summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorMark Dickinson <dickinsm@gmail.com>2009-01-24 21:30:14 (GMT)
committerMark Dickinson <dickinsm@gmail.com>2009-01-24 21:30:14 (GMT)
commit3df16920eb7fe8e3e4b571efb50571b697600c2c (patch)
tree5608486e2d6bfc5b1908d5e0d04304e75113d0f8 /Modules
parent42f612a19b784ecc874e98cb657e1cc01d8f75f7 (diff)
downloadcpython-3df16920eb7fe8e3e4b571efb50571b697600c2c.zip
cpython-3df16920eb7fe8e3e4b571efb50571b697600c2c.tar.gz
cpython-3df16920eb7fe8e3e4b571efb50571b697600c2c.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/cPickle.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/Modules/cPickle.c b/Modules/cPickle.c
index 7f836c3..fb13ba1 100644
--- a/Modules/cPickle.c
+++ b/Modules/cPickle.c
@@ -3465,7 +3465,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");
goto finally;