mirror of
https://github.com/Farama-Foundation/Gymnasium.git
synced 2025-08-23 23:12:46 +00:00
Fix close_extras not implemented by default in VectorEnv (#2507)
This commit is contained in:
@@ -488,6 +488,10 @@ class AsyncVectorEnv(VectorEnv):
|
||||
logger.error("Raising the last exception back to the main process.")
|
||||
raise exctype(value)
|
||||
|
||||
def __del__(self):
|
||||
if not getattr(self, "closed", True):
|
||||
self.close(terminate=True)
|
||||
|
||||
|
||||
def _worker(index, env_fn, pipe, parent_pipe, shared_memory, error_queue):
|
||||
assert shared_memory is None
|
||||
|
@@ -97,7 +97,7 @@ class VectorEnv(gym.Env):
|
||||
|
||||
def close_extras(self, **kwargs):
|
||||
r"""Clean up the extra resources e.g. beyond what's in this base class."""
|
||||
raise NotImplementedError()
|
||||
pass
|
||||
|
||||
def close(self, **kwargs):
|
||||
r"""Close all sub-environments and release resources.
|
||||
@@ -142,7 +142,7 @@ class VectorEnv(gym.Env):
|
||||
|
||||
def __del__(self):
|
||||
if not getattr(self, "closed", True):
|
||||
self.close(terminate=True)
|
||||
self.close()
|
||||
|
||||
def __repr__(self):
|
||||
if self.spec is None:
|
||||
|
Reference in New Issue
Block a user