mirror of
https://github.com/ubiquitarianism/leonida.git
synced 2026-11-26 23:55:52 +01:00
[PR #1837] tools/game_run_summary: guard stdout encoding, BOM ints, OSError and RecursionError #1849
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#1849
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/1837
Author: @kirigayakazima
Created: 11/25/2026
Status: 🔄 Open
Base:
main← Head:fix/game-run-summary-safety📝 Commits (1)
e76cabctools/game_run_summary: guard stdout encoding, BOM ints, OSError and RecursionError📊 Changes
2 files changed (+69 additions, -5 deletions)
View changed files
📝
tests/test_game_run_summary.py(+56 -1)📝
tools/game_run_summary.py(+13 -4)📄 Description
Claimed in the coordination issue as: GAME-RUN-SUMMARY-STDOUT-BOM-AND-VALIDATION (https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7163012307)
What and why
sys.stdout.reconfigure(errors="replace")guard intools/game_run_summary.py's__main__block so redirected Windowspython -Iruns do not raiseUnicodeEncodeErrorwhen reporting method names outside the ANSI/OEM code page.exit_codeandsecondsin_read_int()withencoding="utf-8-sig"so UTF-8 BOM-prefixed files parse cleanly instead of reading asNone.open()in_lines()againstOSErrorand catch(ValueError, RecursionError)onboot.jsonljson.loads()lines so deeply nested corrupt entries incrementstartup_bad_linescleanly.--limit-secondsvalues (< 1) inmain()viaparser.error(...)(exit2).tests/test_game_run_summary.py.Tested
python -I tests/test_game_run_summary.py -v->Ran 12 tests in 0.156s,OK.upstream/main(98c2f777) baseline worktree with updatedtests/test_game_run_summary.py->Ran 12 tests in 0.176s,FAILED (failures=4, errors=2)(all new regression checks fail before the fix).python -I tests/test_ci_registration.py->Ran 16 tests in 5.198s,OK.python -I tests/test_text_write_line_endings.py->Ran 3 tests in 12.859s,OK.python -I scripts/check_no_game_data.py tools/game_run_summary.py tests/test_game_run_summary.py-> exit0.python -I -m compileall -q tools/game_run_summary.py tests/test_game_run_summary.pyandgit diff --check-> exit0.GPUs tested: n/a (CPU/stdlib Python tests on Windows 11 x64)
AI-assisted: yes
Checklist
needs rebase).🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.