summaryrefslogtreecommitdiffstats
path: root/Lib/gzip.py
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2008-05-25 08:07:37 (GMT)
committerGeorg Brandl <georg@python.org>2008-05-25 08:07:37 (GMT)
commite08e3d06864c5ad993f74613d9ed4ce69cc6cbc6 (patch)
tree7f8d08a1089aba9d116273c83e4545347967a60a /Lib/gzip.py
parentecd0ad3c573fd606c05fd550c5393a077b1a9c33 (diff)
downloadcpython-e08e3d06864c5ad993f74613d9ed4ce69cc6cbc6.zip
cpython-e08e3d06864c5ad993f74613d9ed4ce69cc6cbc6.tar.gz
cpython-e08e3d06864c5ad993f74613d9ed4ce69cc6cbc6.tar.bz2
#2959: allow multiple close() calls for GzipFile.
Diffstat (limited to 'Lib/gzip.py')
-rw-r--r--Lib/gzip.py2
1 files changed, 2 insertions, 0 deletions
diff --git a/Lib/gzip.py b/Lib/gzip.py
index eeef3f8..7a3f813 100644
--- a/Lib/gzip.py
+++ b/Lib/gzip.py
@@ -306,6 +306,8 @@ class GzipFile:
raise IOError, "Incorrect length of data produced"
def close(self):
+ if self.fileobj is None:
+ return
if self.mode == WRITE:
self.fileobj.write(self.compress.flush())
write32u(self.fileobj, self.crc)