comparison Python/ceval.c @ 24866:f0dbd5b49d8a legacy-trunk

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.
author Guido van Rossum <guido@python.org>
date Fri, 16 Aug 2002 16:14:00 +0000
parents cf5928fab108
children 2306001f6eaa
comparison
equal deleted inserted replaced
24865:b54cfa98b66b 24866:f0dbd5b49d8a
1973 1973
1974 /* Always dispatch PyCFunction first, because 1974 /* Always dispatch PyCFunction first, because
1975 these are presumed to be the most frequent 1975 these are presumed to be the most frequent
1976 callable object. 1976 callable object.
1977 */ 1977 */
1978 if (PyCFunction_Check(func)) { 1978 if (PyCFunction_Check(func) && nk == 0) {
1979 int flags = PyCFunction_GET_FLAGS(func); 1979 int flags = PyCFunction_GET_FLAGS(func);
1980 if (nk != 0 || (flags & METH_KEYWORDS)) 1980 if (flags & (METH_VARARGS | METH_KEYWORDS)) {
1981 x = do_call(func, &stack_pointer,
1982 na, nk);
1983 else if (flags == METH_VARARGS) {
1984 PyObject *callargs; 1981 PyObject *callargs;
1985 callargs = load_args(&stack_pointer, na); 1982 callargs = load_args(&stack_pointer, na);
1986 x = PyCFunction_Call(func, callargs, NULL); 1983 x = PyCFunction_Call(func, callargs, NULL);
1987 Py_XDECREF(callargs); 1984 Py_XDECREF(callargs);
1988 } else 1985 } else