mirror of
https://github.com/python/cpython.git
synced 2025-11-02 03:01:58 +00:00
Issue #14705: Add 'p' format character to PyArg_ParseTuple* for bool support.
This commit is contained in:
parent
6b03f2ce45
commit
faf91e75ab
4 changed files with 62 additions and 0 deletions
|
|
@ -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},
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue