From 3f0a21ebe0a04d9eec9d2409fc1a24eac6a50d40 Mon Sep 17 00:00:00 2001 From: Jeroen Demeyer Date: Sat, 11 May 2019 14:30:14 +0200 Subject: [PATCH] PEP 590: Use PyObject *kwnames, which may be NULL (#1039) * PEP 590: Use PyObject *kwnames, which may be NULL * PEP 590: nargs after args --- pep-0590.rst | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pep-0590.rst b/pep-0590.rst index bc654f0c1..ddac1d2d6 100644 --- a/pep-0590.rst +++ b/pep-0590.rst @@ -53,12 +53,12 @@ The function pointer type Calls are made through a function pointer taking the following parameters: * ``PyObject *callable``: The called object -* ``Py_ssize_t n``: The number of arguments plus the optional flag ``PY_VECTORCALL_ARGUMENTS_OFFSET`` (see below) * ``PyObject *const *args``: A vector of arguments -* ``PyTupleObject *kwnames``: A tuple of the names of the named 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 This is implemented by the function pointer type: -``typedef PyObject *(*vectorcallfunc)(PyObject *callable, Py_ssize_t n, PyObject *const *args, PyObject *kwnames);`` +``typedef PyObject *(*vectorcallfunc)(PyObject *callable, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames);`` Changes to the ``PyTypeObject`` struct -------------------------------------- @@ -96,7 +96,7 @@ The latter is not required to implement the vectorcall protocol. The call -------- -The call takes the form ``((vectorcallfunc)(((char *)o)+offset))(o, n, args, kwnames)`` where +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.