diff options
author | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2021-07-12 15:11:10 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-07-12 15:11:10 (GMT) |
commit | 6fb4248cd9502f50dd089fdcf548d735dcfd981e (patch) | |
tree | 29f934cbc85d325bf80479e77684a5e8b902263a /Python/ceval.c | |
parent | c89f0b2587eb0b16175a0bbb12d0b86314ff9320 (diff) | |
download | cpython-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.c | 3 |
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 |