diff options
author | Eric Snow <ericsnowcurrently@gmail.com> | 2023-05-06 21:57:35 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-05-06 21:57:35 (GMT) |
commit | fff193bbfebe7b00229856b1e8105ab3de36437f (patch) | |
tree | 1deea51990bee00db4ddc40b868cbd7bcf098c64 /Lib | |
parent | 3b14b51d11ae23a915299a8f9bf650ca2ae90566 (diff) | |
download | cpython-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')
-rw-r--r-- | Lib/test/test_import/__init__.py | 20 | ||||
-rw-r--r-- | Lib/test/test_importlib/extension/test_loader.py | 2 |
2 files changed, 22 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) diff --git a/Lib/test/test_importlib/extension/test_loader.py b/Lib/test/test_importlib/extension/test_loader.py index 3bf2bbd..3a74b82 100644 --- a/Lib/test/test_importlib/extension/test_loader.py +++ b/Lib/test/test_importlib/extension/test_loader.py @@ -348,6 +348,8 @@ class MultiPhaseExtensionModuleTests(abc.LoaderTests): 'exec_err', 'exec_raise', 'exec_unreported_exception', + 'multiple_create_slots', + 'multiple_multiple_interpreters_slots', ]: with self.subTest(name_base): name = self.name + '_' + name_base |