You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Crash in tkinter when passing a recursive or deeply nested list to Tcl #160176
AsObj() and TupleAsObj() in Modules/_tkinter.c convert nested lists and tuples to Tcl lists by plain C recursion with no depth limit, so a recursive or very deeply nested list passed to tk.call(), setvar(), Variable.set() or a widget option overflows the C stack and segfaults.
The same happens with a list nested about 50,000 levels deep (for example one returned by json.loads()), and in the other direction when getvar() reads a Tcl list nested a few hundred thousand levels deep (FromObj()). I'd expect an exception, as _flatten() in the same file already gives with ValueError: nesting too deep in _flatten.
The recursion is old; gh-143310 fixed a different crash in the same code and was backported.
Activity
pythongh-160176: Fix crash in tkinter on deeply nested or recursive l…
serhiy-storchaka commentedon Oct 22, 2026
Tcl itself crashes on deeply nested lists, see for example https://core.tcl-lang.org/tcl/tktview/c31f72813b3966d13deb165f957033d514acd99f. But it is better to prevent what is preventable on our side.