mirror of
https://github.com/python/cpython.git
synced 2025-10-14 18:59:46 +00:00
Issue 2801: fix bug in float.is_integer where ValueError was incorrectly
raised.
This commit is contained in:
parent
b27406c03e
commit
c4352b061a
2 changed files with 4 additions and 0 deletions
|
@ -12,6 +12,9 @@ What's new in Python 3.0b1?
|
||||||
Core and Builtins
|
Core and Builtins
|
||||||
-----------------
|
-----------------
|
||||||
|
|
||||||
|
- Issue 2801: fix bug in the float.is_integer method where a ValueError
|
||||||
|
was sometimes incorrectly raised.
|
||||||
|
|
||||||
Extension Modules
|
Extension Modules
|
||||||
-----------------
|
-----------------
|
||||||
|
|
||||||
|
|
|
@ -900,6 +900,7 @@ float_is_integer(PyObject *v)
|
||||||
return NULL;
|
return NULL;
|
||||||
if (!Py_IS_FINITE(x))
|
if (!Py_IS_FINITE(x))
|
||||||
Py_RETURN_FALSE;
|
Py_RETURN_FALSE;
|
||||||
|
errno = 0;
|
||||||
PyFPE_START_PROTECT("is_integer", return NULL)
|
PyFPE_START_PROTECT("is_integer", return NULL)
|
||||||
o = (floor(x) == x) ? Py_True : Py_False;
|
o = (floor(x) == x) ? Py_True : Py_False;
|
||||||
PyFPE_END_PROTECT(x)
|
PyFPE_END_PROTECT(x)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue