mirror of
https://github.com/python/cpython.git
synced 2025-10-17 20:28:43 +00:00
gh-112620: Fix dis error on show_cache with labels (#112621)
This commit is contained in:
parent
4ed46d2244
commit
162d3d428a
2 changed files with 23 additions and 6 deletions
|
@ -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():
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue