Title: Add Python 3.15 encoding normalization helper by youknowdot · Pull Request #9115 · RustPython/RustPython · GitHub
Open Graph Title: Add Python 3.15 encoding normalization helper by youknowdot · Pull Request #9115 · RustPython/RustPython
X Title: Add Python 3.15 encoding normalization helper by youknowdot · Pull Request #9115 · RustPython/RustPython
Description: I did not use AI to write the code of this patch. This PR follows our AI policy, using the maintainer exemption. Summary Extract the native _codecs._normalize_encoding helper from #8954, alongside the final Python 3.15 encodings.normalize_encoding delegation. Preserve ASCII case and dots, collapse other UTF-8 bytes to interior underscores, and validate the whole string before stopping normalization at NUL. Accept string subclasses and the encoding= keyword. The Python wrapper retains its existing non-ASCII deprecation warning and ASCII bytes support. Main already has that warning and the cache bound; this is not presented as a fix for an email warning. Registry lookup normalization/error messages are unchanged. No IDNA, punycode, bytearray, or other encoding module changes. CPython provenance Only Lib/encodings/__init__.py was updated, using the repository's actual exact-file workflow: python3 scripts/update_lib migrate /workspace/shared/cpython-315-final/Lib/encodings/__init__.py Source: CPython d220409a13b77de7a6c30abe16ea90db01528edc. Input and generated output are byte-identical: SHA256: 849a5e31effe6c647b6d526b92f2f063a67fac36e7750267f721f15e3693de08 Git blob: 169c48324f227bf51b88d8b2e1a6a9df39067533 The supported migrate command was chosen because copy-lib resolves the top-level package and would copy all of encodings. No manual Lib edits or new test skips were used. Native behavior was source-reviewed against final CPython _codecsmodule.c:1025–1062 and unicodeobject.c:3465–3513. Validation Passed: narrow release build, cargo build --release --locked --no-default-features --features threading,stdlib,stdio,importlib,host_env --bin rustpython -j 1. Passed: the new assertions appended to stdlib_codecs_wide.py, extracted by AST into a bounded script and run on the candidate RustPython binary with a 30-second timeout. The candidate encodings.__file__ was asserted. Covers positional/keyword/subclass binding, argument errors, case/dot preservation, punctuation collapse, Unicode, NUL, surrogate-after-NUL validation, native warning absence, and wrapper warning/bytes behavior. Passed: strict VM Clippy, cargo clippy --release --locked -p rustpython-vm --no-default-features --features compiler,threading,host_env -j 1 -- -D warnings. Passed: normal configured pre-commit hooks during the local commit (merge conflicts, ruff format/check, rustfmt, cspell). Independently source-reviewed the exact patch and update_lib provenance. Not run: the pre-existing whole codec snippet, pytest/full snippet suite, full codecs test suites, workspace/C-API tests, all-target Clippy, WASM, or a CPython 3.15 runtime oracle. These are focused automated results, not full-suite or platform validation. AI assistance OpenAI Codex extracted and source-reviewed the implementation, ran the library update tool, wrote bounded regression assertions, and performed the automated checks listed above. This contribution is made under the maintainer exemption. No human manual testing is claimed.
Open Graph Description: I did not use AI to write the code of this patch. This PR follows our AI policy, using the maintainer exemption. Summary Extract the native _codecs._normalize_encoding helper from #8954, alongsid...
X Description: I did not use AI to write the code of this patch. This PR follows our AI policy, using the maintainer exemption. Summary Extract the native _codecs._normalize_encoding helper from #8954, alongsid...
Opengraph URL: https://github.com/RustPython/RustPython/pull/9115
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:13f16085-6c71-6249-546e-1f51e3712f9a |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | B63C:2E7EBB:3E026AD:4E7C81D:6B020366 |
| html-safe-nonce | c66d8230b4d845ba8de8b883b0855cc100355303245f9a2c94ea6fb7c9cdedec |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCNjNDOjJFN0VCQjozRTAyNkFEOjRFN0M4MUQ6NkIwMjAzNjYiLCJ2aXNpdG9yX2lkIjoiMjg2NjIxMTM0NTQ4ODAyMDMyNiIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 887b9316cd9466cc7f1c67f823e497941a9d6b60c755b864189ce1e092e16552 |
| hovercard-subject-tag | pull_request:4856956094 |
| 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/9115/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 | I did not use AI to write the code of this patch. This PR follows our AI policy, using the maintainer exemption. Summary Extract the native _codecs._normalize_encoding helper from #8954, alongsid... |
| 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