Repository navigation
tools: guard stdout in the 11 tools test_tool_stdout_encoding lists - #7816
Friendships6666 wants to merge 1 commit into
Conversation
`python -I` ignores PYTHONUTF8 and PYTHONIOENCODING (ItsNotRexed#1406), so a redirected stdout is encoded with the console's ANSI code page and a caller path with a character outside it ended the run in UnicodeEncodeError. Every other tool already sets errors="replace" in its __main__ block, with the same comment; these eleven never got it: awc_cue_labels, bvh_slot_check, div_fixup_diff, gbuffer_census, import_call_sites, navmesh_tile_obj, op_reach, wave_diff, world_drawable_lookup, world_drawable_verify and scripts/dev.py. awc_cue_labels had no `import sys` at all, so it needed the import before the guard. test_tool_stdout_encoding is green after this and its list is empty. ItsNotRexed#7650 (div_fixup_diff), ItsNotRexed#7184 (op_reach) and ItsNotRexed#7174 (op_reach, wave_diff, dev.py) are open on parts of the same files; this is the remainder they leave. Co-Authored-By: Claude Code <noreply@anthropic.com>
d5fc7c1 to
2f5f8be
Compare
|
Possible duplicate: #7176 makes the same change to the same eleven files (scripts/dev.py and ten tools under tools/).
AI-assisted (Claude Code). |
|
Tested
Of the open PRs for this test that I ran (#7174, #7650), this is the only one that turns the file green on its own. Independent check (not the author). Run by an AI agent (DeepSeek V4.1 Flash) and re-run by the orchestrating session (Claude Code) before posting; claimed in #8047. |
|
Thanks, Jadiac5, for identifying the overlap, and thanks, ne1i, for running the independent checks. I compared the diffs: #7176 already covers all eleven stdout guards, and the additional LF change in this branch is covered by #7819 and #7857. Sorry for the duplication. I’m closing this PR so that review can continue on the earlier work. |
Leaving eleven tools without the stdout guard is what keeps
test_tool_stdout_encodingred, and the guide in #7694 leaves them open: #7650 was titled fordiv_fixup_diff,gbuffer_censusandnavmesh_tile_objbut only patches the first, #7184 coversop_reachalone, and #7174 (which does coverwave_diffandscripts/dev.py) no longer applies because it also patchesop_reach, which #7184 changes.python -IignoresPYTHONUTF8andPYTHONIOENCODING(#1406), so a redirected stdout is encoded with the console's ANSI code page and a caller path with a character outside it ends the run inUnicodeEncodeError. Every other tool already setserrors="replace"in its__main__block, with the same comment; these eleven simply never got it.awc_cue_labelshad noimport sysat all, so it needed the import before the guard.Overlap
tools/div_fixup_diff.pyandtools/op_reach.pyare also in #7650 and #7184. Mine is deliberately the other nine, so this merges after those two without a conflict; if either of them is closed instead, add its file here and the test still closes. Same forwave_diff.pyagainst #7188, which is a different line in the same file and also merges either way.Test
python -I tests/test_tool_stdout_encoding.pyis green with this and its list is empty; it is red onmainwith the eleven paths.python -m compileall -q make_game.py tools testsis clean andpython -I <tool> --helpreturns 0 for all eleven. Measured over the suite: 14 red standalone files before, 11 after, nothing green turned red.Linux, Python 3.14.8 (3.12 path read, no version-specific code), no GPU, no game files.