summaryrefslogtreecommitdiffstats
path: root/Modules/_pickle.c
diff options
context:
space:
mode:
Diffstat (limited to 'Modules/_pickle.c')
-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;
}