-
-
Notifications
You must be signed in to change notification settings - Fork 31.7k
IDLE: refuse invalid key bindings #50988
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
Comments
I tried to assign a new key(lctrl+lshift instead of lctrl+F5) for run- Traceback (most recent call last):
File "C:\Python31\Lib\idlelib\idle.py", line 11, in <module>
idlelib.PyShell.main()
File "C:\Python31\Lib\idlelib\PyShell.py", line 1388, in main
shell = flist.open_shell()
File "C:\Python31\Lib\idlelib\PyShell.py", line 277, in open_shell
self.pyshell = PyShell(self)
File "C:\Python31\Lib\idlelib\PyShell.py", line 813, in __init__
OutputWindow.__init__(self, flist, None, None)
File "C:\Python31\Lib\idlelib\OutputWindow.py", line 16, in __init__
EditorWindow.__init__(self, *args)
File "C:\Python31\Lib\idlelib\EditorWindow.py", line 135, in __init__
self.apply_bindings()
File "C:\Python31\Lib\idlelib\EditorWindow.py", line 961, in
apply_bindings
text.event_add(event, *keylist)
File "C:\Python31\Lib\idlelib\MultiCall.py", line 359, in event_add
widget.event_add(self, virtual, seq)
File "C:\Python31\Lib\tkinter\__init__.py", line 1353, in event_add
self.tk.call(args)
_tkinter.TclError: bad event type or keysym "Shift" What do I do to get this up and running? |
|
Here is a patch that changes IDLE to refuse invalid key bindings. |
Thanks for the help. I removed that external row and now it's up and running again :D May I I'm just a n00b/beginner level on programming and I will someday try to Thank you very much for the help and guidance. |
Please, understand that the bug tracker is a place to provide help and Nevertheless, the attached patch was generated from python trunk so if |
bpo-21519 also patched key validation |
I believe patch for bpo-21519 affects area of file patched here. |
Patch mostly looks good. To apply now, keybindingDialog.py must become config_key.py. I have no idea what other merge issues there might be. The name of the new function'KeySequenceCheck()' should be 'sequence_ok()'. A minimal new test should call sequence_ok with invalid sequence '<Control-Shift>' and valid sequence '<Control-Shift-Key-x>'. |
I've made a PR for the patch. Even though other tests need to be added, I only added a test for the call to sequence_ok(). Testing this by itself will probably allow it to be mocked in other tests. I also added a call to the unittest in config_key.py. |
Guilherme, thank you for the patch. Sorry it took so long to be applied. Cheryl, thank you for making the PR. Writing invalid, exception-raising sequences to user config files was a definite bug. |
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:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: