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 crashing when pressing Command + ^ (OSX)
Type: crash Stage: resolved
Components: macOS, Tkinter Versions: Python 3.7
process
Status: closed Resolution: third party
Dependencies: Superseder:
Assigned To: Nosy List: Aivar.Annamaa, iPodClassic, ned.deily, ronaldoussoren, terry.reedy, wordtech
Priority: normal Keywords:

Created on 2018-08-21 22:20 by iPodClassic, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
crash report idle.txt iPodClassic, 2018-08-21 22:19 crash report IDLE
Messages (15)
msg323848 - (view) Author: iPodClassic (iPodClassic) Date: 2018-08-21 22:19
IDLE crashes when pressing Command (⌘) + ^ 

I have attached the crash report just in case.
msg323851 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2018-08-21 23:02
I believe NSException crashes are due to interaction between tcl/tk and the Mac graphics subsystem, in this case for 10.11.6.

Did you install 3.7 with the python.org installer or something else?
How did you start IDLE and what state was it in when you hit command-^?

Neither of the default Mac key sets use Command-Key-^.  Did you create a custom keyset and bind it to something?
msg323852 - (view) Author: iPodClassic (iPodClassic) Date: 2018-08-21 23:08
Hello Terry. I installed 3.7 from Python.org
First time it crashed,  I was playing around with some basic code (I’m learning), whilst trying to enter [ character (which is option + ^key in spanish keyboard), by mistake I pressed command (key next to option) and crashed IDLE.
Since I saw the crash report, I tried reproducing in in order to report the supposed bug.

Then I restarted IDLE from OSX Spotlight, and successfully crashed it using the same key combo several times.

I did not create any custom keyset, just happened by mistake.

Regards,

> El 21 ago 2018, a las 20:02 , Terry J. Reedy <report@bugs.python.org> escribió:
> 
> 
> Terry J. Reedy <tjreedy@udel.edu> added the comment:
> 
> I believe NSException crashes are due to interaction between tcl/tk and the Mac graphics subsystem, in this case for 10.11.6.
> 
> Did you install 3.7 with the python.org installer or something else?
> How did you start IDLE and what state was it in when you hit command-^?
> 
> Neither of the default Mac key sets use Command-Key-^.  Did you create a custom keyset and bind it to something?
> 
> ----------
> assignee: terry.reedy ->
> components: +Tkinter, macOS -IDLE
> nosy: +ned.deily, ronaldoussoren
> title: IDLE crashing when pressing Command + ^  (OSX) -> Tkinter crashing when pressing Command + ^  (OSX)
> 
> _______________________________________
> Python tracker <report@bugs.python.org>
> <https://bugs.python.org/issue34455>
> _______________________________________
msg323859 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2018-08-22 03:21
Please download and run https://bugs.python.org/file47676/tk_scroll.py.  It is a very stripped-down version of an IDLE editor window.  After making a couple of edits, to make sure it is working, hit the fatal key combination.  Does it still crash?
msg323860 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2018-08-22 03:22
PS, When replaying by email, please delete the quoted message, as it is redundant in the web page display.
msg323879 - (view) Author: iPodClassic (iPodClassic) Date: 2018-08-22 13:39
Noted the issue with the email replies, sorry!

Do you want me to place the file in any folder in particular? Remember I’m a noob at this.  I placed it in the Python app folder, ran the script, played around with IDLE and I can still crash it using command + ^ .  Maybe it’s not a bug after all and a problem with OSX?
msg323886 - (view) Author: Ronald Oussoren (ronaldoussoren) * (Python committer) Date: 2018-08-22 14:21
FWIW I can reproduce the problem with IDLE and tk_scroll.py:

1) Add a spanish keyboard layout in System Preferences (my normal layout is US International, matching the text on the keyboard)

2) Select this keyboard using the keyboard menu item

3) Type CMD-^ by pressing "CMD+SHIFT+[" (that is, at the same time press the keys CMD, SHIFT and the key where [ is on the keycap). 

With tk_scroll.py the following output is shown in the terminal:

2018-08-22 16:12:22.231 Python[51578:13988425] -[TKMenu submenuAction:]: unrecognized selector sent to instance 0x7fe078f56270
2018-08-22 16:12:22.315 Python[51578:13988425] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[TKMenu submenuAction:]: unrecognized selector sent to instance 0x7fe078f56270'
*** First throw call stack:
(
	0   CoreFoundation                      0x00007fff30e8a2db __exceptionPreprocess + 171
	1   libobjc.A.dylib                     0x00007fff58034c76 objc_exception_throw + 48
	2   CoreFoundation                      0x00007fff30f22db4 -[NSObject(NSObject) doesNotRecognizeSelector:] + 132
	3   CoreFoundation                      0x00007fff30e00820 ___forwarding___ + 1456
	4   CoreFoundation                      0x00007fff30e001e8 _CF_forwarding_prep_0 + 120
	5   AppKit                              0x00007fff2eb37a43 -[NSApplication(NSResponder) sendAction:to:from:] + 312
	6   AppKit                              0x00007fff2e82c1bb -[NSCarbonMenuImpl performMenuAction:withTarget:] + 155
	7   AppKit                              0x00007fff2e5cb232 -[NSMenu _performKeyEquivalentWithDelegate:] + 361
	8   AppKit                              0x00007fff2e5cacd8 -[NSMenu performKeyEquivalent:] + 68
	9   AppKit                              0x00007fff2eb366a9 routeKeyEquivalent + 884
	10  AppKit                              0x00007fff2eb33ce0 -[NSApplication(NSEvent) sendEvent:] + 1096
	11  libtk8.6.dylib                      0x0000000108e7f3ee -[TKApplication(TKNotify) sendEvent:] + 39
	12  libtk8.6.dylib                      0x0000000108e7f787 TkMacOSXEventsCheckProc + 434
	13  libtcl8.6.dylib                     0x0000000108d16d06 Tcl_DoOneEvent + 316
	14  _tkinter.cpython-37m-darwin.so      0x0000000108c4701d _tkinter_tkapp_mainloop + 269
	15  Python                              0x000000010865884e _PyMethodDef_RawFastCallKeywords + 430
	16  Python                              0x000000010865e462 _PyMethodDescr_FastCallKeywords + 82
	17  Python                              0x00000001087175e0 call_function + 832
	18  Python                              0x0000000108714546 _PyEval_EvalFrameDefault + 25126
	19  Python                              0x0000000108718096 _PyEval_EvalCodeWithName + 2422
	20  Python                              0x0000000108657d81 _PyFunction_FastCallKeywords + 257
	21  Python                              0x00000001087175bb call_function + 795
	22  Python                              0x0000000108714560 _PyEval_EvalFrameDefault + 25152
	23  Python                              0x0000000108718096 _PyEval_EvalCodeWithName + 2422
	24  Python                              0x000000010870e244 PyEval_EvalCode + 100
	25  Python                              0x000000010874b041 PyRun_FileExFlags + 209
	26  Python                              0x000000010874a8eb PyRun_SimpleFileExFlags + 859
	27  Python                              0x000000010876893c pymain_main + 8044
	28  Python                              0x0000000108768da1 _Py_UnixMain + 129
	29  libdyld.dylib                       0x00007fff58c4e015 start + 1
	30  ???                                 0x0000000000000002 0x0 + 2
)
libc++abi.dylib: terminating with uncaught exception of type NSException
Abort trap: 6

I haven't (and won't) further investigated this problem, but at least this should help reproduce the problem.  Its likely a Tk problem, but maybe it is possible to tweak IDLE or Tkinter to avoid a crash. 

P.S. The crash does not happen with a US keyboard layout. 

P.P.S. SHIFT+[ appears to be how you enter "^" on a spanish keyboard.
msg323893 - (view) Author: iPodClassic (iPodClassic) Date: 2018-08-22 16:20
Thanks for the more detailed and further explanation. So we at least know it’s bound to spanish keyboards only.  I wouldn’t even call it a bothersome bug except the key combo you press is very similar to when you try to enter a [ key (option+^) ; so you end up losing all code by mistake, when trying to enter an often used character on IDLE.
msg323914 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2018-08-23 00:49
I should have been more specific.  I meant to run the file directly with python, with IDLE not involved.  "python3 .../path/to/tk_scroll.py".  Howver, running it from an IDLE editor and editing in the resulting non-IDLE text window is almost as good.

This reminds me of when trying to enter a French cedilla crashed tk.  That was fixed about at tk 8.5.15.

The only thing that could be done from IDLE is to add tk(inter) bind calls.
msg323915 - (view) Author: iPodClassic (iPodClassic) Date: 2018-08-23 01:44
I see. Well, I guess as far as I can go is to notify about the bug. The part about adding tkinter bind calls I have no idea. Should we just close this bug report as postponed or something?

Thanks for the help and explanation though! I guess the more I get into Python the more things I will find out.
msg325192 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2018-09-12 22:01
The crash can also be reproduced with a Spanish keyboard selected and using the Tcl/Tk wish shell edit text demo.  So it's definitely not a Python (tkinter or IDLE) issue.  I see that Kevin Walzer, the primary maintainer for Tk on macOS, is CC here.  If anyone wants this issue to be addressed, someone should probably check the Tck/Tk issue tracker and, if the problem hasn't already been reported, open an issue there:

https://core.tcl.tk/tk/ticket
msg353816 - (view) Author: Aivar Annamaa (Aivar.Annamaa) * Date: 2019-10-03 06:31
I created the ticket: https://core.tcl-lang.org/tk/tktview/5849df7852c48cb763b11a11d848a68482b0f828
msg353827 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2019-10-03 08:31
Aivar, thank you for opening the issue.

I believe what I meant about tkinter bind calls would be to conditionallly bind '<Command+^>' to a function that returns 'break', thus claiming that the key combination has been handled and that tk should ignore it.  The function could do nothing or it could display a message.

I don't know if this would work until it were tested.  And it would be a real kludgy workaround and until disabled would block the key combo from working when the tcl people did fix it.  So not to be done lightly.
msg353829 - (view) Author: Aivar Annamaa (Aivar.Annamaa) * Date: 2019-10-03 08:39
> to conditionallly bind '<Command+^>' to a function that returns 'break'

I tried capturing all <Key> events. The handler was called for Cmd press,  but the crash occurred before the handler was called for the other key.
msg353846 - (view) Author: Kevin Walzer (wordtech) * Date: 2019-10-03 12:54
We have committed some fixes to the keyboard code in the past year that seem to have fixed this issue. I do not see it in 8.6.10, now as a RC. I believe this bug is obsolete at this point.
History
Date User Action Args
2022-04-11 14:59:04adminsetgithub: 78636
2019-10-03 12:54:57wordtechsetmessages: + msg353846
2019-10-03 08:39:18Aivar.Annamaasetmessages: + msg353829
2019-10-03 08:31:45terry.reedysetmessages: + msg353827
2019-10-03 06:31:28Aivar.Annamaasetnosy: + Aivar.Annamaa
messages: + msg353816
2018-09-12 22:01:10ned.deilysetstatus: open -> closed
resolution: third party
messages: + msg325192

stage: resolved
2018-08-23 01:44:34iPodClassicsetmessages: + msg323915
2018-08-23 00:49:01terry.reedysetnosy: + wordtech
messages: + msg323914
2018-08-22 16:20:54iPodClassicsetmessages: + msg323893
2018-08-22 14:21:24ronaldoussorensetmessages: + msg323886
2018-08-22 13:39:13iPodClassicsetmessages: + msg323879
2018-08-22 03:22:09terry.reedysetmessages: + msg323860
2018-08-22 03:21:19terry.reedysetmessages: + msg323859
2018-08-21 23:08:35iPodClassicsetmessages: + msg323852
2018-08-21 23:02:26terry.reedysettitle: IDLE crashing when pressing Command + ^ (OSX) -> Tkinter crashing when pressing Command + ^ (OSX)
nosy: + ronaldoussoren, ned.deily

messages: + msg323851

assignee: terry.reedy ->
components: + macOS, Tkinter, - IDLE
2018-08-21 22:20:10iPodClassiccreate