Patch by Tim Peters fixing PR#89:
long(+/- infinity) returns nonsense.
This commit is contained in:
parent
a840fca155
commit
1a23c2484e
|
@ -145,6 +145,11 @@ PyLong_FromDouble(dval)
|
||||||
double frac;
|
double frac;
|
||||||
int i, ndig, expo, neg;
|
int i, ndig, expo, neg;
|
||||||
neg = 0;
|
neg = 0;
|
||||||
|
if (dval && dval * 0.5 == dval) {
|
||||||
|
PyErr_SetString(PyExc_OverflowError,
|
||||||
|
"cannot convert float infinity to long");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
if (dval < 0.0) {
|
if (dval < 0.0) {
|
||||||
neg = 1;
|
neg = 1;
|
||||||
dval = -dval;
|
dval = -dval;
|
||||||
|
|
Loading…
Reference in New Issue