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
ab396e07
Commit
ab396e07
authored
Jul 16, 2008
by
Mark Dickinson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue #3360: Fix incorrect parsing of '020000000000.0'.
This is a backport of r65005.
parent
4fed741c
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
8 additions
and
10 deletions
+8
-10
Lib/test/test_compile.py
Lib/test/test_compile.py
+4
-0
Misc/NEWS
Misc/NEWS
+3
-0
Python/ast.c
Python/ast.c
+1
-10
No files found.
Lib/test/test_compile.py
View file @
ab396e07
...
...
@@ -209,6 +209,10 @@ if 1:
self
.
assertEqual
(
eval
(
"000000000000007"
),
7
)
self
.
assertEqual
(
eval
(
"000000000000008."
),
8.
)
self
.
assertEqual
(
eval
(
"000000000000009."
),
9.
)
self
.
assertEqual
(
eval
(
"020000000000.0"
),
20000000000.0
)
self
.
assertEqual
(
eval
(
"037777777777e0"
),
37777777777.0
)
self
.
assertEqual
(
eval
(
"01000000000000000000000.0"
),
1000000000000000000000.0
)
def
test_unary_minus
(
self
):
# Verify treatment of unary minus on negative numbers SF bug #660455
...
...
Misc/NEWS
View file @
ab396e07
...
...
@@ -12,6 +12,9 @@ What's New in Python 2.5.3?
Core and builtins
-----------------
- Issue #3360: Fix incorrect parsing of '
020000000000.0
', which
produced a ValueError instead of giving the correct float.
- Issue #3242: Fix a crash inside the print statement, if sys.stdout is
set to a custom object whose write() method happens to install
another file in sys.stdout.
...
...
Python/ast.c
View file @
ab396e07
...
...
@@ -3067,16 +3067,7 @@ parsenumber(const char *s)
#endif
if
(
*
end
==
'l'
||
*
end
==
'L'
)
return
PyLong_FromString
((
char
*
)
s
,
(
char
**
)
0
,
0
);
if
(
s
[
0
]
==
'0'
)
{
x
=
(
long
)
PyOS_strtoul
((
char
*
)
s
,
(
char
**
)
&
end
,
0
);
if
(
x
<
0
&&
errno
==
0
)
{
return
PyLong_FromString
((
char
*
)
s
,
(
char
**
)
0
,
0
);
}
}
else
x
=
PyOS_strtol
((
char
*
)
s
,
(
char
**
)
&
end
,
0
);
x
=
PyOS_strtol
((
char
*
)
s
,
(
char
**
)
&
end
,
0
);
if
(
*
end
==
'\0'
)
{
if
(
errno
!=
0
)
return
PyLong_FromString
((
char
*
)
s
,
(
char
**
)
0
,
0
);
...
...
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