https://github.com/python/cpython/commit/1050f7c8dc2bf5d7ec2f1926de903fb4209fb190
commit: 1050f7c8dc2bf5d7ec2f1926de903fb4209fb190
branch: 3.13
author: Miss Islington (bot) <[email protected]>
committer: zware <[email protected]>
date: 2026-09-03T21:27:54Z
summary:

[3.13] gh-136061: Simplify idlelib.editor.EditorWindow.load_extension 
methodname processing (GH-156913)

(cherry picked from commit 0625799652a4876171103e985057ee3546441d95)

Co-authored-by: John <[email protected]>

files:
M Lib/idlelib/editor.py

diff --git a/Lib/idlelib/editor.py b/Lib/idlelib/editor.py
index a040d791bdeb528..89e1725e15f30b0 100644
--- a/Lib/idlelib/editor.py
+++ b/Lib/idlelib/editor.py
@@ -1175,12 +1175,7 @@ def load_extension(self, name):
         if keydefs:
             self.apply_bindings(keydefs)
             for vevent in keydefs:
-                methodname = vevent.replace("-", "_")
-                while methodname[:1] == '<':
-                    methodname = methodname[1:]
-                while methodname[-1:] == '>':
-                    methodname = methodname[:-1]
-                methodname = methodname + "_event"
+                methodname = vevent.strip("<>").replace("-", "_") + "_event"
                 if hasattr(ins, methodname):
                     self.text.bind(vevent, getattr(ins, methodname))
 

_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3//lists/python-checkins.python.org
Member address: [email protected]

Reply via email to