diff options
| author | Jan Trencansky <jan.trencansky@protonmail.com> | 2026-11-24 20:09:32 -0500 |
|---|---|---|
| committer | Jan Trencansky <jan.trencansky@protonmail.com> | 2026-11-24 20:09:32 -0500 |
| commit | 100fed1b3d04cd84b4211ae6c1d5d3c5bdd9822d (patch) | |
| tree | 852bbc9fb39f4869afbedfffef2b1ee59e7859e8 /scripts | |
| parent | 68eee6b71a619f668b601e0f0b2e5fadbfec7b33 (diff) | |
#984's Python tools: encoding=, the stdout guard, and --help that writes no file
Three conventions main's tests enforce and #984's new tools missed (all three tests fail on #984's head):
- tests/test_text_encoding.py: tools/build_dstorage_history.py read its stamp and its base history, and tools/dstorage_census.py its trace, in the locale's code page. They name UTF-8 now.
- tests/test_tool_stdout_encoding.py: the __main__ blocks of build_dstorage_history.py, dstorage_census.py, gen_bcpack_runtime_tables.py and scripts/translate_pipeline_compute.py did not set errors='replace' on stdout.
- tests/test_tool_startup.py runs every tool with --help. gen_bcpack_runtime_tables.py took its first argument as the output path whatever it was, so the test passed and left a 61 KiB file named '--help' in the working directory. The tool has an argument parser now (the tables file, or --profile JSON OUT, as before); the generated tables are byte-identical.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Diffstat (limited to 'scripts')
| -rw-r--r-- | scripts/translate_pipeline_compute.py | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/scripts/translate_pipeline_compute.py b/scripts/translate_pipeline_compute.py index a7d70ab54..4e691110b 100644 --- a/scripts/translate_pipeline_compute.py +++ b/scripts/translate_pipeline_compute.py | |||
| @@ -167,4 +167,8 @@ def main(): | |||
| 167 | 167 | ||
| 168 | 168 | ||
| 169 | if __name__ == "__main__": | 169 | if __name__ == "__main__": |
| 170 | try: # a redirected stdout is strict ANSI code page under -I; write '?' for what it cannot encode | ||
| 171 | sys.stdout.reconfigure(errors="replace") | ||
| 172 | except AttributeError: | ||
| 173 | pass | ||
| 170 | sys.exit(main()) | 174 | sys.exit(main()) |