gh-152966: Add a disassembly browser to IDLE#152974
Open
serhiy-storchaka wants to merge 3 commits into
Open
Conversation
Documentation build overview
|
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>
1e727f5 to
292d7df
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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