gh-133196: Guard PEP 750 grammar with `CHECK_VERSION` (#133225) · python/cpython@5cdd49b

GitHub

Original file line numberDiff line numberDiff line change@@ -971,7 +971,12 @@ tstring_middle[expr_ty]:

971971 | tstring_replacement_field

972972 | t=TSTRING_MIDDLE { _PyPegen_constant_from_token(p, t) }

973973tstring[expr_ty] (memo):

974- | a=TSTRING_START b=tstring_middle* c=TSTRING_END { _PyPegen_template_str(p, a, (asdl_expr_seq*)b, c) }

974+ | a=TSTRING_START b=tstring_middle* c=TSTRING_END {

975+ CHECK_VERSION(

976+ expr_ty,

977+ 14,

978+ "t-strings are",

979+ _PyPegen_template_str(p, a, (asdl_expr_seq*)b, c)) }

975980976981string[expr_ty]: s[Token*]=STRING { _PyPegen_constant_from_string(p, s) }

977982strings[expr_ty] (memo): a[asdl_expr_seq*]=(fstring|string|tstring)+ { _PyPegen_concatenate_strings(p, a, EXTRA) }