Copilot
|
7e637e8cbd
|
Add __callback__ property to weakref type (#7590)
* Initial plan
* Add __callback__ property to PyWeak for weakref compatibility
Add get_callback() method to PyWeak in core.rs that safely reads the
callback field under the stripe lock. Expose it as a read-only
__callback__ property on the weakref type, matching CPython behavior:
- Returns the callback function when one was provided and referent is alive
- Returns None when no callback was provided
- Returns None after the referent has been collected
- Raises AttributeError on assignment (read-only)
Remove @unittest.expectedFailure from test_callback_attribute and
test_callback_attribute_after_deletion in test_weakref.py.
Add regression tests to extra_tests/snippets/stdlib_weakref.py.
Agent-Logs-Url: https://github.com/RustPython/RustPython/sessions/a8689daa-4476-4645-a935-0e13c7f7bb42
Co-authored-by: youknowone <69878+youknowone@users.noreply.github.com>
* Fix ruff formatting in stdlib_weakref.py snippet
Agent-Logs-Url: https://github.com/RustPython/RustPython/sessions/4995198f-e083-4dac-823a-166fcf54adc4
Co-authored-by: youknowone <69878+youknowone@users.noreply.github.com>
---------
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: youknowone <69878+youknowone@users.noreply.github.com>
|
2026-04-13 23:58:58 +09:00 |
|