PEP 590: Use PyObject *kwnames, which may be NULL (#1039)
* PEP 590: Use PyObject *kwnames, which may be NULL * PEP 590: nargs after args
This commit is contained in:
parent
b3c3e9bca4
commit
3f0a21ebe0
|
@ -53,12 +53,12 @@ The function pointer type
|
||||||
Calls are made through a function pointer taking the following parameters:
|
Calls are made through a function pointer taking the following parameters:
|
||||||
|
|
||||||
* ``PyObject *callable``: The called object
|
* ``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
|
* ``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:
|
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
|
Changes to the ``PyTypeObject`` struct
|
||||||
--------------------------------------
|
--------------------------------------
|
||||||
|
@ -96,7 +96,7 @@ The latter is not required to implement the vectorcall protocol.
|
||||||
The call
|
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``.
|
``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.
|
The caller is responsible for creating the ``kwnames`` tuple and ensuring that there are no duplicates in it.
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue