gh-109721: Guard `_testinternalcapi` imports in tests (GH-109722) · python/cpython@8ded34a · GitHub
Skip to content

Commit 8ded34a

Browse files
authored
gh-109721: Guard _testinternalcapi imports in tests (GH-109722)
1 parent 8a82bff commit 8ded34a

3 files changed

Lines changed: 11 additions & 3 deletions

File tree

Lib/test/test_cmd_line.py

Lines changed: 1 addition & 0 deletions

Lib/test/test_import/__init__.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
import types
2323
import unittest
2424
from unittest import mock
25-
import _testinternalcapi
2625
import _imp
2726

2827
from test.support import os_helper
@@ -50,6 +49,10 @@
5049
import _xxsubinterpreters as _interpreters
5150
except ModuleNotFoundError:
5251
_interpreters = None
52+
try:
53+
import _testinternalcapi
54+
except ImportError:
55+
_testinternalcapi = None
5356

5457

5558
skip_if_dont_write_bytecode = unittest.skipIf(

Lib/test/test_opcache.py

Lines changed: 6 additions & 2 deletions

0 commit comments

Comments
 (0)