diff options
author | Lysandros Nikolaou <lisandrosnik@gmail.com> | 2025-04-30 09:46:41 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-04-30 09:46:41 (GMT) |
commit | 60202609a2c2d0971aadfa4729ba30b50e89c6ea (patch) | |
tree | d821f3f8f277de56e5d8da457d492f1288cb2bb9 /Python/ast.c | |
parent | 5ea9010e8910cb97555c3aef4ed95cca93a74aab (diff) | |
download | cpython-60202609a2c2d0971aadfa4729ba30b50e89c6ea.zip cpython-60202609a2c2d0971aadfa4729ba30b50e89c6ea.tar.gz cpython-60202609a2c2d0971aadfa4729ba30b50e89c6ea.tar.bz2 |
gh-132661: Implement PEP 750 (#132662)
Co-authored-by: Lysandros Nikolaou <lisandrosnik@gmail.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
Co-authored-by: Wingy <git@wingysam.xyz>
Co-authored-by: Koudai Aono <koxudaxi@gmail.com>
Co-authored-by: Dave Peck <davepeck@gmail.com>
Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
Co-authored-by: Paul Everitt <pauleveritt@me.com>
Co-authored-by: sobolevn <mail@sobolevn.me>
Diffstat (limited to 'Python/ast.c')
-rw-r--r-- | Python/ast.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/Python/ast.c b/Python/ast.c index 7ee8843..e01dd0d 100644 --- a/Python/ast.c +++ b/Python/ast.c @@ -345,6 +345,9 @@ validate_expr(expr_ty exp, expr_context_ty ctx) case JoinedStr_kind: ret = validate_exprs(exp->v.JoinedStr.values, Load, 0); break; + case TemplateStr_kind: + ret = validate_exprs(exp->v.TemplateStr.values, Load, 0); + break; case FormattedValue_kind: if (validate_expr(exp->v.FormattedValue.value, Load) == 0) return 0; @@ -354,6 +357,15 @@ validate_expr(expr_ty exp, expr_context_ty ctx) } ret = 1; break; + case Interpolation_kind: + if (validate_expr(exp->v.Interpolation.value, Load) == 0) + return 0; + if (exp->v.Interpolation.format_spec) { + ret = validate_expr(exp->v.Interpolation.format_spec, Load); + break; + } + ret = 1; + break; case Attribute_kind: ret = validate_expr(exp->v.Attribute.value, Load); break; @@ -512,6 +524,7 @@ validate_pattern_match_value(expr_ty exp) } break; case JoinedStr_kind: + case TemplateStr_kind: // Handled in the later stages return 1; default: |