[Python-checkins] r45349 - in python/trunk: Lib/test/test_getargs2.py Modules/_testcapimodule.c Python/getargs.c (original) (raw)

georg.brandl python-checkins at python.org
Thu Apr 13 09:59:31 CEST 2006


Author: georg.brandl Date: Thu Apr 13 09:59:30 2006 New Revision: 45349

Modified: python/trunk/Lib/test/test_getargs2.py python/trunk/Modules/_testcapimodule.c python/trunk/Python/getargs.c Log: Add a test for Py_ssize_t. Correct typo in getargs.c.

Modified: python/trunk/Lib/test/test_getargs2.py

--- python/trunk/Lib/test/test_getargs2.py (original) +++ python/trunk/Lib/test/test_getargs2.py Thu Apr 13 09:59:30 2006 @@ -48,7 +48,7 @@ VERY_LARGE = 0xFF0000121212121212121242L

from _testcapi import UCHAR_MAX, USHRT_MAX, UINT_MAX, ULONG_MAX, INT_MAX, \

fake, they are not defined in Python's header files

LLONG_MAX = 2**63-1 @@ -182,6 +182,23 @@ self.failUnlessEqual(42, getargs_l(42L)) self.assertRaises(OverflowError, getargs_l, VERY_LARGE)

class LongLong_TestCase(unittest.TestCase): def test_L(self):

Modified: python/trunk/Modules/_testcapimodule.c

--- python/trunk/Modules/_testcapimodule.c (original) +++ python/trunk/Modules/_testcapimodule.c Thu Apr 13 09:59:30 2006 @@ -360,6 +360,15 @@ return PyLong_FromLong(value); }

+static PyObject * +getargs_n(PyObject *self, PyObject *args) +{ + Py_ssize_t value; + if (!PyArg_ParseTuple(args, "n", &value)) + return NULL; + return PyInt_FromSsize_t(value); +} + #ifdef HAVE_LONG_LONG static PyObject * getargs_L(PyObject *self, PyObject *args) @@ -661,17 +670,18 @@ {"test_k_code", (PyCFunction)test_k_code, METH_NOARGS}, {"test_null_strings", (PyCFunction)test_null_strings, METH_NOARGS},

@@ -682,7 +692,7 @@ {"test_u_code", (PyCFunction)test_u_code, METH_NOARGS}, #endif #ifdef WITH_THREAD - {"_test_thread_state", (PyCFunction)test_thread_state, METH_VARARGS}, + {"_test_thread_state", test_thread_state, METH_VARARGS}, #endif {NULL, NULL} /* sentinel */ };

Modified: python/trunk/Python/getargs.c

--- python/trunk/Python/getargs.c (original) +++ python/trunk/Python/getargs.c Thu Apr 13 09:59:30 2006 @@ -647,10 +647,10 @@ Py_ssize_t *p = va_arg(*p_va, Py_ssize_t *); Py_ssize_t ival; if (float_argument_error(arg)) - return converterr("integer", arg, msgbuf, bufsize); + return converterr("integer", arg, msgbuf, bufsize); ival = PyInt_AsSsize_t(arg); if (ival == -1 && PyErr_Occurred()) - return converterr("integer", arg, msgbuf, bufsize); + return converterr("integer", arg, msgbuf, bufsize); *p = ival; break; }



More information about the Python-checkins mailing list