mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
Labels
No labels
needs-format
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Niko1221/Strata#4310
Loading…
Add table
Add a link
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/Niko1221/Strata/pull/2879
Author: @ctr-137
Created: 10/17/2026
Status: ❌ Closed
Base:
main← Head:bench-readtext-encoding📝 Commits (1)
cafa126tools: read CMakeLists.txt as UTF-8, not through the OS code page (#2792)📊 Changes
2 files changed (+37 additions, -1 deletions)
View changed files
📝
tools/strata_bench.py(+4 -1)📝
tools/test_strata_bench.py(+33 -0)📄 Description
tools/strata_bench.py:564read this install's ownCMakeLists.txtwith noencoding=, so the decode wentthrough
locale.getpreferredencoding(). That is GBK or cp932 on a Chinese or Japanese Windows, where thefile's UTF-8 BOM is not a valid sequence - the third byte
0xbf- andBENCH.batdied before anymeasurement:
setup.pyreads the same file withencoding="utf-8", so this is an omission here rather than anintentional locale dependency.
A cp1252 machine decodes the BOM to mojibake and says nothing, which is why only those two locales ever saw
it - and why this needs a test rather than a reproducer.
What I changed
tools/strata_bench.py: read it asutf-8-sig. That matches how this file already reads its other repo andconfig files (lines 657, 688, 971), and it strips the BOM the file actually has rather than leaving a
in front of the string the regex scans.What I left alone
/proc/meminfoand/proc/cpuinfoare still read withoutencoding=. They are the Linux-only branchand their content is ASCII whatever the locale, so I did not touch them.
project_version()still catches onlyOSError. A repo file that is unreadable for any other reasonstill reaches the top of
main()as a traceback and leaves a started server behind, which the report alsonotes.
UnicodeDecodeErroris aValueError, so widening that except would cover it - but what thebench should do with an unreadable install is a separate decision and I did not want to bundle it here.
How I checked
Three tests in
tools/test_strata_bench.py, no GPU or server needed:project_version()passes is captured and has to be a UTF-8 one, so a future call thatsilently goes back to the code page fails;
reported failure;
utf-8-sigread of the file.With the fix reverted the first of them fails (
encoding=''), with it all 20 tests intools/test_strata_bench.pypass (python -m unittest tools.test_strata_bench).The reporter's workaround (
set PYTHONUTF8=1) still works and is no longer needed.Fixes #2792.
🤖 Generated with Claude Code
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.