@@ -923,14 +923,14 @@ def render_option_groups_parse_tuple(
923923 parser_code .append (" }}" )
924924 return parser_code
925925
926- def _parse_vararg (self ) -> str :
926+ def _parse_vararg (self , * , fastcall : bool ) -> str :
927927 assert self .varpos is not None
928928 c = self .varpos .converter
929929 assert isinstance (c , libclinic .converters .VarPosCConverter )
930930 return c .parse_vararg (pos_only = self .pos_only ,
931931 min_pos = self .min_pos ,
932932 max_pos = self .max_pos ,
933- fastcall = self . fastcall ,
933+ fastcall = fastcall ,
934934 limited_capi = self .limited_capi )
935935
936936 def _parse_kwarg (self ) -> str :
@@ -963,6 +963,7 @@ def _parse_positional_args(
963963 argname_fmt : str ,
964964 nargs : str ,
965965 limited_capi : bool ,
966+ fastcall : bool ,
966967 ) -> list [str ] | None :
967968 """Emit per-parameter positional argument parsing.
968969
@@ -995,8 +996,8 @@ def _parse_positional_args(
995996 if self .min_pos < len (self .parameters ):
996997 parser_code .append ("skip_optional:" )
997998 if self .varpos :
998- parser_code .append (libclinic .normalize_snippet (self . _parse_vararg (),
999- indent = 4 ))
999+ parser_code .append (libclinic .normalize_snippet (
1000+ self . _parse_vararg ( fastcall = fastcall ), indent = 4 ))
10001001 elif self .var_keyword :
10011002 parser_code .append (libclinic .normalize_snippet (self ._parse_kwarg (),
10021003 indent = 4 ))
@@ -1090,7 +1091,7 @@ def parse_pos_only(self) -> None:
10901091
10911092 pos_code = self ._parse_positional_args (
10921093 argname_fmt = argname_fmt , nargs = nargs ,
1093- limited_capi = self .limited_capi )
1094+ limited_capi = self .limited_capi , fastcall = self . fastcall )
10941095 if pos_code is not None :
10951096 parser_code .extend (pos_code )
10961097 else :
@@ -1148,7 +1149,8 @@ def parse_var_keyword(self) -> None:
11481149 parser_code .append ("skip_optional:" )
11491150
11501151 if self .varpos :
1151- parser_code .append (libclinic .normalize_snippet (self ._parse_vararg (), indent = 4 ))
1152+ parser_code .append (libclinic .normalize_snippet (
1153+ self ._parse_vararg (fastcall = self .fastcall ), indent = 4 ))
11521154 if self .var_keyword :
11531155 parser_code .append (libclinic .normalize_snippet (self ._parse_kwarg (), indent = 4 ))
11541156 self .parser_body (* parser_code )
@@ -1376,7 +1378,12 @@ def parse_general(self, clang: CLanguage) -> None:
13761378 if add_label :
13771379 parser_code .append ("%s:" % add_label )
13781380 if self .varpos :
1379- parser_code .append (libclinic .normalize_snippet (self ._parse_vararg (), indent = 4 ))
1381+ # The vectorcall helper gets an array of arguments, not a
1382+ # tuple: use the converters' fastcall convention, which
1383+ # handles that.
1384+ fastcall = True if self .func .vectorcall else self .fastcall
1385+ parser_code .append (libclinic .normalize_snippet (
1386+ self ._parse_vararg (fastcall = fastcall ), indent = 4 ))
13801387 else :
13811388 self .use_converters ()
13821389
@@ -1617,8 +1624,11 @@ def _vectorcall_positional(self, *,
16171624
16181625 arity_checked: Already have a number of arguments check.
16191626 """
1627+ # The vectorcall gets an array of arguments, not a tuple: use the
1628+ # converters' fastcall convention, which handles that.
16201629 pos_code = self ._parse_positional_args (
1621- argname_fmt = 'args[%d]' , nargs = 'nargs' , limited_capi = False )
1630+ argname_fmt = 'args[%d]' , nargs = 'nargs' , limited_capi = False ,
1631+ fastcall = True )
16221632 # Converter support was validated when @vectorcall was parsed.
16231633 assert pos_code is not None
16241634 if arity_checked :
0 commit comments