Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 19 additions & 28 deletions Lib/_opcode_metadata.py
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 Lib/test/test__opcode.py
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 Lib/test/test_dis.py
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
Copy link
Contributor Author

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

def test_widths(self):
long_opcodes = set(['JUMP_BACKWARD_NO_INTERRUPT',
'INSTRUMENTED_CALL_FUNCTION_EX'])
Expand Down
Loading
Loading