Repository navigation
Close the remaining PEP 701 gaps in the Python floor check - #712
Merged
Merged
Conversation
ast.parse(feature_version=(3, 11)) on 3.12+ accepts every PEP 701 f-string, not just a nested same quote. Below a 3.12 floor the token walk now also flags a backslash or a comment in a field, a line break in a field of a single-quoted f-string, and fields nested more than two deep. Each was checked against a real 3.11. Offenders report each line once, and the docstring says where feature_version stops answering the question. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
earthtojake
added a commit
that referenced
this pull request
Oct 28, 2026
Releases 0.8.2: VERSION, the derived metadata and every cadgen pin. Ships #706: Windows snapshots hand their picture over through a file when OCP refuses a stream (#709, the fallback BruceWu1126 proposed and tested in #710), mesh-file snapshots through a worker, local crash diagnostics, the viewer's pointer-lift guard and a readable error when Windows refuses the kernel processes. Also #708 and #712 (the Python floor check). Co-authored-by: BruceWu1126 <196750230+BruceWu1126@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up to #708. That PR caught f-strings that nest their own quote, a pattern Python 3.11 rejects but that
ast.parse(feature_version=(3, 11))on 3.12+ accepts. Review found three more PEP 701 forms that slip past the floor check the same way, plus a few nits. This closes them in the same token walk, with no CI changes.What the check now flags (only when
requires-pythonis below 3.12)Each case below was checked against a real CPython 3.11
compile():f"{d["k"]}"f"{'\n'.join(a)}", which 3.11 rejects with "expression part cannot include a backslash". A backslash in the literal text or the format spec is still allowed.f"""{a # why\n}""". 3.11 rejects this even inside a triple-quoted f-string.f"{a +\n b}". A triple-quoted f-string may still break lines in its fields.f"{a:{b:{c}}}", which 3.11 rejects as "nested too deeply".Nits from the #708 review
feature_versionanswers "would the floor accept this file?" for f-strings._quoteno longer strips thet/Tprefixes of t-strings, which it never tracks.Other 3.12+ syntax is already rejected by
feature_version=(3, 11). That covers PEP 695 type parameters andtypealiases, and 3.14's t-strings.Testing
feature_versionor this check) on 3.12 and 3.13, with 0 mismatches. A separate set of 22 cases, written independently, also gave 0 mismatches on both.main.scripts/test/test-global.sh: 224 tests, OK (1 skipped). On 3.11 the pinning test skips, because the interpreter rejects all of this syntax itself.🤖 Generated with Claude Code