mirror of https://github.com/python/cpython
Merge 3.5 (imp/_imp)
This commit is contained in:
commit
3e30fd7c59
|
@ -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();
|
||||
|
|
Loading…
Reference in New Issue