Skip to content

Commit c13f724

Browse files
committed
Streamline the fast track for CFunction calls a bit more: there was
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.
1 parent 4993188 commit c13f724

1 file changed

Lines changed: 2 additions & 5 deletions

File tree

Python/ceval.c

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1975,12 +1975,9 @@ eval_frame(PyFrameObject *f)
19751975
these are presumed to be the most frequent
19761976
callable object.
19771977
*/
1978-
if (PyCFunction_Check(func)) {
1978+
if (PyCFunction_Check(func) && nk == 0) {
19791979
int flags = PyCFunction_GET_FLAGS(func);
1980-
if (nk != 0 || (flags & METH_KEYWORDS))
1981-
x = do_call(func, &stack_pointer,
1982-
na, nk);
1983-
else if (flags == METH_VARARGS) {
1980+
if (flags & (METH_VARARGS | METH_KEYWORDS)) {
19841981
PyObject *callargs;
19851982
callargs = load_args(&stack_pointer, na);
19861983
x = PyCFunction_Call(func, callargs, NULL);

0 commit comments

Comments
 (0)