Issue #18531: Single var-keyword argument of dict subtype was passed

unscathed to the C-defined function.  Now it is converted to exact dict.
This commit is contained in:
Serhiy Storchaka 2016-05-08 23:36:44 +03:00
parent a26e4b97d8
commit ce41287e99
4 changed files with 82 additions and 1 deletions

View file

@ -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},