Repository navigation
op_reach: guard stdout with errors='replace' in __main__ - #7184
Open
limpan1212 wants to merge 1 commit into
Open
limpan1212 wants to merge 1 commit into
limpan1212 wants to merge 1 commit into
Conversation
This was referenced Nov 23, 2026
Open
|
Tested
AI-assisted. |
|
Tested 44de7ac merged onto main e36d4c4 on Windows 11 Pro, Intel i7-14700KF, CPython 3.11.0 (venv: pytest 9.2.0, numpy 2.4.6, Pillow 13.0.0; numpy is below the 2.5.5 pin because 2.5 needs Python 3.12), CPU only: pass.
AI-assisted (Claude Code). |
This was referenced Nov 23, 2026
Open
Contributor
|
Tested 44de7ac on Windows 11, Python 3.15.2, NVIDIA RTX 4060 Ti (driver 621.24; CPU-only checks, no game files, no GPU/llvm-mc/MSVC used): pass. Ran the test files this PR adds or changes, from a clean checkout of the PR head: AI-assisted (Claude Code). |
Friendships6666
added a commit
to Friendships6666/Leonida
that referenced
this pull request
Nov 23, 2026
`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>
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.
Claim: #7049 (comment)
What changed and why
tools/op_reach.py(__main__): reconfiguresys.stdoutwitherrors=replace, matching the other CLI tools checked bytests/test_tool_stdout_encoding.py.python -I -X utf8=0with redirected stdout crashes withUnicodeEncodeError: 'charmap' codec can't encode characterattools/op_reach.py:185, andtests/test_tool_stdout_encoding.pyflagstools/op_reach.py.OpReachTests.test_non_codepage_op_pattern_does_not_crash_stdoutintests/test_op_reach.py(confirmed failing withUnicodeEncodeErrorbefore the fix and passing after).tools/op_reach.pyandtests/test_op_reach.pyonly (other entries intest_tool_stdout_encoding.pyare left to their respective PRs such as import_call_sites, world_drawable_lookup, world_drawable_verify: guard stdout like every other tool #7032 and awc_cue_labels: guard stdout with errors='replace' in __main__ #7152).Tests run (Windows 11, Python 3.12.10, CPU-only, no GPU used, no game files)
python -I tests/test_op_reach.py -v— failed before (UnicodeEncodeErroron\ue9c3), pass after (11/11 OK)python -I tests/test_tool_stdout_encoding.py—tools/op_reach.pyis cleared from the missing listpython -I -m compileall -q tools/op_reach.py tests/test_op_reach.py— pass (exit 0)python -I scripts/check_no_game_data.py— pass (exit 0)AI-assisted.