Bug #742342: make Python stop segfaulting on infinitely-recursive reload()s. Fixed by patch #922167.
Backported from r54291.
diff --git a/Python/pythonrun.c b/Python/pythonrun.c
index 3b5307c..75241fe 100644
--- a/Python/pythonrun.c
+++ b/Python/pythonrun.c
@@ -193,6 +193,9 @@
interp->modules = PyDict_New();
if (interp->modules == NULL)
Py_FatalError("Py_Initialize: can't make modules dictionary");
+ interp->modules_reloading = PyDict_New();
+ if (interp->modules_reloading == NULL)
+ Py_FatalError("Py_Initialize: can't make modules_reloading dictionary");
#ifdef Py_USING_UNICODE
/* Init Unicode implementation; relies on the codec registry */
@@ -530,6 +533,7 @@
/* XXX The following is lax in error checking */
interp->modules = PyDict_New();
+ interp->modules_reloading = PyDict_New();
bimod = _PyImport_FindExtension("__builtin__", "__builtin__");
if (bimod != NULL) {