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.
diff --git a/Python/pythonrun.c b/Python/pythonrun.c
index b64a9bf..44a85bb 100644
--- a/Python/pythonrun.c
+++ b/Python/pythonrun.c
@@ -225,8 +225,8 @@
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);