[Python-checkins] python/dist/src/Python ast.c,1.1.2.55,1.1.2.56

bcannon at users.sourceforge.net bcannon at users.sourceforge.net
Mon Mar 21 01:00:57 CET 2005


Update of /cvsroot/python/python/dist/src/Python
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4474/Python

Modified Files:
      Tag: ast-branch
	ast.c 
Log Message:
Fix handling large octal numbers.

Applies #1166879.  Thanks Nick Coghlan.


Index: ast.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Python/Attic/ast.c,v
retrieving revision 1.1.2.55
retrieving revision 1.1.2.56
diff -u -d -r1.1.2.55 -r1.1.2.56
--- ast.c	16 Jan 2005 17:09:11 -0000	1.1.2.55
+++ ast.c	21 Mar 2005 00:00:54 -0000	1.1.2.56
@@ -2344,8 +2344,14 @@
 #endif
 	if (*end == 'l' || *end == 'L')
 		return PyLong_FromString((char *)s, (char **)0, 0);
-	if (s[0] == '0')
+	if (s[0] == '0') {
 		x = (long) PyOS_strtoul((char *)s, (char **)&end, 0);
+ 		if (x < 0 && errno == 0) {
+	 			return PyLong_FromString((char *)s,
+							 (char **)0,
+							 0);
+		}
+	}
 	else
 		x = PyOS_strtol((char *)s, (char **)&end, 0);
 	if (*end == '\0') {



More information about the Python-checkins mailing list