summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Python/import.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/Python/import.c b/Python/import.c
index 77a5605..e6ea3dd 100644
--- a/Python/import.c
+++ b/Python/import.c
@@ -594,6 +594,8 @@ PyImport_ExecCodeModuleEx(char *name, PyObject *co, char *pathname)
m = PyImport_AddModule(name);
if (m == NULL)
return NULL;
+ /* If the module is being reloaded, we get the old module back
+ and re-use its dict to exec the new code. */
d = PyModule_GetDict(m);
if (PyDict_GetItemString(d, "__builtins__") == NULL) {
if (PyDict_SetItemString(d, "__builtins__",