summaryrefslogtreecommitdiffstats
path: root/Python/import.c
diff options
context:
space:
mode:
Diffstat (limited to 'Python/import.c')
-rw-r--r--Python/import.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/Python/import.c b/Python/import.c
index 96f7d47..af47b0b 100644
--- a/Python/import.c
+++ b/Python/import.c
@@ -2243,8 +2243,10 @@ import_module_level(char *name, PyObject *globals, PyObject *locals,
if (parent == NULL)
goto error_exit;
+ Py_INCREF(parent);
head = load_next(parent, level < 0 ? Py_None : parent, &name, buf,
&buflen);
+ Py_DECREF(parent);
if (head == NULL)
goto error_exit;