diff options
author | Mark Dickinson <dickinsm@gmail.com> | 2009-01-24 16:40:29 (GMT) |
---|---|---|
committer | Mark Dickinson <dickinsm@gmail.com> | 2009-01-24 16:40:29 (GMT) |
commit | a3ecd2c6689d8376dfda38e4bbd03a43a69a968a (patch) | |
tree | 65e7ed578360ccb54a0c149252851a89eef67f24 /Modules/cPickle.c | |
parent | c187d11af3407ea424d1debf8a37775ea7cdf95f (diff) | |
download | cpython-a3ecd2c6689d8376dfda38e4bbd03a43a69a968a.zip cpython-a3ecd2c6689d8376dfda38e4bbd03a43a69a968a.tar.gz cpython-a3ecd2c6689d8376dfda38e4bbd03a43a69a968a.tar.bz2 |
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.
Diffstat (limited to 'Modules/cPickle.c')
-rw-r--r-- | Modules/cPickle.c | 3 |
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; |