Skip to content

Commit 28b94b4

Browse files
author
mark.dickinson
committed
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.) git-svn-id: http://svn.python.org/projects/python/trunk@62943 6015fed2-1504-0410-9fe1-9d1591cc4771
1 parent 29dbf34 commit 28b94b4

2 files changed

Lines changed: 4 additions & 0 deletions

File tree

Misc/NEWS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ What's New in Python 2.6 beta 1?
1212
Core and Builtins
1313
-----------------
1414

15+
- Issue #2801: fix bug in the float.is_integer method where a ValueError
16+
was sometimes incorrectly raised.
17+
1518
- Issue #2790: sys.flags was not properly exposing its bytes_warning attribute.
1619

1720
Extension Modules

Objects/floatobject.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1031,6 +1031,7 @@ float_is_integer(PyObject *v)
10311031
return NULL;
10321032
if (!Py_IS_FINITE(x))
10331033
Py_RETURN_FALSE;
1034+
errno = 0;
10341035
PyFPE_START_PROTECT("is_integer", return NULL)
10351036
o = (floor(x) == x) ? Py_True : Py_False;
10361037
PyFPE_END_PROTECT(x)

0 commit comments

Comments
 (0)