summaryrefslogtreecommitdiffstats
path: root/Python
diff options
context:
space:
mode:
authorStéphane Wirtel <stephane@wirtel.be>2017-06-08 11:13:20 (GMT)
committerVictor Stinner <victor.stinner@gmail.com>2017-06-08 11:13:20 (GMT)
commitab1cb80b435a34e4f908c97cd2f3a7fe8add6505 (patch)
treeb4e1629e5898c219dcca716bd62463db608ed8f8 /Python
parent65ece7ca2366308fa91a39a8dfa255e6bdce3cca (diff)
downloadcpython-ab1cb80b435a34e4f908c97cd2f3a7fe8add6505.zip
cpython-ab1cb80b435a34e4f908c97cd2f3a7fe8add6505.tar.gz
cpython-ab1cb80b435a34e4f908c97cd2f3a7fe8add6505.tar.bz2
bpo-30547: Fix multiple reference leaks (#1995)
Fix regressions introduced by: - bpo-22257: commits 1abcf6700b4da6207fe859de40c6c1bada6b4fec and 6b4be195cd8868b76eb6fbe166acc39beee8ce36 Co-Authored-By: Victor Stinner <victor.stinner@gmail.com> Co-Authored-By: Louie Lu <git@louie.lu>
Diffstat (limited to 'Python')
-rw-r--r--Python/pylifecycle.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/Python/pylifecycle.c b/Python/pylifecycle.c
index 048c2b2..ec26824 100644
--- a/Python/pylifecycle.c
+++ b/Python/pylifecycle.c
@@ -302,9 +302,11 @@ initimport(PyInterpreterState *interp, PyObject *sysmod)
/* Install importlib as the implementation of import */
value = PyObject_CallMethod(importlib, "_install", "OO", sysmod, impmod);
- if (value != NULL)
+ if (value != NULL) {
+ Py_DECREF(value);
value = PyObject_CallMethod(importlib,
"_install_external_importers", "");
+ }
if (value == NULL) {
PyErr_Print();
Py_FatalError("Py_Initialize: importlib install failed");
@@ -325,6 +327,7 @@ initexternalimport(PyInterpreterState *interp)
PyErr_Print();
Py_FatalError("Py_EndInitialization: external importer setup failed");
}
+ Py_DECREF(value);
}