Skip to content

Commit dabfefb

Browse files
Argument Clinic: document vectorcall (#1948)
Co-authored-by: Stan Ulbrych <stan@python.org>
1 parent 90ceaa3 commit dabfefb

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

‎development-tools/clinic/howto.rst‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -875,6 +875,19 @@ Just name them ``__new__`` or ``__init__`` as appropriate. Notes:
875875
(If your function doesn't support keywords, the parsing function
876876
generated will throw an exception if it receives any.)
877877

878+
* :ref:`vectorcall protocol <python:vectorcall>` support can be added using the
879+
``@vectorcall`` directive. This will output an additional function that can be
880+
used in the :c:member:`~PyTypeObject.tp_vectorcall` slot.
881+
The generated function adds a fair amount of code, so benchmark first
882+
and only use it where it gives a significant speedup.
883+
884+
Current restrictions:
885+
886+
* Optional groups are not supported.
887+
* The type must be immutable (:c:macro:`Py_TPFLAGS_IMMUTABLETYPE`).
888+
889+
.. versionadded:: 3.16
890+
878891

879892
How to change and redirect Clinic's output
880893
------------------------------------------

0 commit comments

Comments
 (0)