Skip to content

PEP 590: kwnames should be non-empty tuple (or NULL) #1049

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
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
4 changes: 3 additions & 1 deletion pep-0590.rst
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ Calls are made through a function pointer taking the following parameters:
* ``PyObject *callable``: The called object
* ``PyObject *const *args``: A vector of arguments
* ``Py_ssize_t nargs``: The number of arguments plus the optional flag ``PY_VECTORCALL_ARGUMENTS_OFFSET`` (see below)
* ``PyObject *kwnames``: Either ``NULL`` or a tuple with the names of the keyword arguments
* ``PyObject *kwnames``: Either ``NULL`` or a non-empty tuple with the names of the keyword arguments

This is implemented by the function pointer type:
``typedef PyObject *(*vectorcallfunc)(PyObject *callable, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames);``
Expand Down Expand Up @@ -99,6 +99,8 @@ The call
The call takes the form ``((vectorcallfunc)(((char *)o)+offset))(o, args, n, kwnames)`` where
``offset`` is ``Py_TYPE(o)->tp_vectorcall_offset``.
The caller is responsible for creating the ``kwnames`` tuple and ensuring that there are no duplicates in it.
For efficiently dealing with the common case of no keywords,
``kwnames`` must be ``NULL`` if there are no keyword arguments.

``n`` is the number of postional arguments plus possibly the ``PY_VECTORCALL_ARGUMENTS_OFFSET`` flag.

Expand Down