summaryrefslogtreecommitdiffstats
path: root/Objects/longobject.c
diff options
context:
space:
mode:
authorTim Peters <tim.peters@gmail.com>2001-09-05 05:38:10 (GMT)
committerTim Peters <tim.peters@gmail.com>2001-09-05 05:38:10 (GMT)
commit57f282a2a06c01417abec74926e770fb12f95610 (patch)
tree474fbed4f47abd6f4827747d14d8c4490c2d9450 /Objects/longobject.c
parente5ca6c71cd4a27f855612aeb14e600712cf72e04 (diff)
downloadcpython-57f282a2a06c01417abec74926e770fb12f95610.zip
cpython-57f282a2a06c01417abec74926e770fb12f95610.tar.gz
cpython-57f282a2a06c01417abec74926e770fb12f95610.tar.bz2
Try to recover from that glibc's ldexp apparently doesn't set errno on
overflow. Needs testing on Linux (test_long.py and test_long_future.py especially).
Diffstat (limited to 'Objects/longobject.c')
-rw-r--r--Objects/longobject.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/Objects/longobject.c b/Objects/longobject.c
index 5da5113..91e0b66 100644
--- a/Objects/longobject.c
+++ b/Objects/longobject.c
@@ -545,7 +545,7 @@ PyLong_AsDouble(PyObject *vv)
goto overflow;
errno = 0;
x = ldexp(x, e * SHIFT);
- if (errno == ERANGE)
+ if (Py_OVERFLOWED(x))
goto overflow;
return x;
@@ -1607,7 +1607,7 @@ long_true_divide(PyObject *v, PyObject *w)
goto overflow;
errno = 0;
ad = ldexp(ad, aexp * SHIFT);
- if (ad != 0 && errno == ERANGE) /* ignore underflow to 0.0 */
+ if (Py_OVERFLOWED(ad)) /* ignore underflow to 0.0 */
goto overflow;
return PyFloat_FromDouble(ad);