]> granicus.if.org Git - python/commitdiff
Issue 2801: fix bug in float.is_integer where ValueError was incorrectly
authorMark Dickinson <dickinsm@gmail.com>
Fri, 9 May 2008 13:55:01 +0000 (13:55 +0000)
committerMark Dickinson <dickinsm@gmail.com>
Fri, 9 May 2008 13:55:01 +0000 (13:55 +0000)
raised.

Misc/NEWS
Objects/floatobject.c

index 32d1b5d3a7c6780bc6973d5fb513a15ea6ab8a83..0b58d3a08f0effc313d27dc4fbda2ecd3fe3a340 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -12,6 +12,9 @@ What's new in Python 3.0b1?
 Core and Builtins
 -----------------
 
+- Issue 2801: fix bug in the float.is_integer method where a ValueError
+  was sometimes incorrectly raised.
+
 Extension Modules
 -----------------
 
index a748abbdada63799a20c258adebb71e00e924dcb..76a5c2c5edc2465395c1fc96178a46dbd365046b 100644 (file)
@@ -900,6 +900,7 @@ float_is_integer(PyObject *v)
                return NULL;
        if (!Py_IS_FINITE(x))
                Py_RETURN_FALSE;
+       errno = 0;
        PyFPE_START_PROTECT("is_integer", return NULL)
        o = (floor(x) == x) ? Py_True : Py_False;
        PyFPE_END_PROTECT(x)