[3.7] bpo-36829: Enhance PyErr_WriteUnraisable() by vstinner · Pull Request #13487 · python/cpython (original) (raw)

PyErr_WriteUnraisable() now displays the exception even if displaying
the traceback failed. Moreover, hold a reference to sys.stderr while
using it.

Document that an exception must be set when calling
PyErr_WriteUnraisable(), but don't add an assertion to check it at
runtime.

Cleanup: use longer names for variables and create
write_unraisable_exc_file() subfunction.

https://bugs.python.org/issue36829