]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-77560: Report possible errors in restoring builtins at finalization (GH-94255)
authorSerhiy Storchaka <storchaka@gmail.com>
Sat, 25 Jun 2022 16:02:09 +0000 (19:02 +0300)
committerGitHub <noreply@github.com>
Sat, 25 Jun 2022 16:02:09 +0000 (19:02 +0300)
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

index c2c9e90d056296d6804d15439d950a9a23f5e522..65e7f23e963b5fc6f7ecb95492e3311411fa7bd1 100644 (file)
@@ -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);
 }