]> granicus.if.org Git - python/commitdiff
Patch #1110248: SYNC_FLUSH the zlib buffer for GZipFile.flush.
authorMartin v. Löwis <martin@v.loewis.de>
Thu, 3 Mar 2005 08:35:22 +0000 (08:35 +0000)
committerMartin v. Löwis <martin@v.loewis.de>
Thu, 3 Mar 2005 08:35:22 +0000 (08:35 +0000)
Partially fixes #1110242.

Lib/gzip.py
Misc/NEWS

index 5f638c4e6d4e5ed54145d5b9015810ccd3412807..48bd522a7138031614a5f115882256e63be9f639 100644 (file)
@@ -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):
index 0912e00e5dc47d5d0f50370f81d2d6a64eefbb82..5bbc921c0a708ca9aefc56a1226c7ed4e56052d9 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -59,6 +59,8 @@ Extension Modules
 Library
 -------
 
+- Patch #1110248: SYNC_FLUSH the zlib buffer for GZipFile.flush.
+
 - Patch #1107973: Allow to iterate over the lines of a tarfile.ExFileObject.
 
 - Patch #1104111: Alter setup.py --help and --help-commands.