]> granicus.if.org Git - python/commitdiff
Issue 7117: Replace PyOS_ascii_strtod with PyOS_string_to_double in cPickle as part...
authorEric Smith <eric@trueblade.com>
Tue, 27 Oct 2009 11:32:11 +0000 (11:32 +0000)
committerEric Smith <eric@trueblade.com>
Tue, 27 Oct 2009 11:32:11 +0000 (11:32 +0000)
Modules/cPickle.c

index a2261cc9da3f8a1d60a9542fffb5aad9ce8112c5..ab59b7691e90ca5ac7010aef156ab6da11f5dd61 100644 (file)
@@ -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;