diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2016-10-21 13:21:02 (GMT) |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2016-10-21 13:21:02 (GMT) |
commit | c4189a04a8d5fef512db33302f405c9e6170c369 (patch) | |
tree | e3209e210e408b4ad1b51f032665e57ad04863a8 /Python | |
parent | fdf641863015aec32ab3822f4a1d4ecabc06fca4 (diff) | |
parent | b0426cd8c4ecaa19cff05b4860da1c06531a77c1 (diff) | |
download | cpython-c4189a04a8d5fef512db33302f405c9e6170c369.zip cpython-c4189a04a8d5fef512db33302f405c9e6170c369.tar.gz cpython-c4189a04a8d5fef512db33302f405c9e6170c369.tar.bz2 |
Issue #28410: Keep the traceback of original exception in _PyErr_ChainExceptions().
Diffstat (limited to 'Python')
-rw-r--r-- | Python/errors.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/Python/errors.c b/Python/errors.c index 13ae6b4..12bde28 100644 --- a/Python/errors.c +++ b/Python/errors.c @@ -387,8 +387,11 @@ _PyErr_ChainExceptions(PyObject *exc, PyObject *val, PyObject *tb) PyObject *exc2, *val2, *tb2; PyErr_Fetch(&exc2, &val2, &tb2); PyErr_NormalizeException(&exc, &val, &tb); + if (tb != NULL) { + PyException_SetTraceback(val, tb); + Py_DECREF(tb); + } Py_DECREF(exc); - Py_XDECREF(tb); PyErr_NormalizeException(&exc2, &val2, &tb2); PyException_SetContext(val2, val); PyErr_Restore(exc2, val2, tb2); |