[Python-checkins] bpo-41746: Add type information to asdl_seq objects (GH-22223)

Pablo Galindo webhook-mailer at python.org
Wed Sep 16 14:42:09 EDT 2020


https://github.com/python/cpython/commit/a5634c406767ef694df49b624adf9cfa6c0d9064
commit: a5634c406767ef694df49b624adf9cfa6c0d9064
branch: master
author: Pablo Galindo <Pablogsal at gmail.com>
committer: GitHub <noreply at github.com>
date: 2020-09-16T19:42:00+01:00
summary:

bpo-41746: Add type information to asdl_seq objects (GH-22223)

* Add new capability to the PEG parser to type variable assignments. For instance:
```
       | a[asdl_stmt_seq*]=';'.small_stmt+ [';'] NEWLINE { a }
```

* Add new sequence types from the asdl definition (automatically generated)
* Make `asdl_seq` type a generic aliasing pointer type.
* Create a new `asdl_generic_seq` for the generic case using `void*`.
* The old `asdl_seq_GET`/`ast_seq_SET` macros now are typed.
* New `asdl_seq_GET_UNTYPED`/`ast_seq_SET_UNTYPED` macros for dealing with generic sequences.
* Changes all possible `asdl_seq` types to use specific versions everywhere.

files:
M Doc/tools/extensions/peg_highlight.py
M Grammar/python.gram
M Include/Python-ast.h
M Include/asdl.h
M Include/ast.h
M Parser/asdl_c.py
M Parser/parser.c
M Parser/pegen.c
M Parser/pegen.h
M Parser/string_parser.c
M Python/Python-ast.c
M Python/asdl.c
M Python/ast.c
M Python/ast_opt.c
M Python/ast_unparse.c
M Python/compile.c
M Python/future.c
M Python/symtable.c
M Tools/peg_generator/pegen/c_generator.py
M Tools/peg_generator/pegen/grammar.py
M Tools/peg_generator/pegen/grammar_parser.py
M Tools/peg_generator/pegen/metagrammar.gram

diff --git a/Doc/tools/extensions/peg_highlight.py b/Doc/tools/extensions/peg_highlight.py
index 8bc24670fbe0a..9a2acb7f320ba 100644
--- a/Doc/tools/extensions/peg_highlight.py
+++ b/Doc/tools/extensions/peg_highlight.py
@@ -43,7 +43,7 @@ class PEGLexer(RegexLexer):
             (r"'\W+?'", Text),
             (r'"\W+?"', Text),
         ],
-        "variables": [(_name + _text_ws + "(=)", bygroups(None, None, None),),],
+        "variables": [(_name + _text_ws + r"(\[.*\])?" + _text_ws + "(=)", bygroups(None, None, None, None, None),),],
         "invalids": [
             (r"^(\s+\|\s+invalid_\w+\s*\n)", bygroups(None)),
             (r"^(\s+\|\s+incorrect_\w+\s*\n)", bygroups(None)),
diff --git a/Grammar/python.gram b/Grammar/python.gram
index 524e88eb38996..e4533b1a1b879 100644
--- a/Grammar/python.gram
+++ b/Grammar/python.gram
@@ -34,27 +34,27 @@ func_type[mod_ty]: '(' a=[type_expressions] ')' '->' b=expression NEWLINE* ENDMA
 fstring[expr_ty]: star_expressions
 
 # type_expressions allow */** but ignore them
-type_expressions[asdl_seq*]:
+type_expressions[asdl_expr_seq*]:
     | a=','.expression+ ',' '*' b=expression ',' '**' c=expression {
-        _PyPegen_seq_append_to_end(p, CHECK(_PyPegen_seq_append_to_end(p, a, b)), c) }
-    | a=','.expression+ ',' '*' b=expression { _PyPegen_seq_append_to_end(p, a, b) }
-    | a=','.expression+ ',' '**' b=expression { _PyPegen_seq_append_to_end(p, a, b) }
+        (asdl_expr_seq*)_PyPegen_seq_append_to_end(p, CHECK(_PyPegen_seq_append_to_end(p, a, b)), c) }
+    | a=','.expression+ ',' '*' b=expression { (asdl_expr_seq*)_PyPegen_seq_append_to_end(p, a, b) }
+    | a=','.expression+ ',' '**' b=expression { (asdl_expr_seq*)_PyPegen_seq_append_to_end(p, a, b) }
     | '*' a=expression ',' '**' b=expression {
-        _PyPegen_seq_append_to_end(p, CHECK(_PyPegen_singleton_seq(p, a)), b) }
-    | '*' a=expression { _PyPegen_singleton_seq(p, a) }
-    | '**' a=expression { _PyPegen_singleton_seq(p, a) }
-    | ','.expression+
-
-statements[asdl_seq*]: a=statement+ { _PyPegen_seq_flatten(p, a) }
-statement[asdl_seq*]: a=compound_stmt { _PyPegen_singleton_seq(p, a) } | simple_stmt
-statement_newline[asdl_seq*]:
-    | a=compound_stmt NEWLINE { _PyPegen_singleton_seq(p, a) }
+        (asdl_expr_seq*)_PyPegen_seq_append_to_end(p, CHECK(_PyPegen_singleton_seq(p, a)), b) }
+    | '*' a=expression { (asdl_expr_seq*)_PyPegen_singleton_seq(p, a) }
+    | '**' a=expression { (asdl_expr_seq*)_PyPegen_singleton_seq(p, a) }
+    | a[asdl_expr_seq*]=','.expression+ {a}
+
+statements[asdl_stmt_seq*]: a=statement+ { (asdl_stmt_seq*)_PyPegen_seq_flatten(p, a) }
+statement[asdl_stmt_seq*]: a=compound_stmt { (asdl_stmt_seq*)_PyPegen_singleton_seq(p, a) } | a[asdl_stmt_seq*]=simple_stmt { a }
+statement_newline[asdl_stmt_seq*]:
+    | a=compound_stmt NEWLINE { (asdl_stmt_seq*)_PyPegen_singleton_seq(p, a) }
     | simple_stmt
-    | NEWLINE { _PyPegen_singleton_seq(p, CHECK(_Py_Pass(EXTRA))) }
+    | NEWLINE { (asdl_stmt_seq*)_PyPegen_singleton_seq(p, CHECK(_Py_Pass(EXTRA))) }
     | ENDMARKER { _PyPegen_interactive_exit(p) }
-simple_stmt[asdl_seq*]:
-    | a=small_stmt !';' NEWLINE { _PyPegen_singleton_seq(p, a) } # Not needed, there for speedup
-    | a=';'.small_stmt+ [';'] NEWLINE { a }
+simple_stmt[asdl_stmt_seq*]:
+    | a=small_stmt !';' NEWLINE { (asdl_stmt_seq*)_PyPegen_singleton_seq(p, a) } # Not needed, there for speedup
+    | a[asdl_stmt_seq*]=';'.small_stmt+ [';'] NEWLINE { a }
 # NOTE: assignment MUST precede expression, else parsing a simple assignment
 # will throw a SyntaxError.
 small_stmt[stmt_ty] (memo):
@@ -91,7 +91,7 @@ assignment[stmt_ty]:
     | a=('(' b=single_target ')' { b }
          | single_subscript_attribute_target) ':' b=expression c=['=' d=annotated_rhs { d }] {
         CHECK_VERSION(6, "Variable annotations syntax is", _Py_AnnAssign(a, b, c, 0, EXTRA)) }
-    | a=(z=star_targets '=' { z })+ b=(yield_expr | star_expressions) !'=' tc=[TYPE_COMMENT] {
+    | a[asdl_expr_seq*]=(z=star_targets '=' { z })+ b=(yield_expr | star_expressions) !'=' tc=[TYPE_COMMENT] {
          _Py_Assign(a, b, NEW_TYPE_COMMENT(p, tc), EXTRA) }
     | a=single_target b=augassign ~ c=(yield_expr | star_expressions) {
          _Py_AugAssign(a, b->kind, c, EXTRA) }
@@ -112,9 +112,9 @@ augassign[AugOperator*]:
     | '**=' { _PyPegen_augoperator(p, Pow) }
     | '//=' { _PyPegen_augoperator(p, FloorDiv) }
 
-global_stmt[stmt_ty]: 'global' a=','.NAME+ {
+global_stmt[stmt_ty]: 'global' a[asdl_expr_seq*]=','.NAME+ {
     _Py_Global(CHECK(_PyPegen_map_names_to_ids(p, a)), EXTRA) }
-nonlocal_stmt[stmt_ty]: 'nonlocal' a=','.NAME+ {
+nonlocal_stmt[stmt_ty]: 'nonlocal' a[asdl_expr_seq*]=','.NAME+ {
     _Py_Nonlocal(CHECK(_PyPegen_map_names_to_ids(p, a)), EXTRA) }
 
 yield_stmt[stmt_ty]: y=yield_expr { _Py_Expr(y, EXTRA) }
@@ -133,19 +133,19 @@ import_from[stmt_ty]:
         _Py_ImportFrom(b->v.Name.id, c, _PyPegen_seq_count_dots(a), EXTRA) }
     | 'from' a=('.' | '...')+ 'import' b=import_from_targets {
         _Py_ImportFrom(NULL, b, _PyPegen_seq_count_dots(a), EXTRA) }
-import_from_targets[asdl_seq*]:
+import_from_targets[asdl_alias_seq*]:
     | '(' a=import_from_as_names [','] ')' { a }
     | import_from_as_names !','
-    | '*' { _PyPegen_singleton_seq(p, CHECK(_PyPegen_alias_for_star(p))) }
+    | '*' { (asdl_alias_seq*)_PyPegen_singleton_seq(p, CHECK(_PyPegen_alias_for_star(p))) }
     | invalid_import_from_targets
-import_from_as_names[asdl_seq*]:
-    | a=','.import_from_as_name+ { a }
+import_from_as_names[asdl_alias_seq*]:
+    | a[asdl_alias_seq*]=','.import_from_as_name+ { a }
 import_from_as_name[alias_ty]:
     | a=NAME b=['as' z=NAME { z }] { _Py_alias(a->v.Name.id,
                                                (b) ? ((expr_ty) b)->v.Name.id : NULL,
                                                p->arena) }
-dotted_as_names[asdl_seq*]:
-    | a=','.dotted_as_name+ { a }
+dotted_as_names[asdl_alias_seq*]:
+    | a[asdl_alias_seq*]=','.dotted_as_name+ { a }
 dotted_as_name[alias_ty]:
     | a=dotted_name b=['as' z=NAME { z }] { _Py_alias(a->v.Name.id,
                                                       (b) ? ((expr_ty) b)->v.Name.id : NULL,
@@ -155,12 +155,12 @@ dotted_name[expr_ty]:
     | NAME
 
 if_stmt[stmt_ty]:
-    | 'if' a=named_expression ':' b=block c=elif_stmt { _Py_If(a, b, CHECK(_PyPegen_singleton_seq(p, c)), EXTRA) }
+    | 'if' a=named_expression ':' b=block c=elif_stmt { _Py_If(a, b, CHECK((asdl_stmt_seq*)_PyPegen_singleton_seq(p, c)), EXTRA) }
     | 'if' a=named_expression ':' b=block c=[else_block] { _Py_If(a, b, c, EXTRA) }
 elif_stmt[stmt_ty]:
     | 'elif' a=named_expression ':' b=block c=elif_stmt { _Py_If(a, b, CHECK(_PyPegen_singleton_seq(p, c)), EXTRA) }
     | 'elif' a=named_expression ':' b=block c=[else_block] { _Py_If(a, b, c, EXTRA) }
-else_block[asdl_seq*]: 'else' ':' b=block { b }
+else_block[asdl_stmt_seq*]: 'else' ':' b=block { b }
 
 while_stmt[stmt_ty]:
     | 'while' a=named_expression ':' b=block c=[else_block] { _Py_While(a, b, c, EXTRA) }
@@ -173,13 +173,13 @@ for_stmt[stmt_ty]:
     | invalid_for_target
 
 with_stmt[stmt_ty]:
-    | 'with' '(' a=','.with_item+ ','? ')' ':' b=block {
+    | 'with' '(' a[asdl_withitem_seq*]=','.with_item+ ','? ')' ':' b=block {
         _Py_With(a, b, NULL, EXTRA) }
-    | 'with' a=','.with_item+ ':' tc=[TYPE_COMMENT] b=block {
+    | 'with' a[asdl_withitem_seq*]=','.with_item+ ':' tc=[TYPE_COMMENT] b=block {
         _Py_With(a, b, NEW_TYPE_COMMENT(p, tc), EXTRA) }
-    | ASYNC 'with' '(' a=','.with_item+ ','? ')' ':' b=block {
+    | ASYNC 'with' '(' a[asdl_withitem_seq*]=','.with_item+ ','? ')' ':' b=block {
        CHECK_VERSION(5, "Async with statements are", _Py_AsyncWith(a, b, NULL, EXTRA)) }
-    | ASYNC 'with' a=','.with_item+ ':' tc=[TYPE_COMMENT] b=block {
+    | ASYNC 'with' a[asdl_withitem_seq*]=','.with_item+ ':' tc=[TYPE_COMMENT] b=block {
        CHECK_VERSION(5, "Async with statements are", _Py_AsyncWith(a, b, NEW_TYPE_COMMENT(p, tc), EXTRA)) }
 with_item[withitem_ty]:
     | e=expression 'as' t=target &(',' | ')' | ':') { _Py_withitem(e, t, p->arena) }
@@ -188,12 +188,12 @@ with_item[withitem_ty]:
 
 try_stmt[stmt_ty]:
     | 'try' ':' b=block f=finally_block { _Py_Try(b, NULL, NULL, f, EXTRA) }
-    | 'try' ':' b=block ex=except_block+ el=[else_block] f=[finally_block] { _Py_Try(b, ex, el, f, EXTRA) }
+    | 'try' ':' b=block ex[asdl_excepthandler_seq*]=except_block+ el=[else_block] f=[finally_block] { _Py_Try(b, ex, el, f, EXTRA) }
 except_block[excepthandler_ty]:
     | 'except' e=expression t=['as' z=NAME { z }] ':' b=block {
         _Py_ExceptHandler(e, (t) ? ((expr_ty) t)->v.Name.id : NULL, b, EXTRA) }
     | 'except' ':' b=block { _Py_ExceptHandler(NULL, NULL, b, EXTRA) }
-finally_block[asdl_seq*]: 'finally' ':' a=block { a }
+finally_block[asdl_stmt_seq*]: 'finally' ':' a=block { a }
 
 return_stmt[stmt_ty]:
     | 'return' a=[star_expressions] { _Py_Return(a, EXTRA) }
@@ -229,11 +229,11 @@ params[arguments_ty]:
     | parameters
 
 parameters[arguments_ty]:
-    | a=slash_no_default b=param_no_default* c=param_with_default* d=[star_etc] {
+    | a=slash_no_default b[asdl_arg_seq*]=param_no_default* c=param_with_default* d=[star_etc] {
         _PyPegen_make_arguments(p, a, NULL, b, c, d) }
     | a=slash_with_default b=param_with_default* c=[star_etc] {
         _PyPegen_make_arguments(p, NULL, a, NULL, b, c) }
-    | a=param_no_default+ b=param_with_default* c=[star_etc] {
+    | a[asdl_arg_seq*]=param_no_default+ b=param_with_default* c=[star_etc] {
         _PyPegen_make_arguments(p, NULL, NULL, a, b, c) }
     | a=param_with_default+ b=[star_etc] { _PyPegen_make_arguments(p, NULL, NULL, NULL, a, b)}
     | a=star_etc { _PyPegen_make_arguments(p, NULL, NULL, NULL, NULL, a) }
@@ -241,12 +241,12 @@ parameters[arguments_ty]:
 # Some duplication here because we can't write (',' | &')'),
 # which is because we don't support empty alternatives (yet).
 #
-slash_no_default[asdl_seq*]:
-    | a=param_no_default+ '/' ',' { a }
-    | a=param_no_default+ '/' &')' { a }
+slash_no_default[asdl_arg_seq*]:
+    | a[asdl_arg_seq*]=param_no_default+ '/' ',' { a }
+    | a[asdl_arg_seq*]=param_no_default+ '/' &')' { a }
 slash_with_default[SlashWithDefault*]:
-    | a=param_no_default* b=param_with_default+ '/' ',' { _PyPegen_slash_with_default(p, a, b) }
-    | a=param_no_default* b=param_with_default+ '/' &')' { _PyPegen_slash_with_default(p, a, b) }
+    | a=param_no_default* b=param_with_default+ '/' ',' { _PyPegen_slash_with_default(p, (asdl_arg_seq *)a, b) }
+    | a=param_no_default* b=param_with_default+ '/' &')' { _PyPegen_slash_with_default(p, (asdl_arg_seq *)a, b) }
 
 star_etc[StarEtc*]:
     | '*' a=param_no_default b=param_maybe_default* c=[kwds] {
@@ -284,7 +284,7 @@ param[arg_ty]: a=NAME b=annotation? { _Py_arg(a->v.Name.id, b, NULL, EXTRA) }
 annotation[expr_ty]: ':' a=expression { a }
 default[expr_ty]: '=' a=expression { a }
 
-decorators[asdl_seq*]: a=('@' f=named_expression NEWLINE { f })+ { a }
+decorators[asdl_expr_seq*]: a[asdl_expr_seq*]=('@' f=named_expression NEWLINE { f })+ { a }
 
 class_def[stmt_ty]:
     | a=decorators b=class_def_raw { _PyPegen_class_def_decorators(p, a, b) }
@@ -296,12 +296,12 @@ class_def_raw[stmt_ty]:
                      (b) ? ((expr_ty) b)->v.Call.keywords : NULL,
                      c, NULL, EXTRA) }
 
-block[asdl_seq*] (memo):
+block[asdl_stmt_seq*] (memo):
     | NEWLINE INDENT a=statements DEDENT { a }
     | simple_stmt
     | invalid_block
 
-expressions_list[asdl_seq*]: a=','.star_expression+ [','] { a }
+expressions_list[asdl_expr_seq*]: a[asdl_expr_seq*]=','.star_expression+ [','] { a }
 star_expressions[expr_ty]:
     | a=star_expression b=(',' c=star_expression { c })+ [','] {
         _Py_Tuple(CHECK(_PyPegen_seq_insert_in_front(p, a, b)), Load, EXTRA) }
@@ -311,7 +311,7 @@ star_expression[expr_ty] (memo):
     | '*' a=bitwise_or { _Py_Starred(a, Load, EXTRA) }
     | expression
 
-star_named_expressions[asdl_seq*]: a=','.star_named_expression+ [','] { a }
+star_named_expressions[asdl_expr_seq*]: a[asdl_expr_seq*]=','.star_named_expression+ [','] { a }
 star_named_expression[expr_ty]:
     | '*' a=bitwise_or { _Py_Starred(a, Load, EXTRA) }
     | named_expression
@@ -344,21 +344,21 @@ lambda_params[arguments_ty]:
 # a colon, not a close parenthesis.  (For more, see parameters above.)
 #
 lambda_parameters[arguments_ty]:
-    | a=lambda_slash_no_default b=lambda_param_no_default* c=lambda_param_with_default* d=[lambda_star_etc] {
+    | a=lambda_slash_no_default b[asdl_arg_seq*]=lambda_param_no_default* c=lambda_param_with_default* d=[lambda_star_etc] {
         _PyPegen_make_arguments(p, a, NULL, b, c, d) }
     | a=lambda_slash_with_default b=lambda_param_with_default* c=[lambda_star_etc] {
         _PyPegen_make_arguments(p, NULL, a, NULL, b, c) }
-    | a=lambda_param_no_default+ b=lambda_param_with_default* c=[lambda_star_etc] {
+    | a[asdl_arg_seq*]=lambda_param_no_default+ b=lambda_param_with_default* c=[lambda_star_etc] {
         _PyPegen_make_arguments(p, NULL, NULL, a, b, c) }
     | a=lambda_param_with_default+ b=[lambda_star_etc] { _PyPegen_make_arguments(p, NULL, NULL, NULL, a, b)}
     | a=lambda_star_etc { _PyPegen_make_arguments(p, NULL, NULL, NULL, NULL, a) }
 
-lambda_slash_no_default[asdl_seq*]:
-    | a=lambda_param_no_default+ '/' ',' { a }
-    | a=lambda_param_no_default+ '/' &':' { a }
+lambda_slash_no_default[asdl_arg_seq*]:
+    | a[asdl_arg_seq*]=lambda_param_no_default+ '/' ',' { a }
+    | a[asdl_arg_seq*]=lambda_param_no_default+ '/' &':' { a }
 lambda_slash_with_default[SlashWithDefault*]:
-    | a=lambda_param_no_default* b=lambda_param_with_default+ '/' ',' { _PyPegen_slash_with_default(p, a, b) }
-    | a=lambda_param_no_default* b=lambda_param_with_default+ '/' &':' { _PyPegen_slash_with_default(p, a, b) }
+    | a=lambda_param_no_default* b=lambda_param_with_default+ '/' ',' { _PyPegen_slash_with_default(p, (asdl_arg_seq *)a, b) }
+    | a=lambda_param_no_default* b=lambda_param_with_default+ '/' &':' { _PyPegen_slash_with_default(p, (asdl_arg_seq *)a, b) }
 
 lambda_star_etc[StarEtc*]:
     | '*' a=lambda_param_no_default b=lambda_param_maybe_default* c=[lambda_kwds] {
@@ -472,7 +472,7 @@ primary[expr_ty]:
 
 slices[expr_ty]:
     | a=slice !',' { a }
-    | a=','.slice+ [','] { _Py_Tuple(a, Load, EXTRA) }
+    | a[asdl_expr_seq*]=','.slice+ [','] { _Py_Tuple(a, Load, EXTRA) }
 slice[expr_ty]:
     | a=[expression] ':' b=[expression] c=[':' d=[expression] { d }] { _Py_Slice(a, b, c, EXTRA) }
     | a=expression { a }
@@ -518,12 +518,12 @@ double_starred_kvpair[KeyValuePair*]:
     | '**' a=bitwise_or { _PyPegen_key_value_pair(p, NULL, a) }
     | kvpair
 kvpair[KeyValuePair*]: a=expression ':' b=expression { _PyPegen_key_value_pair(p, a, b) }
-for_if_clauses[asdl_seq*]:
-    | for_if_clause+
+for_if_clauses[asdl_comprehension_seq*]:
+    | a[asdl_comprehension_seq*]=for_if_clause+ { a }
 for_if_clause[comprehension_ty]:
-    | ASYNC 'for' a=star_targets 'in' ~ b=disjunction c=('if' z=disjunction { z })* {
+    | ASYNC 'for' a=star_targets 'in' ~ b=disjunction c[asdl_expr_seq*]=('if' z=disjunction { z })* {
         CHECK_VERSION(6, "Async comprehensions are", _Py_comprehension(a, b, c, 1, p->arena)) }
-    | 'for' a=star_targets 'in' ~ b=disjunction c=('if' z=disjunction { z })* {
+    | 'for' a=star_targets 'in' ~ b=disjunction c[asdl_expr_seq*]=('if' z=disjunction { z })* {
         _Py_comprehension(a, b, c, 0, p->arena) }
     | invalid_for_target
 
@@ -535,7 +535,7 @@ arguments[expr_ty] (memo):
     | a=args [','] &')' { a }
     | incorrect_arguments
 args[expr_ty]:
-    | a=','.(starred_expression | named_expression !'=')+ b=[',' k=kwargs {k}] { _PyPegen_collect_call_seqs(p, a, b, EXTRA) }
+    | a[asdl_expr_seq*]=','.(starred_expression | named_expression !'=')+ b=[',' k=kwargs {k}] { _PyPegen_collect_call_seqs(p, a, b, EXTRA) }
     | a=kwargs { _Py_Call(_PyPegen_dummy_name(p),
                           CHECK_NULL_ALLOWED(_PyPegen_seq_extract_starred_exprs(p, a)),
                           CHECK_NULL_ALLOWED(_PyPegen_seq_delete_starred_exprs(p, a)),
@@ -562,7 +562,7 @@ star_targets[expr_ty]:
     | a=star_target !',' { a }
     | a=star_target b=(',' c=star_target { c })* [','] {
         _Py_Tuple(CHECK(_PyPegen_seq_insert_in_front(p, a, b)), Store, EXTRA) }
-star_targets_seq[asdl_seq*]: a=','.star_target+ [','] { a }
+star_targets_seq[asdl_expr_seq*]: a[asdl_expr_seq*]=','.star_target+ [','] { a }
 star_target[expr_ty] (memo):
     | '*' a=(!'*' star_target) {
         _Py_Starred(CHECK(_PyPegen_set_expr_context(p, a, Store)), Store, EXTRA) }
@@ -583,7 +583,7 @@ single_subscript_attribute_target[expr_ty]:
     | a=t_primary '.' b=NAME !t_lookahead { _Py_Attribute(a, b->v.Name.id, Store, EXTRA) }
     | a=t_primary '[' b=slices ']' !t_lookahead { _Py_Subscript(a, b, Store, EXTRA) }
 
-del_targets[asdl_seq*]: a=','.del_target+ [','] { a }
+del_targets[asdl_expr_seq*]: a[asdl_expr_seq*]=','.del_target+ [','] { a }
 del_target[expr_ty] (memo):
     | a=t_primary '.' b=NAME !t_lookahead { _Py_Attribute(a, b->v.Name.id, Del, EXTRA) }
     | a=t_primary '[' b=slices ']' !t_lookahead { _Py_Subscript(a, b, Del, EXTRA) }
@@ -594,7 +594,7 @@ del_t_atom[expr_ty]:
     | '(' a=[del_targets] ')' { _Py_Tuple(a, Del, EXTRA) }
     | '[' a=[del_targets] ']' { _Py_List(a, Del, EXTRA) }
 
-targets[asdl_seq*]: a=','.target+ [','] { a }
+targets[asdl_expr_seq*]: a[asdl_expr_seq*]=','.target+ [','] { a }
 target[expr_ty] (memo):
     | a=t_primary '.' b=NAME !t_lookahead { _Py_Attribute(a, b->v.Name.id, Store, EXTRA) }
     | a=t_primary '[' b=slices ']' !t_lookahead { _Py_Subscript(a, b, Store, EXTRA) }
diff --git a/Include/Python-ast.h b/Include/Python-ast.h
index e7afa1e6579e8..e14bab566fb5a 100644
--- a/Include/Python-ast.h
+++ b/Include/Python-ast.h
@@ -47,18 +47,99 @@ typedef struct _withitem *withitem_ty;
 typedef struct _type_ignore *type_ignore_ty;
 
 
+typedef struct {
+    _ASDL_SEQ_HEAD
+    mod_ty typed_elements[1];
+} asdl_mod_seq;
+
+asdl_mod_seq *_Py_asdl_mod_seq_new(Py_ssize_t size, PyArena *arena);
+
+typedef struct {
+    _ASDL_SEQ_HEAD
+    stmt_ty typed_elements[1];
+} asdl_stmt_seq;
+
+asdl_stmt_seq *_Py_asdl_stmt_seq_new(Py_ssize_t size, PyArena *arena);
+
+typedef struct {
+    _ASDL_SEQ_HEAD
+    expr_ty typed_elements[1];
+} asdl_expr_seq;
+
+asdl_expr_seq *_Py_asdl_expr_seq_new(Py_ssize_t size, PyArena *arena);
+
+typedef struct {
+    _ASDL_SEQ_HEAD
+    comprehension_ty typed_elements[1];
+} asdl_comprehension_seq;
+
+asdl_comprehension_seq *_Py_asdl_comprehension_seq_new(Py_ssize_t size, PyArena
+                                                       *arena);
+
+typedef struct {
+    _ASDL_SEQ_HEAD
+    excepthandler_ty typed_elements[1];
+} asdl_excepthandler_seq;
+
+asdl_excepthandler_seq *_Py_asdl_excepthandler_seq_new(Py_ssize_t size, PyArena
+                                                       *arena);
+
+typedef struct {
+    _ASDL_SEQ_HEAD
+    arguments_ty typed_elements[1];
+} asdl_arguments_seq;
+
+asdl_arguments_seq *_Py_asdl_arguments_seq_new(Py_ssize_t size, PyArena *arena);
+
+typedef struct {
+    _ASDL_SEQ_HEAD
+    arg_ty typed_elements[1];
+} asdl_arg_seq;
+
+asdl_arg_seq *_Py_asdl_arg_seq_new(Py_ssize_t size, PyArena *arena);
+
+typedef struct {
+    _ASDL_SEQ_HEAD
+    keyword_ty typed_elements[1];
+} asdl_keyword_seq;
+
+asdl_keyword_seq *_Py_asdl_keyword_seq_new(Py_ssize_t size, PyArena *arena);
+
+typedef struct {
+    _ASDL_SEQ_HEAD
+    alias_ty typed_elements[1];
+} asdl_alias_seq;
+
+asdl_alias_seq *_Py_asdl_alias_seq_new(Py_ssize_t size, PyArena *arena);
+
+typedef struct {
+    _ASDL_SEQ_HEAD
+    withitem_ty typed_elements[1];
+} asdl_withitem_seq;
+
+asdl_withitem_seq *_Py_asdl_withitem_seq_new(Py_ssize_t size, PyArena *arena);
+
+typedef struct {
+    _ASDL_SEQ_HEAD
+    type_ignore_ty typed_elements[1];
+} asdl_type_ignore_seq;
+
+asdl_type_ignore_seq *_Py_asdl_type_ignore_seq_new(Py_ssize_t size, PyArena
+                                                   *arena);
+
+
 enum _mod_kind {Module_kind=1, Interactive_kind=2, Expression_kind=3,
                  FunctionType_kind=4};
 struct _mod {
     enum _mod_kind kind;
     union {
         struct {
-            asdl_seq *body;
-            asdl_seq *type_ignores;
+            asdl_stmt_seq *body;
+            asdl_type_ignore_seq *type_ignores;
         } Module;
 
         struct {
-            asdl_seq *body;
+            asdl_stmt_seq *body;
         } Interactive;
 
         struct {
@@ -66,7 +147,7 @@ struct _mod {
         } Expression;
 
         struct {
-            asdl_seq *argtypes;
+            asdl_expr_seq *argtypes;
             expr_ty returns;
         } FunctionType;
 
@@ -87,8 +168,8 @@ struct _stmt {
         struct {
             identifier name;
             arguments_ty args;
-            asdl_seq *body;
-            asdl_seq *decorator_list;
+            asdl_stmt_seq *body;
+            asdl_expr_seq *decorator_list;
             expr_ty returns;
             string type_comment;
         } FunctionDef;
@@ -96,18 +177,18 @@ struct _stmt {
         struct {
             identifier name;
             arguments_ty args;
-            asdl_seq *body;
-            asdl_seq *decorator_list;
+            asdl_stmt_seq *body;
+            asdl_expr_seq *decorator_list;
             expr_ty returns;
             string type_comment;
         } AsyncFunctionDef;
 
         struct {
             identifier name;
-            asdl_seq *bases;
-            asdl_seq *keywords;
-            asdl_seq *body;
-            asdl_seq *decorator_list;
+            asdl_expr_seq *bases;
+            asdl_keyword_seq *keywords;
+            asdl_stmt_seq *body;
+            asdl_expr_seq *decorator_list;
         } ClassDef;
 
         struct {
@@ -115,11 +196,11 @@ struct _stmt {
         } Return;
 
         struct {
-            asdl_seq *targets;
+            asdl_expr_seq *targets;
         } Delete;
 
         struct {
-            asdl_seq *targets;
+            asdl_expr_seq *targets;
             expr_ty value;
             string type_comment;
         } Assign;
@@ -140,40 +221,40 @@ struct _stmt {
         struct {
             expr_ty target;
             expr_ty iter;
-            asdl_seq *body;
-            asdl_seq *orelse;
+            asdl_stmt_seq *body;
+            asdl_stmt_seq *orelse;
             string type_comment;
         } For;
 
         struct {
             expr_ty target;
             expr_ty iter;
-            asdl_seq *body;
-            asdl_seq *orelse;
+            asdl_stmt_seq *body;
+            asdl_stmt_seq *orelse;
             string type_comment;
         } AsyncFor;
 
         struct {
             expr_ty test;
-            asdl_seq *body;
-            asdl_seq *orelse;
+            asdl_stmt_seq *body;
+            asdl_stmt_seq *orelse;
         } While;
 
         struct {
             expr_ty test;
-            asdl_seq *body;
-            asdl_seq *orelse;
+            asdl_stmt_seq *body;
+            asdl_stmt_seq *orelse;
         } If;
 
         struct {
-            asdl_seq *items;
-            asdl_seq *body;
+            asdl_withitem_seq *items;
+            asdl_stmt_seq *body;
             string type_comment;
         } With;
 
         struct {
-            asdl_seq *items;
-            asdl_seq *body;
+            asdl_withitem_seq *items;
+            asdl_stmt_seq *body;
             string type_comment;
         } AsyncWith;
 
@@ -183,10 +264,10 @@ struct _stmt {
         } Raise;
 
         struct {
-            asdl_seq *body;
-            asdl_seq *handlers;
-            asdl_seq *orelse;
-            asdl_seq *finalbody;
+            asdl_stmt_seq *body;
+            asdl_excepthandler_seq *handlers;
+            asdl_stmt_seq *orelse;
+            asdl_stmt_seq *finalbody;
         } Try;
 
         struct {
@@ -195,21 +276,21 @@ struct _stmt {
         } Assert;
 
         struct {
-            asdl_seq *names;
+            asdl_alias_seq *names;
         } Import;
 
         struct {
             identifier module;
-            asdl_seq *names;
+            asdl_alias_seq *names;
             int level;
         } ImportFrom;
 
         struct {
-            asdl_seq *names;
+            asdl_identifier_seq *names;
         } Global;
 
         struct {
-            asdl_seq *names;
+            asdl_identifier_seq *names;
         } Nonlocal;
 
         struct {
@@ -236,7 +317,7 @@ struct _expr {
     union {
         struct {
             boolop_ty op;
-            asdl_seq *values;
+            asdl_expr_seq *values;
         } BoolOp;
 
         struct {
@@ -267,33 +348,33 @@ struct _expr {
         } IfExp;
 
         struct {
-            asdl_seq *keys;
-            asdl_seq *values;
+            asdl_expr_seq *keys;
+            asdl_expr_seq *values;
         } Dict;
 
         struct {
-            asdl_seq *elts;
+            asdl_expr_seq *elts;
         } Set;
 
         struct {
             expr_ty elt;
-            asdl_seq *generators;
+            asdl_comprehension_seq *generators;
         } ListComp;
 
         struct {
             expr_ty elt;
-            asdl_seq *generators;
+            asdl_comprehension_seq *generators;
         } SetComp;
 
         struct {
             expr_ty key;
             expr_ty value;
-            asdl_seq *generators;
+            asdl_comprehension_seq *generators;
         } DictComp;
 
         struct {
             expr_ty elt;
-            asdl_seq *generators;
+            asdl_comprehension_seq *generators;
         } GeneratorExp;
 
         struct {
@@ -311,13 +392,13 @@ struct _expr {
         struct {
             expr_ty left;
             asdl_int_seq *ops;
-            asdl_seq *comparators;
+            asdl_expr_seq *comparators;
         } Compare;
 
         struct {
             expr_ty func;
-            asdl_seq *args;
-            asdl_seq *keywords;
+            asdl_expr_seq *args;
+            asdl_keyword_seq *keywords;
         } Call;
 
         struct {
@@ -327,7 +408,7 @@ struct _expr {
         } FormattedValue;
 
         struct {
-            asdl_seq *values;
+            asdl_expr_seq *values;
         } JoinedStr;
 
         struct {
@@ -358,12 +439,12 @@ struct _expr {
         } Name;
 
         struct {
-            asdl_seq *elts;
+            asdl_expr_seq *elts;
             expr_context_ty ctx;
         } List;
 
         struct {
-            asdl_seq *elts;
+            asdl_expr_seq *elts;
             expr_context_ty ctx;
         } Tuple;
 
@@ -383,7 +464,7 @@ struct _expr {
 struct _comprehension {
     expr_ty target;
     expr_ty iter;
-    asdl_seq *ifs;
+    asdl_expr_seq *ifs;
     int is_async;
 };
 
@@ -394,7 +475,7 @@ struct _excepthandler {
         struct {
             expr_ty type;
             identifier name;
-            asdl_seq *body;
+            asdl_stmt_seq *body;
         } ExceptHandler;
 
     } v;
@@ -405,13 +486,13 @@ struct _excepthandler {
 };
 
 struct _arguments {
-    asdl_seq *posonlyargs;
-    asdl_seq *args;
+    asdl_arg_seq *posonlyargs;
+    asdl_arg_seq *args;
     arg_ty vararg;
-    asdl_seq *kwonlyargs;
-    asdl_seq *kw_defaults;
+    asdl_arg_seq *kwonlyargs;
+    asdl_expr_seq *kw_defaults;
     arg_ty kwarg;
-    asdl_seq *defaults;
+    asdl_expr_seq *defaults;
 };
 
 struct _arg {
@@ -458,39 +539,41 @@ struct _type_ignore {
 
 // Note: these macros affect function definitions, not only call sites.
 #define Module(a0, a1, a2) _Py_Module(a0, a1, a2)
-mod_ty _Py_Module(asdl_seq * body, asdl_seq * type_ignores, PyArena *arena);
+mod_ty _Py_Module(asdl_stmt_seq * body, asdl_type_ignore_seq * type_ignores,
+                  PyArena *arena);
 #define Interactive(a0, a1) _Py_Interactive(a0, a1)
-mod_ty _Py_Interactive(asdl_seq * body, PyArena *arena);
+mod_ty _Py_Interactive(asdl_stmt_seq * body, PyArena *arena);
 #define Expression(a0, a1) _Py_Expression(a0, a1)
 mod_ty _Py_Expression(expr_ty body, PyArena *arena);
 #define FunctionType(a0, a1, a2) _Py_FunctionType(a0, a1, a2)
-mod_ty _Py_FunctionType(asdl_seq * argtypes, expr_ty returns, PyArena *arena);
+mod_ty _Py_FunctionType(asdl_expr_seq * argtypes, expr_ty returns, PyArena
+                        *arena);
 #define FunctionDef(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10) _Py_FunctionDef(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10)
-stmt_ty _Py_FunctionDef(identifier name, arguments_ty args, asdl_seq * body,
-                        asdl_seq * decorator_list, expr_ty returns, string
-                        type_comment, int lineno, int col_offset, int
+stmt_ty _Py_FunctionDef(identifier name, arguments_ty args, asdl_stmt_seq *
+                        body, asdl_expr_seq * decorator_list, expr_ty returns,
+                        string type_comment, int lineno, int col_offset, int
                         end_lineno, int end_col_offset, PyArena *arena);
 #define AsyncFunctionDef(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10) _Py_AsyncFunctionDef(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10)
-stmt_ty _Py_AsyncFunctionDef(identifier name, arguments_ty args, asdl_seq *
-                             body, asdl_seq * decorator_list, expr_ty returns,
-                             string type_comment, int lineno, int col_offset,
-                             int end_lineno, int end_col_offset, PyArena
-                             *arena);
+stmt_ty _Py_AsyncFunctionDef(identifier name, arguments_ty args, asdl_stmt_seq
+                             * body, asdl_expr_seq * decorator_list, expr_ty
+                             returns, string type_comment, int lineno, int
+                             col_offset, int end_lineno, int end_col_offset,
+                             PyArena *arena);
 #define ClassDef(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9) _Py_ClassDef(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9)
-stmt_ty _Py_ClassDef(identifier name, asdl_seq * bases, asdl_seq * keywords,
-                     asdl_seq * body, asdl_seq * decorator_list, int lineno,
-                     int col_offset, int end_lineno, int end_col_offset,
-                     PyArena *arena);
+stmt_ty _Py_ClassDef(identifier name, asdl_expr_seq * bases, asdl_keyword_seq *
+                     keywords, asdl_stmt_seq * body, asdl_expr_seq *
+                     decorator_list, int lineno, int col_offset, int
+                     end_lineno, int end_col_offset, PyArena *arena);
 #define Return(a0, a1, a2, a3, a4, a5) _Py_Return(a0, a1, a2, a3, a4, a5)
 stmt_ty _Py_Return(expr_ty value, int lineno, int col_offset, int end_lineno,
                    int end_col_offset, PyArena *arena);
 #define Delete(a0, a1, a2, a3, a4, a5) _Py_Delete(a0, a1, a2, a3, a4, a5)
-stmt_ty _Py_Delete(asdl_seq * targets, int lineno, int col_offset, int
+stmt_ty _Py_Delete(asdl_expr_seq * targets, int lineno, int col_offset, int
                    end_lineno, int end_col_offset, PyArena *arena);
 #define Assign(a0, a1, a2, a3, a4, a5, a6, a7) _Py_Assign(a0, a1, a2, a3, a4, a5, a6, a7)
-stmt_ty _Py_Assign(asdl_seq * targets, expr_ty value, string type_comment, int
-                   lineno, int col_offset, int end_lineno, int end_col_offset,
-                   PyArena *arena);
+stmt_ty _Py_Assign(asdl_expr_seq * targets, expr_ty value, string type_comment,
+                   int lineno, int col_offset, int end_lineno, int
+                   end_col_offset, PyArena *arena);
 #define AugAssign(a0, a1, a2, a3, a4, a5, a6, a7) _Py_AugAssign(a0, a1, a2, a3, a4, a5, a6, a7)
 stmt_ty _Py_AugAssign(expr_ty target, operator_ty op, expr_ty value, int
                       lineno, int col_offset, int end_lineno, int
@@ -500,52 +583,54 @@ stmt_ty _Py_AnnAssign(expr_ty target, expr_ty annotation, expr_ty value, int
                       simple, int lineno, int col_offset, int end_lineno, int
                       end_col_offset, PyArena *arena);
 #define For(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9) _Py_For(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9)
-stmt_ty _Py_For(expr_ty target, expr_ty iter, asdl_seq * body, asdl_seq *
-                orelse, string type_comment, int lineno, int col_offset, int
-                end_lineno, int end_col_offset, PyArena *arena);
+stmt_ty _Py_For(expr_ty target, expr_ty iter, asdl_stmt_seq * body,
+                asdl_stmt_seq * orelse, string type_comment, int lineno, int
+                col_offset, int end_lineno, int end_col_offset, PyArena *arena);
 #define AsyncFor(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9) _Py_AsyncFor(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9)
-stmt_ty _Py_AsyncFor(expr_ty target, expr_ty iter, asdl_seq * body, asdl_seq *
-                     orelse, string type_comment, int lineno, int col_offset,
-                     int end_lineno, int end_col_offset, PyArena *arena);
+stmt_ty _Py_AsyncFor(expr_ty target, expr_ty iter, asdl_stmt_seq * body,
+                     asdl_stmt_seq * orelse, string type_comment, int lineno,
+                     int col_offset, int end_lineno, int end_col_offset,
+                     PyArena *arena);
 #define While(a0, a1, a2, a3, a4, a5, a6, a7) _Py_While(a0, a1, a2, a3, a4, a5, a6, a7)
-stmt_ty _Py_While(expr_ty test, asdl_seq * body, asdl_seq * orelse, int lineno,
-                  int col_offset, int end_lineno, int end_col_offset, PyArena
-                  *arena);
+stmt_ty _Py_While(expr_ty test, asdl_stmt_seq * body, asdl_stmt_seq * orelse,
+                  int lineno, int col_offset, int end_lineno, int
+                  end_col_offset, PyArena *arena);
 #define If(a0, a1, a2, a3, a4, a5, a6, a7) _Py_If(a0, a1, a2, a3, a4, a5, a6, a7)
-stmt_ty _Py_If(expr_ty test, asdl_seq * body, asdl_seq * orelse, int lineno,
-               int col_offset, int end_lineno, int end_col_offset, PyArena
-               *arena);
+stmt_ty _Py_If(expr_ty test, asdl_stmt_seq * body, asdl_stmt_seq * orelse, int
+               lineno, int col_offset, int end_lineno, int end_col_offset,
+               PyArena *arena);
 #define With(a0, a1, a2, a3, a4, a5, a6, a7) _Py_With(a0, a1, a2, a3, a4, a5, a6, a7)
-stmt_ty _Py_With(asdl_seq * items, asdl_seq * body, string type_comment, int
-                 lineno, int col_offset, int end_lineno, int end_col_offset,
-                 PyArena *arena);
+stmt_ty _Py_With(asdl_withitem_seq * items, asdl_stmt_seq * body, string
+                 type_comment, int lineno, int col_offset, int end_lineno, int
+                 end_col_offset, PyArena *arena);
 #define AsyncWith(a0, a1, a2, a3, a4, a5, a6, a7) _Py_AsyncWith(a0, a1, a2, a3, a4, a5, a6, a7)
-stmt_ty _Py_AsyncWith(asdl_seq * items, asdl_seq * body, string type_comment,
-                      int lineno, int col_offset, int end_lineno, int
-                      end_col_offset, PyArena *arena);
+stmt_ty _Py_AsyncWith(asdl_withitem_seq * items, asdl_stmt_seq * body, string
+                      type_comment, int lineno, int col_offset, int end_lineno,
+                      int end_col_offset, PyArena *arena);
 #define Raise(a0, a1, a2, a3, a4, a5, a6) _Py_Raise(a0, a1, a2, a3, a4, a5, a6)
 stmt_ty _Py_Raise(expr_ty exc, expr_ty cause, int lineno, int col_offset, int
                   end_lineno, int end_col_offset, PyArena *arena);
 #define Try(a0, a1, a2, a3, a4, a5, a6, a7, a8) _Py_Try(a0, a1, a2, a3, a4, a5, a6, a7, a8)
-stmt_ty _Py_Try(asdl_seq * body, asdl_seq * handlers, asdl_seq * orelse,
-                asdl_seq * finalbody, int lineno, int col_offset, int
-                end_lineno, int end_col_offset, PyArena *arena);
+stmt_ty _Py_Try(asdl_stmt_seq * body, asdl_excepthandler_seq * handlers,
+                asdl_stmt_seq * orelse, asdl_stmt_seq * finalbody, int lineno,
+                int col_offset, int end_lineno, int end_col_offset, PyArena
+                *arena);
 #define Assert(a0, a1, a2, a3, a4, a5, a6) _Py_Assert(a0, a1, a2, a3, a4, a5, a6)
 stmt_ty _Py_Assert(expr_ty test, expr_ty msg, int lineno, int col_offset, int
                    end_lineno, int end_col_offset, PyArena *arena);
 #define Import(a0, a1, a2, a3, a4, a5) _Py_Import(a0, a1, a2, a3, a4, a5)
-stmt_ty _Py_Import(asdl_seq * names, int lineno, int col_offset, int
+stmt_ty _Py_Import(asdl_alias_seq * names, int lineno, int col_offset, int
                    end_lineno, int end_col_offset, PyArena *arena);
 #define ImportFrom(a0, a1, a2, a3, a4, a5, a6, a7) _Py_ImportFrom(a0, a1, a2, a3, a4, a5, a6, a7)
-stmt_ty _Py_ImportFrom(identifier module, asdl_seq * names, int level, int
-                       lineno, int col_offset, int end_lineno, int
+stmt_ty _Py_ImportFrom(identifier module, asdl_alias_seq * names, int level,
+                       int lineno, int col_offset, int end_lineno, int
                        end_col_offset, PyArena *arena);
 #define Global(a0, a1, a2, a3, a4, a5) _Py_Global(a0, a1, a2, a3, a4, a5)
-stmt_ty _Py_Global(asdl_seq * names, int lineno, int col_offset, int
+stmt_ty _Py_Global(asdl_identifier_seq * names, int lineno, int col_offset, int
                    end_lineno, int end_col_offset, PyArena *arena);
 #define Nonlocal(a0, a1, a2, a3, a4, a5) _Py_Nonlocal(a0, a1, a2, a3, a4, a5)
-stmt_ty _Py_Nonlocal(asdl_seq * names, int lineno, int col_offset, int
-                     end_lineno, int end_col_offset, PyArena *arena);
+stmt_ty _Py_Nonlocal(asdl_identifier_seq * names, int lineno, int col_offset,
+                     int end_lineno, int end_col_offset, PyArena *arena);
 #define Expr(a0, a1, a2, a3, a4, a5) _Py_Expr(a0, a1, a2, a3, a4, a5)
 stmt_ty _Py_Expr(expr_ty value, int lineno, int col_offset, int end_lineno, int
                  end_col_offset, PyArena *arena);
@@ -559,8 +644,9 @@ stmt_ty _Py_Break(int lineno, int col_offset, int end_lineno, int
 stmt_ty _Py_Continue(int lineno, int col_offset, int end_lineno, int
                      end_col_offset, PyArena *arena);
 #define BoolOp(a0, a1, a2, a3, a4, a5, a6) _Py_BoolOp(a0, a1, a2, a3, a4, a5, a6)
-expr_ty _Py_BoolOp(boolop_ty op, asdl_seq * values, int lineno, int col_offset,
-                   int end_lineno, int end_col_offset, PyArena *arena);
+expr_ty _Py_BoolOp(boolop_ty op, asdl_expr_seq * values, int lineno, int
+                   col_offset, int end_lineno, int end_col_offset, PyArena
+                   *arena);
 #define NamedExpr(a0, a1, a2, a3, a4, a5, a6) _Py_NamedExpr(a0, a1, a2, a3, a4, a5, a6)
 expr_ty _Py_NamedExpr(expr_ty target, expr_ty value, int lineno, int
                       col_offset, int end_lineno, int end_col_offset, PyArena
@@ -580,28 +666,28 @@ expr_ty _Py_IfExp(expr_ty test, expr_ty body, expr_ty orelse, int lineno, int
                   col_offset, int end_lineno, int end_col_offset, PyArena
                   *arena);
 #define Dict(a0, a1, a2, a3, a4, a5, a6) _Py_Dict(a0, a1, a2, a3, a4, a5, a6)
-expr_ty _Py_Dict(asdl_seq * keys, asdl_seq * values, int lineno, int
+expr_ty _Py_Dict(asdl_expr_seq * keys, asdl_expr_seq * values, int lineno, int
                  col_offset, int end_lineno, int end_col_offset, PyArena
                  *arena);
 #define Set(a0, a1, a2, a3, a4, a5) _Py_Set(a0, a1, a2, a3, a4, a5)
-expr_ty _Py_Set(asdl_seq * elts, int lineno, int col_offset, int end_lineno,
-                int end_col_offset, PyArena *arena);
+expr_ty _Py_Set(asdl_expr_seq * elts, int lineno, int col_offset, int
+                end_lineno, int end_col_offset, PyArena *arena);
 #define ListComp(a0, a1, a2, a3, a4, a5, a6) _Py_ListComp(a0, a1, a2, a3, a4, a5, a6)
-expr_ty _Py_ListComp(expr_ty elt, asdl_seq * generators, int lineno, int
-                     col_offset, int end_lineno, int end_col_offset, PyArena
-                     *arena);
-#define SetComp(a0, a1, a2, a3, a4, a5, a6) _Py_SetComp(a0, a1, a2, a3, a4, a5, a6)
-expr_ty _Py_SetComp(expr_ty elt, asdl_seq * generators, int lineno, int
-                    col_offset, int end_lineno, int end_col_offset, PyArena
-                    *arena);
-#define DictComp(a0, a1, a2, a3, a4, a5, a6, a7) _Py_DictComp(a0, a1, a2, a3, a4, a5, a6, a7)
-expr_ty _Py_DictComp(expr_ty key, expr_ty value, asdl_seq * generators, int
+expr_ty _Py_ListComp(expr_ty elt, asdl_comprehension_seq * generators, int
                      lineno, int col_offset, int end_lineno, int
                      end_col_offset, PyArena *arena);
+#define SetComp(a0, a1, a2, a3, a4, a5, a6) _Py_SetComp(a0, a1, a2, a3, a4, a5, a6)
+expr_ty _Py_SetComp(expr_ty elt, asdl_comprehension_seq * generators, int
+                    lineno, int col_offset, int end_lineno, int end_col_offset,
+                    PyArena *arena);
+#define DictComp(a0, a1, a2, a3, a4, a5, a6, a7) _Py_DictComp(a0, a1, a2, a3, a4, a5, a6, a7)
+expr_ty _Py_DictComp(expr_ty key, expr_ty value, asdl_comprehension_seq *
+                     generators, int lineno, int col_offset, int end_lineno,
+                     int end_col_offset, PyArena *arena);
 #define GeneratorExp(a0, a1, a2, a3, a4, a5, a6) _Py_GeneratorExp(a0, a1, a2, a3, a4, a5, a6)
-expr_ty _Py_GeneratorExp(expr_ty elt, asdl_seq * generators, int lineno, int
-                         col_offset, int end_lineno, int end_col_offset,
-                         PyArena *arena);
+expr_ty _Py_GeneratorExp(expr_ty elt, asdl_comprehension_seq * generators, int
+                         lineno, int col_offset, int end_lineno, int
+                         end_col_offset, PyArena *arena);
 #define Await(a0, a1, a2, a3, a4, a5) _Py_Await(a0, a1, a2, a3, a4, a5)
 expr_ty _Py_Await(expr_ty value, int lineno, int col_offset, int end_lineno,
                   int end_col_offset, PyArena *arena);
@@ -612,19 +698,19 @@ expr_ty _Py_Yield(expr_ty value, int lineno, int col_offset, int end_lineno,
 expr_ty _Py_YieldFrom(expr_ty value, int lineno, int col_offset, int
                       end_lineno, int end_col_offset, PyArena *arena);
 #define Compare(a0, a1, a2, a3, a4, a5, a6, a7) _Py_Compare(a0, a1, a2, a3, a4, a5, a6, a7)
-expr_ty _Py_Compare(expr_ty left, asdl_int_seq * ops, asdl_seq * comparators,
-                    int lineno, int col_offset, int end_lineno, int
-                    end_col_offset, PyArena *arena);
+expr_ty _Py_Compare(expr_ty left, asdl_int_seq * ops, asdl_expr_seq *
+                    comparators, int lineno, int col_offset, int end_lineno,
+                    int end_col_offset, PyArena *arena);
 #define Call(a0, a1, a2, a3, a4, a5, a6, a7) _Py_Call(a0, a1, a2, a3, a4, a5, a6, a7)
-expr_ty _Py_Call(expr_ty func, asdl_seq * args, asdl_seq * keywords, int
-                 lineno, int col_offset, int end_lineno, int end_col_offset,
-                 PyArena *arena);
+expr_ty _Py_Call(expr_ty func, asdl_expr_seq * args, asdl_keyword_seq *
+                 keywords, int lineno, int col_offset, int end_lineno, int
+                 end_col_offset, PyArena *arena);
 #define FormattedValue(a0, a1, a2, a3, a4, a5, a6, a7) _Py_FormattedValue(a0, a1, a2, a3, a4, a5, a6, a7)
 expr_ty _Py_FormattedValue(expr_ty value, int conversion, expr_ty format_spec,
                            int lineno, int col_offset, int end_lineno, int
                            end_col_offset, PyArena *arena);
 #define JoinedStr(a0, a1, a2, a3, a4, a5) _Py_JoinedStr(a0, a1, a2, a3, a4, a5)
-expr_ty _Py_JoinedStr(asdl_seq * values, int lineno, int col_offset, int
+expr_ty _Py_JoinedStr(asdl_expr_seq * values, int lineno, int col_offset, int
                       end_lineno, int end_col_offset, PyArena *arena);
 #define Constant(a0, a1, a2, a3, a4, a5, a6) _Py_Constant(a0, a1, a2, a3, a4, a5, a6)
 expr_ty _Py_Constant(constant value, string kind, int lineno, int col_offset,
@@ -646,11 +732,11 @@ expr_ty _Py_Name(identifier id, expr_context_ty ctx, int lineno, int
                  col_offset, int end_lineno, int end_col_offset, PyArena
                  *arena);
 #define List(a0, a1, a2, a3, a4, a5, a6) _Py_List(a0, a1, a2, a3, a4, a5, a6)
-expr_ty _Py_List(asdl_seq * elts, expr_context_ty ctx, int lineno, int
+expr_ty _Py_List(asdl_expr_seq * elts, expr_context_ty ctx, int lineno, int
                  col_offset, int end_lineno, int end_col_offset, PyArena
                  *arena);
 #define Tuple(a0, a1, a2, a3, a4, a5, a6) _Py_Tuple(a0, a1, a2, a3, a4, a5, a6)
-expr_ty _Py_Tuple(asdl_seq * elts, expr_context_ty ctx, int lineno, int
+expr_ty _Py_Tuple(asdl_expr_seq * elts, expr_context_ty ctx, int lineno, int
                   col_offset, int end_lineno, int end_col_offset, PyArena
                   *arena);
 #define Slice(a0, a1, a2, a3, a4, a5, a6, a7) _Py_Slice(a0, a1, a2, a3, a4, a5, a6, a7)
@@ -658,18 +744,18 @@ expr_ty _Py_Slice(expr_ty lower, expr_ty upper, expr_ty step, int lineno, int
                   col_offset, int end_lineno, int end_col_offset, PyArena
                   *arena);
 #define comprehension(a0, a1, a2, a3, a4) _Py_comprehension(a0, a1, a2, a3, a4)
-comprehension_ty _Py_comprehension(expr_ty target, expr_ty iter, asdl_seq *
-                                   ifs, int is_async, PyArena *arena);
+comprehension_ty _Py_comprehension(expr_ty target, expr_ty iter, asdl_expr_seq
+                                   * ifs, int is_async, PyArena *arena);
 #define ExceptHandler(a0, a1, a2, a3, a4, a5, a6, a7) _Py_ExceptHandler(a0, a1, a2, a3, a4, a5, a6, a7)
-excepthandler_ty _Py_ExceptHandler(expr_ty type, identifier name, asdl_seq *
-                                   body, int lineno, int col_offset, int
+excepthandler_ty _Py_ExceptHandler(expr_ty type, identifier name, asdl_stmt_seq
+                                   * body, int lineno, int col_offset, int
                                    end_lineno, int end_col_offset, PyArena
                                    *arena);
 #define arguments(a0, a1, a2, a3, a4, a5, a6, a7) _Py_arguments(a0, a1, a2, a3, a4, a5, a6, a7)
-arguments_ty _Py_arguments(asdl_seq * posonlyargs, asdl_seq * args, arg_ty
-                           vararg, asdl_seq * kwonlyargs, asdl_seq *
-                           kw_defaults, arg_ty kwarg, asdl_seq * defaults,
-                           PyArena *arena);
+arguments_ty _Py_arguments(asdl_arg_seq * posonlyargs, asdl_arg_seq * args,
+                           arg_ty vararg, asdl_arg_seq * kwonlyargs,
+                           asdl_expr_seq * kw_defaults, arg_ty kwarg,
+                           asdl_expr_seq * defaults, PyArena *arena);
 #define arg(a0, a1, a2, a3, a4, a5, a6, a7) _Py_arg(a0, a1, a2, a3, a4, a5, a6, a7)
 arg_ty _Py_arg(identifier arg, expr_ty annotation, string type_comment, int
                lineno, int col_offset, int end_lineno, int end_col_offset,
diff --git a/Include/asdl.h b/Include/asdl.h
index e962560bcd4cb..8b61e16c329ea 100644
--- a/Include/asdl.h
+++ b/Include/asdl.h
@@ -13,25 +13,80 @@ typedef PyObject * constant;
    interned Python strings.
 */
 
-/* XXX A sequence should be typed so that its use can be typechecked. */
+#define _ASDL_SEQ_HEAD \
+    Py_ssize_t size;   \
+    void **elements;
 
 typedef struct {
-    Py_ssize_t size;
-    void *elements[1];
+    _ASDL_SEQ_HEAD
 } asdl_seq;
 
 typedef struct {
-    Py_ssize_t size;
-    int elements[1];
+    _ASDL_SEQ_HEAD
+    void *typed_elements[1];
+} asdl_generic_seq;
+
+typedef struct {
+    _ASDL_SEQ_HEAD
+    PyObject *typed_elements[1];
+} asdl_identifier_seq;
+
+typedef struct {
+    _ASDL_SEQ_HEAD
+    int typed_elements[1];
 } asdl_int_seq;
 
-asdl_seq *_Py_asdl_seq_new(Py_ssize_t size, PyArena *arena);
+asdl_generic_seq *_Py_asdl_generic_seq_new(Py_ssize_t size, PyArena *arena);
+asdl_identifier_seq *_Py_asdl_identifier_seq_new(Py_ssize_t size, PyArena *arena);
 asdl_int_seq *_Py_asdl_int_seq_new(Py_ssize_t size, PyArena *arena);
 
-#define asdl_seq_GET(S, I) (S)->elements[(I)]
+
+#define GENERATE_ASDL_SEQ_CONSTRUCTOR(NAME, TYPE) \
+asdl_ ## NAME ## _seq *_Py_asdl_ ## NAME ## _seq_new(Py_ssize_t size, PyArena *arena) \
+{ \
+    asdl_ ## NAME ## _seq *seq = NULL; \
+    size_t n; \
+    /* check size is sane */ \
+    if (size < 0 || \
+        (size && (((size_t)size - 1) > (SIZE_MAX / sizeof(void *))))) { \
+        PyErr_NoMemory(); \
+        return NULL; \
+    } \
+    n = (size ? (sizeof(TYPE *) * (size - 1)) : 0); \
+    /* check if size can be added safely */ \
+    if (n > SIZE_MAX - sizeof(asdl_ ## NAME ## _seq)) { \
+        PyErr_NoMemory(); \
+        return NULL; \
+    } \
+    n += sizeof(asdl_ ## NAME ## _seq); \
+    seq = (asdl_ ## NAME ## _seq *)PyArena_Malloc(arena, n); \
+    if (!seq) { \
+        PyErr_NoMemory(); \
+        return NULL; \
+    } \
+    memset(seq, 0, n); \
+    seq->size = size; \
+    seq->elements = (void**)seq->typed_elements; \
+    return seq; \
+}
+
+#define asdl_seq_GET_UNTYPED(S, I) (S)->elements[(I)]
+#define asdl_seq_GET(S, I) (S)->typed_elements[(I)]
 #define asdl_seq_LEN(S) ((S) == NULL ? 0 : (S)->size)
 #ifdef Py_DEBUG
 #define asdl_seq_SET(S, I, V) \
+    do { \
+        Py_ssize_t _asdl_i = (I); \
+        assert((S) != NULL); \
+        assert(0 <= _asdl_i && _asdl_i < (S)->size); \
+        (S)->typed_elements[_asdl_i] = (V); \
+    } while (0)
+#else
+#define asdl_seq_SET(S, I, V) (S)->typed_elements[I] = (V)
+#endif
+
+#ifdef Py_DEBUG
+#define asdl_seq_SET_UNTYPED(S, I, V) \
     do { \
         Py_ssize_t _asdl_i = (I); \
         assert((S) != NULL); \
@@ -39,7 +94,7 @@ asdl_int_seq *_Py_asdl_int_seq_new(Py_ssize_t size, PyArena *arena);
         (S)->elements[_asdl_i] = (V); \
     } while (0)
 #else
-#define asdl_seq_SET(S, I, V) (S)->elements[I] = (V)
+#define asdl_seq_SET_UNTYPED(S, I, V) (S)->elements[I] = (V)
 #endif
 
 #endif /* !Py_ASDL_H */
diff --git a/Include/ast.h b/Include/ast.h
index de42a3b5e6f91..434ee18dd91b2 100644
--- a/Include/ast.h
+++ b/Include/ast.h
@@ -15,7 +15,7 @@ PyAPI_FUNC(PyObject *) _PyAST_ExprAsUnicode(expr_ty);
 /* Return the borrowed reference to the first literal string in the
    sequence of statements or NULL if it doesn't start from a literal string.
    Doesn't set exception. */
-PyAPI_FUNC(PyObject *) _PyAST_GetDocString(asdl_seq *);
+PyAPI_FUNC(PyObject *) _PyAST_GetDocString(asdl_stmt_seq *);
 
 #ifdef __cplusplus
 }
diff --git a/Parser/asdl_c.py b/Parser/asdl_c.py
index 0c053393d688b..242eccf3d37d7 100755
--- a/Parser/asdl_c.py
+++ b/Parser/asdl_c.py
@@ -163,6 +163,32 @@ def visitProduct(self, product, name, depth):
         self.emit(s, depth)
         self.emit("", depth)
 
+class SequenceDefVisitor(EmitVisitor):
+    def visitModule(self, mod):
+        for dfn in mod.dfns:
+            self.visit(dfn)
+
+    def visitType(self, type, depth=0):
+        self.visit(type.value, type.name, depth)
+
+    def visitSum(self, sum, name, depth):
+        if is_simple(sum):
+            return
+        self.emit_sequence_constructor(name, depth)
+
+    def emit_sequence_constructor(self, name,depth):
+        ctype = get_c_type(name)
+        self.emit("""\
+typedef struct {
+    _ASDL_SEQ_HEAD
+    %(ctype)s typed_elements[1];
+} asdl_%(name)s_seq;""" % locals(), reflow=False, depth=depth)
+        self.emit("", depth)
+        self.emit("asdl_%(name)s_seq *_Py_asdl_%(name)s_seq_new(Py_ssize_t size, PyArena *arena);" % locals(), depth)
+        self.emit("", depth)
+
+    def visitProduct(self, product, name, depth):
+        self.emit_sequence_constructor(name, depth)
 
 class StructVisitor(EmitVisitor):
     """Visitor to generate typedefs for AST."""
@@ -219,7 +245,8 @@ def visitField(self, field, depth):
             if field.type == 'cmpop':
                 self.emit("asdl_int_seq *%(name)s;" % locals(), depth)
             else:
-                self.emit("asdl_seq *%(name)s;" % locals(), depth)
+                _type = field.type
+                self.emit("asdl_%(_type)s_seq *%(name)s;" % locals(), depth)
         else:
             self.emit("%(ctype)s %(name)s;" % locals(), depth)
 
@@ -274,7 +301,7 @@ def get_args(self, fields):
                 if f.type == 'cmpop':
                     ctype = "asdl_int_seq *"
                 else:
-                    ctype = "asdl_seq *"
+                    ctype = f"asdl_{f.type}_seq *"
             else:
                 ctype = get_c_type(f.type)
             args.append((ctype, name, f.opt or f.seq))
@@ -507,7 +534,8 @@ def visitFieldDeclaration(self, field, name, sum=None, prod=None, depth=0):
             if self.isSimpleType(field):
                 self.emit("asdl_int_seq* %s;" % field.name, depth)
             else:
-                self.emit("asdl_seq* %s;" % field.name, depth)
+                _type = field.type
+                self.emit(f"asdl_{field.type}_seq* {field.name};", depth)
         else:
             ctype = get_c_type(field.type)
             self.emit("%s %s;" % (ctype, field.name), depth)
@@ -562,7 +590,7 @@ def visitField(self, field, name, sum=None, prod=None, depth=0):
             if self.isSimpleType(field):
                 self.emit("%s = _Py_asdl_int_seq_new(len, arena);" % field.name, depth+1)
             else:
-                self.emit("%s = _Py_asdl_seq_new(len, arena);" % field.name, depth+1)
+                self.emit("%s = _Py_asdl_%s_seq_new(len, arena);" % (field.name, field.type), depth+1)
             self.emit("if (%s == NULL) goto failed;" % field.name, depth+1)
             self.emit("for (i = 0; i < len; i++) {", depth+1)
             self.emit("%s val;" % ctype, depth+2)
@@ -600,6 +628,24 @@ def prototype(self, sum, name):
     visitProduct = visitSum = prototype
 
 
+class SequenceConstructorVisitor(EmitVisitor):
+    def visitModule(self, mod):
+        for dfn in mod.dfns:
+            self.visit(dfn)
+
+    def visitType(self, type):
+        self.visit(type.value, type.name)
+
+    def visitProduct(self, prod, name):
+        self.emit_sequence_constructor(name, get_c_type(name))
+
+    def visitSum(self, sum, name):
+        if not is_simple(sum):
+            self.emit_sequence_constructor(name, get_c_type(name))
+
+    def emit_sequence_constructor(self, name, type):
+        self.emit(f"GENERATE_ASDL_SEQ_CONSTRUCTOR({name}, {type})", depth=0)
+
 class PyTypesDeclareVisitor(PickleVisitor):
 
     def visitProduct(self, prod, name):
@@ -647,6 +693,7 @@ def visitConstructor(self, cons, name):
                 self.emit('"%s",' % t.name, 1)
             self.emit("};",0)
 
+
 class PyTypesVisitor(PickleVisitor):
 
     def visitModule(self, mod):
@@ -874,7 +921,7 @@ def visitModule(self, mod):
     if (!result)
         return NULL;
     for (i = 0; i < n; i++) {
-        value = func(state, asdl_seq_GET(seq, i));
+        value = func(state, asdl_seq_GET_UNTYPED(seq, i));
         if (!value) {
             Py_DECREF(result);
             return NULL;
@@ -1264,7 +1311,7 @@ def set(self, field, value, depth):
                           depth+2, reflow=False)
                 self.emit("}", depth)
             else:
-                self.emit("value = ast2obj_list(state, %s, ast2obj_%s);" % (value, field.type), depth)
+                self.emit("value = ast2obj_list(state, (asdl_seq*)%s, ast2obj_%s);" % (value, field.type), depth)
         else:
             ctype = get_c_type(field.type)
             self.emit("value = ast2obj_%s(state, %s);" % (field.type, value), depth, reflow=False)
@@ -1431,6 +1478,7 @@ def write_header(f, mod):
     f.write('#undef Yield   /* undefine macro conflicting with <winbase.h> */\n')
     f.write('\n')
     c = ChainOfVisitors(TypeDefVisitor(f),
+                        SequenceDefVisitor(f),
                         StructVisitor(f))
     c.visit(mod)
     f.write("// Note: these macros affect function definitions, not only call sites.\n")
@@ -1457,6 +1505,7 @@ def write_source(f, mod):
     generate_module_def(f, mod)
 
     v = ChainOfVisitors(
+        SequenceConstructorVisitor(f),
         PyTypesDeclareVisitor(f),
         PyTypesVisitor(f),
         Obj2ModPrototypeVisitor(f),
diff --git a/Parser/parser.c b/Parser/parser.c
index 8a7cb62fd7cf8..1bd74a38fbc2b 100644
--- a/Parser/parser.c
+++ b/Parser/parser.c
@@ -389,11 +389,11 @@ static mod_ty interactive_rule(Parser *p);
 static mod_ty eval_rule(Parser *p);
 static mod_ty func_type_rule(Parser *p);
 static expr_ty fstring_rule(Parser *p);
-static asdl_seq* type_expressions_rule(Parser *p);
-static asdl_seq* statements_rule(Parser *p);
-static asdl_seq* statement_rule(Parser *p);
-static asdl_seq* statement_newline_rule(Parser *p);
-static asdl_seq* simple_stmt_rule(Parser *p);
+static asdl_expr_seq* type_expressions_rule(Parser *p);
+static asdl_stmt_seq* statements_rule(Parser *p);
+static asdl_stmt_seq* statement_rule(Parser *p);
+static asdl_stmt_seq* statement_newline_rule(Parser *p);
+static asdl_stmt_seq* simple_stmt_rule(Parser *p);
 static stmt_ty small_stmt_rule(Parser *p);
 static stmt_ty compound_stmt_rule(Parser *p);
 static stmt_ty assignment_rule(Parser *p);
@@ -406,22 +406,22 @@ static stmt_ty del_stmt_rule(Parser *p);
 static stmt_ty import_stmt_rule(Parser *p);
 static stmt_ty import_name_rule(Parser *p);
 static stmt_ty import_from_rule(Parser *p);
-static asdl_seq* import_from_targets_rule(Parser *p);
-static asdl_seq* import_from_as_names_rule(Parser *p);
+static asdl_alias_seq* import_from_targets_rule(Parser *p);
+static asdl_alias_seq* import_from_as_names_rule(Parser *p);
 static alias_ty import_from_as_name_rule(Parser *p);
-static asdl_seq* dotted_as_names_rule(Parser *p);
+static asdl_alias_seq* dotted_as_names_rule(Parser *p);
 static alias_ty dotted_as_name_rule(Parser *p);
 static expr_ty dotted_name_rule(Parser *p);
 static stmt_ty if_stmt_rule(Parser *p);
 static stmt_ty elif_stmt_rule(Parser *p);
-static asdl_seq* else_block_rule(Parser *p);
+static asdl_stmt_seq* else_block_rule(Parser *p);
 static stmt_ty while_stmt_rule(Parser *p);
 static stmt_ty for_stmt_rule(Parser *p);
 static stmt_ty with_stmt_rule(Parser *p);
 static withitem_ty with_item_rule(Parser *p);
 static stmt_ty try_stmt_rule(Parser *p);
 static excepthandler_ty except_block_rule(Parser *p);
-static asdl_seq* finally_block_rule(Parser *p);
+static asdl_stmt_seq* finally_block_rule(Parser *p);
 static stmt_ty return_stmt_rule(Parser *p);
 static stmt_ty raise_stmt_rule(Parser *p);
 static stmt_ty function_def_rule(Parser *p);
@@ -429,7 +429,7 @@ static stmt_ty function_def_raw_rule(Parser *p);
 static Token* func_type_comment_rule(Parser *p);
 static arguments_ty params_rule(Parser *p);
 static arguments_ty parameters_rule(Parser *p);
-static asdl_seq* slash_no_default_rule(Parser *p);
+static asdl_arg_seq* slash_no_default_rule(Parser *p);
 static SlashWithDefault* slash_with_default_rule(Parser *p);
 static StarEtc* star_etc_rule(Parser *p);
 static arg_ty kwds_rule(Parser *p);
@@ -439,14 +439,14 @@ static NameDefaultPair* param_maybe_default_rule(Parser *p);
 static arg_ty param_rule(Parser *p);
 static expr_ty annotation_rule(Parser *p);
 static expr_ty default_rule(Parser *p);
-static asdl_seq* decorators_rule(Parser *p);
+static asdl_expr_seq* decorators_rule(Parser *p);
 static stmt_ty class_def_rule(Parser *p);
 static stmt_ty class_def_raw_rule(Parser *p);
-static asdl_seq* block_rule(Parser *p);
-static asdl_seq* expressions_list_rule(Parser *p);
+static asdl_stmt_seq* block_rule(Parser *p);
+static asdl_expr_seq* expressions_list_rule(Parser *p);
 static expr_ty star_expressions_rule(Parser *p);
 static expr_ty star_expression_rule(Parser *p);
-static asdl_seq* star_named_expressions_rule(Parser *p);
+static asdl_expr_seq* star_named_expressions_rule(Parser *p);
 static expr_ty star_named_expression_rule(Parser *p);
 static expr_ty named_expression_rule(Parser *p);
 static expr_ty annotated_rhs_rule(Parser *p);
@@ -455,7 +455,7 @@ static expr_ty expression_rule(Parser *p);
 static expr_ty lambdef_rule(Parser *p);
 static arguments_ty lambda_params_rule(Parser *p);
 static arguments_ty lambda_parameters_rule(Parser *p);
-static asdl_seq* lambda_slash_no_default_rule(Parser *p);
+static asdl_arg_seq* lambda_slash_no_default_rule(Parser *p);
 static SlashWithDefault* lambda_slash_with_default_rule(Parser *p);
 static StarEtc* lambda_star_etc_rule(Parser *p);
 static arg_ty lambda_kwds_rule(Parser *p);
@@ -504,7 +504,7 @@ static expr_ty dictcomp_rule(Parser *p);
 static asdl_seq* double_starred_kvpairs_rule(Parser *p);
 static KeyValuePair* double_starred_kvpair_rule(Parser *p);
 static KeyValuePair* kvpair_rule(Parser *p);
-static asdl_seq* for_if_clauses_rule(Parser *p);
+static asdl_comprehension_seq* for_if_clauses_rule(Parser *p);
 static comprehension_ty for_if_clause_rule(Parser *p);
 static expr_ty yield_expr_rule(Parser *p);
 static expr_ty arguments_rule(Parser *p);
@@ -514,15 +514,15 @@ static expr_ty starred_expression_rule(Parser *p);
 static KeywordOrStarred* kwarg_or_starred_rule(Parser *p);
 static KeywordOrStarred* kwarg_or_double_starred_rule(Parser *p);
 static expr_ty star_targets_rule(Parser *p);
-static asdl_seq* star_targets_seq_rule(Parser *p);
+static asdl_expr_seq* star_targets_seq_rule(Parser *p);
 static expr_ty star_target_rule(Parser *p);
 static expr_ty star_atom_rule(Parser *p);
 static expr_ty single_target_rule(Parser *p);
 static expr_ty single_subscript_attribute_target_rule(Parser *p);
-static asdl_seq* del_targets_rule(Parser *p);
+static asdl_expr_seq* del_targets_rule(Parser *p);
 static expr_ty del_target_rule(Parser *p);
 static expr_ty del_t_atom_rule(Parser *p);
-static asdl_seq* targets_rule(Parser *p);
+static asdl_expr_seq* targets_rule(Parser *p);
 static expr_ty target_rule(Parser *p);
 static expr_ty t_primary_rule(Parser *p);
 static void *t_lookahead_rule(Parser *p);
@@ -764,7 +764,7 @@ interactive_rule(Parser *p)
             return NULL;
         }
         D(fprintf(stderr, "%*c> interactive[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "statement_newline"));
-        asdl_seq* a;
+        asdl_stmt_seq* a;
         if (
             (a = statement_newline_rule(p))  // statement_newline
         )
@@ -938,7 +938,7 @@ fstring_rule(Parser *p)
 //     | '*' expression
 //     | '**' expression
 //     | ','.expression+
-static asdl_seq*
+static asdl_expr_seq*
 type_expressions_rule(Parser *p)
 {
     D(p->level++);
@@ -946,7 +946,7 @@ type_expressions_rule(Parser *p)
         D(p->level--);
         return NULL;
     }
-    asdl_seq* _res = NULL;
+    asdl_expr_seq* _res = NULL;
     int _mark = p->mark;
     { // ','.expression+ ',' '*' expression ',' '**' expression
         if (p->error_indicator) {
@@ -978,7 +978,7 @@ type_expressions_rule(Parser *p)
         )
         {
             D(fprintf(stderr, "%*c+ type_expressions[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.expression+ ',' '*' expression ',' '**' expression"));
-            _res = _PyPegen_seq_append_to_end ( p , CHECK ( _PyPegen_seq_append_to_end ( p , a , b ) ) , c );
+            _res = ( asdl_expr_seq * ) _PyPegen_seq_append_to_end ( p , CHECK ( _PyPegen_seq_append_to_end ( p , a , b ) ) , c );
             if (_res == NULL && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 D(p->level--);
@@ -1011,7 +1011,7 @@ type_expressions_rule(Parser *p)
         )
         {
             D(fprintf(stderr, "%*c+ type_expressions[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.expression+ ',' '*' expression"));
-            _res = _PyPegen_seq_append_to_end ( p , a , b );
+            _res = ( asdl_expr_seq * ) _PyPegen_seq_append_to_end ( p , a , b );
             if (_res == NULL && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 D(p->level--);
@@ -1044,7 +1044,7 @@ type_expressions_rule(Parser *p)
         )
         {
             D(fprintf(stderr, "%*c+ type_expressions[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.expression+ ',' '**' expression"));
-            _res = _PyPegen_seq_append_to_end ( p , a , b );
+            _res = ( asdl_expr_seq * ) _PyPegen_seq_append_to_end ( p , a , b );
             if (_res == NULL && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 D(p->level--);
@@ -1080,7 +1080,7 @@ type_expressions_rule(Parser *p)
         )
         {
             D(fprintf(stderr, "%*c+ type_expressions[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' expression ',' '**' expression"));
-            _res = _PyPegen_seq_append_to_end ( p , CHECK ( _PyPegen_singleton_seq ( p , a ) ) , b );
+            _res = ( asdl_expr_seq * ) _PyPegen_seq_append_to_end ( p , CHECK ( _PyPegen_singleton_seq ( p , a ) ) , b );
             if (_res == NULL && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 D(p->level--);
@@ -1107,7 +1107,7 @@ type_expressions_rule(Parser *p)
         )
         {
             D(fprintf(stderr, "%*c+ type_expressions[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' expression"));
-            _res = _PyPegen_singleton_seq ( p , a );
+            _res = ( asdl_expr_seq * ) _PyPegen_singleton_seq ( p , a );
             if (_res == NULL && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 D(p->level--);
@@ -1134,7 +1134,7 @@ type_expressions_rule(Parser *p)
         )
         {
             D(fprintf(stderr, "%*c+ type_expressions[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'**' expression"));
-            _res = _PyPegen_singleton_seq ( p , a );
+            _res = ( asdl_expr_seq * ) _PyPegen_singleton_seq ( p , a );
             if (_res == NULL && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 D(p->level--);
@@ -1152,13 +1152,18 @@ type_expressions_rule(Parser *p)
             return NULL;
         }
         D(fprintf(stderr, "%*c> type_expressions[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.expression+"));
-        asdl_seq * _gather_9_var;
+        asdl_expr_seq* a;
         if (
-            (_gather_9_var = _gather_9_rule(p))  // ','.expression+
+            (a = (asdl_expr_seq*)_gather_9_rule(p))  // ','.expression+
         )
         {
             D(fprintf(stderr, "%*c+ type_expressions[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.expression+"));
-            _res = _gather_9_var;
+            _res = a;
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                D(p->level--);
+                return NULL;
+            }
             goto done;
         }
         p->mark = _mark;
@@ -1172,7 +1177,7 @@ type_expressions_rule(Parser *p)
 }
 
 // statements: statement+
-static asdl_seq*
+static asdl_stmt_seq*
 statements_rule(Parser *p)
 {
     D(p->level++);
@@ -1180,7 +1185,7 @@ statements_rule(Parser *p)
         D(p->level--);
         return NULL;
     }
-    asdl_seq* _res = NULL;
+    asdl_stmt_seq* _res = NULL;
     int _mark = p->mark;
     { // statement+
         if (p->error_indicator) {
@@ -1194,7 +1199,7 @@ statements_rule(Parser *p)
         )
         {
             D(fprintf(stderr, "%*c+ statements[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "statement+"));
-            _res = _PyPegen_seq_flatten ( p , a );
+            _res = ( asdl_stmt_seq * ) _PyPegen_seq_flatten ( p , a );
             if (_res == NULL && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 D(p->level--);
@@ -1213,7 +1218,7 @@ statements_rule(Parser *p)
 }
 
 // statement: compound_stmt | simple_stmt
-static asdl_seq*
+static asdl_stmt_seq*
 statement_rule(Parser *p)
 {
     D(p->level++);
@@ -1221,7 +1226,7 @@ statement_rule(Parser *p)
         D(p->level--);
         return NULL;
     }
-    asdl_seq* _res = NULL;
+    asdl_stmt_seq* _res = NULL;
     int _mark = p->mark;
     { // compound_stmt
         if (p->error_indicator) {
@@ -1235,7 +1240,7 @@ statement_rule(Parser *p)
         )
         {
             D(fprintf(stderr, "%*c+ statement[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "compound_stmt"));
-            _res = _PyPegen_singleton_seq ( p , a );
+            _res = ( asdl_stmt_seq * ) _PyPegen_singleton_seq ( p , a );
             if (_res == NULL && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 D(p->level--);
@@ -1253,13 +1258,18 @@ statement_rule(Parser *p)
             return NULL;
         }
         D(fprintf(stderr, "%*c> statement[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "simple_stmt"));
-        asdl_seq* simple_stmt_var;
+        asdl_stmt_seq* a;
         if (
-            (simple_stmt_var = simple_stmt_rule(p))  // simple_stmt
+            (a = (asdl_stmt_seq*)simple_stmt_rule(p))  // simple_stmt
         )
         {
             D(fprintf(stderr, "%*c+ statement[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "simple_stmt"));
-            _res = simple_stmt_var;
+            _res = a;
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                D(p->level--);
+                return NULL;
+            }
             goto done;
         }
         p->mark = _mark;
@@ -1273,7 +1283,7 @@ statement_rule(Parser *p)
 }
 
 // statement_newline: compound_stmt NEWLINE | simple_stmt | NEWLINE | $
-static asdl_seq*
+static asdl_stmt_seq*
 statement_newline_rule(Parser *p)
 {
     D(p->level++);
@@ -1281,7 +1291,7 @@ statement_newline_rule(Parser *p)
         D(p->level--);
         return NULL;
     }
-    asdl_seq* _res = NULL;
+    asdl_stmt_seq* _res = NULL;
     int _mark = p->mark;
     if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
         p->error_indicator = 1;
@@ -1307,7 +1317,7 @@ statement_newline_rule(Parser *p)
         )
         {
             D(fprintf(stderr, "%*c+ statement_newline[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "compound_stmt NEWLINE"));
-            _res = _PyPegen_singleton_seq ( p , a );
+            _res = ( asdl_stmt_seq * ) _PyPegen_singleton_seq ( p , a );
             if (_res == NULL && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 D(p->level--);
@@ -1325,7 +1335,7 @@ statement_newline_rule(Parser *p)
             return NULL;
         }
         D(fprintf(stderr, "%*c> statement_newline[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "simple_stmt"));
-        asdl_seq* simple_stmt_var;
+        asdl_stmt_seq* simple_stmt_var;
         if (
             (simple_stmt_var = simple_stmt_rule(p))  // simple_stmt
         )
@@ -1359,7 +1369,7 @@ statement_newline_rule(Parser *p)
             UNUSED(_end_lineno); // Only used by EXTRA macro
             int _end_col_offset = _token->end_col_offset;
             UNUSED(_end_col_offset); // Only used by EXTRA macro
-            _res = _PyPegen_singleton_seq ( p , CHECK ( _Py_Pass ( EXTRA ) ) );
+            _res = ( asdl_stmt_seq * ) _PyPegen_singleton_seq ( p , CHECK ( _Py_Pass ( EXTRA ) ) );
             if (_res == NULL && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 D(p->level--);
@@ -1402,7 +1412,7 @@ statement_newline_rule(Parser *p)
 }
 
 // simple_stmt: small_stmt !';' NEWLINE | ';'.small_stmt+ ';'? NEWLINE
-static asdl_seq*
+static asdl_stmt_seq*
 simple_stmt_rule(Parser *p)
 {
     D(p->level++);
@@ -1410,7 +1420,7 @@ simple_stmt_rule(Parser *p)
         D(p->level--);
         return NULL;
     }
-    asdl_seq* _res = NULL;
+    asdl_stmt_seq* _res = NULL;
     int _mark = p->mark;
     { // small_stmt !';' NEWLINE
         if (p->error_indicator) {
@@ -1429,7 +1439,7 @@ simple_stmt_rule(Parser *p)
         )
         {
             D(fprintf(stderr, "%*c+ simple_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "small_stmt !';' NEWLINE"));
-            _res = _PyPegen_singleton_seq ( p , a );
+            _res = ( asdl_stmt_seq * ) _PyPegen_singleton_seq ( p , a );
             if (_res == NULL && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 D(p->level--);
@@ -1449,10 +1459,10 @@ simple_stmt_rule(Parser *p)
         D(fprintf(stderr, "%*c> simple_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "';'.small_stmt+ ';'? NEWLINE"));
         void *_opt_var;
         UNUSED(_opt_var); // Silence compiler warnings
-        asdl_seq * a;
+        asdl_stmt_seq* a;
         Token * newline_var;
         if (
-            (a = _gather_12_rule(p))  // ';'.small_stmt+
+            (a = (asdl_stmt_seq*)_gather_12_rule(p))  // ';'.small_stmt+
             &&
             (_opt_var = _PyPegen_expect_token(p, 13), 1)  // ';'?
             &&
@@ -2127,11 +2137,11 @@ assignment_rule(Parser *p)
             return NULL;
         }
         D(fprintf(stderr, "%*c> assignment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "((star_targets '='))+ (yield_expr | star_expressions) !'=' TYPE_COMMENT?"));
-        asdl_seq * a;
+        asdl_expr_seq* a;
         void *b;
         void *tc;
         if (
-            (a = _loop1_22_rule(p))  // ((star_targets '='))+
+            (a = (asdl_expr_seq*)_loop1_22_rule(p))  // ((star_targets '='))+
             &&
             (b = _tmp_23_rule(p))  // yield_expr | star_expressions
             &&
@@ -2602,11 +2612,11 @@ global_stmt_rule(Parser *p)
         }
         D(fprintf(stderr, "%*c> global_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'global' ','.NAME+"));
         Token * _keyword;
-        asdl_seq * a;
+        asdl_expr_seq* a;
         if (
             (_keyword = _PyPegen_expect_token(p, 508))  // token='global'
             &&
-            (a = _gather_25_rule(p))  // ','.NAME+
+            (a = (asdl_expr_seq*)_gather_25_rule(p))  // ','.NAME+
         )
         {
             D(fprintf(stderr, "%*c+ global_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'global' ','.NAME+"));
@@ -2664,11 +2674,11 @@ nonlocal_stmt_rule(Parser *p)
         }
         D(fprintf(stderr, "%*c> nonlocal_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'nonlocal' ','.NAME+"));
         Token * _keyword;
-        asdl_seq * a;
+        asdl_expr_seq* a;
         if (
             (_keyword = _PyPegen_expect_token(p, 509))  // token='nonlocal'
             &&
-            (a = _gather_27_rule(p))  // ','.NAME+
+            (a = (asdl_expr_seq*)_gather_27_rule(p))  // ','.NAME+
         )
         {
             D(fprintf(stderr, "%*c+ nonlocal_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'nonlocal' ','.NAME+"));
@@ -2850,7 +2860,7 @@ del_stmt_rule(Parser *p)
         }
         D(fprintf(stderr, "%*c> del_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'del' del_targets &(';' | NEWLINE)"));
         Token * _keyword;
-        asdl_seq* a;
+        asdl_expr_seq* a;
         if (
             (_keyword = _PyPegen_expect_token(p, 503))  // token='del'
             &&
@@ -2988,7 +2998,7 @@ import_name_rule(Parser *p)
         }
         D(fprintf(stderr, "%*c> import_name[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'import' dotted_as_names"));
         Token * _keyword;
-        asdl_seq* a;
+        asdl_alias_seq* a;
         if (
             (_keyword = _PyPegen_expect_token(p, 513))  // token='import'
             &&
@@ -3055,7 +3065,7 @@ import_from_rule(Parser *p)
         Token * _keyword_1;
         asdl_seq * a;
         expr_ty b;
-        asdl_seq* c;
+        asdl_alias_seq* c;
         if (
             (_keyword = _PyPegen_expect_token(p, 514))  // token='from'
             &&
@@ -3099,7 +3109,7 @@ import_from_rule(Parser *p)
         Token * _keyword;
         Token * _keyword_1;
         asdl_seq * a;
-        asdl_seq* b;
+        asdl_alias_seq* b;
         if (
             (_keyword = _PyPegen_expect_token(p, 514))  // token='from'
             &&
@@ -3143,7 +3153,7 @@ import_from_rule(Parser *p)
 //     | import_from_as_names !','
 //     | '*'
 //     | invalid_import_from_targets
-static asdl_seq*
+static asdl_alias_seq*
 import_from_targets_rule(Parser *p)
 {
     D(p->level++);
@@ -3151,7 +3161,7 @@ import_from_targets_rule(Parser *p)
         D(p->level--);
         return NULL;
     }
-    asdl_seq* _res = NULL;
+    asdl_alias_seq* _res = NULL;
     int _mark = p->mark;
     { // '(' import_from_as_names ','? ')'
         if (p->error_indicator) {
@@ -3163,7 +3173,7 @@ import_from_targets_rule(Parser *p)
         Token * _literal_1;
         void *_opt_var;
         UNUSED(_opt_var); // Silence compiler warnings
-        asdl_seq* a;
+        asdl_alias_seq* a;
         if (
             (_literal = _PyPegen_expect_token(p, 7))  // token='('
             &&
@@ -3193,7 +3203,7 @@ import_from_targets_rule(Parser *p)
             return NULL;
         }
         D(fprintf(stderr, "%*c> import_from_targets[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "import_from_as_names !','"));
-        asdl_seq* import_from_as_names_var;
+        asdl_alias_seq* import_from_as_names_var;
         if (
             (import_from_as_names_var = import_from_as_names_rule(p))  // import_from_as_names
             &&
@@ -3220,7 +3230,7 @@ import_from_targets_rule(Parser *p)
         )
         {
             D(fprintf(stderr, "%*c+ import_from_targets[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*'"));
-            _res = _PyPegen_singleton_seq ( p , CHECK ( _PyPegen_alias_for_star ( p ) ) );
+            _res = ( asdl_alias_seq * ) _PyPegen_singleton_seq ( p , CHECK ( _PyPegen_alias_for_star ( p ) ) );
             if (_res == NULL && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 D(p->level--);
@@ -3258,7 +3268,7 @@ import_from_targets_rule(Parser *p)
 }
 
 // import_from_as_names: ','.import_from_as_name+
-static asdl_seq*
+static asdl_alias_seq*
 import_from_as_names_rule(Parser *p)
 {
     D(p->level++);
@@ -3266,7 +3276,7 @@ import_from_as_names_rule(Parser *p)
         D(p->level--);
         return NULL;
     }
-    asdl_seq* _res = NULL;
+    asdl_alias_seq* _res = NULL;
     int _mark = p->mark;
     { // ','.import_from_as_name+
         if (p->error_indicator) {
@@ -3274,9 +3284,9 @@ import_from_as_names_rule(Parser *p)
             return NULL;
         }
         D(fprintf(stderr, "%*c> import_from_as_names[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.import_from_as_name+"));
-        asdl_seq * a;
+        asdl_alias_seq* a;
         if (
-            (a = _gather_33_rule(p))  // ','.import_from_as_name+
+            (a = (asdl_alias_seq*)_gather_33_rule(p))  // ','.import_from_as_name+
         )
         {
             D(fprintf(stderr, "%*c+ import_from_as_names[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.import_from_as_name+"));
@@ -3343,7 +3353,7 @@ import_from_as_name_rule(Parser *p)
 }
 
 // dotted_as_names: ','.dotted_as_name+
-static asdl_seq*
+static asdl_alias_seq*
 dotted_as_names_rule(Parser *p)
 {
     D(p->level++);
@@ -3351,7 +3361,7 @@ dotted_as_names_rule(Parser *p)
         D(p->level--);
         return NULL;
     }
-    asdl_seq* _res = NULL;
+    asdl_alias_seq* _res = NULL;
     int _mark = p->mark;
     { // ','.dotted_as_name+
         if (p->error_indicator) {
@@ -3359,9 +3369,9 @@ dotted_as_names_rule(Parser *p)
             return NULL;
         }
         D(fprintf(stderr, "%*c> dotted_as_names[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.dotted_as_name+"));
-        asdl_seq * a;
+        asdl_alias_seq* a;
         if (
-            (a = _gather_36_rule(p))  // ','.dotted_as_name+
+            (a = (asdl_alias_seq*)_gather_36_rule(p))  // ','.dotted_as_name+
         )
         {
             D(fprintf(stderr, "%*c+ dotted_as_names[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.dotted_as_name+"));
@@ -3554,7 +3564,7 @@ if_stmt_rule(Parser *p)
         Token * _keyword;
         Token * _literal;
         expr_ty a;
-        asdl_seq* b;
+        asdl_stmt_seq* b;
         stmt_ty c;
         if (
             (_keyword = _PyPegen_expect_token(p, 510))  // token='if'
@@ -3578,7 +3588,7 @@ if_stmt_rule(Parser *p)
             UNUSED(_end_lineno); // Only used by EXTRA macro
             int _end_col_offset = _token->end_col_offset;
             UNUSED(_end_col_offset); // Only used by EXTRA macro
-            _res = _Py_If ( a , b , CHECK ( _PyPegen_singleton_seq ( p , c ) ) , EXTRA );
+            _res = _Py_If ( a , b , CHECK ( ( asdl_stmt_seq * ) _PyPegen_singleton_seq ( p , c ) ) , EXTRA );
             if (_res == NULL && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 D(p->level--);
@@ -3599,7 +3609,7 @@ if_stmt_rule(Parser *p)
         Token * _keyword;
         Token * _literal;
         expr_ty a;
-        asdl_seq* b;
+        asdl_stmt_seq* b;
         void *c;
         if (
             (_keyword = _PyPegen_expect_token(p, 510))  // token='if'
@@ -3672,7 +3682,7 @@ elif_stmt_rule(Parser *p)
         Token * _keyword;
         Token * _literal;
         expr_ty a;
-        asdl_seq* b;
+        asdl_stmt_seq* b;
         stmt_ty c;
         if (
             (_keyword = _PyPegen_expect_token(p, 515))  // token='elif'
@@ -3717,7 +3727,7 @@ elif_stmt_rule(Parser *p)
         Token * _keyword;
         Token * _literal;
         expr_ty a;
-        asdl_seq* b;
+        asdl_stmt_seq* b;
         void *c;
         if (
             (_keyword = _PyPegen_expect_token(p, 515))  // token='elif'
@@ -3760,7 +3770,7 @@ elif_stmt_rule(Parser *p)
 }
 
 // else_block: 'else' ':' block
-static asdl_seq*
+static asdl_stmt_seq*
 else_block_rule(Parser *p)
 {
     D(p->level++);
@@ -3768,7 +3778,7 @@ else_block_rule(Parser *p)
         D(p->level--);
         return NULL;
     }
-    asdl_seq* _res = NULL;
+    asdl_stmt_seq* _res = NULL;
     int _mark = p->mark;
     { // 'else' ':' block
         if (p->error_indicator) {
@@ -3778,7 +3788,7 @@ else_block_rule(Parser *p)
         D(fprintf(stderr, "%*c> else_block[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'else' ':' block"));
         Token * _keyword;
         Token * _literal;
-        asdl_seq* b;
+        asdl_stmt_seq* b;
         if (
             (_keyword = _PyPegen_expect_token(p, 516))  // token='else'
             &&
@@ -3835,7 +3845,7 @@ while_stmt_rule(Parser *p)
         Token * _keyword;
         Token * _literal;
         expr_ty a;
-        asdl_seq* b;
+        asdl_stmt_seq* b;
         void *c;
         if (
             (_keyword = _PyPegen_expect_token(p, 512))  // token='while'
@@ -3910,7 +3920,7 @@ for_stmt_rule(Parser *p)
         Token * _keyword;
         Token * _keyword_1;
         Token * _literal;
-        asdl_seq* b;
+        asdl_stmt_seq* b;
         void *el;
         expr_ty ex;
         expr_ty t;
@@ -3972,7 +3982,7 @@ for_stmt_rule(Parser *p)
         Token * _keyword_1;
         Token * _literal;
         Token * async_var;
-        asdl_seq* b;
+        asdl_stmt_seq* b;
         void *el;
         expr_ty ex;
         expr_ty t;
@@ -4086,14 +4096,14 @@ with_stmt_rule(Parser *p)
         Token * _literal_2;
         void *_opt_var;
         UNUSED(_opt_var); // Silence compiler warnings
-        asdl_seq * a;
-        asdl_seq* b;
+        asdl_withitem_seq* a;
+        asdl_stmt_seq* b;
         if (
             (_keyword = _PyPegen_expect_token(p, 519))  // token='with'
             &&
             (_literal = _PyPegen_expect_token(p, 7))  // token='('
             &&
-            (a = _gather_39_rule(p))  // ','.with_item+
+            (a = (asdl_withitem_seq*)_gather_39_rule(p))  // ','.with_item+
             &&
             (_opt_var = _PyPegen_expect_token(p, 12), 1)  // ','?
             &&
@@ -4134,13 +4144,13 @@ with_stmt_rule(Parser *p)
         D(fprintf(stderr, "%*c> with_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'with' ','.with_item+ ':' TYPE_COMMENT? block"));
         Token * _keyword;
         Token * _literal;
-        asdl_seq * a;
-        asdl_seq* b;
+        asdl_withitem_seq* a;
+        asdl_stmt_seq* b;
         void *tc;
         if (
             (_keyword = _PyPegen_expect_token(p, 519))  // token='with'
             &&
-            (a = _gather_41_rule(p))  // ','.with_item+
+            (a = (asdl_withitem_seq*)_gather_41_rule(p))  // ','.with_item+
             &&
             (_literal = _PyPegen_expect_token(p, 11))  // token=':'
             &&
@@ -4183,9 +4193,9 @@ with_stmt_rule(Parser *p)
         Token * _literal_2;
         void *_opt_var;
         UNUSED(_opt_var); // Silence compiler warnings
-        asdl_seq * a;
+        asdl_withitem_seq* a;
         Token * async_var;
-        asdl_seq* b;
+        asdl_stmt_seq* b;
         if (
             (async_var = _PyPegen_expect_token(p, ASYNC))  // token='ASYNC'
             &&
@@ -4193,7 +4203,7 @@ with_stmt_rule(Parser *p)
             &&
             (_literal = _PyPegen_expect_token(p, 7))  // token='('
             &&
-            (a = _gather_43_rule(p))  // ','.with_item+
+            (a = (asdl_withitem_seq*)_gather_43_rule(p))  // ','.with_item+
             &&
             (_opt_var = _PyPegen_expect_token(p, 12), 1)  // ','?
             &&
@@ -4234,16 +4244,16 @@ with_stmt_rule(Parser *p)
         D(fprintf(stderr, "%*c> with_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "ASYNC 'with' ','.with_item+ ':' TYPE_COMMENT? block"));
         Token * _keyword;
         Token * _literal;
-        asdl_seq * a;
+        asdl_withitem_seq* a;
         Token * async_var;
-        asdl_seq* b;
+        asdl_stmt_seq* b;
         void *tc;
         if (
             (async_var = _PyPegen_expect_token(p, ASYNC))  // token='ASYNC'
             &&
             (_keyword = _PyPegen_expect_token(p, 519))  // token='with'
             &&
-            (a = _gather_45_rule(p))  // ','.with_item+
+            (a = (asdl_withitem_seq*)_gather_45_rule(p))  // ','.with_item+
             &&
             (_literal = _PyPegen_expect_token(p, 11))  // token=':'
             &&
@@ -4402,8 +4412,8 @@ try_stmt_rule(Parser *p)
         D(fprintf(stderr, "%*c> try_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'try' ':' block finally_block"));
         Token * _keyword;
         Token * _literal;
-        asdl_seq* b;
-        asdl_seq* f;
+        asdl_stmt_seq* b;
+        asdl_stmt_seq* f;
         if (
             (_keyword = _PyPegen_expect_token(p, 511))  // token='try'
             &&
@@ -4444,9 +4454,9 @@ try_stmt_rule(Parser *p)
         D(fprintf(stderr, "%*c> try_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'try' ':' block except_block+ else_block? finally_block?"));
         Token * _keyword;
         Token * _literal;
-        asdl_seq* b;
+        asdl_stmt_seq* b;
         void *el;
-        asdl_seq * ex;
+        asdl_excepthandler_seq* ex;
         void *f;
         if (
             (_keyword = _PyPegen_expect_token(p, 511))  // token='try'
@@ -4455,7 +4465,7 @@ try_stmt_rule(Parser *p)
             &&
             (b = block_rule(p))  // block
             &&
-            (ex = _loop1_48_rule(p))  // except_block+
+            (ex = (asdl_excepthandler_seq*)_loop1_48_rule(p))  // except_block+
             &&
             (el = else_block_rule(p), 1)  // else_block?
             &&
@@ -4518,7 +4528,7 @@ except_block_rule(Parser *p)
         D(fprintf(stderr, "%*c> except_block[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'except' expression ['as' NAME] ':' block"));
         Token * _keyword;
         Token * _literal;
-        asdl_seq* b;
+        asdl_stmt_seq* b;
         expr_ty e;
         void *t;
         if (
@@ -4563,7 +4573,7 @@ except_block_rule(Parser *p)
         D(fprintf(stderr, "%*c> except_block[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'except' ':' block"));
         Token * _keyword;
         Token * _literal;
-        asdl_seq* b;
+        asdl_stmt_seq* b;
         if (
             (_keyword = _PyPegen_expect_token(p, 521))  // token='except'
             &&
@@ -4601,7 +4611,7 @@ except_block_rule(Parser *p)
 }
 
 // finally_block: 'finally' ':' block
-static asdl_seq*
+static asdl_stmt_seq*
 finally_block_rule(Parser *p)
 {
     D(p->level++);
@@ -4609,7 +4619,7 @@ finally_block_rule(Parser *p)
         D(p->level--);
         return NULL;
     }
-    asdl_seq* _res = NULL;
+    asdl_stmt_seq* _res = NULL;
     int _mark = p->mark;
     { // 'finally' ':' block
         if (p->error_indicator) {
@@ -4619,7 +4629,7 @@ finally_block_rule(Parser *p)
         D(fprintf(stderr, "%*c> finally_block[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'finally' ':' block"));
         Token * _keyword;
         Token * _literal;
-        asdl_seq* a;
+        asdl_stmt_seq* a;
         if (
             (_keyword = _PyPegen_expect_token(p, 522))  // token='finally'
             &&
@@ -4824,7 +4834,7 @@ function_def_rule(Parser *p)
             return NULL;
         }
         D(fprintf(stderr, "%*c> function_def[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "decorators function_def_raw"));
-        asdl_seq* d;
+        asdl_expr_seq* d;
         stmt_ty f;
         if (
             (d = decorators_rule(p))  // decorators
@@ -4903,7 +4913,7 @@ function_def_raw_rule(Parser *p)
         Token * _literal_1;
         Token * _literal_2;
         void *a;
-        asdl_seq* b;
+        asdl_stmt_seq* b;
         expr_ty n;
         void *params;
         void *tc;
@@ -4961,7 +4971,7 @@ function_def_raw_rule(Parser *p)
         Token * _literal_2;
         void *a;
         Token * async_var;
-        asdl_seq* b;
+        asdl_stmt_seq* b;
         expr_ty n;
         void *params;
         void *tc;
@@ -5179,14 +5189,14 @@ parameters_rule(Parser *p)
             return NULL;
         }
         D(fprintf(stderr, "%*c> parameters[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "slash_no_default param_no_default* param_with_default* star_etc?"));
-        asdl_seq* a;
-        asdl_seq * b;
+        asdl_arg_seq* a;
+        asdl_arg_seq* b;
         asdl_seq * c;
         void *d;
         if (
             (a = slash_no_default_rule(p))  // slash_no_default
             &&
-            (b = _loop0_54_rule(p))  // param_no_default*
+            (b = (asdl_arg_seq*)_loop0_54_rule(p))  // param_no_default*
             &&
             (c = _loop0_55_rule(p))  // param_with_default*
             &&
@@ -5242,11 +5252,11 @@ parameters_rule(Parser *p)
             return NULL;
         }
         D(fprintf(stderr, "%*c> parameters[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default+ param_with_default* star_etc?"));
-        asdl_seq * a;
+        asdl_arg_seq* a;
         asdl_seq * b;
         void *c;
         if (
-            (a = _loop1_57_rule(p))  // param_no_default+
+            (a = (asdl_arg_seq*)_loop1_57_rule(p))  // param_no_default+
             &&
             (b = _loop0_58_rule(p))  // param_with_default*
             &&
@@ -5324,7 +5334,7 @@ parameters_rule(Parser *p)
 }
 
 // slash_no_default: param_no_default+ '/' ',' | param_no_default+ '/' &')'
-static asdl_seq*
+static asdl_arg_seq*
 slash_no_default_rule(Parser *p)
 {
     D(p->level++);
@@ -5332,7 +5342,7 @@ slash_no_default_rule(Parser *p)
         D(p->level--);
         return NULL;
     }
-    asdl_seq* _res = NULL;
+    asdl_arg_seq* _res = NULL;
     int _mark = p->mark;
     { // param_no_default+ '/' ','
         if (p->error_indicator) {
@@ -5342,9 +5352,9 @@ slash_no_default_rule(Parser *p)
         D(fprintf(stderr, "%*c> slash_no_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default+ '/' ','"));
         Token * _literal;
         Token * _literal_1;
-        asdl_seq * a;
+        asdl_arg_seq* a;
         if (
-            (a = _loop1_60_rule(p))  // param_no_default+
+            (a = (asdl_arg_seq*)_loop1_60_rule(p))  // param_no_default+
             &&
             (_literal = _PyPegen_expect_token(p, 17))  // token='/'
             &&
@@ -5371,9 +5381,9 @@ slash_no_default_rule(Parser *p)
         }
         D(fprintf(stderr, "%*c> slash_no_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default+ '/' &')'"));
         Token * _literal;
-        asdl_seq * a;
+        asdl_arg_seq* a;
         if (
-            (a = _loop1_61_rule(p))  // param_no_default+
+            (a = (asdl_arg_seq*)_loop1_61_rule(p))  // param_no_default+
             &&
             (_literal = _PyPegen_expect_token(p, 17))  // token='/'
             &&
@@ -5433,7 +5443,7 @@ slash_with_default_rule(Parser *p)
         )
         {
             D(fprintf(stderr, "%*c+ slash_with_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param_no_default* param_with_default+ '/' ','"));
-            _res = _PyPegen_slash_with_default ( p , a , b );
+            _res = _PyPegen_slash_with_default ( p , ( asdl_arg_seq * ) a , b );
             if (_res == NULL && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 D(p->level--);
@@ -5465,7 +5475,7 @@ slash_with_default_rule(Parser *p)
         )
         {
             D(fprintf(stderr, "%*c+ slash_with_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param_no_default* param_with_default+ '/' &')'"));
-            _res = _PyPegen_slash_with_default ( p , a , b );
+            _res = _PyPegen_slash_with_default ( p , ( asdl_arg_seq * ) a , b );
             if (_res == NULL && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 D(p->level--);
@@ -6050,7 +6060,7 @@ default_rule(Parser *p)
 }
 
 // decorators: (('@' named_expression NEWLINE))+
-static asdl_seq*
+static asdl_expr_seq*
 decorators_rule(Parser *p)
 {
     D(p->level++);
@@ -6058,7 +6068,7 @@ decorators_rule(Parser *p)
         D(p->level--);
         return NULL;
     }
-    asdl_seq* _res = NULL;
+    asdl_expr_seq* _res = NULL;
     int _mark = p->mark;
     { // (('@' named_expression NEWLINE))+
         if (p->error_indicator) {
@@ -6066,9 +6076,9 @@ decorators_rule(Parser *p)
             return NULL;
         }
         D(fprintf(stderr, "%*c> decorators[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(('@' named_expression NEWLINE))+"));
-        asdl_seq * a;
+        asdl_expr_seq* a;
         if (
-            (a = _loop1_68_rule(p))  // (('@' named_expression NEWLINE))+
+            (a = (asdl_expr_seq*)_loop1_68_rule(p))  // (('@' named_expression NEWLINE))+
         )
         {
             D(fprintf(stderr, "%*c+ decorators[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "(('@' named_expression NEWLINE))+"));
@@ -6107,7 +6117,7 @@ class_def_rule(Parser *p)
             return NULL;
         }
         D(fprintf(stderr, "%*c> class_def[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "decorators class_def_raw"));
-        asdl_seq* a;
+        asdl_expr_seq* a;
         stmt_ty b;
         if (
             (a = decorators_rule(p))  // decorators
@@ -6183,7 +6193,7 @@ class_def_raw_rule(Parser *p)
         Token * _literal;
         expr_ty a;
         void *b;
-        asdl_seq* c;
+        asdl_stmt_seq* c;
         if (
             (_keyword = _PyPegen_expect_token(p, 524))  // token='class'
             &&
@@ -6225,7 +6235,7 @@ class_def_raw_rule(Parser *p)
 }
 
 // block: NEWLINE INDENT statements DEDENT | simple_stmt | invalid_block
-static asdl_seq*
+static asdl_stmt_seq*
 block_rule(Parser *p)
 {
     D(p->level++);
@@ -6233,7 +6243,7 @@ block_rule(Parser *p)
         D(p->level--);
         return NULL;
     }
-    asdl_seq* _res = NULL;
+    asdl_stmt_seq* _res = NULL;
     if (_PyPegen_is_memoized(p, block_type, &_res)) {
         D(p->level--);
         return _res;
@@ -6245,7 +6255,7 @@ block_rule(Parser *p)
             return NULL;
         }
         D(fprintf(stderr, "%*c> block[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NEWLINE INDENT statements DEDENT"));
-        asdl_seq* a;
+        asdl_stmt_seq* a;
         Token * dedent_var;
         Token * indent_var;
         Token * newline_var;
@@ -6278,7 +6288,7 @@ block_rule(Parser *p)
             return NULL;
         }
         D(fprintf(stderr, "%*c> block[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "simple_stmt"));
-        asdl_seq* simple_stmt_var;
+        asdl_stmt_seq* simple_stmt_var;
         if (
             (simple_stmt_var = simple_stmt_rule(p))  // simple_stmt
         )
@@ -6318,7 +6328,7 @@ block_rule(Parser *p)
 }
 
 // expressions_list: ','.star_expression+ ','?
-static asdl_seq*
+static asdl_expr_seq*
 expressions_list_rule(Parser *p)
 {
     D(p->level++);
@@ -6326,7 +6336,7 @@ expressions_list_rule(Parser *p)
         D(p->level--);
         return NULL;
     }
-    asdl_seq* _res = NULL;
+    asdl_expr_seq* _res = NULL;
     int _mark = p->mark;
     { // ','.star_expression+ ','?
         if (p->error_indicator) {
@@ -6336,9 +6346,9 @@ expressions_list_rule(Parser *p)
         D(fprintf(stderr, "%*c> expressions_list[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.star_expression+ ','?"));
         void *_opt_var;
         UNUSED(_opt_var); // Silence compiler warnings
-        asdl_seq * a;
+        asdl_expr_seq* a;
         if (
-            (a = _gather_70_rule(p))  // ','.star_expression+
+            (a = (asdl_expr_seq*)_gather_70_rule(p))  // ','.star_expression+
             &&
             (_opt_var = _PyPegen_expect_token(p, 12), 1)  // ','?
         )
@@ -6573,7 +6583,7 @@ star_expression_rule(Parser *p)
 }
 
 // star_named_expressions: ','.star_named_expression+ ','?
-static asdl_seq*
+static asdl_expr_seq*
 star_named_expressions_rule(Parser *p)
 {
     D(p->level++);
@@ -6581,7 +6591,7 @@ star_named_expressions_rule(Parser *p)
         D(p->level--);
         return NULL;
     }
-    asdl_seq* _res = NULL;
+    asdl_expr_seq* _res = NULL;
     int _mark = p->mark;
     { // ','.star_named_expression+ ','?
         if (p->error_indicator) {
@@ -6591,9 +6601,9 @@ star_named_expressions_rule(Parser *p)
         D(fprintf(stderr, "%*c> star_named_expressions[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.star_named_expression+ ','?"));
         void *_opt_var;
         UNUSED(_opt_var); // Silence compiler warnings
-        asdl_seq * a;
+        asdl_expr_seq* a;
         if (
-            (a = _gather_73_rule(p))  // ','.star_named_expression+
+            (a = (asdl_expr_seq*)_gather_73_rule(p))  // ','.star_named_expression+
             &&
             (_opt_var = _PyPegen_expect_token(p, 12), 1)  // ','?
         )
@@ -7245,14 +7255,14 @@ lambda_parameters_rule(Parser *p)
             return NULL;
         }
         D(fprintf(stderr, "%*c> lambda_parameters[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_slash_no_default lambda_param_no_default* lambda_param_with_default* lambda_star_etc?"));
-        asdl_seq* a;
-        asdl_seq * b;
+        asdl_arg_seq* a;
+        asdl_arg_seq* b;
         asdl_seq * c;
         void *d;
         if (
             (a = lambda_slash_no_default_rule(p))  // lambda_slash_no_default
             &&
-            (b = _loop0_76_rule(p))  // lambda_param_no_default*
+            (b = (asdl_arg_seq*)_loop0_76_rule(p))  // lambda_param_no_default*
             &&
             (c = _loop0_77_rule(p))  // lambda_param_with_default*
             &&
@@ -7308,11 +7318,11 @@ lambda_parameters_rule(Parser *p)
             return NULL;
         }
         D(fprintf(stderr, "%*c> lambda_parameters[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default+ lambda_param_with_default* lambda_star_etc?"));
-        asdl_seq * a;
+        asdl_arg_seq* a;
         asdl_seq * b;
         void *c;
         if (
-            (a = _loop1_79_rule(p))  // lambda_param_no_default+
+            (a = (asdl_arg_seq*)_loop1_79_rule(p))  // lambda_param_no_default+
             &&
             (b = _loop0_80_rule(p))  // lambda_param_with_default*
             &&
@@ -7392,7 +7402,7 @@ lambda_parameters_rule(Parser *p)
 // lambda_slash_no_default:
 //     | lambda_param_no_default+ '/' ','
 //     | lambda_param_no_default+ '/' &':'
-static asdl_seq*
+static asdl_arg_seq*
 lambda_slash_no_default_rule(Parser *p)
 {
     D(p->level++);
@@ -7400,7 +7410,7 @@ lambda_slash_no_default_rule(Parser *p)
         D(p->level--);
         return NULL;
     }
-    asdl_seq* _res = NULL;
+    asdl_arg_seq* _res = NULL;
     int _mark = p->mark;
     { // lambda_param_no_default+ '/' ','
         if (p->error_indicator) {
@@ -7410,9 +7420,9 @@ lambda_slash_no_default_rule(Parser *p)
         D(fprintf(stderr, "%*c> lambda_slash_no_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default+ '/' ','"));
         Token * _literal;
         Token * _literal_1;
-        asdl_seq * a;
+        asdl_arg_seq* a;
         if (
-            (a = _loop1_82_rule(p))  // lambda_param_no_default+
+            (a = (asdl_arg_seq*)_loop1_82_rule(p))  // lambda_param_no_default+
             &&
             (_literal = _PyPegen_expect_token(p, 17))  // token='/'
             &&
@@ -7439,9 +7449,9 @@ lambda_slash_no_default_rule(Parser *p)
         }
         D(fprintf(stderr, "%*c> lambda_slash_no_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default+ '/' &':'"));
         Token * _literal;
-        asdl_seq * a;
+        asdl_arg_seq* a;
         if (
-            (a = _loop1_83_rule(p))  // lambda_param_no_default+
+            (a = (asdl_arg_seq*)_loop1_83_rule(p))  // lambda_param_no_default+
             &&
             (_literal = _PyPegen_expect_token(p, 17))  // token='/'
             &&
@@ -7501,7 +7511,7 @@ lambda_slash_with_default_rule(Parser *p)
         )
         {
             D(fprintf(stderr, "%*c+ lambda_slash_with_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default* lambda_param_with_default+ '/' ','"));
-            _res = _PyPegen_slash_with_default ( p , a , b );
+            _res = _PyPegen_slash_with_default ( p , ( asdl_arg_seq * ) a , b );
             if (_res == NULL && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 D(p->level--);
@@ -7533,7 +7543,7 @@ lambda_slash_with_default_rule(Parser *p)
         )
         {
             D(fprintf(stderr, "%*c+ lambda_slash_with_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default* lambda_param_with_default+ '/' &':'"));
-            _res = _PyPegen_slash_with_default ( p , a , b );
+            _res = _PyPegen_slash_with_default ( p , ( asdl_arg_seq * ) a , b );
             if (_res == NULL && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 D(p->level--);
@@ -10553,9 +10563,9 @@ slices_rule(Parser *p)
         D(fprintf(stderr, "%*c> slices[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.slice+ ','?"));
         void *_opt_var;
         UNUSED(_opt_var); // Silence compiler warnings
-        asdl_seq * a;
+        asdl_expr_seq* a;
         if (
-            (a = _gather_94_rule(p))  // ','.slice+
+            (a = (asdl_expr_seq*)_gather_94_rule(p))  // ','.slice+
             &&
             (_opt_var = _PyPegen_expect_token(p, 12), 1)  // ','?
         )
@@ -11111,7 +11121,7 @@ listcomp_rule(Parser *p)
         Token * _literal;
         Token * _literal_1;
         expr_ty a;
-        asdl_seq* b;
+        asdl_comprehension_seq* b;
         if (
             (_literal = _PyPegen_expect_token(p, 9))  // token='['
             &&
@@ -11336,7 +11346,7 @@ genexp_rule(Parser *p)
         Token * _literal;
         Token * _literal_1;
         expr_ty a;
-        asdl_seq* b;
+        asdl_comprehension_seq* b;
         if (
             (_literal = _PyPegen_expect_token(p, 7))  // token='('
             &&
@@ -11428,7 +11438,7 @@ set_rule(Parser *p)
         D(fprintf(stderr, "%*c> set[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'{' expressions_list '}'"));
         Token * _literal;
         Token * _literal_1;
-        asdl_seq* a;
+        asdl_expr_seq* a;
         if (
             (_literal = _PyPegen_expect_token(p, 25))  // token='{'
             &&
@@ -11495,7 +11505,7 @@ setcomp_rule(Parser *p)
         Token * _literal;
         Token * _literal_1;
         expr_ty a;
-        asdl_seq* b;
+        asdl_comprehension_seq* b;
         if (
             (_literal = _PyPegen_expect_token(p, 25))  // token='{'
             &&
@@ -11653,7 +11663,7 @@ dictcomp_rule(Parser *p)
         Token * _literal;
         Token * _literal_1;
         KeyValuePair* a;
-        asdl_seq* b;
+        asdl_comprehension_seq* b;
         if (
             (_literal = _PyPegen_expect_token(p, 25))  // token='{'
             &&
@@ -11867,7 +11877,7 @@ kvpair_rule(Parser *p)
 }
 
 // for_if_clauses: for_if_clause+
-static asdl_seq*
+static asdl_comprehension_seq*
 for_if_clauses_rule(Parser *p)
 {
     D(p->level++);
@@ -11875,7 +11885,7 @@ for_if_clauses_rule(Parser *p)
         D(p->level--);
         return NULL;
     }
-    asdl_seq* _res = NULL;
+    asdl_comprehension_seq* _res = NULL;
     int _mark = p->mark;
     { // for_if_clause+
         if (p->error_indicator) {
@@ -11883,13 +11893,18 @@ for_if_clauses_rule(Parser *p)
             return NULL;
         }
         D(fprintf(stderr, "%*c> for_if_clauses[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "for_if_clause+"));
-        asdl_seq * _loop1_105_var;
+        asdl_comprehension_seq* a;
         if (
-            (_loop1_105_var = _loop1_105_rule(p))  // for_if_clause+
+            (a = (asdl_comprehension_seq*)_loop1_105_rule(p))  // for_if_clause+
         )
         {
             D(fprintf(stderr, "%*c+ for_if_clauses[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "for_if_clause+"));
-            _res = _loop1_105_var;
+            _res = a;
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                D(p->level--);
+                return NULL;
+            }
             goto done;
         }
         p->mark = _mark;
@@ -11928,7 +11943,7 @@ for_if_clause_rule(Parser *p)
         expr_ty a;
         Token * async_var;
         expr_ty b;
-        asdl_seq * c;
+        asdl_expr_seq* c;
         if (
             (async_var = _PyPegen_expect_token(p, ASYNC))  // token='ASYNC'
             &&
@@ -11942,7 +11957,7 @@ for_if_clause_rule(Parser *p)
             &&
             (b = disjunction_rule(p))  // disjunction
             &&
-            (c = _loop0_106_rule(p))  // (('if' disjunction))*
+            (c = (asdl_expr_seq*)_loop0_106_rule(p))  // (('if' disjunction))*
         )
         {
             D(fprintf(stderr, "%*c+ for_if_clause[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "ASYNC 'for' star_targets 'in' ~ disjunction (('if' disjunction))*"));
@@ -11973,7 +11988,7 @@ for_if_clause_rule(Parser *p)
         Token * _keyword_1;
         expr_ty a;
         expr_ty b;
-        asdl_seq * c;
+        asdl_expr_seq* c;
         if (
             (_keyword = _PyPegen_expect_token(p, 517))  // token='for'
             &&
@@ -11985,7 +12000,7 @@ for_if_clause_rule(Parser *p)
             &&
             (b = disjunction_rule(p))  // disjunction
             &&
-            (c = _loop0_107_rule(p))  // (('if' disjunction))*
+            (c = (asdl_expr_seq*)_loop0_107_rule(p))  // (('if' disjunction))*
         )
         {
             D(fprintf(stderr, "%*c+ for_if_clause[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'for' star_targets 'in' ~ disjunction (('if' disjunction))*"));
@@ -12228,10 +12243,10 @@ args_rule(Parser *p)
             return NULL;
         }
         D(fprintf(stderr, "%*c> args[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.(starred_expression | named_expression !'=')+ [',' kwargs]"));
-        asdl_seq * a;
+        asdl_expr_seq* a;
         void *b;
         if (
-            (a = _gather_108_rule(p))  // ','.(starred_expression | named_expression !'=')+
+            (a = (asdl_expr_seq*)_gather_108_rule(p))  // ','.(starred_expression | named_expression !'=')+
             &&
             (b = _tmp_110_rule(p), 1)  // [',' kwargs]
         )
@@ -12768,7 +12783,7 @@ star_targets_rule(Parser *p)
 }
 
 // star_targets_seq: ','.star_target+ ','?
-static asdl_seq*
+static asdl_expr_seq*
 star_targets_seq_rule(Parser *p)
 {
     D(p->level++);
@@ -12776,7 +12791,7 @@ star_targets_seq_rule(Parser *p)
         D(p->level--);
         return NULL;
     }
-    asdl_seq* _res = NULL;
+    asdl_expr_seq* _res = NULL;
     int _mark = p->mark;
     { // ','.star_target+ ','?
         if (p->error_indicator) {
@@ -12786,9 +12801,9 @@ star_targets_seq_rule(Parser *p)
         D(fprintf(stderr, "%*c> star_targets_seq[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.star_target+ ','?"));
         void *_opt_var;
         UNUSED(_opt_var); // Silence compiler warnings
-        asdl_seq * a;
+        asdl_expr_seq* a;
         if (
-            (a = _gather_120_rule(p))  // ','.star_target+
+            (a = (asdl_expr_seq*)_gather_120_rule(p))  // ','.star_target+
             &&
             (_opt_var = _PyPegen_expect_token(p, 12), 1)  // ','?
         )
@@ -13353,7 +13368,7 @@ single_subscript_attribute_target_rule(Parser *p)
 }
 
 // del_targets: ','.del_target+ ','?
-static asdl_seq*
+static asdl_expr_seq*
 del_targets_rule(Parser *p)
 {
     D(p->level++);
@@ -13361,7 +13376,7 @@ del_targets_rule(Parser *p)
         D(p->level--);
         return NULL;
     }
-    asdl_seq* _res = NULL;
+    asdl_expr_seq* _res = NULL;
     int _mark = p->mark;
     { // ','.del_target+ ','?
         if (p->error_indicator) {
@@ -13371,9 +13386,9 @@ del_targets_rule(Parser *p)
         D(fprintf(stderr, "%*c> del_targets[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.del_target+ ','?"));
         void *_opt_var;
         UNUSED(_opt_var); // Silence compiler warnings
-        asdl_seq * a;
+        asdl_expr_seq* a;
         if (
-            (a = _gather_123_rule(p))  // ','.del_target+
+            (a = (asdl_expr_seq*)_gather_123_rule(p))  // ','.del_target+
             &&
             (_opt_var = _PyPegen_expect_token(p, 12), 1)  // ','?
         )
@@ -13694,7 +13709,7 @@ del_t_atom_rule(Parser *p)
 }
 
 // targets: ','.target+ ','?
-static asdl_seq*
+static asdl_expr_seq*
 targets_rule(Parser *p)
 {
     D(p->level++);
@@ -13702,7 +13717,7 @@ targets_rule(Parser *p)
         D(p->level--);
         return NULL;
     }
-    asdl_seq* _res = NULL;
+    asdl_expr_seq* _res = NULL;
     int _mark = p->mark;
     { // ','.target+ ','?
         if (p->error_indicator) {
@@ -13712,9 +13727,9 @@ targets_rule(Parser *p)
         D(fprintf(stderr, "%*c> targets[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.target+ ','?"));
         void *_opt_var;
         UNUSED(_opt_var); // Silence compiler warnings
-        asdl_seq * a;
+        asdl_expr_seq* a;
         if (
-            (a = _gather_125_rule(p))  // ','.target+
+            (a = (asdl_expr_seq*)_gather_125_rule(p))  // ','.target+
             &&
             (_opt_var = _PyPegen_expect_token(p, 12), 1)  // ','?
         )
@@ -14418,7 +14433,7 @@ incorrect_arguments_rule(Parser *p)
         void *_opt_var;
         UNUSED(_opt_var); // Silence compiler warnings
         expr_ty a;
-        asdl_seq* for_if_clauses_var;
+        asdl_comprehension_seq* for_if_clauses_var;
         if (
             (a = expression_rule(p))  // expression
             &&
@@ -14449,7 +14464,7 @@ incorrect_arguments_rule(Parser *p)
         }
         D(fprintf(stderr, "%*c> incorrect_arguments[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "args for_if_clauses"));
         expr_ty a;
-        asdl_seq* for_if_clauses_var;
+        asdl_comprehension_seq* for_if_clauses_var;
         if (
             (a = args_rule(p))  // args
             &&
@@ -14478,7 +14493,7 @@ incorrect_arguments_rule(Parser *p)
         Token * _literal;
         expr_ty a;
         expr_ty args_var;
-        asdl_seq* for_if_clauses_var;
+        asdl_comprehension_seq* for_if_clauses_var;
         if (
             (args_var = args_rule(p))  // args
             &&
@@ -15029,7 +15044,7 @@ invalid_comprehension_rule(Parser *p)
         D(fprintf(stderr, "%*c> invalid_comprehension[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('[' | '(' | '{') starred_expression for_if_clauses"));
         void *_tmp_132_var;
         expr_ty a;
-        asdl_seq* for_if_clauses_var;
+        asdl_comprehension_seq* for_if_clauses_var;
         if (
             (_tmp_132_var = _tmp_132_rule(p))  // '[' | '(' | '{'
             &&
@@ -15078,7 +15093,7 @@ invalid_dict_comprehension_rule(Parser *p)
         Token * _literal_1;
         Token * a;
         expr_ty bitwise_or_var;
-        asdl_seq* for_if_clauses_var;
+        asdl_comprehension_seq* for_if_clauses_var;
         if (
             (_literal = _PyPegen_expect_token(p, 25))  // token='{'
             &&
@@ -15537,7 +15552,7 @@ invalid_import_from_targets_rule(Parser *p)
         }
         D(fprintf(stderr, "%*c> invalid_import_from_targets[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "import_from_as_names ','"));
         Token * _literal;
-        asdl_seq* import_from_as_names_var;
+        asdl_alias_seq* import_from_as_names_var;
         if (
             (import_from_as_names_var = import_from_as_names_rule(p))  // import_from_as_names
             &&
@@ -15614,7 +15629,7 @@ _loop0_1_rule(Parser *p)
         D(fprintf(stderr, "%*c%s _loop0_1[%d-%d]: %s failed!\n", p->level, ' ',
                   p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NEWLINE"));
     }
-    asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
+    asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
     if (!_seq) {
         PyMem_Free(_children);
         p->error_indicator = 1;
@@ -15622,7 +15637,7 @@ _loop0_1_rule(Parser *p)
         D(p->level--);
         return NULL;
     }
-    for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
+    for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
     PyMem_Free(_children);
     _PyPegen_insert_memo(p, _start_mark, _loop0_1_type, _seq);
     D(p->level--);
@@ -15680,7 +15695,7 @@ _loop0_2_rule(Parser *p)
         D(fprintf(stderr, "%*c%s _loop0_2[%d-%d]: %s failed!\n", p->level, ' ',
                   p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NEWLINE"));
     }
-    asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
+    asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
     if (!_seq) {
         PyMem_Free(_children);
         p->error_indicator = 1;
@@ -15688,7 +15703,7 @@ _loop0_2_rule(Parser *p)
         D(p->level--);
         return NULL;
     }
-    for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
+    for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
     PyMem_Free(_children);
     _PyPegen_insert_memo(p, _start_mark, _loop0_2_type, _seq);
     D(p->level--);
@@ -15755,7 +15770,7 @@ _loop0_4_rule(Parser *p)
         D(fprintf(stderr, "%*c%s _loop0_4[%d-%d]: %s failed!\n", p->level, ' ',
                   p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' expression"));
     }
-    asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
+    asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
     if (!_seq) {
         PyMem_Free(_children);
         p->error_indicator = 1;
@@ -15763,7 +15778,7 @@ _loop0_4_rule(Parser *p)
         D(p->level--);
         return NULL;
     }
-    for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
+    for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
     PyMem_Free(_children);
     _PyPegen_insert_memo(p, _start_mark, _loop0_4_type, _seq);
     D(p->level--);
@@ -15869,7 +15884,7 @@ _loop0_6_rule(Parser *p)
         D(fprintf(stderr, "%*c%s _loop0_6[%d-%d]: %s failed!\n", p->level, ' ',
                   p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' expression"));
     }
-    asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
+    asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
     if (!_seq) {
         PyMem_Free(_children);
         p->error_indicator = 1;
@@ -15877,7 +15892,7 @@ _loop0_6_rule(Parser *p)
         D(p->level--);
         return NULL;
     }
-    for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
+    for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
     PyMem_Free(_children);
     _PyPegen_insert_memo(p, _start_mark, _loop0_6_type, _seq);
     D(p->level--);
@@ -15983,7 +15998,7 @@ _loop0_8_rule(Parser *p)
         D(fprintf(stderr, "%*c%s _loop0_8[%d-%d]: %s failed!\n", p->level, ' ',
                   p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' expression"));
     }
-    asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
+    asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
     if (!_seq) {
         PyMem_Free(_children);
         p->error_indicator = 1;
@@ -15991,7 +16006,7 @@ _loop0_8_rule(Parser *p)
         D(p->level--);
         return NULL;
     }
-    for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
+    for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
     PyMem_Free(_children);
     _PyPegen_insert_memo(p, _start_mark, _loop0_8_type, _seq);
     D(p->level--);
@@ -16097,7 +16112,7 @@ _loop0_10_rule(Parser *p)
         D(fprintf(stderr, "%*c%s _loop0_10[%d-%d]: %s failed!\n", p->level, ' ',
                   p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' expression"));
     }
-    asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
+    asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
     if (!_seq) {
         PyMem_Free(_children);
         p->error_indicator = 1;
@@ -16105,7 +16120,7 @@ _loop0_10_rule(Parser *p)
         D(p->level--);
         return NULL;
     }
-    for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
+    for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
     PyMem_Free(_children);
     _PyPegen_insert_memo(p, _start_mark, _loop0_10_type, _seq);
     D(p->level--);
@@ -16178,7 +16193,7 @@ _loop1_11_rule(Parser *p)
             return NULL;
         }
         D(fprintf(stderr, "%*c> _loop1_11[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "statement"));
-        asdl_seq* statement_var;
+        asdl_stmt_seq* statement_var;
         while (
             (statement_var = statement_rule(p))  // statement
         )
@@ -16207,7 +16222,7 @@ _loop1_11_rule(Parser *p)
         D(p->level--);
         return NULL;
     }
-    asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
+    asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
     if (!_seq) {
         PyMem_Free(_children);
         p->error_indicator = 1;
@@ -16215,7 +16230,7 @@ _loop1_11_rule(Parser *p)
         D(p->level--);
         return NULL;
     }
-    for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
+    for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
     PyMem_Free(_children);
     _PyPegen_insert_memo(p, _start_mark, _loop1_11_type, _seq);
     D(p->level--);
@@ -16282,7 +16297,7 @@ _loop0_13_rule(Parser *p)
         D(fprintf(stderr, "%*c%s _loop0_13[%d-%d]: %s failed!\n", p->level, ' ',
                   p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "';' small_stmt"));
     }
-    asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
+    asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
     if (!_seq) {
         PyMem_Free(_children);
         p->error_indicator = 1;
@@ -16290,7 +16305,7 @@ _loop0_13_rule(Parser *p)
         D(p->level--);
         return NULL;
     }
-    for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
+    for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
     PyMem_Free(_children);
     _PyPegen_insert_memo(p, _start_mark, _loop0_13_type, _seq);
     D(p->level--);
@@ -16840,7 +16855,7 @@ _loop1_22_rule(Parser *p)
         D(p->level--);
         return NULL;
     }
-    asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
+    asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
     if (!_seq) {
         PyMem_Free(_children);
         p->error_indicator = 1;
@@ -16848,7 +16863,7 @@ _loop1_22_rule(Parser *p)
         D(p->level--);
         return NULL;
     }
-    for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
+    for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
     PyMem_Free(_children);
     _PyPegen_insert_memo(p, _start_mark, _loop1_22_type, _seq);
     D(p->level--);
@@ -17025,7 +17040,7 @@ _loop0_26_rule(Parser *p)
         D(fprintf(stderr, "%*c%s _loop0_26[%d-%d]: %s failed!\n", p->level, ' ',
                   p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' NAME"));
     }
-    asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
+    asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
     if (!_seq) {
         PyMem_Free(_children);
         p->error_indicator = 1;
@@ -17033,7 +17048,7 @@ _loop0_26_rule(Parser *p)
         D(p->level--);
         return NULL;
     }
-    for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
+    for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
     PyMem_Free(_children);
     _PyPegen_insert_memo(p, _start_mark, _loop0_26_type, _seq);
     D(p->level--);
@@ -17139,7 +17154,7 @@ _loop0_28_rule(Parser *p)
         D(fprintf(stderr, "%*c%s _loop0_28[%d-%d]: %s failed!\n", p->level, ' ',
                   p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' NAME"));
     }
-    asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
+    asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
     if (!_seq) {
         PyMem_Free(_children);
         p->error_indicator = 1;
@@ -17147,7 +17162,7 @@ _loop0_28_rule(Parser *p)
         D(p->level--);
         return NULL;
     }
-    for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
+    for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
     PyMem_Free(_children);
     _PyPegen_insert_memo(p, _start_mark, _loop0_28_type, _seq);
     D(p->level--);
@@ -17343,7 +17358,7 @@ _loop0_31_rule(Parser *p)
         D(fprintf(stderr, "%*c%s _loop0_31[%d-%d]: %s failed!\n", p->level, ' ',
                   p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('.' | '...')"));
     }
-    asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
+    asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
     if (!_seq) {
         PyMem_Free(_children);
         p->error_indicator = 1;
@@ -17351,7 +17366,7 @@ _loop0_31_rule(Parser *p)
         D(p->level--);
         return NULL;
     }
-    for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
+    for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
     PyMem_Free(_children);
     _PyPegen_insert_memo(p, _start_mark, _loop0_31_type, _seq);
     D(p->level--);
@@ -17414,7 +17429,7 @@ _loop1_32_rule(Parser *p)
         D(p->level--);
         return NULL;
     }
-    asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
+    asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
     if (!_seq) {
         PyMem_Free(_children);
         p->error_indicator = 1;
@@ -17422,7 +17437,7 @@ _loop1_32_rule(Parser *p)
         D(p->level--);
         return NULL;
     }
-    for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
+    for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
     PyMem_Free(_children);
     _PyPegen_insert_memo(p, _start_mark, _loop1_32_type, _seq);
     D(p->level--);
@@ -17489,7 +17504,7 @@ _loop0_34_rule(Parser *p)
         D(fprintf(stderr, "%*c%s _loop0_34[%d-%d]: %s failed!\n", p->level, ' ',
                   p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' import_from_as_name"));
     }
-    asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
+    asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
     if (!_seq) {
         PyMem_Free(_children);
         p->error_indicator = 1;
@@ -17497,7 +17512,7 @@ _loop0_34_rule(Parser *p)
         D(p->level--);
         return NULL;
     }
-    for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
+    for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
     PyMem_Free(_children);
     _PyPegen_insert_memo(p, _start_mark, _loop0_34_type, _seq);
     D(p->level--);
@@ -17647,7 +17662,7 @@ _loop0_37_rule(Parser *p)
         D(fprintf(stderr, "%*c%s _loop0_37[%d-%d]: %s failed!\n", p->level, ' ',
                   p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' dotted_as_name"));
     }
-    asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
+    asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
     if (!_seq) {
         PyMem_Free(_children);
         p->error_indicator = 1;
@@ -17655,7 +17670,7 @@ _loop0_37_rule(Parser *p)
         D(p->level--);
         return NULL;
     }
-    for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
+    for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
     PyMem_Free(_children);
     _PyPegen_insert_memo(p, _start_mark, _loop0_37_type, _seq);
     D(p->level--);
@@ -17805,7 +17820,7 @@ _loop0_40_rule(Parser *p)
         D(fprintf(stderr, "%*c%s _loop0_40[%d-%d]: %s failed!\n", p->level, ' ',
                   p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' with_item"));
     }
-    asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
+    asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
     if (!_seq) {
         PyMem_Free(_children);
         p->error_indicator = 1;
@@ -17813,7 +17828,7 @@ _loop0_40_rule(Parser *p)
         D(p->level--);
         return NULL;
     }
-    for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
+    for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
     PyMem_Free(_children);
     _PyPegen_insert_memo(p, _start_mark, _loop0_40_type, _seq);
     D(p->level--);
@@ -17919,7 +17934,7 @@ _loop0_42_rule(Parser *p)
         D(fprintf(stderr, "%*c%s _loop0_42[%d-%d]: %s failed!\n", p->level, ' ',
                   p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' with_item"));
     }
-    asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
+    asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
     if (!_seq) {
         PyMem_Free(_children);
         p->error_indicator = 1;
@@ -17927,7 +17942,7 @@ _loop0_42_rule(Parser *p)
         D(p->level--);
         return NULL;
     }
-    for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
+    for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
     PyMem_Free(_children);
     _PyPegen_insert_memo(p, _start_mark, _loop0_42_type, _seq);
     D(p->level--);
@@ -18033,7 +18048,7 @@ _loop0_44_rule(Parser *p)
         D(fprintf(stderr, "%*c%s _loop0_44[%d-%d]: %s failed!\n", p->level, ' ',
                   p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' with_item"));
     }
-    asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
+    asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
     if (!_seq) {
         PyMem_Free(_children);
         p->error_indicator = 1;
@@ -18041,7 +18056,7 @@ _loop0_44_rule(Parser *p)
         D(p->level--);
         return NULL;
     }
-    for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
+    for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
     PyMem_Free(_children);
     _PyPegen_insert_memo(p, _start_mark, _loop0_44_type, _seq);
     D(p->level--);
@@ -18147,7 +18162,7 @@ _loop0_46_rule(Parser *p)
         D(fprintf(stderr, "%*c%s _loop0_46[%d-%d]: %s failed!\n", p->level, ' ',
                   p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' with_item"));
     }
-    asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
+    asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
     if (!_seq) {
         PyMem_Free(_children);
         p->error_indicator = 1;
@@ -18155,7 +18170,7 @@ _loop0_46_rule(Parser *p)
         D(p->level--);
         return NULL;
     }
-    for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
+    for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
     PyMem_Free(_children);
     _PyPegen_insert_memo(p, _start_mark, _loop0_46_type, _seq);
     D(p->level--);
@@ -18331,7 +18346,7 @@ _loop1_48_rule(Parser *p)
         D(p->level--);
         return NULL;
     }
-    asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
+    asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
     if (!_seq) {
         PyMem_Free(_children);
         p->error_indicator = 1;
@@ -18339,7 +18354,7 @@ _loop1_48_rule(Parser *p)
         D(p->level--);
         return NULL;
     }
-    for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
+    for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
     PyMem_Free(_children);
     _PyPegen_insert_memo(p, _start_mark, _loop1_48_type, _seq);
     D(p->level--);
@@ -18612,7 +18627,7 @@ _loop0_54_rule(Parser *p)
         D(fprintf(stderr, "%*c%s _loop0_54[%d-%d]: %s failed!\n", p->level, ' ',
                   p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default"));
     }
-    asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
+    asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
     if (!_seq) {
         PyMem_Free(_children);
         p->error_indicator = 1;
@@ -18620,7 +18635,7 @@ _loop0_54_rule(Parser *p)
         D(p->level--);
         return NULL;
     }
-    for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
+    for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
     PyMem_Free(_children);
     _PyPegen_insert_memo(p, _start_mark, _loop0_54_type, _seq);
     D(p->level--);
@@ -18678,7 +18693,7 @@ _loop0_55_rule(Parser *p)
         D(fprintf(stderr, "%*c%s _loop0_55[%d-%d]: %s failed!\n", p->level, ' ',
                   p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_with_default"));
     }
-    asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
+    asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
     if (!_seq) {
         PyMem_Free(_children);
         p->error_indicator = 1;
@@ -18686,7 +18701,7 @@ _loop0_55_rule(Parser *p)
         D(p->level--);
         return NULL;
     }
-    for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
+    for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
     PyMem_Free(_children);
     _PyPegen_insert_memo(p, _start_mark, _loop0_55_type, _seq);
     D(p->level--);
@@ -18744,7 +18759,7 @@ _loop0_56_rule(Parser *p)
         D(fprintf(stderr, "%*c%s _loop0_56[%d-%d]: %s failed!\n", p->level, ' ',
                   p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_with_default"));
     }
-    asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
+    asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
     if (!_seq) {
         PyMem_Free(_children);
         p->error_indicator = 1;
@@ -18752,7 +18767,7 @@ _loop0_56_rule(Parser *p)
         D(p->level--);
         return NULL;
     }
-    for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
+    for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
     PyMem_Free(_children);
     _PyPegen_insert_memo(p, _start_mark, _loop0_56_type, _seq);
     D(p->level--);
@@ -18815,7 +18830,7 @@ _loop1_57_rule(Parser *p)
         D(p->level--);
         return NULL;
     }
-    asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
+    asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
     if (!_seq) {
         PyMem_Free(_children);
         p->error_indicator = 1;
@@ -18823,7 +18838,7 @@ _loop1_57_rule(Parser *p)
         D(p->level--);
         return NULL;
     }
-    for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
+    for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
     PyMem_Free(_children);
     _PyPegen_insert_memo(p, _start_mark, _loop1_57_type, _seq);
     D(p->level--);
@@ -18881,7 +18896,7 @@ _loop0_58_rule(Parser *p)
         D(fprintf(stderr, "%*c%s _loop0_58[%d-%d]: %s failed!\n", p->level, ' ',
                   p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_with_default"));
     }
-    asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
+    asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
     if (!_seq) {
         PyMem_Free(_children);
         p->error_indicator = 1;
@@ -18889,7 +18904,7 @@ _loop0_58_rule(Parser *p)
         D(p->level--);
         return NULL;
     }
-    for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
+    for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
     PyMem_Free(_children);
     _PyPegen_insert_memo(p, _start_mark, _loop0_58_type, _seq);
     D(p->level--);
@@ -18952,7 +18967,7 @@ _loop1_59_rule(Parser *p)
         D(p->level--);
         return NULL;
     }
-    asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
+    asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
     if (!_seq) {
         PyMem_Free(_children);
         p->error_indicator = 1;
@@ -18960,7 +18975,7 @@ _loop1_59_rule(Parser *p)
         D(p->level--);
         return NULL;
     }
-    for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
+    for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
     PyMem_Free(_children);
     _PyPegen_insert_memo(p, _start_mark, _loop1_59_type, _seq);
     D(p->level--);
@@ -19023,7 +19038,7 @@ _loop1_60_rule(Parser *p)
         D(p->level--);
         return NULL;
     }
-    asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
+    asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
     if (!_seq) {
         PyMem_Free(_children);
         p->error_indicator = 1;
@@ -19031,7 +19046,7 @@ _loop1_60_rule(Parser *p)
         D(p->level--);
         return NULL;
     }
-    for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
+    for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
     PyMem_Free(_children);
     _PyPegen_insert_memo(p, _start_mark, _loop1_60_type, _seq);
     D(p->level--);
@@ -19094,7 +19109,7 @@ _loop1_61_rule(Parser *p)
         D(p->level--);
         return NULL;
     }
-    asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
+    asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
     if (!_seq) {
         PyMem_Free(_children);
         p->error_indicator = 1;
@@ -19102,7 +19117,7 @@ _loop1_61_rule(Parser *p)
         D(p->level--);
         return NULL;
     }
-    for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
+    for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
     PyMem_Free(_children);
     _PyPegen_insert_memo(p, _start_mark, _loop1_61_type, _seq);
     D(p->level--);
@@ -19160,7 +19175,7 @@ _loop0_62_rule(Parser *p)
         D(fprintf(stderr, "%*c%s _loop0_62[%d-%d]: %s failed!\n", p->level, ' ',
                   p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default"));
     }
-    asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
+    asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
     if (!_seq) {
         PyMem_Free(_children);
         p->error_indicator = 1;
@@ -19168,7 +19183,7 @@ _loop0_62_rule(Parser *p)
         D(p->level--);
         return NULL;
     }
-    for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
+    for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
     PyMem_Free(_children);
     _PyPegen_insert_memo(p, _start_mark, _loop0_62_type, _seq);
     D(p->level--);
@@ -19231,7 +19246,7 @@ _loop1_63_rule(Parser *p)
         D(p->level--);
         return NULL;
     }
-    asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
+    asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
     if (!_seq) {
         PyMem_Free(_children);
         p->error_indicator = 1;
@@ -19239,7 +19254,7 @@ _loop1_63_rule(Parser *p)
         D(p->level--);
         return NULL;
     }
-    for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
+    for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
     PyMem_Free(_children);
     _PyPegen_insert_memo(p, _start_mark, _loop1_63_type, _seq);
     D(p->level--);
@@ -19297,7 +19312,7 @@ _loop0_64_rule(Parser *p)
         D(fprintf(stderr, "%*c%s _loop0_64[%d-%d]: %s failed!\n", p->level, ' ',
                   p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default"));
     }
-    asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
+    asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
     if (!_seq) {
         PyMem_Free(_children);
         p->error_indicator = 1;
@@ -19305,7 +19320,7 @@ _loop0_64_rule(Parser *p)
         D(p->level--);
         return NULL;
     }
-    for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
+    for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
     PyMem_Free(_children);
     _PyPegen_insert_memo(p, _start_mark, _loop0_64_type, _seq);
     D(p->level--);
@@ -19368,7 +19383,7 @@ _loop1_65_rule(Parser *p)
         D(p->level--);
         return NULL;
     }
-    asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
+    asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
     if (!_seq) {
         PyMem_Free(_children);
         p->error_indicator = 1;
@@ -19376,7 +19391,7 @@ _loop1_65_rule(Parser *p)
         D(p->level--);
         return NULL;
     }
-    for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
+    for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
     PyMem_Free(_children);
     _PyPegen_insert_memo(p, _start_mark, _loop1_65_type, _seq);
     D(p->level--);
@@ -19434,7 +19449,7 @@ _loop0_66_rule(Parser *p)
         D(fprintf(stderr, "%*c%s _loop0_66[%d-%d]: %s failed!\n", p->level, ' ',
                   p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_maybe_default"));
     }
-    asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
+    asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
     if (!_seq) {
         PyMem_Free(_children);
         p->error_indicator = 1;
@@ -19442,7 +19457,7 @@ _loop0_66_rule(Parser *p)
         D(p->level--);
         return NULL;
     }
-    for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
+    for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
     PyMem_Free(_children);
     _PyPegen_insert_memo(p, _start_mark, _loop0_66_type, _seq);
     D(p->level--);
@@ -19505,7 +19520,7 @@ _loop1_67_rule(Parser *p)
         D(p->level--);
         return NULL;
     }
-    asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
+    asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
     if (!_seq) {
         PyMem_Free(_children);
         p->error_indicator = 1;
@@ -19513,7 +19528,7 @@ _loop1_67_rule(Parser *p)
         D(p->level--);
         return NULL;
     }
-    for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
+    for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
     PyMem_Free(_children);
     _PyPegen_insert_memo(p, _start_mark, _loop1_67_type, _seq);
     D(p->level--);
@@ -19576,7 +19591,7 @@ _loop1_68_rule(Parser *p)
         D(p->level--);
         return NULL;
     }
-    asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
+    asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
     if (!_seq) {
         PyMem_Free(_children);
         p->error_indicator = 1;
@@ -19584,7 +19599,7 @@ _loop1_68_rule(Parser *p)
         D(p->level--);
         return NULL;
     }
-    for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
+    for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
     PyMem_Free(_children);
     _PyPegen_insert_memo(p, _start_mark, _loop1_68_type, _seq);
     D(p->level--);
@@ -19698,7 +19713,7 @@ _loop0_71_rule(Parser *p)
         D(fprintf(stderr, "%*c%s _loop0_71[%d-%d]: %s failed!\n", p->level, ' ',
                   p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' star_expression"));
     }
-    asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
+    asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
     if (!_seq) {
         PyMem_Free(_children);
         p->error_indicator = 1;
@@ -19706,7 +19721,7 @@ _loop0_71_rule(Parser *p)
         D(p->level--);
         return NULL;
     }
-    for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
+    for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
     PyMem_Free(_children);
     _PyPegen_insert_memo(p, _start_mark, _loop0_71_type, _seq);
     D(p->level--);
@@ -19808,7 +19823,7 @@ _loop1_72_rule(Parser *p)
         D(p->level--);
         return NULL;
     }
-    asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
+    asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
     if (!_seq) {
         PyMem_Free(_children);
         p->error_indicator = 1;
@@ -19816,7 +19831,7 @@ _loop1_72_rule(Parser *p)
         D(p->level--);
         return NULL;
     }
-    for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
+    for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
     PyMem_Free(_children);
     _PyPegen_insert_memo(p, _start_mark, _loop1_72_type, _seq);
     D(p->level--);
@@ -19883,7 +19898,7 @@ _loop0_74_rule(Parser *p)
         D(fprintf(stderr, "%*c%s _loop0_74[%d-%d]: %s failed!\n", p->level, ' ',
                   p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' star_named_expression"));
     }
-    asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
+    asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
     if (!_seq) {
         PyMem_Free(_children);
         p->error_indicator = 1;
@@ -19891,7 +19906,7 @@ _loop0_74_rule(Parser *p)
         D(p->level--);
         return NULL;
     }
-    for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
+    for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
     PyMem_Free(_children);
     _PyPegen_insert_memo(p, _start_mark, _loop0_74_type, _seq);
     D(p->level--);
@@ -19993,7 +20008,7 @@ _loop1_75_rule(Parser *p)
         D(p->level--);
         return NULL;
     }
-    asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
+    asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
     if (!_seq) {
         PyMem_Free(_children);
         p->error_indicator = 1;
@@ -20001,7 +20016,7 @@ _loop1_75_rule(Parser *p)
         D(p->level--);
         return NULL;
     }
-    for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
+    for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
     PyMem_Free(_children);
     _PyPegen_insert_memo(p, _start_mark, _loop1_75_type, _seq);
     D(p->level--);
@@ -20059,7 +20074,7 @@ _loop0_76_rule(Parser *p)
         D(fprintf(stderr, "%*c%s _loop0_76[%d-%d]: %s failed!\n", p->level, ' ',
                   p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default"));
     }
-    asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
+    asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
     if (!_seq) {
         PyMem_Free(_children);
         p->error_indicator = 1;
@@ -20067,7 +20082,7 @@ _loop0_76_rule(Parser *p)
         D(p->level--);
         return NULL;
     }
-    for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
+    for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
     PyMem_Free(_children);
     _PyPegen_insert_memo(p, _start_mark, _loop0_76_type, _seq);
     D(p->level--);
@@ -20125,7 +20140,7 @@ _loop0_77_rule(Parser *p)
         D(fprintf(stderr, "%*c%s _loop0_77[%d-%d]: %s failed!\n", p->level, ' ',
                   p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_with_default"));
     }
-    asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
+    asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
     if (!_seq) {
         PyMem_Free(_children);
         p->error_indicator = 1;
@@ -20133,7 +20148,7 @@ _loop0_77_rule(Parser *p)
         D(p->level--);
         return NULL;
     }
-    for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
+    for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
     PyMem_Free(_children);
     _PyPegen_insert_memo(p, _start_mark, _loop0_77_type, _seq);
     D(p->level--);
@@ -20191,7 +20206,7 @@ _loop0_78_rule(Parser *p)
         D(fprintf(stderr, "%*c%s _loop0_78[%d-%d]: %s failed!\n", p->level, ' ',
                   p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_with_default"));
     }
-    asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
+    asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
     if (!_seq) {
         PyMem_Free(_children);
         p->error_indicator = 1;
@@ -20199,7 +20214,7 @@ _loop0_78_rule(Parser *p)
         D(p->level--);
         return NULL;
     }
-    for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
+    for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
     PyMem_Free(_children);
     _PyPegen_insert_memo(p, _start_mark, _loop0_78_type, _seq);
     D(p->level--);
@@ -20262,7 +20277,7 @@ _loop1_79_rule(Parser *p)
         D(p->level--);
         return NULL;
     }
-    asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
+    asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
     if (!_seq) {
         PyMem_Free(_children);
         p->error_indicator = 1;
@@ -20270,7 +20285,7 @@ _loop1_79_rule(Parser *p)
         D(p->level--);
         return NULL;
     }
-    for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
+    for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
     PyMem_Free(_children);
     _PyPegen_insert_memo(p, _start_mark, _loop1_79_type, _seq);
     D(p->level--);
@@ -20328,7 +20343,7 @@ _loop0_80_rule(Parser *p)
         D(fprintf(stderr, "%*c%s _loop0_80[%d-%d]: %s failed!\n", p->level, ' ',
                   p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_with_default"));
     }
-    asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
+    asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
     if (!_seq) {
         PyMem_Free(_children);
         p->error_indicator = 1;
@@ -20336,7 +20351,7 @@ _loop0_80_rule(Parser *p)
         D(p->level--);
         return NULL;
     }
-    for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
+    for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
     PyMem_Free(_children);
     _PyPegen_insert_memo(p, _start_mark, _loop0_80_type, _seq);
     D(p->level--);
@@ -20399,7 +20414,7 @@ _loop1_81_rule(Parser *p)
         D(p->level--);
         return NULL;
     }
-    asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
+    asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
     if (!_seq) {
         PyMem_Free(_children);
         p->error_indicator = 1;
@@ -20407,7 +20422,7 @@ _loop1_81_rule(Parser *p)
         D(p->level--);
         return NULL;
     }
-    for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
+    for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
     PyMem_Free(_children);
     _PyPegen_insert_memo(p, _start_mark, _loop1_81_type, _seq);
     D(p->level--);
@@ -20470,7 +20485,7 @@ _loop1_82_rule(Parser *p)
         D(p->level--);
         return NULL;
     }
-    asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
+    asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
     if (!_seq) {
         PyMem_Free(_children);
         p->error_indicator = 1;
@@ -20478,7 +20493,7 @@ _loop1_82_rule(Parser *p)
         D(p->level--);
         return NULL;
     }
-    for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
+    for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
     PyMem_Free(_children);
     _PyPegen_insert_memo(p, _start_mark, _loop1_82_type, _seq);
     D(p->level--);
@@ -20541,7 +20556,7 @@ _loop1_83_rule(Parser *p)
         D(p->level--);
         return NULL;
     }
-    asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
+    asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
     if (!_seq) {
         PyMem_Free(_children);
         p->error_indicator = 1;
@@ -20549,7 +20564,7 @@ _loop1_83_rule(Parser *p)
         D(p->level--);
         return NULL;
     }
-    for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
+    for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
     PyMem_Free(_children);
     _PyPegen_insert_memo(p, _start_mark, _loop1_83_type, _seq);
     D(p->level--);
@@ -20607,7 +20622,7 @@ _loop0_84_rule(Parser *p)
         D(fprintf(stderr, "%*c%s _loop0_84[%d-%d]: %s failed!\n", p->level, ' ',
                   p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default"));
     }
-    asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
+    asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
     if (!_seq) {
         PyMem_Free(_children);
         p->error_indicator = 1;
@@ -20615,7 +20630,7 @@ _loop0_84_rule(Parser *p)
         D(p->level--);
         return NULL;
     }
-    for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
+    for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
     PyMem_Free(_children);
     _PyPegen_insert_memo(p, _start_mark, _loop0_84_type, _seq);
     D(p->level--);
@@ -20678,7 +20693,7 @@ _loop1_85_rule(Parser *p)
         D(p->level--);
         return NULL;
     }
-    asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
+    asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
     if (!_seq) {
         PyMem_Free(_children);
         p->error_indicator = 1;
@@ -20686,7 +20701,7 @@ _loop1_85_rule(Parser *p)
         D(p->level--);
         return NULL;
     }
-    for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
+    for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
     PyMem_Free(_children);
     _PyPegen_insert_memo(p, _start_mark, _loop1_85_type, _seq);
     D(p->level--);
@@ -20744,7 +20759,7 @@ _loop0_86_rule(Parser *p)
         D(fprintf(stderr, "%*c%s _loop0_86[%d-%d]: %s failed!\n", p->level, ' ',
                   p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default"));
     }
-    asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
+    asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
     if (!_seq) {
         PyMem_Free(_children);
         p->error_indicator = 1;
@@ -20752,7 +20767,7 @@ _loop0_86_rule(Parser *p)
         D(p->level--);
         return NULL;
     }
-    for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
+    for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
     PyMem_Free(_children);
     _PyPegen_insert_memo(p, _start_mark, _loop0_86_type, _seq);
     D(p->level--);
@@ -20815,7 +20830,7 @@ _loop1_87_rule(Parser *p)
         D(p->level--);
         return NULL;
     }
-    asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
+    asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
     if (!_seq) {
         PyMem_Free(_children);
         p->error_indicator = 1;
@@ -20823,7 +20838,7 @@ _loop1_87_rule(Parser *p)
         D(p->level--);
         return NULL;
     }
-    for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
+    for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
     PyMem_Free(_children);
     _PyPegen_insert_memo(p, _start_mark, _loop1_87_type, _seq);
     D(p->level--);
@@ -20881,7 +20896,7 @@ _loop0_88_rule(Parser *p)
         D(fprintf(stderr, "%*c%s _loop0_88[%d-%d]: %s failed!\n", p->level, ' ',
                   p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_maybe_default"));
     }
-    asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
+    asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
     if (!_seq) {
         PyMem_Free(_children);
         p->error_indicator = 1;
@@ -20889,7 +20904,7 @@ _loop0_88_rule(Parser *p)
         D(p->level--);
         return NULL;
     }
-    for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
+    for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
     PyMem_Free(_children);
     _PyPegen_insert_memo(p, _start_mark, _loop0_88_type, _seq);
     D(p->level--);
@@ -20952,7 +20967,7 @@ _loop1_89_rule(Parser *p)
         D(p->level--);
         return NULL;
     }
-    asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
+    asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
     if (!_seq) {
         PyMem_Free(_children);
         p->error_indicator = 1;
@@ -20960,7 +20975,7 @@ _loop1_89_rule(Parser *p)
         D(p->level--);
         return NULL;
     }
-    for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
+    for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
     PyMem_Free(_children);
     _PyPegen_insert_memo(p, _start_mark, _loop1_89_type, _seq);
     D(p->level--);
@@ -21023,7 +21038,7 @@ _loop1_90_rule(Parser *p)
         D(p->level--);
         return NULL;
     }
-    asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
+    asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
     if (!_seq) {
         PyMem_Free(_children);
         p->error_indicator = 1;
@@ -21031,7 +21046,7 @@ _loop1_90_rule(Parser *p)
         D(p->level--);
         return NULL;
     }
-    for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
+    for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
     PyMem_Free(_children);
     _PyPegen_insert_memo(p, _start_mark, _loop1_90_type, _seq);
     D(p->level--);
@@ -21094,7 +21109,7 @@ _loop1_91_rule(Parser *p)
         D(p->level--);
         return NULL;
     }
-    asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
+    asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
     if (!_seq) {
         PyMem_Free(_children);
         p->error_indicator = 1;
@@ -21102,7 +21117,7 @@ _loop1_91_rule(Parser *p)
         D(p->level--);
         return NULL;
     }
-    for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
+    for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
     PyMem_Free(_children);
     _PyPegen_insert_memo(p, _start_mark, _loop1_91_type, _seq);
     D(p->level--);
@@ -21165,7 +21180,7 @@ _loop1_92_rule(Parser *p)
         D(p->level--);
         return NULL;
     }
-    asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
+    asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
     if (!_seq) {
         PyMem_Free(_children);
         p->error_indicator = 1;
@@ -21173,7 +21188,7 @@ _loop1_92_rule(Parser *p)
         D(p->level--);
         return NULL;
     }
-    for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
+    for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
     PyMem_Free(_children);
     _PyPegen_insert_memo(p, _start_mark, _loop1_92_type, _seq);
     D(p->level--);
@@ -21281,7 +21296,7 @@ _loop0_95_rule(Parser *p)
         D(fprintf(stderr, "%*c%s _loop0_95[%d-%d]: %s failed!\n", p->level, ' ',
                   p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' slice"));
     }
-    asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
+    asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
     if (!_seq) {
         PyMem_Free(_children);
         p->error_indicator = 1;
@@ -21289,7 +21304,7 @@ _loop0_95_rule(Parser *p)
         D(p->level--);
         return NULL;
     }
-    for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
+    for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
     PyMem_Free(_children);
     _PyPegen_insert_memo(p, _start_mark, _loop0_95_type, _seq);
     D(p->level--);
@@ -21657,7 +21672,7 @@ _loop1_100_rule(Parser *p)
         D(p->level--);
         return NULL;
     }
-    asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
+    asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
     if (!_seq) {
         PyMem_Free(_children);
         p->error_indicator = 1;
@@ -21665,7 +21680,7 @@ _loop1_100_rule(Parser *p)
         D(p->level--);
         return NULL;
     }
-    for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
+    for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
     PyMem_Free(_children);
     _PyPegen_insert_memo(p, _start_mark, _loop1_100_type, _seq);
     D(p->level--);
@@ -21834,7 +21849,7 @@ _loop0_104_rule(Parser *p)
         D(fprintf(stderr, "%*c%s _loop0_104[%d-%d]: %s failed!\n", p->level, ' ',
                   p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' double_starred_kvpair"));
     }
-    asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
+    asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
     if (!_seq) {
         PyMem_Free(_children);
         p->error_indicator = 1;
@@ -21842,7 +21857,7 @@ _loop0_104_rule(Parser *p)
         D(p->level--);
         return NULL;
     }
-    for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
+    for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
     PyMem_Free(_children);
     _PyPegen_insert_memo(p, _start_mark, _loop0_104_type, _seq);
     D(p->level--);
@@ -21944,7 +21959,7 @@ _loop1_105_rule(Parser *p)
         D(p->level--);
         return NULL;
     }
-    asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
+    asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
     if (!_seq) {
         PyMem_Free(_children);
         p->error_indicator = 1;
@@ -21952,7 +21967,7 @@ _loop1_105_rule(Parser *p)
         D(p->level--);
         return NULL;
     }
-    for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
+    for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
     PyMem_Free(_children);
     _PyPegen_insert_memo(p, _start_mark, _loop1_105_type, _seq);
     D(p->level--);
@@ -22010,7 +22025,7 @@ _loop0_106_rule(Parser *p)
         D(fprintf(stderr, "%*c%s _loop0_106[%d-%d]: %s failed!\n", p->level, ' ',
                   p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('if' disjunction)"));
     }
-    asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
+    asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
     if (!_seq) {
         PyMem_Free(_children);
         p->error_indicator = 1;
@@ -22018,7 +22033,7 @@ _loop0_106_rule(Parser *p)
         D(p->level--);
         return NULL;
     }
-    for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
+    for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
     PyMem_Free(_children);
     _PyPegen_insert_memo(p, _start_mark, _loop0_106_type, _seq);
     D(p->level--);
@@ -22076,7 +22091,7 @@ _loop0_107_rule(Parser *p)
         D(fprintf(stderr, "%*c%s _loop0_107[%d-%d]: %s failed!\n", p->level, ' ',
                   p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('if' disjunction)"));
     }
-    asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
+    asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
     if (!_seq) {
         PyMem_Free(_children);
         p->error_indicator = 1;
@@ -22084,7 +22099,7 @@ _loop0_107_rule(Parser *p)
         D(p->level--);
         return NULL;
     }
-    for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
+    for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
     PyMem_Free(_children);
     _PyPegen_insert_memo(p, _start_mark, _loop0_107_type, _seq);
     D(p->level--);
@@ -22151,7 +22166,7 @@ _loop0_109_rule(Parser *p)
         D(fprintf(stderr, "%*c%s _loop0_109[%d-%d]: %s failed!\n", p->level, ' ',
                   p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' (starred_expression | named_expression !'=')"));
     }
-    asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
+    asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
     if (!_seq) {
         PyMem_Free(_children);
         p->error_indicator = 1;
@@ -22159,7 +22174,7 @@ _loop0_109_rule(Parser *p)
         D(p->level--);
         return NULL;
     }
-    for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
+    for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
     PyMem_Free(_children);
     _PyPegen_insert_memo(p, _start_mark, _loop0_109_type, _seq);
     D(p->level--);
@@ -22309,7 +22324,7 @@ _loop0_112_rule(Parser *p)
         D(fprintf(stderr, "%*c%s _loop0_112[%d-%d]: %s failed!\n", p->level, ' ',
                   p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' kwarg_or_starred"));
     }
-    asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
+    asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
     if (!_seq) {
         PyMem_Free(_children);
         p->error_indicator = 1;
@@ -22317,7 +22332,7 @@ _loop0_112_rule(Parser *p)
         D(p->level--);
         return NULL;
     }
-    for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
+    for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
     PyMem_Free(_children);
     _PyPegen_insert_memo(p, _start_mark, _loop0_112_type, _seq);
     D(p->level--);
@@ -22423,7 +22438,7 @@ _loop0_114_rule(Parser *p)
         D(fprintf(stderr, "%*c%s _loop0_114[%d-%d]: %s failed!\n", p->level, ' ',
                   p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' kwarg_or_double_starred"));
     }
-    asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
+    asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
     if (!_seq) {
         PyMem_Free(_children);
         p->error_indicator = 1;
@@ -22431,7 +22446,7 @@ _loop0_114_rule(Parser *p)
         D(p->level--);
         return NULL;
     }
-    for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
+    for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
     PyMem_Free(_children);
     _PyPegen_insert_memo(p, _start_mark, _loop0_114_type, _seq);
     D(p->level--);
@@ -22537,7 +22552,7 @@ _loop0_116_rule(Parser *p)
         D(fprintf(stderr, "%*c%s _loop0_116[%d-%d]: %s failed!\n", p->level, ' ',
                   p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' kwarg_or_starred"));
     }
-    asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
+    asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
     if (!_seq) {
         PyMem_Free(_children);
         p->error_indicator = 1;
@@ -22545,7 +22560,7 @@ _loop0_116_rule(Parser *p)
         D(p->level--);
         return NULL;
     }
-    for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
+    for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
     PyMem_Free(_children);
     _PyPegen_insert_memo(p, _start_mark, _loop0_116_type, _seq);
     D(p->level--);
@@ -22651,7 +22666,7 @@ _loop0_118_rule(Parser *p)
         D(fprintf(stderr, "%*c%s _loop0_118[%d-%d]: %s failed!\n", p->level, ' ',
                   p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' kwarg_or_double_starred"));
     }
-    asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
+    asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
     if (!_seq) {
         PyMem_Free(_children);
         p->error_indicator = 1;
@@ -22659,7 +22674,7 @@ _loop0_118_rule(Parser *p)
         D(p->level--);
         return NULL;
     }
-    for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
+    for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
     PyMem_Free(_children);
     _PyPegen_insert_memo(p, _start_mark, _loop0_118_type, _seq);
     D(p->level--);
@@ -22756,7 +22771,7 @@ _loop0_119_rule(Parser *p)
         D(fprintf(stderr, "%*c%s _loop0_119[%d-%d]: %s failed!\n", p->level, ' ',
                   p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(',' star_target)"));
     }
-    asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
+    asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
     if (!_seq) {
         PyMem_Free(_children);
         p->error_indicator = 1;
@@ -22764,7 +22779,7 @@ _loop0_119_rule(Parser *p)
         D(p->level--);
         return NULL;
     }
-    for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
+    for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
     PyMem_Free(_children);
     _PyPegen_insert_memo(p, _start_mark, _loop0_119_type, _seq);
     D(p->level--);
@@ -22831,7 +22846,7 @@ _loop0_121_rule(Parser *p)
         D(fprintf(stderr, "%*c%s _loop0_121[%d-%d]: %s failed!\n", p->level, ' ',
                   p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' star_target"));
     }
-    asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
+    asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
     if (!_seq) {
         PyMem_Free(_children);
         p->error_indicator = 1;
@@ -22839,7 +22854,7 @@ _loop0_121_rule(Parser *p)
         D(p->level--);
         return NULL;
     }
-    for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
+    for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
     PyMem_Free(_children);
     _PyPegen_insert_memo(p, _start_mark, _loop0_121_type, _seq);
     D(p->level--);
@@ -22983,7 +22998,7 @@ _loop0_124_rule(Parser *p)
         D(fprintf(stderr, "%*c%s _loop0_124[%d-%d]: %s failed!\n", p->level, ' ',
                   p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' del_target"));
     }
-    asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
+    asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
     if (!_seq) {
         PyMem_Free(_children);
         p->error_indicator = 1;
@@ -22991,7 +23006,7 @@ _loop0_124_rule(Parser *p)
         D(p->level--);
         return NULL;
     }
-    for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
+    for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
     PyMem_Free(_children);
     _PyPegen_insert_memo(p, _start_mark, _loop0_124_type, _seq);
     D(p->level--);
@@ -23097,7 +23112,7 @@ _loop0_126_rule(Parser *p)
         D(fprintf(stderr, "%*c%s _loop0_126[%d-%d]: %s failed!\n", p->level, ' ',
                   p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' target"));
     }
-    asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
+    asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
     if (!_seq) {
         PyMem_Free(_children);
         p->error_indicator = 1;
@@ -23105,7 +23120,7 @@ _loop0_126_rule(Parser *p)
         D(p->level--);
         return NULL;
     }
-    for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
+    for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
     PyMem_Free(_children);
     _PyPegen_insert_memo(p, _start_mark, _loop0_126_type, _seq);
     D(p->level--);
@@ -23188,7 +23203,7 @@ _tmp_127_rule(Parser *p)
         }
         D(fprintf(stderr, "%*c> _tmp_127[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression for_if_clauses"));
         expr_ty expression_var;
-        asdl_seq* for_if_clauses_var;
+        asdl_comprehension_seq* for_if_clauses_var;
         if (
             (expression_var = expression_rule(p))  // expression
             &&
@@ -23236,7 +23251,7 @@ _loop0_128_rule(Parser *p)
             return NULL;
         }
         D(fprintf(stderr, "%*c> _loop0_128[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_named_expressions"));
-        asdl_seq* star_named_expressions_var;
+        asdl_expr_seq* star_named_expressions_var;
         while (
             (star_named_expressions_var = star_named_expressions_rule(p))  // star_named_expressions
         )
@@ -23260,7 +23275,7 @@ _loop0_128_rule(Parser *p)
         D(fprintf(stderr, "%*c%s _loop0_128[%d-%d]: %s failed!\n", p->level, ' ',
                   p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_named_expressions"));
     }
-    asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
+    asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
     if (!_seq) {
         PyMem_Free(_children);
         p->error_indicator = 1;
@@ -23268,7 +23283,7 @@ _loop0_128_rule(Parser *p)
         D(p->level--);
         return NULL;
     }
-    for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
+    for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
     PyMem_Free(_children);
     _PyPegen_insert_memo(p, _start_mark, _loop0_128_type, _seq);
     D(p->level--);
@@ -23326,7 +23341,7 @@ _loop0_129_rule(Parser *p)
         D(fprintf(stderr, "%*c%s _loop0_129[%d-%d]: %s failed!\n", p->level, ' ',
                   p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(star_targets '=')"));
     }
-    asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
+    asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
     if (!_seq) {
         PyMem_Free(_children);
         p->error_indicator = 1;
@@ -23334,7 +23349,7 @@ _loop0_129_rule(Parser *p)
         D(p->level--);
         return NULL;
     }
-    for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
+    for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
     PyMem_Free(_children);
     _PyPegen_insert_memo(p, _start_mark, _loop0_129_type, _seq);
     D(p->level--);
@@ -23392,7 +23407,7 @@ _loop0_130_rule(Parser *p)
         D(fprintf(stderr, "%*c%s _loop0_130[%d-%d]: %s failed!\n", p->level, ' ',
                   p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(star_targets '=')"));
     }
-    asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
+    asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
     if (!_seq) {
         PyMem_Free(_children);
         p->error_indicator = 1;
@@ -23400,7 +23415,7 @@ _loop0_130_rule(Parser *p)
         D(p->level--);
         return NULL;
     }
-    for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
+    for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
     PyMem_Free(_children);
     _PyPegen_insert_memo(p, _start_mark, _loop0_130_type, _seq);
     D(p->level--);
@@ -23587,7 +23602,7 @@ _loop0_133_rule(Parser *p)
         D(fprintf(stderr, "%*c%s _loop0_133[%d-%d]: %s failed!\n", p->level, ' ',
                   p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default"));
     }
-    asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
+    asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
     if (!_seq) {
         PyMem_Free(_children);
         p->error_indicator = 1;
@@ -23595,7 +23610,7 @@ _loop0_133_rule(Parser *p)
         D(p->level--);
         return NULL;
     }
-    for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
+    for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
     PyMem_Free(_children);
     _PyPegen_insert_memo(p, _start_mark, _loop0_133_type, _seq);
     D(p->level--);
@@ -23708,7 +23723,7 @@ _loop0_135_rule(Parser *p)
         D(fprintf(stderr, "%*c%s _loop0_135[%d-%d]: %s failed!\n", p->level, ' ',
                   p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default"));
     }
-    asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
+    asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
     if (!_seq) {
         PyMem_Free(_children);
         p->error_indicator = 1;
@@ -23716,7 +23731,7 @@ _loop0_135_rule(Parser *p)
         D(p->level--);
         return NULL;
     }
-    for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
+    for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
     PyMem_Free(_children);
     _PyPegen_insert_memo(p, _start_mark, _loop0_135_type, _seq);
     D(p->level--);
@@ -24594,7 +24609,7 @@ _loop1_153_rule(Parser *p)
         D(p->level--);
         return NULL;
     }
-    asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
+    asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
     if (!_seq) {
         PyMem_Free(_children);
         p->error_indicator = 1;
@@ -24602,7 +24617,7 @@ _loop1_153_rule(Parser *p)
         D(p->level--);
         return NULL;
     }
-    for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
+    for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
     PyMem_Free(_children);
     _PyPegen_insert_memo(p, _start_mark, _loop1_153_type, _seq);
     D(p->level--);
@@ -24665,7 +24680,7 @@ _loop1_154_rule(Parser *p)
         D(p->level--);
         return NULL;
     }
-    asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
+    asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
     if (!_seq) {
         PyMem_Free(_children);
         p->error_indicator = 1;
@@ -24673,7 +24688,7 @@ _loop1_154_rule(Parser *p)
         D(p->level--);
         return NULL;
     }
-    for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
+    for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
     PyMem_Free(_children);
     _PyPegen_insert_memo(p, _start_mark, _loop1_154_type, _seq);
     D(p->level--);
diff --git a/Parser/pegen.c b/Parser/pegen.c
index 4beb2abdd296a..1de495eaf398e 100644
--- a/Parser/pegen.c
+++ b/Parser/pegen.c
@@ -1243,7 +1243,7 @@ _PyPegen_run_parser_from_string(const char *str, int start_rule, PyObject *filen
     return result;
 }
 
-void *
+asdl_stmt_seq*
 _PyPegen_interactive_exit(Parser *p)
 {
     if (p->errcode) {
@@ -1257,11 +1257,11 @@ asdl_seq *
 _PyPegen_singleton_seq(Parser *p, void *a)
 {
     assert(a != NULL);
-    asdl_seq *seq = _Py_asdl_seq_new(1, p->arena);
+    asdl_seq *seq = (asdl_seq*)_Py_asdl_generic_seq_new(1, p->arena);
     if (!seq) {
         return NULL;
     }
-    asdl_seq_SET(seq, 0, a);
+    asdl_seq_SET_UNTYPED(seq, 0, a);
     return seq;
 }
 
@@ -1274,14 +1274,14 @@ _PyPegen_seq_insert_in_front(Parser *p, void *a, asdl_seq *seq)
         return _PyPegen_singleton_seq(p, a);
     }
 
-    asdl_seq *new_seq = _Py_asdl_seq_new(asdl_seq_LEN(seq) + 1, p->arena);
+    asdl_seq *new_seq = (asdl_seq*)_Py_asdl_generic_seq_new(asdl_seq_LEN(seq) + 1, p->arena);
     if (!new_seq) {
         return NULL;
     }
 
-    asdl_seq_SET(new_seq, 0, a);
+    asdl_seq_SET_UNTYPED(new_seq, 0, a);
     for (Py_ssize_t i = 1, l = asdl_seq_LEN(new_seq); i < l; i++) {
-        asdl_seq_SET(new_seq, i, asdl_seq_GET(seq, i - 1));
+        asdl_seq_SET_UNTYPED(new_seq, i, asdl_seq_GET_UNTYPED(seq, i - 1));
     }
     return new_seq;
 }
@@ -1295,15 +1295,15 @@ _PyPegen_seq_append_to_end(Parser *p, asdl_seq *seq, void *a)
         return _PyPegen_singleton_seq(p, a);
     }
 
-    asdl_seq *new_seq = _Py_asdl_seq_new(asdl_seq_LEN(seq) + 1, p->arena);
+    asdl_seq *new_seq = (asdl_seq*)_Py_asdl_generic_seq_new(asdl_seq_LEN(seq) + 1, p->arena);
     if (!new_seq) {
         return NULL;
     }
 
     for (Py_ssize_t i = 0, l = asdl_seq_LEN(new_seq); i + 1 < l; i++) {
-        asdl_seq_SET(new_seq, i, asdl_seq_GET(seq, i));
+        asdl_seq_SET_UNTYPED(new_seq, i, asdl_seq_GET_UNTYPED(seq, i));
     }
-    asdl_seq_SET(new_seq, asdl_seq_LEN(new_seq) - 1, a);
+    asdl_seq_SET_UNTYPED(new_seq, asdl_seq_LEN(new_seq) - 1, a);
     return new_seq;
 }
 
@@ -1312,7 +1312,7 @@ _get_flattened_seq_size(asdl_seq *seqs)
 {
     Py_ssize_t size = 0;
     for (Py_ssize_t i = 0, l = asdl_seq_LEN(seqs); i < l; i++) {
-        asdl_seq *inner_seq = asdl_seq_GET(seqs, i);
+        asdl_seq *inner_seq = asdl_seq_GET_UNTYPED(seqs, i);
         size += asdl_seq_LEN(inner_seq);
     }
     return size;
@@ -1325,16 +1325,16 @@ _PyPegen_seq_flatten(Parser *p, asdl_seq *seqs)
     Py_ssize_t flattened_seq_size = _get_flattened_seq_size(seqs);
     assert(flattened_seq_size > 0);
 
-    asdl_seq *flattened_seq = _Py_asdl_seq_new(flattened_seq_size, p->arena);
+    asdl_seq *flattened_seq = (asdl_seq*)_Py_asdl_generic_seq_new(flattened_seq_size, p->arena);
     if (!flattened_seq) {
         return NULL;
     }
 
     int flattened_seq_idx = 0;
     for (Py_ssize_t i = 0, l = asdl_seq_LEN(seqs); i < l; i++) {
-        asdl_seq *inner_seq = asdl_seq_GET(seqs, i);
+        asdl_seq *inner_seq = asdl_seq_GET_UNTYPED(seqs, i);
         for (Py_ssize_t j = 0, li = asdl_seq_LEN(inner_seq); j < li; j++) {
-            asdl_seq_SET(flattened_seq, flattened_seq_idx++, asdl_seq_GET(inner_seq, j));
+            asdl_seq_SET_UNTYPED(flattened_seq, flattened_seq_idx++, asdl_seq_GET_UNTYPED(inner_seq, j));
         }
     }
     assert(flattened_seq_idx == flattened_seq_size);
@@ -1403,7 +1403,7 @@ _PyPegen_seq_count_dots(asdl_seq *seq)
 {
     int number_of_dots = 0;
     for (Py_ssize_t i = 0, l = asdl_seq_LEN(seq); i < l; i++) {
-        Token *current_expr = asdl_seq_GET(seq, i);
+        Token *current_expr = asdl_seq_GET_UNTYPED(seq, i);
         switch (current_expr->type) {
             case ELLIPSIS:
                 number_of_dots += 3;
@@ -1435,13 +1435,13 @@ _PyPegen_alias_for_star(Parser *p)
 }
 
 /* Creates a new asdl_seq* with the identifiers of all the names in seq */
-asdl_seq *
-_PyPegen_map_names_to_ids(Parser *p, asdl_seq *seq)
+asdl_identifier_seq *
+_PyPegen_map_names_to_ids(Parser *p, asdl_expr_seq *seq)
 {
     Py_ssize_t len = asdl_seq_LEN(seq);
     assert(len > 0);
 
-    asdl_seq *new_seq = _Py_asdl_seq_new(len, p->arena);
+    asdl_identifier_seq *new_seq = _Py_asdl_identifier_seq_new(len, p->arena);
     if (!new_seq) {
         return NULL;
     }
@@ -1477,39 +1477,39 @@ _PyPegen_get_cmpops(Parser *p, asdl_seq *seq)
         return NULL;
     }
     for (Py_ssize_t i = 0; i < len; i++) {
-        CmpopExprPair *pair = asdl_seq_GET(seq, i);
+        CmpopExprPair *pair = asdl_seq_GET_UNTYPED(seq, i);
         asdl_seq_SET(new_seq, i, pair->cmpop);
     }
     return new_seq;
 }
 
-asdl_seq *
+asdl_expr_seq *
 _PyPegen_get_exprs(Parser *p, asdl_seq *seq)
 {
     Py_ssize_t len = asdl_seq_LEN(seq);
     assert(len > 0);
 
-    asdl_seq *new_seq = _Py_asdl_seq_new(len, p->arena);
+    asdl_expr_seq *new_seq = _Py_asdl_expr_seq_new(len, p->arena);
     if (!new_seq) {
         return NULL;
     }
     for (Py_ssize_t i = 0; i < len; i++) {
-        CmpopExprPair *pair = asdl_seq_GET(seq, i);
+        CmpopExprPair *pair = asdl_seq_GET_UNTYPED(seq, i);
         asdl_seq_SET(new_seq, i, pair->expr);
     }
     return new_seq;
 }
 
 /* Creates an asdl_seq* where all the elements have been changed to have ctx as context */
-static asdl_seq *
-_set_seq_context(Parser *p, asdl_seq *seq, expr_context_ty ctx)
+static asdl_expr_seq *
+_set_seq_context(Parser *p, asdl_expr_seq *seq, expr_context_ty ctx)
 {
     Py_ssize_t len = asdl_seq_LEN(seq);
     if (len == 0) {
         return NULL;
     }
 
-    asdl_seq *new_seq = _Py_asdl_seq_new(len, p->arena);
+    asdl_expr_seq *new_seq = _Py_asdl_expr_seq_new(len, p->arena);
     if (!new_seq) {
         return NULL;
     }
@@ -1529,13 +1529,19 @@ _set_name_context(Parser *p, expr_ty e, expr_context_ty ctx)
 static expr_ty
 _set_tuple_context(Parser *p, expr_ty e, expr_context_ty ctx)
 {
-    return _Py_Tuple(_set_seq_context(p, e->v.Tuple.elts, ctx), ctx, EXTRA_EXPR(e, e));
+    return _Py_Tuple(
+            _set_seq_context(p, e->v.Tuple.elts, ctx),
+            ctx,
+            EXTRA_EXPR(e, e));
 }
 
 static expr_ty
 _set_list_context(Parser *p, expr_ty e, expr_context_ty ctx)
 {
-    return _Py_List(_set_seq_context(p, e->v.List.elts, ctx), ctx, EXTRA_EXPR(e, e));
+    return _Py_List(
+            _set_seq_context(p, e->v.List.elts, ctx),
+            ctx,
+            EXTRA_EXPR(e, e));
 }
 
 static expr_ty
@@ -1602,32 +1608,32 @@ _PyPegen_key_value_pair(Parser *p, expr_ty key, expr_ty value)
 }
 
 /* Extracts all keys from an asdl_seq* of KeyValuePair*'s */
-asdl_seq *
+asdl_expr_seq *
 _PyPegen_get_keys(Parser *p, asdl_seq *seq)
 {
     Py_ssize_t len = asdl_seq_LEN(seq);
-    asdl_seq *new_seq = _Py_asdl_seq_new(len, p->arena);
+    asdl_expr_seq *new_seq = _Py_asdl_expr_seq_new(len, p->arena);
     if (!new_seq) {
         return NULL;
     }
     for (Py_ssize_t i = 0; i < len; i++) {
-        KeyValuePair *pair = asdl_seq_GET(seq, i);
+        KeyValuePair *pair = asdl_seq_GET_UNTYPED(seq, i);
         asdl_seq_SET(new_seq, i, pair->key);
     }
     return new_seq;
 }
 
 /* Extracts all values from an asdl_seq* of KeyValuePair*'s */
-asdl_seq *
+asdl_expr_seq *
 _PyPegen_get_values(Parser *p, asdl_seq *seq)
 {
     Py_ssize_t len = asdl_seq_LEN(seq);
-    asdl_seq *new_seq = _Py_asdl_seq_new(len, p->arena);
+    asdl_expr_seq *new_seq = _Py_asdl_expr_seq_new(len, p->arena);
     if (!new_seq) {
         return NULL;
     }
     for (Py_ssize_t i = 0; i < len; i++) {
-        KeyValuePair *pair = asdl_seq_GET(seq, i);
+        KeyValuePair *pair = asdl_seq_GET_UNTYPED(seq, i);
         asdl_seq_SET(new_seq, i, pair->value);
     }
     return new_seq;
@@ -1648,7 +1654,7 @@ _PyPegen_name_default_pair(Parser *p, arg_ty arg, expr_ty value, Token *tc)
 
 /* Constructs a SlashWithDefault */
 SlashWithDefault *
-_PyPegen_slash_with_default(Parser *p, asdl_seq *plain_names, asdl_seq *names_with_defaults)
+_PyPegen_slash_with_default(Parser *p, asdl_arg_seq *plain_names, asdl_seq *names_with_defaults)
 {
     SlashWithDefault *a = PyArena_Malloc(p->arena, sizeof(SlashWithDefault));
     if (!a) {
@@ -1678,47 +1684,47 @@ _PyPegen_join_sequences(Parser *p, asdl_seq *a, asdl_seq *b)
 {
     Py_ssize_t first_len = asdl_seq_LEN(a);
     Py_ssize_t second_len = asdl_seq_LEN(b);
-    asdl_seq *new_seq = _Py_asdl_seq_new(first_len + second_len, p->arena);
+    asdl_seq *new_seq = (asdl_seq*)_Py_asdl_generic_seq_new(first_len + second_len, p->arena);
     if (!new_seq) {
         return NULL;
     }
 
     int k = 0;
     for (Py_ssize_t i = 0; i < first_len; i++) {
-        asdl_seq_SET(new_seq, k++, asdl_seq_GET(a, i));
+        asdl_seq_SET_UNTYPED(new_seq, k++, asdl_seq_GET_UNTYPED(a, i));
     }
     for (Py_ssize_t i = 0; i < second_len; i++) {
-        asdl_seq_SET(new_seq, k++, asdl_seq_GET(b, i));
+        asdl_seq_SET_UNTYPED(new_seq, k++, asdl_seq_GET_UNTYPED(b, i));
     }
 
     return new_seq;
 }
 
-static asdl_seq *
+static asdl_arg_seq*
 _get_names(Parser *p, asdl_seq *names_with_defaults)
 {
     Py_ssize_t len = asdl_seq_LEN(names_with_defaults);
-    asdl_seq *seq = _Py_asdl_seq_new(len, p->arena);
+    asdl_arg_seq *seq = _Py_asdl_arg_seq_new(len, p->arena);
     if (!seq) {
         return NULL;
     }
     for (Py_ssize_t i = 0; i < len; i++) {
-        NameDefaultPair *pair = asdl_seq_GET(names_with_defaults, i);
+        NameDefaultPair *pair = asdl_seq_GET_UNTYPED(names_with_defaults, i);
         asdl_seq_SET(seq, i, pair->arg);
     }
     return seq;
 }
 
-static asdl_seq *
+static asdl_expr_seq *
 _get_defaults(Parser *p, asdl_seq *names_with_defaults)
 {
     Py_ssize_t len = asdl_seq_LEN(names_with_defaults);
-    asdl_seq *seq = _Py_asdl_seq_new(len, p->arena);
+    asdl_expr_seq *seq = _Py_asdl_expr_seq_new(len, p->arena);
     if (!seq) {
         return NULL;
     }
     for (Py_ssize_t i = 0; i < len; i++) {
-        NameDefaultPair *pair = asdl_seq_GET(names_with_defaults, i);
+        NameDefaultPair *pair = asdl_seq_GET_UNTYPED(names_with_defaults, i);
         asdl_seq_SET(seq, i, pair->value);
     }
     return seq;
@@ -1726,39 +1732,45 @@ _get_defaults(Parser *p, asdl_seq *names_with_defaults)
 
 /* Constructs an arguments_ty object out of all the parsed constructs in the parameters rule */
 arguments_ty
-_PyPegen_make_arguments(Parser *p, asdl_seq *slash_without_default,
-                        SlashWithDefault *slash_with_default, asdl_seq *plain_names,
+_PyPegen_make_arguments(Parser *p, asdl_arg_seq *slash_without_default,
+                        SlashWithDefault *slash_with_default, asdl_arg_seq *plain_names,
                         asdl_seq *names_with_default, StarEtc *star_etc)
 {
-    asdl_seq *posonlyargs;
+    asdl_arg_seq *posonlyargs;
     if (slash_without_default != NULL) {
         posonlyargs = slash_without_default;
     }
     else if (slash_with_default != NULL) {
-        asdl_seq *slash_with_default_names =
+        asdl_arg_seq *slash_with_default_names =
             _get_names(p, slash_with_default->names_with_defaults);
         if (!slash_with_default_names) {
             return NULL;
         }
-        posonlyargs = _PyPegen_join_sequences(p, slash_with_default->plain_names, slash_with_default_names);
+        posonlyargs = (asdl_arg_seq*)_PyPegen_join_sequences(
+                p,
+                (asdl_seq*)slash_with_default->plain_names,
+                (asdl_seq*)slash_with_default_names);
         if (!posonlyargs) {
             return NULL;
         }
     }
     else {
-        posonlyargs = _Py_asdl_seq_new(0, p->arena);
+        posonlyargs = _Py_asdl_arg_seq_new(0, p->arena);
         if (!posonlyargs) {
             return NULL;
         }
     }
 
-    asdl_seq *posargs;
+    asdl_arg_seq *posargs;
     if (plain_names != NULL && names_with_default != NULL) {
-        asdl_seq *names_with_default_names = _get_names(p, names_with_default);
+        asdl_arg_seq *names_with_default_names = _get_names(p, names_with_default);
         if (!names_with_default_names) {
             return NULL;
         }
-        posargs = _PyPegen_join_sequences(p, plain_names, names_with_default_names);
+        posargs = (asdl_arg_seq*)_PyPegen_join_sequences(
+                p,
+                (asdl_seq*)plain_names,
+                (asdl_seq*)names_with_default_names);
         if (!posargs) {
             return NULL;
         }
@@ -1773,24 +1785,27 @@ _PyPegen_make_arguments(Parser *p, asdl_seq *slash_without_default,
         posargs = plain_names;
     }
     else {
-        posargs = _Py_asdl_seq_new(0, p->arena);
+        posargs = _Py_asdl_arg_seq_new(0, p->arena);
         if (!posargs) {
             return NULL;
         }
     }
 
-    asdl_seq *posdefaults;
+    asdl_expr_seq *posdefaults;
     if (slash_with_default != NULL && names_with_default != NULL) {
-        asdl_seq *slash_with_default_values =
+        asdl_expr_seq *slash_with_default_values =
             _get_defaults(p, slash_with_default->names_with_defaults);
         if (!slash_with_default_values) {
             return NULL;
         }
-        asdl_seq *names_with_default_values = _get_defaults(p, names_with_default);
+        asdl_expr_seq *names_with_default_values = _get_defaults(p, names_with_default);
         if (!names_with_default_values) {
             return NULL;
         }
-        posdefaults = _PyPegen_join_sequences(p, slash_with_default_values, names_with_default_values);
+        posdefaults = (asdl_expr_seq*)_PyPegen_join_sequences(
+                p,
+                (asdl_seq*)slash_with_default_values,
+                (asdl_seq*)names_with_default_values);
         if (!posdefaults) {
             return NULL;
         }
@@ -1808,7 +1823,7 @@ _PyPegen_make_arguments(Parser *p, asdl_seq *slash_without_default,
         }
     }
     else {
-        posdefaults = _Py_asdl_seq_new(0, p->arena);
+        posdefaults = _Py_asdl_expr_seq_new(0, p->arena);
         if (!posdefaults) {
             return NULL;
         }
@@ -1819,7 +1834,7 @@ _PyPegen_make_arguments(Parser *p, asdl_seq *slash_without_default,
         vararg = star_etc->vararg;
     }
 
-    asdl_seq *kwonlyargs;
+    asdl_arg_seq *kwonlyargs;
     if (star_etc != NULL && star_etc->kwonlyargs != NULL) {
         kwonlyargs = _get_names(p, star_etc->kwonlyargs);
         if (!kwonlyargs) {
@@ -1827,13 +1842,13 @@ _PyPegen_make_arguments(Parser *p, asdl_seq *slash_without_default,
         }
     }
     else {
-        kwonlyargs = _Py_asdl_seq_new(0, p->arena);
+        kwonlyargs = _Py_asdl_arg_seq_new(0, p->arena);
         if (!kwonlyargs) {
             return NULL;
         }
     }
 
-    asdl_seq *kwdefaults;
+    asdl_expr_seq *kwdefaults;
     if (star_etc != NULL && star_etc->kwonlyargs != NULL) {
         kwdefaults = _get_defaults(p, star_etc->kwonlyargs);
         if (!kwdefaults) {
@@ -1841,7 +1856,7 @@ _PyPegen_make_arguments(Parser *p, asdl_seq *slash_without_default,
         }
     }
     else {
-        kwdefaults = _Py_asdl_seq_new(0, p->arena);
+        kwdefaults = _Py_asdl_expr_seq_new(0, p->arena);
         if (!kwdefaults) {
             return NULL;
         }
@@ -1861,23 +1876,23 @@ _PyPegen_make_arguments(Parser *p, asdl_seq *slash_without_default,
 arguments_ty
 _PyPegen_empty_arguments(Parser *p)
 {
-    asdl_seq *posonlyargs = _Py_asdl_seq_new(0, p->arena);
+    asdl_arg_seq *posonlyargs = _Py_asdl_arg_seq_new(0, p->arena);
     if (!posonlyargs) {
         return NULL;
     }
-    asdl_seq *posargs = _Py_asdl_seq_new(0, p->arena);
+    asdl_arg_seq *posargs = _Py_asdl_arg_seq_new(0, p->arena);
     if (!posargs) {
         return NULL;
     }
-    asdl_seq *posdefaults = _Py_asdl_seq_new(0, p->arena);
+    asdl_expr_seq *posdefaults = _Py_asdl_expr_seq_new(0, p->arena);
     if (!posdefaults) {
         return NULL;
     }
-    asdl_seq *kwonlyargs = _Py_asdl_seq_new(0, p->arena);
+    asdl_arg_seq *kwonlyargs = _Py_asdl_arg_seq_new(0, p->arena);
     if (!kwonlyargs) {
         return NULL;
     }
-    asdl_seq *kwdefaults = _Py_asdl_seq_new(0, p->arena);
+    asdl_expr_seq *kwdefaults = _Py_asdl_expr_seq_new(0, p->arena);
     if (!kwdefaults) {
         return NULL;
     }
@@ -1900,7 +1915,7 @@ _PyPegen_augoperator(Parser *p, operator_ty kind)
 
 /* Construct a FunctionDef equivalent to function_def, but with decorators */
 stmt_ty
-_PyPegen_function_def_decorators(Parser *p, asdl_seq *decorators, stmt_ty function_def)
+_PyPegen_function_def_decorators(Parser *p, asdl_expr_seq *decorators, stmt_ty function_def)
 {
     assert(function_def != NULL);
     if (function_def->kind == AsyncFunctionDef_kind) {
@@ -1922,7 +1937,7 @@ _PyPegen_function_def_decorators(Parser *p, asdl_seq *decorators, stmt_ty functi
 
 /* Construct a ClassDef equivalent to class_def, but with decorators */
 stmt_ty
-_PyPegen_class_def_decorators(Parser *p, asdl_seq *decorators, stmt_ty class_def)
+_PyPegen_class_def_decorators(Parser *p, asdl_expr_seq *decorators, stmt_ty class_def)
 {
     assert(class_def != NULL);
     return _Py_ClassDef(class_def->v.ClassDef.name, class_def->v.ClassDef.bases,
@@ -1950,7 +1965,7 @@ _seq_number_of_starred_exprs(asdl_seq *seq)
 {
     int n = 0;
     for (Py_ssize_t i = 0, l = asdl_seq_LEN(seq); i < l; i++) {
-        KeywordOrStarred *k = asdl_seq_GET(seq, i);
+        KeywordOrStarred *k = asdl_seq_GET_UNTYPED(seq, i);
         if (!k->is_keyword) {
             n++;
         }
@@ -1959,21 +1974,21 @@ _seq_number_of_starred_exprs(asdl_seq *seq)
 }
 
 /* Extract the starred expressions of an asdl_seq* of KeywordOrStarred*s */
-asdl_seq *
+asdl_expr_seq *
 _PyPegen_seq_extract_starred_exprs(Parser *p, asdl_seq *kwargs)
 {
     int new_len = _seq_number_of_starred_exprs(kwargs);
     if (new_len == 0) {
         return NULL;
     }
-    asdl_seq *new_seq = _Py_asdl_seq_new(new_len, p->arena);
+    asdl_expr_seq *new_seq = _Py_asdl_expr_seq_new(new_len, p->arena);
     if (!new_seq) {
         return NULL;
     }
 
     int idx = 0;
     for (Py_ssize_t i = 0, len = asdl_seq_LEN(kwargs); i < len; i++) {
-        KeywordOrStarred *k = asdl_seq_GET(kwargs, i);
+        KeywordOrStarred *k = asdl_seq_GET_UNTYPED(kwargs, i);
         if (!k->is_keyword) {
             asdl_seq_SET(new_seq, idx++, k->element);
         }
@@ -1982,7 +1997,7 @@ _PyPegen_seq_extract_starred_exprs(Parser *p, asdl_seq *kwargs)
 }
 
 /* Return a new asdl_seq* with only the keywords in kwargs */
-asdl_seq *
+asdl_keyword_seq*
 _PyPegen_seq_delete_starred_exprs(Parser *p, asdl_seq *kwargs)
 {
     Py_ssize_t len = asdl_seq_LEN(kwargs);
@@ -1990,14 +2005,14 @@ _PyPegen_seq_delete_starred_exprs(Parser *p, asdl_seq *kwargs)
     if (new_len == 0) {
         return NULL;
     }
-    asdl_seq *new_seq = _Py_asdl_seq_new(new_len, p->arena);
+    asdl_keyword_seq *new_seq = _Py_asdl_keyword_seq_new(new_len, p->arena);
     if (!new_seq) {
         return NULL;
     }
 
     int idx = 0;
     for (Py_ssize_t i = 0; i < len; i++) {
-        KeywordOrStarred *k = asdl_seq_GET(kwargs, i);
+        KeywordOrStarred *k = asdl_seq_GET_UNTYPED(kwargs, i);
         if (k->is_keyword) {
             asdl_seq_SET(new_seq, idx++, k->element);
         }
@@ -2011,8 +2026,8 @@ _PyPegen_concatenate_strings(Parser *p, asdl_seq *strings)
     Py_ssize_t len = asdl_seq_LEN(strings);
     assert(len > 0);
 
-    Token *first = asdl_seq_GET(strings, 0);
-    Token *last = asdl_seq_GET(strings, len - 1);
+    Token *first = asdl_seq_GET_UNTYPED(strings, 0);
+    Token *last = asdl_seq_GET_UNTYPED(strings, len - 1);
 
     int bytesmode = 0;
     PyObject *bytes_str = NULL;
@@ -2021,7 +2036,7 @@ _PyPegen_concatenate_strings(Parser *p, asdl_seq *strings)
     _PyPegen_FstringParser_Init(&state);
 
     for (Py_ssize_t i = 0; i < len; i++) {
-        Token *t = asdl_seq_GET(strings, i);
+        Token *t = asdl_seq_GET_UNTYPED(strings, i);
 
         int this_bytesmode;
         int this_rawmode;
@@ -2095,12 +2110,12 @@ _PyPegen_concatenate_strings(Parser *p, asdl_seq *strings)
 }
 
 mod_ty
-_PyPegen_make_module(Parser *p, asdl_seq *a) {
-    asdl_seq *type_ignores = NULL;
+_PyPegen_make_module(Parser *p, asdl_stmt_seq *a) {
+    asdl_type_ignore_seq *type_ignores = NULL;
     Py_ssize_t num = p->type_ignore_comments.num_items;
     if (num > 0) {
         // Turn the raw (comment, lineno) pairs into TypeIgnore objects in the arena
-        type_ignores = _Py_asdl_seq_new(num, p->arena);
+        type_ignores = _Py_asdl_type_ignore_seq_new(num, p->arena);
         if (type_ignores == NULL) {
             return NULL;
         }
@@ -2219,7 +2234,7 @@ _PyPegen_nonparen_genexp_in_call(Parser *p, expr_ty args)
 }
 
 
-expr_ty _PyPegen_collect_call_seqs(Parser *p, asdl_seq *a, asdl_seq *b,
+expr_ty _PyPegen_collect_call_seqs(Parser *p, asdl_expr_seq *a, asdl_seq *b,
                      int lineno, int col_offset, int end_lineno,
                      int end_col_offset, PyArena *arena) {
     Py_ssize_t args_len = asdl_seq_LEN(a);
@@ -2231,14 +2246,14 @@ expr_ty _PyPegen_collect_call_seqs(Parser *p, asdl_seq *a, asdl_seq *b,
 
     }
 
-    asdl_seq *starreds = _PyPegen_seq_extract_starred_exprs(p, b);
-    asdl_seq *keywords = _PyPegen_seq_delete_starred_exprs(p, b);
+    asdl_expr_seq *starreds = _PyPegen_seq_extract_starred_exprs(p, b);
+    asdl_keyword_seq *keywords = _PyPegen_seq_delete_starred_exprs(p, b);
 
     if (starreds) {
         total_len += asdl_seq_LEN(starreds);
     }
 
-    asdl_seq *args = _Py_asdl_seq_new(total_len, arena);
+    asdl_expr_seq *args = _Py_asdl_expr_seq_new(total_len, arena);
 
     Py_ssize_t i = 0;
     for (i = 0; i < args_len; i++) {
@@ -2250,6 +2265,4 @@ expr_ty _PyPegen_collect_call_seqs(Parser *p, asdl_seq *a, asdl_seq *b,
 
     return _Py_Call(_PyPegen_dummy_name(p), args, keywords, lineno,
                     col_offset, end_lineno, end_col_offset, arena);
-
-
 }
diff --git a/Parser/pegen.h b/Parser/pegen.h
index c81681efad208..000dc8c462b85 100644
--- a/Parser/pegen.h
+++ b/Parser/pegen.h
@@ -91,7 +91,7 @@ typedef struct {
 } NameDefaultPair;
 
 typedef struct {
-    asdl_seq *plain_names;
+    asdl_arg_seq *plain_names;
     asdl_seq *names_with_defaults; // asdl_seq* of NameDefaultsPair's
 } SlashWithDefault;
 
@@ -229,7 +229,7 @@ mod_ty _PyPegen_run_parser_from_file_pointer(FILE *, int, PyObject *, const char
 void *_PyPegen_run_parser(Parser *);
 mod_ty _PyPegen_run_parser_from_file(const char *, int, PyObject *, PyCompilerFlags *, PyArena *);
 mod_ty _PyPegen_run_parser_from_string(const char *, int, PyObject *, PyCompilerFlags *, PyArena *);
-void *_PyPegen_interactive_exit(Parser *);
+asdl_stmt_seq *_PyPegen_interactive_exit(Parser *);
 asdl_seq *_PyPegen_singleton_seq(Parser *, void *);
 asdl_seq *_PyPegen_seq_insert_in_front(Parser *, void *, asdl_seq *);
 asdl_seq *_PyPegen_seq_append_to_end(Parser *, asdl_seq *, void *);
@@ -237,33 +237,33 @@ asdl_seq *_PyPegen_seq_flatten(Parser *, asdl_seq *);
 expr_ty _PyPegen_join_names_with_dot(Parser *, expr_ty, expr_ty);
 int _PyPegen_seq_count_dots(asdl_seq *);
 alias_ty _PyPegen_alias_for_star(Parser *);
-asdl_seq *_PyPegen_map_names_to_ids(Parser *, asdl_seq *);
+asdl_identifier_seq *_PyPegen_map_names_to_ids(Parser *, asdl_expr_seq *);
 CmpopExprPair *_PyPegen_cmpop_expr_pair(Parser *, cmpop_ty, expr_ty);
 asdl_int_seq *_PyPegen_get_cmpops(Parser *p, asdl_seq *);
-asdl_seq *_PyPegen_get_exprs(Parser *, asdl_seq *);
+asdl_expr_seq *_PyPegen_get_exprs(Parser *, asdl_seq *);
 expr_ty _PyPegen_set_expr_context(Parser *, expr_ty, expr_context_ty);
 KeyValuePair *_PyPegen_key_value_pair(Parser *, expr_ty, expr_ty);
-asdl_seq *_PyPegen_get_keys(Parser *, asdl_seq *);
-asdl_seq *_PyPegen_get_values(Parser *, asdl_seq *);
+asdl_expr_seq *_PyPegen_get_keys(Parser *, asdl_seq *);
+asdl_expr_seq *_PyPegen_get_values(Parser *, asdl_seq *);
 NameDefaultPair *_PyPegen_name_default_pair(Parser *, arg_ty, expr_ty, Token *);
-SlashWithDefault *_PyPegen_slash_with_default(Parser *, asdl_seq *, asdl_seq *);
+SlashWithDefault *_PyPegen_slash_with_default(Parser *, asdl_arg_seq *, asdl_seq *);
 StarEtc *_PyPegen_star_etc(Parser *, arg_ty, asdl_seq *, arg_ty);
-arguments_ty _PyPegen_make_arguments(Parser *, asdl_seq *, SlashWithDefault *,
-                            asdl_seq *, asdl_seq *, StarEtc *);
+arguments_ty _PyPegen_make_arguments(Parser *, asdl_arg_seq *, SlashWithDefault *,
+                                     asdl_arg_seq *, asdl_seq *, StarEtc *);
 arguments_ty _PyPegen_empty_arguments(Parser *);
 AugOperator *_PyPegen_augoperator(Parser*, operator_ty type);
-stmt_ty _PyPegen_function_def_decorators(Parser *, asdl_seq *, stmt_ty);
-stmt_ty _PyPegen_class_def_decorators(Parser *, asdl_seq *, stmt_ty);
+stmt_ty _PyPegen_function_def_decorators(Parser *, asdl_expr_seq *, stmt_ty);
+stmt_ty _PyPegen_class_def_decorators(Parser *, asdl_expr_seq *, stmt_ty);
 KeywordOrStarred *_PyPegen_keyword_or_starred(Parser *, void *, int);
-asdl_seq *_PyPegen_seq_extract_starred_exprs(Parser *, asdl_seq *);
-asdl_seq *_PyPegen_seq_delete_starred_exprs(Parser *, asdl_seq *);
-expr_ty _PyPegen_collect_call_seqs(Parser *, asdl_seq *, asdl_seq *,
+asdl_expr_seq *_PyPegen_seq_extract_starred_exprs(Parser *, asdl_seq *);
+asdl_keyword_seq *_PyPegen_seq_delete_starred_exprs(Parser *, asdl_seq *);
+expr_ty _PyPegen_collect_call_seqs(Parser *, asdl_expr_seq *, asdl_seq *,
                      int lineno, int col_offset, int end_lineno,
                      int end_col_offset, PyArena *arena);
 expr_ty _PyPegen_concatenate_strings(Parser *p, asdl_seq *);
 asdl_seq *_PyPegen_join_sequences(Parser *, asdl_seq *, asdl_seq *);
 int _PyPegen_check_barry_as_flufl(Parser *);
-mod_ty _PyPegen_make_module(Parser *, asdl_seq *);
+mod_ty _PyPegen_make_module(Parser *, asdl_stmt_seq *);
 
 // Error reporting helpers
 typedef enum {
diff --git a/Parser/string_parser.c b/Parser/string_parser.c
index 2c35da590defb..1285968b31917 100644
--- a/Parser/string_parser.c
+++ b/Parser/string_parser.c
@@ -970,15 +970,15 @@ ExprList_Dealloc(ExprList *l)
     l->size = -1;
 }
 
-static asdl_seq *
+static asdl_expr_seq *
 ExprList_Finish(ExprList *l, PyArena *arena)
 {
-    asdl_seq *seq;
+    asdl_expr_seq *seq;
 
     ExprList_check_invariants(l);
 
     /* Allocate the asdl_seq and copy the expressions in to it. */
-    seq = _Py_asdl_seq_new(l->size, arena);
+    seq = _Py_asdl_expr_seq_new(l->size, arena);
     if (seq) {
         Py_ssize_t i;
         for (i = 0; i < l->size; i++) {
@@ -1167,7 +1167,7 @@ expr_ty
 _PyPegen_FstringParser_Finish(Parser *p, FstringParser *state, Token* first_token,
                      Token *last_token)
 {
-    asdl_seq *seq;
+    asdl_expr_seq *seq;
 
     FstringParser_check_invariants(state);
 
diff --git a/Python/Python-ast.c b/Python/Python-ast.c
index 094010e6c9ddc..13657a6727566 100644
--- a/Python/Python-ast.c
+++ b/Python/Python-ast.c
@@ -549,6 +549,18 @@ static int init_identifiers(astmodulestate *state)
     return 1;
 };
 
+GENERATE_ASDL_SEQ_CONSTRUCTOR(mod, mod_ty)
+GENERATE_ASDL_SEQ_CONSTRUCTOR(stmt, stmt_ty)
+GENERATE_ASDL_SEQ_CONSTRUCTOR(expr, expr_ty)
+GENERATE_ASDL_SEQ_CONSTRUCTOR(comprehension, comprehension_ty)
+GENERATE_ASDL_SEQ_CONSTRUCTOR(excepthandler, excepthandler_ty)
+GENERATE_ASDL_SEQ_CONSTRUCTOR(arguments, arguments_ty)
+GENERATE_ASDL_SEQ_CONSTRUCTOR(arg, arg_ty)
+GENERATE_ASDL_SEQ_CONSTRUCTOR(keyword, keyword_ty)
+GENERATE_ASDL_SEQ_CONSTRUCTOR(alias, alias_ty)
+GENERATE_ASDL_SEQ_CONSTRUCTOR(withitem, withitem_ty)
+GENERATE_ASDL_SEQ_CONSTRUCTOR(type_ignore, type_ignore_ty)
+
 static PyObject* ast2obj_mod(astmodulestate *state, void*);
 static const char * const Module_fields[]={
     "body",
@@ -1097,7 +1109,7 @@ static PyObject* ast2obj_list(astmodulestate *state, asdl_seq *seq, PyObject* (*
     if (!result)
         return NULL;
     for (i = 0; i < n; i++) {
-        value = func(state, asdl_seq_GET(seq, i));
+        value = func(state, asdl_seq_GET_UNTYPED(seq, i));
         if (!value) {
             Py_DECREF(result);
             return NULL;
@@ -1912,7 +1924,8 @@ static int obj2ast_type_ignore(astmodulestate *state, PyObject* obj,
                                type_ignore_ty* out, PyArena* arena);
 
 mod_ty
-Module(asdl_seq * body, asdl_seq * type_ignores, PyArena *arena)
+Module(asdl_stmt_seq * body, asdl_type_ignore_seq * type_ignores, PyArena
+       *arena)
 {
     mod_ty p;
     p = (mod_ty)PyArena_Malloc(arena, sizeof(*p));
@@ -1925,7 +1938,7 @@ Module(asdl_seq * body, asdl_seq * type_ignores, PyArena *arena)
 }
 
 mod_ty
-Interactive(asdl_seq * body, PyArena *arena)
+Interactive(asdl_stmt_seq * body, PyArena *arena)
 {
     mod_ty p;
     p = (mod_ty)PyArena_Malloc(arena, sizeof(*p));
@@ -1954,7 +1967,7 @@ Expression(expr_ty body, PyArena *arena)
 }
 
 mod_ty
-FunctionType(asdl_seq * argtypes, expr_ty returns, PyArena *arena)
+FunctionType(asdl_expr_seq * argtypes, expr_ty returns, PyArena *arena)
 {
     mod_ty p;
     if (!returns) {
@@ -1972,9 +1985,10 @@ FunctionType(asdl_seq * argtypes, expr_ty returns, PyArena *arena)
 }
 
 stmt_ty
-FunctionDef(identifier name, arguments_ty args, asdl_seq * body, asdl_seq *
-            decorator_list, expr_ty returns, string type_comment, int lineno,
-            int col_offset, int end_lineno, int end_col_offset, PyArena *arena)
+FunctionDef(identifier name, arguments_ty args, asdl_stmt_seq * body,
+            asdl_expr_seq * decorator_list, expr_ty returns, string
+            type_comment, int lineno, int col_offset, int end_lineno, int
+            end_col_offset, PyArena *arena)
 {
     stmt_ty p;
     if (!name) {
@@ -2005,10 +2019,10 @@ FunctionDef(identifier name, arguments_ty args, asdl_seq * body, asdl_seq *
 }
 
 stmt_ty
-AsyncFunctionDef(identifier name, arguments_ty args, asdl_seq * body, asdl_seq
-                 * decorator_list, expr_ty returns, string type_comment, int
-                 lineno, int col_offset, int end_lineno, int end_col_offset,
-                 PyArena *arena)
+AsyncFunctionDef(identifier name, arguments_ty args, asdl_stmt_seq * body,
+                 asdl_expr_seq * decorator_list, expr_ty returns, string
+                 type_comment, int lineno, int col_offset, int end_lineno, int
+                 end_col_offset, PyArena *arena)
 {
     stmt_ty p;
     if (!name) {
@@ -2039,9 +2053,9 @@ AsyncFunctionDef(identifier name, arguments_ty args, asdl_seq * body, asdl_seq
 }
 
 stmt_ty
-ClassDef(identifier name, asdl_seq * bases, asdl_seq * keywords, asdl_seq *
-         body, asdl_seq * decorator_list, int lineno, int col_offset, int
-         end_lineno, int end_col_offset, PyArena *arena)
+ClassDef(identifier name, asdl_expr_seq * bases, asdl_keyword_seq * keywords,
+         asdl_stmt_seq * body, asdl_expr_seq * decorator_list, int lineno, int
+         col_offset, int end_lineno, int end_col_offset, PyArena *arena)
 {
     stmt_ty p;
     if (!name) {
@@ -2083,7 +2097,7 @@ Return(expr_ty value, int lineno, int col_offset, int end_lineno, int
 }
 
 stmt_ty
-Delete(asdl_seq * targets, int lineno, int col_offset, int end_lineno, int
+Delete(asdl_expr_seq * targets, int lineno, int col_offset, int end_lineno, int
        end_col_offset, PyArena *arena)
 {
     stmt_ty p;
@@ -2100,8 +2114,8 @@ Delete(asdl_seq * targets, int lineno, int col_offset, int end_lineno, int
 }
 
 stmt_ty
-Assign(asdl_seq * targets, expr_ty value, string type_comment, int lineno, int
-       col_offset, int end_lineno, int end_col_offset, PyArena *arena)
+Assign(asdl_expr_seq * targets, expr_ty value, string type_comment, int lineno,
+       int col_offset, int end_lineno, int end_col_offset, PyArena *arena)
 {
     stmt_ty p;
     if (!value) {
@@ -2189,8 +2203,8 @@ AnnAssign(expr_ty target, expr_ty annotation, expr_ty value, int simple, int
 }
 
 stmt_ty
-For(expr_ty target, expr_ty iter, asdl_seq * body, asdl_seq * orelse, string
-    type_comment, int lineno, int col_offset, int end_lineno, int
+For(expr_ty target, expr_ty iter, asdl_stmt_seq * body, asdl_stmt_seq * orelse,
+    string type_comment, int lineno, int col_offset, int end_lineno, int
     end_col_offset, PyArena *arena)
 {
     stmt_ty p;
@@ -2221,9 +2235,9 @@ For(expr_ty target, expr_ty iter, asdl_seq * body, asdl_seq * orelse, string
 }
 
 stmt_ty
-AsyncFor(expr_ty target, expr_ty iter, asdl_seq * body, asdl_seq * orelse,
-         string type_comment, int lineno, int col_offset, int end_lineno, int
-         end_col_offset, PyArena *arena)
+AsyncFor(expr_ty target, expr_ty iter, asdl_stmt_seq * body, asdl_stmt_seq *
+         orelse, string type_comment, int lineno, int col_offset, int
+         end_lineno, int end_col_offset, PyArena *arena)
 {
     stmt_ty p;
     if (!target) {
@@ -2253,8 +2267,8 @@ AsyncFor(expr_ty target, expr_ty iter, asdl_seq * body, asdl_seq * orelse,
 }
 
 stmt_ty
-While(expr_ty test, asdl_seq * body, asdl_seq * orelse, int lineno, int
-      col_offset, int end_lineno, int end_col_offset, PyArena *arena)
+While(expr_ty test, asdl_stmt_seq * body, asdl_stmt_seq * orelse, int lineno,
+      int col_offset, int end_lineno, int end_col_offset, PyArena *arena)
 {
     stmt_ty p;
     if (!test) {
@@ -2277,7 +2291,7 @@ While(expr_ty test, asdl_seq * body, asdl_seq * orelse, int lineno, int
 }
 
 stmt_ty
-If(expr_ty test, asdl_seq * body, asdl_seq * orelse, int lineno, int
+If(expr_ty test, asdl_stmt_seq * body, asdl_stmt_seq * orelse, int lineno, int
    col_offset, int end_lineno, int end_col_offset, PyArena *arena)
 {
     stmt_ty p;
@@ -2301,8 +2315,8 @@ If(expr_ty test, asdl_seq * body, asdl_seq * orelse, int lineno, int
 }
 
 stmt_ty
-With(asdl_seq * items, asdl_seq * body, string type_comment, int lineno, int
-     col_offset, int end_lineno, int end_col_offset, PyArena *arena)
+With(asdl_withitem_seq * items, asdl_stmt_seq * body, string type_comment, int
+     lineno, int col_offset, int end_lineno, int end_col_offset, PyArena *arena)
 {
     stmt_ty p;
     p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p));
@@ -2320,8 +2334,9 @@ With(asdl_seq * items, asdl_seq * body, string type_comment, int lineno, int
 }
 
 stmt_ty
-AsyncWith(asdl_seq * items, asdl_seq * body, string type_comment, int lineno,
-          int col_offset, int end_lineno, int end_col_offset, PyArena *arena)
+AsyncWith(asdl_withitem_seq * items, asdl_stmt_seq * body, string type_comment,
+          int lineno, int col_offset, int end_lineno, int end_col_offset,
+          PyArena *arena)
 {
     stmt_ty p;
     p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p));
@@ -2357,9 +2372,9 @@ Raise(expr_ty exc, expr_ty cause, int lineno, int col_offset, int end_lineno,
 }
 
 stmt_ty
-Try(asdl_seq * body, asdl_seq * handlers, asdl_seq * orelse, asdl_seq *
-    finalbody, int lineno, int col_offset, int end_lineno, int end_col_offset,
-    PyArena *arena)
+Try(asdl_stmt_seq * body, asdl_excepthandler_seq * handlers, asdl_stmt_seq *
+    orelse, asdl_stmt_seq * finalbody, int lineno, int col_offset, int
+    end_lineno, int end_col_offset, PyArena *arena)
 {
     stmt_ty p;
     p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p));
@@ -2401,7 +2416,7 @@ Assert(expr_ty test, expr_ty msg, int lineno, int col_offset, int end_lineno,
 }
 
 stmt_ty
-Import(asdl_seq * names, int lineno, int col_offset, int end_lineno, int
+Import(asdl_alias_seq * names, int lineno, int col_offset, int end_lineno, int
        end_col_offset, PyArena *arena)
 {
     stmt_ty p;
@@ -2418,8 +2433,8 @@ Import(asdl_seq * names, int lineno, int col_offset, int end_lineno, int
 }
 
 stmt_ty
-ImportFrom(identifier module, asdl_seq * names, int level, int lineno, int
-           col_offset, int end_lineno, int end_col_offset, PyArena *arena)
+ImportFrom(identifier module, asdl_alias_seq * names, int level, int lineno,
+           int col_offset, int end_lineno, int end_col_offset, PyArena *arena)
 {
     stmt_ty p;
     p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p));
@@ -2437,8 +2452,8 @@ ImportFrom(identifier module, asdl_seq * names, int level, int lineno, int
 }
 
 stmt_ty
-Global(asdl_seq * names, int lineno, int col_offset, int end_lineno, int
-       end_col_offset, PyArena *arena)
+Global(asdl_identifier_seq * names, int lineno, int col_offset, int end_lineno,
+       int end_col_offset, PyArena *arena)
 {
     stmt_ty p;
     p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p));
@@ -2454,8 +2469,8 @@ Global(asdl_seq * names, int lineno, int col_offset, int end_lineno, int
 }
 
 stmt_ty
-Nonlocal(asdl_seq * names, int lineno, int col_offset, int end_lineno, int
-         end_col_offset, PyArena *arena)
+Nonlocal(asdl_identifier_seq * names, int lineno, int col_offset, int
+         end_lineno, int end_col_offset, PyArena *arena)
 {
     stmt_ty p;
     p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p));
@@ -2541,7 +2556,7 @@ Continue(int lineno, int col_offset, int end_lineno, int end_col_offset,
 }
 
 expr_ty
-BoolOp(boolop_ty op, asdl_seq * values, int lineno, int col_offset, int
+BoolOp(boolop_ty op, asdl_expr_seq * values, int lineno, int col_offset, int
        end_lineno, int end_col_offset, PyArena *arena)
 {
     expr_ty p;
@@ -2716,8 +2731,8 @@ IfExp(expr_ty test, expr_ty body, expr_ty orelse, int lineno, int col_offset,
 }
 
 expr_ty
-Dict(asdl_seq * keys, asdl_seq * values, int lineno, int col_offset, int
-     end_lineno, int end_col_offset, PyArena *arena)
+Dict(asdl_expr_seq * keys, asdl_expr_seq * values, int lineno, int col_offset,
+     int end_lineno, int end_col_offset, PyArena *arena)
 {
     expr_ty p;
     p = (expr_ty)PyArena_Malloc(arena, sizeof(*p));
@@ -2734,7 +2749,7 @@ Dict(asdl_seq * keys, asdl_seq * values, int lineno, int col_offset, int
 }
 
 expr_ty
-Set(asdl_seq * elts, int lineno, int col_offset, int end_lineno, int
+Set(asdl_expr_seq * elts, int lineno, int col_offset, int end_lineno, int
     end_col_offset, PyArena *arena)
 {
     expr_ty p;
@@ -2751,8 +2766,8 @@ Set(asdl_seq * elts, int lineno, int col_offset, int end_lineno, int
 }
 
 expr_ty
-ListComp(expr_ty elt, asdl_seq * generators, int lineno, int col_offset, int
-         end_lineno, int end_col_offset, PyArena *arena)
+ListComp(expr_ty elt, asdl_comprehension_seq * generators, int lineno, int
+         col_offset, int end_lineno, int end_col_offset, PyArena *arena)
 {
     expr_ty p;
     if (!elt) {
@@ -2774,8 +2789,8 @@ ListComp(expr_ty elt, asdl_seq * generators, int lineno, int col_offset, int
 }
 
 expr_ty
-SetComp(expr_ty elt, asdl_seq * generators, int lineno, int col_offset, int
-        end_lineno, int end_col_offset, PyArena *arena)
+SetComp(expr_ty elt, asdl_comprehension_seq * generators, int lineno, int
+        col_offset, int end_lineno, int end_col_offset, PyArena *arena)
 {
     expr_ty p;
     if (!elt) {
@@ -2797,8 +2812,9 @@ SetComp(expr_ty elt, asdl_seq * generators, int lineno, int col_offset, int
 }
 
 expr_ty
-DictComp(expr_ty key, expr_ty value, asdl_seq * generators, int lineno, int
-         col_offset, int end_lineno, int end_col_offset, PyArena *arena)
+DictComp(expr_ty key, expr_ty value, asdl_comprehension_seq * generators, int
+         lineno, int col_offset, int end_lineno, int end_col_offset, PyArena
+         *arena)
 {
     expr_ty p;
     if (!key) {
@@ -2826,8 +2842,8 @@ DictComp(expr_ty key, expr_ty value, asdl_seq * generators, int lineno, int
 }
 
 expr_ty
-GeneratorExp(expr_ty elt, asdl_seq * generators, int lineno, int col_offset,
-             int end_lineno, int end_col_offset, PyArena *arena)
+GeneratorExp(expr_ty elt, asdl_comprehension_seq * generators, int lineno, int
+             col_offset, int end_lineno, int end_col_offset, PyArena *arena)
 {
     expr_ty p;
     if (!elt) {
@@ -2910,8 +2926,9 @@ YieldFrom(expr_ty value, int lineno, int col_offset, int end_lineno, int
 }
 
 expr_ty
-Compare(expr_ty left, asdl_int_seq * ops, asdl_seq * comparators, int lineno,
-        int col_offset, int end_lineno, int end_col_offset, PyArena *arena)
+Compare(expr_ty left, asdl_int_seq * ops, asdl_expr_seq * comparators, int
+        lineno, int col_offset, int end_lineno, int end_col_offset, PyArena
+        *arena)
 {
     expr_ty p;
     if (!left) {
@@ -2934,8 +2951,8 @@ Compare(expr_ty left, asdl_int_seq * ops, asdl_seq * comparators, int lineno,
 }
 
 expr_ty
-Call(expr_ty func, asdl_seq * args, asdl_seq * keywords, int lineno, int
-     col_offset, int end_lineno, int end_col_offset, PyArena *arena)
+Call(expr_ty func, asdl_expr_seq * args, asdl_keyword_seq * keywords, int
+     lineno, int col_offset, int end_lineno, int end_col_offset, PyArena *arena)
 {
     expr_ty p;
     if (!func) {
@@ -2983,8 +3000,8 @@ FormattedValue(expr_ty value, int conversion, expr_ty format_spec, int lineno,
 }
 
 expr_ty
-JoinedStr(asdl_seq * values, int lineno, int col_offset, int end_lineno, int
-          end_col_offset, PyArena *arena)
+JoinedStr(asdl_expr_seq * values, int lineno, int col_offset, int end_lineno,
+          int end_col_offset, PyArena *arena)
 {
     expr_ty p;
     p = (expr_ty)PyArena_Malloc(arena, sizeof(*p));
@@ -3147,7 +3164,7 @@ Name(identifier id, expr_context_ty ctx, int lineno, int col_offset, int
 }
 
 expr_ty
-List(asdl_seq * elts, expr_context_ty ctx, int lineno, int col_offset, int
+List(asdl_expr_seq * elts, expr_context_ty ctx, int lineno, int col_offset, int
      end_lineno, int end_col_offset, PyArena *arena)
 {
     expr_ty p;
@@ -3170,8 +3187,8 @@ List(asdl_seq * elts, expr_context_ty ctx, int lineno, int col_offset, int
 }
 
 expr_ty
-Tuple(asdl_seq * elts, expr_context_ty ctx, int lineno, int col_offset, int
-      end_lineno, int end_col_offset, PyArena *arena)
+Tuple(asdl_expr_seq * elts, expr_context_ty ctx, int lineno, int col_offset,
+      int end_lineno, int end_col_offset, PyArena *arena)
 {
     expr_ty p;
     if (!ctx) {
@@ -3212,7 +3229,7 @@ Slice(expr_ty lower, expr_ty upper, expr_ty step, int lineno, int col_offset,
 }
 
 comprehension_ty
-comprehension(expr_ty target, expr_ty iter, asdl_seq * ifs, int is_async,
+comprehension(expr_ty target, expr_ty iter, asdl_expr_seq * ifs, int is_async,
               PyArena *arena)
 {
     comprehension_ty p;
@@ -3237,8 +3254,9 @@ comprehension(expr_ty target, expr_ty iter, asdl_seq * ifs, int is_async,
 }
 
 excepthandler_ty
-ExceptHandler(expr_ty type, identifier name, asdl_seq * body, int lineno, int
-              col_offset, int end_lineno, int end_col_offset, PyArena *arena)
+ExceptHandler(expr_ty type, identifier name, asdl_stmt_seq * body, int lineno,
+              int col_offset, int end_lineno, int end_col_offset, PyArena
+              *arena)
 {
     excepthandler_ty p;
     p = (excepthandler_ty)PyArena_Malloc(arena, sizeof(*p));
@@ -3256,9 +3274,9 @@ ExceptHandler(expr_ty type, identifier name, asdl_seq * body, int lineno, int
 }
 
 arguments_ty
-arguments(asdl_seq * posonlyargs, asdl_seq * args, arg_ty vararg, asdl_seq *
-          kwonlyargs, asdl_seq * kw_defaults, arg_ty kwarg, asdl_seq *
-          defaults, PyArena *arena)
+arguments(asdl_arg_seq * posonlyargs, asdl_arg_seq * args, arg_ty vararg,
+          asdl_arg_seq * kwonlyargs, asdl_expr_seq * kw_defaults, arg_ty kwarg,
+          asdl_expr_seq * defaults, PyArena *arena)
 {
     arguments_ty p;
     p = (arguments_ty)PyArena_Malloc(arena, sizeof(*p));
@@ -3386,12 +3404,12 @@ ast2obj_mod(astmodulestate *state, void* _o)
         tp = (PyTypeObject *)state->Module_type;
         result = PyType_GenericNew(tp, NULL, NULL);
         if (!result) goto failed;
-        value = ast2obj_list(state, o->v.Module.body, ast2obj_stmt);
+        value = ast2obj_list(state, (asdl_seq*)o->v.Module.body, ast2obj_stmt);
         if (!value) goto failed;
         if (PyObject_SetAttr(result, state->body, value) == -1)
             goto failed;
         Py_DECREF(value);
-        value = ast2obj_list(state, o->v.Module.type_ignores,
+        value = ast2obj_list(state, (asdl_seq*)o->v.Module.type_ignores,
                              ast2obj_type_ignore);
         if (!value) goto failed;
         if (PyObject_SetAttr(result, state->type_ignores, value) == -1)
@@ -3402,7 +3420,8 @@ ast2obj_mod(astmodulestate *state, void* _o)
         tp = (PyTypeObject *)state->Interactive_type;
         result = PyType_GenericNew(tp, NULL, NULL);
         if (!result) goto failed;
-        value = ast2obj_list(state, o->v.Interactive.body, ast2obj_stmt);
+        value = ast2obj_list(state, (asdl_seq*)o->v.Interactive.body,
+                             ast2obj_stmt);
         if (!value) goto failed;
         if (PyObject_SetAttr(result, state->body, value) == -1)
             goto failed;
@@ -3422,7 +3441,8 @@ ast2obj_mod(astmodulestate *state, void* _o)
         tp = (PyTypeObject *)state->FunctionType_type;
         result = PyType_GenericNew(tp, NULL, NULL);
         if (!result) goto failed;
-        value = ast2obj_list(state, o->v.FunctionType.argtypes, ast2obj_expr);
+        value = ast2obj_list(state, (asdl_seq*)o->v.FunctionType.argtypes,
+                             ast2obj_expr);
         if (!value) goto failed;
         if (PyObject_SetAttr(result, state->argtypes, value) == -1)
             goto failed;
@@ -3465,12 +3485,13 @@ ast2obj_stmt(astmodulestate *state, void* _o)
         if (PyObject_SetAttr(result, state->args, value) == -1)
             goto failed;
         Py_DECREF(value);
-        value = ast2obj_list(state, o->v.FunctionDef.body, ast2obj_stmt);
+        value = ast2obj_list(state, (asdl_seq*)o->v.FunctionDef.body,
+                             ast2obj_stmt);
         if (!value) goto failed;
         if (PyObject_SetAttr(result, state->body, value) == -1)
             goto failed;
         Py_DECREF(value);
-        value = ast2obj_list(state, o->v.FunctionDef.decorator_list,
+        value = ast2obj_list(state, (asdl_seq*)o->v.FunctionDef.decorator_list,
                              ast2obj_expr);
         if (!value) goto failed;
         if (PyObject_SetAttr(result, state->decorator_list, value) == -1)
@@ -3501,12 +3522,14 @@ ast2obj_stmt(astmodulestate *state, void* _o)
         if (PyObject_SetAttr(result, state->args, value) == -1)
             goto failed;
         Py_DECREF(value);
-        value = ast2obj_list(state, o->v.AsyncFunctionDef.body, ast2obj_stmt);
+        value = ast2obj_list(state, (asdl_seq*)o->v.AsyncFunctionDef.body,
+                             ast2obj_stmt);
         if (!value) goto failed;
         if (PyObject_SetAttr(result, state->body, value) == -1)
             goto failed;
         Py_DECREF(value);
-        value = ast2obj_list(state, o->v.AsyncFunctionDef.decorator_list,
+        value = ast2obj_list(state,
+                             (asdl_seq*)o->v.AsyncFunctionDef.decorator_list,
                              ast2obj_expr);
         if (!value) goto failed;
         if (PyObject_SetAttr(result, state->decorator_list, value) == -1)
@@ -3532,22 +3555,26 @@ ast2obj_stmt(astmodulestate *state, void* _o)
         if (PyObject_SetAttr(result, state->name, value) == -1)
             goto failed;
         Py_DECREF(value);
-        value = ast2obj_list(state, o->v.ClassDef.bases, ast2obj_expr);
+        value = ast2obj_list(state, (asdl_seq*)o->v.ClassDef.bases,
+                             ast2obj_expr);
         if (!value) goto failed;
         if (PyObject_SetAttr(result, state->bases, value) == -1)
             goto failed;
         Py_DECREF(value);
-        value = ast2obj_list(state, o->v.ClassDef.keywords, ast2obj_keyword);
+        value = ast2obj_list(state, (asdl_seq*)o->v.ClassDef.keywords,
+                             ast2obj_keyword);
         if (!value) goto failed;
         if (PyObject_SetAttr(result, state->keywords, value) == -1)
             goto failed;
         Py_DECREF(value);
-        value = ast2obj_list(state, o->v.ClassDef.body, ast2obj_stmt);
+        value = ast2obj_list(state, (asdl_seq*)o->v.ClassDef.body,
+                             ast2obj_stmt);
         if (!value) goto failed;
         if (PyObject_SetAttr(result, state->body, value) == -1)
             goto failed;
         Py_DECREF(value);
-        value = ast2obj_list(state, o->v.ClassDef.decorator_list, ast2obj_expr);
+        value = ast2obj_list(state, (asdl_seq*)o->v.ClassDef.decorator_list,
+                             ast2obj_expr);
         if (!value) goto failed;
         if (PyObject_SetAttr(result, state->decorator_list, value) == -1)
             goto failed;
@@ -3567,7 +3594,8 @@ ast2obj_stmt(astmodulestate *state, void* _o)
         tp = (PyTypeObject *)state->Delete_type;
         result = PyType_GenericNew(tp, NULL, NULL);
         if (!result) goto failed;
-        value = ast2obj_list(state, o->v.Delete.targets, ast2obj_expr);
+        value = ast2obj_list(state, (asdl_seq*)o->v.Delete.targets,
+                             ast2obj_expr);
         if (!value) goto failed;
         if (PyObject_SetAttr(result, state->targets, value) == -1)
             goto failed;
@@ -3577,7 +3605,8 @@ ast2obj_stmt(astmodulestate *state, void* _o)
         tp = (PyTypeObject *)state->Assign_type;
         result = PyType_GenericNew(tp, NULL, NULL);
         if (!result) goto failed;
-        value = ast2obj_list(state, o->v.Assign.targets, ast2obj_expr);
+        value = ast2obj_list(state, (asdl_seq*)o->v.Assign.targets,
+                             ast2obj_expr);
         if (!value) goto failed;
         if (PyObject_SetAttr(result, state->targets, value) == -1)
             goto failed;
@@ -3652,12 +3681,12 @@ ast2obj_stmt(astmodulestate *state, void* _o)
         if (PyObject_SetAttr(result, state->iter, value) == -1)
             goto failed;
         Py_DECREF(value);
-        value = ast2obj_list(state, o->v.For.body, ast2obj_stmt);
+        value = ast2obj_list(state, (asdl_seq*)o->v.For.body, ast2obj_stmt);
         if (!value) goto failed;
         if (PyObject_SetAttr(result, state->body, value) == -1)
             goto failed;
         Py_DECREF(value);
-        value = ast2obj_list(state, o->v.For.orelse, ast2obj_stmt);
+        value = ast2obj_list(state, (asdl_seq*)o->v.For.orelse, ast2obj_stmt);
         if (!value) goto failed;
         if (PyObject_SetAttr(result, state->orelse, value) == -1)
             goto failed;
@@ -3682,12 +3711,14 @@ ast2obj_stmt(astmodulestate *state, void* _o)
         if (PyObject_SetAttr(result, state->iter, value) == -1)
             goto failed;
         Py_DECREF(value);
-        value = ast2obj_list(state, o->v.AsyncFor.body, ast2obj_stmt);
+        value = ast2obj_list(state, (asdl_seq*)o->v.AsyncFor.body,
+                             ast2obj_stmt);
         if (!value) goto failed;
         if (PyObject_SetAttr(result, state->body, value) == -1)
             goto failed;
         Py_DECREF(value);
-        value = ast2obj_list(state, o->v.AsyncFor.orelse, ast2obj_stmt);
+        value = ast2obj_list(state, (asdl_seq*)o->v.AsyncFor.orelse,
+                             ast2obj_stmt);
         if (!value) goto failed;
         if (PyObject_SetAttr(result, state->orelse, value) == -1)
             goto failed;
@@ -3707,12 +3738,12 @@ ast2obj_stmt(astmodulestate *state, void* _o)
         if (PyObject_SetAttr(result, state->test, value) == -1)
             goto failed;
         Py_DECREF(value);
-        value = ast2obj_list(state, o->v.While.body, ast2obj_stmt);
+        value = ast2obj_list(state, (asdl_seq*)o->v.While.body, ast2obj_stmt);
         if (!value) goto failed;
         if (PyObject_SetAttr(result, state->body, value) == -1)
             goto failed;
         Py_DECREF(value);
-        value = ast2obj_list(state, o->v.While.orelse, ast2obj_stmt);
+        value = ast2obj_list(state, (asdl_seq*)o->v.While.orelse, ast2obj_stmt);
         if (!value) goto failed;
         if (PyObject_SetAttr(result, state->orelse, value) == -1)
             goto failed;
@@ -3727,12 +3758,12 @@ ast2obj_stmt(astmodulestate *state, void* _o)
         if (PyObject_SetAttr(result, state->test, value) == -1)
             goto failed;
         Py_DECREF(value);
-        value = ast2obj_list(state, o->v.If.body, ast2obj_stmt);
+        value = ast2obj_list(state, (asdl_seq*)o->v.If.body, ast2obj_stmt);
         if (!value) goto failed;
         if (PyObject_SetAttr(result, state->body, value) == -1)
             goto failed;
         Py_DECREF(value);
-        value = ast2obj_list(state, o->v.If.orelse, ast2obj_stmt);
+        value = ast2obj_list(state, (asdl_seq*)o->v.If.orelse, ast2obj_stmt);
         if (!value) goto failed;
         if (PyObject_SetAttr(result, state->orelse, value) == -1)
             goto failed;
@@ -3742,12 +3773,13 @@ ast2obj_stmt(astmodulestate *state, void* _o)
         tp = (PyTypeObject *)state->With_type;
         result = PyType_GenericNew(tp, NULL, NULL);
         if (!result) goto failed;
-        value = ast2obj_list(state, o->v.With.items, ast2obj_withitem);
+        value = ast2obj_list(state, (asdl_seq*)o->v.With.items,
+                             ast2obj_withitem);
         if (!value) goto failed;
         if (PyObject_SetAttr(result, state->items, value) == -1)
             goto failed;
         Py_DECREF(value);
-        value = ast2obj_list(state, o->v.With.body, ast2obj_stmt);
+        value = ast2obj_list(state, (asdl_seq*)o->v.With.body, ast2obj_stmt);
         if (!value) goto failed;
         if (PyObject_SetAttr(result, state->body, value) == -1)
             goto failed;
@@ -3762,12 +3794,14 @@ ast2obj_stmt(astmodulestate *state, void* _o)
         tp = (PyTypeObject *)state->AsyncWith_type;
         result = PyType_GenericNew(tp, NULL, NULL);
         if (!result) goto failed;
-        value = ast2obj_list(state, o->v.AsyncWith.items, ast2obj_withitem);
+        value = ast2obj_list(state, (asdl_seq*)o->v.AsyncWith.items,
+                             ast2obj_withitem);
         if (!value) goto failed;
         if (PyObject_SetAttr(result, state->items, value) == -1)
             goto failed;
         Py_DECREF(value);
-        value = ast2obj_list(state, o->v.AsyncWith.body, ast2obj_stmt);
+        value = ast2obj_list(state, (asdl_seq*)o->v.AsyncWith.body,
+                             ast2obj_stmt);
         if (!value) goto failed;
         if (PyObject_SetAttr(result, state->body, value) == -1)
             goto failed;
@@ -3797,22 +3831,24 @@ ast2obj_stmt(astmodulestate *state, void* _o)
         tp = (PyTypeObject *)state->Try_type;
         result = PyType_GenericNew(tp, NULL, NULL);
         if (!result) goto failed;
-        value = ast2obj_list(state, o->v.Try.body, ast2obj_stmt);
+        value = ast2obj_list(state, (asdl_seq*)o->v.Try.body, ast2obj_stmt);
         if (!value) goto failed;
         if (PyObject_SetAttr(result, state->body, value) == -1)
             goto failed;
         Py_DECREF(value);
-        value = ast2obj_list(state, o->v.Try.handlers, ast2obj_excepthandler);
+        value = ast2obj_list(state, (asdl_seq*)o->v.Try.handlers,
+                             ast2obj_excepthandler);
         if (!value) goto failed;
         if (PyObject_SetAttr(result, state->handlers, value) == -1)
             goto failed;
         Py_DECREF(value);
-        value = ast2obj_list(state, o->v.Try.orelse, ast2obj_stmt);
+        value = ast2obj_list(state, (asdl_seq*)o->v.Try.orelse, ast2obj_stmt);
         if (!value) goto failed;
         if (PyObject_SetAttr(result, state->orelse, value) == -1)
             goto failed;
         Py_DECREF(value);
-        value = ast2obj_list(state, o->v.Try.finalbody, ast2obj_stmt);
+        value = ast2obj_list(state, (asdl_seq*)o->v.Try.finalbody,
+                             ast2obj_stmt);
         if (!value) goto failed;
         if (PyObject_SetAttr(result, state->finalbody, value) == -1)
             goto failed;
@@ -3837,7 +3873,8 @@ ast2obj_stmt(astmodulestate *state, void* _o)
         tp = (PyTypeObject *)state->Import_type;
         result = PyType_GenericNew(tp, NULL, NULL);
         if (!result) goto failed;
-        value = ast2obj_list(state, o->v.Import.names, ast2obj_alias);
+        value = ast2obj_list(state, (asdl_seq*)o->v.Import.names,
+                             ast2obj_alias);
         if (!value) goto failed;
         if (PyObject_SetAttr(result, state->names, value) == -1)
             goto failed;
@@ -3852,7 +3889,8 @@ ast2obj_stmt(astmodulestate *state, void* _o)
         if (PyObject_SetAttr(result, state->module, value) == -1)
             goto failed;
         Py_DECREF(value);
-        value = ast2obj_list(state, o->v.ImportFrom.names, ast2obj_alias);
+        value = ast2obj_list(state, (asdl_seq*)o->v.ImportFrom.names,
+                             ast2obj_alias);
         if (!value) goto failed;
         if (PyObject_SetAttr(result, state->names, value) == -1)
             goto failed;
@@ -3867,7 +3905,8 @@ ast2obj_stmt(astmodulestate *state, void* _o)
         tp = (PyTypeObject *)state->Global_type;
         result = PyType_GenericNew(tp, NULL, NULL);
         if (!result) goto failed;
-        value = ast2obj_list(state, o->v.Global.names, ast2obj_identifier);
+        value = ast2obj_list(state, (asdl_seq*)o->v.Global.names,
+                             ast2obj_identifier);
         if (!value) goto failed;
         if (PyObject_SetAttr(result, state->names, value) == -1)
             goto failed;
@@ -3877,7 +3916,8 @@ ast2obj_stmt(astmodulestate *state, void* _o)
         tp = (PyTypeObject *)state->Nonlocal_type;
         result = PyType_GenericNew(tp, NULL, NULL);
         if (!result) goto failed;
-        value = ast2obj_list(state, o->v.Nonlocal.names, ast2obj_identifier);
+        value = ast2obj_list(state, (asdl_seq*)o->v.Nonlocal.names,
+                             ast2obj_identifier);
         if (!value) goto failed;
         if (PyObject_SetAttr(result, state->names, value) == -1)
             goto failed;
@@ -3955,7 +3995,8 @@ ast2obj_expr(astmodulestate *state, void* _o)
         if (PyObject_SetAttr(result, state->op, value) == -1)
             goto failed;
         Py_DECREF(value);
-        value = ast2obj_list(state, o->v.BoolOp.values, ast2obj_expr);
+        value = ast2obj_list(state, (asdl_seq*)o->v.BoolOp.values,
+                             ast2obj_expr);
         if (!value) goto failed;
         if (PyObject_SetAttr(result, state->values, value) == -1)
             goto failed;
@@ -4050,12 +4091,12 @@ ast2obj_expr(astmodulestate *state, void* _o)
         tp = (PyTypeObject *)state->Dict_type;
         result = PyType_GenericNew(tp, NULL, NULL);
         if (!result) goto failed;
-        value = ast2obj_list(state, o->v.Dict.keys, ast2obj_expr);
+        value = ast2obj_list(state, (asdl_seq*)o->v.Dict.keys, ast2obj_expr);
         if (!value) goto failed;
         if (PyObject_SetAttr(result, state->keys, value) == -1)
             goto failed;
         Py_DECREF(value);
-        value = ast2obj_list(state, o->v.Dict.values, ast2obj_expr);
+        value = ast2obj_list(state, (asdl_seq*)o->v.Dict.values, ast2obj_expr);
         if (!value) goto failed;
         if (PyObject_SetAttr(result, state->values, value) == -1)
             goto failed;
@@ -4065,7 +4106,7 @@ ast2obj_expr(astmodulestate *state, void* _o)
         tp = (PyTypeObject *)state->Set_type;
         result = PyType_GenericNew(tp, NULL, NULL);
         if (!result) goto failed;
-        value = ast2obj_list(state, o->v.Set.elts, ast2obj_expr);
+        value = ast2obj_list(state, (asdl_seq*)o->v.Set.elts, ast2obj_expr);
         if (!value) goto failed;
         if (PyObject_SetAttr(result, state->elts, value) == -1)
             goto failed;
@@ -4080,7 +4121,7 @@ ast2obj_expr(astmodulestate *state, void* _o)
         if (PyObject_SetAttr(result, state->elt, value) == -1)
             goto failed;
         Py_DECREF(value);
-        value = ast2obj_list(state, o->v.ListComp.generators,
+        value = ast2obj_list(state, (asdl_seq*)o->v.ListComp.generators,
                              ast2obj_comprehension);
         if (!value) goto failed;
         if (PyObject_SetAttr(result, state->generators, value) == -1)
@@ -4096,7 +4137,7 @@ ast2obj_expr(astmodulestate *state, void* _o)
         if (PyObject_SetAttr(result, state->elt, value) == -1)
             goto failed;
         Py_DECREF(value);
-        value = ast2obj_list(state, o->v.SetComp.generators,
+        value = ast2obj_list(state, (asdl_seq*)o->v.SetComp.generators,
                              ast2obj_comprehension);
         if (!value) goto failed;
         if (PyObject_SetAttr(result, state->generators, value) == -1)
@@ -4117,7 +4158,7 @@ ast2obj_expr(astmodulestate *state, void* _o)
         if (PyObject_SetAttr(result, state->value, value) == -1)
             goto failed;
         Py_DECREF(value);
-        value = ast2obj_list(state, o->v.DictComp.generators,
+        value = ast2obj_list(state, (asdl_seq*)o->v.DictComp.generators,
                              ast2obj_comprehension);
         if (!value) goto failed;
         if (PyObject_SetAttr(result, state->generators, value) == -1)
@@ -4133,7 +4174,7 @@ ast2obj_expr(astmodulestate *state, void* _o)
         if (PyObject_SetAttr(result, state->elt, value) == -1)
             goto failed;
         Py_DECREF(value);
-        value = ast2obj_list(state, o->v.GeneratorExp.generators,
+        value = ast2obj_list(state, (asdl_seq*)o->v.GeneratorExp.generators,
                              ast2obj_comprehension);
         if (!value) goto failed;
         if (PyObject_SetAttr(result, state->generators, value) == -1)
@@ -4190,7 +4231,8 @@ ast2obj_expr(astmodulestate *state, void* _o)
         if (PyObject_SetAttr(result, state->ops, value) == -1)
             goto failed;
         Py_DECREF(value);
-        value = ast2obj_list(state, o->v.Compare.comparators, ast2obj_expr);
+        value = ast2obj_list(state, (asdl_seq*)o->v.Compare.comparators,
+                             ast2obj_expr);
         if (!value) goto failed;
         if (PyObject_SetAttr(result, state->comparators, value) == -1)
             goto failed;
@@ -4205,12 +4247,13 @@ ast2obj_expr(astmodulestate *state, void* _o)
         if (PyObject_SetAttr(result, state->func, value) == -1)
             goto failed;
         Py_DECREF(value);
-        value = ast2obj_list(state, o->v.Call.args, ast2obj_expr);
+        value = ast2obj_list(state, (asdl_seq*)o->v.Call.args, ast2obj_expr);
         if (!value) goto failed;
         if (PyObject_SetAttr(result, state->args, value) == -1)
             goto failed;
         Py_DECREF(value);
-        value = ast2obj_list(state, o->v.Call.keywords, ast2obj_keyword);
+        value = ast2obj_list(state, (asdl_seq*)o->v.Call.keywords,
+                             ast2obj_keyword);
         if (!value) goto failed;
         if (PyObject_SetAttr(result, state->keywords, value) == -1)
             goto failed;
@@ -4240,7 +4283,8 @@ ast2obj_expr(astmodulestate *state, void* _o)
         tp = (PyTypeObject *)state->JoinedStr_type;
         result = PyType_GenericNew(tp, NULL, NULL);
         if (!result) goto failed;
-        value = ast2obj_list(state, o->v.JoinedStr.values, ast2obj_expr);
+        value = ast2obj_list(state, (asdl_seq*)o->v.JoinedStr.values,
+                             ast2obj_expr);
         if (!value) goto failed;
         if (PyObject_SetAttr(result, state->values, value) == -1)
             goto failed;
@@ -4335,7 +4379,7 @@ ast2obj_expr(astmodulestate *state, void* _o)
         tp = (PyTypeObject *)state->List_type;
         result = PyType_GenericNew(tp, NULL, NULL);
         if (!result) goto failed;
-        value = ast2obj_list(state, o->v.List.elts, ast2obj_expr);
+        value = ast2obj_list(state, (asdl_seq*)o->v.List.elts, ast2obj_expr);
         if (!value) goto failed;
         if (PyObject_SetAttr(result, state->elts, value) == -1)
             goto failed;
@@ -4350,7 +4394,7 @@ ast2obj_expr(astmodulestate *state, void* _o)
         tp = (PyTypeObject *)state->Tuple_type;
         result = PyType_GenericNew(tp, NULL, NULL);
         if (!result) goto failed;
-        value = ast2obj_list(state, o->v.Tuple.elts, ast2obj_expr);
+        value = ast2obj_list(state, (asdl_seq*)o->v.Tuple.elts, ast2obj_expr);
         if (!value) goto failed;
         if (PyObject_SetAttr(result, state->elts, value) == -1)
             goto failed;
@@ -4557,7 +4601,7 @@ ast2obj_comprehension(astmodulestate *state, void* _o)
     if (PyObject_SetAttr(result, state->iter, value) == -1)
         goto failed;
     Py_DECREF(value);
-    value = ast2obj_list(state, o->ifs, ast2obj_expr);
+    value = ast2obj_list(state, (asdl_seq*)o->ifs, ast2obj_expr);
     if (!value) goto failed;
     if (PyObject_SetAttr(result, state->ifs, value) == -1)
         goto failed;
@@ -4598,7 +4642,8 @@ ast2obj_excepthandler(astmodulestate *state, void* _o)
         if (PyObject_SetAttr(result, state->name, value) == -1)
             goto failed;
         Py_DECREF(value);
-        value = ast2obj_list(state, o->v.ExceptHandler.body, ast2obj_stmt);
+        value = ast2obj_list(state, (asdl_seq*)o->v.ExceptHandler.body,
+                             ast2obj_stmt);
         if (!value) goto failed;
         if (PyObject_SetAttr(result, state->body, value) == -1)
             goto failed;
@@ -4644,12 +4689,12 @@ ast2obj_arguments(astmodulestate *state, void* _o)
     tp = (PyTypeObject *)state->arguments_type;
     result = PyType_GenericNew(tp, NULL, NULL);
     if (!result) return NULL;
-    value = ast2obj_list(state, o->posonlyargs, ast2obj_arg);
+    value = ast2obj_list(state, (asdl_seq*)o->posonlyargs, ast2obj_arg);
     if (!value) goto failed;
     if (PyObject_SetAttr(result, state->posonlyargs, value) == -1)
         goto failed;
     Py_DECREF(value);
-    value = ast2obj_list(state, o->args, ast2obj_arg);
+    value = ast2obj_list(state, (asdl_seq*)o->args, ast2obj_arg);
     if (!value) goto failed;
     if (PyObject_SetAttr(result, state->args, value) == -1)
         goto failed;
@@ -4659,12 +4704,12 @@ ast2obj_arguments(astmodulestate *state, void* _o)
     if (PyObject_SetAttr(result, state->vararg, value) == -1)
         goto failed;
     Py_DECREF(value);
-    value = ast2obj_list(state, o->kwonlyargs, ast2obj_arg);
+    value = ast2obj_list(state, (asdl_seq*)o->kwonlyargs, ast2obj_arg);
     if (!value) goto failed;
     if (PyObject_SetAttr(result, state->kwonlyargs, value) == -1)
         goto failed;
     Py_DECREF(value);
-    value = ast2obj_list(state, o->kw_defaults, ast2obj_expr);
+    value = ast2obj_list(state, (asdl_seq*)o->kw_defaults, ast2obj_expr);
     if (!value) goto failed;
     if (PyObject_SetAttr(result, state->kw_defaults, value) == -1)
         goto failed;
@@ -4674,7 +4719,7 @@ ast2obj_arguments(astmodulestate *state, void* _o)
     if (PyObject_SetAttr(result, state->kwarg, value) == -1)
         goto failed;
     Py_DECREF(value);
-    value = ast2obj_list(state, o->defaults, ast2obj_expr);
+    value = ast2obj_list(state, (asdl_seq*)o->defaults, ast2obj_expr);
     if (!value) goto failed;
     if (PyObject_SetAttr(result, state->defaults, value) == -1)
         goto failed;
@@ -4899,8 +4944,8 @@ obj2ast_mod(astmodulestate *state, PyObject* obj, mod_ty* out, PyArena* arena)
         return 1;
     }
     if (isinstance) {
-        asdl_seq* body;
-        asdl_seq* type_ignores;
+        asdl_stmt_seq* body;
+        asdl_type_ignore_seq* type_ignores;
 
         if (_PyObject_LookupAttr(obj, state->body, &tmp) < 0) {
             return 1;
@@ -4918,7 +4963,7 @@ obj2ast_mod(astmodulestate *state, PyObject* obj, mod_ty* out, PyArena* arena)
                 goto failed;
             }
             len = PyList_GET_SIZE(tmp);
-            body = _Py_asdl_seq_new(len, arena);
+            body = _Py_asdl_stmt_seq_new(len, arena);
             if (body == NULL) goto failed;
             for (i = 0; i < len; i++) {
                 stmt_ty val;
@@ -4951,7 +4996,7 @@ obj2ast_mod(astmodulestate *state, PyObject* obj, mod_ty* out, PyArena* arena)
                 goto failed;
             }
             len = PyList_GET_SIZE(tmp);
-            type_ignores = _Py_asdl_seq_new(len, arena);
+            type_ignores = _Py_asdl_type_ignore_seq_new(len, arena);
             if (type_ignores == NULL) goto failed;
             for (i = 0; i < len; i++) {
                 type_ignore_ty val;
@@ -4978,7 +5023,7 @@ obj2ast_mod(astmodulestate *state, PyObject* obj, mod_ty* out, PyArena* arena)
         return 1;
     }
     if (isinstance) {
-        asdl_seq* body;
+        asdl_stmt_seq* body;
 
         if (_PyObject_LookupAttr(obj, state->body, &tmp) < 0) {
             return 1;
@@ -4996,7 +5041,7 @@ obj2ast_mod(astmodulestate *state, PyObject* obj, mod_ty* out, PyArena* arena)
                 goto failed;
             }
             len = PyList_GET_SIZE(tmp);
-            body = _Py_asdl_seq_new(len, arena);
+            body = _Py_asdl_stmt_seq_new(len, arena);
             if (body == NULL) goto failed;
             for (i = 0; i < len; i++) {
                 stmt_ty val;
@@ -5048,7 +5093,7 @@ obj2ast_mod(astmodulestate *state, PyObject* obj, mod_ty* out, PyArena* arena)
         return 1;
     }
     if (isinstance) {
-        asdl_seq* argtypes;
+        asdl_expr_seq* argtypes;
         expr_ty returns;
 
         if (_PyObject_LookupAttr(obj, state->argtypes, &tmp) < 0) {
@@ -5067,7 +5112,7 @@ obj2ast_mod(astmodulestate *state, PyObject* obj, mod_ty* out, PyArena* arena)
                 goto failed;
             }
             len = PyList_GET_SIZE(tmp);
-            argtypes = _Py_asdl_seq_new(len, arena);
+            argtypes = _Py_asdl_expr_seq_new(len, arena);
             if (argtypes == NULL) goto failed;
             for (i = 0; i < len; i++) {
                 expr_ty val;
@@ -5184,8 +5229,8 @@ obj2ast_stmt(astmodulestate *state, PyObject* obj, stmt_ty* out, PyArena* arena)
     if (isinstance) {
         identifier name;
         arguments_ty args;
-        asdl_seq* body;
-        asdl_seq* decorator_list;
+        asdl_stmt_seq* body;
+        asdl_expr_seq* decorator_list;
         expr_ty returns;
         string type_comment;
 
@@ -5231,7 +5276,7 @@ obj2ast_stmt(astmodulestate *state, PyObject* obj, stmt_ty* out, PyArena* arena)
                 goto failed;
             }
             len = PyList_GET_SIZE(tmp);
-            body = _Py_asdl_seq_new(len, arena);
+            body = _Py_asdl_stmt_seq_new(len, arena);
             if (body == NULL) goto failed;
             for (i = 0; i < len; i++) {
                 stmt_ty val;
@@ -5264,7 +5309,7 @@ obj2ast_stmt(astmodulestate *state, PyObject* obj, stmt_ty* out, PyArena* arena)
                 goto failed;
             }
             len = PyList_GET_SIZE(tmp);
-            decorator_list = _Py_asdl_seq_new(len, arena);
+            decorator_list = _Py_asdl_expr_seq_new(len, arena);
             if (decorator_list == NULL) goto failed;
             for (i = 0; i < len; i++) {
                 expr_ty val;
@@ -5321,8 +5366,8 @@ obj2ast_stmt(astmodulestate *state, PyObject* obj, stmt_ty* out, PyArena* arena)
     if (isinstance) {
         identifier name;
         arguments_ty args;
-        asdl_seq* body;
-        asdl_seq* decorator_list;
+        asdl_stmt_seq* body;
+        asdl_expr_seq* decorator_list;
         expr_ty returns;
         string type_comment;
 
@@ -5368,7 +5413,7 @@ obj2ast_stmt(astmodulestate *state, PyObject* obj, stmt_ty* out, PyArena* arena)
                 goto failed;
             }
             len = PyList_GET_SIZE(tmp);
-            body = _Py_asdl_seq_new(len, arena);
+            body = _Py_asdl_stmt_seq_new(len, arena);
             if (body == NULL) goto failed;
             for (i = 0; i < len; i++) {
                 stmt_ty val;
@@ -5401,7 +5446,7 @@ obj2ast_stmt(astmodulestate *state, PyObject* obj, stmt_ty* out, PyArena* arena)
                 goto failed;
             }
             len = PyList_GET_SIZE(tmp);
-            decorator_list = _Py_asdl_seq_new(len, arena);
+            decorator_list = _Py_asdl_expr_seq_new(len, arena);
             if (decorator_list == NULL) goto failed;
             for (i = 0; i < len; i++) {
                 expr_ty val;
@@ -5457,10 +5502,10 @@ obj2ast_stmt(astmodulestate *state, PyObject* obj, stmt_ty* out, PyArena* arena)
     }
     if (isinstance) {
         identifier name;
-        asdl_seq* bases;
-        asdl_seq* keywords;
-        asdl_seq* body;
-        asdl_seq* decorator_list;
+        asdl_expr_seq* bases;
+        asdl_keyword_seq* keywords;
+        asdl_stmt_seq* body;
+        asdl_expr_seq* decorator_list;
 
         if (_PyObject_LookupAttr(obj, state->name, &tmp) < 0) {
             return 1;
@@ -5491,7 +5536,7 @@ obj2ast_stmt(astmodulestate *state, PyObject* obj, stmt_ty* out, PyArena* arena)
                 goto failed;
             }
             len = PyList_GET_SIZE(tmp);
-            bases = _Py_asdl_seq_new(len, arena);
+            bases = _Py_asdl_expr_seq_new(len, arena);
             if (bases == NULL) goto failed;
             for (i = 0; i < len; i++) {
                 expr_ty val;
@@ -5524,7 +5569,7 @@ obj2ast_stmt(astmodulestate *state, PyObject* obj, stmt_ty* out, PyArena* arena)
                 goto failed;
             }
             len = PyList_GET_SIZE(tmp);
-            keywords = _Py_asdl_seq_new(len, arena);
+            keywords = _Py_asdl_keyword_seq_new(len, arena);
             if (keywords == NULL) goto failed;
             for (i = 0; i < len; i++) {
                 keyword_ty val;
@@ -5557,7 +5602,7 @@ obj2ast_stmt(astmodulestate *state, PyObject* obj, stmt_ty* out, PyArena* arena)
                 goto failed;
             }
             len = PyList_GET_SIZE(tmp);
-            body = _Py_asdl_seq_new(len, arena);
+            body = _Py_asdl_stmt_seq_new(len, arena);
             if (body == NULL) goto failed;
             for (i = 0; i < len; i++) {
                 stmt_ty val;
@@ -5590,7 +5635,7 @@ obj2ast_stmt(astmodulestate *state, PyObject* obj, stmt_ty* out, PyArena* arena)
                 goto failed;
             }
             len = PyList_GET_SIZE(tmp);
-            decorator_list = _Py_asdl_seq_new(len, arena);
+            decorator_list = _Py_asdl_expr_seq_new(len, arena);
             if (decorator_list == NULL) goto failed;
             for (i = 0; i < len; i++) {
                 expr_ty val;
@@ -5644,7 +5689,7 @@ obj2ast_stmt(astmodulestate *state, PyObject* obj, stmt_ty* out, PyArena* arena)
         return 1;
     }
     if (isinstance) {
-        asdl_seq* targets;
+        asdl_expr_seq* targets;
 
         if (_PyObject_LookupAttr(obj, state->targets, &tmp) < 0) {
             return 1;
@@ -5662,7 +5707,7 @@ obj2ast_stmt(astmodulestate *state, PyObject* obj, stmt_ty* out, PyArena* arena)
                 goto failed;
             }
             len = PyList_GET_SIZE(tmp);
-            targets = _Py_asdl_seq_new(len, arena);
+            targets = _Py_asdl_expr_seq_new(len, arena);
             if (targets == NULL) goto failed;
             for (i = 0; i < len; i++) {
                 expr_ty val;
@@ -5690,7 +5735,7 @@ obj2ast_stmt(astmodulestate *state, PyObject* obj, stmt_ty* out, PyArena* arena)
         return 1;
     }
     if (isinstance) {
-        asdl_seq* targets;
+        asdl_expr_seq* targets;
         expr_ty value;
         string type_comment;
 
@@ -5710,7 +5755,7 @@ obj2ast_stmt(astmodulestate *state, PyObject* obj, stmt_ty* out, PyArena* arena)
                 goto failed;
             }
             len = PyList_GET_SIZE(tmp);
-            targets = _Py_asdl_seq_new(len, arena);
+            targets = _Py_asdl_expr_seq_new(len, arena);
             if (targets == NULL) goto failed;
             for (i = 0; i < len; i++) {
                 expr_ty val;
@@ -5888,8 +5933,8 @@ obj2ast_stmt(astmodulestate *state, PyObject* obj, stmt_ty* out, PyArena* arena)
     if (isinstance) {
         expr_ty target;
         expr_ty iter;
-        asdl_seq* body;
-        asdl_seq* orelse;
+        asdl_stmt_seq* body;
+        asdl_stmt_seq* orelse;
         string type_comment;
 
         if (_PyObject_LookupAttr(obj, state->target, &tmp) < 0) {
@@ -5934,7 +5979,7 @@ obj2ast_stmt(astmodulestate *state, PyObject* obj, stmt_ty* out, PyArena* arena)
                 goto failed;
             }
             len = PyList_GET_SIZE(tmp);
-            body = _Py_asdl_seq_new(len, arena);
+            body = _Py_asdl_stmt_seq_new(len, arena);
             if (body == NULL) goto failed;
             for (i = 0; i < len; i++) {
                 stmt_ty val;
@@ -5967,7 +6012,7 @@ obj2ast_stmt(astmodulestate *state, PyObject* obj, stmt_ty* out, PyArena* arena)
                 goto failed;
             }
             len = PyList_GET_SIZE(tmp);
-            orelse = _Py_asdl_seq_new(len, arena);
+            orelse = _Py_asdl_stmt_seq_new(len, arena);
             if (orelse == NULL) goto failed;
             for (i = 0; i < len; i++) {
                 stmt_ty val;
@@ -6010,8 +6055,8 @@ obj2ast_stmt(astmodulestate *state, PyObject* obj, stmt_ty* out, PyArena* arena)
     if (isinstance) {
         expr_ty target;
         expr_ty iter;
-        asdl_seq* body;
-        asdl_seq* orelse;
+        asdl_stmt_seq* body;
+        asdl_stmt_seq* orelse;
         string type_comment;
 
         if (_PyObject_LookupAttr(obj, state->target, &tmp) < 0) {
@@ -6056,7 +6101,7 @@ obj2ast_stmt(astmodulestate *state, PyObject* obj, stmt_ty* out, PyArena* arena)
                 goto failed;
             }
             len = PyList_GET_SIZE(tmp);
-            body = _Py_asdl_seq_new(len, arena);
+            body = _Py_asdl_stmt_seq_new(len, arena);
             if (body == NULL) goto failed;
             for (i = 0; i < len; i++) {
                 stmt_ty val;
@@ -6089,7 +6134,7 @@ obj2ast_stmt(astmodulestate *state, PyObject* obj, stmt_ty* out, PyArena* arena)
                 goto failed;
             }
             len = PyList_GET_SIZE(tmp);
-            orelse = _Py_asdl_seq_new(len, arena);
+            orelse = _Py_asdl_stmt_seq_new(len, arena);
             if (orelse == NULL) goto failed;
             for (i = 0; i < len; i++) {
                 stmt_ty val;
@@ -6131,8 +6176,8 @@ obj2ast_stmt(astmodulestate *state, PyObject* obj, stmt_ty* out, PyArena* arena)
     }
     if (isinstance) {
         expr_ty test;
-        asdl_seq* body;
-        asdl_seq* orelse;
+        asdl_stmt_seq* body;
+        asdl_stmt_seq* orelse;
 
         if (_PyObject_LookupAttr(obj, state->test, &tmp) < 0) {
             return 1;
@@ -6163,7 +6208,7 @@ obj2ast_stmt(astmodulestate *state, PyObject* obj, stmt_ty* out, PyArena* arena)
                 goto failed;
             }
             len = PyList_GET_SIZE(tmp);
-            body = _Py_asdl_seq_new(len, arena);
+            body = _Py_asdl_stmt_seq_new(len, arena);
             if (body == NULL) goto failed;
             for (i = 0; i < len; i++) {
                 stmt_ty val;
@@ -6196,7 +6241,7 @@ obj2ast_stmt(astmodulestate *state, PyObject* obj, stmt_ty* out, PyArena* arena)
                 goto failed;
             }
             len = PyList_GET_SIZE(tmp);
-            orelse = _Py_asdl_seq_new(len, arena);
+            orelse = _Py_asdl_stmt_seq_new(len, arena);
             if (orelse == NULL) goto failed;
             for (i = 0; i < len; i++) {
                 stmt_ty val;
@@ -6225,8 +6270,8 @@ obj2ast_stmt(astmodulestate *state, PyObject* obj, stmt_ty* out, PyArena* arena)
     }
     if (isinstance) {
         expr_ty test;
-        asdl_seq* body;
-        asdl_seq* orelse;
+        asdl_stmt_seq* body;
+        asdl_stmt_seq* orelse;
 
         if (_PyObject_LookupAttr(obj, state->test, &tmp) < 0) {
             return 1;
@@ -6257,7 +6302,7 @@ obj2ast_stmt(astmodulestate *state, PyObject* obj, stmt_ty* out, PyArena* arena)
                 goto failed;
             }
             len = PyList_GET_SIZE(tmp);
-            body = _Py_asdl_seq_new(len, arena);
+            body = _Py_asdl_stmt_seq_new(len, arena);
             if (body == NULL) goto failed;
             for (i = 0; i < len; i++) {
                 stmt_ty val;
@@ -6290,7 +6335,7 @@ obj2ast_stmt(astmodulestate *state, PyObject* obj, stmt_ty* out, PyArena* arena)
                 goto failed;
             }
             len = PyList_GET_SIZE(tmp);
-            orelse = _Py_asdl_seq_new(len, arena);
+            orelse = _Py_asdl_stmt_seq_new(len, arena);
             if (orelse == NULL) goto failed;
             for (i = 0; i < len; i++) {
                 stmt_ty val;
@@ -6318,8 +6363,8 @@ obj2ast_stmt(astmodulestate *state, PyObject* obj, stmt_ty* out, PyArena* arena)
         return 1;
     }
     if (isinstance) {
-        asdl_seq* items;
-        asdl_seq* body;
+        asdl_withitem_seq* items;
+        asdl_stmt_seq* body;
         string type_comment;
 
         if (_PyObject_LookupAttr(obj, state->items, &tmp) < 0) {
@@ -6338,7 +6383,7 @@ obj2ast_stmt(astmodulestate *state, PyObject* obj, stmt_ty* out, PyArena* arena)
                 goto failed;
             }
             len = PyList_GET_SIZE(tmp);
-            items = _Py_asdl_seq_new(len, arena);
+            items = _Py_asdl_withitem_seq_new(len, arena);
             if (items == NULL) goto failed;
             for (i = 0; i < len; i++) {
                 withitem_ty val;
@@ -6371,7 +6416,7 @@ obj2ast_stmt(astmodulestate *state, PyObject* obj, stmt_ty* out, PyArena* arena)
                 goto failed;
             }
             len = PyList_GET_SIZE(tmp);
-            body = _Py_asdl_seq_new(len, arena);
+            body = _Py_asdl_stmt_seq_new(len, arena);
             if (body == NULL) goto failed;
             for (i = 0; i < len; i++) {
                 stmt_ty val;
@@ -6412,8 +6457,8 @@ obj2ast_stmt(astmodulestate *state, PyObject* obj, stmt_ty* out, PyArena* arena)
         return 1;
     }
     if (isinstance) {
-        asdl_seq* items;
-        asdl_seq* body;
+        asdl_withitem_seq* items;
+        asdl_stmt_seq* body;
         string type_comment;
 
         if (_PyObject_LookupAttr(obj, state->items, &tmp) < 0) {
@@ -6432,7 +6477,7 @@ obj2ast_stmt(astmodulestate *state, PyObject* obj, stmt_ty* out, PyArena* arena)
                 goto failed;
             }
             len = PyList_GET_SIZE(tmp);
-            items = _Py_asdl_seq_new(len, arena);
+            items = _Py_asdl_withitem_seq_new(len, arena);
             if (items == NULL) goto failed;
             for (i = 0; i < len; i++) {
                 withitem_ty val;
@@ -6465,7 +6510,7 @@ obj2ast_stmt(astmodulestate *state, PyObject* obj, stmt_ty* out, PyArena* arena)
                 goto failed;
             }
             len = PyList_GET_SIZE(tmp);
-            body = _Py_asdl_seq_new(len, arena);
+            body = _Py_asdl_stmt_seq_new(len, arena);
             if (body == NULL) goto failed;
             for (i = 0; i < len; i++) {
                 stmt_ty val;
@@ -6546,10 +6591,10 @@ obj2ast_stmt(astmodulestate *state, PyObject* obj, stmt_ty* out, PyArena* arena)
         return 1;
     }
     if (isinstance) {
-        asdl_seq* body;
-        asdl_seq* handlers;
-        asdl_seq* orelse;
-        asdl_seq* finalbody;
+        asdl_stmt_seq* body;
+        asdl_excepthandler_seq* handlers;
+        asdl_stmt_seq* orelse;
+        asdl_stmt_seq* finalbody;
 
         if (_PyObject_LookupAttr(obj, state->body, &tmp) < 0) {
             return 1;
@@ -6567,7 +6612,7 @@ obj2ast_stmt(astmodulestate *state, PyObject* obj, stmt_ty* out, PyArena* arena)
                 goto failed;
             }
             len = PyList_GET_SIZE(tmp);
-            body = _Py_asdl_seq_new(len, arena);
+            body = _Py_asdl_stmt_seq_new(len, arena);
             if (body == NULL) goto failed;
             for (i = 0; i < len; i++) {
                 stmt_ty val;
@@ -6600,7 +6645,7 @@ obj2ast_stmt(astmodulestate *state, PyObject* obj, stmt_ty* out, PyArena* arena)
                 goto failed;
             }
             len = PyList_GET_SIZE(tmp);
-            handlers = _Py_asdl_seq_new(len, arena);
+            handlers = _Py_asdl_excepthandler_seq_new(len, arena);
             if (handlers == NULL) goto failed;
             for (i = 0; i < len; i++) {
                 excepthandler_ty val;
@@ -6633,7 +6678,7 @@ obj2ast_stmt(astmodulestate *state, PyObject* obj, stmt_ty* out, PyArena* arena)
                 goto failed;
             }
             len = PyList_GET_SIZE(tmp);
-            orelse = _Py_asdl_seq_new(len, arena);
+            orelse = _Py_asdl_stmt_seq_new(len, arena);
             if (orelse == NULL) goto failed;
             for (i = 0; i < len; i++) {
                 stmt_ty val;
@@ -6666,7 +6711,7 @@ obj2ast_stmt(astmodulestate *state, PyObject* obj, stmt_ty* out, PyArena* arena)
                 goto failed;
             }
             len = PyList_GET_SIZE(tmp);
-            finalbody = _Py_asdl_seq_new(len, arena);
+            finalbody = _Py_asdl_stmt_seq_new(len, arena);
             if (finalbody == NULL) goto failed;
             for (i = 0; i < len; i++) {
                 stmt_ty val;
@@ -6734,7 +6779,7 @@ obj2ast_stmt(astmodulestate *state, PyObject* obj, stmt_ty* out, PyArena* arena)
         return 1;
     }
     if (isinstance) {
-        asdl_seq* names;
+        asdl_alias_seq* names;
 
         if (_PyObject_LookupAttr(obj, state->names, &tmp) < 0) {
             return 1;
@@ -6752,7 +6797,7 @@ obj2ast_stmt(astmodulestate *state, PyObject* obj, stmt_ty* out, PyArena* arena)
                 goto failed;
             }
             len = PyList_GET_SIZE(tmp);
-            names = _Py_asdl_seq_new(len, arena);
+            names = _Py_asdl_alias_seq_new(len, arena);
             if (names == NULL) goto failed;
             for (i = 0; i < len; i++) {
                 alias_ty val;
@@ -6781,7 +6826,7 @@ obj2ast_stmt(astmodulestate *state, PyObject* obj, stmt_ty* out, PyArena* arena)
     }
     if (isinstance) {
         identifier module;
-        asdl_seq* names;
+        asdl_alias_seq* names;
         int level;
 
         if (_PyObject_LookupAttr(obj, state->module, &tmp) < 0) {
@@ -6813,7 +6858,7 @@ obj2ast_stmt(astmodulestate *state, PyObject* obj, stmt_ty* out, PyArena* arena)
                 goto failed;
             }
             len = PyList_GET_SIZE(tmp);
-            names = _Py_asdl_seq_new(len, arena);
+            names = _Py_asdl_alias_seq_new(len, arena);
             if (names == NULL) goto failed;
             for (i = 0; i < len; i++) {
                 alias_ty val;
@@ -6854,7 +6899,7 @@ obj2ast_stmt(astmodulestate *state, PyObject* obj, stmt_ty* out, PyArena* arena)
         return 1;
     }
     if (isinstance) {
-        asdl_seq* names;
+        asdl_identifier_seq* names;
 
         if (_PyObject_LookupAttr(obj, state->names, &tmp) < 0) {
             return 1;
@@ -6872,7 +6917,7 @@ obj2ast_stmt(astmodulestate *state, PyObject* obj, stmt_ty* out, PyArena* arena)
                 goto failed;
             }
             len = PyList_GET_SIZE(tmp);
-            names = _Py_asdl_seq_new(len, arena);
+            names = _Py_asdl_identifier_seq_new(len, arena);
             if (names == NULL) goto failed;
             for (i = 0; i < len; i++) {
                 identifier val;
@@ -6900,7 +6945,7 @@ obj2ast_stmt(astmodulestate *state, PyObject* obj, stmt_ty* out, PyArena* arena)
         return 1;
     }
     if (isinstance) {
-        asdl_seq* names;
+        asdl_identifier_seq* names;
 
         if (_PyObject_LookupAttr(obj, state->names, &tmp) < 0) {
             return 1;
@@ -6918,7 +6963,7 @@ obj2ast_stmt(astmodulestate *state, PyObject* obj, stmt_ty* out, PyArena* arena)
                 goto failed;
             }
             len = PyList_GET_SIZE(tmp);
-            names = _Py_asdl_seq_new(len, arena);
+            names = _Py_asdl_identifier_seq_new(len, arena);
             if (names == NULL) goto failed;
             for (i = 0; i < len; i++) {
                 identifier val;
@@ -7081,7 +7126,7 @@ obj2ast_expr(astmodulestate *state, PyObject* obj, expr_ty* out, PyArena* arena)
     }
     if (isinstance) {
         boolop_ty op;
-        asdl_seq* values;
+        asdl_expr_seq* values;
 
         if (_PyObject_LookupAttr(obj, state->op, &tmp) < 0) {
             return 1;
@@ -7112,7 +7157,7 @@ obj2ast_expr(astmodulestate *state, PyObject* obj, expr_ty* out, PyArena* arena)
                 goto failed;
             }
             len = PyList_GET_SIZE(tmp);
-            values = _Py_asdl_seq_new(len, arena);
+            values = _Py_asdl_expr_seq_new(len, arena);
             if (values == NULL) goto failed;
             for (i = 0; i < len; i++) {
                 expr_ty val;
@@ -7368,8 +7413,8 @@ obj2ast_expr(astmodulestate *state, PyObject* obj, expr_ty* out, PyArena* arena)
         return 1;
     }
     if (isinstance) {
-        asdl_seq* keys;
-        asdl_seq* values;
+        asdl_expr_seq* keys;
+        asdl_expr_seq* values;
 
         if (_PyObject_LookupAttr(obj, state->keys, &tmp) < 0) {
             return 1;
@@ -7387,7 +7432,7 @@ obj2ast_expr(astmodulestate *state, PyObject* obj, expr_ty* out, PyArena* arena)
                 goto failed;
             }
             len = PyList_GET_SIZE(tmp);
-            keys = _Py_asdl_seq_new(len, arena);
+            keys = _Py_asdl_expr_seq_new(len, arena);
             if (keys == NULL) goto failed;
             for (i = 0; i < len; i++) {
                 expr_ty val;
@@ -7420,7 +7465,7 @@ obj2ast_expr(astmodulestate *state, PyObject* obj, expr_ty* out, PyArena* arena)
                 goto failed;
             }
             len = PyList_GET_SIZE(tmp);
-            values = _Py_asdl_seq_new(len, arena);
+            values = _Py_asdl_expr_seq_new(len, arena);
             if (values == NULL) goto failed;
             for (i = 0; i < len; i++) {
                 expr_ty val;
@@ -7448,7 +7493,7 @@ obj2ast_expr(astmodulestate *state, PyObject* obj, expr_ty* out, PyArena* arena)
         return 1;
     }
     if (isinstance) {
-        asdl_seq* elts;
+        asdl_expr_seq* elts;
 
         if (_PyObject_LookupAttr(obj, state->elts, &tmp) < 0) {
             return 1;
@@ -7466,7 +7511,7 @@ obj2ast_expr(astmodulestate *state, PyObject* obj, expr_ty* out, PyArena* arena)
                 goto failed;
             }
             len = PyList_GET_SIZE(tmp);
-            elts = _Py_asdl_seq_new(len, arena);
+            elts = _Py_asdl_expr_seq_new(len, arena);
             if (elts == NULL) goto failed;
             for (i = 0; i < len; i++) {
                 expr_ty val;
@@ -7494,7 +7539,7 @@ obj2ast_expr(astmodulestate *state, PyObject* obj, expr_ty* out, PyArena* arena)
     }
     if (isinstance) {
         expr_ty elt;
-        asdl_seq* generators;
+        asdl_comprehension_seq* generators;
 
         if (_PyObject_LookupAttr(obj, state->elt, &tmp) < 0) {
             return 1;
@@ -7525,7 +7570,7 @@ obj2ast_expr(astmodulestate *state, PyObject* obj, expr_ty* out, PyArena* arena)
                 goto failed;
             }
             len = PyList_GET_SIZE(tmp);
-            generators = _Py_asdl_seq_new(len, arena);
+            generators = _Py_asdl_comprehension_seq_new(len, arena);
             if (generators == NULL) goto failed;
             for (i = 0; i < len; i++) {
                 comprehension_ty val;
@@ -7554,7 +7599,7 @@ obj2ast_expr(astmodulestate *state, PyObject* obj, expr_ty* out, PyArena* arena)
     }
     if (isinstance) {
         expr_ty elt;
-        asdl_seq* generators;
+        asdl_comprehension_seq* generators;
 
         if (_PyObject_LookupAttr(obj, state->elt, &tmp) < 0) {
             return 1;
@@ -7585,7 +7630,7 @@ obj2ast_expr(astmodulestate *state, PyObject* obj, expr_ty* out, PyArena* arena)
                 goto failed;
             }
             len = PyList_GET_SIZE(tmp);
-            generators = _Py_asdl_seq_new(len, arena);
+            generators = _Py_asdl_comprehension_seq_new(len, arena);
             if (generators == NULL) goto failed;
             for (i = 0; i < len; i++) {
                 comprehension_ty val;
@@ -7615,7 +7660,7 @@ obj2ast_expr(astmodulestate *state, PyObject* obj, expr_ty* out, PyArena* arena)
     if (isinstance) {
         expr_ty key;
         expr_ty value;
-        asdl_seq* generators;
+        asdl_comprehension_seq* generators;
 
         if (_PyObject_LookupAttr(obj, state->key, &tmp) < 0) {
             return 1;
@@ -7659,7 +7704,7 @@ obj2ast_expr(astmodulestate *state, PyObject* obj, expr_ty* out, PyArena* arena)
                 goto failed;
             }
             len = PyList_GET_SIZE(tmp);
-            generators = _Py_asdl_seq_new(len, arena);
+            generators = _Py_asdl_comprehension_seq_new(len, arena);
             if (generators == NULL) goto failed;
             for (i = 0; i < len; i++) {
                 comprehension_ty val;
@@ -7688,7 +7733,7 @@ obj2ast_expr(astmodulestate *state, PyObject* obj, expr_ty* out, PyArena* arena)
     }
     if (isinstance) {
         expr_ty elt;
-        asdl_seq* generators;
+        asdl_comprehension_seq* generators;
 
         if (_PyObject_LookupAttr(obj, state->elt, &tmp) < 0) {
             return 1;
@@ -7719,7 +7764,7 @@ obj2ast_expr(astmodulestate *state, PyObject* obj, expr_ty* out, PyArena* arena)
                 goto failed;
             }
             len = PyList_GET_SIZE(tmp);
-            generators = _Py_asdl_seq_new(len, arena);
+            generators = _Py_asdl_comprehension_seq_new(len, arena);
             if (generators == NULL) goto failed;
             for (i = 0; i < len; i++) {
                 comprehension_ty val;
@@ -7827,7 +7872,7 @@ obj2ast_expr(astmodulestate *state, PyObject* obj, expr_ty* out, PyArena* arena)
     if (isinstance) {
         expr_ty left;
         asdl_int_seq* ops;
-        asdl_seq* comparators;
+        asdl_expr_seq* comparators;
 
         if (_PyObject_LookupAttr(obj, state->left, &tmp) < 0) {
             return 1;
@@ -7891,7 +7936,7 @@ obj2ast_expr(astmodulestate *state, PyObject* obj, expr_ty* out, PyArena* arena)
                 goto failed;
             }
             len = PyList_GET_SIZE(tmp);
-            comparators = _Py_asdl_seq_new(len, arena);
+            comparators = _Py_asdl_expr_seq_new(len, arena);
             if (comparators == NULL) goto failed;
             for (i = 0; i < len; i++) {
                 expr_ty val;
@@ -7920,8 +7965,8 @@ obj2ast_expr(astmodulestate *state, PyObject* obj, expr_ty* out, PyArena* arena)
     }
     if (isinstance) {
         expr_ty func;
-        asdl_seq* args;
-        asdl_seq* keywords;
+        asdl_expr_seq* args;
+        asdl_keyword_seq* keywords;
 
         if (_PyObject_LookupAttr(obj, state->func, &tmp) < 0) {
             return 1;
@@ -7952,7 +7997,7 @@ obj2ast_expr(astmodulestate *state, PyObject* obj, expr_ty* out, PyArena* arena)
                 goto failed;
             }
             len = PyList_GET_SIZE(tmp);
-            args = _Py_asdl_seq_new(len, arena);
+            args = _Py_asdl_expr_seq_new(len, arena);
             if (args == NULL) goto failed;
             for (i = 0; i < len; i++) {
                 expr_ty val;
@@ -7985,7 +8030,7 @@ obj2ast_expr(astmodulestate *state, PyObject* obj, expr_ty* out, PyArena* arena)
                 goto failed;
             }
             len = PyList_GET_SIZE(tmp);
-            keywords = _Py_asdl_seq_new(len, arena);
+            keywords = _Py_asdl_keyword_seq_new(len, arena);
             if (keywords == NULL) goto failed;
             for (i = 0; i < len; i++) {
                 keyword_ty val;
@@ -8067,7 +8112,7 @@ obj2ast_expr(astmodulestate *state, PyObject* obj, expr_ty* out, PyArena* arena)
         return 1;
     }
     if (isinstance) {
-        asdl_seq* values;
+        asdl_expr_seq* values;
 
         if (_PyObject_LookupAttr(obj, state->values, &tmp) < 0) {
             return 1;
@@ -8085,7 +8130,7 @@ obj2ast_expr(astmodulestate *state, PyObject* obj, expr_ty* out, PyArena* arena)
                 goto failed;
             }
             len = PyList_GET_SIZE(tmp);
-            values = _Py_asdl_seq_new(len, arena);
+            values = _Py_asdl_expr_seq_new(len, arena);
             if (values == NULL) goto failed;
             for (i = 0; i < len; i++) {
                 expr_ty val;
@@ -8341,7 +8386,7 @@ obj2ast_expr(astmodulestate *state, PyObject* obj, expr_ty* out, PyArena* arena)
         return 1;
     }
     if (isinstance) {
-        asdl_seq* elts;
+        asdl_expr_seq* elts;
         expr_context_ty ctx;
 
         if (_PyObject_LookupAttr(obj, state->elts, &tmp) < 0) {
@@ -8360,7 +8405,7 @@ obj2ast_expr(astmodulestate *state, PyObject* obj, expr_ty* out, PyArena* arena)
                 goto failed;
             }
             len = PyList_GET_SIZE(tmp);
-            elts = _Py_asdl_seq_new(len, arena);
+            elts = _Py_asdl_expr_seq_new(len, arena);
             if (elts == NULL) goto failed;
             for (i = 0; i < len; i++) {
                 expr_ty val;
@@ -8401,7 +8446,7 @@ obj2ast_expr(astmodulestate *state, PyObject* obj, expr_ty* out, PyArena* arena)
         return 1;
     }
     if (isinstance) {
-        asdl_seq* elts;
+        asdl_expr_seq* elts;
         expr_context_ty ctx;
 
         if (_PyObject_LookupAttr(obj, state->elts, &tmp) < 0) {
@@ -8420,7 +8465,7 @@ obj2ast_expr(astmodulestate *state, PyObject* obj, expr_ty* out, PyArena* arena)
                 goto failed;
             }
             len = PyList_GET_SIZE(tmp);
-            elts = _Py_asdl_seq_new(len, arena);
+            elts = _Py_asdl_expr_seq_new(len, arena);
             if (elts == NULL) goto failed;
             for (i = 0; i < len; i++) {
                 expr_ty val;
@@ -8834,7 +8879,7 @@ obj2ast_comprehension(astmodulestate *state, PyObject* obj, comprehension_ty*
     PyObject* tmp = NULL;
     expr_ty target;
     expr_ty iter;
-    asdl_seq* ifs;
+    asdl_expr_seq* ifs;
     int is_async;
 
     if (_PyObject_LookupAttr(obj, state->target, &tmp) < 0) {
@@ -8879,7 +8924,7 @@ obj2ast_comprehension(astmodulestate *state, PyObject* obj, comprehension_ty*
             goto failed;
         }
         len = PyList_GET_SIZE(tmp);
-        ifs = _Py_asdl_seq_new(len, arena);
+        ifs = _Py_asdl_expr_seq_new(len, arena);
         if (ifs == NULL) goto failed;
         for (i = 0; i < len; i++) {
             expr_ty val;
@@ -8993,7 +9038,7 @@ obj2ast_excepthandler(astmodulestate *state, PyObject* obj, excepthandler_ty*
     if (isinstance) {
         expr_ty type;
         identifier name;
-        asdl_seq* body;
+        asdl_stmt_seq* body;
 
         if (_PyObject_LookupAttr(obj, state->type, &tmp) < 0) {
             return 1;
@@ -9037,7 +9082,7 @@ obj2ast_excepthandler(astmodulestate *state, PyObject* obj, excepthandler_ty*
                 goto failed;
             }
             len = PyList_GET_SIZE(tmp);
-            body = _Py_asdl_seq_new(len, arena);
+            body = _Py_asdl_stmt_seq_new(len, arena);
             if (body == NULL) goto failed;
             for (i = 0; i < len; i++) {
                 stmt_ty val;
@@ -9071,13 +9116,13 @@ obj2ast_arguments(astmodulestate *state, PyObject* obj, arguments_ty* out,
                   PyArena* arena)
 {
     PyObject* tmp = NULL;
-    asdl_seq* posonlyargs;
-    asdl_seq* args;
+    asdl_arg_seq* posonlyargs;
+    asdl_arg_seq* args;
     arg_ty vararg;
-    asdl_seq* kwonlyargs;
-    asdl_seq* kw_defaults;
+    asdl_arg_seq* kwonlyargs;
+    asdl_expr_seq* kw_defaults;
     arg_ty kwarg;
-    asdl_seq* defaults;
+    asdl_expr_seq* defaults;
 
     if (_PyObject_LookupAttr(obj, state->posonlyargs, &tmp) < 0) {
         return 1;
@@ -9095,7 +9140,7 @@ obj2ast_arguments(astmodulestate *state, PyObject* obj, arguments_ty* out,
             goto failed;
         }
         len = PyList_GET_SIZE(tmp);
-        posonlyargs = _Py_asdl_seq_new(len, arena);
+        posonlyargs = _Py_asdl_arg_seq_new(len, arena);
         if (posonlyargs == NULL) goto failed;
         for (i = 0; i < len; i++) {
             arg_ty val;
@@ -9128,7 +9173,7 @@ obj2ast_arguments(astmodulestate *state, PyObject* obj, arguments_ty* out,
             goto failed;
         }
         len = PyList_GET_SIZE(tmp);
-        args = _Py_asdl_seq_new(len, arena);
+        args = _Py_asdl_arg_seq_new(len, arena);
         if (args == NULL) goto failed;
         for (i = 0; i < len; i++) {
             arg_ty val;
@@ -9174,7 +9219,7 @@ obj2ast_arguments(astmodulestate *state, PyObject* obj, arguments_ty* out,
             goto failed;
         }
         len = PyList_GET_SIZE(tmp);
-        kwonlyargs = _Py_asdl_seq_new(len, arena);
+        kwonlyargs = _Py_asdl_arg_seq_new(len, arena);
         if (kwonlyargs == NULL) goto failed;
         for (i = 0; i < len; i++) {
             arg_ty val;
@@ -9207,7 +9252,7 @@ obj2ast_arguments(astmodulestate *state, PyObject* obj, arguments_ty* out,
             goto failed;
         }
         len = PyList_GET_SIZE(tmp);
-        kw_defaults = _Py_asdl_seq_new(len, arena);
+        kw_defaults = _Py_asdl_expr_seq_new(len, arena);
         if (kw_defaults == NULL) goto failed;
         for (i = 0; i < len; i++) {
             expr_ty val;
@@ -9253,7 +9298,7 @@ obj2ast_arguments(astmodulestate *state, PyObject* obj, arguments_ty* out,
             goto failed;
         }
         len = PyList_GET_SIZE(tmp);
-        defaults = _Py_asdl_seq_new(len, arena);
+        defaults = _Py_asdl_expr_seq_new(len, arena);
         if (defaults == NULL) goto failed;
         for (i = 0; i < len; i++) {
             expr_ty val;
diff --git a/Python/asdl.c b/Python/asdl.c
index c21107811813a..4ff07e4377b18 100644
--- a/Python/asdl.c
+++ b/Python/asdl.c
@@ -1,64 +1,6 @@
 #include "Python.h"
 #include "asdl.h"
 
-asdl_seq *
-_Py_asdl_seq_new(Py_ssize_t size, PyArena *arena)
-{
-    asdl_seq *seq = NULL;
-    size_t n;
-
-    /* check size is sane */
-    if (size < 0 ||
-        (size && (((size_t)size - 1) > (SIZE_MAX / sizeof(void *))))) {
-        PyErr_NoMemory();
-        return NULL;
-    }
-    n = (size ? (sizeof(void *) * (size - 1)) : 0);
-
-    /* check if size can be added safely */
-    if (n > SIZE_MAX - sizeof(asdl_seq)) {
-        PyErr_NoMemory();
-        return NULL;
-    }
-    n += sizeof(asdl_seq);
-
-    seq = (asdl_seq *)PyArena_Malloc(arena, n);
-    if (!seq) {
-        PyErr_NoMemory();
-        return NULL;
-    }
-    memset(seq, 0, n);
-    seq->size = size;
-    return seq;
-}
-
-asdl_int_seq *
-_Py_asdl_int_seq_new(Py_ssize_t size, PyArena *arena)
-{
-    asdl_int_seq *seq = NULL;
-    size_t n;
-
-    /* check size is sane */
-    if (size < 0 ||
-        (size && (((size_t)size - 1) > (SIZE_MAX / sizeof(void *))))) {
-            PyErr_NoMemory();
-            return NULL;
-    }
-    n = (size ? (sizeof(void *) * (size - 1)) : 0);
-
-    /* check if size can be added safely */
-    if (n > SIZE_MAX - sizeof(asdl_seq)) {
-        PyErr_NoMemory();
-        return NULL;
-    }
-    n += sizeof(asdl_seq);
-
-    seq = (asdl_int_seq *)PyArena_Malloc(arena, n);
-    if (!seq) {
-        PyErr_NoMemory();
-        return NULL;
-    }
-    memset(seq, 0, n);
-    seq->size = size;
-    return seq;
-}
+GENERATE_ASDL_SEQ_CONSTRUCTOR(generic, void*);
+GENERATE_ASDL_SEQ_CONSTRUCTOR(identifier, PyObject*);
+GENERATE_ASDL_SEQ_CONSTRUCTOR(int, int);
diff --git a/Python/ast.c b/Python/ast.c
index 7bf66e50aa14d..4b7bbd229c99b 100644
--- a/Python/ast.c
+++ b/Python/ast.c
@@ -14,9 +14,9 @@
 
 #define MAXLEVEL 200    /* Max parentheses level */
 
-static int validate_stmts(asdl_seq *);
-static int validate_exprs(asdl_seq *, expr_context_ty, int);
-static int validate_nonempty_seq(asdl_seq *, const char *, const char *);
+static int validate_stmts(asdl_stmt_seq *);
+static int validate_exprs(asdl_expr_seq*, expr_context_ty, int);
+static int _validate_nonempty_seq(asdl_seq *, const char *, const char *);
 static int validate_stmt(stmt_ty);
 static int validate_expr(expr_ty, expr_context_ty);
 
@@ -40,7 +40,7 @@ validate_name(PyObject *name)
 }
 
 static int
-validate_comprehension(asdl_seq *gens)
+validate_comprehension(asdl_comprehension_seq *gens)
 {
     Py_ssize_t i;
     if (!asdl_seq_LEN(gens)) {
@@ -58,7 +58,7 @@ validate_comprehension(asdl_seq *gens)
 }
 
 static int
-validate_keywords(asdl_seq *keywords)
+validate_keywords(asdl_keyword_seq *keywords)
 {
     Py_ssize_t i;
     for (i = 0; i < asdl_seq_LEN(keywords); i++)
@@ -68,7 +68,7 @@ validate_keywords(asdl_seq *keywords)
 }
 
 static int
-validate_args(asdl_seq *args)
+validate_args(asdl_arg_seq *args)
 {
     Py_ssize_t i;
     for (i = 0; i < asdl_seq_LEN(args); i++) {
@@ -324,23 +324,24 @@ validate_expr(expr_ty exp, expr_context_ty ctx)
 }
 
 static int
-validate_nonempty_seq(asdl_seq *seq, const char *what, const char *owner)
+_validate_nonempty_seq(asdl_seq *seq, const char *what, const char *owner)
 {
     if (asdl_seq_LEN(seq))
         return 1;
     PyErr_Format(PyExc_ValueError, "empty %s on %s", what, owner);
     return 0;
 }
+#define validate_nonempty_seq(seq, what, owner) _validate_nonempty_seq((asdl_seq*)seq, what, owner)
 
 static int
-validate_assignlist(asdl_seq *targets, expr_context_ty ctx)
+validate_assignlist(asdl_expr_seq *targets, expr_context_ty ctx)
 {
     return validate_nonempty_seq(targets, "targets", ctx == Del ? "Delete" : "Assign") &&
         validate_exprs(targets, ctx, 0);
 }
 
 static int
-validate_body(asdl_seq *body, const char *owner)
+validate_body(asdl_stmt_seq *body, const char *owner)
 {
     return validate_nonempty_seq(body, "body", owner) && validate_stmts(body);
 }
@@ -488,7 +489,7 @@ validate_stmt(stmt_ty stmt)
 }
 
 static int
-validate_stmts(asdl_seq *seq)
+validate_stmts(asdl_stmt_seq *seq)
 {
     Py_ssize_t i;
     for (i = 0; i < asdl_seq_LEN(seq); i++) {
@@ -507,7 +508,7 @@ validate_stmts(asdl_seq *seq)
 }
 
 static int
-validate_exprs(asdl_seq *exprs, expr_context_ty ctx, int null_ok)
+validate_exprs(asdl_expr_seq *exprs, expr_context_ty ctx, int null_ok)
 {
     Py_ssize_t i;
     for (i = 0; i < asdl_seq_LEN(exprs); i++) {
@@ -550,7 +551,7 @@ PyAST_Validate(mod_ty mod)
 }
 
 PyObject *
-_PyAST_GetDocString(asdl_seq *body)
+_PyAST_GetDocString(asdl_stmt_seq *body)
 {
     if (!asdl_seq_LEN(body)) {
         return NULL;
diff --git a/Python/ast_opt.c b/Python/ast_opt.c
index ff786d6f8d63e..5efaac4c8925a 100644
--- a/Python/ast_opt.c
+++ b/Python/ast_opt.c
@@ -271,7 +271,7 @@ fold_binop(expr_ty node, PyArena *arena, _PyASTOptimizeState *state)
 }
 
 static PyObject*
-make_const_tuple(asdl_seq *elts)
+make_const_tuple(asdl_expr_seq *elts)
 {
     for (int i = 0; i < asdl_seq_LEN(elts); i++) {
         expr_ty e = (expr_ty)asdl_seq_GET(elts, i);
@@ -337,7 +337,7 @@ fold_iter(expr_ty arg, PyArena *arena, _PyASTOptimizeState *state)
     PyObject *newval;
     if (arg->kind == List_kind) {
         /* First change a list into tuple. */
-        asdl_seq *elts = arg->v.List.elts;
+        asdl_expr_seq *elts = arg->v.List.elts;
         Py_ssize_t n = asdl_seq_LEN(elts);
         for (Py_ssize_t i = 0; i < n; i++) {
             expr_ty e = (expr_ty)asdl_seq_GET(elts, i);
@@ -368,7 +368,7 @@ static int
 fold_compare(expr_ty node, PyArena *arena, _PyASTOptimizeState *state)
 {
     asdl_int_seq *ops;
-    asdl_seq *args;
+    asdl_expr_seq *args;
     Py_ssize_t i;
 
     ops = node->v.Compare.ops;
@@ -405,9 +405,9 @@ static int astfold_excepthandler(excepthandler_ty node_, PyArena *ctx_, _PyASTOp
 
 #define CALL_SEQ(FUNC, TYPE, ARG) { \
     int i; \
-    asdl_seq *seq = (ARG); /* avoid variable capture */ \
+    asdl_ ## TYPE ## _seq *seq = (ARG); /* avoid variable capture */ \
     for (i = 0; i < asdl_seq_LEN(seq); i++) { \
-        TYPE elt = (TYPE)asdl_seq_GET(seq, i); \
+        TYPE ## _ty elt = (TYPE ## _ty)asdl_seq_GET(seq, i); \
         if (elt != NULL && !FUNC(elt, ctx_, state)) \
             return 0; \
     } \
@@ -424,13 +424,13 @@ static int astfold_excepthandler(excepthandler_ty node_, PyArena *ctx_, _PyASTOp
 }
 
 static int
-astfold_body(asdl_seq *stmts, PyArena *ctx_, _PyASTOptimizeState *state)
+astfold_body(asdl_stmt_seq *stmts, PyArena *ctx_, _PyASTOptimizeState *state)
 {
     int docstring = _PyAST_GetDocString(stmts) != NULL;
-    CALL_SEQ(astfold_stmt, stmt_ty, stmts);
+    CALL_SEQ(astfold_stmt, stmt, stmts);
     if (!docstring && _PyAST_GetDocString(stmts) != NULL) {
         stmt_ty st = (stmt_ty)asdl_seq_GET(stmts, 0);
-        asdl_seq *values = _Py_asdl_seq_new(1, ctx_);
+        asdl_expr_seq *values = _Py_asdl_expr_seq_new(1, ctx_);
         if (!values) {
             return 0;
         }
@@ -453,7 +453,7 @@ astfold_mod(mod_ty node_, PyArena *ctx_, _PyASTOptimizeState *state)
         CALL(astfold_body, asdl_seq, node_->v.Module.body);
         break;
     case Interactive_kind:
-        CALL_SEQ(astfold_stmt, stmt_ty, node_->v.Interactive.body);
+        CALL_SEQ(astfold_stmt, stmt, node_->v.Interactive.body);
         break;
     case Expression_kind:
         CALL(astfold_expr, expr_ty, node_->v.Expression.body);
@@ -469,7 +469,7 @@ astfold_expr(expr_ty node_, PyArena *ctx_, _PyASTOptimizeState *state)
 {
     switch (node_->kind) {
     case BoolOp_kind:
-        CALL_SEQ(astfold_expr, expr_ty, node_->v.BoolOp.values);
+        CALL_SEQ(astfold_expr, expr, node_->v.BoolOp.values);
         break;
     case BinOp_kind:
         CALL(astfold_expr, expr_ty, node_->v.BinOp.left);
@@ -490,28 +490,28 @@ astfold_expr(expr_ty node_, PyArena *ctx_, _PyASTOptimizeState *state)
         CALL(astfold_expr, expr_ty, node_->v.IfExp.orelse);
         break;
     case Dict_kind:
-        CALL_SEQ(astfold_expr, expr_ty, node_->v.Dict.keys);
-        CALL_SEQ(astfold_expr, expr_ty, node_->v.Dict.values);
+        CALL_SEQ(astfold_expr, expr, node_->v.Dict.keys);
+        CALL_SEQ(astfold_expr, expr, node_->v.Dict.values);
         break;
     case Set_kind:
-        CALL_SEQ(astfold_expr, expr_ty, node_->v.Set.elts);
+        CALL_SEQ(astfold_expr, expr, node_->v.Set.elts);
         break;
     case ListComp_kind:
         CALL(astfold_expr, expr_ty, node_->v.ListComp.elt);
-        CALL_SEQ(astfold_comprehension, comprehension_ty, node_->v.ListComp.generators);
+        CALL_SEQ(astfold_comprehension, comprehension, node_->v.ListComp.generators);
         break;
     case SetComp_kind:
         CALL(astfold_expr, expr_ty, node_->v.SetComp.elt);
-        CALL_SEQ(astfold_comprehension, comprehension_ty, node_->v.SetComp.generators);
+        CALL_SEQ(astfold_comprehension, comprehension, node_->v.SetComp.generators);
         break;
     case DictComp_kind:
         CALL(astfold_expr, expr_ty, node_->v.DictComp.key);
         CALL(astfold_expr, expr_ty, node_->v.DictComp.value);
-        CALL_SEQ(astfold_comprehension, comprehension_ty, node_->v.DictComp.generators);
+        CALL_SEQ(astfold_comprehension, comprehension, node_->v.DictComp.generators);
         break;
     case GeneratorExp_kind:
         CALL(astfold_expr, expr_ty, node_->v.GeneratorExp.elt);
-        CALL_SEQ(astfold_comprehension, comprehension_ty, node_->v.GeneratorExp.generators);
+        CALL_SEQ(astfold_comprehension, comprehension, node_->v.GeneratorExp.generators);
         break;
     case Await_kind:
         CALL(astfold_expr, expr_ty, node_->v.Await.value);
@@ -524,20 +524,20 @@ astfold_expr(expr_ty node_, PyArena *ctx_, _PyASTOptimizeState *state)
         break;
     case Compare_kind:
         CALL(astfold_expr, expr_ty, node_->v.Compare.left);
-        CALL_SEQ(astfold_expr, expr_ty, node_->v.Compare.comparators);
+        CALL_SEQ(astfold_expr, expr, node_->v.Compare.comparators);
         CALL(fold_compare, expr_ty, node_);
         break;
     case Call_kind:
         CALL(astfold_expr, expr_ty, node_->v.Call.func);
-        CALL_SEQ(astfold_expr, expr_ty, node_->v.Call.args);
-        CALL_SEQ(astfold_keyword, keyword_ty, node_->v.Call.keywords);
+        CALL_SEQ(astfold_expr, expr, node_->v.Call.args);
+        CALL_SEQ(astfold_keyword, keyword, node_->v.Call.keywords);
         break;
     case FormattedValue_kind:
         CALL(astfold_expr, expr_ty, node_->v.FormattedValue.value);
         CALL_OPT(astfold_expr, expr_ty, node_->v.FormattedValue.format_spec);
         break;
     case JoinedStr_kind:
-        CALL_SEQ(astfold_expr, expr_ty, node_->v.JoinedStr.values);
+        CALL_SEQ(astfold_expr, expr, node_->v.JoinedStr.values);
         break;
     case Attribute_kind:
         CALL(astfold_expr, expr_ty, node_->v.Attribute.value);
@@ -556,10 +556,10 @@ astfold_expr(expr_ty node_, PyArena *ctx_, _PyASTOptimizeState *state)
         CALL_OPT(astfold_expr, expr_ty, node_->v.Slice.step);
         break;
     case List_kind:
-        CALL_SEQ(astfold_expr, expr_ty, node_->v.List.elts);
+        CALL_SEQ(astfold_expr, expr, node_->v.List.elts);
         break;
     case Tuple_kind:
-        CALL_SEQ(astfold_expr, expr_ty, node_->v.Tuple.elts);
+        CALL_SEQ(astfold_expr, expr, node_->v.Tuple.elts);
         CALL(fold_tuple, expr_ty, node_);
         break;
     case Name_kind:
@@ -586,7 +586,7 @@ astfold_comprehension(comprehension_ty node_, PyArena *ctx_, _PyASTOptimizeState
 {
     CALL(astfold_expr, expr_ty, node_->target);
     CALL(astfold_expr, expr_ty, node_->iter);
-    CALL_SEQ(astfold_expr, expr_ty, node_->ifs);
+    CALL_SEQ(astfold_expr, expr, node_->ifs);
 
     CALL(fold_iter, expr_ty, node_->iter);
     return 1;
@@ -595,13 +595,13 @@ astfold_comprehension(comprehension_ty node_, PyArena *ctx_, _PyASTOptimizeState
 static int
 astfold_arguments(arguments_ty node_, PyArena *ctx_, _PyASTOptimizeState *state)
 {
-    CALL_SEQ(astfold_arg, arg_ty, node_->posonlyargs);
-    CALL_SEQ(astfold_arg, arg_ty, node_->args);
+    CALL_SEQ(astfold_arg, arg, node_->posonlyargs);
+    CALL_SEQ(astfold_arg, arg, node_->args);
     CALL_OPT(astfold_arg, arg_ty, node_->vararg);
-    CALL_SEQ(astfold_arg, arg_ty, node_->kwonlyargs);
-    CALL_SEQ(astfold_expr, expr_ty, node_->kw_defaults);
+    CALL_SEQ(astfold_arg, arg, node_->kwonlyargs);
+    CALL_SEQ(astfold_expr, expr, node_->kw_defaults);
     CALL_OPT(astfold_arg, arg_ty, node_->kwarg);
-    CALL_SEQ(astfold_expr, expr_ty, node_->defaults);
+    CALL_SEQ(astfold_expr, expr, node_->defaults);
     return 1;
 }
 
@@ -621,7 +621,7 @@ astfold_stmt(stmt_ty node_, PyArena *ctx_, _PyASTOptimizeState *state)
     case FunctionDef_kind:
         CALL(astfold_arguments, arguments_ty, node_->v.FunctionDef.args);
         CALL(astfold_body, asdl_seq, node_->v.FunctionDef.body);
-        CALL_SEQ(astfold_expr, expr_ty, node_->v.FunctionDef.decorator_list);
+        CALL_SEQ(astfold_expr, expr, node_->v.FunctionDef.decorator_list);
         if (!(state->ff_features & CO_FUTURE_ANNOTATIONS)) {
             CALL_OPT(astfold_expr, expr_ty, node_->v.FunctionDef.returns);
         }
@@ -629,25 +629,25 @@ astfold_stmt(stmt_ty node_, PyArena *ctx_, _PyASTOptimizeState *state)
     case AsyncFunctionDef_kind:
         CALL(astfold_arguments, arguments_ty, node_->v.AsyncFunctionDef.args);
         CALL(astfold_body, asdl_seq, node_->v.AsyncFunctionDef.body);
-        CALL_SEQ(astfold_expr, expr_ty, node_->v.AsyncFunctionDef.decorator_list);
+        CALL_SEQ(astfold_expr, expr, node_->v.AsyncFunctionDef.decorator_list);
         if (!(state->ff_features & CO_FUTURE_ANNOTATIONS)) {
             CALL_OPT(astfold_expr, expr_ty, node_->v.AsyncFunctionDef.returns);
         }
         break;
     case ClassDef_kind:
-        CALL_SEQ(astfold_expr, expr_ty, node_->v.ClassDef.bases);
-        CALL_SEQ(astfold_keyword, keyword_ty, node_->v.ClassDef.keywords);
+        CALL_SEQ(astfold_expr, expr, node_->v.ClassDef.bases);
+        CALL_SEQ(astfold_keyword, keyword, node_->v.ClassDef.keywords);
         CALL(astfold_body, asdl_seq, node_->v.ClassDef.body);
-        CALL_SEQ(astfold_expr, expr_ty, node_->v.ClassDef.decorator_list);
+        CALL_SEQ(astfold_expr, expr, node_->v.ClassDef.decorator_list);
         break;
     case Return_kind:
         CALL_OPT(astfold_expr, expr_ty, node_->v.Return.value);
         break;
     case Delete_kind:
-        CALL_SEQ(astfold_expr, expr_ty, node_->v.Delete.targets);
+        CALL_SEQ(astfold_expr, expr, node_->v.Delete.targets);
         break;
     case Assign_kind:
-        CALL_SEQ(astfold_expr, expr_ty, node_->v.Assign.targets);
+        CALL_SEQ(astfold_expr, expr, node_->v.Assign.targets);
         CALL(astfold_expr, expr_ty, node_->v.Assign.value);
         break;
     case AugAssign_kind:
@@ -664,44 +664,44 @@ astfold_stmt(stmt_ty node_, PyArena *ctx_, _PyASTOptimizeState *state)
     case For_kind:
         CALL(astfold_expr, expr_ty, node_->v.For.target);
         CALL(astfold_expr, expr_ty, node_->v.For.iter);
-        CALL_SEQ(astfold_stmt, stmt_ty, node_->v.For.body);
-        CALL_SEQ(astfold_stmt, stmt_ty, node_->v.For.orelse);
+        CALL_SEQ(astfold_stmt, stmt, node_->v.For.body);
+        CALL_SEQ(astfold_stmt, stmt, node_->v.For.orelse);
 
         CALL(fold_iter, expr_ty, node_->v.For.iter);
         break;
     case AsyncFor_kind:
         CALL(astfold_expr, expr_ty, node_->v.AsyncFor.target);
         CALL(astfold_expr, expr_ty, node_->v.AsyncFor.iter);
-        CALL_SEQ(astfold_stmt, stmt_ty, node_->v.AsyncFor.body);
-        CALL_SEQ(astfold_stmt, stmt_ty, node_->v.AsyncFor.orelse);
+        CALL_SEQ(astfold_stmt, stmt, node_->v.AsyncFor.body);
+        CALL_SEQ(astfold_stmt, stmt, node_->v.AsyncFor.orelse);
         break;
     case While_kind:
         CALL(astfold_expr, expr_ty, node_->v.While.test);
-        CALL_SEQ(astfold_stmt, stmt_ty, node_->v.While.body);
-        CALL_SEQ(astfold_stmt, stmt_ty, node_->v.While.orelse);
+        CALL_SEQ(astfold_stmt, stmt, node_->v.While.body);
+        CALL_SEQ(astfold_stmt, stmt, node_->v.While.orelse);
         break;
     case If_kind:
         CALL(astfold_expr, expr_ty, node_->v.If.test);
-        CALL_SEQ(astfold_stmt, stmt_ty, node_->v.If.body);
-        CALL_SEQ(astfold_stmt, stmt_ty, node_->v.If.orelse);
+        CALL_SEQ(astfold_stmt, stmt, node_->v.If.body);
+        CALL_SEQ(astfold_stmt, stmt, node_->v.If.orelse);
         break;
     case With_kind:
-        CALL_SEQ(astfold_withitem, withitem_ty, node_->v.With.items);
-        CALL_SEQ(astfold_stmt, stmt_ty, node_->v.With.body);
+        CALL_SEQ(astfold_withitem, withitem, node_->v.With.items);
+        CALL_SEQ(astfold_stmt, stmt, node_->v.With.body);
         break;
     case AsyncWith_kind:
-        CALL_SEQ(astfold_withitem, withitem_ty, node_->v.AsyncWith.items);
-        CALL_SEQ(astfold_stmt, stmt_ty, node_->v.AsyncWith.body);
+        CALL_SEQ(astfold_withitem, withitem, node_->v.AsyncWith.items);
+        CALL_SEQ(astfold_stmt, stmt, node_->v.AsyncWith.body);
         break;
     case Raise_kind:
         CALL_OPT(astfold_expr, expr_ty, node_->v.Raise.exc);
         CALL_OPT(astfold_expr, expr_ty, node_->v.Raise.cause);
         break;
     case Try_kind:
-        CALL_SEQ(astfold_stmt, stmt_ty, node_->v.Try.body);
-        CALL_SEQ(astfold_excepthandler, excepthandler_ty, node_->v.Try.handlers);
-        CALL_SEQ(astfold_stmt, stmt_ty, node_->v.Try.orelse);
-        CALL_SEQ(astfold_stmt, stmt_ty, node_->v.Try.finalbody);
+        CALL_SEQ(astfold_stmt, stmt, node_->v.Try.body);
+        CALL_SEQ(astfold_excepthandler, excepthandler, node_->v.Try.handlers);
+        CALL_SEQ(astfold_stmt, stmt, node_->v.Try.orelse);
+        CALL_SEQ(astfold_stmt, stmt, node_->v.Try.finalbody);
         break;
     case Assert_kind:
         CALL(astfold_expr, expr_ty, node_->v.Assert.test);
@@ -722,7 +722,7 @@ astfold_excepthandler(excepthandler_ty node_, PyArena *ctx_, _PyASTOptimizeState
     switch (node_->kind) {
     case ExceptHandler_kind:
         CALL_OPT(astfold_expr, expr_ty, node_->v.ExceptHandler.type);
-        CALL_SEQ(astfold_stmt, stmt_ty, node_->v.ExceptHandler.body);
+        CALL_SEQ(astfold_stmt, stmt, node_->v.ExceptHandler.body);
         break;
     default:
         break;
diff --git a/Python/ast_unparse.c b/Python/ast_unparse.c
index e699751a05a05..a04ff93e9d9d9 100644
--- a/Python/ast_unparse.c
+++ b/Python/ast_unparse.c
@@ -117,7 +117,7 @@ static int
 append_ast_boolop(_PyUnicodeWriter *writer, expr_ty e, int level)
 {
     Py_ssize_t i, value_count;
-    asdl_seq *values;
+    asdl_expr_seq *values;
     const char *op = (e->v.BoolOp.op == And) ? " and " : " or ";
     int pr = (e->v.BoolOp.op == And) ? PR_AND : PR_OR;
 
@@ -398,7 +398,7 @@ append_ast_comprehension(_PyUnicodeWriter *writer, comprehension_ty gen)
 }
 
 static int
-append_ast_comprehensions(_PyUnicodeWriter *writer, asdl_seq *comprehensions)
+append_ast_comprehensions(_PyUnicodeWriter *writer, asdl_comprehension_seq *comprehensions)
 {
     Py_ssize_t i, gen_count;
     gen_count = asdl_seq_LEN(comprehensions);
@@ -453,7 +453,7 @@ append_ast_compare(_PyUnicodeWriter *writer, expr_ty e, int level)
 {
     const char *op;
     Py_ssize_t i, comparator_count;
-    asdl_seq *comparators;
+    asdl_expr_seq *comparators;
     asdl_int_seq *ops;
 
     APPEND_STR_IF(level > PR_CMP, "(");
@@ -612,7 +612,7 @@ append_fstring_element(_PyUnicodeWriter *writer, expr_ty e, bool is_format_spec)
 /* Build body separately to enable wrapping the entire stream of Strs,
    Constants and FormattedValues in one opening and one closing quote. */
 static PyObject *
-build_fstring_body(asdl_seq *values, bool is_format_spec)
+build_fstring_body(asdl_expr_seq *values, bool is_format_spec)
 {
     Py_ssize_t i, value_count;
     _PyUnicodeWriter body_writer;
diff --git a/Python/compile.c b/Python/compile.c
index 2c5326686f866..3ebf221cf02b7 100644
--- a/Python/compile.c
+++ b/Python/compile.c
@@ -222,27 +222,27 @@ static int compiler_subscript(struct compiler *, expr_ty);
 static int compiler_slice(struct compiler *, expr_ty);
 
 static int inplace_binop(operator_ty);
-static int are_all_items_const(asdl_seq *, Py_ssize_t, Py_ssize_t);
+static int are_all_items_const(asdl_expr_seq *, Py_ssize_t, Py_ssize_t);
 static int expr_constant(expr_ty);
 
 static int compiler_with(struct compiler *, stmt_ty, int);
 static int compiler_async_with(struct compiler *, stmt_ty, int);
 static int compiler_async_for(struct compiler *, stmt_ty);
 static int compiler_call_helper(struct compiler *c, int n,
-                                asdl_seq *args,
-                                asdl_seq *keywords);
+                                asdl_expr_seq *args,
+                                asdl_keyword_seq *keywords);
 static int compiler_try_except(struct compiler *, stmt_ty);
 static int compiler_set_qualname(struct compiler *);
 
 static int compiler_sync_comprehension_generator(
                                       struct compiler *c,
-                                      asdl_seq *generators, int gen_index,
+                                      asdl_comprehension_seq *generators, int gen_index,
                                       int depth,
                                       expr_ty elt, expr_ty val, int type);
 
 static int compiler_async_comprehension_generator(
                                       struct compiler *c,
-                                      asdl_seq *generators, int gen_index,
+                                      asdl_comprehension_seq *generators, int gen_index,
                                       int depth,
                                       expr_ty elt, expr_ty val, int type);
 
@@ -1525,7 +1525,7 @@ compiler_addop_j(struct compiler *c, int opcode, basicblock *b)
 
 #define VISIT_SEQ(C, TYPE, SEQ) { \
     int _i; \
-    asdl_seq *seq = (SEQ); /* avoid variable capture */ \
+    asdl_ ## TYPE ## _seq *seq = (SEQ); /* avoid variable capture */ \
     for (_i = 0; _i < asdl_seq_LEN(seq); _i++) { \
         TYPE ## _ty elt = (TYPE ## _ty)asdl_seq_GET(seq, _i); \
         if (!compiler_visit_ ## TYPE((C), elt)) \
@@ -1535,7 +1535,7 @@ compiler_addop_j(struct compiler *c, int opcode, basicblock *b)
 
 #define VISIT_SEQ_IN_SCOPE(C, TYPE, SEQ) { \
     int _i; \
-    asdl_seq *seq = (SEQ); /* avoid variable capture */ \
+    asdl_ ## TYPE ## _seq *seq = (SEQ); /* avoid variable capture */ \
     for (_i = 0; _i < asdl_seq_LEN(seq); _i++) { \
         TYPE ## _ty elt = (TYPE ## _ty)asdl_seq_GET(seq, _i); \
         if (!compiler_visit_ ## TYPE((C), elt)) { \
@@ -1559,7 +1559,7 @@ compiler_addop_j(struct compiler *c, int opcode, basicblock *b)
 /* Search if variable annotations are present statically in a block. */
 
 static int
-find_ann(asdl_seq *stmts)
+find_ann(asdl_stmt_seq *stmts)
 {
     int i, j, res = 0;
     stmt_ty st;
@@ -1778,7 +1778,7 @@ compiler_unwind_fblock_stack(struct compiler *c, int preserve_tos, struct fblock
    and for annotations. */
 
 static int
-compiler_body(struct compiler *c, asdl_seq *stmts)
+compiler_body(struct compiler *c, asdl_stmt_seq *stmts)
 {
     int i = 0;
     stmt_ty st;
@@ -1841,8 +1841,7 @@ compiler_mod(struct compiler *c, mod_ty mod)
             ADDOP(c, SETUP_ANNOTATIONS);
         }
         c->c_interactive = 1;
-        VISIT_SEQ_IN_SCOPE(c, stmt,
-                                mod->v.Interactive.body);
+        VISIT_SEQ_IN_SCOPE(c, stmt, mod->v.Interactive.body);
         break;
     case Expression_kind:
         VISIT_IN_SCOPE(c, expr, mod->v.Expression.body);
@@ -1945,7 +1944,7 @@ compiler_make_closure(struct compiler *c, PyCodeObject *co, Py_ssize_t flags, Py
 }
 
 static int
-compiler_decorators(struct compiler *c, asdl_seq* decos)
+compiler_decorators(struct compiler *c, asdl_expr_seq* decos)
 {
     int i;
 
@@ -1959,8 +1958,8 @@ compiler_decorators(struct compiler *c, asdl_seq* decos)
 }
 
 static int
-compiler_visit_kwonlydefaults(struct compiler *c, asdl_seq *kwonlyargs,
-                              asdl_seq *kw_defaults)
+compiler_visit_kwonlydefaults(struct compiler *c, asdl_arg_seq *kwonlyargs,
+                              asdl_expr_seq *kw_defaults)
 {
     /* Push a dict of keyword-only default values.
 
@@ -2047,7 +2046,7 @@ compiler_visit_argannotation(struct compiler *c, identifier id,
 }
 
 static int
-compiler_visit_argannotations(struct compiler *c, asdl_seq* args,
+compiler_visit_argannotations(struct compiler *c, asdl_arg_seq* args,
                               PyObject *names)
 {
     int i;
@@ -2173,7 +2172,7 @@ compiler_check_debug_one_arg(struct compiler *c, arg_ty arg)
 }
 
 static int
-compiler_check_debug_args_seq(struct compiler *c, asdl_seq *args)
+compiler_check_debug_args_seq(struct compiler *c, asdl_arg_seq *args)
 {
     if (args != NULL) {
         for (Py_ssize_t i = 0, n = asdl_seq_LEN(args); i < n; i++) {
@@ -2208,8 +2207,8 @@ compiler_function(struct compiler *c, stmt_ty s, int is_async)
     arguments_ty args;
     expr_ty returns;
     identifier name;
-    asdl_seq* decos;
-    asdl_seq *body;
+    asdl_expr_seq* decos;
+    asdl_stmt_seq *body;
     Py_ssize_t i, funcflags;
     int annotations;
     int scope_type;
@@ -2306,7 +2305,7 @@ compiler_class(struct compiler *c, stmt_ty s)
     PyCodeObject *co;
     PyObject *str;
     int i, firstlineno;
-    asdl_seq* decos = s->v.ClassDef.decorator_list;
+    asdl_expr_seq *decos = s->v.ClassDef.decorator_list;
 
     if (!compiler_decorators(c, decos))
         return 0;
@@ -2418,9 +2417,7 @@ compiler_class(struct compiler *c, stmt_ty s)
     ADDOP_LOAD_CONST(c, s->v.ClassDef.name);
 
     /* 5. generate the rest of the code for the call */
-    if (!compiler_call_helper(c, 2,
-                              s->v.ClassDef.bases,
-                              s->v.ClassDef.keywords))
+    if (!compiler_call_helper(c, 2, s->v.ClassDef.bases, s->v.ClassDef.keywords))
         return 0;
 
     /* 6. apply decorators */
@@ -2528,7 +2525,7 @@ compiler_jump_if(struct compiler *c, expr_ty e, basicblock *next, int cond)
         /* fallback to general implementation */
         break;
     case BoolOp_kind: {
-        asdl_seq *s = e->v.BoolOp.values;
+        asdl_expr_seq *s = e->v.BoolOp.values;
         Py_ssize_t i, n = asdl_seq_LEN(s) - 1;
         assert(n >= 0);
         int cond2 = e->v.BoolOp.op == Or;
@@ -3645,7 +3642,7 @@ compiler_boolop(struct compiler *c, expr_ty e)
     basicblock *end;
     int jumpi;
     Py_ssize_t i, n;
-    asdl_seq *s;
+    asdl_expr_seq *s;
 
     assert(e->kind == BoolOp_kind);
     if (e->v.BoolOp.op == And)
@@ -3673,7 +3670,7 @@ compiler_boolop(struct compiler *c, expr_ty e)
 }
 
 static int
-starunpack_helper(struct compiler *c, asdl_seq *elts, int pushed,
+starunpack_helper(struct compiler *c, asdl_expr_seq *elts, int pushed,
                   int build, int add, int extend, int tuple)
 {
     Py_ssize_t n = asdl_seq_LEN(elts);
@@ -3750,7 +3747,7 @@ starunpack_helper(struct compiler *c, asdl_seq *elts, int pushed,
 }
 
 static int
-assignment_helper(struct compiler *c, asdl_seq *elts)
+assignment_helper(struct compiler *c, asdl_expr_seq *elts)
 {
     Py_ssize_t n = asdl_seq_LEN(elts);
     Py_ssize_t i;
@@ -3784,7 +3781,7 @@ assignment_helper(struct compiler *c, asdl_seq *elts)
 static int
 compiler_list(struct compiler *c, expr_ty e)
 {
-    asdl_seq *elts = e->v.List.elts;
+    asdl_expr_seq *elts = e->v.List.elts;
     if (e->v.List.ctx == Store) {
         return assignment_helper(c, elts);
     }
@@ -3800,7 +3797,7 @@ compiler_list(struct compiler *c, expr_ty e)
 static int
 compiler_tuple(struct compiler *c, expr_ty e)
 {
-    asdl_seq *elts = e->v.Tuple.elts;
+    asdl_expr_seq *elts = e->v.Tuple.elts;
     if (e->v.Tuple.ctx == Store) {
         return assignment_helper(c, elts);
     }
@@ -3821,7 +3818,7 @@ compiler_set(struct compiler *c, expr_ty e)
 }
 
 static int
-are_all_items_const(asdl_seq *seq, Py_ssize_t begin, Py_ssize_t end)
+are_all_items_const(asdl_expr_seq *seq, Py_ssize_t begin, Py_ssize_t end)
 {
     Py_ssize_t i;
     for (i = begin; i < end; i++) {
@@ -4084,7 +4081,7 @@ maybe_optimize_method_call(struct compiler *c, expr_ty e)
 {
     Py_ssize_t argsl, i;
     expr_ty meth = e->v.Call.func;
-    asdl_seq *args = e->v.Call.args;
+    asdl_expr_seq *args = e->v.Call.args;
 
     /* Check that the call node is an attribute access, and that
        the call doesn't have keyword parameters. */
@@ -4110,7 +4107,7 @@ maybe_optimize_method_call(struct compiler *c, expr_ty e)
 }
 
 static int
-validate_keywords(struct compiler *c, asdl_seq *keywords)
+validate_keywords(struct compiler *c, asdl_keyword_seq *keywords)
 {
     Py_ssize_t nkeywords = asdl_seq_LEN(keywords);
     for (Py_ssize_t i = 0; i < nkeywords; i++) {
@@ -4210,7 +4207,7 @@ compiler_formatted_value(struct compiler *c, expr_ty e)
 }
 
 static int
-compiler_subkwargs(struct compiler *c, asdl_seq *keywords, Py_ssize_t begin, Py_ssize_t end)
+compiler_subkwargs(struct compiler *c, asdl_keyword_seq *keywords, Py_ssize_t begin, Py_ssize_t end)
 {
     Py_ssize_t i, n = end - begin;
     keyword_ty kw;
@@ -4249,8 +4246,8 @@ compiler_subkwargs(struct compiler *c, asdl_seq *keywords, Py_ssize_t begin, Py_
 static int
 compiler_call_helper(struct compiler *c,
                      int n, /* Args already pushed */
-                     asdl_seq *args,
-                     asdl_seq *keywords)
+                     asdl_expr_seq *args,
+                     asdl_keyword_seq *keywords)
 {
     Py_ssize_t i, nseen, nelts, nkwelts;
 
@@ -4375,7 +4372,7 @@ compiler_call_helper(struct compiler *c,
 
 static int
 compiler_comprehension_generator(struct compiler *c,
-                                 asdl_seq *generators, int gen_index,
+                                 asdl_comprehension_seq *generators, int gen_index,
                                  int depth,
                                  expr_ty elt, expr_ty val, int type)
 {
@@ -4392,7 +4389,7 @@ compiler_comprehension_generator(struct compiler *c,
 
 static int
 compiler_sync_comprehension_generator(struct compiler *c,
-                                      asdl_seq *generators, int gen_index,
+                                      asdl_comprehension_seq *generators, int gen_index,
                                       int depth,
                                       expr_ty elt, expr_ty val, int type)
 {
@@ -4424,7 +4421,7 @@ compiler_sync_comprehension_generator(struct compiler *c,
         /* Fast path for the temporary variable assignment idiom:
              for y in [f(x)]
          */
-        asdl_seq *elts;
+        asdl_expr_seq *elts;
         switch (gen->iter->kind) {
             case List_kind:
                 elts = gen->iter->v.List.elts;
@@ -4511,7 +4508,7 @@ compiler_sync_comprehension_generator(struct compiler *c,
 
 static int
 compiler_async_comprehension_generator(struct compiler *c,
-                                      asdl_seq *generators, int gen_index,
+                                      asdl_comprehension_seq *generators, int gen_index,
                                       int depth,
                                       expr_ty elt, expr_ty val, int type)
 {
@@ -4602,7 +4599,7 @@ compiler_async_comprehension_generator(struct compiler *c,
 
 static int
 compiler_comprehension(struct compiler *c, expr_ty e, int type,
-                       identifier name, asdl_seq *generators, expr_ty elt,
+                       identifier name, asdl_comprehension_seq *generators, expr_ty elt,
                        expr_ty val)
 {
     PyCodeObject *co = NULL;
@@ -5226,7 +5223,7 @@ check_ann_subscr(struct compiler *c, expr_ty e)
         return 1;
     case Tuple_kind: {
         /* extended slice */
-        asdl_seq *elts = e->v.Tuple.elts;
+        asdl_expr_seq *elts = e->v.Tuple.elts;
         Py_ssize_t i, n = asdl_seq_LEN(elts);
         for (i = 0; i < n; i++) {
             if (!check_ann_subscr(c, asdl_seq_GET(elts, i))) {
diff --git a/Python/future.c b/Python/future.c
index 56da4d8c798b8..3cea4fee78085 100644
--- a/Python/future.c
+++ b/Python/future.c
@@ -13,11 +13,10 @@ static int
 future_check_features(PyFutureFeatures *ff, stmt_ty s, PyObject *filename)
 {
     int i;
-    asdl_seq *names;
 
     assert(s->kind == ImportFrom_kind);
 
-    names = s->v.ImportFrom.names;
+    asdl_alias_seq *names = s->v.ImportFrom.names;
     for (i = 0; i < asdl_seq_LEN(names); i++) {
         alias_ty name = (alias_ty)asdl_seq_GET(names, i);
         const char *feature = PyUnicode_AsUTF8(name->name);
diff --git a/Python/symtable.c b/Python/symtable.c
index d192f31deefb7..4a98e79e74a25 100644
--- a/Python/symtable.c
+++ b/Python/symtable.c
@@ -202,8 +202,8 @@ static int symtable_visit_excepthandler(struct symtable *st, excepthandler_ty);
 static int symtable_visit_alias(struct symtable *st, alias_ty);
 static int symtable_visit_comprehension(struct symtable *st, comprehension_ty);
 static int symtable_visit_keyword(struct symtable *st, keyword_ty);
-static int symtable_visit_params(struct symtable *st, asdl_seq *args);
-static int symtable_visit_argannotations(struct symtable *st, asdl_seq *args);
+static int symtable_visit_params(struct symtable *st, asdl_arg_seq *args);
+static int symtable_visit_argannotations(struct symtable *st, asdl_arg_seq *args);
 static int symtable_implicit_arg(struct symtable *st, int pos);
 static int symtable_visit_annotations(struct symtable *st, arguments_ty, expr_ty);
 static int symtable_visit_withitem(struct symtable *st, withitem_ty item);
@@ -261,7 +261,7 @@ struct symtable *
 PySymtable_BuildObject(mod_ty mod, PyObject *filename, PyFutureFeatures *future)
 {
     struct symtable *st = symtable_new();
-    asdl_seq *seq;
+    asdl_stmt_seq *seq;
     int i;
     PyThreadState *tstate;
     int recursion_limit = Py_GetRecursionLimit();
@@ -1116,7 +1116,7 @@ symtable_add_def(struct symtable *st, PyObject *name, int flag) {
 
 #define VISIT_SEQ(ST, TYPE, SEQ) { \
     int i; \
-    asdl_seq *seq = (SEQ); /* avoid variable capture */ \
+    asdl_ ## TYPE ## _seq *seq = (SEQ); /* avoid variable capture */ \
     for (i = 0; i < asdl_seq_LEN(seq); i++) { \
         TYPE ## _ty elt = (TYPE ## _ty)asdl_seq_GET(seq, i); \
         if (!symtable_visit_ ## TYPE((ST), elt)) \
@@ -1126,7 +1126,7 @@ symtable_add_def(struct symtable *st, PyObject *name, int flag) {
 
 #define VISIT_SEQ_TAIL(ST, TYPE, SEQ, START) { \
     int i; \
-    asdl_seq *seq = (SEQ); /* avoid variable capture */ \
+    asdl_ ## TYPE ## _seq *seq = (SEQ); /* avoid variable capture */ \
     for (i = (START); i < asdl_seq_LEN(seq); i++) { \
         TYPE ## _ty elt = (TYPE ## _ty)asdl_seq_GET(seq, i); \
         if (!symtable_visit_ ## TYPE((ST), elt)) \
@@ -1136,7 +1136,7 @@ symtable_add_def(struct symtable *st, PyObject *name, int flag) {
 
 #define VISIT_SEQ_WITH_NULL(ST, TYPE, SEQ) {     \
     int i = 0; \
-    asdl_seq *seq = (SEQ); /* avoid variable capture */ \
+    asdl_ ## TYPE ## _seq *seq = (SEQ); /* avoid variable capture */ \
     for (i = 0; i < asdl_seq_LEN(seq); i++) { \
         TYPE ## _ty elt = (TYPE ## _ty)asdl_seq_GET(seq, i); \
         if (!elt) continue; /* can be NULL */ \
@@ -1318,7 +1318,7 @@ symtable_visit_stmt(struct symtable *st, stmt_ty s)
         break;
     case Global_kind: {
         int i;
-        asdl_seq *seq = s->v.Global.names;
+        asdl_identifier_seq *seq = s->v.Global.names;
         for (i = 0; i < asdl_seq_LEN(seq); i++) {
             identifier name = (identifier)asdl_seq_GET(seq, i);
             long cur = symtable_lookup(st, name);
@@ -1351,7 +1351,7 @@ symtable_visit_stmt(struct symtable *st, stmt_ty s)
     }
     case Nonlocal_kind: {
         int i;
-        asdl_seq *seq = s->v.Nonlocal.names;
+        asdl_identifier_seq *seq = s->v.Nonlocal.names;
         for (i = 0; i < asdl_seq_LEN(seq); i++) {
             identifier name = (identifier)asdl_seq_GET(seq, i);
             long cur = symtable_lookup(st, name);
@@ -1683,7 +1683,7 @@ symtable_implicit_arg(struct symtable *st, int pos)
 }
 
 static int
-symtable_visit_params(struct symtable *st, asdl_seq *args)
+symtable_visit_params(struct symtable *st, asdl_arg_seq *args)
 {
     int i;
 
@@ -1700,7 +1700,7 @@ symtable_visit_params(struct symtable *st, asdl_seq *args)
 }
 
 static int
-symtable_visit_argannotations(struct symtable *st, asdl_seq *args)
+symtable_visit_argannotations(struct symtable *st, asdl_arg_seq *args)
 {
     int i;
 
@@ -1850,7 +1850,7 @@ symtable_visit_keyword(struct symtable *st, keyword_ty k)
 
 static int
 symtable_handle_comprehension(struct symtable *st, expr_ty e,
-                              identifier scope_name, asdl_seq *generators,
+                              identifier scope_name, asdl_comprehension_seq *generators,
                               expr_ty elt, expr_ty value)
 {
     int is_generator = (e->kind == GeneratorExp_kind);
diff --git a/Tools/peg_generator/pegen/c_generator.py b/Tools/peg_generator/pegen/c_generator.py
index aee668c3f329a..1a814aad11ccc 100644
--- a/Tools/peg_generator/pegen/c_generator.py
+++ b/Tools/peg_generator/pegen/c_generator.py
@@ -74,6 +74,7 @@ class FunctionCall:
     function: str
     arguments: List[Any] = field(default_factory=list)
     assigned_variable: Optional[str] = None
+    assigned_variable_type: Optional[str] = None
     return_type: Optional[str] = None
     nodetype: Optional[NodeTypes] = None
     force_true: bool = False
@@ -87,7 +88,10 @@ def __str__(self) -> str:
         if self.force_true:
             parts.append(", 1")
         if self.assigned_variable:
-            parts = ["(", self.assigned_variable, " = ", *parts, ")"]
+            if self.assigned_variable_type:
+                parts = ["(", self.assigned_variable, " = ", '(', self.assigned_variable_type, ')', *parts, ")"]
+            else:
+                parts = ["(", self.assigned_variable, " = ", *parts, ")"]
         if self.comment:
             parts.append(f"  // {self.comment}")
         return "".join(parts)
@@ -210,6 +214,8 @@ def visit_NamedItem(self, node: NamedItem) -> FunctionCall:
         call = self.generate_call(node.item)
         if node.name:
             call.assigned_variable = node.name
+        if node.type:
+            call.assigned_variable_type = node.type
         return call
 
     def lookahead_call_helper(self, node: Lookahead, positive: int) -> FunctionCall:
@@ -568,9 +574,9 @@ def _handle_loop_rule_body(self, node: Rule, rhs: Rhs) -> None:
                     self.print("PyMem_Free(_children);")
                     self.add_return("NULL")
                 self.print("}")
-            self.print("asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);")
+            self.print("asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);")
             self.out_of_memory_return(f"!_seq", cleanup_code="PyMem_Free(_children);")
-            self.print("for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);")
+            self.print("for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);")
             self.print("PyMem_Free(_children);")
             if node.name:
                 self.print(f"_PyPegen_insert_memo(p, _start_mark, {node.name}_type, _seq);")
@@ -782,4 +788,5 @@ def add_var(self, node: NamedItem) -> Tuple[Optional[str], Optional[str]]:
         name = node.name if node.name else call.assigned_variable
         if name is not None:
             name = self.dedupe(name)
-        return name, call.return_type
+        return_type = call.return_type if node.type is None else node.type
+        return name, return_type
diff --git a/Tools/peg_generator/pegen/grammar.py b/Tools/peg_generator/pegen/grammar.py
index 78edf412ea6e4..332ee3c3eec5e 100644
--- a/Tools/peg_generator/pegen/grammar.py
+++ b/Tools/peg_generator/pegen/grammar.py
@@ -259,9 +259,10 @@ def collect_todo(self, gen: ParserGenerator) -> None:
 
 
 class NamedItem:
-    def __init__(self, name: Optional[str], item: Item):
+    def __init__(self, name: Optional[str], item: Item, type: Optional[str] = None):
         self.name = name
         self.item = item
+        self.type = type
         self.nullable = False
 
     def __str__(self) -> str:
diff --git a/Tools/peg_generator/pegen/grammar_parser.py b/Tools/peg_generator/pegen/grammar_parser.py
index c784cfdf3b266..6e3bc5068f5a7 100644
--- a/Tools/peg_generator/pegen/grammar_parser.py
+++ b/Tools/peg_generator/pegen/grammar_parser.py
@@ -402,9 +402,49 @@ def items(self) -> Optional[NamedItemList]:
 
     @memoize
     def named_item(self) -> Optional[NamedItem]:
-        # named_item: NAME '=' ~ item | item | lookahead
+        # named_item: NAME '[' NAME '*' ']' '=' ~ item | NAME '[' NAME ']' '=' ~ item | NAME '=' ~ item | item | lookahead
         mark = self.mark()
         cut = False
+        if (
+            (name := self.name())
+            and
+            (literal := self.expect('['))
+            and
+            (type := self.name())
+            and
+            (literal_1 := self.expect('*'))
+            and
+            (literal_2 := self.expect(']'))
+            and
+            (literal_3 := self.expect('='))
+            and
+            (cut := True)
+            and
+            (item := self.item())
+        ):
+            return NamedItem ( name . string , item , f"{type.string}*" )
+        self.reset(mark)
+        if cut: return None
+        cut = False
+        if (
+            (name := self.name())
+            and
+            (literal := self.expect('['))
+            and
+            (type := self.name())
+            and
+            (literal_1 := self.expect(']'))
+            and
+            (literal_2 := self.expect('='))
+            and
+            (cut := True)
+            and
+            (item := self.item())
+        ):
+            return NamedItem ( name . string , item , type . string )
+        self.reset(mark)
+        if cut: return None
+        cut = False
         if (
             (name := self.name())
             and
diff --git a/Tools/peg_generator/pegen/metagrammar.gram b/Tools/peg_generator/pegen/metagrammar.gram
index f0c5ac3ab390f..4802f56b68f7b 100644
--- a/Tools/peg_generator/pegen/metagrammar.gram
+++ b/Tools/peg_generator/pegen/metagrammar.gram
@@ -83,6 +83,8 @@ items[NamedItemList]:
     | named_item { [named_item] }
 
 named_item[NamedItem]:
+    | NAME '[' type=NAME '*' ']' '=' ~ item {NamedItem(name.string, item, f"{type.string}*")}
+    | NAME '[' type=NAME ']' '=' ~ item {NamedItem(name.string, item, type.string)}
     | NAME '=' ~ item {NamedItem(name.string, item)}
     | item {NamedItem(None, item)}
     | it=lookahead {NamedItem(None, it)}



More information about the Python-checkins mailing list