Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IDLE 3.2 hangs with Cmd-M hotkey on OS X 10.6 with 64-bit installer and A/S Tk 8.5 #55149

Closed
rhettinger opened this issue Jan 18, 2011 · 13 comments
Assignees
Labels
topic-IDLE type-crash A hard crash of the interpreter, possibly with a core dump

Comments

@rhettinger
Copy link
Contributor

BPO 10940
Nosy @brettcannon, @birkenfeld, @rhettinger, @ned-deily
Files
  • issue10940_temporarily_dont_add_dialog_accelerators_on_osx.patch
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = 'https://github.com/ned-deily'
    closed_at = <Date 2011-01-31.00:54:30.510>
    created_at = <Date 2011-01-18.23:02:03.673>
    labels = ['expert-IDLE', 'type-crash']
    title = 'IDLE 3.2 hangs with Cmd-M hotkey on OS X 10.6 with 64-bit installer and A/S Tk 8.5'
    updated_at = <Date 2011-01-31.00:54:30.508>
    user = 'https://github.com/rhettinger'

    bugs.python.org fields:

    activity = <Date 2011-01-31.00:54:30.508>
    actor = 'ned.deily'
    assignee = 'ned.deily'
    closed = True
    closed_date = <Date 2011-01-31.00:54:30.510>
    closer = 'ned.deily'
    components = ['IDLE']
    creation = <Date 2011-01-18.23:02:03.673>
    creator = 'rhettinger'
    dependencies = []
    files = ['20592']
    hgrepos = []
    issue_num = 10940
    keywords = ['patch']
    message_count = 13.0
    messages = ['126500', '126501', '126869', '127264', '127273', '127275', '127281', '127370', '127373', '127376', '127388', '127461', '127563']
    nosy_count = 4.0
    nosy_names = ['brett.cannon', 'georg.brandl', 'rhettinger', 'ned.deily']
    pr_nums = []
    priority = None
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'crash'
    url = 'https://bugs.python.org/issue10940'
    versions = ['Python 2.7', 'Python 3.2']

    @rhettinger rhettinger added topic-IDLE type-crash A hard crash of the interpreter, possibly with a core dump labels Jan 18, 2011
    @ned-deily
    Copy link
    Member

    Is this on OS X 10.6 with ActiveState 8.5.9 installed?

    @rhettinger
    Copy link
    Contributor Author

    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.

    @ned-deily ned-deily changed the 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 Jan 18, 2011
    @ned-deily
    Copy link
    Member

    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.

    @ned-deily
    Copy link
    Member

    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.

    @birkenfeld
    Copy link
    Member

    Why don't we just remove IDLE...

    @rhettinger
    Copy link
    Contributor Author

    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.

    @birkenfeld
    Copy link
    Member

    I was just kidding (but I wish I weren't).

    @ned-deily
    Copy link
    Member

    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.

    @rhettinger
    Copy link
    Contributor Author

    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?

    @ned-deily
    Copy link
    Member

    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.

    @birkenfeld
    Copy link
    Member

    If this helps with hanging, okay to commit. (It doesn't have any effect on non-OSX anyway.)

    @ned-deily
    Copy link
    Member

    Committed in r88232 for 3.2rc2. Pending 2.7 backport, if necessary.

    @ned-deily
    Copy link
    Member

    Committed in r88270 for release in 2.7.2.

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    topic-IDLE type-crash A hard crash of the interpreter, possibly with a core dump
    Projects
    None yet
    Development

    No branches or pull requests

    3 participants