[Python-Dev] Dealing with tone in an email

Terry Reedy tjreedy at udel.edu
Sun May 6 16:04:45 EDT 2018


On 5/6/2018 10:03 AM, Chris Angelico wrote:
> On Sun, May 6, 2018 at 6:54 PM, Terry Reedy <tjreedy at udel.edu> wrote:
>>> 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
>> suffix.
> 
> Okay, that makes a HUGE difference. Thank you for clarifying. So, in
> theory, threads SHOULD be supported, which means that bug reports of
> the nature of "this fails in threaded mode" are 100% valid.

If the reported code does not have bugs, including thread deadlock and 
shutdown bugs, which are non-trivial to avoid, yes.

I dug up more information.  Though he did not say so, Ivan's first 
issue, https://bugs.python.org/issue33257, reopens and continues 
https://bugs.python.org/issue11077, using a slightly modified version of 
the original ballistic launch example.  Ivan added discussion of the tcl 
thread-support compile switch, which was not mentioned in the original. 
Ditto for a patch.

The originator of the original, Scott M., taught new programmers how to 
display data from multiple sources, some blocking.  It seemed most 
natural to him and students to use threads to access sources and use the 
documented widget.method(*args) APIs to display data, rather than have 
to invent a protocol to pass such calls through a queue.  See the 
initial message.

In that older issue, I mentioned, as I did in response to Ivan, that 
'thread' does not appear in the tkinter docs.  Martin Löwis replied

"My claim is that Tkinter is thread-safe as it stands. A lot of thought 
has been put into making Tkinter thread-safe, so if there is any claim 
to the contrary, we would need more details: what exact Python version 
is being used, what exact operating system is being used, what exact 
code is run, and what exact output is produced."

and later said "It's supported on Unix since 1.5.1, and on Windows since 
2.3."

> If it were up to me, I would deprecate non-threaded mode immediately,

Given that 99% of tkinter users do not need threaded tcl, why cut some 
of them off?  When tkinter is import and a root is created, tkinter 
cannot know whether the user is going to later make failing calls from 
threads.  Tkinter has traditional been slow to remove support of old 
versions; it still supports 8.4.  It will eventually become a moot 
point, at least on Windows, as current Windows installers install 
threaded tcl.  I presume the same is true for the new Mac installers.  I 
have no idea what people have on linux.

-- 
Terry Jan Reedy




More information about the Python-Dev mailing list