diff options
author | Eric Smith <eric@trueblade.com> | 2009-10-28 08:44:37 +0000 |
---|---|---|
committer | Eric Smith <eric@trueblade.com> | 2009-10-28 08:44:37 +0000 |
commit | 129c97df02c7cd42e9c777bd75c6f81655ac024c (patch) | |
tree | de846130ce9b029e7d18ae6010f3a8f723f36b92 | |
parent | e8486931b69ee954a9a662c60a5f22a850a6bbeb (diff) | |
download | cpython-git-129c97df02c7cd42e9c777bd75c6f81655ac024c.tar.gz |
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.
-rw-r--r-- | Modules/_json.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/Modules/_json.c b/Modules/_json.c index cfe87087d7..7c8abea8f0 100644 --- a/Modules/_json.c +++ b/Modules/_json.c @@ -1405,7 +1405,11 @@ _match_number_str(PyScannerObject *s, PyObject *pystr, Py_ssize_t start, Py_ssiz 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 { |