Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 13 additions & 5 deletions pep-0590.rst
Original file line number Diff line number Diff line change
Expand Up @@ -127,14 +127,22 @@ New C API and changes to CPython

The following functions or macros are added to the C API:

- ``PyObject *PyObject_Vectorcall(PyObject *obj, PyObject *const *args, Py_ssize_t nargs, PyObject *keywords)``:
Calls ``obj`` with the given arguments.
- ``PyObject *PyObject_Vectorcall(PyObject *obj, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)``:
Call ``obj`` with the given arguments.
Note that ``nargs`` may include the flag ``PY_VECTORCALL_ARGUMENTS_OFFSET``.
The actual number of positional arguments is given by ``PyVectorcall_NARGS(nargs)``.
The argument ``keywords`` is a tuple of keyword names or ``NULL``.
The argument ``kwnames`` is a tuple of keyword names or ``NULL``.
An empty tuple has the same effect as passing ``NULL``.
This uses either the vectorcall protocol or ``tp_call`` internally;
if neither is supported, an exception is raised.
Internally, this uses the vectorcall protocol if supported;
otherwise, it uses ``tp_call``.
If neither is supported, an exception is raised.
This replaces the existing private function ``_PyObject_FastCallKeywords``.

- ``PyObject *PyObject_VectorcallDict(PyObject *obj, PyObject *const *args, Py_ssize_t nargs, PyObject *kwdict)``:
Call ``obj`` with the given arguments.
Same as ``PyObject_Vectorcall`` except that the keyword arguments are given
as a dict (which may be ``NULL`` if there are no keyword arguments).
This replaces the existing private function ``_PyObject_FastCallDict``.

- ``PyObject *PyVectorcall_Call(PyObject *obj, PyObject *tuple, PyObject *dict)``:
Call the object (which must support vectorcall) with the old
Expand Down