]> granicus.if.org Git - python/commitdiff
Removed PyOS_ascii_atof from ast.c, as mentioned in issue 7117.
authorEric Smith <eric@trueblade.com>
Tue, 27 Oct 2009 18:33:14 +0000 (18:33 +0000)
committerEric Smith <eric@trueblade.com>
Tue, 27 Oct 2009 18:33:14 +0000 (18:33 +0000)
Python/ast.c

index 3422c2e1b0dd51d714898b5ffb8ada59829139b3..347da2aa95669ad368874c772a63f701d635a2a4 100644 (file)
@@ -3236,17 +3236,17 @@ parsenumber(struct compiling *c, const char *s)
 #ifndef WITHOUT_COMPLEX
         if (imflag) {
                 complex.real = 0.;
-                PyFPE_START_PROTECT("atof", return 0)
-                complex.imag = PyOS_ascii_atof(s);
-                PyFPE_END_PROTECT(complex)
+                complex.imag = PyOS_string_to_double(s, (char **)&end, NULL);
+                if (complex.imag == -1.0 && PyErr_Occurred())
+                        return NULL;
                 return PyComplex_FromCComplex(complex);
         }
         else
 #endif
         {
-                PyFPE_START_PROTECT("atof", return 0)
-                dx = PyOS_ascii_atof(s);
-                PyFPE_END_PROTECT(dx)
+                dx = PyOS_string_to_double(s, NULL, NULL);
+                if (dx == -1.0 && PyErr_Occurred())
+                        return NULL;
                 return PyFloat_FromDouble(dx);
         }
 }