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

Skip to content

Commit 6e4f7a8

Browse files
committed
[Bug #812325 ] tarfile.close() can write out more bytes to the output
than are specified by the buffer size. The patch calls .__write() to ensure that any full blocks are written out.
1 parent b914ef0 commit 6e4f7a8

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

Lib/tarfile.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -353,6 +353,7 @@ def close(self):
353353
if self.mode == "w" and self.buf:
354354
if self.type != "tar":
355355
self.buf += self.cmp.flush()
356+
self.__write("") # Write remaining blocks to output
356357
self.fileobj.write(self.buf)
357358
self.buf = ""
358359
if self.type == "gz":

0 commit comments

Comments
 (0)