[Python-Dev] bpo-33257: seeking advice & approval on the course of action

Terry Reedy tjreedy at udel.edu
Mon May 14 14:58:49 EDT 2018


On 5/14/2018 12:20 PM, Chris Barker via Python-Dev wrote:
> On Wed, May 2, 2018 at 8:21 PM, Terry Reedy <tjreedy at udel.edu 
> <mailto:tjreedy at udel.edu>> wrote:
> 
>     On 5/2/2018 4:38 PM, Ivan Pozdeev via Python-Dev wrote:
> 
>         The bottom line is: Tkinter is currently broken
> 
> 
>     This is way over-stated.  Many modules have bugs, somethings in
>     features more central to their main purpose.
> 
> I'll suggest a re-statement:
> 
> tkinter is not thread safe,

Still over-stated.  If one uses tcl/tk compiled with thread support, 
tkinter *is* thread-safe.  This is 'as far as I know' from running 
posted 'failing' examples (possible with bug fixes) with 3.5+ on 
Windows, which is installed with tcl/tk 8.6, which defaults to thread-safe.

Tkinter was intended to also be thread-safe when using tcl/tk without 
thread support, which was the default for tcl/tk 8.5 and before.  The 
posted examples can fail on 2.x on Windows, which comes with tcl/tk 8.5 
or before. _tkinter.c has some different #ifdefs for the two situations.

> and yet it is documented as being thread safe

True in https://docs.python.org/3/library/tk.html
Unspecified in https://docs.python.org/3/library/tkinter.html

> This is either a bug(s) in the implementation or the docs.

Both

> So what are the solutions?
> 
> 1) fix the docs -- unless tkInter is made thread safe really soon, and 
> fixes are back-ported, this seems like a no brainer -- at least temporarily.

https://bugs.python.org/issue33479 'Document tkinter and threads'

> 2) fix the issues that make tkInter not thread safe

with non-thread tcl/tk.

https://bugs.python.org/issue33257 has a patch that might improve the 
situation for one type of call.  Fixing everything might not be 
possible.  AFAIK, there are currently no tests of thread safety.

-- 
Terry Jan Reedy




More information about the Python-Dev mailing list