summaryrefslogtreecommitdiffstats
path: root/Python
diff options
context:
space:
mode:
authorJelle Zijlstra <jelle.zijlstra@gmail.com>2023-09-13 16:00:39 (GMT)
committerGitHub <noreply@github.com>2023-09-13 16:00:39 (GMT)
commit987b4bc0870e1e29a88275dc3fa39bf2c3dcc763 (patch)
tree92f0ec16bf4377afab41a040266836ed43879c00 /Python
parent79101edb03b7381b514126c68acabfcbbba2f842 (diff)
downloadcpython-987b4bc0870e1e29a88275dc3fa39bf2c3dcc763.zip
cpython-987b4bc0870e1e29a88275dc3fa39bf2c3dcc763.tar.gz
cpython-987b4bc0870e1e29a88275dc3fa39bf2c3dcc763.tar.bz2
gh-109341: Fix crash on compiling invalid AST including TypeAlias (#109349)
Diffstat (limited to 'Python')
-rw-r--r--Python/ast.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/Python/ast.c b/Python/ast.c
index a230c7e..5f46d41 100644
--- a/Python/ast.c
+++ b/Python/ast.c
@@ -773,6 +773,11 @@ validate_stmt(struct validator *state, stmt_ty stmt)
validate_expr(state, stmt->v.AnnAssign.annotation, Load);
break;
case TypeAlias_kind:
+ if (stmt->v.TypeAlias.name->kind != Name_kind) {
+ PyErr_SetString(PyExc_TypeError,
+ "TypeAlias with non-Name name");
+ return 0;
+ }
ret = validate_expr(state, stmt->v.TypeAlias.name, Store) &&
validate_type_params(state, stmt->v.TypeAlias.type_params) &&
validate_expr(state, stmt->v.TypeAlias.value, Load);