aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars Gustäbel <lars@gustaebel.de>2015-07-02 19:41:03 +0200
committerLars Gustäbel <lars@gustaebel.de>2015-07-02 19:41:03 +0200
commit49c521fd5d3102916045551019368eae66dc7696 (patch)
treeb51dc93916098c3c58bf9c89807341c2f499bdc0 /Lib/tarfile.py
parentMerge 3.4 (diff)
parentIssue #24514: tarfile now tolerates number fields consisting of only whitespace. (diff)
downloadcpython-49c521fd5d3102916045551019368eae66dc7696.tar.gz
cpython-49c521fd5d3102916045551019368eae66dc7696.tar.bz2
cpython-49c521fd5d3102916045551019368eae66dc7696.zip
Merge with 3.4: Issue #24514: tarfile now tolerates number fields consisting of only whitespace.
Diffstat (limited to 'Lib/tarfile.py')
-rwxr-xr-xLib/tarfile.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/Lib/tarfile.py b/Lib/tarfile.py
index bf2234f6376..d1279d2bf58 100755
--- a/Lib/tarfile.py
+++ b/Lib/tarfile.py
@@ -178,7 +178,8 @@ def nti(s):
n = -(256 ** (len(s) - 1) - n)
else:
try:
- n = int(nts(s, "ascii", "strict") or "0", 8)
+ s = nts(s, "ascii", "strict")
+ n = int(s.strip() or "0", 8)
except ValueError:
raise InvalidHeaderError("invalid header")
return n