diff options
author | Lars Gustäbel <lars@gustaebel.de> | 2015-07-02 19:41:03 +0200 |
---|---|---|
committer | Lars Gustäbel <lars@gustaebel.de> | 2015-07-02 19:41:03 +0200 |
commit | 49c521fd5d3102916045551019368eae66dc7696 (patch) | |
tree | b51dc93916098c3c58bf9c89807341c2f499bdc0 /Lib/tarfile.py | |
parent | Merge 3.4 (diff) | |
parent | Issue #24514: tarfile now tolerates number fields consisting of only whitespace. (diff) | |
download | cpython-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-x | Lib/tarfile.py | 3 |
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 |