Repository navigation
Preserve native trailing command-line argument bytes - #9494
Conversation
Carry arguments and program names as OsString until Python filesystem decoding, and restore the canonical invalid UTF-8 argument test through update_lib. Keep remaining markers and startup adapters unchanged. Assisted-by: OpenAI Codex: model version unavailable
|
Caution Review failedThe pull request is closed.
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. |
📦 Library DependenciesThe following Lib/ modules were modified. Here are their dependencies: [ ] test: cpython/Lib/test/test_cmd_line.py (TODO: 12) dependencies: dependent tests: (no tests depend on cmd_line) Legend:
|
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. |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
Summary
OsStringinstead of rejecting them during CLI UTF-8 conversion.sys.argvandsys.orig_argvthrough the existing filesystem-decoding path; useargs_os()for original arguments and program-name initialization.CmdLineTest.test_invalid_utf8_argthroughscripts/update_lib migrate, retaining every other failure marker and the explicitRUSTPYTHONPATHadapter. No test assertion or payload changes.Based on main
8051c05ae4e100bf35eeb32044d3456d2546dc75, after #9492 landed. No dependency or Cargo.lock changes.Public Rust API change
Settings.argvchanges fromVec<String>toVec<OsString>andPaths.program_namefromStringtoOsString. Embedders assigning these public fields must convert their values (for example with.into()orOsString::from). This is not a source-compatible field-type change.Scope and limits
This fixes native-byte transport for trailing arguments and original-argument construction under RustPython's existing filesystem-decoding policy. It does not implement complete locale-dependent decoding, non-Unicode script/module selectors, invalid
-cdiagnostics, or invalidargv[0]compatibility. Those behaviors are not claimed by this PR. The undecodable-code expected-failure marker remains.Validation
cargo fmt --all -- --checkandgit diff --checkpassed.cargo checkand strictcargo clippy -- -D warningspassed for--bin rustpython --no-default-features --features threading,stdlib,stdio,importlib,host_env,doc,ucd_3_2_0with the unchanged lockfile.test_invalid_utf8_argpayloads under C.UTF-8/default, C locale,-X utf8, and-X utf8=0: eight candidate and eight pinned CPython 3.15.0 processes. Every process exited successfully without stderr;os.fsencode(sys.argv[1])andos.fsencode(sys.orig_argv[-1])matched the original bytes and the reference. Input manifests remained unchanged and all owned process groups exited.d220409a13b77de7a6c30abe16ea90db01528edc.The observations directly ran the bounded payload observer with
-B -S; they did not execute the original subprocess unittest harness, the entiretest_cmd_linemodule, the full workspace/CAPI suites, or Windows/macOS runtime tests. The reference was built with test extension modules disabled. CI remains the next cross-platform check, not proof of untested compatibility.AI-assisted implementation and validation; commit disclosure included.