[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.
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):
- 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
-----------