Skip to content

Commit fd54e6e

Browse files
markshannonencukou
authored andcommitted
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.
1 parent 7dc58a6 commit fd54e6e

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

pep-0590.rst

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,15 +58,19 @@ This is implemented by the function pointer type:
5858
Changes to the ``PyTypeObject``
5959
-------------------------------
6060

61-
The a new slot called ``tp_vectorcall_offset`` is added. It has the type ``uint32_t``.
62-
A new flag is added, ``Py_TPFLAGS_HAVE_VECTORCALL``, which is set for any new PyTypeObjects that include the
61+
The unused slot ``printfunc tp_print`` is replaced with ``tp_vectorcall_offset``. It has the type ``uintptr_t``.
62+
63+
A new flag is added, ``Py_TPFLAGS_HAVE_VECTORCALL``, which is set for any new PyTypeObjects that use the
6364
``tp_vectorcall_offset`` member.
6465

6566
If ``Py_TPFLAGS_HAVE_VECTORCALL`` is set then ``tp_vectorcall_offset`` is the offset
6667
into the object of the ``vectorcall`` function-pointer.
68+
A new slot ``tp_vectorcall`` is added so that classes can support the vectorcall calling convention.
69+
It has the type ``vectorcall``.
70+
71+
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.
72+
In particular, the Cython project has shown interest in doing that (see https://mail.python.org/pipermail/python-dev/2018-June/153927.html).
6773

68-
The unused slot ``printfunc tp_print`` is replaced with ``vectorcall tp_vectorcall``, so that classes
69-
can support the vectorcall calling convention.
7074

7175
Additional flags
7276
----------------

0 commit comments

Comments
 (0)