mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
bpo-38631: Replace Py_FatalError() with _PyObject_ASSERT_FAILED_MSG() (GH-18258)
Replace Py_FatalError() with _PyObject_ASSERT_FAILED_MSG() in object.c and typeobject.c to also dump the involved Python object on a fatal error. It should ease debug when such fatal error occurs. If the double linked list is inconsistent, _Py_ForgetReference() no longer dumps previous and next objects in the fatal error, it now only dumps the current object. It ensures that the error message is displayed even if dumping the object does crash Python. Enhance _Py_ForgetReference() error messages; _PyObject_ASSERT_FAILED_MSG() logs the "_Py_ForgetReference" function name.
This commit is contained in:
parent
188bb5b1e8
commit
5eb8bff7e4
2 changed files with 33 additions and 33 deletions
|
@ -3570,9 +3570,9 @@ type_traverse(PyTypeObject *type, visitproc visit, void *arg)
|
|||
for heaptypes. */
|
||||
if (!(type->tp_flags & Py_TPFLAGS_HEAPTYPE)) {
|
||||
char msg[200];
|
||||
sprintf(msg, "type_traverse() called for non-heap type '%.100s'",
|
||||
sprintf(msg, "type_traverse() called on non-heap type '%.100s'",
|
||||
type->tp_name);
|
||||
Py_FatalError(msg);
|
||||
_PyObject_ASSERT_FAILED_MSG((PyObject *)type, msg);
|
||||
}
|
||||
|
||||
Py_VISIT(type->tp_dict);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue