summaryrefslogtreecommitdiffstats
path: root/Python
diff options
context:
space:
mode:
authorJeremy Hylton <jeremy@alum.mit.edu>2001-05-18 20:53:14 (GMT)
committerJeremy Hylton <jeremy@alum.mit.edu>2001-05-18 20:53:14 (GMT)
commitda20fce9c329acd8cf06162bd22be6e9b1fc1bc8 (patch)
treea85ea40301c8a9be10c85db52cac1deaa223f855 /Python
parentbd3090d4d659951ed38d1da0f44c3e59ec830bea (diff)
downloadcpython-da20fce9c329acd8cf06162bd22be6e9b1fc1bc8.zip
cpython-da20fce9c329acd8cf06162bd22be6e9b1fc1bc8.tar.gz
cpython-da20fce9c329acd8cf06162bd22be6e9b1fc1bc8.tar.bz2
Add a second special case to the inline function call code in eval_code2().
If we have a PyCFunction (builtin) and it is METH_VARARGS only, load the args and dispatch to call_cfunction() directly. This provides a small speedup for perhaps the most common function calls -- builtins.
Diffstat (limited to 'Python')
-rw-r--r--Python/ceval.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/Python/ceval.c b/Python/ceval.c
index 0cdd019..e407de4 100644
--- a/Python/ceval.c
+++ b/Python/ceval.c
@@ -1969,7 +1969,13 @@ eval_code2(PyCodeObject *co, PyObject *globals, PyObject *locals,
callable object.
*/
if (PyCFunction_Check(func)) {
- if (PyCFunction_GET_FLAGS(func) == 0) {
+ int flags = PyCFunction_GET_FLAGS(func);
+ if (flags == METH_VARARGS) {
+ PyObject *callargs;
+ callargs = load_args(&stack_pointer, na);
+ x = call_cfunction(func, callargs, NULL);
+ Py_XDECREF(callargs);
+ } else if (flags == 0) {
x = fast_cfunction(func,
&stack_pointer, na);
} else {