Skip to content

Commit 25b2399

Browse files
committed
Update Python ASDL for Python 3.12
From python/cpython@46c1097
1 parent 69d27d9 commit 25b2399

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

ast/Python.asdl

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,20 +10,22 @@ module Python
1010

1111
stmt = FunctionDef(identifier name, arguments args,
1212
stmt* body, expr* decorator_list, expr? returns,
13-
string? type_comment)
13+
string? type_comment, type_param* type_params)
1414
| AsyncFunctionDef(identifier name, arguments args,
1515
stmt* body, expr* decorator_list, expr? returns,
16-
string? type_comment)
16+
string? type_comment, type_param* type_params)
1717

1818
| ClassDef(identifier name,
1919
expr* bases,
2020
keyword* keywords,
2121
stmt* body,
22-
expr* decorator_list)
22+
expr* decorator_list,
23+
type_param* type_params)
2324
| Return(expr? value)
2425

2526
| Delete(expr* targets)
2627
| Assign(expr* targets, expr value, string? type_comment)
28+
| TypeAlias(expr name, type_param* type_params, expr value)
2729
| AugAssign(expr target, operator op, expr value)
2830
-- 'simple' indicates that we annotate simple name without parens
2931
| AnnAssign(expr target, expr annotation, expr? value, int simple)
@@ -142,4 +144,9 @@ module Python
142144
attributes (int lineno, int col_offset, int end_lineno, int end_col_offset)
143145

144146
type_ignore = TypeIgnore(int lineno, string tag)
147+
148+
type_param = TypeVar(identifier name, expr? bound)
149+
| ParamSpec(identifier name)
150+
| TypeVarTuple(identifier name)
151+
attributes (int lineno, int col_offset, int end_lineno, int end_col_offset)
145152
}

0 commit comments

Comments
 (0)