GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — gh-87613: AC VC add support for *args and use it for zip by cmaloney · Pull Request #160944 · python/cpython

Conversation

@cmaloney

@cmaloney cmaloney commented Oct 30, 2026 •
edited by bedevere-app Bot
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

Argument Clinic @vectorcall generation accepted *args parameters but the generated code expected an argument tuple. The first commit uses the fastcall form to parse the args array making it work right.

zip previously hand coded argument parsing and had no vectorcall. Argument error messages are unchanged except for unknown keywords: zip(strict=1, x=2) now reports "got an unexpected keyword argument 'x'" instead of "takes at most 1 keyword argument (2 given)". The docstring gains a summary line; __text_signature__ is unchanged.

pyperf microbenchmark (PGO+LTO, run serially):

Benchmark base zip
zip(a, b, strict=True) 118 ns 61.5 ns: 1.92x faster
zip(a, b) 64.9 ns 53.1 ns: 1.22x faster
zip(a) 55.0 ns 47.1 ns: 1.17x faster
list(zip(a, b)) 123 ns 113 ns: 1.09x faster
zip() 27.4 ns 25.7 ns: 1.07x faster
Sub(a, b) 71.5 ns 70.6 ns: 1.01x faster

Benchmark hidden because not significant (1): zip.__new__

Benchmark code:

import pyperf

runner = pyperf.Runner()
setup = "a = (1, 2, 3); b = [4, 5, 6]"
for stmt in ["zip()", "zip(a)", "zip(a, b)", "zip(a, b, strict=True)",
             "list(zip(a, b))"]:
    runner.timeit(stmt, stmt, setup)
runner.timeit('zip.`__new__`', 'new(zip, a, b)', setup + '; new = zip.__new__')
runner.timeit('Sub(a, b)', 'S(a, b)', setup + '\nclass S(zip): pass')
  • Issue: Generate vectorcall code to parse arguments using Argument Clinic #87613

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
cmaloney and others added 2 commits October 29, 2026 19:36
@cmaloney @claude
pythongh-87613: Support *args in Argument Clinic vectorcall
c121f81
`@vectorcall` accepted `*args`, but the generated code expected an
args tuple. Use fastcall form to parse the args array.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@cmaloney @claude
pythongh-87613: Use Argument Clinic vectorcall for zip
33a4871
zip had no vectorcall, so every call built an args tuple and a kwargs
dict, and strict=True also went through PyArg_ParseTupleAndKeywords with
a temporary empty tuple.  Argument error messages are unchanged except
for unknown keywords: `zip(strict=1, x=2)` now reports "got an
unexpected keyword argument 'x'" instead of "takes at most 1 keyword
argument (2 given)".  The docstring gains a summary line;
`__text_signature__` is unchanged.

pyperf microbenchmark (PGO+LTO, run serially):

| Benchmark              | base    | zip                   |
|------------------------|:-------:|:---------------------:|
| zip(a, b, strict=True) | 118 ns  | 61.5 ns: 1.92x faster |
| zip(a, b)              | 64.9 ns | 53.1 ns: 1.22x faster |
| zip(a)                 | 55.0 ns | 47.1 ns: 1.17x faster |
| list(zip(a, b))        | 123 ns  | 113 ns: 1.09x faster  |
| zip()                  | 27.4 ns | 25.7 ns: 1.07x faster |
| Sub(a, b)              | 71.5 ns | 70.6 ns: 1.01x faster |

Benchmark hidden because not significant (1): zip.`__new__`

Benchmark code:

```python
import pyperf

runner = pyperf.Runner()
setup = "a = (1, 2, 3); b = [4, 5, 6]"
for stmt in ["zip()", "zip(a)", "zip(a, b)", "zip(a, b, strict=True)",
             "list(zip(a, b))"]:
    runner.timeit(stmt, stmt, setup)
runner.timeit('zip.`__new__`', 'new(zip, a, b)', setup + '; new = zip.__new__')
runner.timeit('Sub(a, b)', 'S(a, b)', setup + '\nclass S(zip): pass')
```

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@cmaloney
cmaloney requested review from AA-Turner, ericsnowcurrently and erlend-aasland as code owners October 30, 2026 03:38
@bedevere-app bedevere-app Bot added awaiting review type-feature A feature request or enhancement labels Oct 30, 2026
@bedevere-app bedevere-app Bot mentioned this pull request Oct 30, 2026
Generate vectorcall code to parse arguments using Argument Clinic #87613
Open
@cmaloney cmaloney added the skip news label Oct 30, 2026
cmaloney
cmaloney commented Oct 30, 2026
View reviewed changes
Comment thread Python/bltinmodule.c Resolved

Uh oh!

There was an error while loading. Please reload this page.

@cmaloney cmaloney changed the title gh-87613: AC VC add support for *args and use for for zip gh-87613: AC VC add support for *args and use it for zip Oct 30, 2026
@cmaloney
pythongh-87613: zip: Drop tuplesize local
607ad5a
StanFromIreland
StanFromIreland reviewed Oct 31, 2026
View reviewed changes
Comment thread Python/bltinmodule.c Resolved

Uh oh!

There was an error while loading. Please reload this page.

@cmaloney @StanFromIreland
Apply suggestion from @StanFromIreland
cf1284f
Co-authored-by: Stan Ulbrych <[email protected]>
StanFromIreland
StanFromIreland approved these changes Nov 1, 2026
View reviewed changes

@StanFromIreland StanFromIreland left a comment

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll leave this for you to merge. :-)

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

cmaloney reacted with heart emoji
All reactions
  • ❤️ 1 reaction
@bedevere-app bedevere-app Bot added awaiting merge and removed awaiting review labels Nov 1, 2026
@cmaloney
cmaloney merged commit 6d31270 into python:main Nov 3, 2026
65 of 66 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@cmaloney
cmaloney deleted the clinic_vc_varargs_zip branch November 3, 2026 18:42
@bedevere-app bedevere-app Bot removed the awaiting merge label Nov 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@StanFromIreland StanFromIreland StanFromIreland approved these changes
@ericsnowcurrently ericsnowcurrently Awaiting requested review from ericsnowcurrently ericsnowcurrently is a code owner
@erlend-aasland erlend-aasland Awaiting requested review from erlend-aasland erlend-aasland is a code owner
@AA-Turner AA-Turner Awaiting requested review from AA-Turner AA-Turner is a code owner

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

skip news type-feature A feature request or enhancement

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@cmaloney @StanFromIreland
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.