← 输入框|github.com|刷新
Skip to content

gh-87613: Pass borrowed *args and **kwargs through without Py_INCREF - #162781

Open
cmaloney wants to merge 1 commit into
python:mainfrom
cmaloney:landable/clinic-borrow-varargs
Open

cmaloney wants to merge 1 commit into
python:mainfrom
cmaloney:landable/clinic-borrow-varargs

Conversation

@cmaloney

@cmaloney cmaloney commented Nov 28, 2026 •

Copy link
Copy Markdown
Contributor

When the generated argument parser recieves a tuple and a dict borrow them instead of taking a new reference. The caller holds both for the duration of the call.

Functions with a generated vectorcall keep the new reference: the vectorcall builds its own tuple and dict and shares the cleanup.

Found while investigating slowdowns trying to move Exception hierarchy which often uses *args to AC VC for gh-161242

…NCREF

When the generated argument parser recieves a tuple and a dict borrow
them instead of taking a new reference. The caller holds both for the
duration of the call.

Functions with a generated vectorcall keep the new reference: the
vectorcall builds its own tuple and dict and shares the cleanup.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants