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

Replace PyErr_WriteUnraisable() with PyErr_FormatUnraisable().
This commit is contained in:
Victor Stinner 2025-01-30 16:09:38 +01:00 committed by GitHub
parent 5ab9604683
commit 4e47e05045
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 21 additions and 15 deletions

View file

@ -1042,7 +1042,7 @@ PyObject_ClearWeakRefs(PyObject *object)
PyObject *tuple = PyTuple_New(num_weakrefs * 2);
if (tuple == NULL) {
_PyWeakref_ClearWeakRefsNoCallbacks(object);
PyErr_WriteUnraisable(NULL);
PyErr_FormatUnraisable("Exception ignored when clearing object weakrefs");
PyErr_SetRaisedException(exc);
return;
}