if the GzipFile constructor fails, the __del__ method is still

called.  catch the resulting AttributeError and exit cleanly.
This commit is contained in:
Jeremy Hylton 2000-05-08 16:59:59 +00:00
parent c554505ca1
commit e298c3018c

View file

@ -253,9 +253,13 @@ class GzipFile:
self.myfileobj = None
def __del__(self):
if (self.myfileobj is not None or
self.fileobj is not None):
self.close()
try:
if (self.myfileobj is None and
self.fileobj is None):
return
except AttributeError:
return
self.close()
def flush(self):
self.fileobj.flush()