mirror of
https://github.com/python/cpython
synced 2026-09-29 10:35:30 +03:00
Add _PyObject_FastCallKeywords()
Issue #27830: Similar to _PyObject_FastCallDict(), but keyword arguments are also passed in the same C array than positional arguments, rather than being passed as a Python dict.
This commit is contained in:
parent
53868aaabb
commit
577e1f8cb4
4 changed files with 116 additions and 9 deletions
|
|
@ -292,6 +292,23 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/
|
|||
#define _PyObject_CallArg1(func, arg) \
|
||||
_PyObject_FastCall((func), &(arg), 1)
|
||||
|
||||
/* Call the callable object func with the "fast call" calling convention:
|
||||
args is a C array for positional arguments followed by (key, value)
|
||||
pairs for keyword arguments.
|
||||
|
||||
nargs is the number of positional parameters at the beginning of stack.
|
||||
nkwargs is the number of (key, value) pairs at the end of stack.
|
||||
|
||||
If nargs and nkwargs are equal to zero, stack can be NULL.
|
||||
|
||||
Return the result on success. Raise an exception and return NULL on
|
||||
error. */
|
||||
PyAPI_FUNC(PyObject *) _PyObject_FastCallKeywords(
|
||||
PyObject *func,
|
||||
PyObject **stack,
|
||||
Py_ssize_t nargs,
|
||||
Py_ssize_t nkwargs);
|
||||
|
||||
PyAPI_FUNC(PyObject *) _Py_CheckFunctionResult(PyObject *func,
|
||||
PyObject *result,
|
||||
const char *where);
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
Py_ssize_t nkwargs);
|
||||
#endif
|
||||
|
||||
/* Macros for direct access to these values. Type checks are *not*
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue