Skip to content

Commit 0222238

Browse files
miss-islingtonShaharNavehStanFromIreland
authored
[3.15] Don't require _testcapi for test_code (GH-152185) (#152202)
(cherry picked from commit 11c241e) Co-authored-by: Shahar Naveh <50263213+ShaharNaveh@users.noreply.github.com> Co-authored-by: Stan Ulbrych <stan@python.org>
1 parent 06e6515 commit 0222238

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

Lib/test/test_code.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,6 @@
215215
from test.support import threading_helper, import_helper
216216
from test.support.bytecode_helper import instructions_with_positions
217217
from opcode import opmap, opname
218-
from _testcapi import code_offset_to_line
219218
try:
220219
import _testinternalcapi
221220
except ModuleNotFoundError:
@@ -1491,6 +1490,8 @@ async def async_func():
14911490
rc, out, err = assert_python_ok('-OO', '-c', code)
14921491

14931492
def test_co_branches(self):
1493+
_testcapi = import_helper.import_module("_testcapi")
1494+
code_offset_to_line = _testcapi.code_offset_to_line
14941495

14951496
def get_line_branches(func):
14961497
code = func.__code__

0 commit comments

Comments
 (0)