[Python-checkins] r62943 - in python/trunk: Misc/NEWS Objects/floatobject.c

mark.dickinson python-checkins at python.org
Fri May 9 18:14:16 CEST 2008


Author: mark.dickinson
Date: Fri May  9 18:14:15 2008
New Revision: 62943

Log:
Issue #2801: fix bug in float.is_integer where ValueError
could be incorrectly raised.  This is a backport of the
Py3k fix in r62939.  (Should really have been fixed
in the trunk first and svnmerged into py3k.)


Modified:
   python/trunk/Misc/NEWS
   python/trunk/Objects/floatobject.c

Modified: python/trunk/Misc/NEWS
==============================================================================
--- python/trunk/Misc/NEWS	(original)
+++ python/trunk/Misc/NEWS	Fri May  9 18:14:15 2008
@@ -12,6 +12,9 @@
 Core and Builtins
 -----------------
 
+- Issue #2801: fix bug in the float.is_integer method where a ValueError
+  was sometimes incorrectly raised.
+
 - Issue #2790: sys.flags was not properly exposing its bytes_warning attribute.
 
 Extension Modules

Modified: python/trunk/Objects/floatobject.c
==============================================================================
--- python/trunk/Objects/floatobject.c	(original)
+++ python/trunk/Objects/floatobject.c	Fri May  9 18:14:15 2008
@@ -1031,6 +1031,7 @@
 		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)


More information about the Python-checkins mailing list