mirror of
https://github.com/ubiquitarianism/leonida.git
synced 2026-11-26 22:05:54 +01:00
[PR #605] [MERGED] tools: set errors="replace" on stdout in exe_sha and pr_conflict_label (TEST-STDOUT-ENCODING) #647
Labels
No labels
bug
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
starred/leonida#647
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/ubiquitarianism/leonida/pull/605
Author: @Mby159
Created: 11/24/2026
Status: ✅ Merged
Merged: 11/24/2026
Merged by: @ubiquitarianism
Base:
main← Head:fix/stdout-encoding-guard📝 Commits (1)
ce9bf43tools: replace stdout encoding errors in the two remaining tools📊 Changes
2 files changed (+2 additions, -0 deletions)
View changed files
📝
tools/exe_sha.py(+1 -0)📝
tools/pr_conflict_label.py(+1 -0)📄 Description
Claimed in the coordination issue as: TEST-STDOUT-ENCODING
What and why
tests/test_tool_stdout_encoding.pyis red onmain. That file is the repository's own guard for #1406: every CLI tool undertools/,scripts/andviewer/must seterrors="replace"on stdout, so a redirected stdout - encoded with the console's ANSI code page - cannot die withUnicodeEncodeErrorwhen it prints a path whose characters that code page cannot represent.EveryToolGuardsStdout.test_every_main_block_reconfigures_stdoutscans those three folders and requiressys.stdout.reconfigure(errors="replace")within 400 characters of theif __name__ == "__main__":line. Two tools were added after that test existed and never got the guard:tools/exe_sha.py- added in49c81019ctools/pr_conflict_label.py- added in4f7a34777so on
mainthe test fails with:The check is a source scan, so it fails on every platform: the Windows
checkjob, the Linuxstdlib-tests-linuxjob and the macOSmacos-pythonjob all run it. The upstream Windowscheckjob on #475 logged##[error]tests/test_tool_stdout_encoding.py failed, and that pull request's macOS job failed with the same assertion.This pull request adds the missing guard to the two
__main__blocks. Two lines; on a UTF-8 console nothing changes.Depends on: none
What I tested
python -I tests/test_tool_stdout_encoding.pyonmaind7576d56ae2c77564c84ffae724ffe9bdd2e6701:Ran 4 tests ... FAILED (failures=1)with the assertion above. With this change:Ran 4 tests ... OK.python -m compileall -q make_game.py tools tests: exit 0.python -I tests/test_exe_sha.py: 11 tests, OK.python -I tests/test_pr_conflict_label.py: 12 tests, OK.printof a character outside the code page raisesUnicodeEncodeError(charmap codec can't encode characters) on a strict stdout, and prints???witherrors="replace". This machine's redirected stdout isgbk(ACP 936).Hardware: Windows 11 x64 (10.0.29712), Python 3.13. No game files, no GPU, no network.
AI-assisted: yes.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.