Repository navigation
Pin utf-8 on the two marker reads/writes added with the Vulkan backend - #7507
Merged
Merged
Conversation
test_shipping_code_names_an_encoding is red on main. #7373 added sync_marker_llama_backend, whose read_text/write_text pair does not name an encoding, so both fall back to locale.getencoding(): AssertionError: 2 text read/write call sites in shipping code let the operator's locale decide the encoding, so they crash or silently produce mojibake on Windows. Pass encoding = "utf-8": ['studio/install_llama_prebuilt.py:5656: write_text()', 'studio/install_llama_prebuilt.py:5647: read_text()'] Reproduced on a clean checkout of main at 7917c78: 1 failed, 7 passed. That guard landed in #7486 a few commits earlier, so the rule predates these call sites; nothing about the Vulkan work is wrong beyond the missing kwarg. The create path that writes the same file, 26 lines above at 5621, already passes encoding = "utf-8", so main is also internally inconsistent about one file: written as utf-8, read back under the operator locale. Scope, stated honestly: json.dumps defaults to ensure_ascii = True, so the marker this module writes is pure ASCII and round-trips under cp1252 as well as utf-8. The exposure is a marker produced or edited by something else. A decode failure on the read would not even surface, because UnicodeDecodeError subclasses ValueError and the surrounding except (OSError, ValueError) swallows it into the early return, leaving the backend silently unsynced. So this restores a green suite and makes the file self-consistent rather than fixing a live crash. Verified: tests/test_runtime_text_encoding.py 1 failed / 7 passed before, 8 passed after; tests/test_source_read_encoding.py still passes.
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
This was referenced Jul 28, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
test_shipping_code_names_an_encodingis red onmainright now, so Backend CI fails onmainitself and on every PR that merges it.Reproduced on a clean checkout of
mainat7917c7828: 1 failed, 7 passed.Cause
#7373 added
sync_marker_llama_backend, whoseread_text()/write_text()pair does not name an encoding, so both fall back tolocale.getencoding(). The guard that forbids this landed in #7486 a few commits earlier, so the rule predates the call sites; nothing about the Vulkan work is wrong beyond the missing kwarg.mainis also internally inconsistent about this one file. The create path 26 lines above, at line 5621, already writes it as utf-8:so
UNSLOTH_PREBUILT_INFO.jsonis written as utf-8 and read back under the operator locale.Scope
Stated plainly, because the guard's wording overstates it for these two particular call sites:
json.dumpsdefaults toensure_ascii = True, so the marker this module writes is pure ASCII and round-trips under cp1252 as well as utf-8. The real exposure is a marker produced or hand-edited by something else.A decode failure on the read would not even surface as a crash:
UnicodeDecodeErrorsubclassesValueError, and the surroundingexcept (OSError, ValueError)swallows it into the earlyreturn, leaving the backend silently unsynced.So this restores a green suite and makes the file self-consistent. It is not a fix for a live crash, and I would rather say that than imply otherwise.
Verification
tests/test_runtime_text_encoding.pytests/test_source_read_encoding.pypython -m py_compile studio/install_llama_prebuilt.pyclean. The diff is twoencoding = "utf-8"kwargs and nothing else.