Commit 1df4f326 authored by Guido van Rossum's avatar Guido van Rossum

Patch by Tim Peters fixing PR#89:

long(+/- infinity) returns nonsense.
parent af82c694
......@@ -145,6 +145,11 @@ PyLong_FromDouble(dval)
double frac;
int i, ndig, expo, neg;
neg = 0;
if (dval && dval * 0.5 == dval) {
PyErr_SetString(PyExc_OverflowError,
"cannot convert float infinity to long");
return NULL;
}
if (dval < 0.0) {
neg = 1;
dval = -dval;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment