Mercurial > cpython-lru_cache-weakref
diff Python/getargs.c @ 46405:3653fbdd4483
Issue 2440: revert r62269 and r62279. These changes were made in an effort to fix test_args2.Signed_TestCase.test_n(), which was failing on Windows x64 on the following line: 'self.failUnlessEqual(99, getargs_n(Long()))'. Although the two commits *did* fix the test on Windows x64, it's become clear that it's the test that's incorrect, and the changes to PyNumber_Index() in particular were not warranted (and actually violate PEP 357). This commit will get us back to where we were at r62268, before I started butchering things.
| author | Trent Nelson <trent.nelson@snakebite.org> |
|---|---|
| date | Fri, 11 Apr 2008 23:02:37 +0000 |
| parents | 7c99cedc3e54 |
| children | c0cdacf07f54 |
line wrap: on
line diff
--- a/Python/getargs.c Fri Apr 11 21:17:32 2008 +0000 +++ b/Python/getargs.c Fri Apr 11 23:02:37 2008 +0000 @@ -663,6 +663,7 @@ } case 'n': /* Py_ssize_t */ +#if SIZEOF_SIZE_T != SIZEOF_LONG { PyObject *iobj; Py_ssize_t *p = va_arg(*p_va, Py_ssize_t *); @@ -671,13 +672,14 @@ return converterr("integer<n>", arg, msgbuf, bufsize); iobj = PyNumber_Index(arg); if (iobj != NULL) - ival = PyLong_AsSsize_t(iobj); + ival = PyLong_AsSsize_t(arg); 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;
