gh-112962: in dis module, put cache information in the Instruction instead of creating fake Instructions to represent it (#113016)

This commit is contained in:
Irit Katriel 2023-12-13 12:00:21 +00:00 committed by GitHub
parent 3531ea441b
commit 428c9812cb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 115 additions and 47 deletions

View file

@ -12,6 +12,7 @@ import warnings
from test import support
from test.support import (script_helper, requires_debug_ranges,
requires_specialization, Py_C_RECURSION_LIMIT)
from test.support.bytecode_helper import instructions_with_positions
from test.support.os_helper import FakePath
class TestSpecifics(unittest.TestCase):
@ -1346,8 +1347,8 @@ class TestSourcePositions(unittest.TestCase):
def assertOpcodeSourcePositionIs(self, code, opcode,
line, end_line, column, end_column, occurrence=1):
for instr, position in zip(
dis.Bytecode(code, show_caches=True), code.co_positions(), strict=True
for instr, position in instructions_with_positions(
dis.Bytecode(code), code.co_positions()
):
if instr.opname == opcode:
occurrence -= 1