Package: python3-tk
Version: 3.10.5-1
Severity: normal
X-Debbugs-Cc: d...@shallowsky.com

Dear Maintainer,

When creating a Tk label with:
    label = Label(frame, text=item, font=(item, 70)).pack()
Tk will dump core if the font is various Noto fonts, including
(but not limited to):
    'Noto Kufi Arabic', 'Noto Looped Lao', 'Noto Mono',
    'Noto Looped Lao UI', 'Noto Looped Thai',
    'Noto Looped Thai UI', 'Noto Music',
    'Noto Naskh Arabic', 'Noto Naskh Arabic UI',
    'Noto Nastaliq Urdu', 'Noto Rashi Hebrew',
    'Noto Sans', 'Noto Sans Adlam', 'Noto Sans Adlam Unjoined'

But the core dump only happens if the font list is sorted first.
If labels are created in the order that comes from font.families(),
there's no crash; if they're created in alphabetical order, crash.

I can get the font list from a python gtk3 program, sort the list
and display each font, so I don't think the bug is with the noto
fonts: they may have some sort of error, but gtk finds a way to
work around it and tkinter should at least not crash python; at
most it should raise an exception.

A minimal program to reproduce the problem:

==== BEGIN PROGRAM

from tkinter import Tk, font, Canvas, Frame, Label

root = Tk()
fonts = list(font.families())

# The crash only happens if you sort the font list:
# comment this out to see the full, but unsorted, font list.
fonts.sort()

def list_fonts(frame):
    """Show a list of font labels"""
    for item in sorted(fonts):
        print(item)

        # Crash will happen on this line:
        label = Label(frame, text=item, font=(item, 16)).pack()

canvas = Canvas(root, borderwidth=0, background="#ffffff")
frame = Frame(canvas, background="#ffffff")

list_fonts(frame)

==== END PROGRAM

The noto* packages I have installed are:
    fonts-noto fonts-noto-color-emoji fonts-noto-core fonts-noto-mono
    fonts-noto-ui-core

I installed python3.10-dbg libpython3.10-dbg python3-tk-dbg
and the gdb stack trace is:

#0  0x00007fef676a062f in _XReply () from /lib/x86_64-linux-gnu/libX11.so.6
#1  0x00007fef6769bb4b in XSync () from /lib/x86_64-linux-gnu/libX11.so.6
#2  0x00007fef679afd22 in Tk_DeleteErrorHandler ()
   from /lib/x86_64-linux-gnu/libtk8.6.so
#3  0x00007fef67a69502 in Tk_MeasureChars ()
   from /lib/x86_64-linux-gnu/libtk8.6.so
#4  0x00007fef67a68bd6 in ?? () from /lib/x86_64-linux-gnu/libtk8.6.so
#5  0x00007fef67a68f46 in ?? () from /lib/x86_64-linux-gnu/libtk8.6.so
#6  0x00007fef679b3996 in Tk_AllocFontFromObj ()
   from /lib/x86_64-linux-gnu/libtk8.6.so
#7  0x00007fef679ac90f in ?? () from /lib/x86_64-linux-gnu/libtk8.6.so
#8  0x00007fef679ac31c in Tk_InitOptions ()
   from /lib/x86_64-linux-gnu/libtk8.6.so
#9  0x00007fef679d25ef in ?? () from /lib/x86_64-linux-gnu/libtk8.6.so
#10 0x00007fef677e2452 in TclNRRunCallbacks ()
   from /lib/x86_64-linux-gnu/libtcl8.6.so
#11 0x00007fef67c73037 in Tkapp_Call (selfptr=0x7fef67ca8720,
    args=<optimized out>) at Modules/_tkinter.c:1596
#12 0x0000000000660cfe in method_vectorcall_VARARGS (func=0x7fef67c91f70,
    args=0x1387dd0, nargsf=<optimized out>, kwnames=<optimized out>)
    at ../Objects/descrobject.c:311
#13 0x00000000004d905d in _PyObject_VectorcallTstate (tstate=0xf0cca0,
    callable=0x7fef67c91f70, args=0x1387dd0, nargsf=9223372036854775810,
    kwnames=0x0) at ../Include/cpython/abstract.h:114
#14 0x00000000004dd27e in PyObject_Vectorcall (kwnames=0x0,
    nargsf=9223372036854775810, args=0x1387dd0, callable=0x7fef67c91f70)
    at ../Include/cpython/abstract.h:123
#15 call_function (tstate=tstate@entry=0xf0cca0,
    trace_info=trace_info@entry=0x7fff13f42d10,
    pp_stack=pp_stack@entry=0x7fff13f42cb8, oparg=oparg@entry=2,
    kwnames=kwnames@entry=0x0) at ../Python/ceval.c:5869
--Type <RET> for more, q to quit, c to continue without paging--
#16 0x00000000004ea05b in _PyEval_EvalFrameDefault (tstate=0xf0cca0,
    f=0x1387c20, throwflag=<optimized out>) at ../Python/ceval.c:4198
#17 0x00000000004ec645 in _PyEval_EvalFrame (throwflag=0, f=0x1387c20,
    tstate=0xf0cca0) at ../Include/internal/pycore_ceval.h:46
#18 _PyEval_Vector (tstate=0xf0cca0, con=0x7fef67ce22c0,
    locals=locals@entry=0x0, args=<optimized out>, argcount=<optimized out>,
    kwnames=<optimized out>) at ../Python/ceval.c:5065
#19 0x000000000042f91e in _PyFunction_Vectorcall (func=<optimized out>,
    stack=<optimized out>, nargsf=<optimized out>, kwnames=<optimized out>)
    at ../Objects/call.c:342
#20 0x00000000004d905d in _PyObject_VectorcallTstate (tstate=0xf0cca0,
    callable=0x7fef67ce22b0, args=0x7fef67c7e0e0, nargsf=9223372036854775813,
    kwnames=0x0) at ../Include/cpython/abstract.h:114
#21 0x00000000004dd27e in PyObject_Vectorcall (kwnames=0x0,
    nargsf=9223372036854775813, args=0x7fef67c7e0e0, callable=0x7fef67ce22b0)
    at ../Include/cpython/abstract.h:123
#22 call_function (tstate=tstate@entry=0xf0cca0,
    trace_info=trace_info@entry=0x7fff13f42f40,
    pp_stack=pp_stack@entry=0x7fff13f42ee8, oparg=oparg@entry=5,
    kwnames=kwnames@entry=0x0) at ../Python/ceval.c:5869
#23 0x00000000004ea12d in _PyEval_EvalFrameDefault (tstate=0xf0cca0,
    f=0x7fef67c7df50, throwflag=<optimized out>) at ../Python/ceval.c:4181
#24 0x00000000004ec645 in _PyEval_EvalFrame (throwflag=0, f=0x7fef67c7df50,
    tstate=0xf0cca0) at ../Include/internal/pycore_ceval.h:46
#25 _PyEval_Vector (tstate=0xf0cca0, con=0x7fef67ce9df0,
    locals=locals@entry=0x0, args=<optimized out>, argcount=<optimized out>,
    kwnames=<optimized out>) at ../Python/ceval.c:5065
#26 0x000000000042f91e in _PyFunction_Vectorcall (func=<optimized out>,
    stack=<optimized out>, nargsf=<optimized out>, kwnames=<optimized out>)
    at ../Objects/call.c:342
#27 0x0000000000430232 in _PyObject_FastCallDictTstate (
--Type <RET> for more, q to quit, c to continue without paging--
    tstate=tstate@entry=0xf0cca0, callable=callable@entry=0x7fef67ce9de0,
    args=args@entry=0x7fff13f43060, nargsf=nargsf@entry=2,
    kwargs=kwargs@entry=0x7fef67e30590) at ../Objects/call.c:153
#28 0x00000000004303bd in _PyObject_Call_Prepend (
    tstate=tstate@entry=0xf0cca0, callable=callable@entry=0x7fef67ce9de0,
    obj=obj@entry=0x7fef67d48c30, args=args@entry=0x7fef67f82850,
    kwargs=kwargs@entry=0x7fef67e30590) at ../Objects/call.c:431
#29 0x000000000048910d in slot_tp_init (self=0x7fef67d48c30,
    args=0x7fef67f82850, kwds=0x7fef67e30590) at ../Objects/typeobject.c:7731
#30 0x0000000000485590 in type_call (type=0x1019c10, args=0x7fef67f82850,
    kwds=0x7fef67e30590) at ../Objects/typeobject.c:1135
#31 0x000000000042fc7e in _PyObject_MakeTpCall (tstate=tstate@entry=0xf0cca0,
    callable=callable@entry=0x1019c10, args=args@entry=0x7fef67e6dfe0,
    nargs=<optimized out>, keywords=keywords@entry=0x7fef67f734d0)
    at ../Objects/call.c:215
#32 0x00000000004d9130 in _PyObject_VectorcallTstate (tstate=0xf0cca0,
    callable=0x1019c10, args=0x7fef67e6dfe0, nargsf=<optimized out>,
    kwnames=0x7fef67f734d0) at ../Include/cpython/abstract.h:112
#33 0x00000000004dd27e in PyObject_Vectorcall (kwnames=0x7fef67f734d0,
    nargsf=9223372036854775809, args=0x7fef67e6dfe0, callable=0x1019c10)
    at ../Include/cpython/abstract.h:123
#34 call_function (tstate=tstate@entry=0xf0cca0,
    trace_info=trace_info@entry=0x7fff13f43320,
    pp_stack=pp_stack@entry=0x7fff13f432d8, oparg=oparg@entry=3,
    kwnames=kwnames@entry=0x7fef67f734d0) at ../Python/ceval.c:5869
#35 0x00000000004ea2ec in _PyEval_EvalFrameDefault (tstate=0xf0cca0,
    f=0x7fef67e6de50, throwflag=<optimized out>) at ../Python/ceval.c:4231
#36 0x00000000004ec645 in _PyEval_EvalFrame (throwflag=0, f=0x7fef67e6de50,
    tstate=0xf0cca0) at ../Include/internal/pycore_ceval.h:46
#37 _PyEval_Vector (tstate=0xf0cca0, con=0x7fef683cc950,
    locals=locals@entry=0x0, args=<optimized out>, argcount=<optimized out>,
--Type <RET> for more, q to quit, c to continue without paging--c
    kwnames=<optimized out>) at ../Python/ceval.c:5065
#38 0x000000000042f91e in _PyFunction_Vectorcall (func=<optimized out>, 
stack=<optimized out>, nargsf=<optimized out>, kwnames=<optimized out>) at 
../Objects/call.c:342
#39 0x00000000004d905d in _PyObject_VectorcallTstate (tstate=0xf0cca0, 
callable=0x7fef683cc940, args=0xf6c098, nargsf=9223372036854775809, 
kwnames=0x0) at ../Include/cpython/abstract.h:114
#40 0x00000000004dd27e in PyObject_Vectorcall (kwnames=0x0, 
nargsf=9223372036854775809, args=0xf6c098, callable=0x7fef683cc940) at 
../Include/cpython/abstract.h:123
#41 call_function (tstate=tstate@entry=0xf0cca0, 
trace_info=trace_info@entry=0x7fff13f43550, 
pp_stack=pp_stack@entry=0x7fff13f43500, oparg=oparg@entry=1, 
kwnames=kwnames@entry=0x0) at ../Python/ceval.c:5869
#42 0x00000000004ea1b5 in _PyEval_EvalFrameDefault (tstate=0xf0cca0, 
f=0xf6bf30, throwflag=<optimized out>) at ../Python/ceval.c:4213
#43 0x00000000004ec645 in _PyEval_EvalFrame (throwflag=0, f=0xf6bf30, 
tstate=0xf0cca0) at ../Include/internal/pycore_ceval.h:46
#44 _PyEval_Vector (tstate=tstate@entry=0xf0cca0, con=con@entry=0x7fff13f435f0, 
locals=locals@entry=0x7fef67f1d910, args=args@entry=0x0, 
argcount=argcount@entry=0, kwnames=kwnames@entry=0x0) at ../Python/ceval.c:5065
#45 0x00000000004ec843 in PyEval_EvalCode (co=co@entry=0x7fef67f87370, 
globals=globals@entry=0x7fef67f1d910, locals=locals@entry=0x7fef67f1d910) at 
../Python/ceval.c:1134
#46 0x000000000052aa81 in run_eval_code_obj (tstate=tstate@entry=0xf0cca0, 
co=co@entry=0x7fef67f87370, globals=globals@entry=0x7fef67f1d910, 
locals=locals@entry=0x7fef67f1d910) at ../Python/pythonrun.c:1291
#47 0x000000000052aee4 in run_mod (mod=mod@entry=0xfcb718, 
filename=filename@entry=0x7fef67f794d0, globals=globals@entry=0x7fef67f1d910, 
locals=locals@entry=0x7fef67f1d910, flags=flags@entry=0x7fff13f437a8, 
arena=arena@entry=0x7fef67dfce80) at ../Python/pythonrun.c:1312
#48 0x000000000052afef in pyrun_file (fp=fp@entry=0xf153d0, 
filename=filename@entry=0x7fef67f794d0, start=start@entry=257, 
globals=globals@entry=0x7fef67f1d910, locals=locals@entry=0x7fef67f1d910, 
closeit=closeit@entry=1, flags=0x7fff13f437a8) at ../Python/pythonrun.c:1208
#49 0x000000000052d667 in _PyRun_SimpleFileObject (fp=fp@entry=0xf153d0, 
filename=filename@entry=0x7fef67f794d0, closeit=closeit@entry=1, 
flags=flags@entry=0x7fff13f437a8) at ../Python/pythonrun.c:456
#50 0x000000000052d89e in _PyRun_AnyFileObject (fp=fp@entry=0xf153d0, 
filename=filename@entry=0x7fef67f794d0, closeit=closeit@entry=1, 
flags=flags@entry=0x7fff13f437a8) at ../Python/pythonrun.c:90
#51 0x00000000004201ff in pymain_run_file_obj 
(program_name=program_name@entry=0x7fef67f1dc00, 
filename=filename@entry=0x7fef67f794d0, skip_source_first_line=0) at 
../Modules/main.c:353
#52 0x00000000004204e9 in pymain_run_file (config=config@entry=0xef1040) at 
../Modules/main.c:372
#53 0x0000000000421427 in pymain_run_python 
(exitcode=exitcode@entry=0x7fff13f438cc) at ../Modules/main.c:587
#54 0x0000000000421476 in Py_RunMain () at ../Modules/main.c:666
#55 0x00000000004214cb in pymain_main (args=args@entry=0x7fff13f43910) at 
../Modules/main.c:696
#56 0x0000000000421547 in Py_BytesMain (argc=<optimized out>, argv=<optimized 
out>) at ../Modules/main.c:720
#57 0x000000000041ff9f in main (argc=<optimized out>, argv=<optimized out>) at 
../Programs/python.c:15


-- System Information:
Debian Release: bookworm/sid
  APT prefers unstable
  APT policy: (600, 'unstable')
Architecture: amd64 (x86_64)

Kernel: Linux 5.18.0-2-amd64 (SMP w/8 CPU threads; PREEMPT)
Kernel taint flags: TAINT_WARN
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), LANGUAGE not set
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)

Versions of packages python3-tk depends on:
ii  blt           2.5.3+dfsg-4.1
ii  libc6         2.33-7
ii  libtcl8.6     8.6.12+dfsg-1
ii  libtk8.6      8.6.12-1
ii  python3       3.10.4-1+b1
ii  tk8.6-blt2.5  2.5.3+dfsg-4.1

python3-tk recommends no packages.

Versions of packages python3-tk suggests:
ii  python3-tk-dbg  3.10.5-1
pn  tix             <none>

-- no debconf information

Reply via email to