@@ -2404,8 +2404,10 @@ def test_single_init_extension_compat(self):
24042404
24052405 @unittest .skipIf (_testmultiphase is None , "test requires _testmultiphase module" )
24062406 def test_multi_init_extension_compat (self ):
2407+ # Module with Py_MOD_PER_INTERPRETER_GIL_SUPPORTED
24072408 module = '_testmultiphase'
24082409 require_extension (module )
2410+
24092411 if not Py_GIL_DISABLED :
24102412 with self .subTest (f'{ module } : not strict' ):
24112413 self .check_compatible_here (module , strict = False )
@@ -2416,6 +2418,8 @@ def test_multi_init_extension_compat(self):
24162418
24172419 @unittest .skipIf (_testmultiphase is None , "test requires _testmultiphase module" )
24182420 def test_multi_init_extension_non_isolated_compat (self ):
2421+ # Module with Py_MOD_MULTIPLE_INTERPRETERS_NOT_SUPPORTED
2422+ # and Py_MOD_GIL_NOT_USED
24192423 modname = '_test_non_isolated'
24202424 filename = _testmultiphase .__file__
24212425 module = import_extension_from_file (modname , filename )
@@ -2431,20 +2435,31 @@ def test_multi_init_extension_non_isolated_compat(self):
24312435
24322436 @unittest .skipIf (_testmultiphase is None , "test requires _testmultiphase module" )
24332437 def test_multi_init_extension_per_interpreter_gil_compat (self ):
2434- modname = '_test_shared_gil_only'
2435- filename = _testmultiphase .__file__
2436- module = import_extension_from_file (modname , filename )
24372438
2438- require_extension (module )
2439- with self .subTest (f'{ modname } : isolated, strict' ):
2440- self .check_incompatible_here (modname , filename , isolated = True )
2441- with self .subTest (f'{ modname } : not isolated, strict' ):
2442- self .check_compatible_here (modname , filename ,
2443- strict = True , isolated = False )
2444- if not Py_GIL_DISABLED :
2445- with self .subTest (f'{ modname } : not isolated, not strict' ):
2446- self .check_compatible_here (modname , filename ,
2447- strict = False , isolated = False )
2439+ # _test_shared_gil_only:
2440+ # Explicit Py_MOD_MULTIPLE_INTERPRETERS_SUPPORTED (default)
2441+ # and Py_MOD_GIL_NOT_USED
2442+ # _test_no_multiple_interpreter_slot:
2443+ # No Py_mod_multiple_interpreters slot
2444+ # and Py_MOD_GIL_NOT_USED
2445+ for modname in ('_test_shared_gil_only' ,
2446+ '_test_no_multiple_interpreter_slot' ):
2447+ with self .subTest (modname = modname ):
2448+
2449+ filename = _testmultiphase .__file__
2450+ module = import_extension_from_file (modname , filename )
2451+
2452+ require_extension (module )
2453+ with self .subTest (f'{ modname } : isolated, strict' ):
2454+ self .check_incompatible_here (modname , filename ,
2455+ isolated = True )
2456+ with self .subTest (f'{ modname } : not isolated, strict' ):
2457+ self .check_compatible_here (modname , filename ,
2458+ strict = True , isolated = False )
2459+ if not Py_GIL_DISABLED :
2460+ with self .subTest (f'{ modname } : not isolated, not strict' ):
2461+ self .check_compatible_here (
2462+ modname , filename , strict = False , isolated = False )
24482463
24492464 @unittest .skipIf (_testinternalcapi is None , "requires _testinternalcapi" )
24502465 def test_python_compat (self ):
0 commit comments