diff options
author | Jeremy Hylton <jeremy@alum.mit.edu> | 2001-08-27 19:45:25 (GMT) |
---|---|---|
committer | Jeremy Hylton <jeremy@alum.mit.edu> | 2001-08-27 19:45:25 (GMT) |
commit | 71b6af91d382a0e084b55f1d519aedc1b71a97d4 (patch) | |
tree | a2cc5cc6e240174dd8197dbb302a9a86574e4fa3 /Python | |
parent | 9aa70d93aae89a9404a58f32f3fcd3c72b1ee56b (diff) | |
download | cpython-71b6af91d382a0e084b55f1d519aedc1b71a97d4.zip cpython-71b6af91d382a0e084b55f1d519aedc1b71a97d4.tar.gz cpython-71b6af91d382a0e084b55f1d519aedc1b71a97d4.tar.bz2 |
If an integer constant can't be generated from an integer literal
because of overflow, generate a long instead.
Diffstat (limited to 'Python')
-rw-r--r-- | Python/compile.c | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/Python/compile.c b/Python/compile.c index c6c3394..d238a30 100644 --- a/Python/compile.c +++ b/Python/compile.c @@ -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 */ |