diff Python/ast.c @ 56856:e99adfc92dc2 legacy-trunk

Removed PyOS_ascii_atof from ast.c, as mentioned in issue 7117.
author Eric Smith <eric@trueblade.com>
date Tue, 27 Oct 2009 18:33:14 +0000
parents cceb62eb1cf1
children 844180b7e6ff
line wrap: on
line diff
--- a/Python/ast.c	Tue Oct 27 17:41:58 2009 +0000
+++ b/Python/ast.c	Tue Oct 27 18:33:14 2009 +0000
@@ -3236,17 +3236,17 @@
 #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);
         }
 }