[Python-checkins] r52021 - in python/branches/release24-maint: Lib/gzip.py Misc/NEWS

andrew.kuchling python-checkins at python.org
Wed Sep 27 21:37:30 CEST 2006


Author: andrew.kuchling
Date: Wed Sep 27 21:37:27 2006
New Revision: 52021

Modified:
   python/branches/release24-maint/Lib/gzip.py
   python/branches/release24-maint/Misc/NEWS
Log:
[Backport rev. 38534 by loewis]

[Possibly controversial because it adds a parameter to a method.
 This parameter isn't documented, however, so arguably it's a private 
 detail, and the fix is necessary to make GzipFile.flush() behave more
 similarly to regular file object.]

Patch #1110248: SYNC_FLUSH the zlib buffer for GZipFile.flush.
Partially fixes #1110242.


Modified: python/branches/release24-maint/Lib/gzip.py
==============================================================================
--- python/branches/release24-maint/Lib/gzip.py	(original)
+++ python/branches/release24-maint/Lib/gzip.py	Wed Sep 27 21:37:27 2006
@@ -332,7 +332,10 @@
             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):

Modified: python/branches/release24-maint/Misc/NEWS
==============================================================================
--- python/branches/release24-maint/Misc/NEWS	(original)
+++ python/branches/release24-maint/Misc/NEWS	Wed Sep 27 21:37:27 2006
@@ -176,6 +176,7 @@
 - Bug #1472827: correctly escape newlines and tabs in attribute values in
   the saxutils.XMLGenerator class.
 
+- Patch #1110248: SYNC_FLUSH the zlib buffer for GZipFile.flush.
 
 Tools/Demos
 -----------


More information about the Python-checkins mailing list