summaryrefslogtreecommitdiffstats
path: root/Lib/gzip.py
diff options
context:
space:
mode:
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 45fae9f..9d8dac5 100644
--- a/Lib/gzip.py
+++ b/Lib/gzip.py
@@ -323,6 +323,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)