diff options
author | Christian Heimes <christian@cheimes.de> | 2008-01-15 02:01:20 (GMT) |
---|---|---|
committer | Christian Heimes <christian@cheimes.de> | 2008-01-15 02:01:20 (GMT) |
commit | 386cd1e3c950b038fefefbf5ad887fd7f3215dc8 (patch) | |
tree | cfe938b184856e4e94c9dc4f3519c371a943fd3d /Objects | |
parent | 62fe8a8e1cda9b4568453bee7e514aae06dfafd1 (diff) | |
download | cpython-386cd1e3c950b038fefefbf5ad887fd7f3215dc8.zip cpython-386cd1e3c950b038fefefbf5ad887fd7f3215dc8.tar.gz cpython-386cd1e3c950b038fefefbf5ad887fd7f3215dc8.tar.bz2 |
long(float('nan')) raises an OverflowError as discussed on the mailing list a week ago
Diffstat (limited to 'Objects')
-rw-r--r-- | Objects/longobject.c | 4 |
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; |