[Python-checkins] r75913 - python/trunk/Modules/_json.c

eric.smith python-checkins at python.org
Wed Oct 28 09:44:38 CET 2009


Author: eric.smith
Date: Wed Oct 28 09:44:37 2009
New Revision: 75913

Log:
Issue 7117: Replace PyOS_ascii_strtod with PyOS_string_to_double in _json.c as part of short float repr. Change made after consulting with Bob Ippolito. This completes the removal of calls to PyOS_ascii_strtod.

Modified:
   python/trunk/Modules/_json.c

Modified: python/trunk/Modules/_json.c
==============================================================================
--- python/trunk/Modules/_json.c	(original)
+++ python/trunk/Modules/_json.c	Wed Oct 28 09:44:37 2009
@@ -1405,7 +1405,11 @@
             rval = PyObject_CallFunctionObjArgs(s->parse_float, numstr, NULL);
         }
         else {
-            rval = PyFloat_FromDouble(PyOS_ascii_atof(PyString_AS_STRING(numstr)));
+            double d = PyOS_string_to_double(PyString_AS_STRING(numstr),
+                                             NULL, NULL);
+            if (d == -1.0 && PyErr_Occurred())
+                return NULL;
+            rval = PyFloat_FromDouble(d);
         }
     }
     else {


More information about the Python-checkins mailing list