mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
Added __del__ method to GzipFile class that will flush and close the
object, if required.
This commit is contained in:
parent
68921dfa31
commit
916fcc3b18
1 changed files with 5 additions and 0 deletions
|
@ -251,6 +251,11 @@ class GzipFile:
|
|||
self.myfileobj.close()
|
||||
self.myfileobj = None
|
||||
|
||||
def __del__(self):
|
||||
if (self.myfileobj is not None or
|
||||
self.fileobj is not None):
|
||||
self.close()
|
||||
|
||||
def flush(self):
|
||||
self.fileobj.flush()
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue