@@ -2404,8 +2404,10 @@ def test_single_init_extension_compat(self):
2404
2404
2405
2405
@unittest .skipIf (_testmultiphase is None , "test requires _testmultiphase module" )
2406
2406
def test_multi_init_extension_compat (self ):
2407
+ # Module with Py_MOD_PER_INTERPRETER_GIL_SUPPORTED
2407
2408
module = '_testmultiphase'
2408
2409
require_extension (module )
2410
+
2409
2411
if not Py_GIL_DISABLED :
2410
2412
with self .subTest (f'{ module } : not strict' ):
2411
2413
self .check_compatible_here (module , strict = False )
@@ -2416,6 +2418,8 @@ def test_multi_init_extension_compat(self):
2416
2418
2417
2419
@unittest .skipIf (_testmultiphase is None , "test requires _testmultiphase module" )
2418
2420
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
2419
2423
modname = '_test_non_isolated'
2420
2424
filename = _testmultiphase .__file__
2421
2425
module = import_extension_from_file (modname , filename )
@@ -2431,20 +2435,31 @@ def test_multi_init_extension_non_isolated_compat(self):
2431
2435
2432
2436
@unittest .skipIf (_testmultiphase is None , "test requires _testmultiphase module" )
2433
2437
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 )
2437
2438
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 )
2448
2463
2449
2464
@unittest .skipIf (_testinternalcapi is None , "requires _testinternalcapi" )
2450
2465
def test_python_compat (self ):
0 commit comments