Tkinter -- interpreter crashes in tcl in presence of threads?

Mike Clarkson support at internetdiscovery.com
Wed Aug 15 09:11:48 CEST 2001


On Mon, 13 Aug 2001 15:29:44 +0100, Bernard Sufrin
<Bernard.Sufrin at comlab.ox.ac.uk> wrote:

>I've been plagued, across two very different programs, a few variants of
>python (1.6, 2.0, 2.1.1) and tk with what look like tcl interpreter
>crashes during a python call to tcl at an unpredictable time during the
>execution of the program.
>
>The error report is always along the following lines:
>
>TclExecuteByteCode: done instruction at pc 4: stack top 0 != entry stack
>top -1
>  Source: "5067420callit"TclExecuteByteCode execution failure: end stack
>top != start stack top
>Abort

I've seen this error in pure Tk/Tcl, so it's not necessarily a Python
error. It means the Tcl intepreter got messed up on it's stack,
and no amount of user coding errors should end up with this.

I beleve the Tcl intepreter will be dead after this, so you can't
debug the procedure that was called (I think you would do:
	root.tk.eval('info body 5067420callit')
)
>The only thing the programs have in common is that they use threads as
>well as having a Tkinter mainloop active. In all the programs,
>invocation of Tk code is done via an agent thread (so there's no
>immediately apparent race for Tk resources between threads.).
>One of the programs is doing event simulation, the other provides the
>user-interface component of a proof assistant.

You may be best off leaving all Tk calls in the main thread.
Note that as of Python 2.0, Python has its own handcrafted thread
for Tk, with it's own specialized thread handling from the main
thread in _tkinter.c.

>In all cases I'm using the stock python libraries, and a stock tk/tcl
>setup. In other words I can't put this down to some imported (or
>self-written) extensions to the libraries.

The best hope is to upgrade to the latest stable Tk/Tcl - 8.3.3
and hope that solves it. If it's a Tcl interpreter eval bug, it will
get noticed in pure Tk, and should be fixed in due course.

>Can anyone shed any insight into this?
Sorry I can't help more, but you in essence you can't debug this.

Mike.



More information about the Python-list mailing list