From: Andrew M. Kuchling Date: Fri, 2 Jan 2004 15:44:29 +0000 (+0000) Subject: [Bug #812325 ] tarfile.close() can write out more bytes to the output X-Git-Tag: v2.4a1~1000 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=6e4f7a82da178c7c69dc8cbe65284bf7d1bb5a61;p=thirdparty%2FPython%2Fcpython.git [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. --- diff --git a/Lib/tarfile.py b/Lib/tarfile.py index 26f9c7f6acff..6f44146920d0 100644 --- a/Lib/tarfile.py +++ b/Lib/tarfile.py @@ -353,6 +353,7 @@ class _Stream: if self.mode == "w" and self.buf: if self.type != "tar": self.buf += self.cmp.flush() + self.__write("") # Write remaining blocks to output self.fileobj.write(self.buf) self.buf = "" if self.type == "gz":