summaryrefslogtreecommitdiff
path: root/Lib/zipfile.py
diff options
context:
space:
mode:
authorMartin Panter <vadmium+py@gmail.com>2015-12-11 05:19:29 +0000
committerMartin Panter <vadmium+py@gmail.com>2015-12-11 05:19:29 +0000
commitb82032f935962d13220bba52d26ac607149485eb (patch)
treedd2b37f8a5c8f4e5621739c6f7c5b727727d9542 /Lib/zipfile.py
parent7dda421bfff887da9a84e99c37ef1b0ef9f3cde9 (diff)
downloadcpython-git-b82032f935962d13220bba52d26ac607149485eb.tar.gz
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/zipfile.py')
-rw-r--r--Lib/zipfile.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/Lib/zipfile.py b/Lib/zipfile.py
index bee00d0d68..56a2479fb3 100644
--- a/Lib/zipfile.py
+++ b/Lib/zipfile.py
@@ -734,7 +734,7 @@ class ZipExtFile(io.BufferedIOBase):
if hasattr(zipinfo, 'CRC'):
self._expected_crc = zipinfo.CRC
- self._running_crc = crc32(b'') & 0xffffffff
+ self._running_crc = crc32(b'')
else:
self._expected_crc = None
@@ -856,7 +856,7 @@ class ZipExtFile(io.BufferedIOBase):
if self._expected_crc is None:
# No need to compute the CRC if we don't have a reference value
return
- self._running_crc = crc32(newdata, self._running_crc) & 0xffffffff
+ self._running_crc = crc32(newdata, self._running_crc)
# Check the CRC if we're at the end of the file
if self._eof and self._running_crc != self._expected_crc:
raise BadZipFile("Bad CRC-32 for file %r" % self.name)
@@ -1492,7 +1492,7 @@ class ZipFile:
if not buf:
break
file_size = file_size + len(buf)
- CRC = crc32(buf, CRC) & 0xffffffff
+ CRC = crc32(buf, CRC)
if cmpr:
buf = cmpr.compress(buf)
compress_size = compress_size + len(buf)
@@ -1567,7 +1567,7 @@ class ZipFile:
self._writecheck(zinfo)
self._didModify = True
- zinfo.CRC = crc32(data) & 0xffffffff # CRC-32 checksum
+ zinfo.CRC = crc32(data) # CRC-32 checksum
co = _get_compressor(zinfo.compress_type)
if co:
data = co.compress(data) + co.flush()