Repository navigation
Mark LRU cache wrappers as method descriptors - #9072
Conversation
Match the Python 3.14 wrapper type flag and enable the existing guarded method-call fast path. Keep the partial vectorcall changes separate. Assisted-by: OpenAI Codex:model identifier unavailable
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Merge Risk: ⚪ Minimal · up to The flag enables the wrapper’s existing method-descriptor behavior, with no concrete regression identified. The change presents no actionable merge-blocking risk. Pre-merge checks |
|
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c251a89292
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| from testutils import assert_raises | ||
|
|
||
| # Cached wrappers support method-descriptor lookup and binding. | ||
| assert _lru_cache_wrapper.__flags__ & (1 << 17) |
There was a problem hiding this comment.
Remove the forbidden test assertion
For this change, the added line modifies an existing snippet test by introducing a new assertion. The root AGENTS.md marks these restrictions as critical, forbids changing test assertions/logic/data, and limits permitted test-file edits to expected-failure decorator updates, so this assertion (and its supporting import/comment) must be removed from the patch.
AGENTS.md reference: AGENTS.md:L275-L279
Useful? React with 👍 / 👎.
Summary
Extract the independent
_lru_cache_wrappermethod-descriptor flag from #8954. CPython 3.14.7 and 3.14.8 already setPy_TPFLAGS_METHOD_DESCRIPTORon this type. RustPython already implements the required class/instance descriptor binding, so this enables its existing guarded method-call path without changing the wrapper's call implementation.The partial/vectorcall rewrite and other Python 3.15 changes remain separate. Checked the relevant open functools/ownership work for overlap; this is the single wrapper flag, not a cache or ownership redesign.
Validation
stdlib_functools.pygains one focused Python assertion on the actual C-style wrapper type's flag. Full snippet passes on CPython 3.14.7, CPython 3.14.8, and the patched native RustPython build. The pre-patch native binary fails that new assertion.TestLRUCtests pass: method binding, copy, deepcopy, pickle, keyword arguments, and unlimited cache.This validates the flag contract and existing behavior, not a measured performance improvement. Local validation is Linux and bounded; the full hosted matrix remains required.
Summary by CodeRabbit