summaryrefslogtreecommitdiffstats
path: root/Python/ceval.c
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2021-07-12 15:11:10 (GMT)
committerGitHub <noreply@github.com>2021-07-12 15:11:10 (GMT)
commit6fb4248cd9502f50dd089fdcf548d735dcfd981e (patch)
tree29f934cbc85d325bf80479e77684a5e8b902263a /Python/ceval.c
parentc89f0b2587eb0b16175a0bbb12d0b86314ff9320 (diff)
downloadcpython-6fb4248cd9502f50dd089fdcf548d735dcfd981e.zip
cpython-6fb4248cd9502f50dd089fdcf548d735dcfd981e.tar.gz
cpython-6fb4248cd9502f50dd089fdcf548d735dcfd981e.tar.bz2
bpo-44472: Fix ltrace functionality when exceptions are raised (GH-26822) (#26831)
(cherry picked from commit 06cda808f149fae9b4c688f752b6eccd0d455ba4) Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
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 91e879e..86a5d81 100644
--- a/Python/ceval.c
+++ b/Python/ceval.c
@@ -4598,11 +4598,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