Commit 8af6b83e authored by Jeremy Hylton's avatar Jeremy Hylton

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.
parent c898f2cd
...@@ -2728,16 +2728,6 @@ call_cfunction(PyObject *func, PyObject *arg, PyObject *kw) ...@@ -2728,16 +2728,6 @@ call_cfunction(PyObject *func, PyObject *arg, PyObject *kw)
int flags = PyCFunction_GET_FLAGS(func); int flags = PyCFunction_GET_FLAGS(func);
if (flags & METH_KEYWORDS) { 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); return (*(PyCFunctionWithKeywords)meth)(self, arg, kw);
} }
if (kw != NULL && PyDict_Size(kw) != 0) { if (kw != NULL && PyDict_Size(kw) != 0) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment