gh-108082: Add PyErr_FormatUnraisable() function (GH-111086)

This commit is contained in:
Serhiy Storchaka 2023-10-31 23:42:44 +02:00 committed by GitHub
parent 453e96e302
commit f6a02327b5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 142 additions and 8 deletions

View file

@ -99,6 +99,18 @@ Printing and clearing
Use :func:`sys.unraisablehook`.
.. c:function:: void PyErr_FormatUnraisable(const char *format, ...)
Similar to :c:func:`PyErr_WriteUnraisable`, but the *format* and subsequent
parameters help format the warning message; they have the same meaning and
values as in :c:func:`PyUnicode_FromFormat`.
``PyErr_WriteUnraisable(obj)`` is roughtly equivalent to
``PyErr_FormatUnraisable("Exception ignored in: %R, obj)``.
If *format* is ``NULL``, only the traceback is printed.
.. versionadded:: 3.13
.. c:function:: void PyErr_DisplayException(PyObject *exc)
Print the standard traceback display of ``exc`` to ``sys.stderr``, including
@ -106,6 +118,7 @@ Printing and clearing
.. versionadded:: 3.12
Raising exceptions
==================