[Python-checkins] cpython (merge 3.3 -> default): Issue #17098: all modules should have __loader__
brett.cannon
python-checkins at python.org
Fri Feb 1 20:07:45 CET 2013
http://hg.python.org/cpython/rev/1f1a1b3cc416
changeset: 81870:1f1a1b3cc416
parent: 81868:905b4e3cf6d0
parent: 81869:05747d3bcd9c
user: Brett Cannon <brett at python.org>
date: Fri Feb 01 14:07:28 2013 -0500
summary:
Issue #17098: all modules should have __loader__
files:
Lib/importlib/_bootstrap.py | 8 +++++---
Misc/NEWS | 3 +++
Modules/signalmodule.c | 3 +--
3 files changed, 9 insertions(+), 5 deletions(-)
diff --git a/Lib/importlib/_bootstrap.py b/Lib/importlib/_bootstrap.py
--- a/Lib/importlib/_bootstrap.py
+++ b/Lib/importlib/_bootstrap.py
@@ -1723,9 +1723,11 @@
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'):
diff --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -10,6 +10,9 @@
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
diff --git a/Modules/signalmodule.c b/Modules/signalmodule.c
--- a/Modules/signalmodule.c
+++ b/Modules/signalmodule.c
@@ -1362,9 +1362,8 @@
void
PyOS_InitInterrupts(void)
{
- PyObject *m = PyInit_signal();
+ PyObject *m = PyImport_ImportModule("signal");
if (m) {
- _PyImport_FixupBuiltin(m, "signal");
Py_DECREF(m);
}
}
--
Repository URL: http://hg.python.org/cpython
More information about the Python-checkins
mailing list