diff --git a/Lib/idlelib/News3.txt b/Lib/idlelib/News3.txt index 30784578cc637f..6cb66605e78726 100644 --- a/Lib/idlelib/News3.txt +++ b/Lib/idlelib/News3.txt @@ -4,6 +4,9 @@ Released on 2025-10-07 ========================= +gh-134873: Minor code modernization in extension loader. +Patch by johnzhou721, Zachary Ware, and Terry J. Reedy. + gh-112936: IDLE - Include Shell menu in single-process mode, though with Restart Shell and View Last Restart disabled. Patch by Zhikang Yan. diff --git a/Lib/idlelib/editor.py b/Lib/idlelib/editor.py index c76db20c58792d..9d4fc62da339ab 100644 --- a/Lib/idlelib/editor.py +++ b/Lib/idlelib/editor.py @@ -1202,12 +1202,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))