]> granicus.if.org Git - python/commitdiff
If an integer constant can't be generated from an integer literal
authorJeremy Hylton <jeremy@alum.mit.edu>
Mon, 27 Aug 2001 19:45:25 +0000 (19:45 +0000)
committerJeremy Hylton <jeremy@alum.mit.edu>
Mon, 27 Aug 2001 19:45:25 +0000 (19:45 +0000)
because of overflow, generate a long instead.

Python/compile.c

index c6c33942d201f2197c3e93542da8160a51d21257..d238a302a5e568cbb8b5cf4823edab423f5b4b46 100644 (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 */