René's URL Explorer Experiment


Title: Share code construction and comparison controls by youknowdot · Pull Request #9713 · RustPython/RustPython · GitHub

Open Graph Title: Share code construction and comparison controls by youknowdot · Pull Request #9713 · RustPython/RustPython

X Title: Share code construction and comparison controls by youknowdot · Pull Request #9713 · RustPython/RustPython

Description: Summary Align code-object construction, replacement, comparison and hashing controls with Python 3.15 through shared validation and existing binding primitives in two Rust production files. Compare constant keys before names and tables, releasing temporary keys left-to-right on both success and error. Compare retained Python name/local-plus/table objects through their protocols, preserving tuple/bytes-subclass callbacks instead of comparing normalized internal arrays. Hash the retained objects in CPython's order, preserving callback errors and the cached hash of the original constants tuple. Remove the local-partition count: code objects with identical combined locals-plus names can compare equal despite different local/cell partitions. Share CodeUnits' existing atomic deoptimization/cache traversal between byte serialization and hashing. Exclude inline caches and adaptive counters; hold the monitoring lock only after Python hash callbacks finish. Validation Compared against pinned CPython d220409a13b77de7a6c30abe16ea90db01528edc codeobject.c. The original four reference groups and nine expanded groups pass, covering callback order, early false/error exits, retained-field identity, local/cell partitions, original tuple hash caching and stable hashing after ordinary specialization. Constructed or modified code objects were not executed. Independent source review passed, including bounds/traversal preservation, atomic reads, monitoring-lock scope and equality/hash consistency. Final threaded cargo check passed (1m04s), all-target Clippy passed (2m17s) with exactly the 12 unchanged baseline diagnostics, and normal commit hooks passed. Limits and integration The initial validation used external reference checks and source review. Current native validation is recorded in the shared-binding follow-up section; hosted CI remains necessary. No repository tests, markers, Lib files or workflows are changed. The goal includes observable protocol callbacks and equality/hash consistency, not a promise of identical numerical hashes across distinct interpreter implementations. Signed constructor first-line representation differences remain outside this patch. #9688's filename repr work and #8939's constant-borrow ownership work remain separate and should be preserved on composition. Integration with #9439 (head 95a4916) requires explicit reconciliation, not a clean automatic composition: retain that PR's removal of per-code monitoring data and its original_bytes-based deopt_code; omit this patch's extracted monitoring resolver and lock; hash through original_instructions_with with identity resolution. Its bounded base-instruction analysis helper has different stop semantics and should not replace serialization/hash traversal blindly. The retained-object comparison/hash controls are not duplicated by #9439. Shared construction and replacement controls Share signed C-int conversion, original argument retention, audit-event construction, structural validation, name interning and CodeObject assembly. Derived signatures, KwArgs and the shared Clinic validation in bind_for handle binding. The owner-retaining wrapper forwards binding metadata without a separate keyword parser or nested bind. Accept the constructor's optional freevars/cellvars tuples and positional-only signature. Convert replacement controls in declaration order and reject iterable substitutes for tuple fields without calling their iteration hooks. Emit the nine-value code.new audit event with original object identities and propagate vetoes at the constructor/replacement-specific phase. Retain numeric arguments through later callbacks. Snapshot the replacement's default filename before index conversion callbacks can mutate it. Keep constructor name normalization separate from replacement's exact-string validation, matching their distinct error precedence. Share argument/local-capacity validation and retain positive unknown flag bits. Preserve the original comparison/hash changes. The constructor's negative firstlineno still uses the existing unsigned internal line representation. In-place interning of externally referenced tuples, constant deduplication and exact interned filename/name identity, malformed bytecode parity, generic binder TypeError wording, and broader locals/line representation changes remain outside scope. Existing safe bytecode checks and location-array behavior are retained; no constructed or replaced code is executed in reference probes. #6894's old locals representation redesign is not duplicated, but would require source reconciliation if revived. The current group changes 887 lines (+511/-376) in two production Rust files. Constructor-specific name diagnostics use native type names and the verified UTF-8-safe 500-byte bound. The added validation includes 103 focused and 103 independent pinned CPython cases, covering audit identity/veto/order, conversion and destruction order, structural errors, tuple subclass controls, mutable filename snapshots, flag retention and diagnostic bounds. Independent source review also confirmed that the original comparison/hash section is unchanged. These are reference checks and source review, not a claim that all oracle wording passes verbatim on RustPython. Final follow-up validation: threaded host-env/VM/stdlib cargo check passed in 1m02s and all-targets Clippy in 2m20s, with exactly the 12 unchanged baseline diagnostics. The first compile exposed three borrowed-reference ownership conversions; those and two new lint findings were corrected, independently reviewed, and both final commands rerun. Normal commit hooks passed. Those earlier runs did not include full workspace, C-API or native runtime tests. Current results follow; separate WASM/non-threaded graphs remain unexecuted. Shared-binding follow-up Rebased independently onto main at fb57e68 and validated commit 886c794. The four existing commits are patch-identical after rebase. Later main changes through ea5fbcc affect ctypes and zlib, not the code-object or binding files used here. Forward PARAMS and BINDING_PARAMS from the typed arguments so shared Clinic validation runs once before conversion. Remove the duplicate arity/keyword preflight, temporary keyword-name vector, and private specification trait. Keep the original argument owners through numeric conversions and audit callbacks. Preserve the replacement filename snapshot before conversion and existing callee diagnostics. Independent review and normal commit hooks passed. No tests, expected-failure markers, or unrelated production files were changed by this follow-up. Validation on this exact commit: Full workspace tests with the documented WASM, venvlauncher and C-API exclusions: 1,513 passed, 20 ignored across unit and documentation suites. Full workspace all-target Clippy: passed with zero warnings. This was ordinary Clippy, without -D warnings. Separate C-API all-target Clippy: passed with zero warnings. Separate C-API tests: 149 passed, 2 ignored, using CARGO_PROFILE_TEST_DEBUG=0. Fresh release RustPython -m test test_code: SUCCESS, 37 tests run and 15 skipped. The host PyO3 interpreter was the existing CPython 3.12.14, verified in the fresh build configuration. C-API checks used the repository's RustPython 3.15 configuration without an external interpreter. The pinned CPython 3.15 comparison is source-only; no CPython 3.15 executable was run for this follow-up. Hosted CI for the updated head remains pending. AI assistance is disclosed in the commit trailers.

Open Graph Description: Summary Align code-object construction, replacement, comparison and hashing controls with Python 3.15 through shared validation and existing binding primitives in two Rust production files. Compar...

X Description: Summary Align code-object construction, replacement, comparison and hashing controls with Python 3.15 through shared validation and existing binding primitives in two Rust production files. Compar...

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

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:339b9c99-fd5c-7fd7-51f5-0680c7d4a3aa
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-id8730:2F543F:13FB08D:1A6F81B:6B01F39A
html-safe-nonce6d921e484614ffda9fccdf4fcdcd84650cd527490db427b4ec752c965ae94ad5
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4NzMwOjJGNTQzRjoxM0ZCMDhEOjFBNkY4MUI6NkIwMUYzOUEiLCJ2aXNpdG9yX2lkIjoiMjAxODY3OTUxNzYxODUwMDUwNiIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmacb3159e3aacf6c218de7c3bf7c3d93747cc4806e9ee0fb147df91ca2907994d2b
hovercard-subject-tagpull_request:5158269826
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/9713/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 Align code-object construction, replacement, comparison and hashing controls with Python 3.15 through shared validation and existing binding primitives in two Rust production files. Compar...
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/9713/files#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2FRustPython%2FRustPython%2Fpull%2F9713%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%2F9713%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/9713/files
Reloadhttps://github.com/RustPython/RustPython/pull/9713/files
Reloadhttps://github.com/RustPython/RustPython/pull/9713/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/code-controls-20261104https://github.com/youknowdot/RustPython/tree/fix/code-controls-20261104
Conversation 5 https://github.com/RustPython/RustPython/pull/9713
Commits 5 https://github.com/RustPython/RustPython/pull/9713/commits
Checks 19 https://github.com/RustPython/RustPython/pull/9713/checks
Files changed https://github.com/RustPython/RustPython/pull/9713/files
Please reload this pagehttps://github.com/RustPython/RustPython/pull/9713/files
Share code construction and comparison controls https://github.com/RustPython/RustPython/pull/9713/files#top
Show all changes 5 commits https://github.com/RustPython/RustPython/pull/9713/files
91aa222 Preserve code comparison and hashing callbacks youknowdot Nov 4, 2026 https://github.com/RustPython/RustPython/pull/9713/commits/91aa222588680683e1ea9b6cab6f44c1a25ac912
5777aed Share code construction and replacement controls youknowdot Nov 4, 2026 https://github.com/RustPython/RustPython/pull/9713/commits/5777aed9b629c4cea228737f1622241bb72125d0
7808947 Use canonical code constructor argument names codex Nov 6, 2026 https://github.com/RustPython/RustPython/pull/9713/commits/7808947835f293205e312f5572a9dcea77df6b03
b0aecbb Rely on scope cleanup for redundant explicit drops codex Nov 6, 2026 https://github.com/RustPython/RustPython/pull/9713/commits/b0aecbb48d234331cbdde29950d28a3ecd7d1f3e
886c794 Use shared binding validation for retained code arguments codex Nov 7, 2026 https://github.com/RustPython/RustPython/pull/9713/commits/886c794856d7c9432bdaac3bc1a4fdffb6b465dc
Clear filters https://github.com/RustPython/RustPython/pull/9713/files
Please reload this pagehttps://github.com/RustPython/RustPython/pull/9713/files
Please reload this pagehttps://github.com/RustPython/RustPython/pull/9713/files
bytecode.rs https://github.com/RustPython/RustPython/pull/9713/files#diff-14e38729fc9f6fc42fa6a3125689aa0034480a2cf3ebd59f1c4d1f40fdcd36a0
code.rs https://github.com/RustPython/RustPython/pull/9713/files#diff-77c714638c90d3ce93194eec52bdefe7301d53f84d90a45c87289b21a11383f9
crates/compiler-core/src/bytecode.rshttps://github.com/RustPython/RustPython/pull/9713/files#diff-14e38729fc9f6fc42fa6a3125689aa0034480a2cf3ebd59f1c4d1f40fdcd36a0
View file https://github.com/youknowdot/RustPython/blob/886c794856d7c9432bdaac3bc1a4fdffb6b465dc/crates/compiler-core/src/bytecode.rs
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/RustPython/RustPython/pull/9713/{{ revealButtonHref }}
https://github.com/RustPython/RustPython/pull/9713/files#diff-14e38729fc9f6fc42fa6a3125689aa0034480a2cf3ebd59f1c4d1f40fdcd36a0
https://github.com/RustPython/RustPython/pull/9713/files#diff-14e38729fc9f6fc42fa6a3125689aa0034480a2cf3ebd59f1c4d1f40fdcd36a0
Please reload this pagehttps://github.com/RustPython/RustPython/pull/9713/files
Please reload this pagehttps://github.com/RustPython/RustPython/pull/9713/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.