Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Merge branch 'main' into capi-PyErr_FormatUnraisable
  • Loading branch information
serhiy-storchaka committed Oct 30, 2023
commit bda2510a3417260c1666e6a9429f1251375bcdeb
6 changes: 6 additions & 0 deletions Doc/c-api/exceptions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,12 @@ Printing and clearing

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_FormatUnraisable(const char *format, ...)

Expand Down
6 changes: 2 additions & 4 deletions Modules/_testcapi/exceptions.c
Original file line number Diff line number Diff line change
Expand Up @@ -313,8 +313,7 @@ err_writeunraisable(PyObject *Py_UNUSED(module), PyObject *args)
NULLABLE(exc);
NULLABLE(obj);
if (exc) {
Py_INCREF(exc);
PyErr_SetRaisedException(exc);
PyErr_SetRaisedException(Py_NewRef(exc));
}
PyErr_WriteUnraisable(obj);
Py_RETURN_NONE;
Expand All @@ -336,8 +335,7 @@ err_formatunraisable(PyObject *Py_UNUSED(module), PyObject *args)
}
NULLABLE(exc);
if (exc) {
Py_INCREF(exc);
PyErr_SetRaisedException(exc);
PyErr_SetRaisedException(Py_NewRef(exc));
}
PyErr_FormatUnraisable(fmt,
objs[0], objs[1], objs[2], objs[3], objs[4],
Expand Down
You are viewing a condensed version of this merge commit. You can view the full changes here.