mirror of
https://github.com/python/cpython.git
synced 2025-07-12 22:05:16 +00:00
bpo-44472: Fix ltrace functionality when exceptions are raised (GH-26822) (GH-26830)
(cherry picked from commit 06cda808f1
)
Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
This commit is contained in:
parent
7223ce3b3f
commit
4a0f1df952
2 changed files with 4 additions and 0 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue