summaryrefslogtreecommitdiffstats
path: root/Lib/tarfile.py
diff options
context:
space:
mode:
authorMartin Panter <vadmium+py@gmail.com>2015-12-11 05:19:29 (GMT)
committerMartin Panter <vadmium+py@gmail.com>2015-12-11 05:19:29 (GMT)
commitb82032f935962d13220bba52d26ac607149485eb (patch)
treedd2b37f8a5c8f4e5621739c6f7c5b727727d9542 /Lib/tarfile.py
parent7dda421bfff887da9a84e99c37ef1b0ef9f3cde9 (diff)
downloadcpython-b82032f935962d13220bba52d26ac607149485eb.zip
cpython-b82032f935962d13220bba52d26ac607149485eb.tar.gz
cpython-b82032f935962d13220bba52d26ac607149485eb.tar.bz2
Issue #22341: Drop Python 2 workaround and document CRC initial value
Also align the parameter naming in binascii to be consistent with zlib.
Diffstat (limited to 'Lib/tarfile.py')
-rwxr-xr-xLib/tarfile.py8
1 files changed, 1 insertions, 7 deletions
diff --git a/Lib/tarfile.py b/Lib/tarfile.py
index ca45126..9d22c8e 100755
--- a/Lib/tarfile.py
+++ b/Lib/tarfile.py
@@ -459,13 +459,7 @@ class _Stream:
self.fileobj.write(self.buf)
self.buf = b""
if self.comptype == "gz":
- # The native zlib crc is an unsigned 32-bit integer, but
- # the Python wrapper implicitly casts that to a signed C
- # long. So, on a 32-bit box self.crc may "look negative",
- # while the same crc on a 64-bit box may "look positive".
- # To avoid irksome warnings from the `struct` module, force
- # it to look positive on all boxes.
- self.fileobj.write(struct.pack("<L", self.crc & 0xffffffff))
+ self.fileobj.write(struct.pack("<L", self.crc))
self.fileobj.write(struct.pack("<L", self.pos & 0xffffFFFF))
finally:
if not self._extfileobj: