commit | c234a5245814af7334b5b35cd643b603b7525b50 | [log] [tgz] |
---|---|---|
author | Martin v. Löwis <martin@v.loewis.de> | Sun Aug 22 21:28:33 2004 +0000 |
committer | Martin v. Löwis <martin@v.loewis.de> | Sun Aug 22 21:28:33 2004 +0000 |
tree | ee997741da9f9e733cfafd523f839a99bb5d7009 | |
parent | 70aa1f20951a443dcd6387a23a8835bde596055f [diff] [blame] |
Flush bz2 data even if nothing had been written so far. Fixes #1013882. Will backport to 2.3.
diff --git a/Lib/tarfile.py b/Lib/tarfile.py index ff9f51f..2d5bf64 100644 --- a/Lib/tarfile.py +++ b/Lib/tarfile.py
@@ -350,9 +350,9 @@ 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":