You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Could we instead make lltrace a local variable for PyEval_EvalFrameDefault? I think that would be a beneficial change anyway: you then only trace functions in modules marked with __lltrace__, and it stays on after a call to a different module finishes.
Activity
sweeneyde commentedon Apr 26, 2022
How strange: I don't know how the encoding is preventing
printf()from working.serhiy-storchaka commentedon Apr 26, 2022
It may fail to decode a non-UTF-8 file path with UTF-8 and then silence all errors. It may be similar to #91922.
vstinner commentedon May 25, 2022
It's a subtle bug related to unicode_check_encoding_errors().
lltrace_resume_frame() => PyObject_Print() => PyUnicode_AsEncodedString() => unicode_check_encoding_errors() => _PyCodec_Lookup() => (...) => _PyEval_EvalFrame()
The _PyEval_EvalFrame() call executes encodings.search_function() which sets lltrace to 0.
I propose #93199 to fix it.
sweeneyde commentedon May 25, 2022
Thanks for the detective work!
Could we instead make
lltracea local variable forPyEval_EvalFrameDefault? I think that would be a beneficial change anyway: you then only trace functions in modules marked with__lltrace__, and it stays on after a call to a different module finishes.vstinner commentedon May 25, 2022
Let's discuss that in the PR instead.
pythongh-91924: Fix __lltrace__ for non-UTF-8 stdout encoding (python…
gh-91924: Fix __lltrace__ for non-UTF-8 stdout encoding (#93199)
gh-91924: Fix __lltrace__ for non-UTF-8 stdout encoding (GH-93199)
[3.10] gh-91924: Fix __ltrace__ for non-UTF-8 stdout encoding (#93214)
vstinner commentedon May 25, 2022
Fixed by:
gh-91924: Optimize unicode_check_encoding_errors() (#93200)