diff options
-rw-r--r-- | Lib/test/test_getargs2.py | 4 | ||||
-rw-r--r-- | Python/getargs.c | 5 |
2 files changed, 3 insertions, 6 deletions
diff --git a/Lib/test/test_getargs2.py b/Lib/test/test_getargs2.py index 1918386..69791e8 100644 --- a/Lib/test/test_getargs2.py +++ b/Lib/test/test_getargs2.py @@ -187,8 +187,8 @@ class Signed_TestCase(unittest.TestCase): # n returns 'Py_ssize_t', and does range checking # (PY_SSIZE_T_MIN ... PY_SSIZE_T_MAX) self.assertRaises(TypeError, getargs_n, 3.14) - self.failUnlessEqual(99, getargs_n(Long())) - self.failUnlessEqual(99, getargs_n(Int())) + self.assertRaises(TypeError, getargs_n, Long()) + self.assertRaises(TypeError, getargs_n, Int()) self.assertRaises(OverflowError, getargs_n, PY_SSIZE_T_MIN-1) self.failUnlessEqual(PY_SSIZE_T_MIN, getargs_n(PY_SSIZE_T_MIN)) diff --git a/Python/getargs.c b/Python/getargs.c index 1370e09..6a50ef6 100644 --- a/Python/getargs.c +++ b/Python/getargs.c @@ -663,7 +663,6 @@ convertsimple(PyObject *arg, const char **p_format, va_list *p_va, int flags, } case 'n': /* Py_ssize_t */ -#if SIZEOF_SIZE_T != SIZEOF_LONG { PyObject *iobj; Py_ssize_t *p = va_arg(*p_va, Py_ssize_t *); @@ -672,14 +671,12 @@ convertsimple(PyObject *arg, const char **p_format, va_list *p_va, int flags, return converterr("integer<n>", arg, msgbuf, bufsize); iobj = PyNumber_Index(arg); if (iobj != NULL) - ival = PyLong_AsSsize_t(arg); + ival = PyLong_AsSsize_t(iobj); if (ival == -1 && PyErr_Occurred()) return converterr("integer<n>", arg, msgbuf, bufsize); *p = ival; break; } -#endif - /* Fall through from 'n' to 'l' if Py_ssize_t is int */ case 'l': {/* long int */ long *p = va_arg(*p_va, long *); long ival; |