diff --git a/Lib/dis.py b/Lib/dis.py index 109c986bbe3d7d..a77458e208c332 100644 --- a/Lib/dis.py +++ b/Lib/dis.py @@ -460,7 +460,10 @@ def print_instruction(self, instr, mark_as_current=False): # Only show the fancy argrepr for a CACHE instruction when it's # the first entry for a particular cache value: if i == 0: - argrepr = f"{name}: {int.from_bytes(data, sys.byteorder)}" + data_int = int.from_bytes(data, sys.byteorder) + argrepr = f"{name}: {data_int}" + if name == "counter": + argrepr += f" (value: {data_int >> 4}, backoff: {data_int & 15})" else: argrepr = "" self.print_instruction_line( diff --git a/Lib/test/test_dis.py b/Lib/test/test_dis.py index 955a3e4cb9e4f7..3a41abed69dfd8 100644 --- a/Lib/test/test_dis.py +++ b/Lib/test/test_dis.py @@ -2514,7 +2514,7 @@ def test_show_cache(self): 1 LOAD_NAME 0 (print) PUSH_NULL CALL 0 - CACHE 0 (counter: 0) + CACHE 0 (counter: 0 (value: 0, backoff: 0)) CACHE 0 (func_version: 0) CACHE 0 POP_TOP