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.

Title: Tkinter crashes with Tk-related error on macOS with ActiveTcl 8.6
Type: Stage: resolved
Components: macOS, Tkinter Versions: Python 3.8, Python 3.7
Status: closed Resolution: third party
Dependencies: Superseder:
Assigned To: Nosy List: ned.deily, ronaldoussoren, royf, serhiy.storchaka, taleinat, terry.reedy, vtudorache, wordtech
Priority: Keywords:

Created on 2018-08-01 20:49 by taleinat, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Messages (26)
msg322888 - (view) Author: Tal Einat (taleinat) * (Python committer) Date: 2018-08-01 20:49
On macOS 10.13.5 (the latest available) with ActiveTcl 8.6.7 (the latest available), I'm building Python from latest master (to be 3.8.0).  I'm consistently having IDLE crash almost immediately, just by opening any file for editing.  The crash results in the following error:

$ root/bin/python3 -m idlelib
objc[50759]: Invalid or prematurely-freed autorelease pool 0x7fb74091f050.
[1]    50759 abort      root/bin/python3 -m idlelib

In issue34120, @vtudorache reported a similar issue (also on macOS).

With Python 3.7.0 from, everything works fine.

Strangely, replacing ActiveTcl with version resolves this issue.

I'm not sure whether this is specific to IDLE; I'll try to provide a minimal way to reproduce.
msg322898 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2018-08-01 23:49
I presume then that you tested PR8603 without opening an editor (which is certainly possible).

10.13.6 was released in the last month.

PCBuild/build.bat -e downloads missing external dependency source code into externals/ and then compiles it into compatible .dlls.  This includes doing updates as appropriate. I presume that the source and compilation flags are the same as used to make a release. AFAIK, Zach Ware is mainly responsible for the current easy-to-use, easy-to-get-right status.

For a stripped-down reporducer, you might start with the files I attached to #34047.
msg322927 - (view) Author: Vlad Tudorache (vtudorache) * Date: 2018-08-02 08:29
I confirm the crashes. I've tried with personal builds of python 3.5, 3.6, 3.7, with ActiveTcl and personal builds of Tcl 8.6.x, the problem does not appear with 8.5.18, but shows itself with 8.5.19 (strange, API changes?). I'll try to investigate.
msg322930 - (view) Author: Vlad Tudorache (vtudorache) * Date: 2018-08-02 08:57
The problem shows itself on macOS High Sierra in some Tk Demos, independently of Python's IDLE. So there is something completely different, to report to the Tcl/Tk community. Strangely, I didn't notice the issues on Sierra, but I have no Sierra Mac right now to check it again. Even in Tk 8.5.18 (ActiveState or self-compiled) there are issues (notably the cascade menus demo, the button menus demo, others to) in rendering some UI elements. Sometimes bad indexes are reported (sort of [lindex {A LIST} index $N] gives $N not found even when in range)...
msg322976 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2018-08-02 16:15
Kevin, more tk mac issues.
msg323008 - (view) Author: Kevin Walzer (wordtech) * Date: 2018-08-03 02:00
The crash reported by the OP did show up at times in recent releases of Tk 8.6.x, but a lot of work went into refactoring memory management in 8.6.8 and those problems do not seem present in the current release (8.6.7 is a year old). I'd try updating to 8.6.8 and seeing if that fixes things.
msg323040 - (view) Author: Vlad Tudorache (vtudorache) * Date: 2018-08-03 08:27
I was telling only that I've seen myself the issues with some Tcl/Tk versions. As I often build Tcl/Tk on macOS, I can confirm that on 8.6.8 I didn't see issues (those were effectively present in (ActiveState or not) Tcl 8.5.18, 8.5.19, 8.6.6, 8.6.7. The only issue I had was an @autoreleasepool after several open/close of the Preferences dialog in IDLE (see the 34120 issue), related probably to a partial release of resources.
msg323134 - (view) Author: Tal Einat (taleinat) * (Python committer) Date: 2018-08-05 07:04
I can confirm the these issues do *not* occur on my macOS setup when using tcl/tk 8.6.8 built from source.
msg326758 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2018-10-01 02:26
Since this was opened, I have opened files in the editor, without incident with both installed 3.7.0 and 3.7.1rc1 (64 bit).  Should this still stay open?  Does anyony have any problems with the current release candidates?
msg326775 - (view) Author: Tal Einat (taleinat) * (Python committer) Date: 2018-10-01 09:46
I couldn't reproduce this issue with any of the 3.7.1rc1 and 3.6.7rc1 installers from on my macOS.

This certainly seems like an issue with Tcl/Tk versions before 8.6.8.

It is unfortunate that ActiveState have still not released ActiveTcl 8.6.8; the latest version is 8.6.7 which does exhibit this issue.

ISTM we should update the section of the docs about GUI programming on macOS, which suggests using the latest version of Tcl/Tk from ActiveState:
msg326778 - (view) Author: Vlad Tudorache (vtudorache) * Date: 2018-10-01 10:02

The issues appear with both Tk 8.6.[:8] and (8.5.[:18] + 8.5.[19:], just in case you update the docs. For 32/64 bit installers on macOS, the only version (built by myself or ActiveState) without crashes is 8.5.18 (on my Mac).
msg326780 - (view) Author: Tal Einat (taleinat) * (Python committer) Date: 2018-10-01 10:07
Vlad, you previously mentioned that with Tcl/Tk 8.6.8 you also didn't see this issue. Have you tried building Tcl/Tk 8.6.8 yourself? When I did so everything worked fine.
msg326784 - (view) Author: Vlad Tudorache (vtudorache) * Date: 2018-10-01 10:16
Yes, like in the Pythonic Tk 8.6.[:8] :), starting at version 8.6.8 (-dev, too) I see no crash. Tcl/Tk 8.6.8 is built by myself (the last time I checked there was no 8.6.8 built on ActiveState).
As for the old 8.5 series, only 8.5.18 works with the dual 32/64 bit Python(s).
msg326815 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2018-10-01 16:47
I think that the resolution of this issue should be revision of at least the tkinter paragraph in, and I think at least the tkinter revision should be cherry-picked into the upcoming releases.  Ned, what do you want to do?

PyObjC paragraph: move to end?

Tkinter paragraph: rewrite to something like...

The standard Python GUI toolkit is tkinter, based on the cross-platform Tk toolkit ( Starting with the 64-bit installer in 3.6.6 and both installers in 3.7.0, an Aqua-native version of Tk is bundled the installer.  Users are urged to install the most recent bug-fix releases.

'Other' paragraphs:  combine into something like ...

*wxPython* and *PyQt* are other cross-platform GUI toolkits that runs natively on Mac OS X. See or

[Does the other Qt wrapping, PySide, run natively on Mac?]
msg326900 - (view) Author: Vlad Tudorache (vtudorache) * Date: 2018-10-02 20:18

Maybe "users are urged to install the most recent bug-fix releases" is a little bit misleading. As I wrote, Tcl/Tk 8.5.18 does not give crashes on macOS, when both 8.5.17 and 8.5.19 (bug-fix) do. Some times ago, if I remember well, the same thing happened 'round 8.6.3 something (there was a "bug-fix" release worse than the previous one). Should installers provide only tested self-contained Tcl/Tk builds?
msg326902 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2018-10-02 20:48
Current Mac installers do contain hopefully tested tcl/tk installers.  (This has always been true for the Windows installers.) We are not responsible if users use anything else with Python.
msg326989 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2018-10-03 16:12
If I understand correctly, this is not a release blocker issue.  The most up-to-date documentation for which Tcl/Tk to use on macOS has been and remains:

The entire section remains woefully out-of-date; there are other open issues regarding it.
msg331770 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2018-12-13 21:37
I installed 64-bit 3.7.2rc1 on my Macbook, with 8.6.9, and so far IDLE itself runs fine.  (Other than new blackout issue reported in #34313.)  I will let someone else test 32/64 bit release, which Ned says also uses 8.6.9.

Vlad says in msg323040 "on 8.6.8 I didn't see issues" and in msg326778 "The issues appear with ... Tk 8.6.[:8]".  Different 'issues'?

In any case, tcl/tk on the every changing macOS graphics seems 'tempermental'.

Let me revise, extend, and reword what I said earlier about 'recent releases'. I think the goal of the python x.y.z Mac equivalent of PCbuild should be to make it just as easy to build python with the current 'official' x.y.z version of tcl/tk as PCbuild does.  Does the ActiveState licensing allow this?  Then we could consider saying that we only support tkinter x.y.z with that tcl/tk, and IDLE patches could be tested against the expected tcl/tk they will be installed with.  (This is routine on Windows.  If someone breaks IDLE on Windows by replacing the installed tcl/tk, it is basically their problem.)

To put it another way, I want tcl/tk to shield me from differences between OS versions.  To do that on Mac, we have to use a fairly up-to-date version of the efforts of Kevin and company.
msg331772 - (view) Author: Tal Einat (taleinat) * (Python committer) Date: 2018-12-13 21:52
> Vlad says in msg323040 "on 8.6.8 I didn't see issues" and in msg326778 "The issues appear with ... Tk 8.6.[:8]".  Different 'issues'?

Nope, same issues: Vlad was saying that 8.6.x versions of Tcl/Tk *before* 8.6.8 displayed these issues, but 8.6.8 is fine.

To state this point as directly as possible: Tcl/Tk 8.5.18 and 8.6.8 are fine in this regard, and apparently so is 8.6.9.  The issues discussed here occur with Tcl/Tk versions 8.6.x before 8.6.8, as well as 8.5.x other than 8.5.18.

macOS users do occasionally install another version of Tcl/Tk, and IDLE will automatically use the system installed Tcl/Tk in many cases.

ISTM we should update the docs to recommend the working versions of Tcl/Tk, and warn about versions known to be problematic.
msg331773 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2018-12-13 22:34
I get it now.  [:8] meant .0 to .7 inclusive, like range(8).

I understand that until last spring, the tcl/tk/tkinter situation on Mac was a bit like the old American wild west.  But then Ned more or less tamed it for 3.7 and now 3.6. We no longer install Python to work with system tcl and, I believe, releases compiled against 8.6 would not work with them.

Can you suggest a doc change?

tkinter has a hard-coded requirement for at least 8.4, IDLE for 8.5 (so ttk works).  For future IDLE, that should be at least 8.5.18 or maybe later.  I have thought about adding a startup warning if something older that the expected (tested-against) version is used, but that should be once only, requiring a 'hidden' configuration value.  So maybe not worth the effort.
msg331783 - (view) Author: Tal Einat (taleinat) * (Python committer) Date: 2018-12-14 06:48
We already have a warning about Tk versions on macOS, see macosx.tkVersionWarning().  It is currently printed in new shell windows.    It would be straightforward to add warnings when using anything other than 8.5.18 or 8.6.8+.  I suggest this approach.

As for the docs, IMO we should update the "GUI Programming on the Mac" section of; I'll prepare a PR.

I also suggest updating The following two current paragraphs should be improved:

"If you are using Python (prior to 3.7) from a 64-bit/32-bit Python installer for macOS 10.6 and later, you should only use IDLE or tkinter with an updated third-party Tcl/Tk 8.5 (not 8.6), like ActiveTcl 8.5 installed."

"If you are using macOS 10.7 or later, the Apple-supplied Tcl/Tk 8.5 still has serious bugs that can cause application crashes. If you wish to use IDLE or Tkinter, install and use a newer version of Python and of Tcl/Tk."

I'm happy to suggest clearer wording; I'm not sure where to post a patch/PR, though.
msg331785 - (view) Author: Vlad Tudorache (vtudorache) * Date: 2018-12-14 08:11
The only versions of Tk not showing issues on my Mac are:

- 8.5.18 with any Python in 3.5, 3.6, 3.7 on Mojave AND previous versions;
- 8.6.8 when built on a 10.13 SDK, with the same Python versions.

For 8.6.8 built on Mojave SDK, there's the black background console window issue and for the IDLE's problem showing a little black window.
I've seen no crashes yet with 8.5.18, 8.6.8, 8.6.9 (on my Mac).
msg348577 - (view) Author: (royf) Date: 2019-07-28 14:18
I started having a similar issue after updating to macOS Mojave 10.14.6.

I'm not using idle, but the following minimal code has a similar issue:
import tkinter as tk

w = tk.Tk()
The crash happens on `mainloop`.

This worked for me on macOS <= 10.14.5, but started crashing after updating to macOS 10.14.6. I'm using miniconda with conda=4.7.10, python=3.7.3, and tk=8.6.8.

The above code does work fine on the macOS 10.14.6 in a conda environment with python=3.6.2 and tk=8.5.18. But I really want to use python 3.7, which requires tk>=8.6.8, at least on the default conda channels.
msg348760 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2019-07-30 17:09
@royf, Without more information, we can only speculate what kind of crash you are seeing.  But based on past experience, it is almost certainly a crash in Tk itself and, if so, you need to work with your supplier of Tk, presumably the conda project, to get a working version of Tk 8.6.x. Our most recent experience with building Tk on macOS for the installers found that using the released Tk 8.6.8 source tarball ( was the least problematic at the moment.
msg348765 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2019-07-30 18:13
Is this issue open for some specific action in a repository covered by this tracker, or should it be closed?
msg348818 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2019-07-31 17:52
Good question. I don't think there's anything more to do here other than to continue to monitor and evaluate future Tk releases, which we do anyway.  Improvements to the build documentation etc are covered by other open issues.
Date User Action Args
2022-04-11 14:59:04adminsetgithub: 78494
2019-07-31 17:52:53ned.deilysetstatus: open -> closed
resolution: third party
messages: + msg348818

stage: resolved
2019-07-30 18:13:19terry.reedysetmessages: + msg348765
2019-07-30 17:09:51ned.deilysetmessages: + msg348760
2019-07-28 14:18:20royfsetnosy: + royf
messages: + msg348577
2018-12-14 08:11:52vtudorachesetmessages: + msg331785
2018-12-14 06:48:04taleinatsetmessages: + msg331783
2018-12-13 22:34:19terry.reedysetmessages: + msg331773
2018-12-13 21:52:54taleinatsetmessages: + msg331772
2018-12-13 21:37:39terry.reedysetmessages: + msg331770
2018-12-12 04:13:34terry.reedysetcomponents: - IDLE
title: IDLE crashes with Tk-related error on macOS with ActiveTcl 8.6 -> Tkinter crashes with Tk-related error on macOS with ActiveTcl 8.6
2018-12-11 22:31:14terry.reedysetversions: - Python 3.6
2018-10-03 16:12:12ned.deilysetpriority: release blocker ->

messages: + msg326989
2018-10-02 20:48:32terry.reedysetmessages: + msg326902
2018-10-02 20:18:20vtudorachesetmessages: + msg326900
2018-10-01 16:47:52terry.reedysetpriority: normal -> release blocker

messages: + msg326815
2018-10-01 10:16:29vtudorachesetmessages: + msg326784
2018-10-01 10:07:04taleinatsetmessages: + msg326780
2018-10-01 10:02:38vtudorachesetmessages: + msg326778
versions: + Python 3.6, Python 3.7
2018-10-01 09:46:56taleinatsetmessages: + msg326775
2018-10-01 02:26:28terry.reedysetmessages: + msg326758
2018-08-05 07:04:48taleinatsetmessages: + msg323134
2018-08-03 08:27:26vtudorachesetmessages: + msg323040
2018-08-03 02:00:18wordtechsetmessages: + msg323008
2018-08-02 16:15:46terry.reedysetnosy: + wordtech
messages: + msg322976
2018-08-02 08:57:41vtudorachesetmessages: + msg322930
2018-08-02 08:29:31vtudorachesetmessages: + msg322927
2018-08-01 23:49:55terry.reedysetnosy: + ned.deily, ronaldoussoren, - gpolo
messages: + msg322898

assignee: terry.reedy ->
components: + macOS
2018-08-01 20:49:42taleinatcreate