Skip to content

Commit 6ead95c

Browse files
committed
PEP 590: new function PyObject_VectorcallDict
1 parent 502c87c commit 6ead95c

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

pep-0590.rst

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -127,14 +127,22 @@ New C API and changes to CPython
127127

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

130-
- ``PyObject *PyObject_Vectorcall(PyObject *obj, PyObject *const *args, Py_ssize_t nargs, PyObject *keywords)``:
131-
Calls ``obj`` with the given arguments.
130+
- ``PyObject *PyObject_Vectorcall(PyObject *obj, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)``:
131+
Call ``obj`` with the given arguments.
132132
Note that ``nargs`` may include the flag ``PY_VECTORCALL_ARGUMENTS_OFFSET``.
133133
The actual number of positional arguments is given by ``PyVectorcall_NARGS(nargs)``.
134-
The argument ``keywords`` is a tuple of keyword names or ``NULL``.
134+
The argument ``kwnames`` is a tuple of keyword names or ``NULL``.
135135
An empty tuple has the same effect as passing ``NULL``.
136-
This uses either the vectorcall protocol or ``tp_call`` internally;
137-
if neither is supported, an exception is raised.
136+
Internally, this uses the vectorcall protocol if possible.
137+
If vectorcall is not supported, it uses ``tp_call``.
138+
If neither is supported, an exception is raised.
139+
This replaces the existing private function ``_PyObject_FastCallKeywords``.
140+
141+
- ``PyObject *PyObject_VectorcallDict(PyObject *obj, PyObject *const *args, Py_ssize_t nargs, PyObject *kwdict)``:
142+
Call ``obj`` with the given arguments.
143+
Same as ``PyObject_Vectorcall`` except that the keyword arguments are given
144+
as a dict (which may be ``NULL`` if there are no keyword arguments).
145+
This replaces the existing private function ``_PyObject_FastCallDict``.
138146

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

0 commit comments

Comments
 (0)