[Python-checkins] r75824 - python/trunk/Python/ast.c

eric.smith python-checkins at python.org
Tue Oct 27 19:33:14 CET 2009


Author: eric.smith
Date: Tue Oct 27 19:33:14 2009
New Revision: 75824

Log:
Removed PyOS_ascii_atof from ast.c, as mentioned in issue 7117.

Modified:
   python/trunk/Python/ast.c

Modified: python/trunk/Python/ast.c
==============================================================================
--- python/trunk/Python/ast.c	(original)
+++ python/trunk/Python/ast.c	Tue Oct 27 19:33:14 2009
@@ -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);
         }
 }


More information about the Python-checkins mailing list