commit | 1a23c2484ece91d06f75d9ebdaf2ada951c87c82 | [log] [tgz] |
---|---|---|
author | Guido van Rossum <guido@python.org> | Mon Sep 27 17:11:52 1999 +0000 |
committer | Guido van Rossum <guido@python.org> | Mon Sep 27 17:11:52 1999 +0000 |
tree | 3c8483c25d1939d013949a3b15b0eee79e199489 | |
parent | a840fca15590f2369bb5381be86d13ce12563f73 [diff] |
Patch by Tim Peters fixing PR#89: long(+/- infinity) returns nonsense.
diff --git a/Objects/longobject.c b/Objects/longobject.c index 7c805a5..9f605a1 100644 --- a/Objects/longobject.c +++ b/Objects/longobject.c
@@ -145,6 +145,11 @@ 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;