summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Misc/NEWS.d/next/Core and Builtins/2021-06-21-11-19-54.bpo-44472.Vvm1yn.rst1
-rw-r--r--Python/ceval.c3
2 files changed, 4 insertions, 0 deletions
diff --git a/Misc/NEWS.d/next/Core and Builtins/2021-06-21-11-19-54.bpo-44472.Vvm1yn.rst b/Misc/NEWS.d/next/Core and Builtins/2021-06-21-11-19-54.bpo-44472.Vvm1yn.rst
new file mode 100644
index 0000000..34fa2a9
--- /dev/null
+++ b/Misc/NEWS.d/next/Core and Builtins/2021-06-21-11-19-54.bpo-44472.Vvm1yn.rst
@@ -0,0 +1 @@
+Fix ltrace functionality when exceptions are raised. Patch by Pablo Galindo
diff --git a/Python/ceval.c b/Python/ceval.c
index 2674e46..6482c88 100644
--- a/Python/ceval.c
+++ b/Python/ceval.c
@@ -5385,11 +5385,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