Repository navigation
Stream deque inputs and release evicted items outside locks - #8860
Conversation
Assisted-by: Codex:GPT-6
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository: RustPython/RustPython/.coderabbit.yml Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (2)
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 7 remain after this review. 📝 WalkthroughWalkthroughDeque append and extension operations now share helpers for insertion, mutation tracking, and maxlen trimming. Extension handles self-extension, bounded containers, and other iterables through distinct paths. New tests cover partial updates on errors, iterator behavior, and object lifetime. ChangesDeque mutation and extension
Priority: ⬇️ Low Estimated code review effort: 3 (Moderate) | ~20 minutes Change: Bug fix Suggested reviewers: Merge Risk: ⚪ Minimal · up to No confirmed issue prevents merging after normal checks. Security Architecture ReviewSecurity architecture risk: 🔵 Low · up to Streaming inputs and releasing evicted objects outside the lock improve bounded-memory behavior and reentrancy. A concurrent iterator may now miss a mutation in an additional scheduling window. No privilege expansion or sensitive-data path was established. Retained concerns
Security review detailsSecurity Blast Radius
Trust Boundaries and Controls
Resilience and Maintainability Implications
Hardening Proposals
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
Merging this PR will not alter performance
Comparing Footnotes
|
Summary
Consume inputs incrementally in deque construction,
extend,extendleft, and+=. Bounded deques no longer materialize generated inputs, and items already consumed remain in the deque when iteration raises.Release evicted items outside the deque lock so finalizers can reenter safely. Empty or immediately failing
extend/extendleftcalls preserve existing iterators. Prepending no longer rebuilds the entire deque for each batch.Follow-up to #8567 and #8847.
Performance
Consuming 10,000 generated objects reduces peak live objects from 10,000 to 9 with
maxlen=8, and from 10,000 to 1 withmaxlen=0.Release build, medians of three runs:
deque(maxlen=64), thenextend(range(4096))AI assistance
Written with Codex (GPT-6), reviewed by a human before submission.
Summary by CodeRabbit