python / python/cpython

IDLE: add a bytecode browser

Aperta
#152,966 2 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

stdlib topic-IDLE type-feature
Lingua principale
Python
Stelle
77.2k
Fork
35.9k
Metriche di merge delle PR
Metriche PR in attesa

Descrizione

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

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Direzione di ricerca

Esamina prima i browser dei token e dell’AST, la loro struttura di finestra condivisa e il meccanismo di sincronizzazione con l’editor, insieme alla PR collegata gh-152974. Usa le regole di interazione e ambito dell’issue come criteri di accettazione: il bytecode deve poter essere esplorato per oggetto codice, sincronizzarsi con l’editor o il debugger e nascondersi tornando all’istruzione pertinente.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
python
Ambito
desktop, tooling
Tipo di issue
Funzionalità
Difficoltà
5/5
Tempo stimato
Più di una settimana
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
25/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.