summaryrefslogtreecommitdiffstats
path: root/Python/ceval.c
diff options
context:
space:
mode:
authorPablo Galindo <Pablogsal@gmail.com>2021-06-21 15:23:53 (GMT)
committerGitHub <noreply@github.com>2021-06-21 15:23:53 (GMT)
commit06cda808f149fae9b4c688f752b6eccd0d455ba4 (patch)
treefe41789e2974228ef32e77f57a9b0e39c45a89e7 /Python/ceval.c
parent30f7a77f359a0fc6e37988b0f317a77a15d66b7b (diff)
downloadcpython-06cda808f149fae9b4c688f752b6eccd0d455ba4.zip
cpython-06cda808f149fae9b4c688f752b6eccd0d455ba4.tar.gz
cpython-06cda808f149fae9b4c688f752b6eccd0d455ba4.tar.bz2
bpo-44472: Fix ltrace functionality when exceptions are raised (GH-26822)
Diffstat (limited to 'Python/ceval.c')
-rw-r--r--Python/ceval.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/Python/ceval.c b/Python/ceval.c
index b5e3dd5..9c11640 100644
--- a/Python/ceval.c
+++ b/Python/ceval.c
@@ -5325,11 +5325,14 @@ static int
prtrace(PyThreadState *tstate, PyObject *v, const char *str)
{
printf("%s ", str);
+ PyObject *type, *value, *traceback;
+ PyErr_Fetch(&type, &value, &traceback);
if (PyObject_Print(v, stdout, 0) != 0) {
/* Don't know what else to do */
_PyErr_Clear(tstate);
}
printf("\n");
+ PyErr_Restore(type, value, traceback);
return 1;
}
#endif