[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.
This commit is contained in:
Andrew M. Kuchling 2004-01-02 15:44:29 +00:00
parent b914ef0a33
commit 6e4f7a82da
1 changed files with 1 additions and 0 deletions

View File

@ -353,6 +353,7 @@ class _Stream:
if self.mode == "w" and self.buf: if self.mode == "w" and self.buf:
if self.type != "tar": if self.type != "tar":
self.buf += self.cmp.flush() self.buf += self.cmp.flush()
self.__write("") # Write remaining blocks to output
self.fileobj.write(self.buf) self.fileobj.write(self.buf)
self.buf = "" self.buf = ""
if self.type == "gz": if self.type == "gz":