gh-112620: Fix dis error on show_cache with labels (#112621)

This commit is contained in:
Irit Katriel 2023-12-03 12:12:49 +00:00 committed by GitHub
parent 4ed46d2244
commit 162d3d428a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 23 additions and 6 deletions

View file

@ -1896,6 +1896,18 @@ class InstructionTests(InstructionTestCase):
positions=None)
self.assertEqual(instruction.arg, instruction.oparg)
def test_show_caches_with_label(self):
def f(x, y, z):
if x:
res = y
else:
res = z
return res
output = io.StringIO()
dis.dis(f.__code__, file=output, show_caches=True)
self.assertIn("L1:", output.getvalue())
def test_baseopname_and_baseopcode(self):
# Standard instructions
for name, code in dis.opmap.items():