⚡ Sangsakala Proxy 🏠 Home
Skip to content

Align LRU cache keys and callback controls - #9681

Draft
youknowdot wants to merge 2 commits into
RustPython:mainfrom
youknowdot:lru-cache-controls-group-20261104
Draft

youknowdot wants to merge 2 commits into
RustPython:mainfrom
youknowdot:lru-cache-controls-group-20261104

Conversation

@youknowdot

Copy link
Copy Markdown
Contributor

Summary

  • Match LRU constructor keyword names and conversion order, scalar-key distinctions, and copy-method arity through shared binders and converters.
  • Move bounded hits without replacing stored keys or repeating equality callbacks.
  • Keep cache clearing, recursive insertion and eviction consistent under reentrant equality and finalizers.
  • Add two narrow dictionary operations using existing entry revalidation, leaving unrelated get/pop callers unchanged.

The helper changes address stale reads or removals when equality clears and repopulates a dictionary position. Failed insertion releases the newly computed result before the evicted key/result, matching CPython.

Reference: CPython 3.15.0 LRU implementation.

Validation

  • Independent source review and 13 bounded CPython 3.15 reference groups cover conversion, scalar keys, recursion, equality reentry, eviction and finalizer order.
  • Formatting and whitespace checks passed.
  • Final focused VM, host-env and stdlib check and strict Clippy with rustpython-stdlib/threading passed after removing the obsolete deletion wrapper and a redundant clone. Normal repository hooks passed.
  • RustPython runtime, full workspace/C-API suites and cross-platform execution were not run. No test, Lib, workflow or marker edits.

Composition with #9679 requires reconciling the shared import hunk to retain both ArgIntoBool and Callee; the behavioral sections are separate.

AI assistance: OpenAI Codex performed source comparison, implementation, reference probes and independent source review; model version was not exposed.

Use shared constructor conversions and exact scalar cache keys. Preserve
stored keys during recency updates, validate reentrant lookups through
existing dictionary entry machinery, and match recursive insertion and
eviction reference-release ordering.

Assisted-by: OpenAI Codex:model version not exposed
Drop the now-unused crate-private known-hash deletion wrapper and transfer the owned unbounded cache result directly.

Assisted-by: OpenAI Codex:model version not exposed
@coderabbitai

coderabbitai Bot commented Nov 4, 2026

Copy link
Copy Markdown
Contributor

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@codspeed

codspeed Bot commented Nov 4, 2026

Copy link
Copy Markdown
Contributor

Merging this PR will not alter performance

✅ 62 untouched benchmarks
⏩ 4 skipped benchmarks1


Comparing youknowdot:lru-cache-controls-group-20261104 (8199026) with main (0b081b0)2

Open in CodSpeed

Footnotes

  1. 4 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports. ↩

  2. No successful run was found on main (bc0a49c) during the generation of this report, so 0b081b0 was used instead as the comparison base. There might be some changes unrelated to this pull request in this report. ↩

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant