summaryrefslogtreecommitdiffstats
path: root/Python
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@python.org>2022-05-25 22:16:32 (GMT)
committerGitHub <noreply@github.com>2022-05-25 22:16:32 (GMT)
commit9369942054fe3fe389f4f4ff808d33c5d7945052 (patch)
tree4f9b6e47cd432c374822e7d4f348f005d9062394 /Python
parent02d35fc4ef8a718e74ab97402b6d8371b69d3635 (diff)
downloadcpython-9369942054fe3fe389f4f4ff808d33c5d7945052.zip
cpython-9369942054fe3fe389f4f4ff808d33c5d7945052.tar.gz
cpython-9369942054fe3fe389f4f4ff808d33c5d7945052.tar.bz2
[3.10] gh-91924: Fix __ltrace__ for non-UTF-8 stdout encoding (#93214)
Fix __ltrace__ debug feature if the stdout encoding is not UTF-8. If the stdout encoding is not UTF-8, the first call to lltrace_resume_frame() indirectly sets lltrace to 0 when calling unicode_check_encoding_errors() which calls encodings.search_function(). Add test_lltrace.test_lltrace() test.
Diffstat (limited to 'Python')
-rw-r--r--Python/ceval.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/Python/ceval.c b/Python/ceval.c
index 21674e0..9a193c9 100644
--- a/Python/ceval.c
+++ b/Python/ceval.c
@@ -5377,6 +5377,8 @@ prtrace(PyThreadState *tstate, PyObject *v, const char *str)
}
printf("\n");
PyErr_Restore(type, value, traceback);
+ // gh-91924: PyObject_Print() can indirectly set lltrace to 0
+ lltrace = 1;
return 1;
}
#endif