summaryrefslogtreecommitdiffstats
path: root/Objects/longobject.c
diff options
context:
space:
mode:
Diffstat (limited to 'Objects/longobject.c')
-rw-r--r--Objects/longobject.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/Objects/longobject.c b/Objects/longobject.c
index dc7ce87..4b7eee0 100644
--- a/Objects/longobject.c
+++ b/Objects/longobject.c
@@ -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;