From: Martin v. Löwis Date: Thu, 3 Mar 2005 08:35:22 +0000 (+0000) Subject: Patch #1110248: SYNC_FLUSH the zlib buffer for GZipFile.flush. X-Git-Tag: v2.5a0~1982 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=f2a8d63e4fac18c794ab99fd46999b36de35d11d;p=thirdparty%2FPython%2Fcpython.git Patch #1110248: SYNC_FLUSH the zlib buffer for GZipFile.flush. Partially fixes #1110242. --- diff --git a/Lib/gzip.py b/Lib/gzip.py index 5f638c4e6d4e..48bd522a7138 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): diff --git a/Misc/NEWS b/Misc/NEWS index 0912e00e5dc4..5bbc921c0a70 100644 --- 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.