Skip to content

Commit 06cda80

Browse files
authored
bpo-44472: Fix ltrace functionality when exceptions are raised (GH-26822)
1 parent 30f7a77 commit 06cda80

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fix ltrace functionality when exceptions are raised. Patch by Pablo Galindo

Python/ceval.c

+3
Original file line numberDiff line numberDiff line change
@@ -5325,11 +5325,14 @@ static int
53255325
prtrace(PyThreadState *tstate, PyObject *v, const char *str)
53265326
{
53275327
printf("%s ", str);
5328+
PyObject *type, *value, *traceback;
5329+
PyErr_Fetch(&type, &value, &traceback);
53285330
if (PyObject_Print(v, stdout, 0) != 0) {
53295331
/* Don't know what else to do */
53305332
_PyErr_Clear(tstate);
53315333
}
53325334
printf("\n");
5335+
PyErr_Restore(type, value, traceback);
53335336
return 1;
53345337
}
53355338
#endif

0 commit comments

Comments
 (0)