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>
This commit is contained in:
Lysandros Nikolaou 2025-04-30 11:46:41 +02:00 committed by GitHub
parent 5ea9010e89
commit 60202609a2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
81 changed files with 7716 additions and 3761 deletions

View file

@ -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: