]> granicus.if.org Git - python/commitdiff
When calling a PyCFunction that has METH_KEYWORDS defined, don't
authorJeremy Hylton <jeremy@alum.mit.edu>
Fri, 9 Feb 2001 23:23:20 +0000 (23:23 +0000)
committerJeremy Hylton <jeremy@alum.mit.edu>
Fri, 9 Feb 2001 23:23:20 +0000 (23:23 +0000)
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.

Python/ceval.c

index 9d6549572f5600272ec3060a369a74956d72c993..8a83e99eadae931b5d759e3a0a5fd2aad272f6b7 100644 (file)
@@ -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) {