Title: Use Argument Clinic Vectorcall for types where it provides substantial benefit · Issue #162350 · python/cpython · GitHub
Open Graph Title: Use Argument Clinic Vectorcall for types where it provides substantial benefit · Issue #162350 · python/cpython
X Title: Use Argument Clinic Vectorcall for types where it provides substantial benefit · Issue #162350 · python/cpython
Description: Feature or enhancement Argument Clinic can now generate vectorcall for class __init__ and __new__ (gh-87613). This is a meta tracking issue for moving objects to use Argument Clinic generated Vectorcall for these cases: Replacing a handw...
Open Graph Description: Feature or enhancement Argument Clinic can now generate vectorcall for class __init__ and __new__ (gh-87613). This is a meta tracking issue for moving objects to use Argument Clinic generated Vecto...
X Description: Feature or enhancement Argument Clinic can now generate vectorcall for class __init__ and __new__ (gh-87613). This is a meta tracking issue for moving objects to use Argument Clinic generated Vecto...
Opengraph URL: https://github.com/python/cpython/issues/162350
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Use Argument Clinic Vectorcall for types where it provides substantial benefit","articleBody":"### Feature or enhancement\n\nArgument Clinic can now generate vectorcall for class `__init__` and `__new__` (gh-87613). This is a meta tracking issue for moving objects to use Argument Clinic generated Vectorcall for these cases:\n\n1. Replacing a handwritten vectorcall with the same behavior and equal or better performance. \n - Minor changes in exception text for bad arguments are okay\n2. Replacing `PyArg_Parse*` with Argument Clinic + Vectorcall\n - At least a 10% performance boost in pyperf microbenchmark.\n - Minor changes in exception text for bad arguments are okay\n3. Adding Vectorcall to objects which currently use Argument Clinic but do not support it\n - For these one of the following should apply:\n - The objects are common in performance critical code. This should generally be shown with an improvement on a `pyperformance` benchmark. If it's critical for a real application but there are no benchmarks, we should add them.\n - Speedup is substantial: over 15% in microbenchmarks. If the operation is a small part of a larger common operation (ex. `json.Encoder` in `json.dumps`), that operation must improve by at least 5% on a typical input. This is because vectorcall adds significant code for the performance it enables.\n\nFor all the cases it's important to validate\n - Behavior is the same across a wide range of inputs. Changes must be documented and noted. Substantial chagnes mean a different issue from this one is required.\n - There are no regressions for specific argument patterns.\n - `tp_call` keeps strong references in the argument tuple. In vectorcall the arguments are borrowed references. Make sure to hold a strong reference (`Py_INCREF`) before calling arbitrary Python code.\n\n\nIf new features are neededed those should be worked on in other issues. Ideally don't want to both convert a type _and_ change existing codegen in one PR. Issues with AC Vectorcall code generation should be reported in gh-87613.\n\n## Good Candidates\n\n- [ ] `itertools`\n- [ ] `operator`: `itemgetter`, `attrgetter`\n- [ ] `types`: `MethodType`, `CellType`, `FrameLocalsProxy`, `MappingProxyType`, `FunctionType`\n- [ ] `memoryview`\n- [ ] `property`\n- [ ] `complex`\n- [ ] `sentinel`\n- [ ] `string.templatelib`: `Template`, `Interpolation`\n- [ ] `typing`: `TypeAliasType`, `ParamSpecArgs`, `ParamSpecKwargs`\n- [ ] `pickle.PickleBuffer`\n- [ ] `contextvars.ContextVar`\n- [ ] `array.array`\n- [ ] `csv`\n- [ ] `datetime`: `timezone`, `timedelta`\n- [ ] `zoneinfo`\n- [ ] `queue.SimpleQueue`\n- [ ] `io.IncrementalNewlineDecoder`\n- [ ] `ctypes.CField`\n- [ ] `map`\n- [ ] `json` - GH-162376\n\n## Blocked: Require known feature work\n\n- [ ] gh-161597: Support `**kwargs` in AC vectorcall\n - `collections.defaultdict`, `operator.methodcaller`, `functools.partial`, `object`\n - `collections.OrderedDict` (also needs the self cast fix)\n - Exception hierarchy\n - `asyncio.Task`, `asyncio.Future`\n - `xml.etree.ElementTree`\n- [ ] Other known improvements needed\n - [ ] `set`, `frozenset`\n - [ ] `super`\n - [ ] `sqlite3.Cursor`, `sqlite3.Row`\n - [ ] `datetime.date`, `datetime.time`, `datetime.datetime`\n\n\n### Has this already been discussed elsewhere?\n\nThis is a minor feature, which does not need previous discussion elsewhere\n\n### Links to previous discussion of this feature:\n\n_No response_\n\n\u003c!-- gh-linked-prs -->\n### Linked PRs\n* gh-162376\n\u003c!-- /gh-linked-prs -->\n","author":{"url":"https://github.com/cmaloney","@type":"Person","name":"cmaloney"},"datePublished":"2026-11-21T02:57:08Z","url":"https://github.com/python/cpython/issues/162350"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:e345c60f-3cb7-d8a3-b535-c36d69bc5da4 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | A4C6:1087D4:2FB9CC4:3FC91B7:6B01E941 |
| html-safe-nonce | db3eb4639ffa3717306f6ee3f350d88b98a370cb461fc0b617911e53c4b7f342 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBNEM2OjEwODdENDoyRkI5Q0M0OjNGQzkxQjc6NkIwMUU5NDEiLCJ2aXNpdG9yX2lkIjoiNjg3MzkzNzUxNjU2MzY1NDk3NyIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 6ff3726cc4e5e309d8d79ea2f5d81885fddc2bc4e1271df1a4b79b304b76c1f3 |
| hovercard-subject-tag | issue:6523657872 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/python/cpython/162350/issue_layout |
| twitter:image | https://opengraph.githubassets.com/ff6a45c1f02d99a2fc9ad4a05b0bb83f8a7efb754540996890cdb8b9cfccce7d/python/cpython/issues/162350 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/ff6a45c1f02d99a2fc9ad4a05b0bb83f8a7efb754540996890cdb8b9cfccce7d/python/cpython/issues/162350 |
| og:image:alt | Feature or enhancement Argument Clinic can now generate vectorcall for class __init__ and __new__ (gh-87613). This is a meta tracking issue for moving objects to use Argument Clinic generated Vecto... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | cmaloney |
| hostname | github.com |
| expected-hostname | github.com |
| None | 87e774ee7c6b3bee0490394e4d3e57ec9dbc956f74b87ea685dc8996c1676456 |
| turbo-cache-control | no-preview |
| go-import | github.com/python/cpython git https://github.com/python/cpython.git |
| octolytics-dimension-user_id | 1525981 |
| octolytics-dimension-user_login | python |
| octolytics-dimension-repository_id | 81598961 |
| octolytics-dimension-repository_nwo | python/cpython |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 81598961 |
| octolytics-dimension-repository_network_root_nwo | python/cpython |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 423dbb54c5e7bfecc838eb387c1435eb3d0e760d |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width