Flush bz2 data even if nothing had been written so far. Fixes #1013882.

Will backport to 2.3.
This commit is contained in:
Martin v. Löwis 2004-08-22 21:28:33 +00:00
parent 70aa1f2095
commit c234a52458
2 changed files with 9 additions and 3 deletions

View file

@ -350,9 +350,9 @@ class _Stream:
if self.closed:
return
if self.mode == "w" and self.type != "tar":
self.buf += self.cmp.flush()
if self.mode == "w" and self.buf:
if self.type != "tar":
self.buf += self.cmp.flush()
self.fileobj.write(self.buf)
self.buf = ""
if self.type == "gz":