When calling a PyCFunction that has METH_KEYWORDS defined, don't
create an empty dictionary if it is called without keyword args. Just pass NULL. XXX I had believed that this caused weird errors, but the test suite runs cleanly.
This commit is contained in:
parent
c898f2cd3b
commit
8af6b83e61
|
@ -2728,16 +2728,6 @@ call_cfunction(PyObject *func, PyObject *arg, PyObject *kw)
|
|||
int flags = PyCFunction_GET_FLAGS(func);
|
||||
|
||||
if (flags & METH_KEYWORDS) {
|
||||
if (kw == NULL) {
|
||||
static PyObject *dict = NULL;
|
||||
if (dict == NULL) {
|
||||
dict = PyDict_New();
|
||||
if (dict == NULL)
|
||||
return NULL;
|
||||
}
|
||||
kw = dict;
|
||||
Py_INCREF(dict);
|
||||
}
|
||||
return (*(PyCFunctionWithKeywords)meth)(self, arg, kw);
|
||||
}
|
||||
if (kw != NULL && PyDict_Size(kw) != 0) {
|
||||
|
|
Loading…
Reference in New Issue