mirror of
https://github.com/python/cpython.git
synced 2025-12-31 04:23:37 +00:00
[3.10] gh-125529: Avoid f-strings in the metagrammar (#125582)
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. Co-authored-by: Lysandros Nikolaou <lisandrosnik@gmail.com>
This commit is contained in:
parent
3c63d80b95
commit
6a2f12a754
2 changed files with 2 additions and 2 deletions
|
|
@ -420,7 +420,7 @@ class GeneratedParser(Parser):
|
|||
and
|
||||
(item := self.item())
|
||||
):
|
||||
return NamedItem ( name . string , item , f"{type.string}*" )
|
||||
return NamedItem ( name . string , item , type . string + "*" )
|
||||
self.reset(mark)
|
||||
if cut: return None
|
||||
cut = False
|
||||
|
|
|
|||
|
|
@ -84,7 +84,7 @@ items[NamedItemList]:
|
|||
| named_item { [named_item] }
|
||||
|
||||
named_item[NamedItem]:
|
||||
| NAME '[' type=NAME '*' ']' '=' ~ item {NamedItem(name.string, item, f"{type.string}*")}
|
||||
| NAME '[' type=NAME '*' ']' '=' ~ item {NamedItem(name.string, item, type.string+"*")}
|
||||
| NAME '[' type=NAME ']' '=' ~ item {NamedItem(name.string, item, type.string)}
|
||||
| NAME '=' ~ item {NamedItem(name.string, item)}
|
||||
| item {NamedItem(None, item)}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue