From 8481c79d37d7c33d5cbf917f025a87b2c452a6d8 Mon Sep 17 00:00:00 2001 From: Cody Maloney Date: Tue, 27 Oct 2026 16:44:26 -0700 Subject: [PATCH 1/3] Argument Clinic: document vectorcall Documents the directive added in python/cpython#145381 (gh-87613). --- development-tools/clinic/howto.rst | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/development-tools/clinic/howto.rst b/development-tools/clinic/howto.rst index 43e8c20e8..72b00ee5c 100644 --- a/development-tools/clinic/howto.rst +++ b/development-tools/clinic/howto.rst @@ -875,6 +875,19 @@ Just name them ``__new__`` or ``__init__`` as appropriate. Notes: (If your function doesn't support keywords, the parsing function generated will throw an exception if it receives any.) +* :ref:`vectorcall protocol ` support can be added using the +``@vectorcall`` directive. This will output an additional function that can be + used in the :c:member:`~PyTypeObject.tp_vectorcall` slot. Vectorcall adds + moderate code, be sure to microbenchmark and validate it saves significant + runtime. + + Current restrictions: + + * Optional groups are not supported. + * The type must be immutable (:c:macro:`Py_TPFLAGS_IMMUTABLETYPE`). + + .. versionadded:: 3.16 + How to change and redirect Clinic's output ------------------------------------------ From ab014a1ee55dbaae7a9de6ec24f62a03e1ca7cad Mon Sep 17 00:00:00 2001 From: Cody Maloney Date: Tue, 27 Oct 2026 17:10:40 -0700 Subject: [PATCH 2/3] Fix indentation --- development-tools/clinic/howto.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/development-tools/clinic/howto.rst b/development-tools/clinic/howto.rst index 72b00ee5c..dede36988 100644 --- a/development-tools/clinic/howto.rst +++ b/development-tools/clinic/howto.rst @@ -876,7 +876,7 @@ Just name them ``__new__`` or ``__init__`` as appropriate. Notes: generated will throw an exception if it receives any.) * :ref:`vectorcall protocol ` support can be added using the -``@vectorcall`` directive. This will output an additional function that can be + ``@vectorcall`` directive. This will output an additional function that can be used in the :c:member:`~PyTypeObject.tp_vectorcall` slot. Vectorcall adds moderate code, be sure to microbenchmark and validate it saves significant runtime. From 64956040e9c2beb5fa9e29076367c62d91ff9827 Mon Sep 17 00:00:00 2001 From: Cody Maloney Date: Thu, 29 Oct 2026 12:13:49 -0700 Subject: [PATCH 3/3] Update development-tools/clinic/howto.rst Co-authored-by: Stan Ulbrych --- development-tools/clinic/howto.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/development-tools/clinic/howto.rst b/development-tools/clinic/howto.rst index dede36988..1addc1a31 100644 --- a/development-tools/clinic/howto.rst +++ b/development-tools/clinic/howto.rst @@ -877,9 +877,9 @@ Just name them ``__new__`` or ``__init__`` as appropriate. Notes: * :ref:`vectorcall protocol ` support can be added using the ``@vectorcall`` directive. This will output an additional function that can be - used in the :c:member:`~PyTypeObject.tp_vectorcall` slot. Vectorcall adds - moderate code, be sure to microbenchmark and validate it saves significant - runtime. + used in the :c:member:`~PyTypeObject.tp_vectorcall` slot. + The generated function adds a fair amount of code, so benchmark first + and only use it where it gives a significant speedup. Current restrictions: