summaryrefslogtreecommitdiffstats
path: root/Lib/importlib
diff options
context:
space:
mode:
authorBrett Cannon <brett@python.org>2013-02-01 19:07:28 (GMT)
committerBrett Cannon <brett@python.org>2013-02-01 19:07:28 (GMT)
commit611afc1b3fd0183b1d386474ef5665cee43009ed (patch)
tree17c3e3acf8a7201406467a76cf0b9b6ec052eb0b /Lib/importlib
parentd7be03aafab4b0a9ff9a3a1701220b380028862d (diff)
parent0ecd30b4af4f5bd3c9e884a608e0a256ffe8f5fa (diff)
downloadcpython-611afc1b3fd0183b1d386474ef5665cee43009ed.zip
cpython-611afc1b3fd0183b1d386474ef5665cee43009ed.tar.gz
cpython-611afc1b3fd0183b1d386474ef5665cee43009ed.tar.bz2
Issue #17098: all modules should have __loader__
Diffstat (limited to 'Lib/importlib')
-rw-r--r--Lib/importlib/_bootstrap.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/Lib/importlib/_bootstrap.py b/Lib/importlib/_bootstrap.py
index 292c4e1..8949365 100644
--- a/Lib/importlib/_bootstrap.py
+++ b/Lib/importlib/_bootstrap.py
@@ -1723,9 +1723,11 @@ def _setup(sys_module, _imp_module):
else:
BYTECODE_SUFFIXES = DEBUG_BYTECODE_SUFFIXES
- for module in (_imp, sys):
- if not hasattr(module, '__loader__'):
- module.__loader__ = BuiltinImporter
+ module_type = type(sys)
+ for module in sys.modules.values():
+ if isinstance(module, module_type):
+ if not hasattr(module, '__loader__'):
+ module.__loader__ = BuiltinImporter
self_module = sys.modules[__name__]
for builtin_name in ('_io', '_warnings', 'builtins', 'marshal'):