fix(test): read add_contributor.py with explicit UTF-8 encoding - #79490
Closed
a0000001 wants to merge 1 commit into
Closed
fix(test): read add_contributor.py with explicit UTF-8 encoding#79490a0000001 wants to merge 1 commit into
a0000001 wants to merge 1 commit into
Conversation
test_cli_entrypoint_end_to_end copies add_contributor.py with read_text()/write_text() and no encoding argument, so both fall back to the system locale. add_contributor.py contains UTF-8 multi-byte characters (an em dash), which makes the read raise UnicodeDecodeError on any non-UTF-8 Windows locale (observed on cp950 / Traditional Chinese). The trailing mapping-file read gets the same treatment for symmetry. Same footgun class as the subprocess text=True sweep in NousResearch#60741, just on the pathlib read_text/write_text side. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
This was referenced Aug 7, 2026
Contributor
|
Merged in #81965 — clean cherry-pick with authorship. Thanks! |
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.
What
test_cli_entrypoint_end_to_endcopiesadd_contributor.pywithread_text()/write_text()and no encoding argument, so both fall back to the system locale.Why
add_contributor.pycontains UTF-8 multi-byte characters (an em dash), so the read raisesUnicodeDecodeErroron any non-UTF-8 Windows locale — reproduced on cp950 (Traditional Chinese Windows), where this test fails on every run. The trailing mapping-file read gets the same treatment for symmetry.Same footgun class as the
subprocess text=Truesweep in #60741, just on the pathlibread_text/write_textside.Verification
pytest tests/scripts/test_contributor_map.py— 7/7 pass on a cp950-locale Windows host (previously 1 failed).🤖 Generated with Claude Code