summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_capi/test_opt.py
diff options
context:
space:
mode:
authorBrandt Bucher <brandtbucher@microsoft.com>2025-01-31 10:50:54 (GMT)
committerGitHub <noreply@github.com>2025-01-31 10:50:54 (GMT)
commit674befbd7be3bffee66772ff9fdef168feda47ef (patch)
tree05b689a8acc4672bcdf56df45af42bd7d6047e3e /Lib/test/test_capi/test_opt.py
parente3eba8ce266f90d9f8faeb5b2b4b64e56110bd2a (diff)
downloadcpython-674befbd7be3bffee66772ff9fdef168feda47ef.zip
cpython-674befbd7be3bffee66772ff9fdef168feda47ef.tar.gz
cpython-674befbd7be3bffee66772ff9fdef168feda47ef.tar.bz2
GH-129386: Add `test.support.reset_code` (GH-129486)
Diffstat (limited to 'Lib/test/test_capi/test_opt.py')
-rw-r--r--Lib/test/test_capi/test_opt.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/Lib/test/test_capi/test_opt.py b/Lib/test/test_capi/test_opt.py
index d3aea37..02e534c 100644
--- a/Lib/test/test_capi/test_opt.py
+++ b/Lib/test/test_capi/test_opt.py
@@ -9,7 +9,8 @@ import os
import _opcode
from test.support import (script_helper, requires_specialization,
- import_helper, Py_GIL_DISABLED, requires_jit_enabled)
+ import_helper, Py_GIL_DISABLED, requires_jit_enabled,
+ reset_code)
_testinternalcapi = import_helper.import_module("_testinternalcapi")
@@ -19,11 +20,11 @@ from _testinternalcapi import TIER2_THRESHOLD
@contextlib.contextmanager
def clear_executors(func):
# Clear executors in func before and after running a block
- func.__code__ = func.__code__.replace()
+ reset_code(func)
try:
yield
finally:
- func.__code__ = func.__code__.replace()
+ reset_code(func)
def get_first_executor(func):