@@ -2386,8 +2386,10 @@ def test_single_init_extension_compat(self):
23862386
23872387 @unittest .skipIf (_testmultiphase is None , "test requires _testmultiphase module" )
23882388 def test_multi_init_extension_compat (self ):
2389+ # Module with Py_MOD_PER_INTERPRETER_GIL_SUPPORTED
23892390 module = '_testmultiphase'
23902391 require_extension (module )
2392+
23912393 if not Py_GIL_DISABLED :
23922394 with self .subTest (f'{ module } : not strict' ):
23932395 self .check_compatible_here (module , strict = False )
@@ -2398,6 +2400,8 @@ def test_multi_init_extension_compat(self):
23982400
23992401 @unittest .skipIf (_testmultiphase is None , "test requires _testmultiphase module" )
24002402 def test_multi_init_extension_non_isolated_compat (self ):
2403+ # Module with Py_MOD_MULTIPLE_INTERPRETERS_NOT_SUPPORTED
2404+ # and Py_MOD_GIL_NOT_USED
24012405 modname = '_test_non_isolated'
24022406 filename = _testmultiphase .__file__
24032407 module = import_extension_from_file (modname , filename )
@@ -2413,20 +2417,31 @@ def test_multi_init_extension_non_isolated_compat(self):
24132417
24142418 @unittest .skipIf (_testmultiphase is None , "test requires _testmultiphase module" )
24152419 def test_multi_init_extension_per_interpreter_gil_compat (self ):
2416- modname = '_test_shared_gil_only'
2417- filename = _testmultiphase .__file__
2418- module = import_extension_from_file (modname , filename )
24192420
2420- require_extension (module )
2421- with self .subTest (f'{ modname } : isolated, strict' ):
2422- self .check_incompatible_here (modname , filename , isolated = True )
2423- with self .subTest (f'{ modname } : not isolated, strict' ):
2424- self .check_compatible_here (modname , filename ,
2425- strict = True , isolated = False )
2426- if not Py_GIL_DISABLED :
2427- with self .subTest (f'{ modname } : not isolated, not strict' ):
2428- self .check_compatible_here (modname , filename ,
2429- strict = False , isolated = False )
2421+ # _test_shared_gil_only:
2422+ # Explicit Py_MOD_MULTIPLE_INTERPRETERS_SUPPORTED (default)
2423+ # and Py_MOD_GIL_NOT_USED
2424+ # _test_no_multiple_interpreter_slot:
2425+ # No Py_mod_multiple_interpreters slot
2426+ # and Py_MOD_GIL_NOT_USED
2427+ for modname in ('_test_shared_gil_only' ,
2428+ '_test_no_multiple_interpreter_slot' ):
2429+ with self .subTest (modname = modname ):
2430+
2431+ filename = _testmultiphase .__file__
2432+ module = import_extension_from_file (modname , filename )
2433+
2434+ require_extension (module )
2435+ with self .subTest (f'{ modname } : isolated, strict' ):
2436+ self .check_incompatible_here (modname , filename ,
2437+ isolated = True )
2438+ with self .subTest (f'{ modname } : not isolated, strict' ):
2439+ self .check_compatible_here (modname , filename ,
2440+ strict = True , isolated = False )
2441+ if not Py_GIL_DISABLED :
2442+ with self .subTest (f'{ modname } : not isolated, not strict' ):
2443+ self .check_compatible_here (
2444+ modname , filename , strict = False , isolated = False )
24302445
24312446 @unittest .skipIf (_testinternalcapi is None , "requires _testinternalcapi" )
24322447 def test_python_compat (self ):
0 commit comments