classification
Title: IDLE 3.2 hangs with Cmd-M hotkey on OS X 10.6 with 64-bit installer and A/S Tk 8.5
Type: crash Stage: resolved
Components: IDLE Versions: Python 3.2, Python 2.7
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: ned.deily Nosy List: brett.cannon, georg.brandl, ned.deily, rhettinger
Priority: Keywords: patch

Created on 2011-01-18 23:02 by rhettinger, last changed 2011-01-31 00:54 by ned.deily. This issue is now closed.

Files
File name Uploaded Description Edit
issue10940_temporarily_dont_add_dialog_accelerators_on_osx.patch ned.deily, 2011-01-29 02:42
Messages (13)
msg126500 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2011-01-18 23:04
Is this on OS X 10.6 with ActiveState 8.5.9 installed?
msg126501 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2011-01-18 23:04
On the Mac O/S 64-bit install, Idle hangs when the Cmd-M hotkey is pressed, but selecting OpenModule directly from the File menu works fine.

For me, it hangs with the pinwheel of death and requires a force-quit.  For Brett, it changes colors as if an unhandled event if being fired-off.
msg126869 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2011-01-23 01:41
It appears that the Cocoa Tk 8.5 added support for the Apple convention using Cmd-M as the window minimize menu item (collapses the window into the dock) and that conflicts with IDLE's use of the Cmd-M as the shortcut for the Open Module menu item.  I'll see if Tk can be persuaded to not use that shortcut, otherwise it will probably be necessary to use a new shortcut for Open Module on OS X.
msg127264 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2011-01-28 09:30
After more investigation, I found that my original speculation about a Cmd-M conflict with Cocoa Tk 8.5 was not correct. And the problem is not just limited to the keyboard accelerator for the Open Module command; it can also be seen with the keyboard accelerators for the Go To Line and New Ident Width commands, although none are always repeatable.  What all three have in common is that they use the tkinter.simpledialog module to get user input in response to the command. There does not seem to be a problem ever if the menu commands are clicked on rather than opened with a keyboard accelerator nor is the problem seen when using the older Carbon Tk 8.4.  The problem occurs at the end of the common Dialog class (simpledialog.py lines 167-169) where the tk "wait visibility" command does not cause the intended window to appear and the tk "wait window" (to be destroyed) command hangs waiting on a non-visible window.  Adding some debugging code makes it seem that the hangup is the display of the Entry widget within the dialog window.  Why that is a problem when going though the lengthy execution path triggered by a menu keyboard type-in, and not the clicking-on-menu-item path, is still not clear.  Most likely it is a bug in Cocoa Tk 8.5 but so far I have not yet been able to reduce it to a simpler, reproducible test case.

For 3.2rc2 and 3.2, I propose to add a temporary patch to IDLE that removes the keyboard accelerators for these three commands when running with Cocoa Tk 8.5.  That should prevent users from running into the hang and, thereby, losing work.  The patch should be available later today.
msg127273 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2011-01-28 10:32
Why don't we just remove IDLE...
msg127275 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2011-01-28 10:37
Ned, I agree with your idea to knock-out the three problematic hot-kye combinations.

Georg, your solution is too radical and would do more harm than good.  I've been getting excellent use out of Py3.2's IDLE and I expect to use it as a teaching aid in some upcoming classes on advanced Python.  The loss of IDLE would be felt most actutely by beginners who don't necessarily have good alternatives.
msg127281 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2011-01-28 11:02
I was just kidding (but I wish I weren't).
msg127370 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2011-01-29 02:42
The attached temporary patch avoids the hang seen when IDLE is used with Cocoa Tk 8.5 by removing the menu accelerator hints from IDLE's menu on OS X.  The keyboard accelerators still work when typed but the character hints are not displayed on their menu items.  The affected commands are:
    Open Module       Cmd-M
    Go to Line        Cmd-J
    New Indent Width  Control-U

This should be applied to 3.2rc2.  I will leave the issue open for possible backport to 2.7 and to find a better resolution so that this patch can be reverted.
msg127373 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2011-01-29 03:05
Shouldn't this just be an edit to config-keys.def?
Why does it need to hit EditorWindow.py?
Also, instead of killing keys, would it make sense
to remap them to other non-exploding keys?
msg127376 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2011-01-29 03:31
Just editing config-keys.def does not eliminate the problem. The hang seems to occur because of the presence of any menu accelerator along with the detached windows produced by tkinter.simpledialog.Dialog().  Looking at the Cocoa Tk sources, there are some comments that indicate Cocoa Tk needs to handle menu accelerators differently than Carbon Tk, but there is more to do to get a reliable test case.  The patch as supplied does not kill the keys, rather the accelerator keys for the problematic items are effectively no longer passed to Tk 8.5 and to OS X Cocoa; they are still processed as keyboard events directly by IDLE so they still work when pressed, however the shortcut reminder does not appear to the right of the menu item for these three.
msg127388 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2011-01-29 09:25
If this helps with hanging, okay to commit. (It doesn't have any effect on non-OSX anyway.)
msg127461 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2011-01-29 18:32
Committed in r88232 for 3.2rc2.  Pending 2.7 backport, if necessary.
msg127563 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2011-01-31 00:54
Committed in r88270 for release in 2.7.2.
History
Date User Action Args
2011-01-31 00:54:30ned.deilysetstatus: pending -> closed

versions: + Python 2.7
messages: + msg127563
nosy: brett.cannon, georg.brandl, rhettinger, ned.deily
2011-01-29 18:32:04ned.deilysetstatus: open -> pending

nosy: brett.cannon, georg.brandl, rhettinger, ned.deily
messages: + msg127461
priority: release blocker ->
resolution: accepted -> fixed
stage: commit review -> resolved
2011-01-29 09:25:28georg.brandlsetnosy: brett.cannon, georg.brandl, rhettinger, ned.deily
messages: + msg127388
2011-01-29 03:32:46rhettingersetnosy: brett.cannon, georg.brandl, rhettinger, ned.deily
resolution: accepted
2011-01-29 03:31:28ned.deilysetnosy: brett.cannon, georg.brandl, rhettinger, ned.deily
messages: + msg127376
2011-01-29 03:05:19rhettingersetnosy: brett.cannon, georg.brandl, rhettinger, ned.deily
messages: + msg127373
2011-01-29 02:45:46ned.deilysetnosy: brett.cannon, georg.brandl, rhettinger, ned.deily
stage: needs patch -> commit review
2011-01-29 02:42:27ned.deilysetfiles: + issue10940_temporarily_dont_add_dialog_accelerators_on_osx.patch
priority: critical -> release blocker
nosy: brett.cannon, georg.brandl, rhettinger, ned.deily
messages: + msg127370

keywords: + patch
2011-01-28 11:02:40georg.brandlsetnosy: brett.cannon, georg.brandl, rhettinger, ned.deily
messages: + msg127281
2011-01-28 10:37:57rhettingersetnosy: brett.cannon, georg.brandl, rhettinger, ned.deily
messages: + msg127275
2011-01-28 10:32:14georg.brandlsetnosy: brett.cannon, georg.brandl, rhettinger, ned.deily
messages: + msg127273
2011-01-28 09:30:17ned.deilysetpriority: high -> critical
nosy: + georg.brandl
messages: + msg127264

2011-01-23 01:41:55ned.deilysetnosy: brett.cannon, rhettinger, ned.deily
messages: + msg126869
stage: needs patch
2011-01-18 23:16:48ned.deilysetnosy: brett.cannon, rhettinger, ned.deily
title: IDLE hangs with Cmd-M hotkey on Mac O/S -> IDLE 3.2 hangs with Cmd-M hotkey on OS X 10.6 with 64-bit installer and A/S Tk 8.5
2011-01-18 23:04:25rhettingersetnosy: brett.cannon, rhettinger, ned.deily
messages: + msg126501
2011-01-18 23:04:01ned.deilysetnosy: brett.cannon, rhettinger, ned.deily
messages: + msg126500
2011-01-18 23:02:03rhettingercreate