gh-128891: add specialized opcodes to opcode.opname (#128892)

This commit is contained in:
Irit Katriel 2025-01-15 21:02:32 +00:00 committed by GitHub
parent 256d6d2131
commit 5eee2fe2b0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 15 additions and 4 deletions

View file

@ -999,12 +999,14 @@ class DisTests(DisTestBase):
def test_widths(self):
long_opcodes = set(['JUMP_BACKWARD_NO_INTERRUPT',
'INSTRUMENTED_CALL_FUNCTION_EX'])
for opcode, opname in enumerate(dis.opname):
for op, opname in enumerate(dis.opname):
if opname in long_opcodes or opname.startswith("INSTRUMENTED"):
continue
if opname in opcode._specialized_opmap:
continue
with self.subTest(opname=opname):
width = dis._OPNAME_WIDTH
if opcode in dis.hasarg:
if op in dis.hasarg:
width += 1 + dis._OPARG_WIDTH
self.assertLessEqual(len(opname), width)