diff Python/ceval.c @ 17855:d2d3f88661a3 legacy-trunk

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.
author Jeremy Hylton <jeremy@alum.mit.edu>
date Fri, 18 May 2001 20:53:14 +0000
parents e9a4e27e8d4e
children 0769e11d9d5f
line wrap: on
line diff
--- a/Python/ceval.c	Fri May 18 15:32:59 2001 +0000
+++ b/Python/ceval.c	Fri May 18 20:53:14 2001 +0000
@@ -1969,7 +1969,13 @@
 		       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 {