diff options
author | Jelle Zijlstra <jelle.zijlstra@gmail.com> | 2024-05-03 13:17:32 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-05-03 13:17:32 (GMT) |
commit | ca269e58c290be8ca11bb728004ea842d9f85e3a (patch) | |
tree | 7af6ddffd5195536343780ef7aeb338ef460501e /Python/ast.c | |
parent | 852263e1086748492602a90347ecc0a3925e1dda (diff) | |
download | cpython-ca269e58c290be8ca11bb728004ea842d9f85e3a.zip cpython-ca269e58c290be8ca11bb728004ea842d9f85e3a.tar.gz cpython-ca269e58c290be8ca11bb728004ea842d9f85e3a.tar.bz2 |
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>
Diffstat (limited to 'Python/ast.c')
-rw-r--r-- | Python/ast.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/Python/ast.c b/Python/ast.c index 71b09d8..1d1a48e 100644 --- a/Python/ast.c +++ b/Python/ast.c @@ -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; |