Skip to content

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

Closed
Luna-OS wants to merge 1 commit into
ProjectLeonida:mainfrom
Luna-OS:fix/native-pso-hashes-help
Closed

Luna-OS wants to merge 1 commit into
ProjectLeonida:mainfrom
Luna-OS:fix/native-pso-hashes-help

Conversation

@Luna-OS

@Luna-OS Luna-OS commented Nov 24, 2026 •

Copy link
Copy Markdown

Claimed in the coordination issue as: NATIVE-PSO-HASHES-HELP (#14 (comment))

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

@LewisStephens99

Copy link
Copy Markdown

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.

…ASHES-HELP)

The --help half landed in 116de82; tests/test_tool_stdout_encoding.py still
listed this tool as missing the __main__ stdout guard.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Luna-OS
Luna-OS force-pushed the fix/native-pso-hashes-help branch from 82b118b to 8624b9f Compare November 24, 2026 15:24
@Luna-OS Luna-OS changed the title native_pso_hashes: --help exits 0 and stdout gets the errors=replace guard (NATIVE-PSO-HASHES-HELP) native_pso_hashes: stdout gets the errors=replace guard (NATIVE-PSO-HASHES-HELP) Nov 24, 2026
@Luna-OS

Luna-OS commented Nov 24, 2026

Copy link
Copy Markdown
Author

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 MoonEyes left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

  • 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

Copy link
Copy Markdown
Collaborator

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).

@aslan2142 aslan2142 closed this Nov 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants