gh-129354: Use PyErr_FormatUnraisable() function (#129511)

Replace PyErr_WriteUnraisable() with PyErr_FormatUnraisable().
This commit is contained in:
Victor Stinner
2025-01-31 13:16:08 +01:00
committed by GitHub
parent c3ae5c9e4a
commit 0373926260
5 changed files with 40 additions and 35 deletions

View File

@@ -1735,7 +1735,9 @@ unicode_dealloc(PyObject *unicode)
PyObject *popped;
int r = PyDict_Pop(interned, unicode, &popped);
if (r == -1) {
PyErr_WriteUnraisable(unicode);
PyErr_FormatUnraisable("Exception ignored while "
"removing an interned string %R",
unicode);
// We don't know what happened to the string. It's probably
// best to leak it:
// - if it was popped, there are no more references to it