mirror of https://github.com/python/cpython
gh-91276: make space for longer opcodes in dis output (GH-91444)
This commit is contained in:
parent
f33e2c87a8
commit
e44f988b26
|
@ -245,7 +245,7 @@ _Instruction.positions.__doc__ = "dis.Positions object holding the span of sourc
|
||||||
_ExceptionTableEntry = collections.namedtuple("_ExceptionTableEntry",
|
_ExceptionTableEntry = collections.namedtuple("_ExceptionTableEntry",
|
||||||
"start end target depth lasti")
|
"start end target depth lasti")
|
||||||
|
|
||||||
_OPNAME_WIDTH = 20
|
_OPNAME_WIDTH = max(map(len, opmap))
|
||||||
_OPARG_WIDTH = 5
|
_OPARG_WIDTH = 5
|
||||||
|
|
||||||
class Instruction(_Instruction):
|
class Instruction(_Instruction):
|
||||||
|
|
|
@ -683,18 +683,6 @@ class DisTests(DisTestBase):
|
||||||
|
|
||||||
def test_widths(self):
|
def test_widths(self):
|
||||||
for opcode, opname in enumerate(dis.opname):
|
for opcode, opname in enumerate(dis.opname):
|
||||||
if opname in ('BUILD_MAP_UNPACK_WITH_CALL',
|
|
||||||
'BUILD_TUPLE_UNPACK_WITH_CALL',
|
|
||||||
'JUMP_BACKWARD_NO_INTERRUPT',
|
|
||||||
'POP_JUMP_FORWARD_IF_NONE',
|
|
||||||
'POP_JUMP_BACKWARD_IF_NONE',
|
|
||||||
'POP_JUMP_FORWARD_IF_NOT_NONE',
|
|
||||||
'POP_JUMP_BACKWARD_IF_NOT_NONE',
|
|
||||||
'POP_JUMP_FORWARD_IF_TRUE',
|
|
||||||
'POP_JUMP_BACKWARD_IF_TRUE',
|
|
||||||
'POP_JUMP_FORWARD_IF_FALSE',
|
|
||||||
'POP_JUMP_BACKWARD_IF_FALSE'):
|
|
||||||
continue
|
|
||||||
with self.subTest(opname=opname):
|
with self.subTest(opname=opname):
|
||||||
width = dis._OPNAME_WIDTH
|
width = dis._OPNAME_WIDTH
|
||||||
if opcode < dis.HAVE_ARGUMENT:
|
if opcode < dis.HAVE_ARGUMENT:
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
Make space for longer opcodes in :mod:`dis` output.
|
Loading…
Reference in New Issue