bpo-30547: Fix multiple reference leaks (#1995)
Fix regressions introduced by: - bpo-22257: commits1abcf6700b
and6b4be195cd
Co-Authored-By: Victor Stinner <victor.stinner@gmail.com> Co-Authored-By: Louie Lu <git@louie.lu>
This commit is contained in:
parent
65ece7ca23
commit
ab1cb80b43
|
@ -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);
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue