diff Python/pystrtod.c @ 48021:40db45bfc0f2 legacy-trunk

Fix issue 3411: default float format spec fails on negative numbers.
author Eric Smith <eric@trueblade.com>
date Sat, 19 Jul 2008 00:24:05 +0000
parents 752e1abaf15a
children f7eccf769c1a c5e0d9beebf9
line wrap: on
line diff
--- a/Python/pystrtod.c	Fri Jul 18 19:30:22 2008 +0000
+++ b/Python/pystrtod.c	Sat Jul 19 00:24:05 2008 +0000
@@ -302,6 +302,10 @@
 
 	/* search for the first non-digit character */
 	char *p = buffer;
+	if (*p == '-' || *p == '+')
+		/* Skip leading sign, if present.  I think this could only
+		   ever be '-', but it can't hurt to check for both. */
+		++p;
 	while (*p && isdigit(Py_CHARMASK(*p)))
 		++p;