Skip to content

Commit 1840f77

Browse files
ShaharNavehStanFromIreland
authored andcommitted
Don't require _testcapi for test_code (GH-152185)
(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 be65a38 commit 1840f77

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:
@@ -1485,6 +1484,8 @@ async def async_func():
14851484
rc, out, err = assert_python_ok('-OO', '-c', code)
14861485

14871486
def test_co_branches(self):
1487+
_testcapi = import_helper.import_module("_testcapi")
1488+
code_offset_to_line = _testcapi.code_offset_to_line
14881489

14891490
def get_line_branches(func):
14901491
code = func.__code__

0 commit comments

Comments
 (0)