gh-102755: Add PyErr_DisplayException(exc) (#102756)

This commit is contained in:
Irit Katriel 2023-03-16 22:18:04 +00:00 committed by GitHub
parent 405739f916
commit 3f9285a8c5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
13 changed files with 76 additions and 78 deletions

View file

@ -39,20 +39,13 @@ err_restore(PyObject *self, PyObject *args) {
static PyObject *
exception_print(PyObject *self, PyObject *args)
{
PyObject *value;
PyObject *tb = NULL;
PyObject *exc;
if (!PyArg_ParseTuple(args, "O:exception_print", &value)) {
if (!PyArg_ParseTuple(args, "O:exception_print", &exc)) {
return NULL;
}
if (PyExceptionInstance_Check(value)) {
tb = PyException_GetTraceback(value);
}
PyErr_Display((PyObject *) Py_TYPE(value), value, tb);
Py_XDECREF(tb);
PyErr_DisplayException(exc);
Py_RETURN_NONE;
}