James Sanders added the comment:

I did a bit more digging and I think I've worked out what is going on.  The 
particular bit of tcl initialization code that triggers the problem if it is 
run before the fork is Tcl_InitNotifier in tclUnixNotify.c.  It turns out there 
is a known problem with this bit of tcl not being process-safe if tcl was built 
with threading support (this is discussed at 
https://bugs.archlinux.org/task/16401, for example).

The bug doesn't show up in my 8.5 builds as threading support is off by 
default, though the debian/ubuntu packages apparently have it switched on.  
Threading was turned on by default in 8.6, but a recent change to 
tclUnixNotify.c (discussed at 
https://issues.apache.org/bugzilla/show_bug.cgi?id=55153#c13 - it should be 
included in 8.6.1 and 8.5.15) appears to have fixed the whole problem anyway.

So hopefully the bug should disappear entirely in future releases of tcl, but 
for now you can work around it by building tcl without threads, calling exec in 
between the fork and any use of tkinter in the child process, or not importing 
tkinter until after the fork.  I don't know if there should be a note about 
this somewhere in the tkinter docs?

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue5527>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to