Skip to content

gh-152966: Add a disassembly browser to IDLE#152974

Open
serhiy-storchaka wants to merge 3 commits into
python:mainfrom
serhiy-storchaka:idle-disbrowser
Open

gh-152966: Add a disassembly browser to IDLE#152974
serhiy-storchaka wants to merge 3 commits into
python:mainfrom
serhiy-storchaka:idle-disbrowser

Conversation

@serhiy-storchaka

@serhiy-storchaka serhiy-storchaka commented Jul 3, 2026

Copy link
Copy Markdown
Member

Add a Disassembly Browser extension on the Tools menu (Shell and editor), completing the browser series alongside the token (#152941) and AST (#152942) browsers. It shows the disassembled bytecode of the current window as collapsible code objects and their instructions.

Selecting an instruction highlights the corresponding source in the editor and, while the browser has focus, moves the cursor there; selecting text or moving the cursor in the editor selects the matching instructions. Double-clicking a row (or Escape) hides the browser. 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 current instruction.

This PR is stacked on #152947 — it shares the window skeleton and editor-sync mechanism with the token and AST browsers, so it includes those commits and should be reviewed and merged after them.

🤖 Generated with Claude Code

@read-the-docs-community

read-the-docs-community Bot commented Jul 3, 2026

Copy link
Copy Markdown

Documentation build overview

📚 cpython-previews | 🛠️ Build #33433717 | 📁 Comparing 292d7df against main (a90576d)

  🔍 Preview build  

3 files changed
± library/idle.html
± library/tk.html
± whatsnew/changelog.html

serhiy-storchaka and others added 3 commits July 4, 2026 01:17
Add a Token Browser command to a new Browse menu (Shell and editor).  It
opens a window listing the Python tokens of the editor content, or of the
selection if there is one, with the token type names colored as by
"python -m tokenize".

There is one browser per editor; invoking the command again refreshes it
and selects the token at the cursor.  Selecting rows highlights the
matching regions in the editor and, while the browser has focus, moves
the editor cursor there; selecting text or moving the cursor in the
editor selects the matching rows.  Double-clicking a row (or pressing
Escape) hides the browser, revealing the editor at the token.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Add an AST Browser command to the Browse menu (Shell and editor).  It
opens a window showing the abstract syntax tree of the editor content
(or, in the Shell, the current input), or of the selection if there is
one.  Selecting a node highlights the matching region in the editor and,
while the browser has focus, moves the editor cursor there; selecting
text or moving the cursor in the editor selects the innermost enclosing
node.  Double-clicking a node (or pressing Escape) hides the browser,
revealing the editor at the node.

It shares the window skeleton and editor-sync mechanism with the token
browser.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Add a Disassembly Browser command to the Browse menu (Shell and editor).
It shows the disassembled bytecode of the editor content, the Shell input,
or the selection, as collapsible code objects colored by operand kind.
Selecting an instruction highlights the matching source, and selecting
source selects the instructions.

While the debugger is stopped, the browser instead shows the code object
that is executing -- obtained from the subprocess through the debugger RPC
via marshal, not by recompiling the editor -- and marks the current
instruction.

It shares the window skeleton and editor-sync mechanism with the token and
AST browsers.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant