Issue #13959: Rename imp to _imp and add Lib/imp.py and begin

rewriting functionality in pure Python.

To start, imp.new_module() has been rewritten in pure Python, put into
importlib (privately) and then publicly exposed in imp.
This commit is contained in:
Brett Cannon 2012-04-15 16:08:47 -04:00
parent 7788838473
commit 6f44d66bc4
10 changed files with 2850 additions and 2814 deletions

View file

@ -225,8 +225,8 @@ import_init(PyInterpreterState *interp, PyObject *sysmod)
if (Py_VerboseFlag) {
PySys_FormatStderr("import sys # builtin\n");
}
if (PyDict_SetItemString(sys_modules, "imp", impmod) < 0) {
Py_FatalError("Py_Initialize: can't save imp to sys.modules");
if (PyDict_SetItemString(sys_modules, "_imp", impmod) < 0) {
Py_FatalError("Py_Initialize: can't save _imp to sys.modules");
}
value = PyObject_CallMethod(importlib, "_setup", "OO", sysmod, impmod);