IDLE: add a bytecode browser
还没有人认领这个 Issue。
- 主要语言
- Python
- 星标
- 77.2k
- 派生
- 35.9k
- PR 合并指标
- PR 指标待抓取
描述
Feature or enhancement
Completing the browser series alongside the token (#152941) and AST (#152942) browsers, seeing the disassembled bytecode helps in learning how CPython compiles code and in understanding what the interpreter actually executes.
I propose a Disassembly Browser added as an extension on the Tools menu (Shell and editor). It shows the disassembled bytecode of the current window. Each code object is a collapsible row of its instructions; nested code objects (functions, classes, comprehensions, ...) are shown as further rows.
Interaction:
- Selecting an instruction highlights the corresponding source in the editor and, while the browser has focus, moves the cursor there.
- The browser follows the editor: selecting text or moving the cursor selects the matching instructions.
- Double-clicking a row (or pressing Escape) hides the browser, revealing the editor at that instruction.
- Scope is the editor selection if there is one, else the Shell's current input, else the whole window.
While the debugger is stopped, the browser follows it instead of the editor: it shows the code object that is actually executing and marks the instruction the frame is stopped at.
It shares the window skeleton and editor-sync mechanism with the token and AST browsers.
A PR will follow.
Linked PRs
- gh-152974
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
首先检查 token 和 AST 浏览器、它们共享的窗口骨架和编辑器同步机制,以及关联的 PR gh-152974。将 issue 的交互和范围规则作为验收标准:字节码应可按代码对象浏览,与编辑器或调试器同步,并隐藏回相关指令。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- python
- 领域
- desktop, tooling
- Issue 类型
- 功能
- 难度
- 5/5
- 预计耗时
- 一周以上
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 25/100