From 5695c0e0a25da58dfc1d22fc1cd68c2fda0a320d Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Wed, 25 May 2022 11:45:33 +0200 Subject: gh-91924: Fix __lltrace__ for non-UTF-8 stdout encoding (#93199) Fix __lltrace__ 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(). --- Python/ceval.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'Python/ceval.c') diff --git a/Python/ceval.c b/Python/ceval.c index 230198b41f..e82f734302 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -107,7 +107,6 @@ static PyObject * do_call_core( PyObject *callargs, PyObject *kwdict, int use_tracing); #ifdef LLTRACE -static int lltrace; static void dump_stack(_PyInterpreterFrame *frame, PyObject **stack_pointer) { @@ -1715,6 +1714,9 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, _PyInterpreterFrame *frame, int uint8_t opcode; /* Current opcode */ int oparg; /* Current opcode argument, if any */ _Py_atomic_int * const eval_breaker = &tstate->interp->ceval.eval_breaker; +#ifdef LLTRACE + int lltrace = 0; +#endif _PyCFrame cframe; CallShape call_shape; -- cgit v1.2.1