[issue36829] CLI option to make PyErr_WriteUnraisable abort the current process

STINNER Victor report at bugs.python.org
Thu May 9 17:58:19 EDT 2019


STINNER Victor <vstinner at redhat.com> added the comment:

too_late_unraisable.py is an example where PyErr_WriteUnraisable() is called very lated during Python finalization to be handled by user code. A destructor (__del__) fails on print() because the stream has been closed.

PyErr_WriteUnraisable() is called by _PyGC_CollectNoFail() at the *end* of PyImport_Cleanup(). At this point, the sys module has already been cleared, as all other modules. A custom sys.unraisablehook cannot be used, because sys has been called.

----------
versions: +Python 3.8
Added file: https://bugs.python.org/file48321/too_late_unraisable.py

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue36829>
_______________________________________


More information about the Python-bugs-list mailing list