You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Bug Description:
A series of performance issues related to quadratic complexity has been identified in IDLE's editor. On files with very long lines, this can cause the editor to freeze or hang.
@kexinoh Bug 2 is invalid because "anyone who can edit files or get code files loaded can do much worse than than make IDLE hang on hitting" (Reedy 2025).
In addition:
Any such [refactoring] project [of the block of code in bug 2] must begin with a separate issue and an detailed analysis of current versus desired behavior, and it must consider the entire block of relevant code. This is lines 1365-1385, which begin with the comment
It may require inserting spaces if we back up over a tab character! This is written to be clear, not fast.
changed the title [-]IDLE: Performance Issue with Long Lines Due to Quadratic Complexity[/-][+]IDLE: Performance issue processing config-extensions.def[/+]on Jun 28, 2025
Item 1 does not involves processing lines in the editor. It is only about processing lines in idlelib/config-extensions.def. This code could be moved to a function in config.py. I changed the title accordingly.
This is not much of a bug either. Users do not normally change that file. But if they download and install an IDLE extension, its installer must add lines to the file. The code executed when the extension is invoked is more of a danger.
However, updating and improving the 2000 code with a feature added in 2002, which I am glad to do, also fixes the possible vulnerability.
As previously noted the 'quadratic' loop in item 2 does indicate problematic code. The complexity comes from trying to handle situations that either cannot or should not occur. Simplifying the function specification should allow elimination of that loop.
Fixed in main by #134874 and backported to 3.13 (#156913) and 3.14 (#156912). The 3.15 backport #156911 is waiting for the release manager. Item 2 is tracked in #136556.
Activity
johnzhou721 commentedon Jun 28, 2025
@kexinoh Bug 2 is invalid because "anyone who can edit files or get code files loaded can do much worse than than make IDLE hang on hitting" (Reedy 2025).
In addition:
REFERENCES
#134874
kexinoh commentedon Jun 28, 2025
I modified the content about this part in the issue
johnzhou721 commentedon Jun 28, 2025
@kexinoh Thanks!
[-]IDLE: Performance Issue with Long Lines Due to Quadratic Complexity[/-][+]IDLE: Performance issue processing config-extensions.def[/+]terryjreedy commentedon Jun 28, 2025
Item 1 does not involves processing lines in the editor. It is only about processing lines in idlelib/config-extensions.def. This code could be moved to a function in config.py. I changed the title accordingly.
This is not much of a bug either. Users do not normally change that file. But if they download and install an IDLE extension, its installer must add lines to the file. The code executed when the extension is invoked is more of a danger.
However, updating and improving the 2000 code with a feature added in 2002, which I am glad to do, also fixes the possible vulnerability.
As previously noted the 'quadratic' loop in item 2 does indicate problematic code. The complexity comes from trying to handle situations that either cannot or should not occur. Simplifying the function specification should allow elimination of that loop.
johnzhou721 commentedon Jul 11, 2025
#136556 tracks item 2 as needing simplification instead of a quadratic vulnerability.
gh-136061: Simplify idlelib.editor.EditorWindow.load_extension method…
[3.13] gh-136061: Simplify idlelib.editor.EditorWindow.load_extension…
[3.14] gh-136061: Simplify idlelib.editor.EditorWindow.load_extension…
pythongh-136061: Simplify idlelib.editor.EditorWindow.load_extension …
serhiy-storchaka commentedon Sep 15, 2026
Fixed in main by #134874 and backported to 3.13 (#156913) and 3.14 (#156912). The 3.15 backport #156911 is waiting for the release manager. Item 2 is tracked in #136556.
[3.15] gh-136061: Simplify idlelib.editor.EditorWindow.load_extension…