diff Python/compile.c @ 19502:62bf9401a1ac legacy-trunk

If an integer constant can't be generated from an integer literal because of overflow, generate a long instead.
author Jeremy Hylton <jeremy@alum.mit.edu>
date Mon, 27 Aug 2001 19:45:25 +0000
parents 7257e87e0720
children 04fd3869c6bb
line wrap: on
line diff
--- a/Python/compile.c	Mon Aug 27 19:19:28 2001 +0000
+++ b/Python/compile.c	Mon Aug 27 19:45:25 2001 +0000
@@ -1084,11 +1084,8 @@
 	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 */