]> granicus.if.org Git - python/commitdiff
Streamline the fast track for CFunction calls a bit more: there was
authorGuido van Rossum <guido@python.org>
Fri, 16 Aug 2002 16:14:00 +0000 (16:14 +0000)
committerGuido van Rossum <guido@python.org>
Fri, 16 Aug 2002 16:14:00 +0000 (16:14 +0000)
nothing special done if keyword arguments were present, so test for
that earlier and fall through to the normal case if there are any.
This ought to slow down CFunction calls with keyword args, but I don't
care; it's a tiny (1%) improvement for pystone.

Python/ceval.c

index 6985846cc6f43f8023329aced51cec52c7d5fffd..954d078b58e52957d77a9e04ce242d5866163457 100644 (file)
@@ -1975,12 +1975,9 @@ eval_frame(PyFrameObject *f)
                       these are presumed to be the most frequent
                       callable object.
                    */
-                   if (PyCFunction_Check(func)) {
+                   if (PyCFunction_Check(func) && nk == 0) {
                            int flags = PyCFunction_GET_FLAGS(func);
-                           if (nk != 0 || (flags & METH_KEYWORDS))
-                                   x = do_call(func, &stack_pointer,
-                                               na, nk);
-                           else if (flags == METH_VARARGS) {
+                           if (flags  & (METH_VARARGS | METH_KEYWORDS)) {
                                    PyObject *callargs;
                                    callargs = load_args(&stack_pointer, na);
                                    x = PyCFunction_Call(func, callargs, NULL);