From 8905fcc85a6fc3ac394bc89b0bbf40897e9497a6 Mon Sep 17 00:00:00 2001 From: Serhiy Storchaka Date: Tue, 11 Dec 2018 08:38:03 +0200 Subject: bpo-35454: Fix miscellaneous minor issues in error handling. (#11077) * bpo-35454: Fix miscellaneous minor issues in error handling. * Fix a null pointer dereference. --- Python/pylifecycle.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'Python/pylifecycle.c') diff --git a/Python/pylifecycle.c b/Python/pylifecycle.c index 6de32decc5..37ecc510c8 100644 --- a/Python/pylifecycle.c +++ b/Python/pylifecycle.c @@ -1286,6 +1286,9 @@ new_interpreter(PyThreadState **tstate_p) PyDict_SetItemString(interp->sysdict, "modules", modules); _PySys_EndInit(interp->sysdict, interp); } + else if (PyErr_Occurred()) { + goto handle_error; + } bimod = _PyImport_FindBuiltin("builtins", modules); if (bimod != NULL) { @@ -1294,6 +1297,9 @@ new_interpreter(PyThreadState **tstate_p) goto handle_error; Py_INCREF(interp->builtins); } + else if (PyErr_Occurred()) { + goto handle_error; + } /* initialize builtin exceptions */ _PyExc_Init(bimod); -- cgit v1.2.1