[issue42225] Tkinter hangs or crashes when displaying astral chars

Terry J. Reedy report at bugs.python.org
Mon Nov 2 22:04:57 EST 2020


Terry J. Reedy <tjreedy at udel.edu> added the comment:

Victor, does my test run to completion (without exception) on your Fedora?  If it does, I definitely would not disable astral char display on Fedora.  This version catches exceptions and reports them separately and runs directly with tkinter, in about a second.

tk = True
if tk:
    from tkinter import Tk
    from tkinter.scrolledtext import ScrolledText
    root = Tk()
    text = ScrolledText(root, width=80, height=40)
    text.pack()
    def print(txt):
        text.insert('insert', txt+'\n')

errors = []
for i in range(0x10000, 0x40000, 32):
    chars = ''.join(chr(i+j) for j in range(32))
    try:
       print(f"{hex(i)} {chars}")
    except Exception as e:
        errors.append(f"{hex(i)} {e}")
print("ERRORS:")
for line in errors:
    print(line)

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue42225>
_______________________________________


More information about the Python-bugs-list mailing list