summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_embed.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_embed.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_embed.py')
-rw-r--r--Lib/test/test_embed.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/Lib/test/test_embed.py b/Lib/test/test_embed.py
index 7222137..cd65496 100644
--- a/Lib/test/test_embed.py
+++ b/Lib/test/test_embed.py
@@ -391,6 +391,7 @@ class EmbeddingTests(EmbeddingTestsMixin, unittest.TestCase):
import importlib._bootstrap
import opcode
import test.test_dis
+ import test.support
def is_specialized(f):
for instruction in dis.get_instructions(f, adaptive=True):
@@ -409,7 +410,7 @@ class EmbeddingTests(EmbeddingTestsMixin, unittest.TestCase):
func = importlib._bootstrap._handle_fromlist
# "copy" the code to un-specialize it:
- func.__code__ = func.__code__.replace()
+ test.support.reset_code(func)
assert not is_specialized(func), "specialized instructions found"