mirror of
https://github.com/python/cpython.git
synced 2024-11-24 18:34:43 +08:00
Merge for issue #26186
This commit is contained in:
commit
e5f4d3c246
@ -4,7 +4,6 @@ from . import _bootstrap_external
|
||||
from . import machinery
|
||||
try:
|
||||
import _frozen_importlib
|
||||
# import _frozen_importlib_external
|
||||
except ImportError as exc:
|
||||
if exc.name != '_frozen_importlib':
|
||||
raise
|
||||
|
@ -263,11 +263,6 @@ class LazyLoader(abc.Loader):
|
||||
def __check_eager_loader(loader):
|
||||
if not hasattr(loader, 'exec_module'):
|
||||
raise TypeError('loader must define exec_module()')
|
||||
elif hasattr(loader.__class__, 'create_module'):
|
||||
if abc.Loader.create_module != loader.__class__.create_module:
|
||||
# Only care if create_module() is overridden in a subclass of
|
||||
# importlib.abc.Loader.
|
||||
raise TypeError('loader cannot define create_module()')
|
||||
|
||||
@classmethod
|
||||
def factory(cls, loader):
|
||||
|
@ -54,6 +54,7 @@ class LazyLoaderTests(unittest.TestCase):
|
||||
|
||||
def test_init(self):
|
||||
with self.assertRaises(TypeError):
|
||||
# Classes that dono't define exec_module() trigger TypeError.
|
||||
util.LazyLoader(object)
|
||||
|
||||
def new_module(self, source_code=None):
|
||||
|
@ -185,6 +185,9 @@ Core and Builtins
|
||||
|
||||
Library
|
||||
-------
|
||||
|
||||
Issue #26186: Remove an invalid type check in importlib.util.LazyLoader.
|
||||
|
||||
- Issue #26367: importlib.__init__() raises ImportError like
|
||||
builtins.__import__() when ``level`` is specified but without an accompanying
|
||||
package specified.
|
||||
|
Loading…
Reference in New Issue
Block a user