summaryrefslogtreecommitdiffstats
path: root/Lib/gzip.py
diff options
context:
space:
mode:
authorMartin v. Löwis <martin@v.loewis.de>2005-03-03 08:35:22 (GMT)
committerMartin v. Löwis <martin@v.loewis.de>2005-03-03 08:35:22 (GMT)
commitf2a8d63e4fac18c794ab99fd46999b36de35d11d (patch)
tree2f04fd5e98974125d0d6bf9acce567f64420e3a1 /Lib/gzip.py
parentdf24153f650f39ca82db143cc4a58062412a0896 (diff)
downloadcpython-f2a8d63e4fac18c794ab99fd46999b36de35d11d.zip
cpython-f2a8d63e4fac18c794ab99fd46999b36de35d11d.tar.gz
cpython-f2a8d63e4fac18c794ab99fd46999b36de35d11d.tar.bz2
Patch #1110248: SYNC_FLUSH the zlib buffer for GZipFile.flush.
Partially fixes #1110242.
Diffstat (limited to 'Lib/gzip.py')
-rw-r--r--Lib/gzip.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/Lib/gzip.py b/Lib/gzip.py
index 5f638c4..48bd522 100644
--- a/Lib/gzip.py
+++ b/Lib/gzip.py
@@ -331,7 +331,10 @@ class GzipFile:
return
self.close()
- def flush(self):
+ def flush(self,zlib_mode=zlib.Z_SYNC_FLUSH):
+ if self.mode == WRITE:
+ # Ensure the compressor's buffer is flushed
+ self.fileobj.write(self.compress.flush(zlib_mode))
self.fileobj.flush()
def fileno(self):