Modernize Code In IDLELib Editor Backspace
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 77.2k
- Forks
- 35.9k
- PR merge metrics
- PR metrics pending
Description
(and potentially deprecate handling of tabs in IDLE, though likely separate issue)
In https://github.com/python/cpython/issues/136061, https://github.com/python/cpython/blob/561212a03306cb2f246771e9c4748bec1dc41405/Lib/idlelib/editor.py#L1365-L1385 is mentioned as an area of code with quadratic complexity, which may lead to performance issues; though this is unlikely to be of large impact in practice because attackers with the ability to get a huge file loaded and/or modify configuration files to change the tab width can do much worse things than getting IDLE to hang on hitting backspace.
However, the complexity there comes from a loop which handles situations (files with tabs) that either cannot or should not occur; in the current default IDLE, you can't put tabs, and a space after a tab should just be deleted in a file coming from elsewhere as in indicated in https://github.com/python/cpython/pull/134874#issuecomment-3014981765. Therefore, simplifying the function specification and/or deprecating IDLE to handle tabs (which we should do) will allow elimination of this piece of obsolete code, as indicated in https://github.com/python/cpython/issues/136061#issuecomment-3016093746.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Read Lib/idlelib/editor.py lines 1365-1385 first, then review issue 136061 and the linked discussion in PR 134874. Clarify whether this issue covers simplifying backspace handling, deprecating tab handling, or both; it is done when the agreed scope is implemented and the obsolete behavior is addressed.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- desktop, tooling
- Issue type
- Refactor
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100