Title: Align Windows code-page codec errors with CPython by youknowdot · Pull Request #9849 · RustPython/RustPython · GitHub
Open Graph Title: Align Windows code-page codec errors with CPython by youknowdot · Pull Request #9849 · RustPython/RustPython
X Title: Align Windows code-page codec errors with CPython by youknowdot · Pull Request #9849 · RustPython/RustPython
Description: Summary Group Windows code-page codec compatibility fixes with the shared encoder error-handler validation they depend on: Preserve lone surrogates on the Windows UTF-16 input path (including UTF-7), and restore the upstream test_cp_utf7 test. Match CPython 3.15 whole-input strict error ranges (0..0) instead of inventing a failing-character range. Replace bespoke Windows encode/decode handler plumbing with the existing codec contexts. This preserves handler replacement/restart validation, registered handlers, and mutated decoder exception objects. Match CPython encoder handler __index__ conversion precedence and negative/overflow restart errors. Propagate unexpected Windows conversion failures instead of treating all OS failures as encoding errors. Route mbcs/OEM aliases through the same conversions, as CPython does, instead of silently ignoring handler/final arguments. Preserve original input length for final=True consumed results. This removes substantially more Windows-specific code than it adds. Regression cases extend the existing codec snippet; upstream tests are not duplicated or rewritten. Reference: CPython 3.15 Objects/unicodeobject.c, unicode_encode_call_errorhandler, encode_code_page_errors, decode_code_page_errors, and the Windows wchar decoder error handler. Independent source review also checked the deliberate surrogate-pair joining of the wchar decoder path. Validation so far Linux release build succeeded. -m test test_codecs: 288 tests, 14 existing platform/feature skips, passed. Adjacent test_codeccallbacks: 43 passed; test_str: 139 tests, 11 skips, passed. Existing stdlib_codecs_wide.py including new cases passed on RustPython and CPython 3.15; focused pytest: 2 passed. The new negative restart regression fails on the unmodified main binary (unsigned-wrapped position) and passes with this change. Workspace all-target Clippy completed; only existing must_use_candidate warnings in unmodified root entrypoints. Formatting, lint, and repository commit hooks passed. Windows GNU VM cross-check passed using Zig CC (with unrelated existing nt/os unused warnings). Full pytest under CPython 3.15 completed: 494 passed, 21 failed, 15 subtests passed. Failures are unavailable _ctypes/_lzma/_sqlite3 modules and sandbox-restricted OS/socket/multiprocessing operations. C-API tests: 149 passed, 2 ignored; C-API Clippy passed. Workspace unit tests were attempted but stopped during optimized compilation when the workspace ran out of disk space; no unit-test success is claimed. The stopped build’s new incomplete incremental artifacts were cleaned, without touching other work. The Windows-only while-let lint found by CI was fixed in the latest head; its CI rerun is pending. Real Windows execution and performance are not yet verified; keep this draft until CI establishes those results. The Linux skips are not evidence that Windows behavior passed.
Open Graph Description: Summary Group Windows code-page codec compatibility fixes with the shared encoder error-handler validation they depend on: Preserve lone surrogates on the Windows UTF-16 input path (including UTF-...
X Description: Summary Group Windows code-page codec compatibility fixes with the shared encoder error-handler validation they depend on: Preserve lone surrogates on the Windows UTF-16 input path (including UTF-...
Opengraph URL: https://github.com/RustPython/RustPython/pull/9849
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:32ab787c-fba7-d2db-f380-13842f95cd4a |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | 8830:22DB35:370D03B:463F7E9:6B01DE70 |
| html-safe-nonce | 74be7c644375b2836d2d42c35ecaf019baa1fe9b69521a55737b75acbf7f6970 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4ODMwOjIyREIzNTozNzBEMDNCOjQ2M0Y3RTk6NkIwMURFNzAiLCJ2aXNpdG9yX2lkIjoiMTMyNjU4Mzg4NzYzMTA4MTA3MiIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | b50b84f6d2d47e27c6cbd30fcaf1851c0f84b7e7058c2227e359b79bd0f69ab1 |
| hovercard-subject-tag | pull_request:5320349323 |
| 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/9849/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 Group Windows code-page codec compatibility fixes with the shared encoder error-handler validation they depend on: Preserve lone surrogates on the Windows UTF-16 input path (including UTF-... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | cc5dfdd32f62ebd3223cab3af3aa2b268d3605218237326a48a99d1efd89495c |
| 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 | 8c77c9e8439031ad54c75a250694842892f693e1 |
| ui-target | canary-2 |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width