diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2016-05-16 06:55:32 (GMT) |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2016-05-16 06:55:32 (GMT) |
commit | acef5de6ecd1cb84420bb0ea8d0a8d6cd09682e2 (patch) | |
tree | 81376bd368d4cb32bdafaa4ef5382dd45493e15c /Modules/_testcapimodule.c | |
parent | af7cf6d2b9ec4ec2ec016fdf47c21894fef3f26a (diff) | |
download | cpython-acef5de6ecd1cb84420bb0ea8d0a8d6cd09682e2.zip cpython-acef5de6ecd1cb84420bb0ea8d0a8d6cd09682e2.tar.gz cpython-acef5de6ecd1cb84420bb0ea8d0a8d6cd09682e2.tar.bz2 |
Backported tests for issue #18531.
Diffstat (limited to 'Modules/_testcapimodule.c')
-rw-r--r-- | Modules/_testcapimodule.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/Modules/_testcapimodule.c b/Modules/_testcapimodule.c index 71aa419..19fea20 100644 --- a/Modules/_testcapimodule.c +++ b/Modules/_testcapimodule.c @@ -872,6 +872,26 @@ test_L_code(PyObject *self) #endif /* ifdef HAVE_LONG_LONG */ +static PyObject * +get_args(PyObject *self, PyObject *args) +{ + if (args == NULL) { + args = Py_None; + } + Py_INCREF(args); + return args; +} + +static PyObject * +get_kwargs(PyObject *self, PyObject *args, PyObject *kwargs) +{ + if (kwargs == NULL) { + kwargs = Py_None; + } + Py_INCREF(kwargs); + return kwargs; +} + /* Test tuple argument processing */ static PyObject * getargs_tuple(PyObject *self, PyObject *args) @@ -3651,6 +3671,8 @@ static PyMethodDef TestMethods[] = { {"test_pep3118_obsolete_write_locks", (PyCFunction)test_pep3118_obsolete_write_locks, METH_NOARGS}, #endif {"getbuffer_with_null_view", getbuffer_with_null_view, METH_O}, + {"get_args", get_args, METH_VARARGS}, + {"get_kwargs", (PyCFunction)get_kwargs, METH_VARARGS|METH_KEYWORDS}, {"getargs_tuple", getargs_tuple, METH_VARARGS}, {"getargs_keywords", (PyCFunction)getargs_keywords, METH_VARARGS|METH_KEYWORDS}, |