mirror of
https://github.com/python/cpython.git
synced 2025-07-12 13:55:34 +00:00
If an integer constant can't be generated from an integer literal
because of overflow, generate a long instead.
This commit is contained in:
parent
9aa70d93aa
commit
71b6af91d3
1 changed files with 2 additions and 5 deletions
|
@ -1084,11 +1084,8 @@ parsenumber(struct compiling *co, char *s)
|
|||
else
|
||||
x = PyOS_strtol(s, &end, 0);
|
||||
if (*end == '\0') {
|
||||
if (errno != 0) {
|
||||
com_error(co, PyExc_OverflowError,
|
||||
"integer literal too large");
|
||||
return NULL;
|
||||
}
|
||||
if (errno != 0)
|
||||
return PyLong_FromString(s, (char **)0, 0);
|
||||
return PyInt_FromLong(x);
|
||||
}
|
||||
/* XXX Huge floats may silently fail */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue