Title: Decode command-line source after interpreter startup by youknowdot · Pull Request #9495 · RustPython/RustPython · GitHub
Open Graph Title: Decode command-line source after interpreter startup by youknowdot · Pull Request #9495 · RustPython/RustPython
X Title: Decode command-line source after interpreter startup by youknowdot · Pull Request #9495 · RustPython/RustPython
Description: Summary Follow-up to merged #9494 for the Python 3.15 Lib/test/test_cmd_line update. Carry -c source as OsString until interpreter startup, filesystem-decode it without losing surrogate escapes, and emit cpython.run_command before conversion/dedent. Match the command-decoding stderr prefix and strict UTF-8 UnicodeEncodeError, including the original pre-dedent Unicode character range and adjacent surrogate ranges. Audit failures do not get the decoding prefix. Regenerate the canonical test with actual scripts/update_lib migrate, removing only test_undecodable_code's RustPython expected-failure marker. Its body and Windows skip, all other markers, and the explicit startup adapter are preserved. Rust embedding API: RunMode::Command now contains OsString rather than String, consistent with #9494's native argument transport. Valid commands now emit the audit event with the original decoded command plus CPython's appended newline before dedent. Validation Normal repository hooks: merge-conflict check, Ruff format/check, redundant-test-patch check, rustfmt and cspell passed. Locked/offline cargo check, strict Clippy (-D warnings) and CLI build passed with --no-default-features --features threading,stdlib,stdio,importlib,host_env,doc,ucd_3_2_0; actual VM compiler invocations retained opt-level 3. 34 bounded direct CLI observations: 17 fixed cases each on corrected RustPython and pinned CPython 3.15.0 (d220409a13b77de7a6c30abe16ea90db01528edc). Exact exit codes and stdout/stderr matched, including canonical undecodable source in C/C.UTF-8 with UTF-8 mode enabled, original multibyte-prefix error positions, adjacent surrogates, valid Unicode/dedent/line-ending controls, and both prior trailing-argument regression payloads. No original known-crashing interpreter was exercised. The final Lib change is one decorator line; canonical method/platform-guard AST matches upstream and all tested native source bytes remain unchanged. Rebased onto #9494's squash merge c2bb450316db3ce3dc4ddc6bcde9f3059ee4e90c: both parent trees and complete final trees are byte-identical to the validated stack. Existing native/runtime evidence is carried forward by this equivalence, not claimed as a fresh post-rebase run. Normal hooks were rerun after rebase. Limits These direct observations are not the full test_cmd_line/workspace/CAPI test suites. Audit-hook rejection priority is source-reviewed but not runtime-observed. Windows native-Unicode execution, -X utf8=0/non-UTF-8 locale parity and full dedent compatibility are not established. Existing filesystem encoding/dedent limitations are unchanged. No dependency pins or vendored parser changes are included. AI assistance is disclosed in the commit trailer. Summary by CodeRabbit Bug Fixes Improved handling of commands passed with -c: valid source is normalized before execution, and commands containing unsupported Unicode characters now produce a clearer encoding diagnostic.
Open Graph Description: Summary Follow-up to merged #9494 for the Python 3.15 Lib/test/test_cmd_line update. Carry -c source as OsString until interpreter startup, filesystem-decode it without losing surrogate escapes, a...
X Description: Summary Follow-up to merged #9494 for the Python 3.15 Lib/test/test_cmd_line update. Carry -c source as OsString until interpreter startup, filesystem-decode it without losing surrogate escapes, a...
Opengraph URL: https://github.com/RustPython/RustPython/pull/9495
X: @github
Domain: github.com
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:ccb802cf-e83c-65f6-d4d2-378e8a0d017c |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | C142:3DCD28:1595FBB:1C9D87E:6B01FE81 |
| html-safe-nonce | b5d7995ba5ae3d0085a4dc4ab422fd97e5165b3e63445ed7f115e8e9e9230d30 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDMTQyOjNEQ0QyODoxNTk1RkJCOjFDOUQ4N0U6NkIwMUZFODEiLCJ2aXNpdG9yX2lkIjoiNDEwNDIwMjQ1NTU3NzkxOTEwNSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 11d61ee2c029bfdddec29bb8775486773be676586b3f36914fbb6ed25c7dbc95 |
| hovercard-subject-tag | pull_request:5096801645 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/RustPython/RustPython/pull/9495/files |
| twitter:image | https://avatars.githubusercontent.com/u/336763669?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/336763669?s=400&v=4 |
| og:image:alt | Summary Follow-up to merged #9494 for the Python 3.15 Lib/test/test_cmd_line update. Carry -c source as OsString until interpreter startup, filesystem-decode it without losing surrogate escapes, a... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | 87e774ee7c6b3bee0490394e4d3e57ec9dbc956f74b87ea685dc8996c1676456 |
| turbo-cache-control | no-preview |
| diff-view | unified |
| go-import | github.com/RustPython/RustPython git https://github.com/RustPython/RustPython.git |
| octolytics-dimension-user_id | 39710557 |
| octolytics-dimension-user_login | RustPython |
| octolytics-dimension-repository_id | 135201145 |
| octolytics-dimension-repository_nwo | RustPython/RustPython |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 135201145 |
| octolytics-dimension-repository_network_root_nwo | RustPython/RustPython |
| turbo-body-classes | logged-out env-production page-responsive full-width |
| disable-turbo | true |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 423dbb54c5e7bfecc838eb387c1435eb3d0e760d |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width