Skip to content

Complete PEP 798 unpacking operands and diagnostics - #7

Draft
youknowdot wants to merge 1 commit into
RustPython:rustpython-0.17.1from
youknowdot:pep798-unpacking-operands-315
Draft

youknowdot wants to merge 1 commit into
RustPython:rustpython-0.17.1from
youknowdot:pep798-unpacking-operands-315

Conversation

@youknowdot

Copy link
Copy Markdown

Summary

Complete PEP 798 unpacking operands on the RustPython 0.17.1 parser branch. Dictionary comprehensions and starred generator expressions accept full expressions, including conditional expressions. Malformed unpacking preserves the first relevant diagnostic and recovers without producing invalid AST ranges.

The production changes are limited to the parser's expression parsing, error definitions, and deferred-error state. Thirteen fixtures and regenerated snapshots cover conditional/Boolean/comparison operands, nested contexts, soft keywords, invalid unpacking positions, and subsequent syntax errors.

Behavior is compared with CPython 3.15.0 at d220409a13b77de7a6c30abe16ea90db01528edc. This is the narrow operand/diagnostic prerequisite for RustPython's PEP 798 compiler changes. It builds on rustpython-0.17.1; the broader older-version work in #6 remains separate.

Validation

  • Parser tests: 254 unit tests, 617 fixture tests, 1 integration test, and 10 doctests passed with snapshot updates disabled in the final run.
  • Parser-only strict Clippy passed with --no-deps.
  • The dependency-wide strict Clippy gate encounters nine pre-existing unexpected_cfgs diagnostics for cache/salsa in the AST dependency. The same nine diagnostics were reproduced on unchanged base 9290a8849542134d83f77e9360e7f0b93897fd93.
  • Fresh RustPython integration with the compiler remainder passed the whole canonical test_unpack_ex suite, also run on the pinned CPython oracle.
  • All 41 derived compile/error-order observations and 8 recursive bytecode/line-table/position observations matched the oracle exactly.
  • Existing RustPython comprehension, generator, AST, unparse, and syntax suites passed (482 tests, 18 existing skips), plus 31 reviewed async-generator core tests.
  • Normal repository commit hooks passed.

The integration results include RustPython compiler changes outside this parser PR; this PR alone does not implement the VM/code-generation portion of PEP 798. Git dependency consumers need to select the resulting revision; this does not establish a crates.io release.

Assistance

Prepared and tested with OpenAI Codex at the maintainer's explicit request. No claim of manual maintainer review is implied.

Parse full expression operands in dictionary and starred generator comprehensions. Preserve conditional-unpacking fallback ordering and recover malformed dictionary unpacking without invalid AST ranges. Add parser fixtures and regenerated snapshots.

Assisted-by: OpenAI Codex:model version unavailable
@coderabbitai

coderabbitai Bot commented Oct 19, 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

Comment @coderabbitai help to get the list of available commands.

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.

1 participant