[issue42225] Tkinter hangs or crashes when displaying astral chars

STINNER Victor report at bugs.python.org
Tue Nov 3 12:00:22 EST 2020


STINNER Victor <vstinner at python.org> added the comment:

The following program fails with:
---
X Error of failed request:  BadLength (poly request too large or internal Xlib length error)
  Major opcode of failed request:  138 (RENDER)
  Minor opcode of failed request:  20 (RenderAddGlyphs)
  Serial number of failed request:  4248
  Current serial number in output stream:  4956
---

Python program:
---
from tkinter import Tk
from tkinter.scrolledtext import ScrolledText
root = Tk()
text = ScrolledText(root, width=80, height=40)
text.pack()

for i in range(0x10000, 0x40000, 32):
    chars = ''.join(chr(i+j) for j in range(32))
    text.insert('insert', f"{hex(i)} {chars}\n")

input("Press enter to exit")
---

It seems like the first character which triggers this RenderAddGlyphs BadLength issue is: U+1f6c2. See attached emoji.png screenshot. As you can see, some emojis are rendered in color in Gnome Terminal. I guess that it uses the Gtk 3 pango library to render these characters.

----------
Added file: https://bugs.python.org/file49567/emojis.png

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


More information about the Python-bugs-list mailing list