summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Lib/gzip.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/Lib/gzip.py b/Lib/gzip.py
index 1c196a8..578a07b 100644
--- a/Lib/gzip.py
+++ b/Lib/gzip.py
@@ -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()