[3.10] gh-125529: Avoid f-strings in the metagrammar #125582
Merged
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.
Grammar actions need to be valid Python tokens and the accepted tokens need to be listed in the actions mini-grammar).
In Python 3.12+ (PEP 701), f-strings are no longer STRING tokens, so pegen fails to regenerate the metaparser on this Python version, as in:
PYTHON_FOR_REGEN=python3.12 make regen-pegen-metaparser
Use
+
and plain strings rather than f-strings.Note that 3.9 and 3.11+ don't use f-strings in the metagrammar
This affects our PR CI fail in the Check if generated files are up to date step, like here: https://github.com/python/cpython/actions/runs/11274132145/job/31352641619?pr=125255
I see several ways we could solve this:
I believe this patch is best:
pegen
, and ones that do are likely equipped handle any failures.But of course, it's entirely the RM's call. @pablogsal?
make regen-pegen-metaparser
fails with 3.12+ #125529