gh-126219: Fix crash in tkinter.Tk with non-BMP className on Tcl/Tk 8.x#151980
Open
serhiy-storchaka wants to merge 1 commit into
Open
gh-126219: Fix crash in tkinter.Tk with non-BMP className on Tcl/Tk 8.x#151980serhiy-storchaka wants to merge 1 commit into
serhiy-storchaka wants to merge 1 commit into
Conversation
f5c0917 to
bf0f06a
Compare
…l/Tk 8.x Tcl 8.x crashes when title-casing a non-BMP character during Tk initialization, so such a className is now rejected with a ValueError. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
bf0f06a to
8088525
Compare
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.
tkinter.Tk(className='\U0010FFFF')(and the underlying_tkinter.create()) crashes with a segfault when tkinter is built against Tcl/Tk 8.x.The class name is title-cased during Tk initialization, and Tcl 8.x crashes in
Tcl_UtfToTitle()on non-BMP characters (encoded as 4-byte UTF-8 sequences). Such a className is now rejected with aValueErrorbefore Tk is initialized.Tcl 9 supports non-BMP characters and is not affected; the check is compiled out there.
Among the other string arguments of
_tkinter.create(), onlyclassNameis affected —screenName,baseNameandusefail gracefully.(The same Tcl 8.x bug also affects
Tcl_UtfToUpper()/Tcl_UtfToLower(), reachable via e.g.tk.call('string', 'toupper', ...), but that is a general Tcl issue that cannot be guarded on the CPython side.)🤖 Generated with Claude Code
tkinter.Tksegfault with invalidclassName#126219