File tree Expand file tree Collapse file tree 2 files changed +5
-0
lines changed
Expand file tree Collapse file tree 2 files changed +5
-0
lines changed Original file line number Diff line number Diff line change @@ -16,6 +16,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
1616- ` MemFS ` now immediately releases all memory it holds when ` close() ` is called,
1717 rather than when it gets garbage collected. Closes [ issue #308 ] ( https://github.com/PyFilesystem/pyfilesystem2/issues/308 ) .
1818- ` FTPFS ` now translates ` EOFError ` into ` RemoteConnectionError ` . Closes [ #292 ] ( https://github.com/PyFilesystem/pyfilesystem2/issues/292 )
19+ - Added automatic close for filesystems that go out of scope. Fixes [ #298 ] ( https://github.com/PyFilesystem/pyfilesystem2/issues/298 )
1920
2021## [ 2.4.8] - 2019-06-12
2122
Original file line number Diff line number Diff line change @@ -112,6 +112,10 @@ def __init__(self):
112112 self ._lock = threading .RLock ()
113113 super (FS , self ).__init__ ()
114114
115+ def __del__ (self ):
116+ """Auto-close the filesystem on exit."""
117+ self .close ()
118+
115119 def __enter__ (self ):
116120 # type: (...) -> FS
117121 """Allow use of filesystem as a context manager.
You can’t perform that action at this time.
0 commit comments