Issue #3360: Fix incorrect parsing of '020000000000.0'.
This is a backport of r65005.
This commit is contained in:
parent
4fed741c5d
commit
ab396e07cc
|
@ -209,6 +209,10 @@ if 1:
|
||||||
self.assertEqual(eval("000000000000007"), 7)
|
self.assertEqual(eval("000000000000007"), 7)
|
||||||
self.assertEqual(eval("000000000000008."), 8.)
|
self.assertEqual(eval("000000000000008."), 8.)
|
||||||
self.assertEqual(eval("000000000000009."), 9.)
|
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):
|
def test_unary_minus(self):
|
||||||
# Verify treatment of unary minus on negative numbers SF bug #660455
|
# Verify treatment of unary minus on negative numbers SF bug #660455
|
||||||
|
|
|
@ -12,6 +12,9 @@ What's New in Python 2.5.3?
|
||||||
Core and builtins
|
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
|
- Issue #3242: Fix a crash inside the print statement, if sys.stdout is
|
||||||
set to a custom object whose write() method happens to install
|
set to a custom object whose write() method happens to install
|
||||||
another file in sys.stdout.
|
another file in sys.stdout.
|
||||||
|
|
|
@ -3067,15 +3067,6 @@ parsenumber(const char *s)
|
||||||
#endif
|
#endif
|
||||||
if (*end == 'l' || *end == 'L')
|
if (*end == 'l' || *end == 'L')
|
||||||
return PyLong_FromString((char *)s, (char **)0, 0);
|
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 (*end == '\0') {
|
||||||
if (errno != 0)
|
if (errno != 0)
|
||||||
|
|
Loading…
Reference in New Issue