From d3ef25e9d647093bad495ee8e04042b2aee267dd Mon Sep 17 00:00:00 2001 From: Serhiy Storchaka Date: Sat, 25 Jun 2022 11:24:04 +0300 Subject: [PATCH] gh-77560: Report possible errors in restoring builtins at finalization Seems in the past the copy of builtins was not made in some scenarios, and the error was silenced. Write it now to stderr, so we have a chance to see it. --- Python/pylifecycle.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Python/pylifecycle.c b/Python/pylifecycle.c index c2c9e90d056296..65e7f23e963b5f 100644 --- a/Python/pylifecycle.c +++ b/Python/pylifecycle.c @@ -1462,7 +1462,7 @@ finalize_restore_builtins(PyThreadState *tstate) } PyDict_Clear(interp->builtins); if (PyDict_Update(interp->builtins, interp->builtins_copy)) { - _PyErr_Clear(tstate); + PyErr_WriteUnraisable(NULL); } Py_XDECREF(dict); }