_tkinter.c, threads and C-modules
Bernhard Herzog
herzog at online.de
Fri Apr 9 15:04:29 EDT 1999
A few weeks ago, there was a bug report on c.l.py regarding an
incompatibility between Sketch and Python 1.5.2b2. It seems to me that
the cause for the problems is the new Tcl-lock in 1.5.2.
The tcl-lock was introduced for better thread support in Tkinter.
Whenever _tkinter calls the tcl interpreter, it releases the python-lock
and acquires the tcl-lock. Sketch defines some tcl-callbacks in C, which
in turn may call the python interpreter, but without releasing the
tcl.lock and acquiring the python-lock. I think that this is the cause,
because compiling just the _tkinter module without thread support cures
the problem.
The question now is, how do I make Sketch work correctly with a
threadable _tkinter? AFAICT, Sketch would have to have access to some
static variables in _tkinter.c.
The best solution IMO would be to give third-party C-modules access to
the functionality of the macros ENTER_TCL, LEAVE_TCL, etc, via some
C-functions to access those variables and a _tkinter headerfile
installed with the other Python headerfiles.
Any chance to get something like this into Python 1.5.2 final?
Bernhard
--
Bernhard Herzog | Sketch, a python based drawing program
herzog at online.de | http://www.online.de/home/sketch/
More information about the Python-list
mailing list