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

Created on 2018-08-01 20:49 by taleinat, last changed 2018-10-03 16:12 by ned.deily.

Messages (17)
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 python.org, everything works fine.

Strangely, replacing ActiveTcl with version 8.5.18.0 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 python.org 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:
https://docs.python.org/3/using/mac.html#gui-programming-on-the-mac
msg326778 - (view) Author: Vlad Tudorache (vtudorache) * Date: 2018-10-01 10:02
@taleinat

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 https://docs.python.org/3/using/mac.html#gui-programming-on-the-mac, 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 (https://www.tcl.tk). 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 https://www.wxpython.org or https://riverbankcomputing.com/software/pyqt/intro.

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

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 python.org 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:

https://www.python.org/download/mac/tcltk/

The entire https://docs.python.org/3/using/mac.html section remains woefully out-of-date; there are other open issues regarding it.
History
Date User Action Args
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