https://github.com/python/cpython/commit/0625799652a4876171103e985057ee3546441d95
commit: 0625799652a4876171103e985057ee3546441d95
branch: main
author: John <[email protected]>
committer: zware <[email protected]>
date: 2026-09-03T21:09:46Z
summary:

gh-136061: Simplify idlelib.editor.EditorWindow.load_extension methodname 
processing (GH-134874)

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