summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_import
diff options
context:
space:
mode:
authorEric Snow <ericsnowcurrently@gmail.com>2023-05-06 21:57:35 (GMT)
committerGitHub <noreply@github.com>2023-05-06 21:57:35 (GMT)
commitfff193bbfebe7b00229856b1e8105ab3de36437f (patch)
tree1deea51990bee00db4ddc40b868cbd7bcf098c64 /Lib/test/test_import
parent3b14b51d11ae23a915299a8f9bf650ca2ae90566 (diff)
downloadcpython-fff193bbfebe7b00229856b1e8105ab3de36437f.zip
cpython-fff193bbfebe7b00229856b1e8105ab3de36437f.tar.gz
cpython-fff193bbfebe7b00229856b1e8105ab3de36437f.tar.bz2
gh-99113: Add a check for Py_MOD_PER_INTERPRETER_GIL_SUPPORTED (gh-104206)
Py_MOD_PER_INTERPRETER_GIL_SUPPORTED is a new supported value for Py_mod_multiple_interpreters, added in gh-104205.
Diffstat (limited to 'Lib/test/test_import')
-rw-r--r--Lib/test/test_import/__init__.py20
1 files changed, 20 insertions, 0 deletions
diff --git a/Lib/test/test_import/__init__.py b/Lib/test/test_import/__init__.py
index 773b709..e2384a0 100644
--- a/Lib/test/test_import/__init__.py
+++ b/Lib/test/test_import/__init__.py
@@ -1861,6 +1861,26 @@ class SubinterpImportTests(unittest.TestCase):
with self.subTest(f'{modname}: not strict'):
self.check_compatible_here(modname, filename, strict=False)
+ @unittest.skipIf(_testmultiphase is None, "test requires _testmultiphase module")
+ def test_multi_init_extension_per_interpreter_gil_compat(self):
+ modname = '_test_shared_gil_only'
+ filename = _testmultiphase.__file__
+ loader = ExtensionFileLoader(modname, filename)
+ spec = importlib.util.spec_from_loader(modname, loader)
+ module = importlib.util.module_from_spec(spec)
+ loader.exec_module(module)
+ sys.modules[modname] = module
+
+ require_extension(module)
+ with self.subTest(f'{modname}: isolated, strict'):
+ self.check_incompatible_here(modname, filename, isolated=True)
+ with self.subTest(f'{modname}: not isolated, strict'):
+ self.check_compatible_here(modname, filename,
+ strict=True, isolated=False)
+ with self.subTest(f'{modname}: not isolated, not strict'):
+ self.check_compatible_here(modname, filename,
+ strict=False, isolated=False)
+
def test_python_compat(self):
module = 'threading'
require_pure_python(module)