gh-91276: revert the increase of dis output width (GH-92126)

This commit is contained in:
Irit Katriel 2022-05-02 09:51:17 -06:00 committed by GitHub
parent b9ab6cea08
commit 84b986ba10
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 262 additions and 250 deletions

View file

@ -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):

View file

@ -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: