From 8624b9f9c58e065fe24d42eee16f8e26318e2419 Mon Sep 17 00:00:00 2001 From: Luna Date: Tue, 24 Nov 2026 16:23:58 +0100 Subject: [PATCH] native_pso_hashes: stdout gets the errors=replace guard (NATIVE-PSO-HASHES-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 --- tools/native_pso_hashes.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tools/native_pso_hashes.py b/tools/native_pso_hashes.py index 11af33342d..d6316be61b 100644 --- a/tools/native_pso_hashes.py +++ b/tools/native_pso_hashes.py @@ -115,4 +115,8 @@ def main(argv) -> int: if __name__ == "__main__": + try: # a redirected stdout is strict ANSI code page under -I; write '?' for what it cannot encode + sys.stdout.reconfigure(errors="replace") + except (AttributeError, ValueError, OSError): + pass sys.exit(main(sys.argv))