From bec802dbb87717a23acb9c600c15f40bc98340a3 Mon Sep 17 00:00:00 2001 From: Serhiy Storchaka Date: Sat, 25 Jun 2022 19:02:09 +0300 Subject: gh-77560: Report possible errors in restoring builtins at finalization (GH-94255) 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 c2c9e90..65e7f23 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); } -- cgit v0.12