-
-
Notifications
You must be signed in to change notification settings - Fork 32.2k
[3.10] gh-91924: Fix __ltrace__ for non-UTF-8 stdout encoding #93214
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
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.
@sweeneyde @serhiy-storchaka: Would you mind to review this fix for Python 3.10? The fix is different and I adapted the test from the main branch for 3.10. Without the fix but with the new test, |
I'm not sure why Windows CI is failing, the tests pass on my Windows machine. Maybe it has something to do with not calling |
In the 3.10 branch, the Windows CI builds Python in release mode. I fixed the test. |
@sweeneyde: the CI tests now pass. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me. The local variable is nicer, but I agree that minimizing changes (EXT_POP and call_function) is more important.
Adding an argument to call_function() can make the performance worse, and the code more complicated depending if LLTRACE macro is defined or not. I really want to minimize the risk of regression in 3.10 stable branch. |
I hesitated to fix |
It reminds me the weird typo of |
Oh, for the float method, I backported my change fixing the typo: #31558 |
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.