Skip to content

Commit ab1cb80

Browse files
matrixisevstinnermlouielu
committed
bpo-30547: Fix multiple reference leaks (#1995)
Fix regressions introduced by: - bpo-22257: commits 1abcf67 and 6b4be19 Co-Authored-By: Victor Stinner <[email protected]> Co-Authored-By: Louie Lu <[email protected]>
1 parent 65ece7c commit ab1cb80

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

Python/pylifecycle.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -302,9 +302,11 @@ initimport(PyInterpreterState *interp, PyObject *sysmod)
302302

303303
/* Install importlib as the implementation of import */
304304
value = PyObject_CallMethod(importlib, "_install", "OO", sysmod, impmod);
305-
if (value != NULL)
305+
if (value != NULL) {
306+
Py_DECREF(value);
306307
value = PyObject_CallMethod(importlib,
307308
"_install_external_importers", "");
309+
}
308310
if (value == NULL) {
309311
PyErr_Print();
310312
Py_FatalError("Py_Initialize: importlib install failed");
@@ -325,6 +327,7 @@ initexternalimport(PyInterpreterState *interp)
325327
PyErr_Print();
326328
Py_FatalError("Py_EndInitialization: external importer setup failed");
327329
}
330+
Py_DECREF(value);
328331
}
329332

330333

0 commit comments

Comments
 (0)