René's URL Explorer Experiment


Title: Bind interpreter arguments with borrowed Clinic structs by youknowdot · Pull Request #9763 · RustPython/RustPython · GitHub

Open Graph Title: Bind interpreter arguments with borrowed Clinic structs by youknowdot · Pull Request #9763 · RustPython/RustPython

X Title: Bind interpreter arguments with borrowed Clinic structs by youknowdot · Pull Request #9763 · RustPython/RustPython

Description: Summary Replace the display-only signature_args wrappers and _interpreters' duplicated ArgSpec parsers with borrowed Clinic argument structs. Extend #[derive(FromArgs)] with #[from_args(borrowed)]. The native wrapper owns the original FuncArgs through argument conversion, the implementation, and return conversion. Generated fields borrow that storage. Bind and validate each slot once before any converter runs, using the existing Clinic shape/count rules and #9790's matched-keyword approach. Positional calls without keywords skip keyword lookup. Generate binding and signature metadata from the same fields. _interpreters no longer opts out of Clinic validation to expose signatures. Convert borrowed objects, typed payload references, and flags in Clinic declaration order. Preserve payload-specific validation such as PyUtf8Str's surrogate error. Release borrowed native arguments in reverse evaluation-stack order. Retain original expanded-call containers through native, bound-method, callable-object, and instrumented calls, and release tuple members in reverse order. Keep the existing owned and explicit legacy paths. Borrowing currently supports finite structs with one lifetime, passed as the sole arguments struct plus the VM. Unsupported layouts and display defaults without omission handling are rejected at compile time. This builds on #9563 and #9729 and is based on main dd8c34399. Validation Reference: CPython 3.15.1 Clinic wrappers. 273 binding/error cases match CPython exactly, including call(-1, None, args=None, unexpected=1) reporting the unexpected keyword first. 15 inspected and whitespace-normalized raw signatures match. call's raw line wrapping still differs; no exact raw-match claim is made for that string. 585 lifetime/error comparisons across 15 Clinic functions and nine call forms match CPython 3.15.1, including reordered keywords, positional/keyword mixtures, unpacking, binding errors, typed conversion errors, and boolean conversion exceptions. New regressions cover direct/expanded native cleanup, exact Python functions versus bound methods and callable objects, tuple-subclass iteration, nested/subclass tuple destruction, raising bodies, and monitoring transitions. Existing owned native converters and Python-function binding-failure cleanup are not migrated here. This is not a universal call-lifetime parity claim. Derive tests check for one binding invocation and no owning copies, allocation containers, or second binding pass. VM tests check reference identity/counts and Clinic error precedence. A local two-field borrowed-object counting-allocator probe over 100,000 positional and 100,000 keyword bindings measured zero allocations and unchanged input reference counts. Generated and equivalent handwritten extraction perform the same successful-path work in optimized x86-64 assembly; cold panic locations and function addresses differ. This is scoped evidence for the abstraction, not a claim that conversions or diagnostics can never allocate. Local validation: cargo test --workspace --exclude rustpython_wasm --exclude rustpython-venvlauncher --exclude rustpython-capi: passed, including the borrowed derive/payload regressions and doctests. C-API tests from crates/capi on the final head: 149 passed, 2 ignored. Workspace and separate C-API Clippy runs with --all-targets -- -D warnings: passed. The full extra_tests run with the final release binary and CPython 3.15.1 had 491 passed, 20 failed, 15 subtests passed. All 20 failure IDs reproduce with the previous head binary: restricted multiprocessing/NETLINK operations, filesystem EINVAL, unavailable _sqlite3/CPython test modules, and existing CPython snippet incompatibilities. The three changed snippets pass on both interpreters. These failures are not counted as passes. test_call, test_extcall, test_tuple, test_monitoring, test_funcattrs, and test_generators: passed (426 tests reported, 193 skipped). test_interpreters.test_api remains skipped because this build has the GIL disabled, so it is not claimed as coverage. Repository pre-commit hooks: passed on every commit. Common borrowed binding still adds zero allocations or reference-count clones. Non-tuple *iterable calls to non-Python callables now retain a normalized argument snapshot, which requires one additional Vec and one clone/drop pair per positional value. Exact-tuple calls retain their existing owner without this snapshot allocation. Final Linux x86-64 alternating-process microbenchmarks put native *tuple calls about 3–4% slower and native *list calls 8–9% slower than 635291497. Ordinary Python expansion paths were approximately baseline; native **kwargs improved about 3%. Direct borrowed-call measurements varied by about +1–6% across focused/broad samples, so no universal zero-runtime-overhead claim is made. Expanded-call collection now keeps owner state local, preallocates keyword space, and specializes instrumentation at compile time; borrowed cleanup is inlined, confirmed in assembly. CI for head 5157ca191102b4985c23144dd37af5fdc52b4e71 is tracked in this run. This PR remains a draft. AI-assisted implementation, tests, and review using OpenAI Codex.

Open Graph Description: Summary Replace the display-only signature_args wrappers and _interpreters' duplicated ArgSpec parsers with borrowed Clinic argument structs. Extend #[derive(FromArgs)] with #[from_args(borrow...

X Description: Summary Replace the display-only signature_args wrappers and _interpreters' duplicated ArgSpec parsers with borrowed Clinic argument structs. Extend #[derive(FromArgs)] with #[from_args(bo...

Opengraph URL: https://github.com/RustPython/RustPython/pull/9763

X: @github

direct link

Domain: github.com

react-profiling0
react-import-mapreact,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322
route-pattern/:user_id/:repository/pull/:id/files(.:format)
route-controllerpull_requests
route-actionfiles
fetch-noncev2:e87c77d3-70bf-1e24-e0bd-a6552155530a
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-idD3B8:2AF0D8:25B0E:2F1E7:6B01E961
html-safe-nonce85253fae28131d79d5851d8265d0ff3ce685b2ccdf9964ac39a4efc91f20d752
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEM0I4OjJBRjBEODoyNUIwRToyRjFFNzo2QjAxRTk2MSIsInZpc2l0b3JfaWQiOiI3MDUwMTY4MzY1NTQ1MDIzODQxIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0=
visitor-hmacc1665dfe3801efa2b9bfdde819f44675196e44e4a451e760b95aa5095fbd53a6
hovercard-subject-tagpull_request:5224526854
github-keyboard-shortcutsrepository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///pull_requests/show/files
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/RustPython/RustPython/pull/9763/files
twitter:imagehttps://avatars.githubusercontent.com/u/336763669?s=400&v=4
twitter:cardsummary_large_image
og:imagehttps://avatars.githubusercontent.com/u/336763669?s=400&v=4
og:image:altSummary Replace the display-only signature_args wrappers and _interpreters' duplicated ArgSpec parsers with borrowed Clinic argument structs. Extend #[derive(FromArgs)] with #[from_args(borrow...
og:site_nameGitHub
og:typeobject
hostnamegithub.com
expected-hostnamegithub.com
None87e774ee7c6b3bee0490394e4d3e57ec9dbc956f74b87ea685dc8996c1676456
turbo-cache-controlno-preview
diff-viewunified
go-importgithub.com/RustPython/RustPython git https://github.com/RustPython/RustPython.git
octolytics-dimension-user_id39710557
octolytics-dimension-user_loginRustPython
octolytics-dimension-repository_id135201145
octolytics-dimension-repository_nwoRustPython/RustPython
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id135201145
octolytics-dimension-repository_network_root_nwoRustPython/RustPython
turbo-body-classeslogged-out env-production page-responsive full-width
disable-turbotrue
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release423dbb54c5e7bfecc838eb387c1435eb3d0e760d
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/RustPython/RustPython/pull/9763/files#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2FRustPython%2FRustPython%2Fpull%2F9763%2Ffiles
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://github.com/security/advanced-security
Copilot for businessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2FRustPython%2FRustPython%2Fpull%2F9763%2Ffiles
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fpull_requests%2Fshow%2Ffiles&source=header-repo&source_repo=RustPython%2FRustPython
Reloadhttps://github.com/RustPython/RustPython/pull/9763/files
Reloadhttps://github.com/RustPython/RustPython/pull/9763/files
Reloadhttps://github.com/RustPython/RustPython/pull/9763/files
RustPythonhttps://github.com/RustPython
RustPythonhttps://github.com/RustPython/RustPython
Codehttps://github.com/RustPython/RustPython
Issues195 (195)https://github.com/RustPython/RustPython/issues
Pull requests133 (133)https://github.com/RustPython/RustPython/pulls
Discussionshttps://github.com/RustPython/RustPython/discussions
Actionshttps://github.com/RustPython/RustPython/actions
Projectshttps://github.com/RustPython/RustPython/projects
Wikihttps://github.com/RustPython/RustPython/wiki
Security and qualityhttps://github.com/RustPython/RustPython/security
Insightshttps://github.com/RustPython/RustPython/insights
Sign up for GitHub https://github.com/signup?return_to=%2FRustPython%2FRustPython%2Fissues%2Fnew%2Fchoose
terms of servicehttps://docs.github.com/terms
privacy statementhttps://docs.github.com/privacy
Sign inhttps://github.com/login?return_to=%2FRustPython%2FRustPython%2Fissues%2Fnew%2Fchoose
youknowonehttps://github.com/youknowone
RustPython:mainhttps://github.com/RustPython/RustPython/tree/main
youknowdot:fix/signature-next-20261109https://github.com/youknowdot/RustPython/tree/fix/signature-next-20261109
Conversation 4 https://github.com/RustPython/RustPython/pull/9763
Commits 7 https://github.com/RustPython/RustPython/pull/9763/commits
Checks 27 https://github.com/RustPython/RustPython/pull/9763/checks
Files changed https://github.com/RustPython/RustPython/pull/9763/files
Please reload this pagehttps://github.com/RustPython/RustPython/pull/9763/files
Bind interpreter arguments with borrowed Clinic structs https://github.com/RustPython/RustPython/pull/9763/files#top
Show all changes 7 commits https://github.com/RustPython/RustPython/pull/9763/files
f89410c Bind interpreter arguments with borrowed Clinic structs youknowdot Nov 11, 2026 https://github.com/RustPython/RustPython/pull/9763/commits/f89410c957f5bdb700a63d84957f445f4150acf8
e6eb3f3 Return infallible interpreter query results directly youknowdot Nov 11, 2026 https://github.com/RustPython/RustPython/pull/9763/commits/e6eb3f3331da79ecea864d3e8bfc819a136336b0
703bcae Match tuple reference-counted destruction order youknowdot Nov 11, 2026 https://github.com/RustPython/RustPython/pull/9763/commits/703bcaedd8670eb9126b9c3cf361474cb6cb30a2
41e2b08 Retain expanded call argument owners through dispatch youknowdot Nov 11, 2026 https://github.com/RustPython/RustPython/pull/9763/commits/41e2b08fc39a90e0283a487c202d9caf3a3382ea
05e0cd2 Release borrowed native arguments in stack order youknowdot Nov 11, 2026 https://github.com/RustPython/RustPython/pull/9763/commits/05e0cd21265f801db8eaa5a5aa31f000f1cb7e82
d96e7fc Avoid call ownership helper overhead youknowdot Nov 11, 2026 https://github.com/RustPython/RustPython/pull/9763/commits/d96e7fc2fa43b5cffe0f611a8208a239e4c56f19
b1874da Parse from_args modes in one place youknowone Nov 11, 2026 https://github.com/RustPython/RustPython/pull/9763/commits/b1874da374da56b743b1dbbe075f0943fe75857e
Clear filters https://github.com/RustPython/RustPython/pull/9763/files
Please reload this pagehttps://github.com/RustPython/RustPython/pull/9763/files
Please reload this pagehttps://github.com/RustPython/RustPython/pull/9763/files
from_args.rs https://github.com/RustPython/RustPython/pull/9763/files#diff-90c094cca198d94b0145e4a485172fba68de5c77f49fcd05a6b882896721f1c9
lib.rs https://github.com/RustPython/RustPython/pull/9763/files#diff-20d9586a7e5e7a1ffb491abaefbd0c7a0c23bbea9524c66d06c8cc65c00ad539
tuple.rs https://github.com/RustPython/RustPython/pull/9763/files#diff-606274a9a62c77c00f802fbc298be35b47e2932cf90cc413748b4d8fc69d7c7e
try_from.rs https://github.com/RustPython/RustPython/pull/9763/files#diff-d959673a4ea1ca1a80680fd974b79e36013562bc9162aa1f3dbaef60ed8799d3
frame.rs https://github.com/RustPython/RustPython/pull/9763/files#diff-03f2741d7d424014f3d2f0c82226be52fa58134aab34bf0780714ee67a248deb
argument.rs https://github.com/RustPython/RustPython/pull/9763/files#diff-e9ca87fa93dba19813dc8ace2b1f9cbfd3cb9f29560b80c1e38963101107cfff
builtin.rs https://github.com/RustPython/RustPython/pull/9763/files#diff-6c24b946ac8e941c9ff035e11a371d071bb4e3cfccaab95095060bd841880f9b
mod.rs https://github.com/RustPython/RustPython/pull/9763/files#diff-c2fa22f10e57d8883fb9de7511a7345f799c1c3e87cda5ac557e3d513020d950
signature.rs https://github.com/RustPython/RustPython/pull/9763/files#diff-d8d33ac439d83ede8760de2d14f5bc298f336c809ffeeaece6be77fe6fd5865c
core.rs https://github.com/RustPython/RustPython/pull/9763/files#diff-29e5bc70b379859cc90757773e821848e53dff65ce99167408b6f547bc317196
payload.rs https://github.com/RustPython/RustPython/pull/9763/files#diff-810ea11cfb8461075d5d8f586b7bc9fb28d85695bdaf74cde28129c5e1e7e9a3
_interpreters.rs https://github.com/RustPython/RustPython/pull/9763/files#diff-cd3e63eccf55514e2c8479674118e64c43bb4a297419f82d2b8990813f1bba77
builtin_tuple.py https://github.com/RustPython/RustPython/pull/9763/files#diff-a6dd37603cca8c67da079a7b796a7aa77f0e4e2ce3b04e55a7edec762087cfe3
protocol_callable.py https://github.com/RustPython/RustPython/pull/9763/files#diff-339b6244f52b48725285bff67491ec954c60e1bb9dce6b04c21970564834b204
stdlib_subinterpreters.py https://github.com/RustPython/RustPython/pull/9763/files#diff-f71d3b6dab48fe4cca5dccb28f6026c51037953966f9013c0e1fb018b7a17326
crates/derive-impl/src/from_args.rshttps://github.com/RustPython/RustPython/pull/9763/files#diff-90c094cca198d94b0145e4a485172fba68de5c77f49fcd05a6b882896721f1c9
View file https://github.com/youknowdot/RustPython/blob/b1874da374da56b743b1dbbe075f0943fe75857e/crates/derive-impl/src/from_args.rs
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/RustPython/RustPython/pull/9763/{{ revealButtonHref }}
https://github.com/RustPython/RustPython/pull/9763/files#diff-90c094cca198d94b0145e4a485172fba68de5c77f49fcd05a6b882896721f1c9
https://github.com/RustPython/RustPython/pull/9763/files#diff-90c094cca198d94b0145e4a485172fba68de5c77f49fcd05a6b882896721f1c9
https://github.com/RustPython/RustPython/pull/9763/files#diff-90c094cca198d94b0145e4a485172fba68de5c77f49fcd05a6b882896721f1c9
https://github.com/RustPython/RustPython/pull/9763/files#diff-90c094cca198d94b0145e4a485172fba68de5c77f49fcd05a6b882896721f1c9
https://github.com/RustPython/RustPython/pull/9763/files#diff-90c094cca198d94b0145e4a485172fba68de5c77f49fcd05a6b882896721f1c9
https://github.com/RustPython/RustPython/pull/9763/files#diff-90c094cca198d94b0145e4a485172fba68de5c77f49fcd05a6b882896721f1c9
https://github.com/RustPython/RustPython/pull/9763/files#diff-90c094cca198d94b0145e4a485172fba68de5c77f49fcd05a6b882896721f1c9
https://github.com/RustPython/RustPython/pull/9763/files#diff-90c094cca198d94b0145e4a485172fba68de5c77f49fcd05a6b882896721f1c9
crates/derive/src/lib.rshttps://github.com/RustPython/RustPython/pull/9763/files#diff-20d9586a7e5e7a1ffb491abaefbd0c7a0c23bbea9524c66d06c8cc65c00ad539
View file https://github.com/youknowdot/RustPython/blob/b1874da374da56b743b1dbbe075f0943fe75857e/crates/derive/src/lib.rs
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/RustPython/RustPython/pull/9763/{{ revealButtonHref }}
https://github.com/RustPython/RustPython/pull/9763/files#diff-20d9586a7e5e7a1ffb491abaefbd0c7a0c23bbea9524c66d06c8cc65c00ad539
https://github.com/RustPython/RustPython/pull/9763/files#diff-20d9586a7e5e7a1ffb491abaefbd0c7a0c23bbea9524c66d06c8cc65c00ad539
crates/vm/src/builtins/tuple.rshttps://github.com/RustPython/RustPython/pull/9763/files#diff-606274a9a62c77c00f802fbc298be35b47e2932cf90cc413748b4d8fc69d7c7e
View file https://github.com/youknowdot/RustPython/blob/b1874da374da56b743b1dbbe075f0943fe75857e/crates/vm/src/builtins/tuple.rs
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/RustPython/RustPython/pull/9763/{{ revealButtonHref }}
https://github.com/RustPython/RustPython/pull/9763/files#diff-606274a9a62c77c00f802fbc298be35b47e2932cf90cc413748b4d8fc69d7c7e
https://github.com/RustPython/RustPython/pull/9763/files#diff-606274a9a62c77c00f802fbc298be35b47e2932cf90cc413748b4d8fc69d7c7e
crates/vm/src/convert/try_from.rshttps://github.com/RustPython/RustPython/pull/9763/files#diff-d959673a4ea1ca1a80680fd974b79e36013562bc9162aa1f3dbaef60ed8799d3
View file https://github.com/youknowdot/RustPython/blob/b1874da374da56b743b1dbbe075f0943fe75857e/crates/vm/src/convert/try_from.rs
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/RustPython/RustPython/pull/9763/{{ revealButtonHref }}
https://github.com/RustPython/RustPython/pull/9763/files#diff-d959673a4ea1ca1a80680fd974b79e36013562bc9162aa1f3dbaef60ed8799d3
https://github.com/RustPython/RustPython/pull/9763/files#diff-d959673a4ea1ca1a80680fd974b79e36013562bc9162aa1f3dbaef60ed8799d3
https://github.com/RustPython/RustPython/pull/9763/files#diff-d959673a4ea1ca1a80680fd974b79e36013562bc9162aa1f3dbaef60ed8799d3
https://github.com/RustPython/RustPython/pull/9763/files#diff-d959673a4ea1ca1a80680fd974b79e36013562bc9162aa1f3dbaef60ed8799d3
Please reload this pagehttps://github.com/RustPython/RustPython/pull/9763/files
Please reload this pagehttps://github.com/RustPython/RustPython/pull/9763/files
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.