Added __del__ method to GzipFile class that will flush and close the

object, if required.
This commit is contained in:
Andrew M. Kuchling 1999-08-10 13:19:30 +00:00
parent 68921dfa31
commit 916fcc3b18

View file

@ -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()