Title: Support Python single-byte codecs in pyexpat by youknowone · Pull Request #9938 · RustPython/RustPython · GitHub
Open Graph Title: Support Python single-byte codecs in pyexpat by youknowone · Pull Request #9938 · RustPython/RustPython
X Title: Support Python single-byte codecs in pyexpat by youknowone · Pull Request #9938 · RustPython/RustPython
Description: Summary Support Python single-byte text codecs in pyexpat, including the ISO-8859, Windows code-page, KOI8 and Mac codec families exercised by CPython 3.15.2. Build and validate Expat-style 256-entry maps through Python's codec registry, then decode lazily on the XML reader rather than rewriting complete documents. Preserve declared versus explicit encoding lookup order, XML-declaration callbacks, BOM/preamble handling, terminal codec failures and original-byte position accounting. Share the bridge between threaded and synchronous readers without calling Python from the parser thread. Remove nine stale expected-failure markers, enabling ten test occurrences across pyexpat, both ElementTree implementations and XML-RPC. Add one focused custom-codec/streaming regression to the existing XML snippet. This is independent of #9662's DTD/entity work and does not implement missing namespace, DTD, external-entity or amplification-accounting features. Validation Relevant canonical modules: test_pyexpat test_xml_etree test_xml_etree_c test_sax test_minidom test_plistlib: 979 tests, 36 skips, success (remaining unrelated expected failures retained). Existing stdlib_xml.py snippet passes on RustPython and CPython 3.15.2. cargo test -p rustpython-stdlib --lib: 64 passed, 0 failed or ignored. 43 custom-codec differential cases exercised with the threaded reader and post-fork synchronous fallback. Exception classes match CPython; callback/codec ordering matches except the pre-existing xml-rs buffered-text loss immediately before invalid input. Workspace Rust/doc tests excluding wasm, venvlauncher and C-API: 1,619 passed, 21 ignored. Workspace Clippy succeeded; final scoped Clippy succeeded after resolving local style warnings (existing wasi-host manifest / VM warnings remain). Final exact-commit binary reran all six canonical modules, the XML snippet and both differential-reader paths successfully. Eight alternating development-build smoke benchmark pairs for ordinary UTF-8 parsing: baseline median 0.16883s, candidate 0.16613s. This is a non-regression smoke check, not a release-profile speedup claim. Exact CPython diagnostic parity is not claimed: existing event positions and mixed UTF-16-header/single-byte-body column behavior still differ. No synthetic markup or test weakening hides those limitations. Windows/macOS/WASI execution and C-API tests have not been performed locally; C-API work is deferred. AI disclosure: implementation, review and validation were assisted by OpenAI Codex; the exact model identifier is unavailable in this session. Maintainer review remains pending. CI follow-up The first head exposed three additional XML-RPC encoding XPASS cases on Linux, macOS and Windows. Their obsolete expected-failure markers are removed in 25cc0ba; all 94 XML-RPC tests pass locally with walltime resources enabled. The updated XML snippet passes both RustPython and CPython 3.15.2 through the pytest harness (2 passed). The review-bot suggestion to return None explicitly for unrecognized codec names is addressed. The first Windows run also failed the unrelated asyncio SSL shutdown/backpressure test with “the transport never paused writing”, including its retry. This is not claimed fixed by the XML change; a separate investigation is underway. Checks after failed Python suites were skipped. Rust tests, Clippy, Miri and WASI checks passed on the first head. CodSpeed's benchmark build/execution and pyperformance were skipped, so there is no hosted performance measurement. CI for the updated head is pending.
Open Graph Description: Summary Support Python single-byte text codecs in pyexpat, including the ISO-8859, Windows code-page, KOI8 and Mac codec families exercised by CPython 3.15.2. Build and validate Expat-style 256-en...
X Description: Summary Support Python single-byte text codecs in pyexpat, including the ISO-8859, Windows code-page, KOI8 and Mac codec families exercised by CPython 3.15.2. Build and validate Expat-style 256-en...
Opengraph URL: https://github.com/RustPython/RustPython/pull/9938
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:192a94f4-85dc-09ab-68e0-7e43f561a664 |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | CD0A:A70A9:F2A20E:1413A44:6B01D7F6 |
| html-safe-nonce | 08d7a218a82a5427845e464443bb8f5b23a643542438204c1ea63fa2b96b6a53 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDRDBBOkE3MEE5OkYyQTIwRToxNDEzQTQ0OjZCMDFEN0Y2IiwidmlzaXRvcl9pZCI6Ijc1NDE0MTk3ODQxOTQzNDkwNDYiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 7ebbcbd64c103b275867f92be975444331444bdc0dcd86b69249e9ae76d68b5f |
| hovercard-subject-tag | pull_request:5373588222 |
| 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/9938/files |
| twitter:image | https://avatars.githubusercontent.com/u/69878?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/69878?s=400&v=4 |
| og:image:alt | Summary Support Python single-byte text codecs in pyexpat, including the ISO-8859, Windows code-page, KOI8 and Mac codec families exercised by CPython 3.15.2. Build and validate Expat-style 256-en... |
| 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 | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width