@@ -653,7 +653,7 @@ def test_magic_number(self):
653653
654654
655655@unittest .skipIf (_interpreters is None , 'subinterpreters required' )
656- class AllowingAllExtensionsTests (unittest .TestCase ):
656+ class IncompatibleExtensionModuleRestrictionsTests (unittest .TestCase ):
657657
658658 ERROR = re .compile ("^<class 'ImportError'>: module (.*) does not support loading in subinterpreters" )
659659
@@ -678,8 +678,8 @@ def run_with_shared_gil(self, script):
678678 @unittest .skipIf (_testsinglephase is None , "test requires _testsinglephase module" )
679679 def test_single_phase_init_module (self ):
680680 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 ):
683683 import _testsinglephase
684684 ''' )
685685 with self .subTest ('check disabled, shared GIL' ):
@@ -688,8 +688,8 @@ def test_single_phase_init_module(self):
688688 self .run_with_own_gil (script )
689689
690690 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):
693693 import _testsinglephase
694694 ''' )
695695 with self .subTest ('check enabled, shared GIL' ):
@@ -713,8 +713,8 @@ def test_incomplete_multi_phase_init_module(self):
713713 ''' )
714714
715715 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 ):
718718 module = module_from_spec(spec)
719719 loader.exec_module(module)
720720 ''' )
@@ -724,8 +724,8 @@ def test_incomplete_multi_phase_init_module(self):
724724 self .run_with_own_gil (script )
725725
726726 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):
729729 module = module_from_spec(spec)
730730 loader.exec_module(module)
731731 ''' )
@@ -738,8 +738,8 @@ def test_incomplete_multi_phase_init_module(self):
738738 @unittest .skipIf (_testmultiphase is None , "test requires _testmultiphase module" )
739739 def test_complete_multi_phase_init_module (self ):
740740 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 ):
743743 import _testmultiphase
744744 ''' )
745745 with self .subTest ('check disabled, shared GIL' ):
@@ -748,8 +748,8 @@ def test_complete_multi_phase_init_module(self):
748748 self .run_with_own_gil (script )
749749
750750 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):
753753 import _testmultiphase
754754 ''' )
755755 with self .subTest ('check enabled, shared GIL' ):
0 commit comments