diff options
author | Larry Hastings <larry@hastings.org> | 2012-05-05 23:54:29 (GMT) |
---|---|---|
committer | Larry Hastings <larry@hastings.org> | 2012-05-05 23:54:29 (GMT) |
commit | faf91e75ab287ae6c377b05b7eb91d7f5274fbc5 (patch) | |
tree | 5fd9ed01b383d818d84091f91efa22ce48b1bccb /Modules/_testcapimodule.c | |
parent | 6b03f2ce45785190c6a8da271199ff724ba559d8 (diff) | |
download | cpython-faf91e75ab287ae6c377b05b7eb91d7f5274fbc5.zip cpython-faf91e75ab287ae6c377b05b7eb91d7f5274fbc5.tar.gz cpython-faf91e75ab287ae6c377b05b7eb91d7f5274fbc5.tar.bz2 |
Issue #14705: Add 'p' format character to PyArg_ParseTuple* for bool support.
Diffstat (limited to 'Modules/_testcapimodule.c')
-rw-r--r-- | Modules/_testcapimodule.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/Modules/_testcapimodule.c b/Modules/_testcapimodule.c index 471d66d..bdc465a 100644 --- a/Modules/_testcapimodule.c +++ b/Modules/_testcapimodule.c @@ -916,6 +916,15 @@ getargs_n(PyObject *self, PyObject *args) return PyLong_FromSsize_t(value); } +static PyObject * +getargs_p(PyObject *self, PyObject *args) +{ + int value; + if (!PyArg_ParseTuple(args, "p", &value)) + return NULL; + return PyLong_FromLong(value); +} + #ifdef HAVE_LONG_LONG static PyObject * getargs_L(PyObject *self, PyObject *args) @@ -2439,6 +2448,7 @@ static PyMethodDef TestMethods[] = { {"getargs_i", getargs_i, METH_VARARGS}, {"getargs_l", getargs_l, METH_VARARGS}, {"getargs_n", getargs_n, METH_VARARGS}, + {"getargs_p", getargs_p, METH_VARARGS}, #ifdef HAVE_LONG_LONG {"getargs_L", getargs_L, METH_VARARGS}, {"getargs_K", getargs_K, METH_VARARGS}, |