Commit f6a8e880 authored by Marius Wachtler's avatar Marius Wachtler

Fix int('0x000', 2)

parent a0aa3971
......@@ -196,11 +196,11 @@ extern "C" PyObject* PyInt_FromString(const char* s, char** pend, int base) noex
s++;
errno = 0;
if (base == 0 && s[0] == '0') {
x = (long)strtoul(s, &end, base);
x = (long)PyOS_strtoul(const_cast<char*>(s), &end, base);
if (x < 0)
return PyLong_FromString(s, pend, base);
} else
x = strtol(s, &end, base);
x = PyOS_strtol(const_cast<char*>(s), &end, base);
if (end == s || !isalnum(Py_CHARMASK(end[-1])))
goto bad;
while (*end && isspace(Py_CHARMASK(*end)))
......
......@@ -67,6 +67,7 @@ print type(int(L()))
print int(u'123')
print int("9223372036854775808", 0)
print int("0b101", 2), int("0b101", 0)
print 1 << 63, 1 << 64, -1 << 63, -1 << 64, 2 << 63
print type(1 << 63), type(1 << 64), type(-1 << 63), type(-1 << 64), type(2 << 63)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment