projects
/
python
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
c554505
)
if the GzipFile constructor fails, the __del__ method is still
author
Jeremy Hylton
<jeremy@alum.mit.edu>
Mon, 8 May 2000 16:59:59 +0000
(16:59 +0000)
committer
Jeremy Hylton
<jeremy@alum.mit.edu>
Mon, 8 May 2000 16:59:59 +0000
(16:59 +0000)
called. catch the resulting AttributeError and exit cleanly.
Lib/gzip.py
patch
|
blob
|
history
diff --git
a/Lib/gzip.py
b/Lib/gzip.py
index 25278bef3b7c1c4234ef6b863ba06ddb860ecacd..43501d40a7a8ff65670e64da5b534008140681a2 100644
(file)
--- a/
Lib/gzip.py
+++ b/
Lib/gzip.py
@@
-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()