Modernize Code In IDLELib Editor Backspace
还没有人认领这个 Issue。
- 主要语言
- Python
- 星标
- 77.2k
- 派生
- 35.9k
- PR 合并指标
- PR 指标待抓取
描述
(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.
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
先阅读 Lib/idlelib/editor.py 的第 1365–1385 行,然后查看 issue 136061 以及 PR 134874 中链接的讨论。明确此 issue 涵盖的是简化 Backspace 处理、弃用 Tab 处理,还是两者都包括;在约定的范围完成实现并处理掉过时的行为后,该 issue 即告完成。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- python
- 领域
- desktop, tooling
- Issue 类型
- 重构
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 活跃度
- 停滞
- 描述清晰度
- 需要澄清
- 新手友好度
- 35/100