GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Assign opcode ids by ShaharNaveh · Pull Request #6637 · RustPython/RustPython

Assign opcode ids #6637

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Sign up for GitHub

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
youknowone merged 20 commits into RustPython:main from ShaharNaveh:bytecode-opcode-id
Jan 9, 2026

Uh oh!

There was an error while loading. Please reload this page.

Merged

Assign opcode ids #6637

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
5e4f61f
All opcodes have id
ShaharNaveh Jan 5, 2026
2b6b0bd
Fix names
ShaharNaveh Jan 6, 2026
6b96d0e
Fix `frame.rs`
ShaharNaveh Jan 6, 2026
2a6672f
Fix codegen
ShaharNaveh Jan 6, 2026
c5eab6a
re add GetYieldFromIter
ShaharNaveh Jan 6, 2026
c56c91f
Fix `frame.rs`
ShaharNaveh Jan 6, 2026
04f6d42
Fix `opcode.rs`
ShaharNaveh Jan 6, 2026
a7a0eda
Fix `TryFrom<u8>` for `Instruction`
ShaharNaveh Jan 6, 2026
1646643
Mark failing tests
ShaharNaveh Jan 6, 2026
e166fda
fix jit
ShaharNaveh Jan 6, 2026
6df35bf
Fix more jit
ShaharNaveh Jan 7, 2026
2ab530e
Merge remote-tracking branch 'upstream/main' into bytecode-opcode-id
ShaharNaveh Jan 7, 2026
04139e4
Merge remote-tracking branch 'upstream/main' into bytecode-opcode-id
ShaharNaveh Jan 9, 2026
b222c80
VarArgs -> Varargs
ShaharNaveh Jan 9, 2026
0006700
Refactor scripts/generate_opcode_metadata.py
ShaharNaveh Jan 9, 2026
89c20f6
Add placeholder opcodes
ShaharNaveh Jan 9, 2026
6cdf6f5
Fix
ShaharNaveh Jan 9, 2026
8e1433c
Don't crash on placejolder bytecode
ShaharNaveh Jan 9, 2026
9e6cbed
Unmark passing test
ShaharNaveh Jan 9, 2026
258f61c
Mark failing test
ShaharNaveh Jan 9, 2026
File filter
Filter by extension

Clear filters
Conversations
Failed to load comments.
Loading

Uh oh!

There was an error while loading. Please reload this page.

Jump to
Jump to file
Failed to load files.
Loading

Uh oh!

There was an error while loading. Please reload this page.

Diff view
Diff view

There are no files selected for viewing

47 changes: 19 additions & 28 deletions 47 Lib/_opcode_metadata.py
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
'CACHE': 0,
'BEFORE_ASYNC_WITH': 1,
'BEFORE_WITH': 2,
'RESERVED_3': 3,
'BINARY_OP_INPLACE_ADD_UNICODE': 3,
'BINARY_SLICE': 4,
'BINARY_SUBSCR': 5,
'CHECK_EG_MATCH': 6,
Expand All @@ -24,7 +24,7 @@
'FORMAT_SIMPLE': 14,
'FORMAT_WITH_SPEC': 15,
'GET_AITER': 16,
'RESERVED_17': 17,
'RESERVED': 17,
'GET_ANEXT': 18,
'GET_ITER': 19,
'GET_LEN': 20,
Expand Down Expand Up @@ -127,36 +127,27 @@
'UNPACK_SEQUENCE': 117,
'YIELD_VALUE': 118,
'BREAK': 119,
'BUILD_LIST_UNPACK': 120,
'BUILD_LIST_FROM_TUPLES': 120,
'BUILD_MAP_FOR_CALL': 121,
'BUILD_SET_UNPACK': 122,
'BUILD_TUPLE_ITER': 123,
'BUILD_TUPLE_UNPACK': 124,
'CALL_METHOD': 125,
'CALL_METHOD_KW': 126,
'BUILD_SET_FROM_TUPLES': 122,
'BUILD_TUPLE_FROM_ITER': 123,
'BUILD_TUPLE_FROM_TUPLES': 124,
'CALL_METHOD_POSITIONAL': 125,
'CALL_METHOD_KEYWORD': 126,
'CALL_METHOD_EX': 127,
'CONTINUE': 128,
'JUMP': 129,
'JUMP_IF_FALSE_OR_POP': 130,
'JUMP_IF_TRUE_OR_POP': 131,
'JUMP_IF_NOT_EXC_MATCH': 132,
'LOAD_CLASSDEREF': 133,
'LOAD_CLOSURE': 134,
'LOAD_METHOD': 135,
'POP_BLOCK': 136,
'REVERSE': 137,
'SET_EXC_INFO': 138,
'SUBSCRIPT': 139,
'UNARY_OP': 140,
'RESERVED_141': 141,
'RESERVED_142': 142,
'RESERVED_143': 143,
'RESERVED_144': 144,
'RESERVED_145': 145,
'RESERVED_146': 146,
'RESERVED_147': 147,
'RESERVED_148': 148,
'JUMP_IF_FALSE_OR_POP': 129,
'JUMP_IF_TRUE_OR_POP': 130,
'JUMP_IF_NOT_EXC_MATCH': 131,
'LOAD_CLASS_DEREF': 132,
'REVERSE': 133,
'SET_EXC_INFO': 134,
'SUBSCRIPT': 135,
'RESUME': 149,
'JUMP': 252,
'LOAD_CLOSURE': 253,
'LOAD_METHOD': 254,
'POP_BLOCK': 255,
}

# CPython 3.13 compatible: opcodes < 44 have no argument
Expand Down
1 change: 1 addition & 0 deletions 1 Lib/test/test__opcode.py
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ def check_bool_function_result(self, func, ops, expected):
self.assertIsInstance(func(op), bool)
self.assertEqual(func(op), expected)

@unittest.expectedFailure # TODO: RUSTPYTHON; Only supporting u8 ATM
def test_invalid_opcodes(self):
invalid = [-100, -1, 255, 512, 513, 1000]
self.check_bool_function_result(_opcode.is_valid, invalid, False)
Expand Down
1 change: 1 addition & 0 deletions 1 Lib/test/test_dis.py
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -937,6 +937,7 @@ def test_opname(self):
def test_boundaries(self):
self.assertEqual(dis.opmap["EXTENDED_ARG"], dis.EXTENDED_ARG)

@unittest.expectedFailure # TODO: RUSTPYTHON; AssertionError: 29 not less than or equal to 20
Comment thread

@ShaharNaveh ShaharNaveh Jan 9, 2026

Copy link
Copy Markdown
Contributor Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because BINARY_OP_INPLACE_ADD_UNICODE opcode was added, we are missing some truncation logic when formatting the dis output

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

youknowone reacted with thumbs up emoji
All reactions
  • 👍 1 reaction
def test_widths(self):
long_opcodes = set(['JUMP_BACKWARD_NO_INTERRUPT',
'INSTRUMENTED_CALL_FUNCTION_EX'])
Expand Down
Loading
Oops, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

Loading
Oops, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

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.
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.