Skip to content

Allow freezing cyclic and deeply nested dictionaries - #159

Open
oyeong011 wants to merge 1 commit into
mewwts:masterfrom
oyeong011:fix/freeze-cyclic-dicts
Open

oyeong011 wants to merge 1 commit into
mewwts:masterfrom
oyeong011:fix/freeze-cyclic-dicts

Conversation

@oyeong011

Copy link
Copy Markdown

Allow freezing cyclic and deeply nested dictionaries.

Replace unbounded recursive traversal with an identity-visited explicit stack for built-in Dict.freeze. Custom child freeze overrides retain dispatch. Tests cover cycles, 1500-level chain, freeze/unfreeze and subclass overrides.

Validation: 134 tests passed on Python 3.14; public API reproduction passes. Built-in traversal only; custom child freeze overrides remain responsible for their own cyclic traversal. O(number of distinct Dict nodes) visited memory; no changes to nested list handling. Python 3.14 only.

AI assistance: OpenAI Codex prepared this change and regression tests.

Tested: 134 tests passed; cyclic/shared graph and 2000-level API QA

Confidence: high

Scope-risk: moderate

Constraint: Preserve dispatch to custom child freeze overrides.
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