gh-108082: Use PyErr_FormatUnraisable() (GH-111580)

Replace most of calls of _PyErr_WriteUnraisableMsg() and some
calls of PyErr_WriteUnraisable(NULL) with PyErr_FormatUnraisable().

Co-authored-by: Victor Stinner <vstinner@python.org>
This commit is contained in:
Serhiy Storchaka 2023-11-02 11:16:34 +02:00 committed by GitHub
parent a12f624a9d
commit 970e719a7a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
18 changed files with 83 additions and 114 deletions

View file

@ -34,7 +34,6 @@
#include "pycore_flowgraph.h"
#include "pycore_intrinsics.h"
#include "pycore_long.h" // _PyLong_GetZero()
#include "pycore_pyerrors.h" // _PyErr_WriteUnraisableMsg()
#include "pycore_pystate.h" // _Py_GetConfig()
#include "pycore_setobject.h" // _PySet_NextEntry()
#include "pycore_symtable.h" // PySTEntryObject, _PyFuture_FromAST()
@ -1407,8 +1406,8 @@ compiler_exit_scope(struct compiler *c)
assert(c->u);
/* we are deleting from a list so this really shouldn't fail */
if (PySequence_DelItem(c->c_stack, n) < 0) {
_PyErr_WriteUnraisableMsg("on removing the last compiler "
"stack item", NULL);
PyErr_FormatUnraisable("Exception ignored on removing "
"the last compiler stack item");
}
}
else {