PEP 590: Swap tp_vectorcall_offset and tp_vectorcall slots. (GH-1026)

PEP 590: Swap tp_vectorcall_offset and tp_vectorcall slots to allow Cython to use vectorcall in versions before 3.8.
This commit is contained in:
Mark Shannon 2019-05-07 09:54:57 -04:00 committed by Petr Viktorin
parent 7dc58a6307
commit fd54e6e509
1 changed files with 8 additions and 4 deletions

View File

@ -58,15 +58,19 @@ This is implemented by the function pointer type:
Changes to the ``PyTypeObject``
-------------------------------
The a new slot called ``tp_vectorcall_offset`` is added. It has the type ``uint32_t``.
A new flag is added, ``Py_TPFLAGS_HAVE_VECTORCALL``, which is set for any new PyTypeObjects that include the
The unused slot ``printfunc tp_print`` is replaced with ``tp_vectorcall_offset``. It has the type ``uintptr_t``.
A new flag is added, ``Py_TPFLAGS_HAVE_VECTORCALL``, which is set for any new PyTypeObjects that use the
``tp_vectorcall_offset`` member.
If ``Py_TPFLAGS_HAVE_VECTORCALL`` is set then ``tp_vectorcall_offset`` is the offset
into the object of the ``vectorcall`` function-pointer.
A new slot ``tp_vectorcall`` is added so that classes can support the vectorcall calling convention.
It has the type ``vectorcall``.
The ``tp_print`` slot is reused as the ``tp_vectorcall_offset`` slot to make it easier for for external projects to backport the vectorcall protocol to earlier Python versions.
In particular, the Cython project has shown interest in doing that (see https://mail.python.org/pipermail/python-dev/2018-June/153927.html).
The unused slot ``printfunc tp_print`` is replaced with ``vectorcall tp_vectorcall``, so that classes
can support the vectorcall calling convention.
Additional flags
----------------