summaryrefslogtreecommitdiff
path: root/Lib/tarfile.py
diff options
context:
space:
mode:
authorLars Gustäbel <lars@gustaebel.de>2015-07-02 19:42:09 +0200
committerLars Gustäbel <lars@gustaebel.de>2015-07-02 19:42:09 +0200
commit60eaba04cdfe47eeac1163f40f750a6586714da9 (patch)
tree5a997fb24a6aa30859cfc2f482485b474993aa2a /Lib/tarfile.py
parent63d80b71b3cc5a1180026a77e6329e0324974b3d (diff)
parent49c521fd5d3102916045551019368eae66dc7696 (diff)
downloadcpython-git-60eaba04cdfe47eeac1163f40f750a6586714da9.tar.gz
Merge with 3.5: 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 bf2234f637..d1279d2bf5 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