This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: tkinter crashes macOS in the latest macOS update 10.14.6
Type: crash Stage: resolved
Components: macOS Versions: Python 3.7
process
Status: closed Resolution: third party
Dependencies: Superseder:
Assigned To: Nosy List: ned.deily, ronaldoussoren, smits92, wordtech
Priority: normal Keywords:

Created on 2019-08-12 13:59 by smits92, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Messages (13)
msg349472 - (view) Author: Ricardo Smits (smits92) Date: 2019-08-12 13:59
tkVersion == 8.6

After the new update in macOS (10.14.6):

In any python interpreter, when running tk.Tk() it makes macOS crash and logout giving the following error:
$ CGSTrackingRegionSetIsEnabled returned CG error 268435459
$ HIToolbox: received notification of WindowServer event port death.
msg349473 - (view) Author: Ronald Oussoren (ronaldoussoren) * (Python committer) Date: 2019-08-12 14:48
This is almost certainly a bug in macOS. I wonder if it is possible to work around it in Python.
msg349485 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2019-08-12 18:39
Can you be more specific about the source of your Pythons and Tk 8.6 and exactly what version it is? Tk through tkinter seems to work as expected (and without a crash) when I try the current Python.org pythons with their built-in Tk 8.6.6 or current MscPorts Pythons with their Tk 8.6.9 all running on the latest released 10.14.6 with Supplemental Update on a MacBook Pro.

Ronald, are you able to reproduce this?
msg349490 - (view) Author: Ricardo Smits (smits92) Date: 2019-08-12 19:56
I am on a Conda environment with Python 3.7.4 with the corresponding
Tkinter 8.6 that came with it. I tried to use some apps I compiled with
Pyinstaller and all of them caused this crash. So I tried line by line on
the terminal (to cross out Pyinstaller as the problem) and "root = tk.Tk()"
was where it crashed for me.

Here are more people with the same issues:
https://github.com/pyinstaller/pyinstaller/issues/4334

As Ronald said, most certainly it is a macOS bug, but I don't think they
will bother to fix this when they are so close to their 10.15 release :/

On Mon, Aug 12, 2019 at 8:39 PM Ned Deily <report@bugs.python.org> wrote:

>
> Ned Deily <nad@python.org> added the comment:
>
> Can you be more specific about the source of your Pythons and Tk 8.6 and
> exactly what version it is? Tk through tkinter seems to work as expected
> (and without a crash) when I try the current Python.org pythons with their
> built-in Tk 8.6.6 or current MscPorts Pythons with their Tk 8.6.9 all
> running on the latest released 10.14.6 with Supplemental Update on a
> MacBook Pro.
>
> Ronald, are you able to reproduce this?
>
> ----------
>
> _______________________________________
> Python tracker <report@bugs.python.org>
> <https://bugs.python.org/issue37833>
> _______________________________________
>
msg349492 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2019-08-12 20:23
Thanks for the link but that really doesn’t pin down exactly what Tk is in use. This probably should be pursued with the Tk project. Adding Kevin Walzer from Tk: Kevin, does this problem sound familiar?
msg349516 - (view) Author: Kevin Walzer (wordtech) * Date: 2019-08-13 04:02
Hard to say what is going on without knowing more about the specific version of Tk (not just 8.6, but 8.6.8? 8.6.9?).
msg349529 - (view) Author: Ronald Oussoren (ronaldoussoren) * (Python committer) Date: 2019-08-13 06:53
I had a similar problem during EuroPython, but that was when I had anaconda on my machine. I've since removed it because generally don't use it but had it installed for a training session.

I haven't tried to reproduce, but also don't run 10.14.6 yet (holding of rebooting due to too much active Terminal windows). I'll try to reproduce later this week on another machine.

I get reports about this in the py2app repo as well, see <https://bitbucket.org/ronaldoussoren/py2app/issues/267/when-run-the-app-os-will-restart-on-macos>, so this is not just something on a single machine.
msg349530 - (view) Author: Ronald Oussoren (ronaldoussoren) * (Python committer) Date: 2019-08-13 07:00
A followup question: How can I determine the exact version of Tk?
msg349531 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2019-08-13 07:30
As far as I know, the best information you can get from Tk about version is the patch level which does not necessarily take into account builds from a dev repo or patched source.  The easiest way to get that info from tkinter is to use test.pythoninfo:

$ python3.7 -m test.pythoninfo
[...]
tkinter.TCL_VERSION: 8.6
tkinter.TK_VERSION: 8.6
tkinter.info_patchlevel: 8.6.8
[...]

It may also be useful to ascertain which Tk libraries tkinter is linked with:

$ python3.7 -c 'import _tkinter;print(_tkinter.__file__)'
/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/lib-dynload/_tkinter.cpython-37m-darwin.so

$ otool -L $(python3.7 -c 'import _tkinter;print(_tkinter.__file__)')
/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/lib-dynload/_tkinter.cpython-37m-darwin.so:
	/Library/Frameworks/Python.framework/Versions/3.7/lib/libtcl8.6.dylib (compatibility version 8.6.0, current version 8.6.8)
	/Library/Frameworks/Python.framework/Versions/3.7/lib/libtk8.6.dylib (compatibility version 8.6.0, current version 8.6.8)
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1197.1.1)
msg349532 - (view) Author: Ricardo Smits (smits92) Date: 2019-08-13 07:36
Thanks! I was just looking how to send you all this info, so here it is:

tkinter.TCL_VERSION: 8.6
tkinter.TK_VERSION: 8.6
tkinter.info_patchlevel: 8.6.8

$ python3.7 -c 'import _tkinter;print(_tkinter.__file__)'

/anaconda3/envs/main/lib/python3.7/lib-dynload/_
tkinter.cpython-37m-darwin.so

$ otool -L $(python3.7 -c 'import _tkinter;print(_tkinter.__file__)')

/anaconda3/envs/main/lib/python3.7/lib-dynload/_
tkinter.cpython-37m-darwin.so:

@rpath/libtcl8.6.dylib (compatibility version 8.6.0, current version 8.6.8)

@rpath/libtk8.6.dylib (compatibility version 8.6.0, current version 8.6.8)

/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version
1213.0.0)
msg349533 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2019-08-13 08:02
OK, thanks, Ricardo. Since you appear to be using an Anaconda-supplied Tk, I suggest you open an issue or otherwise ask for help from the Conda project and, as necessary, the Tk folks.  Without more info and unable to reproduce with other sources of Tk, there is next to nothing we can do here and the chances that this is a Python problem, rather than a Tk or macOS problem, is very slim.
msg349658 - (view) Author: Ronald Oussoren (ronaldoussoren) * (Python committer) Date: 2019-08-14 07:11
Interestingly enough both users in the py2app issue I mentioned use the python.org installer to install Python.  

One of them mentions this only happens when py2app is used, and that the script works fine outside of an app.

I'll look into this tonight (CEST).
msg349737 - (view) Author: Ronald Oussoren (ronaldoussoren) * (Python committer) Date: 2019-08-14 19:08
The py2app issue I mentioned is not relevant for this issue. 

A simple tkinter runs fine with Python 3.7 (64-bit, 3.7.4, Python.org installer), the same script causes a WindowServer crash (SEGV) when bundled with py2app. 

This is definitely a bug in macOS, the WindowServer should not crash like this even if an app is misbehaving. 

I'm therefore changing the status of this issue to closed/third party.
History
Date User Action Args
2022-04-11 14:59:19adminsetgithub: 82014
2019-08-14 19:08:26ronaldoussorensetstatus: open -> closed
resolution: third party
messages: + msg349737

stage: resolved
2019-08-14 07:11:46ronaldoussorensetstatus: pending -> open

messages: + msg349658
2019-08-13 08:02:29ned.deilysetstatus: open -> pending

messages: + msg349533
2019-08-13 07:36:11smits92setmessages: + msg349532
2019-08-13 07:30:08ned.deilysetmessages: + msg349531
2019-08-13 07:00:05ronaldoussorensetmessages: + msg349530
2019-08-13 06:53:32ronaldoussorensetmessages: + msg349529
2019-08-13 04:02:58wordtechsetmessages: + msg349516
2019-08-12 20:23:03ned.deilysetnosy: + wordtech
messages: + msg349492
2019-08-12 19:56:50smits92setmessages: + msg349490
2019-08-12 18:39:22ned.deilysetmessages: + msg349485
2019-08-12 14:48:37ronaldoussorensetmessages: + msg349473
2019-08-12 13:59:38smits92create