diff Objects/floatobject.c @ 46792:8baeba13ae93 legacy-trunk

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.)
author Mark Dickinson <dickinsm@gmail.com>
date Fri, 09 May 2008 16:14:15 +0000
parents 5bc7b20dc04a
children 4fe192d48960
line wrap: on
line diff
--- a/Objects/floatobject.c	Fri May 09 12:19:09 2008 +0000
+++ b/Objects/floatobject.c	Fri May 09 16:14:15 2008 +0000
@@ -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)