[Python-checkins] r75743 - python/trunk/Modules/cPickle.c
eric.smith
python-checkins at python.org
Tue Oct 27 12:32:11 CET 2009
Author: eric.smith
Date: Tue Oct 27 12:32:11 2009
New Revision: 75743
Log:
Issue 7117: Replace PyOS_ascii_strtod with PyOS_string_to_double in cPickle as part of short float repr.
Modified:
python/trunk/Modules/cPickle.c
Modified: python/trunk/Modules/cPickle.c
==============================================================================
--- python/trunk/Modules/cPickle.c (original)
+++ python/trunk/Modules/cPickle.c Tue Oct 27 12:32:11 2009
@@ -3552,11 +3552,11 @@
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;
More information about the Python-checkins
mailing list