Repository navigation
Honor freezing when deleting or popping a keypath from a benedict instance - #635
Merged
fabiocaccamo merged 2 commits intoOct 20, 2026
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #635 +/- ##
=======================================
Coverage 98.69% 98.69%
=======================================
Files 65 65
Lines 2446 2450 +4
=======================================
+ Hits 2414 2418 +4
Misses 32 32
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
…move changelog entry.
fabiocaccamo
approved these changes
Oct 20, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Describe your changes
A frozen
benedictrejectsd["a.b"] = 2, butdel d["a.b"]andd.pop("a.b")still remove the nested value. Keypath deletion resolves a nested parent and operates on it without reaching the root frozen check.Check the root state in
benedict.__delitem__andbenedict.pop, alongside the existingbenedict.__setitem__check. The production change adds five lines. Directly obtained nested dictionaries and lists remain mutable, as documented for shallow freeze. The lower-level keylist/keypath classes retain their existing behavior.Five test methods cover dotted paths, keylists, list indexes, custom separators,
popwith omitted/None/explicit defaults, missing paths, unfrozen and unfrozen-again instances, and direct child mutation. Add one Unreleased changelog entry.Related issue
Fixes #634
Validation
c4c8a58d517b4ceaa21b6d7529afe1527446100e.python -m unittest— 963 tests ran.popkeypath, 8delkeypath, 6 missing keypath with default). Mutable and direct-child controls passed.python -m unittest tests.dicts.test_benedict_freeze— 25 tests passed.python -m unittest— 968 tests ran.check-yamlhad no matching files.python -m mypy benedict(Mypy 2.3.1) — no issues in 65 source files.git diff --checkpassed.Environment: Windows CPython 3.13.5; an earlier run on Linux CPython 3.12.14 produced the same test counts and the same failure breakdown. A few IO tests that fetch fixtures over the network were skipped by transport errors in both runs and are unrelated to this change.
Checklist before requesting a review
Disclosure: developed, tested, and self-reviewed with Codex. No human or independent agent review is claimed.