diff options
Diffstat (limited to 'Objects/descrobject.c')
-rw-r--r-- | Objects/descrobject.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/Objects/descrobject.c b/Objects/descrobject.c index e4d9f33..c5e793d 100644 --- a/Objects/descrobject.c +++ b/Objects/descrobject.c @@ -805,6 +805,17 @@ wrapper_call(wrapperobject *wp, PyObject *args, PyObject *kwds) wrapperfunc wrapper = wp->descr->d_base->wrapper; PyObject *self = wp->self; + if (wp->descr->d_base->flags & PyWrapperFlag_KEYWORDS) { + wrapperfunc_kwds wk = (wrapperfunc_kwds)wrapper; + return (*wk)(self, args, wp->descr->d_wrapped, kwds); + } + + if (kwds != NULL && (!PyDict_Check(kwds) || PyDict_Size(kwds) != 0)) { + PyErr_Format(PyExc_TypeError, + "wrapper %s doesn't take keyword arguments", + wp->descr->d_base->name); + return NULL; + } return (*wrapper)(self, args, wp->descr->d_wrapped); } |