CVE-2019-19275 (C, published 2019-11-26T15:15Z)
Description: value: typed_ast 1.3.0 and 1.3.1 has an ast_for_arguments out-of-bounds read. An attacker with the ability to cause a Python interpreter to parse Python source (but not necessarily execute it) may be able to crash the interpreter process. This could be a concern, for example, in a web-based service that parses (but does not execute) Python code. (This issue also affected certain Python 3.8.0-alpha prereleases.)
Severity: MEDIUM (CVSS v3 base score: 7.5)
Weakness: CWE-125 \u2014 Out-of-bounds Read
The product reads data past the end, or before the beginning, of the intended buffer.
Repository: https://github.com/python/cpython
Files changed:
Doc/library/ast.rst
Doc/library/token-list.inc
Doc/library/token.rst
Grammar/Grammar
Grammar/Tokens
Include/Python-ast.h
Include/compile.h
Include/graminit.h
Include/parsetok.h
Include/token.h
Lib/ast.py
Lib/symbol.py
Lib/test/test_asdl_parser.py
Lib/test/test_ast.py
Lib/test/test_type_comments.py
Lib/token.py
Misc/NEWS.d/next/Core and Builtins/2019-01-22-19-17-27.bpo-35766.gh1tHZ.rst	
Modules/parsermodule.c
Parser/Python.asdl
Parser/asdl_c.py
Parser/parser.c
Parser/parsetok.c
Parser/token.c
Parser/tokenizer.c
Parser/tokenizer.h
Python/Python-ast.c
Python/ast.c
Python/bltinmodule.c
Python/graminit.c
Python/pythonrun.c
Commit message: bpo-35766: Merge typed_ast back into CPython (GH-11645)



Vulnerable code:
.. function:: parse(source, filename='<unknown>', mode='exec')
funcdef: 'def' NAME parameters ['->' test] ':' suite
typedargslist: (tfpdef ['=' test] (',' tfpdef ['=' test])* [',' [
        '*' [tfpdef] (',' tfpdef ['=' test])* [',' ['**' tfpdef [',']]]
      | '**' tfpdef [',']]]
  | '*' [tfpdef] (',' tfpdef ['=' test])* [',' ['**' tfpdef [',']]]
  | '**' tfpdef [','])
                     ('=' (yield_expr|testlist_star_expr))*)
for_stmt: 'for' exprlist 'in' testlist ':' suite ['else' ':' suite]
with_stmt: 'with' with_item (',' with_item)*  ':' suite
                 Suite_kind=4};
#define Module(a0, a1) _Py_Module(a0, a1)
mod_ty _Py_Module(asdl_seq * body, PyArena *arena);
#define FunctionDef(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9) _Py_FunctionDef(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9)
                        asdl_seq * decorator_list, expr_ty returns, 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) _Py_AsyncFunctionDef(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9)
                             int lineno, int col_offset, int end_lineno, int
                             end_col_offset, PyArena *arena);
#define Assign(a0, a1, a2, a3, a4, a5, a6) _Py_Assign(a0, a1, a2, a3, a4, a5, a6)
stmt_ty _Py_Assign(asdl_seq * targets, expr_ty value, 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) _Py_For(a0, a1, a2, a3, a4, a5, a6, a7, a8)
                orelse, 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) _Py_AsyncFor(a0, a1, a2, a3, a4, a5, a6, a7, a8)
                     orelse, int lineno, int col_offset, int end_lineno, int
                     end_col_offset, PyArena *arena);
#define With(a0, a1, a2, a3, a4, a5, a6) _Py_With(a0, a1, a2, a3, a4, a5, a6)
stmt_ty _Py_With(asdl_seq * items, asdl_seq * body, int lineno, int col_offset,
                 int end_lineno, int end_col_offset, PyArena *arena);
#define AsyncWith(a0, a1, a2, a3, a4, a5, a6) _Py_AsyncWith(a0, a1, a2, a3, a4, a5, a6)
stmt_ty _Py_AsyncWith(asdl_seq * items, asdl_seq * body, int lineno, int
                      col_offset, int end_lineno, int end_col_offset, PyArena
                      *arena);
#define arg(a0, a1, a2, a3, a4, a5, a6) _Py_arg(a0, a1, a2, a3, a4, a5, a6)
arg_ty _Py_arg(identifier arg, expr_ty annotation, int lineno, int col_offset,
               int end_lineno, int end_col_offset, PyArena *arena);
/* These definitions must match corresponding definitions in graminit.h.
   There's code in compile.c that checks that they are the same. */
#define ERRORTOKEN      55
#define N_TOKENS        59
def parse(source, filename='<unknown>', mode='exec'):
    return compile(source, filename, mode, PyCF_ONLY_AST)
        self.assertEqual(v.names_with_seq, ['Module', 'Interactive', 'Suite'])
        x = ast.Module(body)
        m = ast.Module([ast.Expr(ast.expr(**pos), **pos)])
        m = ast.Module([ast.Expr(ast.Name(42, ast.Load()))])
            "keywords=[]))])"
            "Constant('and cheese')], []))])"
            "lineno=1, col_offset=0, end_lineno=1, end_col_offset=24)])"
            "end_col_offset=0), lineno=1, col_offset=0, end_lineno=1, end_col_offset=0)])"
        mod = ast.Module(body)
        mod = ast.Module(body)
        mod = ast.Module([ast.Expr(node)])
        mod = ast.Module([stmt])
#### EVERYTHING BELOW IS GENERATED #####
('Module', [('Expr', (1, 0), ('Constant', (1, 0), None))]),
('Module', [('Expr', (1, 0), ('Constant', (1, 0), 'module docstring'))]),
('Module', [('FunctionDef', (1, 0), 'f', ('arguments', [], None, [], [], None, []), [('Pass', (1, 9))], [], None)]),
('Module', [('FunctionDef', (1, 0), 'f', ('arguments', [], None, [], [], None, []), [('Expr', (1, 9), ('Constant', (1, 9), 'function docstring'))], [], None)]),
('Module', [('FunctionDef', (1, 0), 'f', ('arguments', [('arg', (1, 6), 'a', None)], None, [], [], None, []), [('Pass', (1, 10))], [], None)]),
('Module', [('FunctionDef', (1, 0), 'f', ('arguments', [('arg', (1, 6), 'a', None)], None, [], [], None, [('Constant', (1, 8), 0)]), [('Pass', (1, 12))], [], None)]),
('Module', [('FunctionDef', (1, 0), 'f', ('arguments', [], ('arg', (1, 7), 'args', None), [], [], None, []), [('Pass', (1, 14))], [], None)]),
('Module', [('FunctionDef', (1, 0), 'f', ('arguments', [], None, [], [], ('arg', (1, 8), 'kwargs', None), []), [('Pass', (1, 17))], [], None)]),
('Module', [('FunctionDef', (1, 0), 'f', ('arguments', [('arg', (1, 6), 'a', None), ('arg', (1, 9), 'b', None), ('arg', (1, 14), 'c', None), ('arg', (1, 22), 'd', None), ('arg', (1, 28), 'e', None)], ('arg', (1, 35), 'args', None), [('arg', (1, 41), 'f', None)], [('Constant', (1, 43), 42)], ('arg', (1, 49), 'kwargs', None), [('Constant', (1, 11), 1), ('Constant', (1, 16), None), ('List', (1, 24), [], ('Load',)), ('Dict', (1, 30), [], [])]), [('Expr', (1, 58), ('Constant', (1, 58), 'doc for f()'))], [], None)]),
('Module', [('ClassDef', (1, 0), 'C', [], [], [('Pass', (1, 8))], [])]),
('Module', [('ClassDef', (1, 0), 'C', [], [], [('Expr', (1, 9), ('Constant', (1, 9), 'docstring for class C'))], [])]),
('Module', [('ClassDef', (1, 0), 'C', [('Name', (1, 8), 'object', ('Load',))], [], [('Pass', (1, 17))], [])]),
('Module', [('FunctionDef', (1, 0), 'f', ('arguments', [], None, [], [], None, []), [('Return', (1, 8), ('Constant', (1, 15), 1))], [], None)]),
('Module', [('Delete', (1, 0), [('Name', (1, 4), 'v', ('Del',))])]),
('Module', [('Assign', (1, 0), [('Name', (1, 0), 'v', ('Store',))], ('Constant', (1, 4), 1))]),
('Module', [('Assign', (1, 0), [('Tuple', (1, 0), [('Name', (1, 0), 'a', ('Store',)), ('Name', (1, 2), 'b', ('Store',))], ('Store',))], ('Name', (1, 6), 'c', ('Load',)))]),
('Module', [('Assign', (1, 0), [('Tuple', (1, 0), [('Name', (1, 1), 'a', ('Store',)), ('Name', (1, 3), 'b', ('Store',))], ('Store',))], ('Name', (1, 8), 'c', ('Load',)))]),
('Module', [('Assign', (1, 0), [('List', (1, 0), [('Name', (1, 1), 'a', ('Store',)), ('Name', (1, 3), 'b', ('Store',))], ('Store',))], ('Name', (1, 8), 'c', ('Load',)))]),
('Module', [('AugAssign', (1, 0), ('Name', (1, 0), 'v', ('Store',)), ('Add',), ('Constant', (1, 5), 1))]),
('Module', [('For', (1, 0), ('Name', (1, 4), 'v', ('Store',)), ('Name', (1, 9), 'v', ('Load',)), [('Pass', (1, 11))], [])]),
('Module', [('While', (1, 0), ('Name', (1, 6), 'v', ('Load',)), [('Pass', (1, 8))], [])]),
('Module', [('If', (1, 0), ('Name', (1, 3), 'v', ('Load',)), [('Pass', (1, 5))], [])]),
('Module', [('With', (1, 0), [('withitem', ('Name', (1, 5), 'x', ('Load',)), ('Name', (1, 10), 'y', ('Store',)))], [('Pass', (1, 13))])]),
('Module', [('With', (1, 0), [('withitem', ('Name', (1, 5), 'x', ('Load',)), ('Name', (1, 10), 'y', ('Store',))), ('withitem', ('Name', (1, 13), 'z', ('Load',)), ('Name', (1, 18), 'q', ('Store',)))], [('Pass', (1, 21))])]),
('Module', [('Raise', (1, 0), ('Call', (1, 6), ('Name', (1, 6), 'Exception', ('Load',)), [('Constant', (1, 16), 'string')], []), None)]),
('Module', [('Try', (1, 0), [('Pass', (2, 2))], [('ExceptHandler', (3, 0), ('Name', (3, 7), 'Exception', ('Load',)), None, [('Pass', (4, 2))])], [], [])]),
('Module', [('Try', (1, 0), [('Pass', (2, 2))], [], [], [('Pass', (4, 2))])]),
('Module', [('Assert', (1, 0), ('Name', (1, 7), 'v', ('Load',)), None)]),
('Module', [('Import', (1, 0), [('alias', 'sys', None)])]),
('Module', [('ImportFrom', (1, 0), 'sys', [('alias', 'v', None)], 0)]),
('Module', [('Global', (1, 0), ['v'])]),
('Module', [('Expr', (1, 0), ('Constant', (1, 0), 1))]),
('Module', [('Pass', (1, 0))]),
('Module', [('For', (1, 0), ('Name', (1, 4), 'v', ('Store',)), ('Name', (1, 9), 'v', ('Load',)), [('Break', (1, 11))], [])]),
('Module', [('For', (1, 0), ('Name', (1, 4), 'v', ('Store',)), ('Name', (1, 9), 'v', ('Load',)), [('Continue', (1, 11))], [])]),
('Module', [('For', (1, 0), ('Tuple', (1, 4), [('Name', (1, 4), 'a', ('Store',)), ('Name', (1, 6), 'b', ('Store',))], ('Store',)), ('Name', (1, 11), 'c', ('Load',)), [('Pass', (1, 14))], [])]),
('Module', [('For', (1, 0), ('Tuple', (1, 4), [('Name', (1, 5), 'a', ('Store',)), ('Name', (1, 7), 'b', ('Store',))], ('Store',)), ('Name', (1, 13), 'c', ('Load',)), [('Pass', (1, 16))], [])]),
('Module', [('For', (1, 0), ('List', (1, 4), [('Name', (1, 5), 'a', ('Store',)), ('Name', (1, 7), 'b', ('Store',))], ('Store',)), ('Name', (1, 13), 'c', ('Load',)), [('Pass', (1, 16))], [])]),
('Module', [('Expr', (1, 0), ('GeneratorExp', (1, 0), ('Tuple', (2, 4), [('Name', (3, 4), 'Aa', ('Load',)), ('Name', (5, 7), 'Bb', ('Load',))], ('Load',)), [('comprehension', ('Tuple', (8, 4), [('Name', (8, 4), 'Aa', ('Store',)), ('Name', (10, 4), 'Bb', ('Store',))], ('Store',)), ('Name', (10, 10), 'Cc', ('Load',)), [], 0)]))]),
('Module', [('Expr', (1, 0), ('DictComp', (1, 0), ('Name', (1, 1), 'a', ('Load',)), ('Name', (1, 5), 'b', ('Load',)), [('comprehension', ('Name', (1, 11), 'w', ('Store',)), ('Name', (1, 16), 'x', ('Load',)), [], 0), ('comprehension', ('Name', (1, 22), 'm', ('Store',)), ('Name', (1, 27), 'p', ('Load',)), [('Name', (1, 32), 'g', ('Load',))], 0)]))]),
('Module', [('Expr', (1, 0), ('DictComp', (1, 0), ('Name', (1, 1), 'a', ('Load',)), ('Name', (1, 5), 'b', ('Load',)), [('comprehension', ('Tuple', (1, 11), [('Name', (1, 11), 'v', ('Store',)), ('Name', (1, 13), 'w', ('Store',))], ('Store',)), ('Name', (1, 18), 'x', ('Load',)), [], 0)]))]),
('Module', [('Expr', (1, 0), ('SetComp', (1, 0), ('Name', (1, 1), 'r', ('Load',)), [('comprehension', ('Name', (1, 7), 'l', ('Store',)), ('Name', (1, 12), 'x', ('Load',)), [('Name', (1, 17), 'g', ('Load',))], 0)]))]),
('Module', [('Expr', (1, 0), ('SetComp', (1, 0), ('Name', (1, 1), 'r', ('Load',)), [('comprehension', ('Tuple', (1, 7), [('Name', (1, 7), 'l', ('Store',)), ('Name', (1, 9), 'm', ('Store',))], ('Store',)), ('Name', (1, 14), 'x', ('Load',)), [], 0)]))]),
('Module', [('AsyncFunctionDef', (1, 0), 'f', ('arguments', [], None, [], [], None, []), [('Expr', (2, 1), ('Constant', (2, 1), 'async function')), ('Expr', (3, 1), ('Await', (3, 1), ('Call', (3, 7), ('Name', (3, 7), 'something', ('Load',)), [], [])))], [], None)]),
('Module', [('AsyncFunctionDef', (1, 0), 'f', ('arguments', [], None, [], [], None, []), [('AsyncFor', (2, 1), ('Name', (2, 11), 'e', ('Store',)), ('Name', (2, 16), 'i', ('Load',)), [('Expr', (2, 19), ('Constant', (2, 19), 1))], [('Expr', (3, 7), ('Constant', (3, 7), 2))])], [], None)]),
('Module', [('AsyncFunctionDef', (1, 0), 'f', ('arguments', [], None, [], [], None, []), [('AsyncWith', (2, 1), [('withitem', ('Name', (2, 12), 'a', ('Load',)), ('Name', (2, 17), 'b', ('Store',)))], [('Expr', (2, 20), ('Constant', (2, 20), 1))])], [], None)]),
('Module', [('Expr', (1, 0), ('Dict', (1, 0), [None, ('Constant', (1, 10), 2)], [('Dict', (1, 3), [('Constant', (1, 4), 1)], [('Constant', (1, 6), 2)]), ('Constant', (1, 12), 3)]))]),
('Module', [('Expr', (1, 0), ('Set', (1, 0), [('Starred', (1, 1), ('Set', (1, 2), [('Constant', (1, 3), 1), ('Constant', (1, 6), 2)]), ('Load',)), ('Constant', (1, 10), 3)]))]),
('Module', [('AsyncFunctionDef', (1, 0), 'f', ('arguments', [], None, [], [], None, []), [('Expr', (2, 1), ('ListComp', (2, 1), ('Name', (2, 2), 'i', ('Load',)), [('comprehension', ('Name', (2, 14), 'b', ('Store',)), ('Name', (2, 19), 'c', ('Load',)), [], 1)]))], [], None)]),
('Module', [('FunctionDef', (3, 0), 'f', ('arguments', [], None, [], [], None, []), [('Pass', (3, 9))], [('Name', (1, 1), 'deco1', ('Load',)), ('Call', (2, 0), ('Name', (2, 1), 'deco2', ('Load',)), [], [])], None)]),
('Module', [('AsyncFunctionDef', (3, 0), 'f', ('arguments', [], None, [], [], None, []), [('Pass', (3, 15))], [('Name', (1, 1), 'deco1', ('Load',)), ('Call', (2, 0), ('Name', (2, 1), 'deco2', ('Load',)), [], [])], None)]),
('Module', [('ClassDef', (3, 0), 'C', [], [], [('Pass', (3, 9))], [('Name', (1, 1), 'deco1', ('Load',)), ('Call', (2, 0), ('Name', (2, 1), 'deco2', ('Load',)), [], [])])]),
('Module', [('FunctionDef', (2, 0), 'f', ('arguments', [], None, [], [], None, []), [('Pass', (2, 9))], [('Call', (1, 1), ('Name', (1, 1), 'deco', ('Load',)), [('GeneratorExp', (1, 5), ('Name', (1, 6), 'a', ('Load',)), [('comprehension', ('Name', (1, 12), 'a', ('Store',)), ('Name', (1, 17), 'b', ('Load',)), [], 0)])], [])], None)]),
ERRORTOKEN = 55
COMMENT = 56
NL = 57
ENCODING = 58
N_TOKENS = 59
    mod = Module(stmt* body)
                       stmt* body, expr* decorator_list, expr? returns)
                             stmt* body, expr* decorator_list, expr? returns)
          | Assign(expr* targets, expr value)
          | For(expr target, expr iter, stmt* body, stmt* orelse)
          | AsyncFor(expr target, expr iter, stmt* body, stmt* orelse)
          | With(withitem* items, stmt* body)
          | AsyncWith(withitem* items, stmt* body)
    arg = (identifier arg, expr? annotation)
    char *req_name[] = {"Module", "Expression", "Interactive"};
    assert(0 <= mode && mode <= 2);
                    dfa *d1 = PyGrammar_FindDFA(
                    D(printf(" Push ...\n"));
    /* Skip comment */
_Py_IDENTIFIER(returns);
    Module_type = make_type("Module", mod_type, Module_fields, 1);
                                 5);
                                      AsyncFunctionDef_fields, 5);
    Assign_type = make_type("Assign", stmt_type, Assign_fields, 2);
    For_type = make_type("For", stmt_type, For_fields, 4);
    AsyncFor_type = make_type("AsyncFor", stmt_type, AsyncFor_fields, 4);
    With_type = make_type("With", stmt_type, With_fields, 2);
    AsyncWith_type = make_type("AsyncWith", stmt_type, AsyncWith_fields, 2);
    arg_type = make_type("arg", &AST_type, arg_fields, 2);
Module(asdl_seq * body, PyArena *arena)
            decorator_list, expr_ty returns, int lineno, int col_offset, int
            end_lineno, int end_col_offset, PyArena *arena)
                 * decorator_list, expr_ty returns, int lineno, int col_offset,
                 int end_lineno, int end_col_offset, PyArena *arena)
Assign(asdl_seq * targets, expr_ty value, int lineno, int col_offset, int
       end_lineno, int end_col_offset, PyArena *arena)
For(expr_ty target, expr_ty iter, asdl_seq * body, asdl_seq * orelse, int
    lineno, int col_offset, int end_lineno, int end_col_offset, PyArena *arena)
AsyncFor(expr_ty target, expr_ty iter, asdl_seq * body, asdl_seq * orelse, int
         lineno, int col_offset, int end_lineno, int end_col_offset, PyArena
         *arena)
With(asdl_seq * items, asdl_seq * body, int lineno, int col_offset, int
     end_lineno, int end_col_offset, PyArena *arena)
AsyncWith(asdl_seq * items, asdl_seq * body, int lineno, int col_offset, int
          end_lineno, int end_col_offset, PyArena *arena)
arg(identifier arg, expr_ty annotation, int lineno, int col_offset, int
    end_lineno, int end_col_offset, PyArena *arena)
        *out = Module(body, arena);
        *out = FunctionDef(name, args, body, decorator_list, returns, lineno,
                           col_offset, end_lineno, end_col_offset, arena);
                                lineno, col_offset, end_lineno, end_col_offset,
                                arena);
        *out = Assign(targets, value, lineno, col_offset, end_lineno,
                      end_col_offset, arena);
        *out = For(target, iter, body, orelse, lineno, col_offset, end_lineno,
                   end_col_offset, arena);
        *out = AsyncFor(target, iter, body, orelse, lineno, col_offset,
                        end_lineno, end_col_offset, arena);
        *out = With(items, body, lineno, col_offset, end_lineno,
        *out = AsyncWith(items, body, lineno, col_offset, end_lineno,
                         end_col_offset, arena);
    *out = arg(arg, annotation, lineno, col_offset, end_lineno, end_col_offset,
               arena);
    char *req_name[] = {"Module", "Expression", "Interactive"};
    assert(0 <= mode && mode <= 2);
                for (i = 2; i < (NCH(n) - 1); i++)
            res = Module(stmts, arena);
    ret = arg(name, annotation, LINENO(n), n->n_col_offset,
                arg = arg(argname, annotation, LINENO(ch), ch->n_col_offset,
                i += 2; /* the name and the comma */
                i += 2; /* the name and the comma */
                    (i+2 == NCH(n) && TYPE(CHILD(n, i+1)) == COMMA)) {
                        "named arguments must follow bare *");
                    i += 3;
                i += 3;
    /* funcdef: 'def' NAME parameters ['->' test] ':' suite */
        return AsyncFunctionDef(name, args, body, decorator_seq, returns,
        return FunctionDef(name, args, body, decorator_seq, returns,
                            "dict comprehension");
                                "positional argument follows "
                                "keyword argument unpacking");
                                "positional argument follows "
                                "keyword argument");
                            "iterable argument unpacking follows "
                            "keyword argument unpacking");
                                "positional argument follows "
                                "keyword argument unpacking");
                                "positional argument follows "
                                "keyword argument");
                                "keyword argument repeated");
                            ('=' (yield_expr|testlist_star_expr))*)
       annassign: ':' test ['=' test]
       testlist_star_expr: (test|star_expr) (',' test|star_expr)* [',']
       augassign: '+=' | '-=' | '*=' | '@=' | '/=' | '%=' | '&=' | '|=' | '^='
                | '<<=' | '>>=' | '**=' | '//='
    if (NCH(n) == 1) {
        int i;
        targets = _Py_asdl_seq_new(NCH(n) / 2, c->c_arena);
        for (i = 0; i < NCH(n) - 2; i += 2) {
        value = CHILD(n, NCH(n) - 1);
        return Assign(targets, expression, LINENO(n), n->n_col_offset,
                ast_error(c, n, "trailing comma not allowed without"
                             " surrounding parentheses");
    /* suite: simple_stmt | NEWLINE INDENT stmt+ DEDENT */
    REQ(n, suite);
        for (i = 2; i < (NCH(n) - 1); i++) {
    /* for_stmt: 'for' exprlist 'in' testlist ':' suite ['else' ':' suite] */
    if (NCH(n) == 9) {
        seq = ast_for_suite(c, CHILD(n, 8));
    suite_seq = ast_for_suite(c, CHILD(n, 5));
        return AsyncFor(target, expression, suite_seq, seq,
        return For(target, expression, suite_seq, seq,
/* with_stmt: 'with' with_item (',' with_item)* ':' suite */
    int i, n_items, end_lineno, end_col_offset;
    n_items = (NCH(n) - 2) / 2;
    for (i = 1; i < NCH(n) - 2; i += 2) {
        return AsyncWith(items, body, LINENO(n0), n0->n_col_offset,
        return With(items, body, LINENO(n), n->n_col_offset,
            ast_error(c, n, "f-string expression part "
                            "cannot include a backslash");
            ast_error(c, n, "f-string: invalid conversion character: "
                            "expected 's', 'r', or 'a'");
                ast_error(c, n, "bytes can only contain ASCII "
    int start[] = {Py_file_input, Py_eval_input, Py_single_input};
        ~(PyCF_MASK | PyCF_MASK_OBSOLETE | PyCF_DONT_IMPLY_DEDENT | PyCF_ONLY_AST))
        PyErr_SetString(PyExc_ValueError,
                        "compile() mode must be 'exec', 'eval' or 'single'");
static arc arcs_7_5[1] = {
    {0, 7},
static state states_7[8] = {
    {1, arcs_7_5},
    {29, 2},
    {30, 1},
    {33, 2},
    {34, 3},
static arc arcs_9_1[3] = {
    {31, 4},
    {32, 5},
static arc arcs_9_2[3] = {
    {30, 6},
    {32, 7},
    {30, 8},
    {26, 9},
static arc arcs_9_5[4] = {
    {30, 10},
    {33, 11},
    {34, 3},
static arc arcs_9_6[2] = {
    {32, 7},
    {30, 12},
    {34, 3},
static arc arcs_9_8[2] = {
    {32, 13},
static arc arcs_9_9[2] = {
    {32, 5},
    {32, 5},
    {31, 4},
static arc arcs_9_11[3] = {
    {30, 14},
    {32, 15},
static arc arcs_9_12[3] = {
    {32, 7},
    {31, 16},
static arc arcs_9_13[1] = {
static arc arcs_9_14[2] = {
    {32, 15},
static arc arcs_9_15[3] = {
    {30, 17},
    {34, 3},
static arc arcs_9_16[1] = {
    {26, 6},
    {32, 15},
    {31, 18},
static arc arcs_9_18[1] = {
    {26, 14},
static state states_9[19] = {
    {3, arcs_9_1},
    {3, arcs_9_2},
    {4, arcs_9_5},
    {2, arcs_9_6},
    {2, arcs_9_8},
    {2, arcs_9_9},
    {3, arcs_9_11},
    {3, arcs_9_12},
    {1, arcs_9_13},
    {2, arcs_9_14},
    {3, arcs_9_15},
    {1, arcs_9_16},
    {1, arcs_9_18},
    {36, 1},
    {33, 2},
    {34, 3},
    {31, 4},
    {32, 5},
    {36, 6},
    {32, 7},
    {36, 8},
    {36, 10},
    {33, 11},
    {34, 3},
    {32, 7},
    {36, 12},
    {34, 3},
    {32, 13},
    {32, 5},
    {32, 5},
    {31, 4},
    {36, 14},
    {32, 15},
    {32, 7},
    {31, 16},
    {32, 15},
    {36, 17},
    {34, 3},
    {32, 15},
    {31, 18},
    {37, 1},
    {38, 2},
    {37, 1},
    {39, 1},
    {47, 1},
    {48, 2},
    {49, 3},
    {31, 4},
    {50, 2},
    {50, 5},
    {47, 5},
static arc arcs_16_5[2] = {
    {31, 4},
    {2, arcs_16_5},
    {31, 3},
    {50, 4},
    {51, 1},
    {32, 2},
    {51, 1},
    {52, 1},
    {65, 1},
    {66, 2},
    {67, 1},
    {68, 1},
    {73, 1},
    {74, 1},
    {75, 1},
    {47, 2},
    {50, 1},
    {76, 1},
    {77, 3},
    {78, 1},
    {80, 1},
    {81, 2},
    {77, 1},
    {82, 2},
    {82, 2},
    {80, 4},
    {80, 4},
    {33, 5},
    {84, 5},
    {84, 7},
    {86, 2},
    {86, 2},
    {85, 1},
    {32, 2},
    {85, 1},
    {87, 1},
    {32, 0},
    {82, 0},
    {88, 1},
    {32, 1},
    {89, 1},
    {32, 1},
    {90, 1},
    {32, 3},
    {91, 1},
    {96, 1},
    {95, 2},
    {93, 2},
    {97, 1},
    {98, 2},
    {28, 4},
    {99, 1},
    {100, 5},
    {28, 7},
    {101, 1},
    {28, 4},
    {100, 5},
    {28, 7},
    {102, 1},
    {66, 2},
    {103, 3},
static arc arcs_43_5[1] = {
static arc arcs_43_6[2] = {
    {0, 6},
static arc arcs_43_7[1] = {
    {27, 8},
    {28, 9},
    {0, 9},
static state states_43[10] = {
    {1, arcs_43_5},
    {2, arcs_43_6},
    {1, arcs_43_7},
    {104, 1},
    {28, 3},
    {105, 4},
    {106, 5},
    {28, 8},
    {28, 9},
    {105, 4},
    {100, 10},
    {106, 5},
    {28, 12},
    {106, 5},
    {107, 1},
    {108, 2},
    {32, 1},
static arc arcs_45_3[1] = {
    {0, 4},
static state states_45[5] = {
    {1, arcs_45_3},
    {86, 2},
    {109, 3},
    {110, 1},
    {86, 3},
    {111, 3},
    {112, 1},
    {113, 2},
    {114, 1},
    {115, 2},
    {97, 3},
    {114, 4},
    {100, 5},
    {114, 1},
    {117, 1},
    {118, 1},
    {35, 2},
    {118, 1},
    {35, 2},
    {116, 4},
    {119, 1},
    {120, 0},
    {121, 1},
    {122, 0},
    {123, 1},
    {124, 2},
    {121, 2},
    {109, 1},
    {125, 0},
    {126, 1},
    {127, 1},
    {103, 1},
    {123, 2},
    {133, 3},
    {103, 1},
    {123, 1},
    {33, 1},
    {109, 2},
    {134, 1},
    {135, 0},
    {136, 1},
    {137, 0},
    {138, 1},
    {139, 0},
    {140, 1},
    {141, 0},
    {142, 0},
    {143, 1},
    {144, 0},
    {145, 0},
    {146, 1},
    {33, 0},
    {147, 0},
    {148, 0},
    {144, 1},
    {145, 1},
    {150, 1},
    {151, 2},
    {146, 2},
    {152, 1},
    {34, 2},
    {146, 3},
    {153, 1},
    {154, 2},
    {154, 2},
    {155, 2},
    {157, 2},
    {159, 3},
    {162, 4},
    {163, 5},
    {83, 4},
    {165, 4},
    {50, 6},
    {156, 6},
    {156, 7},
    {158, 4},
    {160, 8},
    {161, 4},
    {163, 5},
    {158, 4},
    {161, 4},
    {98, 1},
    {51, 1},
    {167, 2},
    {32, 3},
    {98, 4},
    {51, 4},
    {32, 3},
    {157, 2},
    {82, 3},
    {168, 6},
    {158, 5},
    {169, 1},
    {32, 2},
    {169, 1},
    {170, 4},
    {170, 4},
    {109, 1},
    {51, 1},
    {32, 2},
    {109, 1},
    {51, 1},
    {32, 2},
    {34, 2},
    {51, 3},
    {167, 5},
    {32, 6},
    {109, 7},
    {167, 5},
    {32, 6},
    {51, 8},
    {167, 5},
    {32, 9},
    {32, 6},
    {34, 11},
    {109, 13},
    {32, 9},
    {171, 1},
    {28, 7},
    {172, 1},
    {32, 2},
    {172, 1},
    {33, 2},
    {167, 3},
    {113, 2},
    {31, 2},
    {167, 1},
    {174, 1},
    {102, 1},
    {66, 2},
    {103, 3},
    {114, 4},
    {173, 5},
    {175, 2},
    {175, 2},
    {97, 1},
    {116, 2},
    {173, 3},
    {177, 1},
    {178, 2},
    {77, 1},
    {47, 2},
static dfa dfas[88] = {
     "\004\050\340\000\002\000\000\000\012\076\011\007\142\011\100\010\000\000\103\242\174\010\002"},
     "\204\050\340\000\002\000\000\000\012\076\011\007\142\011\100\010\000\000\103\242\174\010\002"},
     "\000\040\200\000\000\000\000\000\000\000\010\000\000\000\100\010\000\000\103\242\174\000\000"},
    {263, "funcdef", 0, 8, states_7,
    {265, "typedargslist", 0, 19, states_9,
     "\000\000\200\000\006\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
     "\000\000\200\000\006\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
     "\000\050\340\000\002\000\000\000\012\076\011\007\142\011\100\010\000\000\103\242\174\010\002"},
     "\000\040\200\000\002\000\000\000\012\076\011\007\000\000\100\010\000\000\103\242\174\000\002"},
     "\000\040\200\000\002\000\000\000\012\076\011\007\000\000\100\010\000\000\103\242\174\000\002"},
     "\000\040\200\000\002\000\000\000\000\000\010\000\000\000\100\010\000\000\103\242\174\000\000"},
     "\000\040\200\000\002\000\000\000\000\000\010\000\000\000\100\010\000\000\103\242\174\000\000"},
     "\000\000\000\000\000\000\360\377\001\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
     "\000\000\000\000\000\000\000\000\002\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
     "\000\000\000\000\000\000\000\000\010\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
     "\000\000\000\000\000\000\000\000\000\036\000\000\000\000\000\000\000\000\000\000\000\000\002"},
     "\000\000\000\000\000\000\000\000\000\002\000\000\000\000\000\000\000\000\000\000\000\000\000"},
    {280, "continue_stmt", 0, 2, states_24,
    {281, "return_stmt", 0, 3, states_25,
     "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\002"},
     "\000\000\000\000\000\000\000\000\000\020\000\000\000\000\000\000\000\000\000\000\000\000\000"},
     "\000\000\000\000\000\000\000\000\000\040\001\000\000\000\000\000\000\000\000\000\000\000\000"},
     "\000\000\000\000\000\000\000\000\000\000\001\000\000\000\000\000\000\000\000\000\000\000\000"},
     "\000\000\000\000\000\000\000\000\000\040\000\000\000\000\000\000\000\000\000\000\000\000\000"},
     "\000\000\000\000\000\000\000\000\000\000\000\001\000\000\000\000\000\000\000\000\000\000\000"},
    {293, "nonlocal_stmt", 0, 3, states_37,
    {294, "assert_stmt", 0, 5, states_38,
     "\000\010\140\000\000\000\000\000\000\000\000\000\142\011\000\000\000\000\000\000\000\010\000"},
     "\000\000\000\000\000\000\000\000\000\000\000\000\002\000\000\000\000\000\000\000\000\000\000"},
     "\000\000\000\000\000\000\000\000\000\000\000\000\040\000\000\000\000\000\000\000\000\000\000"},
    {299, "for_stmt", 0, 10, states_43,
     "\000\000\000\000\000\000\000\000\000\000\000\000\100\000\000\000\000\000\000\000\000\000\000"},
    {300, "try_stmt", 0, 13, states_44,
    {301, "with_stmt", 0, 5, states_45,
     "\000\000\000\000\000\000\000\000\000\000\000\000\000\010\000\000\000\000\000\000\000\000\000"},
     "\000\040\200\000\000\000\000\000\000\000\010\000\000\000\100\010\000\000\103\242\174\000\000"},
     "\000\000\000\000\000\000\000\000\000\000\000\000\000\100\000\000\000\000\000\000\000\000\000"},
     "\004\040\200\000\002\000\000\000\012\076\011\007\000\000\100\010\000\000\103\242\174\000\002"},
     "\000\040\200\000\000\000\000\000\000\000\010\000\000\000\100\010\000\000\103\242\174\000\000"},
     "\000\040\200\000\000\000\000\000\000\000\010\000\000\000\100\010\000\000\103\242\174\000\000"},
     "\000\040\200\000\000\000\000\000\000\000\010\000\000\000\100\010\000\000\103\242\174\000\000"},
     "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\100\000\000\000\000\000\000\000\000"},
     "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\100\000\000\000\000\000\000\000\000"},
     "\000\040\200\000\000\000\000\000\000\000\010\000\000\000\000\010\000\000\103\242\174\000\000"},
     "\000\040\200\000\000\000\000\000\000\000\010\000\000\000\000\010\000\000\103\242\174\000\000"},
     "\000\040\200\000\000\000\000\000\000\000\010\000\000\000\000\010\000\000\103\242\174\000\000"},
     "\000\040\200\000\000\000\000\000\000\000\010\000\000\000\000\000\000\000\103\242\174\000\000"},
     "\000\000\000\000\000\000\000\000\000\000\000\000\200\000\000\310\077\000\000\000\000\000\000"},
     "\000\000\000\000\002\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
     "\000\040\200\000\000\000\000\000\000\000\010\000\000\000\000\000\000\000\103\242\174\000\000"},
     "\000\040\200\000\000\000\000\000\000\000\010\000\000\000\000\000\000\000\103\242\174\000\000"},
     "\000\040\200\000\000\000\000\000\000\000\010\000\000\000\000\000\000\000\103\242\174\000\000"},
     "\000\040\200\000\000\000\000\000\000\000\010\000\000\000\000\000\000\000\103\242\174\000\000"},
     "\000\040\200\000\000\000\000\000\000\000\010\000\000\000\000\000\000\000\103\242\174\000\000"},
     "\000\040\200\000\000\000\000\000\000\000\010\000\000\000\000\000\000\000\103\242\174\000\000"},
     "\000\040\200\000\000\000\000\000\000\000\010\000\000\000\000\000\000\000\103\242\174\000\000"},
     "\000\040\200\000\000\000\000\000\000\000\010\000\000\000\000\000\000\000\000\242\174\000\000"},
     "\000\040\200\000\000\000\000\000\000\000\010\000\000\000\000\000\000\000\000\242\174\000\000"},
     "\000\040\200\000\000\000\000\000\000\000\010\000\000\000\000\000\000\000\000\240\174\000\000"},
     "\000\040\200\000\002\000\000\000\000\000\010\000\000\000\100\010\000\000\103\242\174\000\000"},
     "\000\040\000\000\000\000\000\000\000\000\004\000\000\000\000\000\000\000\000\040\000\000\000"},
     "\000\040\200\010\000\000\000\000\000\000\010\000\000\000\100\010\000\000\103\242\174\000\000"},
     "\000\040\200\010\000\000\000\000\000\000\010\000\000\000\100\010\000\000\103\242\174\000\000"},
     "\000\040\200\000\002\000\000\000\000\000\010\000\000\000\000\000\000\000\103\242\174\000\000"},
     "\000\040\200\000\000\000\000\000\000\000\010\000\000\000\100\010\000\000\103\242\174\000\000"},
     "\000\040\200\000\006\000\000\000\000\000\010\000\000\000\100\010\000\000\103\242\174\000\000"},
     "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\010\000"},
     "\000\040\200\000\006\000\000\000\000\000\010\000\000\000\100\010\000\000\103\242\174\000\000"},
     "\000\040\200\000\006\000\000\000\000\000\010\000\000\000\100\010\000\000\103\242\174\000\000"},
     "\000\000\040\000\000\000\000\000\000\000\000\000\102\000\000\000\000\000\000\000\000\000\000"},
     "\000\000\000\000\000\000\000\000\000\000\000\000\100\000\000\000\000\000\000\000\000\000\000"},
     "\000\000\040\000\000\000\000\000\000\000\000\000\100\000\000\000\000\000\000\000\000\000\000"},
     "\000\000\000\000\000\000\000\000\000\000\000\000\002\000\000\000\000\000\000\000\000\000\000"},
     "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\002"},
     "\000\040\200\000\002\000\000\000\000\040\010\000\000\000\100\010\000\000\103\242\174\000\000"},
static label labels[179] = {
    {304, 0},
    88,
    {179, labels},

Fixed code:
.. function:: parse(source, filename='<unknown>', mode='exec', *, type_comments=False)
   If ``type_comments=True`` is given, the parser is modified to check
   and return type comments as specified by :pep:`484` and :pep:`526`.
   This is equivalent to adding :data:`ast.PyCF_TYPE_COMMENTS` to the
   flags passed to :func:`compile()`.  This will report syntax errors
   for misplaced type comments.  Without this flag, type comments will
   be ignored, and the ``type_comment`` field on selected AST nodes
   will always be ``None``.  In addition, the locations of ``# type:
   ignore`` comments will be returned as the ``type_ignores``
   attribute of :class:`Module` (otherwise it is always an empty list).

   In addition, if ``mode`` is ``'func_type'``, the input syntax is
   modified to correspond to :pep:`484` "signature type comments",
   e.g. ``(str, int) -> List[str]``.

   .. versionchanged:: 3.8
      Added ``type_comments=True`` and ``mode='func_type'``.

.. data:: TYPE_IGNORE

.. data:: TYPE_COMMENT

.. data:: TYPE_COMMENT

   Token value indicating that a type comment was recognized.  Such
   tokens are only produced when :func:`ast.parse()` is invoked with
   ``type_comments=True``.



.. versionchanged:: 3.8
   Added :data:`TYPE_COMMENT`.
#       func_type_input is a PEP 484 Python 2 function type comment
# NB: due to the way TYPE_COMMENT is tokenized it will always be followed by a NEWLINE
funcdef: 'def' NAME parameters ['->' test] ':' [TYPE_COMMENT] func_body_suite
typedargslist: (tfpdef ['=' test] (',' [TYPE_COMMENT] tfpdef ['=' test])* (TYPE_COMMENT | [',' [TYPE_COMMENT] [
        '*' [tfpdef] (',' [TYPE_COMMENT] tfpdef ['=' test])* (TYPE_COMMENT | [',' [TYPE_COMMENT] ['**' tfpdef [','] [TYPE_COMMENT]]])
      | '**' tfpdef [','] [TYPE_COMMENT]]])
  | '*' [tfpdef] (',' [TYPE_COMMENT] tfpdef ['=' test])* (TYPE_COMMENT | [',' [TYPE_COMMENT] ['**' tfpdef [','] [TYPE_COMMENT]]])
  | '**' tfpdef [','] [TYPE_COMMENT])
                     [('=' (yield_expr|testlist_star_expr))+ [TYPE_COMMENT]] )
for_stmt: 'for' exprlist 'in' testlist ':' [TYPE_COMMENT] suite ['else' ':' suite]
with_stmt: 'with' with_item (',' with_item)*  ':' [TYPE_COMMENT] suite

# the TYPE_COMMENT in suites is only parsed for funcdefs,
# but can't go elsewhere due to ambiguity
func_body_suite: simple_stmt | NEWLINE [TYPE_COMMENT NEWLINE] INDENT stmt+ DEDENT

func_type_input: func_type NEWLINE* ENDMARKER
func_type: '(' [typelist] ')' '->' test
# typelist is a modified typedargslist (see above)
typelist: (test (',' test)* [','
       ['*' [test] (',' test)* [',' '**' test] | '**' test]]
     |  '*' [test] (',' test)* [',' '**' test] | '**' test)
TYPE_IGNORE
TYPE_COMMENT
typedef struct _type_ignore *type_ignore_ty;

                 FunctionType_kind=4, Suite_kind=5};
            asdl_seq *type_ignores;
        struct {
            asdl_seq *argtypes;
            expr_ty returns;
        } FunctionType;

            string type_comment;
            string type_comment;
            string type_comment;
            string type_comment;
            string type_comment;
            string type_comment;
            string type_comment;
    string type_comment;
enum _type_ignore_kind {TypeIgnore_kind=1};
struct _type_ignore {
    enum _type_ignore_kind kind;
    union {
        struct {
            int lineno;
        } TypeIgnore;

    } v;
};

#define Module(a0, a1, a2) _Py_Module(a0, a1, a2)
mod_ty _Py_Module(asdl_seq * body, asdl_seq * type_ignores, PyArena *arena);
#define FunctionType(a0, a1, a2) _Py_FunctionType(a0, a1, a2)
mod_ty _Py_FunctionType(asdl_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)
                        asdl_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)
                             string type_comment, 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);
#define For(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9) _Py_For(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9)
                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)
                     orelse, string type_comment, 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);
#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);
#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,
               PyArena *arena);
#define TypeIgnore(a0, a1) _Py_TypeIgnore(a0, a1)
type_ignore_ty _Py_TypeIgnore(int lineno, PyArena *arena);
#define PyCF_TYPE_COMMENTS 0x1000
/* These definitions must match corresponding definitions in graminit.h. */
#define Py_func_type_input 345
#define func_body_suite 344
#define func_type_input 345
#define func_type 346
#define typelist 347
#define PyPARSE_TYPE_COMMENTS 0x0040
#define TYPE_IGNORE     55
#define TYPE_COMMENT    56
#define ERRORTOKEN      57
#define N_TOKENS        61
def parse(source, filename='<unknown>', mode='exec', *, type_comments=False):
    Pass type_comments=True to get back type comments where the syntax allows.
    flags = PyCF_ONLY_AST
    if type_comments:
        flags |= PyCF_TYPE_COMMENTS
    return compile(source, filename, mode, flags)
func_body_suite = 344
func_type_input = 345
func_type = 346
typelist = 347
        self.assertEqual(v.names_with_seq,
                         ['Module', 'Module', 'Interactive', 'FunctionType', 'Suite'])
        x = ast.Module(body, [])
        m = ast.Module([ast.Expr(ast.expr(**pos), **pos)], [])
        m = ast.Module([ast.Expr(ast.Name(42, ast.Load()))], [])
            "keywords=[]))], type_ignores=[])"
            "Constant('and cheese')], []))], [])"
            "lineno=1, col_offset=0, end_lineno=1, end_col_offset=24)], type_ignores=[])"
            "end_col_offset=0), lineno=1, col_offset=0, end_lineno=1, end_col_offset=0)], "
            "type_ignores=[])"
        mod = ast.Module(body, [])
        mod = ast.Module(body, [])
        mod = ast.Module([ast.Expr(node)], [])
        mod = ast.Module([stmt], [])
#### EVERYTHING BELOW IS GENERATED BY python Lib/test/test_ast.py -g  #####
('Module', [('Expr', (1, 0), ('Constant', (1, 0), None))], []),
('Module', [('Expr', (1, 0), ('Constant', (1, 0), 'module docstring'))], []),
('Module', [('FunctionDef', (1, 0), 'f', ('arguments', [], None, [], [], None, []), [('Pass', (1, 9))], [], None, None)], []),
('Module', [('FunctionDef', (1, 0), 'f', ('arguments', [], None, [], [], None, []), [('Expr', (1, 9), ('Constant', (1, 9), 'function docstring'))], [], None, None)], []),
('Module', [('FunctionDef', (1, 0), 'f', ('arguments', [('arg', (1, 6), 'a', None, None)], None, [], [], None, []), [('Pass', (1, 10))], [], None, None)], []),
('Module', [('FunctionDef', (1, 0), 'f', ('arguments', [('arg', (1, 6), 'a', None, None)], None, [], [], None, [('Constant', (1, 8), 0)]), [('Pass', (1, 12))], [], None, None)], []),
('Module', [('FunctionDef', (1, 0), 'f', ('arguments', [], ('arg', (1, 7), 'args', None, None), [], [], None, []), [('Pass', (1, 14))], [], None, None)], []),
('Module', [('FunctionDef', (1, 0), 'f', ('arguments', [], None, [], [], ('arg', (1, 8), 'kwargs', None, None), []), [('Pass', (1, 17))], [], None, None)], []),
('Module', [('FunctionDef', (1, 0), 'f', ('arguments', [('arg', (1, 6), 'a', None, None), ('arg', (1, 9), 'b', None, None), ('arg', (1, 14), 'c', None, None), ('arg', (1, 22), 'd', None, None), ('arg', (1, 28), 'e', None, None)], ('arg', (1, 35), 'args', None, None), [('arg', (1, 41), 'f', None, None)], [('Constant', (1, 43), 42)], ('arg', (1, 49), 'kwargs', None, None), [('Constant', (1, 11), 1), ('Constant', (1, 16), None), ('List', (1, 24), [], ('Load',)), ('Dict', (1, 30), [], [])]), [('Expr', (1, 58), ('Constant', (1, 58), 'doc for f()'))], [], None, None)], []),
('Module', [('ClassDef', (1, 0), 'C', [], [], [('Pass', (1, 8))], [])], []),
('Module', [('ClassDef', (1, 0), 'C', [], [], [('Expr', (1, 9), ('Constant', (1, 9), 'docstring for class C'))], [])], []),
('Module', [('ClassDef', (1, 0), 'C', [('Name', (1, 8), 'object', ('Load',))], [], [('Pass', (1, 17))], [])], []),
('Module', [('FunctionDef', (1, 0), 'f', ('arguments', [], None, [], [], None, []), [('Return', (1, 8), ('Constant', (1, 15), 1))], [], None, None)], []),
('Module', [('Delete', (1, 0), [('Name', (1, 4), 'v', ('Del',))])], []),
('Module', [('Assign', (1, 0), [('Name', (1, 0), 'v', ('Store',))], ('Constant', (1, 4), 1), None)], []),
('Module', [('Assign', (1, 0), [('Tuple', (1, 0), [('Name', (1, 0), 'a', ('Store',)), ('Name', (1, 2), 'b', ('Store',))], ('Store',))], ('Name', (1, 6), 'c', ('Load',)), None)], []),
('Module', [('Assign', (1, 0), [('Tuple', (1, 0), [('Name', (1, 1), 'a', ('Store',)), ('Name', (1, 3), 'b', ('Store',))], ('Store',))], ('Name', (1, 8), 'c', ('Load',)), None)], []),
('Module', [('Assign', (1, 0), [('List', (1, 0), [('Name', (1, 1), 'a', ('Store',)), ('Name', (1, 3), 'b', ('Store',))], ('Store',))], ('Name', (1, 8), 'c', ('Load',)), None)], []),
('Module', [('AugAssign', (1, 0), ('Name', (1, 0), 'v', ('Store',)), ('Add',), ('Constant', (1, 5), 1))], []),
('Module', [('For', (1, 0), ('Name', (1, 4), 'v', ('Store',)), ('Name', (1, 9), 'v', ('Load',)), [('Pass', (1, 11))], [], None)], []),
('Module', [('While', (1, 0), ('Name', (1, 6), 'v', ('Load',)), [('Pass', (1, 8))], [])], []),
('Module', [('If', (1, 0), ('Name', (1, 3), 'v', ('Load',)), [('Pass', (1, 5))], [])], []),
('Module', [('With', (1, 0), [('withitem', ('Name', (1, 5), 'x', ('Load',)), ('Name', (1, 10), 'y', ('Store',)))], [('Pass', (1, 13))], None)], []),
('Module', [('With', (1, 0), [('withitem', ('Name', (1, 5), 'x', ('Load',)), ('Name', (1, 10), 'y', ('Store',))), ('withitem', ('Name', (1, 13), 'z', ('Load',)), ('Name', (1, 18), 'q', ('Store',)))], [('Pass', (1, 21))], None)], []),
('Module', [('Raise', (1, 0), ('Call', (1, 6), ('Name', (1, 6), 'Exception', ('Load',)), [('Constant', (1, 16), 'string')], []), None)], []),
('Module', [('Try', (1, 0), [('Pass', (2, 2))], [('ExceptHandler', (3, 0), ('Name', (3, 7), 'Exception', ('Load',)), None, [('Pass', (4, 2))])], [], [])], []),
('Module', [('Try', (1, 0), [('Pass', (2, 2))], [], [], [('Pass', (4, 2))])], []),
('Module', [('Assert', (1, 0), ('Name', (1, 7), 'v', ('Load',)), None)], []),
('Module', [('Import', (1, 0), [('alias', 'sys', None)])], []),
('Module', [('ImportFrom', (1, 0), 'sys', [('alias', 'v', None)], 0)], []),
('Module', [('Global', (1, 0), ['v'])], []),
('Module', [('Expr', (1, 0), ('Constant', (1, 0), 1))], []),
('Module', [('Pass', (1, 0))], []),
('Module', [('For', (1, 0), ('Name', (1, 4), 'v', ('Store',)), ('Name', (1, 9), 'v', ('Load',)), [('Break', (1, 11))], [], None)], []),
('Module', [('For', (1, 0), ('Name', (1, 4), 'v', ('Store',)), ('Name', (1, 9), 'v', ('Load',)), [('Continue', (1, 11))], [], None)], []),
('Module', [('For', (1, 0), ('Tuple', (1, 4), [('Name', (1, 4), 'a', ('Store',)), ('Name', (1, 6), 'b', ('Store',))], ('Store',)), ('Name', (1, 11), 'c', ('Load',)), [('Pass', (1, 14))], [], None)], []),
('Module', [('For', (1, 0), ('Tuple', (1, 4), [('Name', (1, 5), 'a', ('Store',)), ('Name', (1, 7), 'b', ('Store',))], ('Store',)), ('Name', (1, 13), 'c', ('Load',)), [('Pass', (1, 16))], [], None)], []),
('Module', [('For', (1, 0), ('List', (1, 4), [('Name', (1, 5), 'a', ('Store',)), ('Name', (1, 7), 'b', ('Store',))], ('Store',)), ('Name', (1, 13), 'c', ('Load',)), [('Pass', (1, 16))], [], None)], []),
('Module', [('Expr', (1, 0), ('GeneratorExp', (1, 0), ('Tuple', (2, 4), [('Name', (3, 4), 'Aa', ('Load',)), ('Name', (5, 7), 'Bb', ('Load',))], ('Load',)), [('comprehension', ('Tuple', (8, 4), [('Name', (8, 4), 'Aa', ('Store',)), ('Name', (10, 4), 'Bb', ('Store',))], ('Store',)), ('Name', (10, 10), 'Cc', ('Load',)), [], 0)]))], []),
('Module', [('Expr', (1, 0), ('DictComp', (1, 0), ('Name', (1, 1), 'a', ('Load',)), ('Name', (1, 5), 'b', ('Load',)), [('comprehension', ('Name', (1, 11), 'w', ('Store',)), ('Name', (1, 16), 'x', ('Load',)), [], 0), ('comprehension', ('Name', (1, 22), 'm', ('Store',)), ('Name', (1, 27), 'p', ('Load',)), [('Name', (1, 32), 'g', ('Load',))], 0)]))], []),
('Module', [('Expr', (1, 0), ('DictComp', (1, 0), ('Name', (1, 1), 'a', ('Load',)), ('Name', (1, 5), 'b', ('Load',)), [('comprehension', ('Tuple', (1, 11), [('Name', (1, 11), 'v', ('Store',)), ('Name', (1, 13), 'w', ('Store',))], ('Store',)), ('Name', (1, 18), 'x', ('Load',)), [], 0)]))], []),
('Module', [('Expr', (1, 0), ('SetComp', (1, 0), ('Name', (1, 1), 'r', ('Load',)), [('comprehension', ('Name', (1, 7), 'l', ('Store',)), ('Name', (1, 12), 'x', ('Load',)), [('Name', (1, 17), 'g', ('Load',))], 0)]))], []),
('Module', [('Expr', (1, 0), ('SetComp', (1, 0), ('Name', (1, 1), 'r', ('Load',)), [('comprehension', ('Tuple', (1, 7), [('Name', (1, 7), 'l', ('Store',)), ('Name', (1, 9), 'm', ('Store',))], ('Store',)), ('Name', (1, 14), 'x', ('Load',)), [], 0)]))], []),
('Module', [('AsyncFunctionDef', (1, 0), 'f', ('arguments', [], None, [], [], None, []), [('Expr', (2, 1), ('Constant', (2, 1), 'async function')), ('Expr', (3, 1), ('Await', (3, 1), ('Call', (3, 7), ('Name', (3, 7), 'something', ('Load',)), [], [])))], [], None, None)], []),
('Module', [('AsyncFunctionDef', (1, 0), 'f', ('arguments', [], None, [], [], None, []), [('AsyncFor', (2, 1), ('Name', (2, 11), 'e', ('Store',)), ('Name', (2, 16), 'i', ('Load',)), [('Expr', (2, 19), ('Constant', (2, 19), 1))], [('Expr', (3, 7), ('Constant', (3, 7), 2))], None)], [], None, None)], []),
('Module', [('AsyncFunctionDef', (1, 0), 'f', ('arguments', [], None, [], [], None, []), [('AsyncWith', (2, 1), [('withitem', ('Name', (2, 12), 'a', ('Load',)), ('Name', (2, 17), 'b', ('Store',)))], [('Expr', (2, 20), ('Constant', (2, 20), 1))], None)], [], None, None)], []),
('Module', [('Expr', (1, 0), ('Dict', (1, 0), [None, ('Constant', (1, 10), 2)], [('Dict', (1, 3), [('Constant', (1, 4), 1)], [('Constant', (1, 6), 2)]), ('Constant', (1, 12), 3)]))], []),
('Module', [('Expr', (1, 0), ('Set', (1, 0), [('Starred', (1, 1), ('Set', (1, 2), [('Constant', (1, 3), 1), ('Constant', (1, 6), 2)]), ('Load',)), ('Constant', (1, 10), 3)]))], []),
('Module', [('AsyncFunctionDef', (1, 0), 'f', ('arguments', [], None, [], [], None, []), [('Expr', (2, 1), ('ListComp', (2, 1), ('Name', (2, 2), 'i', ('Load',)), [('comprehension', ('Name', (2, 14), 'b', ('Store',)), ('Name', (2, 19), 'c', ('Load',)), [], 1)]))], [], None, None)], []),
('Module', [('FunctionDef', (3, 0), 'f', ('arguments', [], None, [], [], None, []), [('Pass', (3, 9))], [('Name', (1, 1), 'deco1', ('Load',)), ('Call', (2, 0), ('Name', (2, 1), 'deco2', ('Load',)), [], [])], None, None)], []),
('Module', [('AsyncFunctionDef', (3, 0), 'f', ('arguments', [], None, [], [], None, []), [('Pass', (3, 15))], [('Name', (1, 1), 'deco1', ('Load',)), ('Call', (2, 0), ('Name', (2, 1), 'deco2', ('Load',)), [], [])], None, None)], []),
('Module', [('ClassDef', (3, 0), 'C', [], [], [('Pass', (3, 9))], [('Name', (1, 1), 'deco1', ('Load',)), ('Call', (2, 0), ('Name', (2, 1), 'deco2', ('Load',)), [], [])])], []),
('Module', [('FunctionDef', (2, 0), 'f', ('arguments', [], None, [], [], None, []), [('Pass', (2, 9))], [('Call', (1, 1), ('Name', (1, 1), 'deco', ('Load',)), [('GeneratorExp', (1, 5), ('Name', (1, 6), 'a', ('Load',)), [('comprehension', ('Name', (1, 12), 'a', ('Store',)), ('Name', (1, 17), 'b', ('Load',)), [], 0)])], [])], None, None)], []),
import ast
import unittest


funcdef = """\
def foo():
    # type: () -> int
    pass

def bar():  # type: () -> None
    pass
"""

asyncdef = """\
async def foo():
    # type: () -> int
    return await bar()

async def bar():  # type: () -> int
    return await bar()
"""

redundantdef = """\
def foo():  # type: () -> int
    # type: () -> str
    return ''
"""

nonasciidef = """\
def foo():
    # type: () -> àçčéñt
    pass
"""

forstmt = """\
for a in []:  # type: int
    pass
"""

withstmt = """\
with context() as a:  # type: int
    pass
"""

vardecl = """\
a = 0  # type: int
"""

ignores = """\
def foo():
    pass  # type: ignore

def bar():
    x = 1  # type: ignore
"""

# Test for long-form type-comments in arguments.  A test function
# named 'fabvk' would have two positional args, a and b, plus a
# var-arg *v, plus a kw-arg **k.  It is verified in test_longargs()
# that it has exactly these arguments, no more, no fewer.
longargs = """\
def fa(
    a = 1,  # type: A
):
    pass

def fa(
    a = 1  # type: A
):
    pass

def fab(
    a,  # type: A
    b,  # type: B
):
    pass

def fab(
    a,  # type: A
    b  # type: B
):
    pass

def fv(
    *v,  # type: V
):
    pass

def fv(
    *v  # type: V
):
    pass

def fk(
    **k,  # type: K
):
    pass

def fk(
    **k  # type: K
):
    pass

def fvk(
    *v,  # type: V
    **k,  # type: K
):
    pass

def fvk(
    *v,  # type: V
    **k  # type: K
):
    pass

def fav(
    a,  # type: A
    *v,  # type: V
):
    pass

def fav(
    a,  # type: A
    *v  # type: V
):
    pass

def fak(
    a,  # type: A
    **k,  # type: K
):
    pass

def fak(
    a,  # type: A
    **k  # type: K
):
    pass

def favk(
    a,  # type: A
    *v,  # type: V
    **k,  # type: K
):
    pass

def favk(
    a,  # type: A
    *v,  # type: V
    **k  # type: K
):
    pass
"""


class TypeCommentTests(unittest.TestCase):

    def parse(self, source):
        return ast.parse(source, type_comments=True)

    def classic_parse(self, source):
        return ast.parse(source)

    def test_funcdef(self):
        tree = self.parse(funcdef)
        self.assertEqual(tree.body[0].type_comment, "() -> int")
        self.assertEqual(tree.body[1].type_comment, "() -> None")
        tree = self.classic_parse(funcdef)
        self.assertEqual(tree.body[0].type_comment, None)
        self.assertEqual(tree.body[1].type_comment, None)

    def test_asyncdef(self):
        tree = self.parse(asyncdef)
        self.assertEqual(tree.body[0].type_comment, "() -> int")
        self.assertEqual(tree.body[1].type_comment, "() -> int")
        tree = self.classic_parse(asyncdef)
        self.assertEqual(tree.body[0].type_comment, None)
        self.assertEqual(tree.body[1].type_comment, None)

    def test_redundantdef(self):
        with self.assertRaisesRegex(SyntaxError, "^Cannot have two type comments on def"):
            tree = self.parse(redundantdef)

    def test_nonasciidef(self):
        tree = self.parse(nonasciidef)
        self.assertEqual(tree.body[0].type_comment, "() -> àçčéñt")

    def test_forstmt(self):
        tree = self.parse(forstmt)
        self.assertEqual(tree.body[0].type_comment, "int")
        tree = self.classic_parse(forstmt)
        self.assertEqual(tree.body[0].type_comment, None)

    def test_withstmt(self):
        tree = self.parse(withstmt)
        self.assertEqual(tree.body[0].type_comment, "int")
        tree = self.classic_parse(withstmt)
        self.assertEqual(tree.body[0].type_comment, None)

    def test_vardecl(self):
        tree = self.parse(vardecl)
        self.assertEqual(tree.body[0].type_comment, "int")
        tree = self.classic_parse(vardecl)
        self.assertEqual(tree.body[0].type_comment, None)

    def test_ignores(self):
        tree = self.parse(ignores)
        self.assertEqual([ti.lineno for ti in tree.type_ignores], [2, 5])
        tree = self.classic_parse(ignores)
        self.assertEqual(tree.type_ignores, [])

    def test_longargs(self):
        tree = self.parse(longargs)
        for t in tree.body:
            # The expected args are encoded in the function name
            todo = set(t.name[1:])
            self.assertEqual(len(t.args.args),
                             len(todo) - bool(t.args.vararg) - bool(t.args.kwarg))
            self.assertTrue(t.name.startswith('f'), t.name)
            for c in t.name[1:]:
                todo.remove(c)
                if c == 'v':
                    arg = t.args.vararg
                elif c == 'k':
                    arg = t.args.kwarg
                else:
                    assert 0 <= ord(c) - ord('a') < len(t.args.args)
                    arg = t.args.args[ord(c) - ord('a')]
                self.assertEqual(arg.arg, c)  # That's the argument name
                self.assertEqual(arg.type_comment, arg.arg.upper())
            assert not todo
        tree = self.classic_parse(longargs)
        for t in tree.body:
            for arg in t.args.args + [t.args.vararg, t.args.kwarg]:
                if arg is not None:
                    self.assertIsNone(arg.type_comment, "%s(%s:%r)" %
                                      (t.name, arg.arg, arg.type_comment))

    def test_inappropriate_type_comments(self):
        """Tests for inappropriately-placed type comments.

        These should be silently ignored with type comments off,
        but raise SyntaxError with type comments on.

        This is not meant to be exhaustive.
        """

        def check_both_ways(source):
            ast.parse(source, type_comments=False)
            with self.assertRaises(SyntaxError):
                ast.parse(source, type_comments=True)

        check_both_ways("pass  # type: int\n")
        check_both_ways("foo()  # type: int\n")
        check_both_ways("x += 1  # type: int\n")
        check_both_ways("while True:  # type: int\n  continue\n")
        check_both_ways("while True:\n  continue  # type: int\n")
        check_both_ways("try:  # type: int\n  pass\nfinally:\n  pass\n")
        check_both_ways("try:\n  pass\nfinally:  # type: int\n  pass\n")

    def test_func_type_input(self):

        def parse_func_type_input(source):
            return ast.parse(source, "<unknown>", "func_type")

        # Some checks below will crash if the returned structure is wrong
        tree = parse_func_type_input("() -> int")
        self.assertEqual(tree.argtypes, [])
        self.assertEqual(tree.returns.id, "int")

        tree = parse_func_type_input("(int) -> List[str]")
        self.assertEqual(len(tree.argtypes), 1)
        arg = tree.argtypes[0]
        self.assertEqual(arg.id, "int")
        self.assertEqual(tree.returns.value.id, "List")
        self.assertEqual(tree.returns.slice.value.id, "str")

        tree = parse_func_type_input("(int, *str, **Any) -> float")
        self.assertEqual(tree.argtypes[0].id, "int")
        self.assertEqual(tree.argtypes[1].id, "str")
        self.assertEqual(tree.argtypes[2].id, "Any")
        self.assertEqual(tree.returns.id, "float")

        with self.assertRaises(SyntaxError):
            tree = parse_func_type_input("(int, *str, *Any) -> float")

        with self.assertRaises(SyntaxError):
            tree = parse_func_type_input("(int, **str, Any) -> float")

        with self.assertRaises(SyntaxError):
            tree = parse_func_type_input("(**int, **str) -> float")


if __name__ == '__main__':
    unittest.main()
TYPE_IGNORE = 55
TYPE_COMMENT = 56
ERRORTOKEN = 57
COMMENT = 58
NL = 59
ENCODING = 60
N_TOKENS = 61
Add the option to parse PEP 484 type comments in the ast module. (Off by default.) This is merging the key functionality of the third party fork thereof, [typed_ast](https://github.com/python/typed_ast).
        if (ch_type == suite && TYPE(tree) == funcdef) {
            /* This is the opposite hack of what we do in parser.c
               (search for func_body_suite), except we don't ever
               support type comments here. */
            ch_type = func_body_suite;
        }
    mod = Module(stmt* body, type_ignore *type_ignores)
        | FunctionType(expr* argtypes, expr returns)
                       stmt* body, expr* decorator_list, expr? returns,
                       string? type_comment)
                             stmt* body, expr* decorator_list, expr? returns,
                             string? type_comment)
          | Assign(expr* targets, expr value, string? type_comment)
          | For(expr target, expr iter, stmt* body, stmt* orelse, string? type_comment)
          | AsyncFor(expr target, expr iter, stmt* body, stmt* orelse, string? type_comment)
          | With(withitem* items, stmt* body, string? type_comment)
          | AsyncWith(withitem* items, stmt* body, string? type_comment)
    arg = (identifier arg, expr? annotation, string? type_comment)

    type_ignore = TypeIgnore(int lineno)
static int obj2ast_string(PyObject* obj, PyObject** out, PyArena* arena)
{
    if (!PyUnicode_CheckExact(obj) && !PyBytes_CheckExact(obj)) {
        PyErr_SetString(PyExc_TypeError, "AST string must be of type str");
        return 1;
    }
    return obj2ast_object(obj, out, arena);
}

        self.emit('if (PyModule_AddIntMacro(m, PyCF_TYPE_COMMENTS) < 0)', 1)
        self.emit("return NULL;", 2)
/* and 3 for "func_type" */
    char *req_name[] = {"Module", "Expression", "Interactive", "FunctionType"};
    assert(0 <= mode && mode <= 3);
#include "graminit.h"
                    dfa *d1;
                    if (nt == func_body_suite && !(ps->p_flags & PyCF_TYPE_COMMENTS)) {
                        /* When parsing type comments is not requested,
                           we can provide better errors about bad indentation
                           by using 'suite' for the body of a funcdef */
                        D(printf(" [switch func_body_suite to suite]"));
                        nt = suite;
                    }
                    d1 = PyGrammar_FindDFA(
                    D(printf(" Push '%s'\n", d1->d_name));
typedef struct {
    int *items;
    size_t size;
    size_t num_items;
} growable_int_array;

static int
growable_int_array_init(growable_int_array *arr, size_t initial_size) {
    assert(initial_size > 0);
    arr->items = malloc(initial_size * sizeof(*arr->items));
    arr->size = initial_size;
    arr->num_items = 0;

    return arr->items != NULL;
}

static int
growable_int_array_add(growable_int_array *arr, int item) {
    if (arr->num_items >= arr->size) {
        arr->size *= 2;
        arr->items = realloc(arr->items, arr->size * sizeof(*arr->items));
        if (!arr->items) {
            return 0;
        }
    }

    arr->items[arr->num_items] = item;
    arr->num_items++;
    return 1;
}

static void
growable_int_array_deallocate(growable_int_array *arr) {
    free(arr->items);
}

    if (*flags & PyPARSE_TYPE_COMMENTS) {
        tok->type_comments = 1;
    }
    if (*flags & PyPARSE_TYPE_COMMENTS) {
        tok->type_comments = 1;
    }
    growable_int_array type_ignores;

    if (!growable_int_array_init(&type_ignores, 10)) {
        err_ret->error = E_NOMEM;
        PyTokenizer_Free(tok);
        return NULL;
    }
    if (*flags & PyPARSE_TYPE_COMMENTS)
        ps->p_flags |= PyCF_TYPE_COMMENTS;

        if (type == TYPE_IGNORE) {
            if (!growable_int_array_add(&type_ignores, tok->lineno)) {
                err_ret->error = E_NOMEM;
                break;
            }
            continue;
        }

        if (n->n_type == file_input) {
            /* Put type_ignore nodes in the ENDMARKER of file_input. */
            int num;
            node *ch;
            size_t i;

            num = NCH(n);
            ch = CHILD(n, num - 1);
            REQ(ch, ENDMARKER);

            for (i = 0; i < type_ignores.num_items; i++) {
                PyNode_AddChild(ch, TYPE_IGNORE, NULL,
                                type_ignores.items[i], 0,
                                type_ignores.items[i], 0);
            }
        }
        growable_int_array_deallocate(&type_ignores);

    "TYPE_IGNORE",
    "TYPE_COMMENT",
/* Spaces in this constant are treated as "zero or more spaces or tabs" when
   tokenizing. */
static const char* type_comment_prefix = "# type: ";

    tok->type_comments = 0;
    /* Skip comment, unless it's a type comment */
        const char *prefix, *p, *type_start;


        if (tok->type_comments) {
            p = tok->start;
            prefix = type_comment_prefix;
            while (*prefix && p < tok->cur) {
                if (*prefix == ' ') {
                    while (*p == ' ' || *p == '\t') {
                        p++;
                    }
                } else if (*prefix == *p) {
                    p++;
                } else {
                    break;
                }

                prefix++;
            }

            /* This is a type comment if we matched all of type_comment_prefix. */
            if (!*prefix) {
                int is_type_ignore = 1;
                tok_backup(tok, c);  /* don't eat the newline or EOF */

                type_start = p;

                is_type_ignore = tok->cur >= p + 6 && memcmp(p, "ignore", 6) == 0;
                p += 6;
                while (is_type_ignore && p < tok->cur) {
                    if (*p == '#')
                        break;
                    is_type_ignore = is_type_ignore && (*p == ' ' || *p == '\t');
                    p++;
                }

                if (is_type_ignore) {
                    /* If this type ignore is the only thing on the line, consume the newline also. */
                    if (blankline) {
                        tok_nextc(tok);
                        tok->atbol = 1;
                    }
                    return TYPE_IGNORE;
                } else {
                    *p_start = (char *) type_start;  /* after type_comment_prefix */
                    *p_end = tok->cur;
                    return TYPE_COMMENT;
                }
            }
        }

    int type_comments;      /* Whether to look for type comments */
_Py_IDENTIFIER(type_ignores);
    "type_ignores",
static PyTypeObject *FunctionType_type;
_Py_IDENTIFIER(argtypes);
_Py_IDENTIFIER(returns);
static char *FunctionType_fields[]={
    "argtypes",
    "returns",
};
_Py_IDENTIFIER(type_comment);
    "type_comment",
    "type_comment",
    "type_comment",
    "type_comment",
    "type_comment",
    "type_comment",
    "type_comment",
    "type_comment",
static PyTypeObject *type_ignore_type;
static PyObject* ast2obj_type_ignore(void*);
static PyTypeObject *TypeIgnore_type;
static char *TypeIgnore_fields[]={
    "lineno",
};
static int obj2ast_string(PyObject* obj, PyObject** out, PyArena* arena)
{
    if (!PyUnicode_CheckExact(obj) && !PyBytes_CheckExact(obj)) {
        PyErr_SetString(PyExc_TypeError, "AST string must be of type str");
        return 1;
    }
    return obj2ast_object(obj, out, arena);
}

    Module_type = make_type("Module", mod_type, Module_fields, 2);
    FunctionType_type = make_type("FunctionType", mod_type,
                                  FunctionType_fields, 2);
    if (!FunctionType_type) return 0;
                                 6);
                                      AsyncFunctionDef_fields, 6);
    Assign_type = make_type("Assign", stmt_type, Assign_fields, 3);
    For_type = make_type("For", stmt_type, For_fields, 5);
    AsyncFor_type = make_type("AsyncFor", stmt_type, AsyncFor_fields, 5);
    With_type = make_type("With", stmt_type, With_fields, 3);
    AsyncWith_type = make_type("AsyncWith", stmt_type, AsyncWith_fields, 3);
    arg_type = make_type("arg", &AST_type, arg_fields, 3);
    type_ignore_type = make_type("type_ignore", &AST_type, NULL, 0);
    if (!type_ignore_type) return 0;
    if (!add_attributes(type_ignore_type, NULL, 0)) return 0;
    TypeIgnore_type = make_type("TypeIgnore", type_ignore_type,
                                TypeIgnore_fields, 1);
    if (!TypeIgnore_type) return 0;
static int obj2ast_type_ignore(PyObject* obj, type_ignore_ty* out, PyArena*
                               arena);
Module(asdl_seq * body, asdl_seq * type_ignores, PyArena *arena)
    p->v.Module.type_ignores = type_ignores;
mod_ty
FunctionType(asdl_seq * argtypes, expr_ty returns, PyArena *arena)
{
    mod_ty p;
    if (!returns) {
        PyErr_SetString(PyExc_ValueError,
                        "field returns is required for FunctionType");
        return NULL;
    }
    p = (mod_ty)PyArena_Malloc(arena, sizeof(*p));
    if (!p)
        return NULL;
    p->kind = FunctionType_kind;
    p->v.FunctionType.argtypes = argtypes;
    p->v.FunctionType.returns = returns;
    return p;
}

            decorator_list, expr_ty returns, string type_comment, int lineno,
            int col_offset, int end_lineno, int end_col_offset, PyArena *arena)
    p->v.FunctionDef.type_comment = type_comment;
                 * decorator_list, expr_ty returns, string type_comment, int
                 lineno, int col_offset, int end_lineno, int end_col_offset,
                 PyArena *arena)
    p->v.AsyncFunctionDef.type_comment = type_comment;
Assign(asdl_seq * targets, expr_ty value, string type_comment, int lineno, int
       col_offset, int end_lineno, int end_col_offset, PyArena *arena)
    p->v.Assign.type_comment = type_comment;
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)
    p->v.For.type_comment = type_comment;
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)
    p->v.AsyncFor.type_comment = type_comment;
With(asdl_seq * items, asdl_seq * body, string type_comment, int lineno, int
     col_offset, int end_lineno, int end_col_offset, PyArena *arena)
    p->v.With.type_comment = type_comment;
AsyncWith(asdl_seq * items, asdl_seq * body, string type_comment, int lineno,
          int col_offset, int end_lineno, int end_col_offset, PyArena *arena)
    p->v.AsyncWith.type_comment = type_comment;
arg(identifier arg, expr_ty annotation, string type_comment, int lineno, int
    col_offset, int end_lineno, int end_col_offset, PyArena *arena)
    p->type_comment = type_comment;
type_ignore_ty
TypeIgnore(int lineno, PyArena *arena)
{
    type_ignore_ty p;
    p = (type_ignore_ty)PyArena_Malloc(arena, sizeof(*p));
    if (!p)
        return NULL;
    p->kind = TypeIgnore_kind;
    p->v.TypeIgnore.lineno = lineno;
    return p;
}

        value = ast2obj_list(o->v.Module.type_ignores, ast2obj_type_ignore);
        if (!value) goto failed;
        if (_PyObject_SetAttrId(result, &PyId_type_ignores, value) == -1)
            goto failed;
        Py_DECREF(value);
    case FunctionType_kind:
        result = PyType_GenericNew(FunctionType_type, NULL, NULL);
        if (!result) goto failed;
        value = ast2obj_list(o->v.FunctionType.argtypes, ast2obj_expr);
        if (!value) goto failed;
        if (_PyObject_SetAttrId(result, &PyId_argtypes, value) == -1)
            goto failed;
        Py_DECREF(value);
        value = ast2obj_expr(o->v.FunctionType.returns);
        if (!value) goto failed;
        if (_PyObject_SetAttrId(result, &PyId_returns, value) == -1)
            goto failed;
        Py_DECREF(value);
        break;
        value = ast2obj_string(o->v.FunctionDef.type_comment);
        if (!value) goto failed;
        if (_PyObject_SetAttrId(result, &PyId_type_comment, value) == -1)
            goto failed;
        Py_DECREF(value);
        value = ast2obj_string(o->v.AsyncFunctionDef.type_comment);
        if (!value) goto failed;
        if (_PyObject_SetAttrId(result, &PyId_type_comment, value) == -1)
            goto failed;
        Py_DECREF(value);
        value = ast2obj_string(o->v.Assign.type_comment);
        if (!value) goto failed;
        if (_PyObject_SetAttrId(result, &PyId_type_comment, value) == -1)
            goto failed;
        Py_DECREF(value);
        value = ast2obj_string(o->v.For.type_comment);
        if (!value) goto failed;
        if (_PyObject_SetAttrId(result, &PyId_type_comment, value) == -1)
            goto failed;
        Py_DECREF(value);
        value = ast2obj_string(o->v.AsyncFor.type_comment);
        if (!value) goto failed;
        if (_PyObject_SetAttrId(result, &PyId_type_comment, value) == -1)
            goto failed;
        Py_DECREF(value);
        value = ast2obj_string(o->v.With.type_comment);
        if (!value) goto failed;
        if (_PyObject_SetAttrId(result, &PyId_type_comment, value) == -1)
            goto failed;
        Py_DECREF(value);
        value = ast2obj_string(o->v.AsyncWith.type_comment);
        if (!value) goto failed;
        if (_PyObject_SetAttrId(result, &PyId_type_comment, value) == -1)
            goto failed;
        Py_DECREF(value);
    value = ast2obj_string(o->type_comment);
    if (!value) goto failed;
    if (_PyObject_SetAttrId(result, &PyId_type_comment, value) == -1)
        goto failed;
    Py_DECREF(value);
PyObject*
ast2obj_type_ignore(void* _o)
{
    type_ignore_ty o = (type_ignore_ty)_o;
    PyObject *result = NULL, *value = NULL;
    if (!o) {
        Py_RETURN_NONE;
    }

    switch (o->kind) {
    case TypeIgnore_kind:
        result = PyType_GenericNew(TypeIgnore_type, NULL, NULL);
        if (!result) goto failed;
        value = ast2obj_int(o->v.TypeIgnore.lineno);
        if (!value) goto failed;
        if (_PyObject_SetAttrId(result, &PyId_lineno, value) == -1)
            goto failed;
        Py_DECREF(value);
        break;
    }
    return result;
failed:
    Py_XDECREF(value);
    Py_XDECREF(result);
    return NULL;
}

        asdl_seq* type_ignores;
        if (_PyObject_LookupAttrId(obj, &PyId_type_ignores, &tmp) < 0) {
            return 1;
        }
        if (tmp == NULL) {
            PyErr_SetString(PyExc_TypeError, "required field \"type_ignores\" missing from Module");
            return 1;
        }
        else {
            int res;
            Py_ssize_t len;
            Py_ssize_t i;
            if (!PyList_Check(tmp)) {
                PyErr_Format(PyExc_TypeError, "Module field \"type_ignores\" must be a list, not a %.200s", tmp->ob_type->tp_name);
                goto failed;
            }
            len = PyList_GET_SIZE(tmp);
            type_ignores = _Py_asdl_seq_new(len, arena);
            if (type_ignores == NULL) goto failed;
            for (i = 0; i < len; i++) {
                type_ignore_ty val;
                res = obj2ast_type_ignore(PyList_GET_ITEM(tmp, i), &val, arena);
                if (res != 0) goto failed;
                if (len != PyList_GET_SIZE(tmp)) {
                    PyErr_SetString(PyExc_RuntimeError, "Module field \"type_ignores\" changed size during iteration");
                    goto failed;
                }
                asdl_seq_SET(type_ignores, i, val);
            }
            Py_CLEAR(tmp);
        }
        *out = Module(body, type_ignores, arena);
    isinstance = PyObject_IsInstance(obj, (PyObject*)FunctionType_type);
    if (isinstance == -1) {
        return 1;
    }
    if (isinstance) {
        asdl_seq* argtypes;
        expr_ty returns;

        if (_PyObject_LookupAttrId(obj, &PyId_argtypes, &tmp) < 0) {
            return 1;
        }
        if (tmp == NULL) {
            PyErr_SetString(PyExc_TypeError, "required field \"argtypes\" missing from FunctionType");
            return 1;
        }
        else {
            int res;
            Py_ssize_t len;
            Py_ssize_t i;
            if (!PyList_Check(tmp)) {
                PyErr_Format(PyExc_TypeError, "FunctionType field \"argtypes\" must be a list, not a %.200s", tmp->ob_type->tp_name);
                goto failed;
            }
            len = PyList_GET_SIZE(tmp);
            argtypes = _Py_asdl_seq_new(len, arena);
            if (argtypes == NULL) goto failed;
            for (i = 0; i < len; i++) {
                expr_ty val;
                res = obj2ast_expr(PyList_GET_ITEM(tmp, i), &val, arena);
                if (res != 0) goto failed;
                if (len != PyList_GET_SIZE(tmp)) {
                    PyErr_SetString(PyExc_RuntimeError, "FunctionType field \"argtypes\" changed size during iteration");
                    goto failed;
                }
                asdl_seq_SET(argtypes, i, val);
            }
            Py_CLEAR(tmp);
        }
        if (_PyObject_LookupAttrId(obj, &PyId_returns, &tmp) < 0) {
            return 1;
        }
        if (tmp == NULL) {
            PyErr_SetString(PyExc_TypeError, "required field \"returns\" missing from FunctionType");
            return 1;
        }
        else {
            int res;
            res = obj2ast_expr(tmp, &returns, arena);
            if (res != 0) goto failed;
            Py_CLEAR(tmp);
        }
        *out = FunctionType(argtypes, returns, arena);
        if (*out == NULL) goto failed;
        return 0;
    }
        string type_comment;
        if (_PyObject_LookupAttrId(obj, &PyId_type_comment, &tmp) < 0) {
            return 1;
        }
        if (tmp == NULL || tmp == Py_None) {
            Py_CLEAR(tmp);
            type_comment = NULL;
        }
        else {
            int res;
            res = obj2ast_string(tmp, &type_comment, arena);
            if (res != 0) goto failed;
            Py_CLEAR(tmp);
        }
        *out = FunctionDef(name, args, body, decorator_list, returns,
                           type_comment, lineno, col_offset, end_lineno,
                           end_col_offset, arena);
        string type_comment;
        if (_PyObject_LookupAttrId(obj, &PyId_type_comment, &tmp) < 0) {
            return 1;
        }
        if (tmp == NULL || tmp == Py_None) {
            Py_CLEAR(tmp);
            type_comment = NULL;
        }
        else {
            int res;
            res = obj2ast_string(tmp, &type_comment, arena);
            if (res != 0) goto failed;
            Py_CLEAR(tmp);
        }
                                type_comment, lineno, col_offset, end_lineno,
                                end_col_offset, arena);
        string type_comment;
        if (_PyObject_LookupAttrId(obj, &PyId_type_comment, &tmp) < 0) {
            return 1;
        }
        if (tmp == NULL || tmp == Py_None) {
            Py_CLEAR(tmp);
            type_comment = NULL;
        }
        else {
            int res;
            res = obj2ast_string(tmp, &type_comment, arena);
            if (res != 0) goto failed;
            Py_CLEAR(tmp);
        }
        *out = Assign(targets, value, type_comment, lineno, col_offset,
                      end_lineno, end_col_offset, arena);
        string type_comment;
        if (_PyObject_LookupAttrId(obj, &PyId_type_comment, &tmp) < 0) {
            return 1;
        }
        if (tmp == NULL || tmp == Py_None) {
            Py_CLEAR(tmp);
            type_comment = NULL;
        }
        else {
            int res;
            res = obj2ast_string(tmp, &type_comment, arena);
            if (res != 0) goto failed;
            Py_CLEAR(tmp);
        }
        *out = For(target, iter, body, orelse, type_comment, lineno,
                   col_offset, end_lineno, end_col_offset, arena);
        string type_comment;
        if (_PyObject_LookupAttrId(obj, &PyId_type_comment, &tmp) < 0) {
            return 1;
        }
        if (tmp == NULL || tmp == Py_None) {
            Py_CLEAR(tmp);
            type_comment = NULL;
        }
        else {
            int res;
            res = obj2ast_string(tmp, &type_comment, arena);
            if (res != 0) goto failed;
            Py_CLEAR(tmp);
        }
        *out = AsyncFor(target, iter, body, orelse, type_comment, lineno,
                        col_offset, end_lineno, end_col_offset, arena);
        string type_comment;
        if (_PyObject_LookupAttrId(obj, &PyId_type_comment, &tmp) < 0) {
            return 1;
        }
        if (tmp == NULL || tmp == Py_None) {
            Py_CLEAR(tmp);
            type_comment = NULL;
        }
        else {
            int res;
            res = obj2ast_string(tmp, &type_comment, arena);
            if (res != 0) goto failed;
            Py_CLEAR(tmp);
        }
        *out = With(items, body, type_comment, lineno, col_offset, end_lineno,
        string type_comment;
        if (_PyObject_LookupAttrId(obj, &PyId_type_comment, &tmp) < 0) {
            return 1;
        }
        if (tmp == NULL || tmp == Py_None) {
            Py_CLEAR(tmp);
            type_comment = NULL;
        }
        else {
            int res;
            res = obj2ast_string(tmp, &type_comment, arena);
            if (res != 0) goto failed;
            Py_CLEAR(tmp);
        }
        *out = AsyncWith(items, body, type_comment, lineno, col_offset,
                         end_lineno, end_col_offset, arena);
    string type_comment;
    if (_PyObject_LookupAttrId(obj, &PyId_type_comment, &tmp) < 0) {
        return 1;
    }
    if (tmp == NULL || tmp == Py_None) {
        Py_CLEAR(tmp);
        type_comment = NULL;
    }
    else {
        int res;
        res = obj2ast_string(tmp, &type_comment, arena);
        if (res != 0) goto failed;
        Py_CLEAR(tmp);
    }
    *out = arg(arg, annotation, type_comment, lineno, col_offset, end_lineno,
               end_col_offset, arena);
int
obj2ast_type_ignore(PyObject* obj, type_ignore_ty* out, PyArena* arena)
{
    int isinstance;

    PyObject *tmp = NULL;

    if (obj == Py_None) {
        *out = NULL;
        return 0;
    }
    isinstance = PyObject_IsInstance(obj, (PyObject*)TypeIgnore_type);
    if (isinstance == -1) {
        return 1;
    }
    if (isinstance) {
        int lineno;

        if (_PyObject_LookupAttrId(obj, &PyId_lineno, &tmp) < 0) {
            return 1;
        }
        if (tmp == NULL) {
            PyErr_SetString(PyExc_TypeError, "required field \"lineno\" missing from TypeIgnore");
            return 1;
        }
        else {
            int res;
            res = obj2ast_int(tmp, &lineno, arena);
            if (res != 0) goto failed;
            Py_CLEAR(tmp);
        }
        *out = TypeIgnore(lineno, arena);
        if (*out == NULL) goto failed;
        return 0;
    }

    PyErr_Format(PyExc_TypeError, "expected some sort of type_ignore, but got %R", obj);
    failed:
    Py_XDECREF(tmp);
    return 1;
}

    if (PyModule_AddIntMacro(m, PyCF_TYPE_COMMENTS) < 0)
        return NULL;
    if (PyDict_SetItemString(d, "FunctionType", (PyObject*)FunctionType_type) <
        0) return NULL;
    if (PyDict_SetItemString(d, "type_ignore", (PyObject*)type_ignore_type) <
        0) return NULL;
    if (PyDict_SetItemString(d, "TypeIgnore", (PyObject*)TypeIgnore_type) < 0)
        return NULL;
/* and 3 for "func_type" */
    char *req_name[] = {"Module", "Expression", "Interactive", "FunctionType"};
    assert(0 <= mode && mode <= 3);
static string
new_type_comment(const char *s)
{
  return PyUnicode_DecodeUTF8(s, strlen(s), NULL);
}
#define NEW_TYPE_COMMENT(n) new_type_comment(STR(n))

        case func_body_suite:
            /* func_body_suite: simple_stmt | NEWLINE [TYPE_COMMENT NEWLINE] INDENT stmt+ DEDENT */
            /* suite: simple_stmt | NEWLINE INDENT stmt+ DEDENT */
                i = 2;
                if (TYPE(CHILD(n, 1)) == TYPE_COMMENT)
                    i += 2;
                for (; i < (NCH(n) - 1); i++)
    asdl_seq *type_ignores = NULL;
    asdl_seq *argtypes = NULL;
    expr_ty ret, arg;

            /* Type ignores are stored under the ENDMARKER in file_input. */
            ch = CHILD(n, NCH(n) - 1);
            REQ(ch, ENDMARKER);
            num = NCH(ch);
            type_ignores = _Py_asdl_seq_new(num, arena);
            if (!type_ignores)
                goto out;

            for (i = 0; i < num; i++) {
                type_ignore_ty ti = TypeIgnore(LINENO(CHILD(ch, i)), arena);
                if (!ti)
                   goto out;
               asdl_seq_SET(type_ignores, i, ti);
            }

            res = Module(stmts, type_ignores, arena);
        case func_type_input:
            n = CHILD(n, 0);
            REQ(n, func_type);

            if (TYPE(CHILD(n, 1)) == typelist) {
                ch = CHILD(n, 1);
                /* this is overly permissive -- we don't pay any attention to
                 * stars on the args -- just parse them into an ordered list */
                num = 0;
                for (i = 0; i < NCH(ch); i++) {
                    if (TYPE(CHILD(ch, i)) == test) {
                        num++;
                    }
                }

                argtypes = _Py_asdl_seq_new(num, arena);
                if (!argtypes)
                    goto out;

                j = 0;
                for (i = 0; i < NCH(ch); i++) {
                    if (TYPE(CHILD(ch, i)) == test) {
                        arg = ast_for_expr(&c, CHILD(ch, i));
                        if (!arg)
                            goto out;
                        asdl_seq_SET(argtypes, j++, arg);
                    }
                }
            }
            else {
                argtypes = _Py_asdl_seq_new(0, arena);
                if (!argtypes)
                    goto out;
            }

            ret = ast_for_expr(&c, CHILD(n, NCH(n) - 1));
            if (!ret)
                goto out;
            res = FunctionType(argtypes, ret, arena);
            break;
    ret = arg(name, annotation, NULL, LINENO(n), n->n_col_offset,
                arg = arg(argname, annotation, NULL, LINENO(ch), ch->n_col_offset,
                i += 1; /* the name */
                if (TYPE(CHILD(n, i)) == COMMA)
                    i += 1; /* the comma, if present */
                break;
            case TYPE_COMMENT:
                /* arg will be equal to the last argument processed */
                arg->type_comment = NEW_TYPE_COMMENT(ch);
                if (!arg->type_comment)
                    goto error;
                i += 1;
                i += 1; /* the name */
                if (i < NCH(n) && TYPE(CHILD(n, i)) == COMMA)
                    i += 1; /* the comma, if present */
                    (i+2 == NCH(n) && (TYPE(CHILD(n, i+1)) == COMMA
                                       || TYPE(CHILD(n, i+1)) == TYPE_COMMENT))) {
                              "named arguments must follow bare *");

                    if (i < NCH(n) && TYPE(CHILD(n, i)) == TYPE_COMMENT) {
                        ast_error(c, CHILD(n, i),
                                  "bare * has associated type comment");
                        return NULL;
                    }

                i += 2; /* the star and the name */
                if (i < NCH(n) && TYPE(CHILD(n, i)) == COMMA)
                    i += 1; /* the comma, if present */

                if (i < NCH(n) && TYPE(CHILD(n, i)) == TYPE_COMMENT) {
                        vararg->type_comment = NEW_TYPE_COMMENT(CHILD(n, i));
                        if (!vararg->type_comment)
                            return NULL;
                        i += 1;
                    }

                i += 2; /* the double star and the name */
                if (TYPE(CHILD(n, i)) == COMMA)
                    i += 1; /* the comma, if present */
                break;
            case TYPE_COMMENT:
                assert(i);

                if (kwarg)
                    arg = kwarg;

                /* arg will be equal to the last argument processed */
                arg->type_comment = NEW_TYPE_COMMENT(ch);
                if (!arg->type_comment)
                    return NULL;
                i += 1;
    /* funcdef: 'def' NAME parameters ['->' test] ':' [TYPE_COMMENT] suite */
    node *tc;
    string type_comment = NULL;
    if (TYPE(CHILD(n, name_i + 3)) == TYPE_COMMENT) {
        type_comment = NEW_TYPE_COMMENT(CHILD(n, name_i + 3));
        if (!type_comment)
            return NULL;
        name_i += 1;
    }
    if (NCH(CHILD(n, name_i + 3)) > 1) {
        /* Check if the suite has a type comment in it. */
        tc = CHILD(CHILD(n, name_i + 3), 1);

        if (TYPE(tc) == TYPE_COMMENT) {
            if (type_comment != NULL) {
                ast_error(c, n, "Cannot have two type comments on def");
                return NULL;
            }
            type_comment = NEW_TYPE_COMMENT(tc);
            if (!type_comment)
                return NULL;
        }
    }

        return AsyncFunctionDef(name, args, body, decorator_seq, returns, type_comment,
        return FunctionDef(name, args, body, decorator_seq, returns, type_comment,
                              "dict comprehension");
                                  "positional argument follows "
                                  "keyword argument unpacking");
                                  "positional argument follows "
                                  "keyword argument");
                              "iterable argument unpacking follows "
                              "keyword argument unpacking");
                                  "positional argument follows "
                                  "keyword argument unpacking");
                                  "positional argument follows "
                                  "keyword argument");
                                  "keyword argument repeated");
                     [('=' (yield_expr|testlist_star_expr))+ [TYPE_COMMENT]] )
       annassign: ':' test ['=' (yield_expr|testlist)]
       testlist_star_expr: (test|star_expr) (',' (test|star_expr))* [',']
       augassign: ('+=' | '-=' | '*=' | '@=' | '/=' | '%=' | '&=' | '|=' | '^=' |
                   '<<=' | '>>=' | '**=' | '//=')
    int num = NCH(n);
    if (num == 1) {
        int i, nch_minus_type, has_type_comment;
        string type_comment;

        has_type_comment = TYPE(CHILD(n, num - 1)) == TYPE_COMMENT;
        nch_minus_type = num - has_type_comment;

        targets = _Py_asdl_seq_new(nch_minus_type / 2, c->c_arena);
        for (i = 0; i < nch_minus_type - 2; i += 2) {
        value = CHILD(n, nch_minus_type - 1);
        if (has_type_comment) {
            type_comment = NEW_TYPE_COMMENT(CHILD(n, nch_minus_type));
            if (!type_comment)
                return NULL;
        }
        else
            type_comment = NULL;
        return Assign(targets, expression, type_comment, LINENO(n), n->n_col_offset,
                ast_error(c, n,
                          "trailing comma not allowed without"
                          " surrounding parentheses");
    /* suite: simple_stmt | NEWLINE [TYPE_COMMENT NEWLINE] INDENT stmt+ DEDENT */
    if (TYPE(n) != func_body_suite) {
        REQ(n, suite);
    }
        i = 2;
        if (TYPE(CHILD(n, 1)) == TYPE_COMMENT) {
            i += 2;
            REQ(CHILD(n, 2), NEWLINE);
        }

        for (; i < (NCH(n) - 1); i++) {
    int has_type_comment;
    string type_comment;
    /* for_stmt: 'for' exprlist 'in' testlist ':' [TYPE_COMMENT] suite ['else' ':' suite] */
    has_type_comment = TYPE(CHILD(n, 5)) == TYPE_COMMENT;

    if (NCH(n) == 9 + has_type_comment) {
        seq = ast_for_suite(c, CHILD(n, 8 + has_type_comment));
    suite_seq = ast_for_suite(c, CHILD(n, 5 + has_type_comment));

    if (has_type_comment) {
        type_comment = NEW_TYPE_COMMENT(CHILD(n, 5));
        if (!type_comment)
            return NULL;
    }
    else
        type_comment = NULL;

        return AsyncFor(target, expression, suite_seq, seq, type_comment,
        return For(target, expression, suite_seq, seq, type_comment,
/* with_stmt: 'with' with_item (',' with_item)*  ':' [TYPE_COMMENT] suite */
    int i, n_items, nch_minus_type, has_type_comment, end_lineno, end_col_offset;
    string type_comment;
    has_type_comment = TYPE(CHILD(n, NCH(n) - 2)) == TYPE_COMMENT;
    nch_minus_type = NCH(n) - has_type_comment;

    n_items = (nch_minus_type - 2) / 2;
    for (i = 1; i < nch_minus_type - 2; i += 2) {
    if (has_type_comment) {
        type_comment = NEW_TYPE_COMMENT(CHILD(n, NCH(n) - 2));
        if (!type_comment)
            return NULL;
    }
    else
        type_comment = NULL;

        return AsyncWith(items, body, type_comment, LINENO(n0), n0->n_col_offset,
        return With(items, body, type_comment, LINENO(n), n->n_col_offset,
            ast_error(c, n,
                      "f-string expression part "
                      "cannot include a backslash");
            ast_error(c, n,
                      "f-string: invalid conversion character: "
                      "expected 's', 'r', or 'a'");
                ast_error(c, n,
                          "bytes can only contain ASCII "
    int start[] = {Py_file_input, Py_eval_input, Py_single_input, Py_func_type_input};
        ~(PyCF_MASK | PyCF_MASK_OBSOLETE | PyCF_DONT_IMPLY_DEDENT | PyCF_ONLY_AST | PyCF_TYPE_COMMENTS))
    else if (strcmp(mode, "func_type") == 0) {
        if (!(flags & PyCF_ONLY_AST)) {
            PyErr_SetString(PyExc_ValueError,
                            "compile() mode 'func_type' requires flag PyCF_ONLY_AST");
            goto error;
        }
        compile_mode = 3;
    }
        const char *msg;
        if (flags & PyCF_ONLY_AST)
            msg = "compile() mode must be 'exec', 'eval', 'single' or 'func_type'";
        else
            msg = "compile() mode must be 'exec', 'eval' or 'single'";
        PyErr_SetString(PyExc_ValueError, msg);
static arc arcs_7_5[2] = {
    {29, 8},
    {29, 8},
};
static arc arcs_7_8[1] = {
    {0, 8},
static state states_7[9] = {
    {2, arcs_7_5},
    {1, arcs_7_8},
    {30, 2},
    {31, 1},
    {34, 2},
    {35, 3},
static arc arcs_9_1[4] = {
    {32, 4},
    {33, 5},
    {28, 6},
static arc arcs_9_2[4] = {
    {31, 7},
    {33, 8},
    {28, 6},
    {31, 9},
    {26, 10},
static arc arcs_9_5[5] = {
    {28, 11},
    {31, 12},
    {34, 13},
    {35, 3},
static arc arcs_9_6[1] = {
    {33, 8},
    {28, 6},
static arc arcs_9_8[4] = {
    {28, 14},
    {31, 15},
    {35, 3},
static arc arcs_9_9[3] = {
    {33, 16},
    {28, 6},
    {33, 5},
    {28, 6},
static arc arcs_9_11[4] = {
    {31, 12},
    {34, 13},
    {35, 3},
static arc arcs_9_12[4] = {
    {33, 5},
    {32, 4},
    {28, 6},
static arc arcs_9_13[4] = {
    {31, 17},
    {33, 18},
    {28, 6},
static arc arcs_9_14[3] = {
    {31, 15},
    {35, 3},
static arc arcs_9_15[4] = {
    {33, 8},
    {32, 19},
    {28, 6},
static arc arcs_9_16[2] = {
    {28, 6},
    {0, 16},
    {33, 18},
    {28, 6},
static arc arcs_9_18[4] = {
    {28, 20},
    {31, 21},
    {35, 3},
    {0, 18},
};
static arc arcs_9_19[1] = {
    {26, 7},
static arc arcs_9_20[3] = {
    {31, 21},
    {35, 3},
    {0, 20},
};
static arc arcs_9_21[4] = {
    {33, 18},
    {32, 22},
    {28, 6},
    {0, 21},
};
static arc arcs_9_22[1] = {
    {26, 17},
};
static state states_9[23] = {
    {4, arcs_9_1},
    {4, arcs_9_2},
    {5, arcs_9_5},
    {1, arcs_9_6},
    {4, arcs_9_8},
    {3, arcs_9_9},
    {4, arcs_9_11},
    {4, arcs_9_12},
    {4, arcs_9_13},
    {3, arcs_9_14},
    {4, arcs_9_15},
    {2, arcs_9_16},
    {4, arcs_9_18},
    {1, arcs_9_19},
    {3, arcs_9_20},
    {4, arcs_9_21},
    {1, arcs_9_22},
    {37, 1},
    {34, 2},
    {35, 3},
    {32, 4},
    {33, 5},
    {37, 6},
    {33, 7},
    {37, 8},
    {37, 10},
    {34, 11},
    {35, 3},
    {33, 7},
    {37, 12},
    {35, 3},
    {33, 13},
    {33, 5},
    {33, 5},
    {32, 4},
    {37, 14},
    {33, 15},
    {33, 7},
    {32, 16},
    {33, 15},
    {37, 17},
    {35, 3},
    {33, 15},
    {32, 18},
    {38, 1},
    {39, 2},
    {38, 1},
    {47, 1},
    {48, 1},
    {49, 2},
    {50, 3},
    {32, 4},
    {51, 2},
    {51, 5},
    {48, 5},
static arc arcs_16_5[3] = {
    {32, 4},
    {28, 2},
    {3, arcs_16_5},
    {32, 3},
    {51, 4},
    {52, 1},
    {33, 2},
    {52, 1},
    {65, 1},
    {66, 1},
    {67, 2},
    {68, 1},
    {73, 1},
    {74, 1},
    {75, 1},
    {76, 1},
    {48, 2},
    {51, 1},
    {77, 1},
    {78, 3},
    {80, 1},
    {81, 1},
    {82, 2},
    {78, 1},
    {84, 2},
    {84, 2},
    {81, 4},
    {81, 4},
    {34, 5},
    {85, 5},
    {85, 7},
    {87, 2},
    {87, 2},
    {86, 1},
    {33, 2},
    {86, 1},
    {88, 1},
    {33, 0},
    {83, 0},
    {89, 1},
    {33, 1},
    {90, 1},
    {33, 1},
    {91, 1},
    {33, 3},
    {96, 1},
    {97, 1},
    {96, 2},
    {94, 2},
    {98, 1},
    {99, 2},
    {100, 4},
    {101, 1},
    {102, 5},
    {100, 7},
    {103, 1},
    {100, 4},
    {102, 5},
    {100, 7},
    {104, 1},
    {67, 2},
    {105, 3},
static arc arcs_43_5[2] = {
    {100, 7},
static arc arcs_43_6[1] = {
static arc arcs_43_7[2] = {
    {102, 8},
    {0, 7},
    {27, 9},
    {100, 10},
};
static arc arcs_43_10[1] = {
    {0, 10},
static state states_43[11] = {
    {2, arcs_43_5},
    {1, arcs_43_6},
    {2, arcs_43_7},
    {1, arcs_43_10},
    {106, 1},
    {100, 3},
    {107, 4},
    {108, 5},
    {100, 8},
    {100, 9},
    {107, 4},
    {102, 10},
    {108, 5},
    {100, 12},
    {108, 5},
    {109, 1},
    {110, 2},
    {33, 1},
static arc arcs_45_3[2] = {
    {100, 5},
    {100, 5},
static arc arcs_45_5[1] = {
    {0, 5},
};
static state states_45[6] = {
    {2, arcs_45_3},
    {1, arcs_45_5},
    {87, 2},
    {111, 3},
    {112, 1},
    {87, 3},
    {113, 3},
    {114, 1},
    {115, 2},
    {116, 1},
    {117, 2},
    {98, 3},
    {116, 4},
    {102, 5},
    {116, 1},
    {119, 1},
    {120, 1},
    {36, 2},
    {120, 1},
    {36, 2},
    {118, 4},
    {121, 1},
    {122, 0},
    {123, 1},
    {124, 0},
    {125, 1},
    {126, 2},
    {123, 2},
    {111, 1},
    {127, 0},
    {133, 1},
    {134, 1},
    {105, 1},
    {125, 2},
    {135, 3},
    {105, 1},
    {125, 1},
    {34, 1},
    {111, 2},
    {136, 1},
    {137, 0},
    {138, 1},
    {139, 0},
    {140, 1},
    {141, 0},
    {142, 1},
    {143, 0},
    {144, 0},
    {145, 1},
    {146, 0},
    {147, 0},
    {148, 1},
    {34, 0},
    {150, 0},
    {151, 0},
    {146, 1},
    {147, 1},
    {152, 1},
    {153, 2},
    {148, 2},
    {154, 1},
    {35, 2},
    {148, 3},
    {155, 1},
    {156, 2},
    {156, 2},
    {157, 2},
    {159, 2},
    {161, 3},
    {165, 5},
    {84, 4},
    {167, 4},
    {168, 4},
    {51, 6},
    {158, 6},
    {158, 7},
    {160, 4},
    {162, 8},
    {163, 4},
    {165, 5},
    {160, 4},
    {163, 4},
    {99, 1},
    {52, 1},
    {169, 2},
    {33, 3},
    {99, 4},
    {52, 4},
    {33, 3},
    {159, 2},
    {83, 3},
    {170, 6},
    {160, 5},
    {171, 1},
    {33, 2},
    {171, 1},
    {172, 4},
    {172, 4},
    {111, 1},
    {52, 1},
    {33, 2},
    {111, 1},
    {52, 1},
    {33, 2},
    {35, 2},
    {52, 3},
    {169, 5},
    {33, 6},
    {111, 7},
    {169, 5},
    {33, 6},
    {52, 8},
    {169, 5},
    {33, 9},
    {33, 6},
    {35, 11},
    {111, 13},
    {33, 9},
    {173, 1},
    {100, 7},
    {174, 1},
    {33, 2},
    {174, 1},
    {35, 2},
    {169, 3},
    {115, 2},
    {32, 2},
    {169, 1},
    {176, 1},
    {104, 1},
    {67, 2},
    {105, 3},
    {116, 4},
    {175, 5},
    {177, 2},
    {177, 2},
    {98, 1},
    {118, 2},
    {175, 3},
    {179, 1},
    {180, 2},
    {78, 1},
    {48, 2},
static arc arcs_88_0[2] = {
    {3, 1},
    {2, 2},
};
static arc arcs_88_1[1] = {
    {0, 1},
};
static arc arcs_88_2[2] = {
    {28, 3},
    {113, 4},
};
static arc arcs_88_3[1] = {
    {2, 5},
};
static arc arcs_88_4[1] = {
    {6, 6},
};
static arc arcs_88_5[1] = {
    {113, 4},
};
static arc arcs_88_6[2] = {
    {6, 6},
    {114, 1},
};
static state states_88[7] = {
    {2, arcs_88_0},
    {1, arcs_88_1},
    {2, arcs_88_2},
    {1, arcs_88_3},
    {1, arcs_88_4},
    {1, arcs_88_5},
    {2, arcs_88_6},
};
static arc arcs_89_0[1] = {
    {182, 1},
};
static arc arcs_89_1[2] = {
    {2, 1},
    {7, 2},
};
static arc arcs_89_2[1] = {
    {0, 2},
};
static state states_89[3] = {
    {1, arcs_89_0},
    {2, arcs_89_1},
    {1, arcs_89_2},
};
static arc arcs_90_0[1] = {
    {13, 1},
};
static arc arcs_90_1[2] = {
    {183, 2},
    {15, 3},
};
static arc arcs_90_2[1] = {
    {15, 3},
};
static arc arcs_90_3[1] = {
    {25, 4},
};
static arc arcs_90_4[1] = {
    {26, 5},
};
static arc arcs_90_5[1] = {
    {0, 5},
};
static state states_90[6] = {
    {1, arcs_90_0},
    {2, arcs_90_1},
    {1, arcs_90_2},
    {1, arcs_90_3},
    {1, arcs_90_4},
    {1, arcs_90_5},
};
static arc arcs_91_0[3] = {
    {26, 1},
    {34, 2},
    {35, 3},
};
static arc arcs_91_1[2] = {
    {33, 4},
    {0, 1},
};
static arc arcs_91_2[3] = {
    {26, 5},
    {33, 6},
    {0, 2},
};
static arc arcs_91_3[1] = {
    {26, 7},
};
static arc arcs_91_4[4] = {
    {26, 1},
    {34, 8},
    {35, 3},
    {0, 4},
};
static arc arcs_91_5[2] = {
    {33, 6},
    {0, 5},
};
static arc arcs_91_6[2] = {
    {26, 5},
    {35, 3},
};
static arc arcs_91_7[1] = {
    {0, 7},
};
static arc arcs_91_8[3] = {
    {26, 9},
    {33, 10},
    {0, 8},
};
static arc arcs_91_9[2] = {
    {33, 10},
    {0, 9},
};
static arc arcs_91_10[2] = {
    {26, 9},
    {35, 3},
};
static state states_91[11] = {
    {3, arcs_91_0},
    {2, arcs_91_1},
    {3, arcs_91_2},
    {1, arcs_91_3},
    {4, arcs_91_4},
    {2, arcs_91_5},
    {2, arcs_91_6},
    {1, arcs_91_7},
    {3, arcs_91_8},
    {2, arcs_91_9},
    {2, arcs_91_10},
};
static dfa dfas[92] = {
     "\004\050\340\000\004\000\000\000\024\174\022\016\204\045\000\041\000\000\014\211\362\041\010"},
     "\204\050\340\000\004\000\000\000\024\174\022\016\204\045\000\041\000\000\014\211\362\041\010"},
     "\000\040\200\000\000\000\000\000\000\000\020\000\000\000\000\041\000\000\014\211\362\001\000"},
    {263, "funcdef", 0, 9, states_7,
    {265, "typedargslist", 0, 23, states_9,
     "\000\000\200\000\014\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
     "\000\000\200\000\014\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
     "\000\050\340\000\004\000\000\000\024\174\022\016\204\045\000\041\000\000\014\211\362\041\010"},
     "\000\040\200\000\004\000\000\000\024\174\022\016\000\000\000\041\000\000\014\211\362\001\010"},
     "\000\040\200\000\004\000\000\000\024\174\022\016\000\000\000\041\000\000\014\211\362\001\010"},
     "\000\040\200\000\004\000\000\000\000\000\020\000\000\000\000\041\000\000\014\211\362\001\000"},
     "\000\040\200\000\004\000\000\000\000\000\020\000\000\000\000\041\000\000\014\211\362\001\000"},
     "\000\000\000\000\000\000\340\377\003\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
     "\000\000\000\000\000\000\000\000\004\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
     "\000\000\000\000\000\000\000\000\020\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
     "\000\000\000\000\000\000\000\000\000\074\000\000\000\000\000\000\000\000\000\000\000\000\010"},
    {280, "continue_stmt", 0, 2, states_24,
    {281, "return_stmt", 0, 3, states_25,
     "\000\000\000\000\000\000\000\000\000\020\000\000\000\000\000\000\000\000\000\000\000\000\000"},
     "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\010"},
     "\000\000\000\000\000\000\000\000\000\040\000\000\000\000\000\000\000\000\000\000\000\000\000"},
     "\000\000\000\000\000\000\000\000\000\100\002\000\000\000\000\000\000\000\000\000\000\000\000"},
     "\000\000\000\000\000\000\000\000\000\000\002\000\000\000\000\000\000\000\000\000\000\000\000"},
     "\000\000\000\000\000\000\000\000\000\100\000\000\000\000\000\000\000\000\000\000\000\000\000"},
    {293, "nonlocal_stmt", 0, 3, states_37,
    {294, "assert_stmt", 0, 5, states_38,
     "\000\000\000\000\000\000\000\000\000\000\000\010\000\000\000\000\000\000\000\000\000\000\000"},
     "\000\010\140\000\000\000\000\000\000\000\000\000\204\045\000\000\000\000\000\000\000\040\000"},
     "\000\000\000\000\000\000\000\000\000\000\000\000\004\000\000\000\000\000\000\000\000\000\000"},
     "\000\000\000\000\000\000\000\000\000\000\000\000\200\000\000\000\000\000\000\000\000\000\000"},
    {299, "for_stmt", 0, 11, states_43,
    {300, "try_stmt", 0, 13, states_44,
     "\000\000\000\000\000\000\000\000\000\000\000\000\000\004\000\000\000\000\000\000\000\000\000"},
    {301, "with_stmt", 0, 6, states_45,
     "\000\000\000\000\000\000\000\000\000\000\000\000\000\040\000\000\000\000\000\000\000\000\000"},
     "\000\040\200\000\000\000\000\000\000\000\020\000\000\000\000\041\000\000\014\211\362\001\000"},
     "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\001\000\000\000\000\000\000\000\000"},
     "\004\040\200\000\004\000\000\000\024\174\022\016\000\000\000\041\000\000\014\211\362\001\010"},
     "\000\040\200\000\000\000\000\000\000\000\020\000\000\000\000\041\000\000\014\211\362\001\000"},
     "\000\040\200\000\000\000\000\000\000\000\020\000\000\000\000\041\000\000\014\211\362\001\000"},
     "\000\040\200\000\000\000\000\000\000\000\020\000\000\000\000\041\000\000\014\211\362\001\000"},
     "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\001\000\000\000\000\000\000\000"},
     "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\001\000\000\000\000\000\000\000"},
     "\000\040\200\000\000\000\000\000\000\000\020\000\000\000\000\040\000\000\014\211\362\001\000"},
     "\000\040\200\000\000\000\000\000\000\000\020\000\000\000\000\040\000\000\014\211\362\001\000"},
     "\000\040\200\000\000\000\000\000\000\000\020\000\000\000\000\040\000\000\014\211\362\001\000"},
     "\000\040\200\000\000\000\000\000\000\000\020\000\000\000\000\000\000\000\014\211\362\001\000"},
     "\000\000\000\000\000\000\000\000\000\000\000\000\000\002\000\040\377\000\000\000\000\000\000"},
     "\000\000\000\000\004\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
     "\000\040\200\000\000\000\000\000\000\000\020\000\000\000\000\000\000\000\014\211\362\001\000"},
     "\000\040\200\000\000\000\000\000\000\000\020\000\000\000\000\000\000\000\014\211\362\001\000"},
     "\000\040\200\000\000\000\000\000\000\000\020\000\000\000\000\000\000\000\014\211\362\001\000"},
     "\000\040\200\000\000\000\000\000\000\000\020\000\000\000\000\000\000\000\014\211\362\001\000"},
     "\000\040\200\000\000\000\000\000\000\000\020\000\000\000\000\000\000\000\014\211\362\001\000"},
     "\000\040\200\000\000\000\000\000\000\000\020\000\000\000\000\000\000\000\014\211\362\001\000"},
     "\000\040\200\000\000\000\000\000\000\000\020\000\000\000\000\000\000\000\014\211\362\001\000"},
     "\000\040\200\000\000\000\000\000\000\000\020\000\000\000\000\000\000\000\000\210\362\001\000"},
     "\000\040\200\000\000\000\000\000\000\000\020\000\000\000\000\000\000\000\000\210\362\001\000"},
     "\000\040\200\000\000\000\000\000\000\000\020\000\000\000\000\000\000\000\000\200\362\001\000"},
     "\000\040\200\000\004\000\000\000\000\000\020\000\000\000\000\041\000\000\014\211\362\001\000"},
     "\000\040\000\000\000\000\000\000\000\000\010\000\000\000\000\000\000\000\000\200\000\000\000"},
     "\000\040\200\010\000\000\000\000\000\000\020\000\000\000\000\041\000\000\014\211\362\001\000"},
     "\000\040\200\010\000\000\000\000\000\000\020\000\000\000\000\041\000\000\014\211\362\001\000"},
     "\000\040\200\000\004\000\000\000\000\000\020\000\000\000\000\000\000\000\014\211\362\001\000"},
     "\000\040\200\000\000\000\000\000\000\000\020\000\000\000\000\041\000\000\014\211\362\001\000"},
     "\000\040\200\000\014\000\000\000\000\000\020\000\000\000\000\041\000\000\014\211\362\001\000"},
     "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\040\000"},
     "\000\040\200\000\014\000\000\000\000\000\020\000\000\000\000\041\000\000\014\211\362\001\000"},
     "\000\040\200\000\014\000\000\000\000\000\020\000\000\000\000\041\000\000\014\211\362\001\000"},
     "\000\000\040\000\000\000\000\000\000\000\000\000\004\001\000\000\000\000\000\000\000\000\000"},
     "\000\000\000\000\000\000\000\000\000\000\000\000\000\001\000\000\000\000\000\000\000\000\000"},
     "\000\000\040\000\000\000\000\000\000\000\000\000\000\001\000\000\000\000\000\000\000\000\000"},
     "\000\000\000\000\000\000\000\000\000\000\000\000\004\000\000\000\000\000\000\000\000\000\000"},
     "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\010"},
     "\000\040\200\000\004\000\000\000\000\100\020\000\000\000\000\041\000\000\014\211\362\001\000"},
    {344, "func_body_suite", 0, 7, states_88,
     "\004\040\200\000\004\000\000\000\024\174\022\016\000\000\000\041\000\000\014\211\362\001\010"},
    {345, "func_type_input", 0, 3, states_89,
     "\000\040\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
    {346, "func_type", 0, 6, states_90,
     "\000\040\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
    {347, "typelist", 0, 11, states_91,
     "\000\040\200\000\014\000\000\000\000\000\020\000\000\000\000\041\000\000\014\211\362\001\000"},
static label labels[184] = {
    {56, 0},
    {344, 0},
    {304, 0},
    {345, 0},
    {346, 0},
    {347, 0},
    92,
    {184, labels},
    if (flags->cf_flags & PyCF_TYPE_COMMENTS)
        parser_flags |= PyPARSE_TYPE_COMMENTS;