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.)
This commit is contained in:
Mark Dickinson 2008-05-09 16:14:15 +00:00
parent 17433d206c
commit e81c376080
2 changed files with 4 additions and 0 deletions

View file

@ -1031,6 +1031,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)