summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorAntoine Pitrou <solipsis@pitrou.net>2012-05-17 19:04:49 (GMT)
committerAntoine Pitrou <solipsis@pitrou.net>2012-05-17 19:04:49 (GMT)
commit62110c769f9681c7a747d3e136759937222edc7d (patch)
tree32ae53fd41ccf56970967eb7ba66b9a125bb8b8c /Lib
parent314a16b0ececffbe33bbca1242dd53022b018f4a (diff)
parent468ff4c3ed07b815898a749eca14e9ae1ea76893 (diff)
downloadcpython-62110c769f9681c7a747d3e136759937222edc7d.zip
cpython-62110c769f9681c7a747d3e136759937222edc7d.tar.gz
cpython-62110c769f9681c7a747d3e136759937222edc7d.tar.bz2
Merge
Diffstat (limited to 'Lib')
-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):