diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2016-05-08 20:36:44 (GMT) |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2016-05-08 20:36:44 (GMT) |
commit | ce41287e996351735ec1564bc1d701dd9057bdcf (patch) | |
tree | 6c405d106d2c5aa2f349ff70f9058af7680063c4 /Modules | |
parent | a26e4b97d82f408b18ea0ba7cf8b61606f80f1a8 (diff) | |
download | cpython-ce41287e996351735ec1564bc1d701dd9057bdcf.zip cpython-ce41287e996351735ec1564bc1d701dd9057bdcf.tar.gz cpython-ce41287e996351735ec1564bc1d701dd9057bdcf.tar.bz2 |
Issue #18531: Single var-keyword argument of dict subtype was passed
unscathed to the C-defined function. Now it is converted to exact dict.
Diffstat (limited to 'Modules')
-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 8c79485..5083be6 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) @@ -3784,6 +3804,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}, |