summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_dis.py
diff options
context:
space:
mode:
authorIrit Katriel <1055913+iritkatriel@users.noreply.github.com>2023-12-03 12:12:49 (GMT)
committerGitHub <noreply@github.com>2023-12-03 12:12:49 (GMT)
commit162d3d428a836850ba29c58bbf37c931843d9e37 (patch)
tree7c876204b40b009f3c087b402b7f867ffd840038 /Lib/test/test_dis.py
parent4ed46d224401243399b41c7ceef4532bd249da27 (diff)
downloadcpython-162d3d428a836850ba29c58bbf37c931843d9e37.zip
cpython-162d3d428a836850ba29c58bbf37c931843d9e37.tar.gz
cpython-162d3d428a836850ba29c58bbf37c931843d9e37.tar.bz2
gh-112620: Fix dis error on show_cache with labels (#112621)
Diffstat (limited to 'Lib/test/test_dis.py')
-rw-r--r--Lib/test/test_dis.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/Lib/test/test_dis.py b/Lib/test/test_dis.py
index 805cd4e..349790e 100644
--- a/Lib/test/test_dis.py
+++ b/Lib/test/test_dis.py
@@ -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():