@@ -1900,6 +1900,7 @@ def test_single_init_extension_compat(self):
1900
1900
1901
1901
@unittest .skipIf (_testmultiphase is None , "test requires _testmultiphase module" )
1902
1902
def test_multi_init_extension_compat (self ):
1903
+ # Module with Py_MOD_PER_INTERPRETER_GIL_SUPPORTED
1903
1904
module = '_testmultiphase'
1904
1905
require_extension (module )
1905
1906
with self .subTest (f'{ module } : not strict' ):
@@ -1911,6 +1912,8 @@ def test_multi_init_extension_compat(self):
1911
1912
1912
1913
@unittest .skipIf (_testmultiphase is None , "test requires _testmultiphase module" )
1913
1914
def test_multi_init_extension_non_isolated_compat (self ):
1915
+ # Module with Py_MOD_MULTIPLE_INTERPRETERS_NOT_SUPPORTED
1916
+ # and Py_MOD_GIL_NOT_USED
1914
1917
modname = '_test_non_isolated'
1915
1918
filename = _testmultiphase .__file__
1916
1919
loader = ExtensionFileLoader (modname , filename )
@@ -1929,23 +1932,33 @@ def test_multi_init_extension_non_isolated_compat(self):
1929
1932
1930
1933
@unittest .skipIf (_testmultiphase is None , "test requires _testmultiphase module" )
1931
1934
def test_multi_init_extension_per_interpreter_gil_compat (self ):
1932
- modname = '_test_shared_gil_only'
1933
- filename = _testmultiphase .__file__
1934
- loader = ExtensionFileLoader (modname , filename )
1935
- spec = importlib .util .spec_from_loader (modname , loader )
1936
- module = importlib .util .module_from_spec (spec )
1937
- loader .exec_module (module )
1938
- sys .modules [modname ] = module
1939
-
1940
- require_extension (module )
1941
- with self .subTest (f'{ modname } : isolated, strict' ):
1942
- self .check_incompatible_here (modname , filename , isolated = True )
1943
- with self .subTest (f'{ modname } : not isolated, strict' ):
1944
- self .check_compatible_here (modname , filename ,
1945
- strict = True , isolated = False )
1946
- with self .subTest (f'{ modname } : not isolated, not strict' ):
1947
- self .check_compatible_here (modname , filename ,
1948
- strict = False , isolated = False )
1935
+ # _test_shared_gil_only:
1936
+ # Explicit Py_MOD_MULTIPLE_INTERPRETERS_SUPPORTED (default)
1937
+ # and Py_MOD_GIL_NOT_USED
1938
+ # _test_no_multiple_interpreter_slot:
1939
+ # No Py_mod_multiple_interpreters slot
1940
+ # and Py_MOD_GIL_NOT_USED
1941
+ for modname in ('_test_shared_gil_only' ,
1942
+ '_test_no_multiple_interpreter_slot' ):
1943
+ with self .subTest (modname = modname ):
1944
+
1945
+ filename = _testmultiphase .__file__
1946
+ loader = ExtensionFileLoader (modname , filename )
1947
+ spec = importlib .util .spec_from_loader (modname , loader )
1948
+ module = importlib .util .module_from_spec (spec )
1949
+ loader .exec_module (module )
1950
+ sys .modules [modname ] = module
1951
+
1952
+ require_extension (module )
1953
+ with self .subTest (f'{ modname } : isolated, strict' ):
1954
+ self .check_incompatible_here (modname , filename ,
1955
+ isolated = True )
1956
+ with self .subTest (f'{ modname } : not isolated, strict' ):
1957
+ self .check_compatible_here (modname , filename ,
1958
+ strict = True , isolated = False )
1959
+ with self .subTest (f'{ modname } : not isolated, not strict' ):
1960
+ self .check_compatible_here (
1961
+ modname , filename , strict = False , isolated = False )
1949
1962
1950
1963
def test_python_compat (self ):
1951
1964
module = 'threading'
0 commit comments