If an integer constant can't be generated from an integer literal

because of overflow, generate a long instead.
This commit is contained in:
Jeremy Hylton 2001-08-27 19:45:25 +00:00
parent 9aa70d93aa
commit 71b6af91d3
1 changed files with 2 additions and 5 deletions

View File

@ -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 */