@@ -653,7 +653,7 @@ def test_magic_number(self):
653
653
654
654
655
655
@unittest .skipIf (_interpreters is None , 'subinterpreters required' )
656
- class AllowingAllExtensionsTests (unittest .TestCase ):
656
+ class IncompatibleExtensionModuleRestrictionsTests (unittest .TestCase ):
657
657
658
658
ERROR = re .compile ("^<class 'ImportError'>: module (.*) does not support loading in subinterpreters" )
659
659
@@ -678,8 +678,8 @@ def run_with_shared_gil(self, script):
678
678
@unittest .skipIf (_testsinglephase is None , "test requires _testsinglephase module" )
679
679
def test_single_phase_init_module (self ):
680
680
script = textwrap .dedent ('''
681
- import importlib.util
682
- with importlib.util.allowing_all_extensions( ):
681
+ from importlib.util import _incompatible_extension_module_restrictions
682
+ with _incompatible_extension_module_restrictions(disable_check=True ):
683
683
import _testsinglephase
684
684
''' )
685
685
with self .subTest ('check disabled, shared GIL' ):
@@ -688,8 +688,8 @@ def test_single_phase_init_module(self):
688
688
self .run_with_own_gil (script )
689
689
690
690
script = textwrap .dedent (f'''
691
- import importlib.util
692
- with importlib.util.allowing_all_extensions( False):
691
+ from importlib.util import _incompatible_extension_module_restrictions
692
+ with _incompatible_extension_module_restrictions(disable_check= False):
693
693
import _testsinglephase
694
694
''' )
695
695
with self .subTest ('check enabled, shared GIL' ):
@@ -713,8 +713,8 @@ def test_incomplete_multi_phase_init_module(self):
713
713
''' )
714
714
715
715
script = prescript + textwrap .dedent ('''
716
- import importlib.util
717
- with importlib.util.allowing_all_extensions( ):
716
+ from importlib.util import _incompatible_extension_module_restrictions
717
+ with _incompatible_extension_module_restrictions(disable_check=True ):
718
718
module = module_from_spec(spec)
719
719
loader.exec_module(module)
720
720
''' )
@@ -724,8 +724,8 @@ def test_incomplete_multi_phase_init_module(self):
724
724
self .run_with_own_gil (script )
725
725
726
726
script = prescript + textwrap .dedent ('''
727
- import importlib.util
728
- with importlib.util.allowing_all_extensions( False):
727
+ from importlib.util import _incompatible_extension_module_restrictions
728
+ with _incompatible_extension_module_restrictions(disable_check= False):
729
729
module = module_from_spec(spec)
730
730
loader.exec_module(module)
731
731
''' )
@@ -738,8 +738,8 @@ def test_incomplete_multi_phase_init_module(self):
738
738
@unittest .skipIf (_testmultiphase is None , "test requires _testmultiphase module" )
739
739
def test_complete_multi_phase_init_module (self ):
740
740
script = textwrap .dedent ('''
741
- import importlib.util
742
- with importlib.util.allowing_all_extensions( ):
741
+ from importlib.util import _incompatible_extension_module_restrictions
742
+ with _incompatible_extension_module_restrictions(disable_check=True ):
743
743
import _testmultiphase
744
744
''' )
745
745
with self .subTest ('check disabled, shared GIL' ):
@@ -748,8 +748,8 @@ def test_complete_multi_phase_init_module(self):
748
748
self .run_with_own_gil (script )
749
749
750
750
script = textwrap .dedent (f'''
751
- import importlib.util
752
- with importlib.util.allowing_all_extensions( False):
751
+ from importlib.util import _incompatible_extension_module_restrictions
752
+ with _incompatible_extension_module_restrictions(disable_check= False):
753
753
import _testmultiphase
754
754
''' )
755
755
with self .subTest ('check enabled, shared GIL' ):
0 commit comments