introduce iterator helpers that manage recursion / time#454
Conversation
Merging this PR will not alter performance
Comparing Footnotes
|
Codecov Results 📊❌ Patch coverage is 10.00%. Project has 24165 uncovered lines. Files with missing lines (25)Coverage diff@@ Coverage Diff @@
## main #PR +/-##
==========================================
- Coverage 66.19% 66.15% -0.04%
==========================================
Files 279 279 —
Lines 71052 71389 +337
Branches 152853 153482 +629
==========================================
+ Hits 47030 47224 +194
- Misses 24022 24165 +143
- Partials 3993 4036 +43Generated by Codecov Action |
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
There was a problem hiding this comment.
2 issues found across 25 files
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="crates/monty/src/types/dict_view.rs">
<violation number="1" location="crates/monty/src/types/dict_view.rs:70">
P1: These view equality helpers still squash membership errors into `false`, so cyclic key/item comparisons can return unequal instead of raising `RecursionError`.</violation>
</file>
<file name="crates/monty/src/types/set.rs">
<violation number="1" location="crates/monty/src/types/set.rs:285">
P1: Propagate `other.contains` errors here instead of collapsing them into `false`.</violation>
</file>
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
There was a problem hiding this comment.
1 issue found across 3 files (changes from recent commits).
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
There was a problem hiding this comment.
1 issue found across 13 files (changes from recent commits).
Tip: Review your code locally with the cubic CLI to iterate faster.
Re-trigger cubic
This generally seeks to avoid cases where recursion inside iteration could lead to resource overflows. I introduce iteration helpers to each container which check both recursion and time on each turn.
Summary by cubic
Introduces recursion/time-aware lending iterators for core containers and rebuilds
json.dumpsto stream with them. Deep nesting now raisesRecursionError, JSON cycles are detected, comparison/sort errors propagate, and resource exhaustion never corrupts heap state.Refactors
check_time()on each step.json.dumpsaround a streaming encoder using these iterators; dicts pre-collect entries forskipkeys/sort_keys, take an explicit recursion token, and track active containers to detect cycles.py_eq/py_cmpacross core types andValueto returnRunResult; sorting passes errors through without extra wrapping.sys.setrecursionlimit()(behindtest-hooks), backed byResourceTracker::lower_recursion_limitand forwarded viamonty-python.Bug Fixes
list.count/index/removeanddict.updateiterate under recursion tokens; cycles don’t panic; deep comparisons raiseRecursionError.enumerateandbytes.splitlinesbuild results underHeapGuardso early exits/timeouts don’t leave partial heap state.LimitedTrackeris now backward-compatible with prior formats.sys.setrecursionlimit()hook.Written for commit 5971c5c. Summary will update on new commits. Review in cubic