Repository navigation
Keep rejected ManyToMany additions from changing keys - #601
Closed
Gambit-Checkmate wants to merge 1 commit into
Closed
Gambit-Checkmate wants to merge 1 commit into
Gambit-Checkmate wants to merge 1 commit into
Conversation
Owner
|
Folded into #609 (see the PR description for credit). Thanks for the report and the repro. |
This was referenced Oct 26, 2026
blebo
pushed a commit
to blebo/boltons
that referenced
this pull request
Nov 1, 2026
This was referenced Nov 2, 2026
This was referenced Nov 9, 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.
The change
Closes #600.
Validate the value's hashability before creating its forward key in
ManyToMany.add. A rejected list/dict/set value currently leaves an empty key in the relation, changing its length and iteration despite raising TypeError. Adding through the inverse relation has the same problem.The regression tests check unchanged forward/inverse edges and key sets for six invalid additions, plus successful and repeated additions in both directions. All six invalid cases fail before the fix; both positive controls pass.
Validation on Windows / CPython 3.13.13:
check --select E9,Fon the changed Python files: passed.compileallfor changed Python files andgit diff --check: passed.Other Python versions and platforms await upstream CI. This does not change copying/update behavior (#526) or replacement behavior (previously proposed in #528).
The backstory
This is another contribution from the same automated contribution effort as #567. Source inspection found that failed
addcalls create a key before rejecting the value, and a short example reproduced the state change. This was discovered through code inspection, not through personal production use; the example is a reproducer rather than a claimed incident.AI assistance
Hosted CI: Actions run39876090658 is
action_requiredfor external-contribution approval; no hosted tests have executed for this head yet.