summaryrefslogtreecommitdiffstats
path: root/Python
diff options
context:
space:
mode:
authorAntoine Pitrou <solipsis@pitrou.net>2012-01-18 19:16:09 (GMT)
committerAntoine Pitrou <solipsis@pitrou.net>2012-01-18 19:16:09 (GMT)
commit6c40eb7f421804eba3c24a9336c4a9e59dba636c (patch)
tree7b5220e29f6c927c8834728d890f47227e79f409 /Python
parent0c60381749cfb9af804cf3f961a110797ee192d9 (diff)
downloadcpython-6c40eb7f421804eba3c24a9336c4a9e59dba636c.zip
cpython-6c40eb7f421804eba3c24a9336c4a9e59dba636c.tar.gz
cpython-6c40eb7f421804eba3c24a9336c4a9e59dba636c.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 e721498..ee3f9b0 100644
--- a/Python/import.c
+++ b/Python/import.c
@@ -2169,6 +2169,7 @@ init_builtin(char *name)
for (p = PyImport_Inittab; p->name != NULL; p++) {
PyObject *mod;
+ PyModuleDef *def;
if (strcmp(name, p->name) == 0) {
if (p->initfunc == NULL) {
PyErr_Format(PyExc_ImportError,
@@ -2181,6 +2182,9 @@ init_builtin(char *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_FixupBuiltin(mod, name) < 0)
return -1;
/* FixupExtension has put the module into sys.modules,