Skip to content

Canonicalize f-string annotation fields - #9077

Merged
youknowone merged 1 commit into
RustPython:mainfrom
youknowdot:fix-python314-compiler-compatibility-batch
Oct 12, 2026
Merged

youknowone merged 1 commit into
RustPython:mainfrom
youknowdot:fix-python314-compiler-compatibility-batch

Conversation

@youknowdot

@youknowdot youknowdot commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor

Current revision

Targets Python 3.15 main at f39da82d9d38cd5bdceb9e645205e830f65126fb with one logical commit, 08ba7aefead6429d46b9c664742f1995add630b5. The unique patch is unchanged from the prior reviewed PR head (range-diff =); current main fixes, original author attribution, and assistance trailers are preserved. No files under Lib/ are changed.

Normal commit hooks, changed-range hooks, whitespace checks, and source-equivalence review passed. Normal hosted CI is enabled for this exact head. Current-revision local validation is source and hooks only; earlier runtime results below remain attributed to their original revisions.

Summary

Canonicalize opening-brace whitespace in postponed f-string annotations. Preserve debug text, literal format padding and the brace-leading expression safeguard. Four compile-only Python cases cover the behavior.

Source and scope

The leaf contains only the f-string fix and its four Python regression cases. It adds no Lib/ changes, ParamSpec or TextIOWrapper prerequisite, version pin, or documentation-default change. The inherited reference and documentation default remain 3.15.0. The earlier configparser and SQLite backports are deferred to the common library refresh; their fixes are already in official 3.15. The withdrawn tuple-folding optimization remains absent.

The change follows CPython 3.15 final's AST unparser. Main's nested template-format annotation fix (#9076) and its regression cases are preserved through the dependency.

Validation

The current revision has the source-equivalence and hook validation recorded above; normal Python 3.15 hosted CI is pending.

Earlier fresh native builds, focused tests and Clippy results belonged to a6c5ba47e623149d84c54376ce0b7db4c9b807ff with a CPython 3.14.8 reference. They do not validate this 3.15-based head.

Leave this PR draft and unmerged pending dependency and maintainer review.

AI-assisted implementation, source review, rebase and validation with OpenAI Codex; assistance is disclosed in the retained commit trailers.

@coderabbitai

coderabbitai Bot commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Note

Currently processing new changes in this PR. This may take a few minutes, please wait...

⚙️ Run configuration
  • Configuration used: Repository: RustPython/RustPython/.coderabbit.yml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 1247ad2f-22aa-48af-9c7b-97d10d342dc1

📥 Commits

Reviewing files that changed from the base of the PR and between f39da82 and 08ba7ae.


📒 Files selected for processing (2)
  • crates/codegen/src/unparse.rs
  • extra_tests/snippets/syntax_annotations.py

 ____________________________
< Try...catch me if you can. >
 ----------------------------
  \
   \   (\__/)
       (•ㅅ•)
       /   づ
✨ 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.

❤️ Share

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

@youknowdot youknowdot changed the title Backport Python 3.14 compiler and library compatibility fixes Fix Python 3.14 annotations, config parsing, and SQLite dumps Oct 10, 2026
@youknowdot

Copy link
Copy Markdown
Contributor Author

Withdrew the tuple-fold optimization in ab819bc after independent review and compile-only co_consts checks exposed changed identity for repeated float constants. The prior native path and CPython retain one shared object; the enabled fold created distinct objects. The revert restores the old path and removes only its newly added IR expectation. The other three fixes, doc default and identical #9063 prerequisites remain. Repaired native identity checks, 10 canonical tests, 8 pytest entries, 3 existing compiler controls, hooks and codegen/VM/CAPI Clippy pass. Replacement hosted CI is pending.

@github-actions

github-actions Bot commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor

📦 Library Dependencies

The following Lib/ modules were modified. Here are their dependencies:

[ ] test: cpython/Lib/test/test_mmap.py (TODO: 19)

dependencies:

dependent tests: (2 tests)

  • mmap: test_os
    • multiprocessing.shared_memory: test_genericalias

Legend:

  • [+] path exists in CPython
  • [x] up-to-date, [ ] outdated

@youknowdot
youknowdot force-pushed the fix-python314-compiler-compatibility-batch branch 2 times, most recently from 36a962a to a6c5ba4 Compare October 11, 2026 00:58
@youknowdot youknowdot changed the title Fix Python 3.14 annotations, config parsing, and SQLite dumps Canonicalize f-string annotation fields Oct 11, 2026
@youknowdot
youknowdot force-pushed the fix-python314-compiler-compatibility-batch branch 2 times, most recently from c37af47 to af1cd77 Compare October 11, 2026 03:21
@youknowone
youknowone changed the base branch from main to stack/python-3.15-8950 October 11, 2026 03:26
@youknowdot
youknowdot force-pushed the fix-python314-compiler-compatibility-batch branch from af1cd77 to fd806a6 Compare October 11, 2026 04:07
@youknowone
youknowone changed the base branch from stack/python-3.15-8950 to main October 11, 2026 04:09
@youknowdot
youknowdot force-pushed the fix-python314-compiler-compatibility-batch branch from fd806a6 to c6e3b24 Compare October 11, 2026 04:14
Ignore incidental formatted-value whitespace while retaining brace-leading safeguards and literal/debug text. Include compile-only annotation-constant coverage.

Assisted-by: OpenAI Codex:model identifier unavailable
@youknowdot
youknowdot force-pushed the fix-python314-compiler-compatibility-batch branch from c6e3b24 to 08ba7ae Compare October 11, 2026 18:37
@youknowone
youknowone marked this pull request as ready for review October 12, 2026 04:38
@youknowone
youknowone merged commit 9ea138c into RustPython:main Oct 12, 2026
20 checks passed
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 12, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-12T04:41:21.284866Z 08ba7ae Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 08ba7aefea

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

from typing import get_type_hints

# Future f-string annotations canonicalize fields, not their literal padding.
for formatted, expected in (

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Remove the disallowed regression-test additions

This loop adds new test data, compilation logic, and an assertion to extra_tests/snippets/syntax_annotations.py, but the root AGENTS.md says that the only acceptable test-file edits are adding expected-failure decorators or removing them with their TODOs. Please remove these additions or get the repository policy changed or waived before landing the implementation.

AGENTS.md reference: AGENTS.md:L277-L279

Useful? React with 👍 / 👎.

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