native_pso_hashes: stdout gets the errors=replace guard (NATIVE-PSO-HASHES-HELP) #883

Closed
Luna-OS wants to merge 1 commit from upstream-pr/883 into main
Luna-OS commented 2026-11-24 14:55:24 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by Luna-OS on 2026-11-24T14:55:24Z.


Claimed in the coordination issue as: NATIVE-PSO-HASHES-HELP (https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7135144377)

What and why

tests/test_tool_stdout_encoding.py requires every tool's __main__ block to set errors="replace" on stdout, and it fails on main because tools/native_pso_hashes.py has no guard:

- ['tools/native_pso_hashes.py']
+ [] : programs whose __main__ block doesn't set errors='replace' on stdout

This adds the same guard the other tools use. (The --help half of the original claim landed separately in 116de82, so this PR was rebased down to the guard.)

Tested

Windows 11, Python 3.13.7, no game files: tests/test_tool_stdout_encoding.py OK (was 1 failure), tests/test_native_pso_hashes.py OK.

GPUs tested: n/a

AI-assisted: yes (Claude Code)

Checklist

  • Based on current main and merges cleanly.
  • One topic.
  • No game data, keys or decryption.
  • No translator rule changed.

🤖 Generated with Claude Code

<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5474564528 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/883). Originally posted by [Luna-OS](https://github.com/Luna-OS) on 2026-11-24T14:55:24Z. --- Claimed in the coordination issue as: NATIVE-PSO-HASHES-HELP (https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7135144377) ### What and why `tests/test_tool_stdout_encoding.py` requires every tool's `__main__` block to set `errors="replace"` on stdout, and it fails on `main` because `tools/native_pso_hashes.py` has no guard: ``` - ['tools/native_pso_hashes.py'] + [] : programs whose __main__ block doesn't set errors='replace' on stdout ``` This adds the same guard the other tools use. (The `--help` half of the original claim landed separately in 116de82, so this PR was rebased down to the guard.) ### Tested Windows 11, Python 3.13.7, no game files: `tests/test_tool_stdout_encoding.py` OK (was 1 failure), `tests/test_native_pso_hashes.py` OK. GPUs tested: n/a AI-assisted: yes (Claude Code) ### Checklist - [x] Based on current `main` and merges cleanly. - [x] One topic. - [x] No game data, keys or decryption. - [x] No translator rule changed. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
LewisStephens99 commented 2026-11-24 15:06:54 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by LewisStephens99 on 2026-11-24T15:06:54Z.


Independent verification on Windows 11, Python 3.14:n- python -I tests/test_tool_startup.py: 2/2 passed.n- python -I tests/test_native_pso_hashes.py: 9/9 passed.n- python -I tools/native_pso_hashes.py --help: exits 0 and prints usage.n`nNo game files or GPU used. AI-assisted.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7135481896 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/883#issuecomment-7135481896). Originally posted by [LewisStephens99](https://github.com/LewisStephens99) on 2026-11-24T15:06:54Z. --- Independent verification on Windows 11, Python 3.14:`n- `python -I tests/test_tool_startup.py`: 2/2 passed.`n- `python -I tests/test_native_pso_hashes.py`: 9/9 passed.`n- `python -I tools/native_pso_hashes.py --help`: exits 0 and prints usage.`n`nNo game files or GPU used. AI-assisted.
Luna-OS commented 2026-11-24 15:24:06 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by Luna-OS on 2026-11-24T15:24:06Z.


Rebased on main: the --help half (and its test) landed separately in 116de82, so this PR now only adds the __main__ stdout guard that tests/test_tool_stdout_encoding.py still reports as missing. Re-checked: test_tool_stdout_encoding.py and test_native_pso_hashes.py both OK on Windows 11 / Python 3.13.7.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7135962903 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/883#issuecomment-7135962903). Originally posted by [Luna-OS](https://github.com/Luna-OS) on 2026-11-24T15:24:06Z. --- Rebased on main: the `--help` half (and its test) landed separately in 116de82, so this PR now only adds the `__main__` stdout guard that `tests/test_tool_stdout_encoding.py` still reports as missing. Re-checked: `test_tool_stdout_encoding.py` and `test_native_pso_hashes.py` both OK on Windows 11 / Python 3.13.7.
MoonEyes commented 2026-11-24 16:12:03 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-11-24T16:12:03Z.

Review: APPROVED


LGTM. Measured on Windows 11, Python 3.14, against current main 0af7753c0:

  • main: python -I tests/test_tool_stdout_encoding.py fails with ['tools/native_pso_hashes.py'] != []. On CI, this is the only real failure in the stdlib-tests-linux and macos-python jobs of main (run 45369028646; on that older commit, the list was exe_sha / pr_conflict_label, fixed since by #605).
  • main + this PR (merged locally, no conflict): test_tool_stdout_encoding.py OK, test_native_pso_hashes.py OK, and tools/native_pso_hashes.py --help exits 0.

The guard is the same try: sys.stdout.reconfigure(errors="replace") block the other tools use, and only __main__ changes.

AI-assisted: yes (Claude Code ran the measurements; I checked them).

<!-- greyfinch-sync:ubiquitarianism/leonida:review:6042985816 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/883#pullrequestreview-6042985816). Originally posted by [MoonEyes](https://github.com/MoonEyes) on 2026-11-24T16:12:03Z. **Review:** APPROVED --- LGTM. Measured on Windows 11, Python 3.14, against current `main` 0af7753c0: - main: `python -I tests/test_tool_stdout_encoding.py` fails with `['tools/native_pso_hashes.py'] != []`. On CI, this is the only real failure in the `stdlib-tests-linux` and `macos-python` jobs of main (run 45369028646; on that older commit, the list was `exe_sha` / `pr_conflict_label`, fixed since by #605). - main + this PR (merged locally, no conflict): `test_tool_stdout_encoding.py` OK, `test_native_pso_hashes.py` OK, and `tools/native_pso_hashes.py --help` exits 0. The guard is the same `try: sys.stdout.reconfigure(errors="replace")` block the other tools use, and only `__main__` changes. AI-assisted: yes (Claude Code ran the measurements; I checked them).
aslan2142 commented 2026-11-24 16:50:24 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by aslan2142 on 2026-11-24T16:50:24Z.


Thanks for the fix. I'm closing this in favour of #948, which claimed the same change first:

If I missed an earlier claim of yours, say so here and I'll reopen it.

AI-assisted (Claude Code, Claude Opus 5.5).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7138286254 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/883#issuecomment-7138286254). Originally posted by [aslan2142](https://github.com/aslan2142) on 2026-11-24T16:50:24Z. --- Thanks for the fix. I'm closing this in favour of #948, which claimed the same change first: - reece-barker claimed the stdout guard for `tools/native_pso_hashes.py` in #14 at 13:51 UTC, an hour before `NATIVE-PSO-HASHES-HELP` was claimed at 14:54 UTC: https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7133439528 - The `--help` half of `NATIVE-PSO-HASHES-HELP` was already covered by #776, merged at 14:37 UTC. - This PR contains only the stdout guard, and #948 has the same four lines. If I missed an earlier claim of yours, say so here and I'll reopen it. AI-assisted (Claude Code, Claude Opus 5.5).

Pull request closed

Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
ProjectLeonida/mandy!883
No description provided.