STINNER Victor <vstin...@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 <rep...@bugs.python.org>
<https://bugs.python.org/issue36829>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to