summaryrefslogtreecommitdiffstats
path: root/Lib/tarfile.py
diff options
context:
space:
mode:
authorRoss Lagerwall <rosslagerwall@gmail.com>2012-05-17 17:49:27 (GMT)
committerRoss Lagerwall <rosslagerwall@gmail.com>2012-05-17 17:49:27 (GMT)
commit468ff4c3ed07b815898a749eca14e9ae1ea76893 (patch)
tree98995406703a6675bc8b95d012c8f26b9fde7946 /Lib/tarfile.py
parent6c6d3a2f9f031fdf8b12a9f9dbeb178e081b8dbc (diff)
downloadcpython-468ff4c3ed07b815898a749eca14e9ae1ea76893.zip
cpython-468ff4c3ed07b815898a749eca14e9ae1ea76893.tar.gz
cpython-468ff4c3ed07b815898a749eca14e9ae1ea76893.tar.bz2
Issue #13031: Small speed-up for tarfile when unzipping tarfiles.
Patch by Justin Peel.
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 9d38421..8549677 100644
--- a/Lib/tarfile.py
+++ b/Lib/tarfile.py
@@ -245,8 +245,8 @@ def calc_chksums(buf):
the high bit set. So we calculate two checksums, unsigned and
signed.
"""
- unsigned_chksum = 256 + sum(struct.unpack("148B", buf[:148]) + struct.unpack("356B", buf[156:512]))
- signed_chksum = 256 + sum(struct.unpack("148b", buf[:148]) + struct.unpack("356b", buf[156:512]))
+ unsigned_chksum = 256 + sum(struct.unpack_from("148B8x356B", buf))
+ signed_chksum = 256 + sum(struct.unpack_from("148b8x356b", buf))
return unsigned_chksum, signed_chksum
def copyfileobj(src, dst, length=None):