Title: Align weak-reference comparison and ownership controls by youknowdot · Pull Request #9710 · RustPython/RustPython · GitHub
Open Graph Title: Align weak-reference comparison and ownership controls by youknowdot · Pull Request #9710 · RustPython/RustPython
X Title: Align weak-reference comparison and ownership controls by youknowdot · Pull Request #9710 · RustPython/RustPython
Description: Summary Align weak-reference and proxy controls with Python 3.15 in three Rust files (+101/-92). Return raw weak-reference comparison results, preserve exact equality/inequality dispatch, and accept both proxy payload types as CPython does. Unwrap both proxy operands through the existing binary helper. Release upgraded binary/ternary operands in argument order after callbacks, including errors, without forcing comparison results to bool. Let the outer weak-reference hash result replace a recursively populated cache, or clear that cache on failure, before releasing the referent. Give live and dead proxies their own repr without invoking referent repr; preserve lossless type-name formatting when composed with #9700. Preserve Cell's raw comparison results while releasing owned contents in left-to-right order through a borrowed comparison call. Validation Compared against pinned CPython d220409a13b77de7a6c30abe16ea90db01528edc weakrefobject.c, cellobject.c and weakrefobject.h. The external CPython oracle passes 149 assertions plus 20 additional exact-repr assertions covering raw results, exact operations, both proxy types, dead operands, repr callback bypass, reentrant hash cache outcomes, and callback/finalizer order. Independent source/lifetime review passed on the final patch. An independent external oracle passed another 172 assertions, including direct proxy-slot dispatch, nested hash error/cache outcomes and last-owner finalizer visibility. Final threaded cargo check passed (1m03s) and all-target Clippy passed (1m34s), with exactly the 12 unchanged baseline diagnostics. Normal commit hooks passed without bypass. No Python tests, repository test logic, markers, Lib files or workflows are changed. Limits and integration Native RustPython execution remains unperformed because the required safety guard is not verified. External reference assertions and source review do not establish a native runtime pass; hosted CI remains necessary. Cross-thread hash critical-section equivalence and concurrent stress behavior are not established by this single-threaded compatibility work. The pinned CPython runtime leaks earlier upgraded operands when a later proxy is dead, and can corrupt a pending hash exception during finalizer reentry. Those upstream anomalies are deliberately not reproduced: Rust retains safe cleanup and the original error. Traceback-owned operand lifetimes can separately delay finalizers. Standalone surrogate module/qualname fidelity remains limited by the current shared helper; full lossless names require #9700. Constructor parsing remains unchanged. The patch preserves #9699's reversed-method area and composes with #9700's qualified-name return type change using the existing WTF-8 helper rather than a second formatter. Payload validation/ownership infrastructure from #8963/#8944/#8939 is not duplicated. Summary by CodeRabbit Bug Fixes Comparisons involving weak references and proxies now handle equality, inequality, and other comparison operations more consistently, including when the referenced object is no longer available. Weak proxy representations now show the referenced object’s type and ID while it is alive, and clearly indicate when the reference is dead. Weak reference hashing now uses the referenced object’s computed hash and reports an error if the object is no longer available.
Open Graph Description: Summary Align weak-reference and proxy controls with Python 3.15 in three Rust files (+101/-92). Return raw weak-reference comparison results, preserve exact equality/inequality dispatch, and acce...
X Description: Summary Align weak-reference and proxy controls with Python 3.15 in three Rust files (+101/-92). Return raw weak-reference comparison results, preserve exact equality/inequality dispatch, and acce...
Opengraph URL: https://github.com/RustPython/RustPython/pull/9710
X: @github
Domain: github.com
| 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 | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:9ced5202-7f54-e8b1-b780-edcf698a7125 |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | BA28:3D97C8:32FBB9B:43D6543:6B01F397 |
| html-safe-nonce | 335cf610f26d6ba33fbb56c7f1e1b27970b4135a20efec39de32edbf964666e6 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCQTI4OjNEOTdDODozMkZCQjlCOjQzRDY1NDM6NkIwMUYzOTciLCJ2aXNpdG9yX2lkIjoiNTIwOTk2MzMxNjYwNDE3MTE1OSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | eb137fc9fffaccee307325fbb92ebdfca0ac4cb28a9c2de77cec69dfb5d81ac2 |
| hovercard-subject-tag | pull_request:5157373537 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,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/RustPython/RustPython/pull/9710/files |
| twitter:image | https://avatars.githubusercontent.com/u/336763669?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/336763669?s=400&v=4 |
| og:image:alt | Summary Align weak-reference and proxy controls with Python 3.15 in three Rust files (+101/-92). Return raw weak-reference comparison results, preserve exact equality/inequality dispatch, and acce... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | 87e774ee7c6b3bee0490394e4d3e57ec9dbc956f74b87ea685dc8996c1676456 |
| turbo-cache-control | no-preview |
| diff-view | unified |
| go-import | github.com/RustPython/RustPython git https://github.com/RustPython/RustPython.git |
| octolytics-dimension-user_id | 39710557 |
| octolytics-dimension-user_login | RustPython |
| octolytics-dimension-repository_id | 135201145 |
| octolytics-dimension-repository_nwo | RustPython/RustPython |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 135201145 |
| octolytics-dimension-repository_network_root_nwo | RustPython/RustPython |
| turbo-body-classes | logged-out env-production page-responsive full-width |
| disable-turbo | true |
| 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 |
Links:
Viewport: width=device-width