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.
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) {