Repository navigation
Implement CPython 3.15 Expat public error metadata - #9493
Conversation
Populate the canonical error constants and bidirectional mappings, implement C-long-to-int ErrorString lookup, and restore the canonical metadata test through update_lib. Assisted-by: OpenAI Codex: model version unavailable
|
No actionable comments were generated in the recent review.
|
| Layer / File(s) | Summary |
|---|---|
Error metadata and lookup crates/stdlib/src/pyexpat.rs |
The module initializes and registers pyexpat.errors with Expat error constants and dictionaries. ErrorString(code) converts the input and returns the matching message, or None when the index is outside the table. |
Estimated code review effort: 2 (Simple) | ~10 minutes
Change: Feature
Possibly related issues
RustPython/RustPython#6839— This change updates pyexpat error metadata as one part of the broader standard-library update tracked by the issue.
Suggested reviewers: youknowone, 1ndahous3
Merge Risk: 
Minimal · up to e09c4
-
No concrete merge-blocking issue is established for the pyexpat error-metadata changes. Mergeability remains subject to normal checks passing.
Pre-merge checks: 
4 · 
1
-
Failed checks: 1 warning Passed checks: 4 passedFull details: Docstring Coverage
-
Explanation
Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 3 functions across 1 files.
Resolution
Write docstrings for the functions missing them to satisfy the coverage threshold.
-
Finishing Touches
-
🧪 Generate unit tests (beta)
-
- Create a new PR
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
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.
Comment @coderabbitai help to get the list of available commands.
📦 Library DependenciesThe following Lib/ modules were modified. Here are their dependencies: [x] lib: cpython/Lib/xml dependencies:
dependent tests: (39 tests)
Legend:
|
Merging this PR will not alter performance
Comparing Footnotes
|
Retire expected-failure markers demonstrated obsolete on macOS, Ubuntu and Windows by CI 41112774656, including ElementTree's inherited C variant. Restore both canonical methods via update_lib without changing assertions or other adaptations. Assisted-by: OpenAI Codex: model version unavailable
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
Implement the public
pyexpaterror metadata API from CPython 3.15.0:errors.XML_ERROR_*messages and thecodes/messagesmappings.ErrorStringusing index conversion, platform C-long bounds and C-int narrowing, independently of mutable public dictionaries.pyexpat.errorssubmodule, preserving the existingerror is ExpatErroralias.scripts/update_lib migrateto restore canonicalErrorMessageTest.test_codes,ErrorMessageTest.test_expaterrorandParseErrorTest.test_error_code(also inherited bytest_xml_etree_c); all unrelated adaptations and markers remain.Source reference: CPython 3.15.0
Modules/pyexpat.cat d220409a13b77de7a6c30abe16ea90db01528edc. All 44 table messages also match the bundled ExpatXML_ErrorString. This is metadata compatibility, not an assertion that the backend implements every named error condition.Validation
cargo check, strict Clippy and fresh CLI build passed for the final source. Two earlier Rust typing failures were fixed and retained in local receipts.-B -Sprocesses produced 76 identical metadata records per engine against the pinned CPython 3.15.0 reference: all constants/maps, module and exception aliases, valid/invalid scalar codes, index conversion, C-long overflow/C-int narrowing, argument shape and lookup independence from mutable dictionaries.test_expaterrorand both ElementTree error-code variants were unexpected successes on the initial run and rerun. This follow-up retires those two obsolete decorators through the actual updater; the new commit still awaits CI. Local observations are not full canonical/parser coverage.Scope
No parser construction/feed/state, XML backend or dependency changes. Repeated parsing, encoding resolution, namespace ordering and parser lifecycle behavior are unchanged. The canonical test module constructs a parser in a decorator during import, so its tests are reserved for hosted CI rather than included in metadata-only local observations. No new snippets or Rust tests executing Python behavior.
Summary by CodeRabbit
pyexpat.errors.pyexpat.ErrorString(code)to retrieve the message associated with an error code. It returnsNonewhen the code does not correspond to an available error message. These additions make Expat parser errors accessible through the Python module’s public interface.