[pypy-commit] pypy cpyext-ext: PyNumber_Check accepts int as well as float

mattip pypy.commits at gmail.com
Thu Mar 3 10:14:48 EST 2016


Author: mattip <matti.picus at gmail.com>
Branch: cpyext-ext
Changeset: r82676:4d2743ceeb86
Date: 2016-03-03 02:24 -0500
http://bitbucket.org/pypy/pypy/changeset/4d2743ceeb86/

Log:	PyNumber_Check accepts int as well as float

diff --git a/pypy/module/cpyext/number.py b/pypy/module/cpyext/number.py
--- a/pypy/module/cpyext/number.py
+++ b/pypy/module/cpyext/number.py
@@ -24,7 +24,13 @@
         space.float_w(w_obj)
         return 1
     except OperationError:
-        return 0
+        pass
+    try:
+        space.int_w(w_obj)
+        return 1
+    except OperationError:
+        pass
+    return 0
 
 @cpython_api([PyObject, PyObject], Py_ssize_t, error=-1)
 def PyNumber_AsSsize_t(space, w_obj, w_exc):


More information about the pypy-commit mailing list