Skip to content

Add per-parse runtime hooks for Unicode names and literal diagnostics - #9

Draft
youknowone wants to merge 1 commit into
RustPython:pr-7-runtime-basefrom
youknowdot:unicode-name-provider
Draft

youknowone wants to merge 1 commit into
RustPython:pr-7-runtime-basefrom
youknowdot:unicode-name-provider

Conversation

@youknowone

@youknowone youknowone commented Nov 13, 2026 •

Copy link
Copy Markdown
Member

Summary

Add borrowed UnicodeNameProvider and ParseRuntime hooks plus parse_unchecked_with_runtime, keeping existing parse APIs and options unchanged. Unicode preparation occurs at actual named-escape decoding, before name validation; successful literal decoding can dispatch VM warnings. No thread-local state or raw-source rescanning is used.

Decoder abort survives diagnostic checkpoints and suppresses subsequent runtime effects. Ordinary strings, outer f/t-string fragments, and immediate format-spec fragments follow distinct CPython 3.15 semantic-action boundaries. FormatSpecDecodeError preserves the distinction needed by downstream callers for bare Unicode errors.

Dependency and integration

Depends on #7, exact head cd0390f5cb46db24d4d64d133c2155a05727af54. The temporary base pr-7-runtime-base points to that commit. If #7 changes, this staging base becomes stale and must be reconciled. After #7 merges, retarget this PR to rustpython-0.17.5.

The rebase preserves the runtime-hook change without restoring #7's removed PEP 798 accepted-grammar extensions; those remain upstream work.

This is parser API work only: RustPython compiler/VM wiring and dependency updates are separate. Existing scalar-only AST surrogate replacement remains a limitation. This is not a claim of complete CPython equivalence.

Verification

After rebasing onto the reduced-scope #7, at head 71f341c445617704d514f0532a4aedd8122f3c7e:

  • 257 parser unit tests, 645 fixtures, one inline-generation test, 20 runtime integration tests, and 10 doctests passed.
  • Parser-only strict Clippy, all targets and features, with --no-deps passed; existing AST dependency cfg warnings remain.
  • Changed-file hooks passed.
  • Before this rebase, independent review and finite fresh-process CPython 3.15.2 oracle cases checked syntax/import/warning precedence, recovery, adjacent literals, f/t fragments, and format specifications. The runtime-hook commit is unchanged by the rebase (range-diff matched); the finite oracle comparison was not rerun for this head. Full Ruff workspace and downstream runtime integration were not tested.

AI assistance: OpenAI Codex implemented and reviewed this change.

@coderabbitai

coderabbitai Bot commented Nov 13, 2026

Copy link
Copy Markdown

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true
  • 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.

Share

Keep decoder failures across diagnostic backtracking and dispatch literal warnings in grammar action order. Preserve format-spec exception provenance and retain standalone parser behavior.

Assisted-by: Codex:gpt-6.1-sol

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants