Merged revisions 68903,68906 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r68903 | mark.dickinson | 2009-01-24 16:40:29 +0000 (Sat, 24 Jan 2009) | 5 lines
Issue #1672332: Fix unpickling of subnormal floats, which was raising
ValueError on some platforms as a result of the platform strtod setting
errno on underflow.
........
r68906 | mark.dickinson | 2009-01-24 21:08:38 +0000 (Sat, 24 Jan 2009) | 2 lines
Issue #3657: fix occasional test_pickletools failures.
........
diff --git a/Modules/_pickle.c b/Modules/_pickle.c
index 6536e6f..5813fd4 100644
--- a/Modules/_pickle.c
+++ b/Modules/_pickle.c
@@ -2958,7 +2958,8 @@
errno = 0;
d = PyOS_ascii_strtod(s, &endptr);
- if (errno || (endptr[0] != '\n') || (endptr[1] != '\0')) {
+ if ((errno == ERANGE && !(fabs(d) <= 1.0)) ||
+ (endptr[0] != '\n') || (endptr[1] != '\0')) {
PyErr_SetString(PyExc_ValueError, "could not convert string to float");
return -1;
}