]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[Bug #812325 ] tarfile.close() can write out more bytes to the output
authorAndrew M. Kuchling <amk@amk.ca>
Fri, 2 Jan 2004 15:44:29 +0000 (15:44 +0000)
committerAndrew M. Kuchling <amk@amk.ca>
Fri, 2 Jan 2004 15:44:29 +0000 (15:44 +0000)
   than are specified by the buffer size.  The patch calls .__write()
   to ensure that any full blocks are written out.

Lib/tarfile.py

index 26f9c7f6acff459cdbc16604bb8a10627f5db136..6f44146920d080d342bd2e9edb3dc0eb01298131 100644 (file)
@@ -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":