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#4875
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/4011
Author: @SuperDistance
Created: 10/24/2026
Status: ❌ Closed
Base:
main← Head:pr/bench-utf8📝 Commits (2)
ae5aa79tools/strata_bench.py: read CMakeLists.txt as UTF-8, not with the locale's code page (#2792)ffa5ac5tools/strata_bench.py: name no locale; the test reads the version under every Windows ANSI code page📊 Changes
2 files changed (+20 additions, -1 deletions)
View changed files
📝
tools/strata_bench.py(+2 -1)📝
tools/test_strata_bench.py(+18 -0)📄 Description
Problem and result
tools/strata_bench.py(BENCH.bat,./bench.sh) readsCMakeLists.txtwithPath.read_text()and no encoding. On Windows, Python then decodes the file with the locale's code page instead of UTF-8.CMakeLists.txtis UTF-8 and has non-ASCII text (line 3), so on many Windows locales the benchmark stops with aUnicodeDecodeErrorbefore it measures anything. On this PC (Windows 11, code page 936) the 0.2.4.1 tool stopped with'gbk' codec can't decode byte 0xa7 in position 74. With this change the file is read as UTF-8 whatever the locale, and the tool runs.How main 7dd5cf18's
CMakeLists.txtreads under each Windows ANSI code page (its bytes decoded with Python 3.12):UnicodeDecodeError: cp874, cp936, cp949, cp950, cp1253, cp1255, cp1257, cp1258.Linux and macOS default to UTF-8 and are not affected.
Related discussion
Fixes #2792 (Lithivm, closed in the 0.2.0 tracker reset; the bug is still in main
7dd5cf18). This is the fix suggested there, and the same readsetup.pyalready does:(ROOT / "CMakeLists.txt").read_text(encoding="utf-8").Approach
project_version()passesencoding="utf-8". The file's other reads already pass an encoding; the two without one read/proc/meminfoand/proc/cpuinfoon Linux.tools/test_strata_bench.py: a test that makesPath.read_textdefault to each of the 14 Windows ANSI code pages in turn. It writes aCMakeLists.txtwith non-ASCII text and expects the version back under every one.Validation
Passed:
python tools/test_strata_bench.pyon main7dd5cf18+ this PR (ffa5ac5e), Windows 11, Python 3.12.14: 18 tests OK.strata_bench.pyfails under 5 of the 14 code pages (cp874, cp932, cp936, cp949, cp950), each with aUnicodeDecodeError. Its sample text differs from the real file's line 3, so the code pages that fail differ from the list above.PYTHONUTF8:project_version()returns0.1.49.2with this change, and raisesUnicodeDecodeError: 'gbk' codec can't decode byte 0xa7 in position 74with main's file. Earlier, withPYTHONUTF8=1(the workaround from #2792), the 0.2.4.1 tool ran to the end against a local server on 2x RTX 5090.Failed: none observed.
Not run: Windows set to the other code pages (they were checked only by decoding the file, as above); a full benchmark run with this change (only
project_version()touches the file).Limits
None known. Only the version string read changes.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.