GH-129386: Add test.support.reset_code (GH-129486)

This commit is contained in:
Brandt Bucher 2025-01-31 02:50:54 -08:00 committed by GitHub
parent e3eba8ce26
commit 674befbd7b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 22 additions and 9 deletions

View file

@ -15,7 +15,7 @@ import types
import unittest
from test.support import (captured_stdout, requires_debug_ranges,
requires_specialization, cpython_only,
os_helper, import_helper)
os_helper, import_helper, reset_code)
from test.support.bytecode_helper import BytecodeTestCase
@ -1356,7 +1356,7 @@ class DisTests(DisTestBase):
self.code_quicken(f)
else:
# "copy" the code to un-quicken it:
f.__code__ = f.__code__.replace()
reset_code(f)
for instruction in _unroll_caches_as_Instructions(dis.get_instructions(
f, show_caches=True, adaptive=adaptive
), show_caches=True):