From 436be4a340ffeaa42e16188deaf43c55cef38fe3 Mon Sep 17 00:00:00 2001 From: AN Long Date: Fri, 23 Feb 2024 22:38:58 +0800 Subject: [PATCH] Document how to use varargs in Argument Clinic Co-authored-by: Jelle Zijlstra Co-authored-by: Sergey B Kirpichev --- development-tools/clinic.rst | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/development-tools/clinic.rst b/development-tools/clinic.rst index 2f4677430..7954153ff 100644 --- a/development-tools/clinic.rst +++ b/development-tools/clinic.rst @@ -1495,6 +1495,27 @@ You can still use a self converter, a return converter, and specify a *type* argument to the object converter for :c:macro:`METH_O`. +How to convert var-positional parameter functions +------------------------------------------------- + +To convert a var-positional parameter function, +prepending the parameter name with ``*`` , +and the parameter should use the ``object`` converter:: + + /*[clinic input] + var_positional_sample + + foo: int + *args: object + [clinic start generated code]*/ + +The implementation function will receive var-positional arguments +as *args* array. + +.. versionadded:: 3.11 +.. versionchanged:: 3.14 + + How to convert ``tp_new`` and ``tp_init`` functions ---------------------------------------------------