From: Mark Dickinson Date: Fri, 9 May 2008 13:55:01 +0000 (+0000) Subject: Issue 2801: fix bug in float.is_integer where ValueError was incorrectly X-Git-Tag: v3.0b1~429 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=c4352b061a6d6cb35c4364ccfb827ff6c2715553;p=python Issue 2801: fix bug in float.is_integer where ValueError was incorrectly raised. --- diff --git a/Misc/NEWS b/Misc/NEWS index 32d1b5d3a7..0b58d3a08f 100644 --- 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 ----------------- diff --git a/Objects/floatobject.c b/Objects/floatobject.c index a748abbdad..76a5c2c5ed 100644 --- a/Objects/floatobject.c +++ b/Objects/floatobject.c @@ -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)