IDLE: add a bytecode browser
還沒有人認領這個 Issue。
- 主要語言
- Python
- 星號
- 77.2k
- 分支
- 36k
- 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