Skip to content

Commit 47c2acd

Browse files
committed
Fix code_offset_to_line handling
1 parent 2b06a0b commit 47c2acd

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

Lib/test/test_code.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,10 @@
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
218+
try:
219+
from _testcapi import code_offset_to_line
220+
except ModuleNotFoundError:
221+
code_offset_to_line = None
219222
try:
220223
import _testinternalcapi
221224
except ModuleNotFoundError:
@@ -1490,6 +1493,7 @@ async def async_func():
14901493

14911494
rc, out, err = assert_python_ok('-OO', '-c', code)
14921495

1496+
@unittest.skipUnless(code_offset_to_line, '_testcapi required')
14931497
def test_co_branches(self):
14941498

14951499
def get_line_branches(func):

0 commit comments

Comments
 (0)