Repository navigation
Fix UTF-8 startup option precedence and refresh canonical tests - #9422
youknowone merged 3 commits into
Conversation
Resolve the first explicit UTF-8 option before environment validation and align startup diagnostics with CPython 3.15. Refresh canonical encoding tests through update_lib and narrow the existing environment test failure to Windows. Support only monotonic expected-failure narrowing in updater metadata with focused regression tests. Assisted-by: OpenAI Codex: model version unavailable
|
Caution Review failedThe pull request is closed. Finishing Touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
📦 Library DependenciesThe following Lib/ modules were modified. Here are their dependencies: [x] test: cpython/Lib/test/test_utf8_mode.py (TODO: 5) dependencies: dependent tests: (no tests depend on utf8_mode) [x] test: cpython/Lib/test/test_c_locale_coercion.py dependencies: dependent tests: (no tests depend on c_locale_coercion) Legend:
|
Resolve explicit stdio encodings through CodecInfo.name before creating standard streams, matching CPython initialization. Preserve ordinary TextIOWrapper spelling and existing standard-stream error policies; leave canonical tests unchanged. Assisted-by: OpenAI Codex: model version unavailable
Merging this PR will not alter performance
Comparing Footnotes
|
The configured-codec normalization fix makes canonical test_stdio pass in both Linux CI attempts. Remove only its stale expectedFailure through update_lib, preserving canonical assertions and all other platform guards. Assisted-by: OpenAI Codex: model version unavailable
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Summary
Resolve the first explicit
-X utf8beforePYTHONUTF8, so an invalid environment value cannot override a valid command-line setting. Keep the Python3.15 UTF-8 default and empty-environment handling; align invalid-value diagnostics with pinned CPython.Refresh
test_utf8_modeandtest_c_locale_coercionusing the actualscripts/update_lib migratepipeline from CPython3.15.0d220409a13b77de7a6c30abe16ea90db01528edc.Narrow the existing
test_env_varexpected failure to Windows only. Its portable settings branches are source-reviewed; Windows still lacksPYTHONLEGACYWINDOWSFSENCODING, so that existing failure remains. Retire only the staletest_stdioexpected failure after repeated Linux CI unexpected successes; all four other existing markers and all reasons remain unchanged.Allow only monotonic narrowing of an existing unconditional expected failure through updater metadata, with same target/reason/order. Add focused updater tests rejecting new targets, reordered/duplicated markers, changed reasons, skip/success conversions and conditional broadening.
Normalize explicitly configured standard-stream encodings using the existing codec registry's
CodecInfo.name, as CPython does before stdio construction. OrdinaryTextIOWrapperkeeps its spelling behavior.Scope
No PEP538 process-locale initialization/coercion or Windows legacy filesystem encoding implementation. No changes to the already-enabled UTF-8 default or existing strict behavior for explicitly configured standard streams. The locale module's existing CPython-only coercion guard is preserved. Existing unguarded external-locale configuration behavior is not claimed fixed.
Validation
cargo check --locked --offline -j1 -p rustpython --lib --no-default-features --features threading,stdlib,stdio,importlib,host_env,doc,ucd_3_2_0passed.-- -D warningspassed.RustPython runtime suites for this branch have not run locally; the available executable belongs to another branch and does not validate this fix. This is not a full workspace/default-feature/CAPI or platform validation claim. The marker narrowing rests on explicit case-by-case settings-source review, not a claimed runtime pass. Hosted CI results are recorded below; this remains a draft for maintainer review.
CI follow-up
Initial CI on
d5b160a2d96bbaa0f77462ea3683ffc89c9a9a2dexposed the new canonicaltest_with_ioencodingfailure on macOS and Linux:PYTHONIOENCODING=UTF-8was retained literally instead of resolving to the canonicalutf-8codec name. The VM bootstrap fix follows pinned CPythonObjects/unicodeobject.cconfig_get_codec_name/init_stdio_encoding; it adds no test edits or skips. Ten bounded startup probes on the pinned CPython 3.15.0 binary verified alias names, error policies, empty/default values, and rejection of invalid codec names; these are oracle results, not a RustPython runtime pass. Follow-up commitd5341f63c274a1b5ab2d34b03e0cde1b7c651811: final-source focused check passed in 1m29s and strict Clippy in 1m37s, with both changed-source hashes verified and normal commit hooks passed. Correctness CI was pending at that follow-up; final-head results are recorded below.Passing-test marker retirement
After
d5341f63c274a1b5ab2d34b03e0cde1b7c651811, Linux correctness CI passedtest_c_locale_coercionand failed only because canonicaltest_stdiounexpectedly succeeded in both initial execution and rerun. Commit04b7a2682a827aecb98d44215a5065602f24413bremoves exactly its one stale decorator via actualupdate_lib migrate; assertions, all other guards and native code are unchanged. The test has the same three piped subprocess cases on all platforms and exercises the shared stdio bootstrap. Windows/macOS outcomes were not yet verified at retirement time; final-head CI results are recorded below. Normal hooks and all 224 updater tests passed. No additional Rust build or local RustPython runtime is claimed for this marker-only follow-up.Hosted CI status
Verified on final head
04b7a2682a827aecb98d44215a5065602f24413b: correctness CI run 40641575189 completed successfully with all 24 jobs passing, and dependency check 40641571678 also succeeded. The final hosted Linux, macOS, and Windows results now validate the normalization fix and stale-marker retirement in their configured suites. This does not establish the deliberately excluded process-locale or Windows legacy filesystem-encoding support, and does not change the no-local-RustPython-runtime limitation above. The PR remains a draft for maintainer review.