cpython: 60f7197f991f (original) (raw)

Mercurial > cpython

changeset 81057:60f7197f991f

Test for issue16772 and redoes the previous fix to accept __index__-aware objects as the base by using PyNumber_AsSsize_t similar to round(). [#16772]

Gregory P. Smith greg@krypto.org
date Tue, 25 Dec 2012 22:38:32 -0800
parents 3cd57e8144dc
children 43b19d9f9af4
files Lib/test/test_int.py Objects/longobject.c
diffstat 2 files changed, 27 insertions(+), 4 deletions(-)[+] [-] Lib/test/test_int.py 24 Objects/longobject.c 7

line wrap: on

line diff

--- a/Lib/test/test_int.py +++ b/Lib/test/test_int.py @@ -240,6 +240,30 @@ class IntTestCases(unittest.TestCase): self.assertEquals(int(base=1000), 0) self.assertEquals(int(base='foo'), 0)

+

+ def test_non_numeric_input_types(self): # Test possible non-numeric types for the argument x, including # subclasses of the explicitly documented accepted types.

--- a/Objects/longobject.c +++ b/Objects/longobject.c @@ -4247,8 +4247,7 @@ static PyObject * long_new(PyTypeObject *type, PyObject *args, PyObject *kwds) { PyObject *obase = NULL, *x = NULL;