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
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
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