Mercurial > cpython-lru_cache-weakref
diff Python/import.c @ 74504:f0cbceef47c3 3.2
Fix the builtin module initialization code to store the init function for future reinitialization.
| author | Antoine Pitrou <solipsis@pitrou.net> |
|---|---|
| date | Wed, 18 Jan 2012 20:16:09 +0100 |
| parents | 425591f6c2a5 |
| children | a2f3d6986bfa 3fee4f07aeab |
line wrap: on
line diff
--- a/Python/import.c Wed Jan 18 17:40:18 2012 +0100 +++ b/Python/import.c Wed Jan 18 20:16:09 2012 +0100 @@ -2169,6 +2169,7 @@ 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 @@ 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,
