initialize compression globally for non-“concat” archives
authorPhilipp Gesang <philipp.gesang@intra2net.com>
Thu, 20 Apr 2017 15:53:49 +0000 (17:53 +0200)
committerThomas Jarosch <thomas.jarosch@intra2net.com>
Mon, 2 Apr 2018 11:34:08 +0000 (13:34 +0200)
deltatar/tarfile.py

index a2d21c4..aef4faf 100644 (file)
@@ -464,7 +464,9 @@ class _Stream:
                 self.zlib = zlib
                 if mode == "r":
                     self._init_read_gz()
-                self.exception = zlib.error # XXX what for? seems unused
+                    self.exception = zlib.error
+                elif mode == "w" and concat_stream is False:
+                    self._new_gz_block()
                 self.crc = zlib.crc32(b"") & 0xFFFFffff
 
             elif comptype == "bz2":