Commit 33160ed4 by btimby

__del__() is inherited from FS and redundant.

Synchronize the close() methods.
Ensure the close() methods close and del referenced file systems.
parent 6bcbae3c
...@@ -79,9 +79,6 @@ class ArchiveFS(FS): ...@@ -79,9 +79,6 @@ class ArchiveFS(FS):
else: else:
self.contents[part] = libarchive.Entry(pathname=part, mode=stat.S_IFDIR, size=0, mtime=item.mtime) self.contents[part] = libarchive.Entry(pathname=part, mode=stat.S_IFDIR, size=0, mtime=item.mtime)
def __del__(self):
self.close()
def __str__(self): def __str__(self):
return "<ArchiveFS: %s>" % self.root_path return "<ArchiveFS: %s>" % self.root_path
...@@ -93,6 +90,7 @@ class ArchiveFS(FS): ...@@ -93,6 +90,7 @@ class ArchiveFS(FS):
return self.read_only return self.read_only
return super(ArchiveFS, self).getmeta(meta_name, default) return super(ArchiveFS, self).getmeta(meta_name, default)
@synchronize
def close(self): def close(self):
if getattr(self, 'archive', None) is None: if getattr(self, 'archive', None) is None:
return return
...@@ -185,10 +183,12 @@ class ArchiveMountFS(mountfs.MountFS): ...@@ -185,10 +183,12 @@ class ArchiveMountFS(mountfs.MountFS):
self.rootfs = rootfs self.rootfs = rootfs
self.mountdir('/', rootfs) self.mountdir('/', rootfs)
def __del__(self): @synchronize
# Close (if requested by auto_close, why by default is True) when def close(self):
# de-referenced. # Close and delete references to any other fs instances.
self.close() self.rootfs.close()
del self.rootfs
super(ArchiveMountFS, self).close()
def ismount(self, path): def ismount(self, path):
"Checks if the given path has a file system mounted on it." "Checks if the given path has a file system mounted on it."
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment