mirror of
https://github.com/python/cpython.git
synced 2025-09-14 04:37:29 +00:00
Add _PyObject_FastCallKeywords()
Issue #27830: Add _PyObject_FastCallKeywords(): avoid the creation of a temporary dictionary for keyword arguments. Other changes: * Cleanup call_function() and fast_function() (ex: rename nk to nkwargs) * Remove now useless do_call(), replaced with _PyObject_FastCallKeywords()
This commit is contained in:
parent
84f6a8f725
commit
d873572095
4 changed files with 130 additions and 55 deletions
|
@ -271,8 +271,8 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/
|
|||
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.
|
||||
args is a C array for positional arguments (nargs is the number of
|
||||
positional arguments), kwargs is a dictionary for keyword arguments.
|
||||
|
||||
If nargs is equal to zero, args can be NULL. kwargs can be NULL.
|
||||
nargs must be greater or equal to zero.
|
||||
|
@ -283,6 +283,24 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/
|
|||
PyObject **args, Py_ssize_t nargs,
|
||||
PyObject *kwargs);
|
||||
|
||||
/* Call the callable object func with the "fast call" calling convention:
|
||||
args is a C array for positional arguments followed by values of
|
||||
keyword arguments. Keys of keyword arguments are stored as a tuple
|
||||
of strings in kwnames. nargs is the number of positional parameters at
|
||||
the beginning of stack. The size of kwnames gives the number of keyword
|
||||
values in the stack after positional arguments.
|
||||
|
||||
If nargs is equal to zero and there is no keyword argument (kwnames is
|
||||
NULL or its size is zero), args can be NULL.
|
||||
|
||||
Return the result on success. Raise an exception and return NULL on
|
||||
error. */
|
||||
PyAPI_FUNC(PyObject *) _PyObject_FastCallKeywords
|
||||
(PyObject *func,
|
||||
PyObject **args,
|
||||
Py_ssize_t nargs,
|
||||
PyObject *kwnames);
|
||||
|
||||
#define _PyObject_FastCall(func, args, nargs) \
|
||||
_PyObject_FastCallDict((func), (args), (nargs), NULL)
|
||||
|
||||
|
|
|
@ -64,6 +64,12 @@ PyAPI_FUNC(PyObject *) _PyFunction_FastCallDict(
|
|||
PyObject **args,
|
||||
Py_ssize_t nargs,
|
||||
PyObject *kwargs);
|
||||
|
||||
PyAPI_FUNC(PyObject *) _PyFunction_FastCallKeywords(
|
||||
PyObject *func,
|
||||
PyObject **stack,
|
||||
Py_ssize_t nargs,
|
||||
PyObject *kwnames);
|
||||
#endif
|
||||
|
||||
/* Macros for direct access to these values. Type checks are *not*
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue