mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
gh-102755: Add PyErr_DisplayException(exc) (#102756)
This commit is contained in:
parent
405739f916
commit
3f9285a8c5
13 changed files with 76 additions and 78 deletions
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue