gh-116126: Implement PEP 696 (#116129)

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com>
This commit is contained in:
Jelle Zijlstra 2024-05-03 06:17:32 -07:00 committed by GitHub
parent 852263e108
commit ca269e58c2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
28 changed files with 1924 additions and 623 deletions

View file

@ -1011,13 +1011,19 @@ validate_typeparam(struct validator *state, type_param_ty tp)
case TypeVar_kind:
ret = validate_name(tp->v.TypeVar.name) &&
(!tp->v.TypeVar.bound ||
validate_expr(state, tp->v.TypeVar.bound, Load));
validate_expr(state, tp->v.TypeVar.bound, Load)) &&
(!tp->v.TypeVar.default_value ||
validate_expr(state, tp->v.TypeVar.default_value, Load));
break;
case ParamSpec_kind:
ret = validate_name(tp->v.ParamSpec.name);
ret = validate_name(tp->v.ParamSpec.name) &&
(!tp->v.ParamSpec.default_value ||
validate_expr(state, tp->v.ParamSpec.default_value, Load));
break;
case TypeVarTuple_kind:
ret = validate_name(tp->v.TypeVarTuple.name);
ret = validate_name(tp->v.TypeVarTuple.name) &&
(!tp->v.TypeVarTuple.default_value ||
validate_expr(state, tp->v.TypeVarTuple.default_value, Load));
break;
}
return ret;