diff Python/ceval.c @ 18306:9098415971d0 2.1

Backport Jeremy's checkin 2.244: 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 Thomas Wouters <thomas@python.org>
date Wed, 27 Jun 2001 13:09:44 +0000
parents a34293ced63b
children 140cb246b864
line wrap: on
line diff
--- a/Python/ceval.c	Wed Jun 27 13:05:05 2001 +0000
+++ b/Python/ceval.c	Wed Jun 27 13:09:44 2001 +0000
@@ -1941,7 +1941,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 {