diff options
author | Eric Smith <eric@trueblade.com> | 2009-10-27 11:32:11 (GMT) |
---|---|---|
committer | Eric Smith <eric@trueblade.com> | 2009-10-27 11:32:11 (GMT) |
commit | 97be1ca1d9f385996e11cf157b3348392266e778 (patch) | |
tree | 569ba7550f42917f035e4cea281cd8466f0e7d7c /Modules/cPickle.c | |
parent | 7582ec36b2aaa5c7ef236b3989a96567745acea3 (diff) | |
download | cpython-97be1ca1d9f385996e11cf157b3348392266e778.zip cpython-97be1ca1d9f385996e11cf157b3348392266e778.tar.gz cpython-97be1ca1d9f385996e11cf157b3348392266e778.tar.bz2 |
Issue 7117: Replace PyOS_ascii_strtod with PyOS_string_to_double in cPickle as part of short float repr.
Diffstat (limited to 'Modules/cPickle.c')
-rw-r--r-- | Modules/cPickle.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/Modules/cPickle.c b/Modules/cPickle.c index a2261cc..ab59b76 100644 --- a/Modules/cPickle.c +++ b/Modules/cPickle.c @@ -3552,11 +3552,11 @@ load_float(Unpicklerobject *self) if (len < 2) return bad_readline(); if (!( s=pystrndup(s,len))) return -1; - errno = 0; - d = PyOS_ascii_strtod(s, &endptr); + d = PyOS_string_to_double(s, &endptr, PyExc_OverflowError); - if ((errno == ERANGE && !(fabs(d) <= 1.0)) || - (endptr[0] != '\n') || (endptr[1] != '\0')) { + if (d == -1.0 && PyErr_Occurred()) { + goto finally; + } else if ((endptr[0] != '\n') || (endptr[1] != '\0')) { PyErr_SetString(PyExc_ValueError, "could not convert string to float"); goto finally; |