python / python/cpython

IDLE: add a bytecode browser

Offen
#152,966 2 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

stdlib topic-IDLE type-feature
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

Beitragsleitfaden öffnen

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Ö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

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.