summaryrefslogtreecommitdiffstats
path: root/Lib/tarfile.py
diff options
context:
space:
mode:
authorMartin v. Löwis <martin@v.loewis.de>2004-08-22 21:28:33 (GMT)
committerMartin v. Löwis <martin@v.loewis.de>2004-08-22 21:28:33 (GMT)
commitc234a5245814af7334b5b35cd643b603b7525b50 (patch)
treeee997741da9f9e733cfafd523f839a99bb5d7009 /Lib/tarfile.py
parent70aa1f20951a443dcd6387a23a8835bde596055f (diff)
downloadcpython-c234a5245814af7334b5b35cd643b603b7525b50.zip
cpython-c234a5245814af7334b5b35cd643b603b7525b50.tar.gz
cpython-c234a5245814af7334b5b35cd643b603b7525b50.tar.bz2
Flush bz2 data even if nothing had been written so far. Fixes #1013882.
Will backport to 2.3.
Diffstat (limited to 'Lib/tarfile.py')
-rw-r--r--Lib/tarfile.py4
1 files changed, 2 insertions, 2 deletions
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 @@ 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":