mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
Issue #17098: Make sure every module has __loader__ defined.
Thanks to Thomas Heller for the bug report.
This commit is contained in:
parent
89fa86b035
commit
0ecd30b4af
4 changed files with 299 additions and 289 deletions
|
@ -1703,9 +1703,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'):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue