summaryrefslogtreecommitdiffstats
path: root/Python
diff options
context:
space:
mode:
authorAntoine Pitrou <solipsis@pitrou.net>2012-01-18 19:17:58 (GMT)
committerAntoine Pitrou <solipsis@pitrou.net>2012-01-18 19:17:58 (GMT)
commit165e01f83f64061fc66440e2e13b095d4ce9c755 (patch)
tree4d892da5751bb3ba0ce70bc15cead6ad61821011 /Python
parentaf5facc4cace578700ae2b74524c62e8790d4763 (diff)
parent6c40eb7f421804eba3c24a9336c4a9e59dba636c (diff)
downloadcpython-165e01f83f64061fc66440e2e13b095d4ce9c755.zip
cpython-165e01f83f64061fc66440e2e13b095d4ce9c755.tar.gz
cpython-165e01f83f64061fc66440e2e13b095d4ce9c755.tar.bz2
Fix the builtin module initialization code to store the init function for future reinitialization.
Diffstat (limited to 'Python')
-rw-r--r--Python/import.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/Python/import.c b/Python/import.c
index 4efc369..76f40d3 100644
--- a/Python/import.c
+++ b/Python/import.c
@@ -2542,6 +2542,7 @@ init_builtin(PyObject *name)
for (p = PyImport_Inittab; p->name != NULL; p++) {
PyObject *mod;
+ PyModuleDef *def;
if (PyUnicode_CompareWithASCIIString(name, p->name) == 0) {
if (p->initfunc == NULL) {
PyErr_Format(PyExc_ImportError,
@@ -2554,6 +2555,9 @@ init_builtin(PyObject *name)
mod = (*p->initfunc)();
if (mod == 0)
return -1;
+ /* Remember pointer to module init function. */
+ def = PyModule_GetDef(mod);
+ def->m_base.m_init = p->initfunc;
if (_PyImport_FixupExtensionObject(mod, name, name) < 0)
return -1;
/* FixupExtension has put the module into sys.modules,