mirror of
https://github.com/python/cpython.git
synced 2025-09-27 10:50:04 +00:00
gh-91276: revert the increase of dis output width (GH-92126)
This commit is contained in:
parent
b9ab6cea08
commit
84b986ba10
2 changed files with 262 additions and 250 deletions
|
@ -264,7 +264,7 @@ _Instruction.positions.__doc__ = "dis.Positions object holding the span of sourc
|
|||
_ExceptionTableEntry = collections.namedtuple("_ExceptionTableEntry",
|
||||
"start end target depth lasti")
|
||||
|
||||
_OPNAME_WIDTH = max(map(len, opmap))
|
||||
_OPNAME_WIDTH = 20
|
||||
_OPARG_WIDTH = 5
|
||||
|
||||
class Instruction(_Instruction):
|
||||
|
|
|
@ -734,7 +734,19 @@ class DisTests(DisTestBase):
|
|||
self.assertEqual(dis.opmap["STORE_NAME"], dis.HAVE_ARGUMENT)
|
||||
|
||||
def test_widths(self):
|
||||
long_opcodes = set(['POP_JUMP_FORWARD_IF_FALSE',
|
||||
'POP_JUMP_FORWARD_IF_TRUE',
|
||||
'POP_JUMP_FORWARD_IF_NOT_NONE',
|
||||
'POP_JUMP_FORWARD_IF_NONE',
|
||||
'POP_JUMP_BACKWARD_IF_FALSE',
|
||||
'POP_JUMP_BACKWARD_IF_TRUE',
|
||||
'POP_JUMP_BACKWARD_IF_NOT_NONE',
|
||||
'POP_JUMP_BACKWARD_IF_NONE',
|
||||
'JUMP_BACKWARD_NO_INTERRUPT',
|
||||
])
|
||||
for opcode, opname in enumerate(dis.opname):
|
||||
if opname in long_opcodes:
|
||||
continue
|
||||
with self.subTest(opname=opname):
|
||||
width = dis._OPNAME_WIDTH
|
||||
if opcode < dis.HAVE_ARGUMENT:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue