diff options
author | Irit Katriel <1055913+iritkatriel@users.noreply.github.com> | 2021-11-30 22:37:04 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-11-30 22:37:04 +0000 |
commit | 8a45ca542a65ea27e7acaa44a4c833a27830e796 (patch) | |
tree | 8cc5563159c3c11b88d0f9c9b9164ed21a9d9e7f /Python/ceval.c | |
parent | af8c8caaf5e07c02202d736a31f6a2f7e27819b8 (diff) | |
download | cpython-git-8a45ca542a65ea27e7acaa44a4c833a27830e796.tar.gz |
bpo-45711: Change exc_info related APIs to derive type and traceback from the exception instance (GH-29780)
Diffstat (limited to 'Python/ceval.c')
-rw-r--r-- | Python/ceval.c | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/Python/ceval.c b/Python/ceval.c index 0427361a03..c5477b30f7 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -5918,20 +5918,17 @@ do_raise(PyThreadState *tstate, PyObject *exc, PyObject *cause) if (exc == NULL) { /* Reraise */ _PyErr_StackItem *exc_info = _PyErr_GetTopmostException(tstate); - PyObject *tb; - type = exc_info->exc_type; value = exc_info->exc_value; - tb = exc_info->exc_traceback; - assert(((Py_IsNone(value) || value == NULL)) == - ((Py_IsNone(type) || type == NULL))); if (Py_IsNone(value) || value == NULL) { _PyErr_SetString(tstate, PyExc_RuntimeError, "No active exception to reraise"); return 0; } + assert(PyExceptionInstance_Check(value)); + type = PyExceptionInstance_Class(value); Py_XINCREF(type); Py_XINCREF(value); - Py_XINCREF(tb); + PyObject *tb = PyException_GetTraceback(value); /* new ref */ _PyErr_Restore(tstate, type, value, tb); return 1; } |