Repository navigation
test(tools): decode select_tests and stubgen CLI output as UTF-8 - #13833
Merged
oneandonlydean merged 1 commit intoNov 1, 2026
Merged
Conversation
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
12 tasks done
12 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
tools/select_tests.pyandtools/stubgen.pyreconfigure stdout and stderr to UTF-8, but three test call sites read their output withtext=True, which decodes with the locale encoding:BuildErrorTests.run_toolintools/tests/test_select_tests.py(3 tests, 10 cases);test_dangling_targets_fail_instead_of_selecting_no_testsin the same file;test_readonly_second_output_preserves_both_outputsintools/tests/test_stubgen.py, which runs only on Windows.On Windows without Python's UTF-8 mode, the locale encoding is the ANSI code page. When the temporary directory holds a character whose UTF-8 bytes the code page cannot decode, such as
с(d1 81) in aTEMPlikeC:\Users\Иван\AppData\Local\Tempunder code page 1252, the error message that names the path fails to decode insubprocess's reader thread (UnicodeDecodeError: 'charmap' codec can't decode byte 0x81),stdout/stderrareNone, and the assertions raiseTypeError.These call sites now pass
encoding="utf-8", astools/tests/test_audit_dump.py,tools/tests/test_configure_seed.pyand other tool tests already do. The tools are unchanged. Same kind of fix as #13269 fortest_pr_overlap_export_cache.py; no overlap with it.Tested
Windows 11, Python 3.14 (ANSI code page 1252), WinLibs GCC 15.2.0 UCRT POSIX SEH toolchain on
PATH.TEMPmainpython tools/tests/test_stubgen.pyC:\b\l3 тестpython tools/tests/test_select_tests.py BuildErrorTests GraphClosureTestsC:\b\l3 тестpython tools/tests/test_stubgen.pypython tools/tests/test_select_tests.pyThe other
test_select_tests.pyclasses configure a CMake/Ninja build in the temporary directory, which the MinGW toolchain here cannot do in a directory outside the ANSI code page; they are not affected by this change.python tools/check_conventions.py --base origin/main: all checks passed.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)🤖 Generated with Claude Code