summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_importlib
diff options
context:
space:
mode:
authorBrett Cannon <brett@python.org>2016-06-25 17:58:17 (GMT)
committerBrett Cannon <brett@python.org>2016-06-25 17:58:17 (GMT)
commit696c35e86bffea1f2bc6179a29e46416899e3de6 (patch)
tree774b8cec3342b4ca9a2c6d9c193f59b17299f615 /Lib/test/test_importlib
parentda037616b10fc12a213e67711065f8123fb98cef (diff)
downloadcpython-696c35e86bffea1f2bc6179a29e46416899e3de6.zip
cpython-696c35e86bffea1f2bc6179a29e46416899e3de6.tar.gz
cpython-696c35e86bffea1f2bc6179a29e46416899e3de6.tar.bz2
Issue #26186: Remove the restriction that built-in and extension
modules can't be lazily loaded. Thanks to Python 3.6 allowing for types.ModuleType to have its __class__ mutated, the restriction can be lifted by calling create_module() on the wrapped loader.
Diffstat (limited to 'Lib/test/test_importlib')
-rw-r--r--Lib/test/test_importlib/test_lazy.py2
1 files changed, 2 insertions, 0 deletions
diff --git a/Lib/test/test_importlib/test_lazy.py b/Lib/test/test_importlib/test_lazy.py
index cc383c2..ffd8dc6 100644
--- a/Lib/test/test_importlib/test_lazy.py
+++ b/Lib/test/test_importlib/test_lazy.py
@@ -66,6 +66,8 @@ class LazyLoaderTests(unittest.TestCase):
spec = util.spec_from_loader(TestingImporter.module_name,
util.LazyLoader(loader))
module = spec.loader.create_module(spec)
+ if module is None:
+ module = types.ModuleType(TestingImporter.module_name)
module.__spec__ = spec
module.__loader__ = spec.loader
spec.loader.exec_module(module)