Python/ceval.c
static PyObject*
_PyFunction_FastCall(PyCodeObject *co, PyObject **args, Py_ssize_t nargs,
                     PyObject *globals)
{
    PyFrameObject *f;
    PyThreadState *tstate = PyThreadState_GET();
    PyObject **fastlocals;
    Py_ssize_t i;
    PyObject *result;

    assert(globals != NULL);
    /* XXX Perhaps we should create a specialized
       PyFrame_New() that doesn't take locals, but does
       take builtins without sanity checking them.
       */
    assert(tstate != NULL);
    f = PyFrame_New(tstate, co, globals, NULL);
    if (f == NULL) {
        return NULL;
    }

    fastlocals = f->f_localsplus;

    for (i = 0; i < nargs; i++) {
        Py_INCREF(*args);
        fastlocals[i] = *args++;
    }
    result = PyEval_EvalFrameEx(f,0);

    ++tstate->recursion_depth;
    Py_DECREF(f);
    --tstate->recursion_depth;

    return result;
}
/* The fast_function() function optimize calls for which no argument
   tuple is necessary; the objects are passed directly from the stack.
   For the simplest case -- a function that takes only positional
   arguments and is called with only positional arguments -- it
   inlines the most primitive frame setup code from
   PyEval_EvalCodeEx(), which vastly reduces the checks that must be
   done before evaluating the frame.
*/
The fast_function() function optimize calls for which no argument
tuple is necessary; the objects are passed directly from the stack.
For the simplest case -- a function that takes only positional
arguments and is called with only positional arguments -- it
inlines the most primitive frame setup code from
PyEval_EvalCodeEx(), which vastly reduces the checks that must be
done before evaluating the frame.
The fast_function () function optimize calls for which no argument tuple is necessary ; the objects are passed directly from the stack . For the simplest case -- a function that takes only positional arguments and is called with only positional arguments -- it inlines the most primitive frame setup code from PyEval_EvalCodeEx () which vastly reduces the checks that must be done before evaluating the frame .
static PyObject*
_PyFunction_FastCall(PyCodeObject *co, PyObject **args, Py_ssize_t nargs,
                     PyObject *globals)
{
    PyFrameObject *f;
    PyThreadState *tstate = PyThreadState_GET();
    PyObject **fastlocals;
    Py_ssize_t i;
    PyObject *result;
    assert(globals != NULL);
    assert(tstate != NULL);
    f = PyFrame_New(tstate, co, globals, NULL);
    if (f == NULL) {
        return NULL;
    }
    fastlocals = f->f_localsplus;
    for (i = 0; i < nargs; i++) {
        Py_INCREF(*args);
        fastlocals[i] = *args++;
    }
    result = PyEval_EvalFrameEx(f,0);
    ++tstate->recursion_depth;
    Py_DECREF(f);
    --tstate->recursion_depth;
    return result;
}
static PyObject * _PyFunction_FastCall ( PyCodeObject * co , PyObject * * args , Py_ssize_t nargs , PyObject * globals ) { PyFrameObject * f ; PyThreadState * tstate = PyThreadState_GET ( ) ; PyObject * * fastlocals ; Py_ssize_t i ; PyObject * result ; assert ( globals != NULL ) ; assert ( tstate != NULL ) ; f = PyFrame_New ( tstate , co , globals , NULL ) ; if ( f == NULL ) { return NULL ; } fastlocals = f -> f_localsplus ; for ( i = 0 ; i < nargs ; i ++ ) { Py_INCREF ( * args ) ; fastlocals [ i ] = * args ++ ; } result = PyEval_EvalFrameEx ( f , 0 ) ; ++ tstate -> recursion_depth ; Py_DECREF ( f ) ; -- tstate -> recursion_depth ; return result ; }
The fast_function() function optimize calls for which no argument
tuple is necessary; the objects are passed directly from the stack.
The fast_function () function optimize calls for which no argument tuple is necessary ; the objects are passed directly from the stack .
/* XXX Perhaps we should create a specialized
       PyFrame_New() that doesn't take locals, but does
       take builtins without sanity checking them.
       */