mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
Add _PyObject_FastCall()
Issue #27128: Add _PyObject_FastCall(), a new calling convention avoiding a temporary tuple to pass positional parameters in most cases, but create a temporary tuple if needed (ex: for the tp_call slot). The API is prepared to support keyword parameters, but the full implementation will come later (_PyFunction_FastCall() doesn't support keyword parameters yet). Add also: * _PyStack_AsTuple() helper function: convert a "stack" of parameters to a tuple. * _PyCFunction_FastCall(): fast call implementation for C functions * _PyFunction_FastCall(): fast call implementation for Python functions
This commit is contained in:
parent
fa46aa7899
commit
9be7e7b52f
6 changed files with 314 additions and 49 deletions
|
@ -267,10 +267,26 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/
|
|||
PyObject *args, PyObject *kw);
|
||||
|
||||
#ifndef Py_LIMITED_API
|
||||
PyAPI_FUNC(PyObject*) _PyStack_AsTuple(PyObject **stack,
|
||||
Py_ssize_t nargs);
|
||||
|
||||
/* Call the callable object func with the "fast call" calling convention:
|
||||
args is a C array for positional parameters (nargs is the number of
|
||||
positional paramater), kwargs is a dictionary for keyword parameters.
|
||||
|
||||
If nargs is equal to zero, args can be NULL. kwargs can be NULL.
|
||||
nargs must be greater or equal to zero.
|
||||
|
||||
Return the result on success. Raise an exception on return NULL on
|
||||
error. */
|
||||
PyAPI_FUNC(PyObject *) _PyObject_FastCall(PyObject *func,
|
||||
PyObject **args, int nargs,
|
||||
PyObject *kwargs);
|
||||
|
||||
PyAPI_FUNC(PyObject *) _Py_CheckFunctionResult(PyObject *func,
|
||||
PyObject *result,
|
||||
const char *where);
|
||||
#endif
|
||||
#endif /* Py_LIMITED_API */
|
||||
|
||||
/*
|
||||
Call a callable Python object, callable_object, with
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue