Skip to content

gh-87613: Support **kwargs in AC VC - #162465

Open
cmaloney wants to merge 3 commits into
python:mainfrom
cmaloney:clinic_vc_kwargs_ac
Open

cmaloney wants to merge 3 commits into
python:mainfrom
cmaloney:clinic_vc_kwargs_ac

Conversation

@cmaloney

@cmaloney cmaloney commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

@vectorcall with **kwargs always delegated to the keyword helper, which only reads a kwargs dict, so it couldn't be generated. The vectorcall now parses positionals with the shared positional emitter and builds the dict from kwnames only when there are keywords, otherwise passing NULL, as the tuple parser does.

  • The *args and **kwargs parsers take the calling convention explicitly rather than reading self.fastcall, which describes the Python-visible entry point having stack style args, not the vectorcall.
  • Allow **kwargs as name: *args as name already set the C name, but the 'as' regex only allowed a single leading star.
  • _testclinic.VcKwds exercises the generated vectorcall at runtime.

Split from GH-161597, which converts xml.etree.ElementTree.Element to use this. per request by @asvetlov. Also added a small test_clinic.py which uses the code generation.

cmaloney and others added 3 commits November 22, 2026 15:53
`@vectorcall` with `**kwargs` always delegated to the keyword helper,
which only reads a kwargs dict, so it couldn't be generated.  The
vectorcall now parses positionals with the shared positional emitter and
builds the dict from kwnames only when there are keywords, otherwise
passing NULL, as the tuple parser does.

The `*args` and `**kwargs` parsers take the calling convention explicitly
rather than reading `self.fastcall`, which describes the Python-visible
entry point having stack style args, not the vectorcall.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
`*args as name` already set the C name; `**kwargs as name` failed to
parse because the 'as' regex only allowed a single leading star.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@cmaloney cmaloney changed the title gh-87613L Support **kwargs in AC VC gh-87613: Support **kwargs in AC VC Nov 23, 2026
@bedevere-app bedevere-app Bot added the type-feature A feature request or enhancement label Nov 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant