diff options
author | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2021-07-13 08:43:26 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-07-13 08:43:26 (GMT) |
commit | 4a0f1df9527f7d67064d33f5366476b3c93dc86c (patch) | |
tree | 6ab420f8d5f1ec323b1a2320c1dc68aa9e6bc1d4 /Python | |
parent | 7223ce3b3f50ec8a825e317437ea0359b6ad6856 (diff) | |
download | cpython-4a0f1df9527f7d67064d33f5366476b3c93dc86c.zip cpython-4a0f1df9527f7d67064d33f5366476b3c93dc86c.tar.gz cpython-4a0f1df9527f7d67064d33f5366476b3c93dc86c.tar.bz2 |
bpo-44472: Fix ltrace functionality when exceptions are raised (GH-26822) (GH-26830)
(cherry picked from commit 06cda808f149fae9b4c688f752b6eccd0d455ba4)
Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
Diffstat (limited to 'Python')
-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 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 |