Kaydet (Commit) ab1cb80b authored tarafından Stéphane Wirtel's avatar Stéphane Wirtel Kaydeden (comit) Victor Stinner

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

Fix regressions introduced by:

- bpo-22257: commits 1abcf670 and 6b4be195Co-Authored-By: 's avatarVictor Stinner <victor.stinner@gmail.com>
Co-Authored-By: 's avatarLouie Lu <git@louie.lu>
üst 65ece7ca
...@@ -302,9 +302,11 @@ initimport(PyInterpreterState *interp, PyObject *sysmod) ...@@ -302,9 +302,11 @@ initimport(PyInterpreterState *interp, PyObject *sysmod)
/* Install importlib as the implementation of import */ /* Install importlib as the implementation of import */
value = PyObject_CallMethod(importlib, "_install", "OO", sysmod, impmod); value = PyObject_CallMethod(importlib, "_install", "OO", sysmod, impmod);
if (value != NULL) if (value != NULL) {
Py_DECREF(value);
value = PyObject_CallMethod(importlib, value = PyObject_CallMethod(importlib,
"_install_external_importers", ""); "_install_external_importers", "");
}
if (value == NULL) { if (value == NULL) {
PyErr_Print(); PyErr_Print();
Py_FatalError("Py_Initialize: importlib install failed"); Py_FatalError("Py_Initialize: importlib install failed");
...@@ -325,6 +327,7 @@ initexternalimport(PyInterpreterState *interp) ...@@ -325,6 +327,7 @@ initexternalimport(PyInterpreterState *interp)
PyErr_Print(); PyErr_Print();
Py_FatalError("Py_EndInitialization: external importer setup failed"); Py_FatalError("Py_EndInitialization: external importer setup failed");
} }
Py_DECREF(value);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment