FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

gh-157676: Fix KeyError in tkinter.simpledialog when a foreign window holds the grab by serhiy-storchaka · Pull Request #157677 · python/cpython · GitHub

Repository navigation

gh-157676: Fix KeyError in tkinter.simpledialog when a foreign window holds the grab - #157677

Merged
serhiy-storchaka merged 4 commits into
python:mainfrom
serhiy-storchaka:gh-157676-simpledialog-grab
Sep 29, 2026
Merged

serhiy-storchaka merged 4 commits into
python:mainfrom
serhiy-storchaka:gh-157676-simpledialog-grab

Conversation

Copy link
Copy Markdown
Member

_temp_grab_focus() used grab_current() and focus_get(), which raise KeyError for windows which were not created by tkinter, such as a native message box. Use Tcl window names instead. Regression from #151848, not released.

🤖 Generated with Claude Code

…window holds the grab

_temp_grab_focus() used grab_current() and focus_get(), which raise
KeyError for windows which were not created by tkinter, such as a native
message box.  Use Tcl window names instead.
The dialog can destroy a temporary default root, and then even "winfo"
fails with "application has been destroyed".
On the Windows CI runners "focus -force" has no effect, because
SetForegroundWindow() is refused for a background process.
The application can lose the focus when the dialog is destroyed, and
"focus" without -force does not take it back.
serhiy-storchaka merged commit 3736342 into python:main Sep 29, 2026
49 checks passed
serhiy-storchaka deleted the gh-157676-simpledialog-grab branch September 29, 2026 12:56
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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant


Back | FazBrowse Home | New Git URL