[Python-Dev] Dealing with tone in an email
tjreedy at udel.edu
Sun May 6 04:54:39 EDT 2018
On 5/5/2018 9:45 PM, Chris Angelico wrote:
> On Sun, May 6, 2018 at 11:39 AM, Steven D'Aprano <steve at pearwood.info> wrote:
>> On Sun, May 06, 2018 at 11:09:21AM +1000, Chris Angelico wrote:
>>> What exactly didn't work? I don't understand.
> I've read it and I still don't fully understand the problem.
Chris this is an excellent series of questions. I think I have enough
knowledge to answer somewhat adequately. This is partly thanks to
things people like you and Steven have posted on python-list abouts
threads, deadlocks, and volatile conditions, and partly thanks to Ivan's
contribution on the thread above and https://bugs.python.org/issue33257.
> Is it ALL of Tkinter that fails in threaded mode?
No. It is non-threaded tcl that fails in threaded mode, along with
tkinter's attempt to make non-thread tcl work anyway. There are at
least two different cases.
Ivan has clarified the following.
1. Tcl has a 'threads' compile switch.
2. The default changed from 'off' for 8.5 and before to 'on' for 8.6.
3. When compiled with thread support, the resulting library file has t
4. The Windows installer for 2.7 installs tcl85.dll while at least 3.6
and later install tcl86t.dll. Hence things work that did not work before.
5. Changing 2.7 to tcl85t.dll and tk85t.dll could break 3rd code that
interfaces to the .dlls. _tkinter is written with #ifdefs to
accommodate thread or no thread compiles, but any code written just for
the no-t version would could fail with the t version.
> Is it just certain specific calls?
33257 is about calling widget modification methods from threads. The
_tkinter code to make this work with non-t tcl fails haphazardly in
maybe 1 in 10000 calls. Ivan signed the CA and submitted a PR which he
claims fixes the Python and Tcl locking. Serhiy has not reviewed this yet.
33412 is about calling event_generate from threads. For non-t tcl and
more than one thread making such calls, the example fails immediately.
With thread tcl, the same example ran until it deadlocked during
shutdown cleanup. I found one way to almost certainly avoid it. Ivan
found a better way, which I am thinking about making part of a new doc
section on tkinter and threads.
> Are there calls that fail in single-threaded programs?
This is a different issue. I don't know of much of anything except a
few things on MacOS, due to tcl/tk bugs or Apple changing the graphics
> If the given test-case is the only thing that fails,
Neither fails with properly written code when using the thread build of
> it's a horrific exaggeration to say that Tkinter is broken.
Yep. But I don't care any more what Ivan writes here. I am sorry he
lost a job bid or whatever. I appreciate what he has contributed on the
tracker, in his more rational mode.
Terry Jan Reedy
More information about the Python-Dev