Skip to content

Compare both dictionaries using current wrapped contents - #645

Open
123qeew wants to merge 1 commit into
fabiocaccamo:mainfrom
123qeew:fix/wrapped-dictionary-comparison
Open

123qeew wants to merge 1 commit into
fabiocaccamo:mainfrom
123qeew:fix/wrapped-dictionary-comparison

Conversation

@123qeew

@123qeew 123qeew commented Oct 26, 2026

Copy link
Copy Markdown

Comparisons can be asymmetric when one benedict owns its contents and another wraps a dictionary. After the backing dictionary changes, owned == wrapped reads the wrapper's stale inherited dict storage, while wrapped == owned reads its current contents. Inequality has the same problem.

Resolve a wrapped right-hand operand before delegating equality and inequality. The regression exercises BaseDict and public benedict, both operand orders, changed/added/deleted keys and matching/nonmatching contents. Existing reflected-comparison tests continue to pass.

Validation on Python 3.13 with the repository's test requirements: the baseline runs 990 tests successfully; the new regression fails in six subcases before the fix; all 991 tests pass afterward. Changed-file Ruff lint/format and full package mypy checks pass.

Disclosure: Codex produced this fix and description during a code audit and ran the checks locally. No production incident or human review is claimed.

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