IDLE: add a bytecode browser
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- Python
- Sterne
- 77.2k
- Forks
- 35.9k
- PR-Merge-Kennzahlen
- PR-Kennzahlen ausstehend
Beschreibung
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
Beitragsleitfaden
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Rechercherichtung
Überprüfe zunächst die Token- und AST-Browser, ihr gemeinsames Fensterskelett und den Editor-Synchronisierungsmechanismus sowie den verknüpften PR gh-152974. Verwende die Interaktions- und Umfangsregeln des Issues als Akzeptanzkriterien: Bytecode sollte nach Codeobjekt durchsuchbar sein, mit dem Editor oder Debugger synchronisiert werden und zurück zur relevanten Instruktion ausgeblendet werden.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- python
- Bereich
- desktop, tooling
- Issue-Typ
- Feature
- Schwierigkeit
- 5/5
- Geschätzter Aufwand
- Über eine Woche
- Aktivitätsstatus
- Veraltet
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 25/100