Commit 0ecd30b4 authored by Brett Cannon's avatar Brett Cannon

Issue #17098: Make sure every module has __loader__ defined.

Thanks to Thomas Heller for the bug report.
parent 89fa86b0
......@@ -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'):
......
......@@ -12,6 +12,9 @@ What's New in Python 3.3.1?
Core and Builtins
-----------------
- Issue #17098: All modules now have __loader__ set even if they pre-exist the
bootstrapping of importlib.
- Issue #16979: Fix error handling bugs in the unicode-escape-decode decoder.
- Issue #13886: Fix input() to not strip out input bytes that cannot be decoded
......
......@@ -1367,9 +1367,8 @@ PyErr_SetInterrupt(void)
void
PyOS_InitInterrupts(void)
{
PyObject *m = PyInit_signal();
PyObject *m = PyImport_ImportModule("signal");
if (m) {
_PyImport_FixupBuiltin(m, "signal");
Py_DECREF(m);
}
}
......
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment