Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
49c521fd
Commit
49c521fd
authored
Jul 02, 2015
by
Lars Gustäbel
Browse files
Options
Browse Files
Download
Plain Diff
Merge with 3.4: Issue #24514: tarfile now tolerates number fields consisting of only whitespace.
parents
44f323cb
b7a688b3
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
9 additions
and
1 deletion
+9
-1
Lib/tarfile.py
Lib/tarfile.py
+2
-1
Lib/test/test_tarfile.py
Lib/test/test_tarfile.py
+4
-0
Misc/NEWS
Misc/NEWS
+3
-0
No files found.
Lib/tarfile.py
View file @
49c521fd
...
...
@@ -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
...
...
Lib/test/test_tarfile.py
View file @
49c521fd
...
...
@@ -1952,6 +1952,10 @@ class MiscTest(unittest.TestCase):
self
.
assertEqual
(
tarfile
.
nti
(
b"
\
xff
\
x00
\
x00
\
x00
\
x00
\
x00
\
x00
\
x00
"
),
-
0x100000000000000
)
# Issue 24514: Test if empty number fields are converted to zero.
self
.
assertEqual
(
tarfile
.
nti
(
b"
\
0
"
),
0
)
self
.
assertEqual
(
tarfile
.
nti
(
b"
\
0
"
),
0
)
def
test_write_number_fields
(
self
):
self
.
assertEqual
(
tarfile
.
itn
(
1
),
b"0000001
\
x00
"
)
self
.
assertEqual
(
tarfile
.
itn
(
0o7777777
),
b"7777777
\
x00
"
)
...
...
Misc/NEWS
View file @
49c521fd
...
...
@@ -30,6 +30,9 @@ Core and Builtins
Library
-------
- Issue #24514: tarfile now tolerates number fields consisting of only
whitespace.
- Issue #19176: Fixed doctype() related bugs in C implementation of ElementTree.
A deprecation warning no longer issued by XMLParser subclass with default
doctype() method. Direct call of doctype() now issues a warning. Parser'
s
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment