gh-108082: C API: Add tests for PyErr_WriteUnraisable() (GH-111455)

Also document the behavior when called with NULL.
This commit is contained in:
Serhiy Storchaka 2023-10-30 19:01:03 +02:00 committed by GitHub
parent 8eaa206fec
commit bca3305429
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 70 additions and 0 deletions

View file

@ -88,9 +88,17 @@ Printing and clearing
The function is called with a single argument *obj* that identifies the context
in which the unraisable exception occurred. If possible,
the repr of *obj* will be printed in the warning message.
If *obj* is ``NULL``, only the traceback is printed.
An exception must be set when calling this function.
.. versionchanged:: 3.4
Print a traceback. Print only traceback if *obj* is ``NULL``.
.. versionchanged:: 3.8
Use :func:`sys.unraisablehook`.
.. c:function:: void PyErr_DisplayException(PyObject *exc)
Print the standard traceback display of ``exc`` to ``sys.stderr``, including