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).
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 @@
goto overflow;
errno = 0;
x = ldexp(x, e * SHIFT);
- if (errno == ERANGE)
+ if (Py_OVERFLOWED(x))
goto overflow;
return x;
@@ -1607,7 +1607,7 @@
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);