summaryrefslogtreecommitdiffstats
path: root/Python/pylifecycle.c
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2015-09-18 07:11:57 (GMT)
committerVictor Stinner <victor.stinner@gmail.com>2015-09-18 07:11:57 (GMT)
commitcd6e69439c908a7d3aa0a5b13570c83d7cc57bf7 (patch)
tree5b9a57698d4240dfcdd1cae35befe5c1204277b1 /Python/pylifecycle.c
parentd8f5fb4611cf08e3d882854db7797a9058703985 (diff)
downloadcpython-cd6e69439c908a7d3aa0a5b13570c83d7cc57bf7.zip
cpython-cd6e69439c908a7d3aa0a5b13570c83d7cc57bf7.tar.gz
cpython-cd6e69439c908a7d3aa0a5b13570c83d7cc57bf7.tar.bz2
Issue #25160: Fix import_init() comments and messages
import_init() imports the "_imp" module, not the "imp" module.
Diffstat (limited to 'Python/pylifecycle.c')
-rw-r--r--Python/pylifecycle.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/Python/pylifecycle.c b/Python/pylifecycle.c
index df66fa0..4f5efc9 100644
--- a/Python/pylifecycle.c
+++ b/Python/pylifecycle.c
@@ -252,13 +252,13 @@ import_init(PyInterpreterState *interp, PyObject *sysmod)
interp->importlib = importlib;
Py_INCREF(interp->importlib);
- /* Install _importlib as __import__ */
+ /* Import the _imp module */
impmod = PyInit_imp();
if (impmod == NULL) {
- Py_FatalError("Py_Initialize: can't import imp");
+ Py_FatalError("Py_Initialize: can't import _imp");
}
else if (Py_VerboseFlag) {
- PySys_FormatStderr("import imp # builtin\n");
+ PySys_FormatStderr("import _imp # builtin\n");
}
sys_modules = PyImport_GetModuleDict();
if (Py_VerboseFlag) {
@@ -268,6 +268,7 @@ import_init(PyInterpreterState *interp, PyObject *sysmod)
Py_FatalError("Py_Initialize: can't save _imp to sys.modules");
}
+ /* Install importlib as the implementation of import */
value = PyObject_CallMethod(importlib, "_install", "OO", sysmod, impmod);
if (value == NULL) {
PyErr_Print();