Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit f2a8d63

Browse files
committed
Patch #1110248: SYNC_FLUSH the zlib buffer for GZipFile.flush.
Partially fixes #1110242.
1 parent df24153 commit f2a8d63

2 files changed

Lines changed: 6 additions & 1 deletion

File tree

Lib/gzip.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -331,7 +331,10 @@ def __del__(self):
331331
return
332332
self.close()
333333

334-
def flush(self):
334+
def flush(self,zlib_mode=zlib.Z_SYNC_FLUSH):
335+
if self.mode == WRITE:
336+
# Ensure the compressor's buffer is flushed
337+
self.fileobj.write(self.compress.flush(zlib_mode))
335338
self.fileobj.flush()
336339

337340
def fileno(self):

Misc/NEWS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,8 @@ Extension Modules
5959
Library
6060
-------
6161

62+
- Patch #1110248: SYNC_FLUSH the zlib buffer for GZipFile.flush.
63+
6264
- Patch #1107973: Allow to iterate over the lines of a tarfile.ExFileObject.
6365

6466
- Patch #1104111: Alter setup.py --help and --help-commands.

0 commit comments

Comments
 (0)