summaryrefslogtreecommitdiffstats
path: root/Python/import.c
diff options
context:
space:
mode:
authorEric Snow <ericsnowcurrently@gmail.com>2016-09-08 02:08:02 (GMT)
committerEric Snow <ericsnowcurrently@gmail.com>2016-09-08 02:08:02 (GMT)
commitbf00bc783fd87544c1717b2db163736cea6412aa (patch)
tree293b139cca275b02148ef35ffa7fe2bd0e2a2489 /Python/import.c
parent280bc223b4b5df841da20faafd1b63cde2694acd (diff)
downloadcpython-bf00bc783fd87544c1717b2db163736cea6412aa.zip
cpython-bf00bc783fd87544c1717b2db163736cea6412aa.tar.gz
cpython-bf00bc783fd87544c1717b2db163736cea6412aa.tar.bz2
Issue #15578: Correctly incref the parent module while importing.
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;