mirror of
https://github.com/python/cpython.git
synced 2025-08-03 16:39:00 +00:00
long(float('nan')) raises an OverflowError as discussed on the mailing list a week ago
This commit is contained in:
parent
62fe8a8e1c
commit
386cd1e3c9
3 changed files with 7 additions and 2 deletions
|
@ -255,7 +255,9 @@ PyLong_FromDouble(double dval)
|
|||
return NULL;
|
||||
}
|
||||
if (Py_IS_NAN(dval)) {
|
||||
return PyLong_FromLong(0L);
|
||||
PyErr_SetString(PyExc_OverflowError,
|
||||
"cannot convert float NaN to int");
|
||||
return NULL;
|
||||
}
|
||||
if (dval < 0.0) {
|
||||
neg = 1;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue