bpo-30547: Fix multiple reference leaks (#1995)

Fix regressions introduced by:

- bpo-22257: commits 1abcf6700b and 6b4be195cd

Co-Authored-By: Victor Stinner <victor.stinner@gmail.com>
Co-Authored-By: Louie Lu <git@louie.lu>
This commit is contained in:
Stéphane Wirtel 2017-06-08 13:13:20 +02:00 committed by Victor Stinner
parent 65ece7ca23
commit ab1cb80b43
1 changed files with 4 additions and 1 deletions

View File

@ -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);
}