summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorMark Dickinson <dickinsm@gmail.com>2009-01-24 21:46:33 (GMT)
committerMark Dickinson <dickinsm@gmail.com>2009-01-24 21:46:33 (GMT)
commitcddcf444b257478eb940c50c78eb86ef40eae16f (patch)
tree6594818ecf14ab507cd08f13e756a90693ed2637 /Modules
parent3dfe55b6ff9e7a74bca94d5b95dbfafb9aa2a987 (diff)
downloadcpython-cddcf444b257478eb940c50c78eb86ef40eae16f.zip
cpython-cddcf444b257478eb940c50c78eb86ef40eae16f.tar.gz
cpython-cddcf444b257478eb940c50c78eb86ef40eae16f.tar.bz2
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. ........
Diffstat (limited to 'Modules')
-rw-r--r--Modules/_pickle.c3
1 files changed, 2 insertions, 1 deletions
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 @@ load_float(UnpicklerObject *self)
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;
}