[Python-checkins] r71963 - python/trunk/Objects/complexobject.c

mark.dickinson python-checkins at python.org
Sun Apr 26 16:00:08 CEST 2009


Author: mark.dickinson
Date: Sun Apr 26 16:00:08 2009
New Revision: 71963

Log:
Reset errno before both calls to PyOS_ascii_strtod, not just one.


Modified:
   python/trunk/Objects/complexobject.c

Modified: python/trunk/Objects/complexobject.c
==============================================================================
--- python/trunk/Objects/complexobject.c	(original)
+++ python/trunk/Objects/complexobject.c	Sun Apr 26 16:00:08 2009
@@ -911,8 +911,6 @@
 		return NULL;
 	}
 
-	errno = 0;
-
 	/* position on first nonblank */
 	start = s;
 	while (*s && isspace(Py_CHARMASK(*s)))
@@ -947,6 +945,7 @@
 	*/
 
 	/* first look for forms starting with <float> */
+	errno = 0;
 	z = PyOS_ascii_strtod(s, &end);
 	if (end == s && errno == ENOMEM)
 		return PyErr_NoMemory();
@@ -959,6 +958,7 @@
 		if (*s == '+' || *s == '-') {
 			/* <float><signed-float>j | <float><sign>j */
 			x = z;
+			errno = 0;
 			y = PyOS_ascii_strtod(s, &end);
 			if (end == s && errno == ENOMEM)
 				return PyErr_NoMemory();


More information about the Python-checkins mailing list