python / python/cpython

Modernize Code In IDLELib Editor Backspace

未关闭
#136,556 9 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

topic-IDLE type-feature
主要语言
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.

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 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

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。