gh-89360: Fix ValueError in IDLE MultiCall event_delete#152738
Merged
terryjreedy merged 1 commit intoJul 1, 2026
Conversation
Deleting a key binding for a sequence not bound to the virtual event no longer raises a ValueError; the discrepancy is now ignored.
|
Thanks @serhiy-storchaka for the PR, and @terryjreedy for merging it 🌮🎉.. I'm working now to backport this PR to: 3.13, 3.14, 3.15. |
|
GH-152802 is a backport of this pull request to the 3.15 branch. |
|
GH-152803 is a backport of this pull request to the 3.14 branch. |
|
GH-152804 is a backport of this pull request to the 3.13 branch. |
terryjreedy
pushed a commit
that referenced
this pull request
Jul 1, 2026
…2738) (#152804) gh-89360: Fix ValueError in IDLE MultiCall event_delete (GH-152738) Deleting a key binding for a sequence not bound to the virtual event no longer raises a ValueError; the discrepancy is now ignored. (cherry picked from commit ea7619f) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
terryjreedy
pushed a commit
that referenced
this pull request
Jul 1, 2026
…2738) (#152803) gh-89360: Fix ValueError in IDLE MultiCall event_delete (GH-152738) Deleting a key binding for a sequence not bound to the virtual event no longer raises a ValueError; the discrepancy is now ignored. (cherry picked from commit ea7619f) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
terryjreedy
pushed a commit
that referenced
this pull request
Jul 1, 2026
…2738) (#152802) gh-89360: Fix ValueError in IDLE MultiCall event_delete (GH-152738) Deleting a key binding for a sequence not bound to the virtual event no longer raises a ValueError; the discrepancy is now ignored. (cherry picked from commit ea7619f) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
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.
MultiCall.event_delete()calledtriplets.remove(triplet)unconditionally. When the sequence was not actually bound to the virtual event — a rare discrepancy that could happen when the completion window was closed — this raisedValueError: list.remove(x): x not in list, crashing through the Tk callback (reported by @rhettinger).The unbind and remove are now skipped when the sequence is not bound. This is safer than catching only
triplets.remove(), because the binder'sunbind()also doesbindedfuncs.remove(func), which would raiseValueErroras well.event_add()pairs the bind and append, so the membership check keeps both structures consistent.The added test reproduces the exact scenario (add one sequence, delete a different one); it raises the reported
ValueErrorwithout the fix.🤖 Generated with Claude Code