collect() should not get an exception, but it does, logging the
exception is enough. Override sys.unraisablehook to decide how to
handle unraisable exceptions.
Py_FatalError() should be avoided whenever possible.
g->_gc_prev -= 1 << _PyGC_PREV_SHIFT;
}
-/* Python string to use if unhandled exception occurs */
-static PyObject *gc_str = NULL;
-
/* set for debugging information */
#define DEBUG_STATS (1<<0) /* print collection statistics */
#define DEBUG_COLLECTABLE (1<<1) /* print collectable objects */
_PyErr_Clear(tstate);
}
else {
- if (gc_str == NULL)
- gc_str = PyUnicode_FromString("garbage collection");
- PyErr_WriteUnraisable(gc_str);
- Py_FatalError("unexpected exception during garbage collection");
+ _PyErr_WriteUnraisableMsg("in garbage collection", NULL);
}
}