summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorIrit Katriel <1055913+iritkatriel@users.noreply.github.com>2023-03-16 22:18:04 (GMT)
committerGitHub <noreply@github.com>2023-03-16 22:18:04 (GMT)
commit3f9285a8c52bf776c364f0cf4aecdd8f514ac4e1 (patch)
tree22d14446b3d59b7402b59bbad2c153b4ddcb1b21 /Modules
parent405739f9166592104a5b0b945de92e28415ae972 (diff)
downloadcpython-3f9285a8c52bf776c364f0cf4aecdd8f514ac4e1.zip
cpython-3f9285a8c52bf776c364f0cf4aecdd8f514ac4e1.tar.gz
cpython-3f9285a8c52bf776c364f0cf4aecdd8f514ac4e1.tar.bz2
gh-102755: Add PyErr_DisplayException(exc) (#102756)
Diffstat (limited to 'Modules')
-rw-r--r--Modules/_testcapi/exceptions.c13
1 files changed, 3 insertions, 10 deletions
diff --git a/Modules/_testcapi/exceptions.c b/Modules/_testcapi/exceptions.c
index c64b823..1922ca3b 100644
--- a/Modules/_testcapi/exceptions.c
+++ b/Modules/_testcapi/exceptions.c
@@ -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;
}