Coverage Report

Created: 2025-10-10 06:33

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/cpython/Python/Python-ast.c
Line
Count
Source
1
// File automatically generated by Parser/asdl_c.py.
2
3
#include "Python.h"
4
#include "pycore_ast.h"
5
#include "pycore_ast_state.h"     // struct ast_state
6
#include "pycore_ceval.h"         // _Py_EnterRecursiveCall()
7
#include "pycore_lock.h"          // _PyOnceFlag
8
#include "pycore_modsupport.h"    // _PyArg_NoPositional()
9
#include "pycore_pystate.h"       // _PyInterpreterState_GET()
10
#include "pycore_runtime.h"       // _Py_ID()
11
#include "pycore_setobject.h"     // _PySet_NextEntry()
12
#include "pycore_unionobject.h"   // _Py_union_type_or
13
14
#include <stddef.h>               // offsetof()
15
16
17
// Forward declaration
18
static int init_types(void *arg);
19
20
static struct ast_state*
21
get_ast_state(void)
22
28.7k
{
23
28.7k
    PyInterpreterState *interp = _PyInterpreterState_GET();
24
28.7k
    struct ast_state *state = &interp->ast;
25
28.7k
    assert(!state->finalized);
26
28.7k
    if (_PyOnceFlag_CallOnce(&state->once, (_Py_once_fn_t *)&init_types, state) < 0) {
27
0
        return NULL;
28
0
    }
29
28.7k
    return state;
30
28.7k
}
31
32
void _PyAST_Fini(PyInterpreterState *interp)
33
0
{
34
0
    struct ast_state *state = &interp->ast;
35
36
0
    Py_CLEAR(state->AST_type);
37
0
    Py_CLEAR(state->Add_singleton);
38
0
    Py_CLEAR(state->Add_type);
39
0
    Py_CLEAR(state->And_singleton);
40
0
    Py_CLEAR(state->And_type);
41
0
    Py_CLEAR(state->AnnAssign_type);
42
0
    Py_CLEAR(state->Assert_type);
43
0
    Py_CLEAR(state->Assign_type);
44
0
    Py_CLEAR(state->AsyncFor_type);
45
0
    Py_CLEAR(state->AsyncFunctionDef_type);
46
0
    Py_CLEAR(state->AsyncWith_type);
47
0
    Py_CLEAR(state->Attribute_type);
48
0
    Py_CLEAR(state->AugAssign_type);
49
0
    Py_CLEAR(state->Await_type);
50
0
    Py_CLEAR(state->BinOp_type);
51
0
    Py_CLEAR(state->BitAnd_singleton);
52
0
    Py_CLEAR(state->BitAnd_type);
53
0
    Py_CLEAR(state->BitOr_singleton);
54
0
    Py_CLEAR(state->BitOr_type);
55
0
    Py_CLEAR(state->BitXor_singleton);
56
0
    Py_CLEAR(state->BitXor_type);
57
0
    Py_CLEAR(state->BoolOp_type);
58
0
    Py_CLEAR(state->Break_type);
59
0
    Py_CLEAR(state->Call_type);
60
0
    Py_CLEAR(state->ClassDef_type);
61
0
    Py_CLEAR(state->Compare_type);
62
0
    Py_CLEAR(state->Constant_type);
63
0
    Py_CLEAR(state->Continue_type);
64
0
    Py_CLEAR(state->Del_singleton);
65
0
    Py_CLEAR(state->Del_type);
66
0
    Py_CLEAR(state->Delete_type);
67
0
    Py_CLEAR(state->DictComp_type);
68
0
    Py_CLEAR(state->Dict_type);
69
0
    Py_CLEAR(state->Div_singleton);
70
0
    Py_CLEAR(state->Div_type);
71
0
    Py_CLEAR(state->Eq_singleton);
72
0
    Py_CLEAR(state->Eq_type);
73
0
    Py_CLEAR(state->ExceptHandler_type);
74
0
    Py_CLEAR(state->Expr_type);
75
0
    Py_CLEAR(state->Expression_type);
76
0
    Py_CLEAR(state->FloorDiv_singleton);
77
0
    Py_CLEAR(state->FloorDiv_type);
78
0
    Py_CLEAR(state->For_type);
79
0
    Py_CLEAR(state->FormattedValue_type);
80
0
    Py_CLEAR(state->FunctionDef_type);
81
0
    Py_CLEAR(state->FunctionType_type);
82
0
    Py_CLEAR(state->GeneratorExp_type);
83
0
    Py_CLEAR(state->Global_type);
84
0
    Py_CLEAR(state->GtE_singleton);
85
0
    Py_CLEAR(state->GtE_type);
86
0
    Py_CLEAR(state->Gt_singleton);
87
0
    Py_CLEAR(state->Gt_type);
88
0
    Py_CLEAR(state->IfExp_type);
89
0
    Py_CLEAR(state->If_type);
90
0
    Py_CLEAR(state->ImportFrom_type);
91
0
    Py_CLEAR(state->Import_type);
92
0
    Py_CLEAR(state->In_singleton);
93
0
    Py_CLEAR(state->In_type);
94
0
    Py_CLEAR(state->Interactive_type);
95
0
    Py_CLEAR(state->Interpolation_type);
96
0
    Py_CLEAR(state->Invert_singleton);
97
0
    Py_CLEAR(state->Invert_type);
98
0
    Py_CLEAR(state->IsNot_singleton);
99
0
    Py_CLEAR(state->IsNot_type);
100
0
    Py_CLEAR(state->Is_singleton);
101
0
    Py_CLEAR(state->Is_type);
102
0
    Py_CLEAR(state->JoinedStr_type);
103
0
    Py_CLEAR(state->LShift_singleton);
104
0
    Py_CLEAR(state->LShift_type);
105
0
    Py_CLEAR(state->Lambda_type);
106
0
    Py_CLEAR(state->ListComp_type);
107
0
    Py_CLEAR(state->List_type);
108
0
    Py_CLEAR(state->Load_singleton);
109
0
    Py_CLEAR(state->Load_type);
110
0
    Py_CLEAR(state->LtE_singleton);
111
0
    Py_CLEAR(state->LtE_type);
112
0
    Py_CLEAR(state->Lt_singleton);
113
0
    Py_CLEAR(state->Lt_type);
114
0
    Py_CLEAR(state->MatMult_singleton);
115
0
    Py_CLEAR(state->MatMult_type);
116
0
    Py_CLEAR(state->MatchAs_type);
117
0
    Py_CLEAR(state->MatchClass_type);
118
0
    Py_CLEAR(state->MatchMapping_type);
119
0
    Py_CLEAR(state->MatchOr_type);
120
0
    Py_CLEAR(state->MatchSequence_type);
121
0
    Py_CLEAR(state->MatchSingleton_type);
122
0
    Py_CLEAR(state->MatchStar_type);
123
0
    Py_CLEAR(state->MatchValue_type);
124
0
    Py_CLEAR(state->Match_type);
125
0
    Py_CLEAR(state->Mod_singleton);
126
0
    Py_CLEAR(state->Mod_type);
127
0
    Py_CLEAR(state->Module_type);
128
0
    Py_CLEAR(state->Mult_singleton);
129
0
    Py_CLEAR(state->Mult_type);
130
0
    Py_CLEAR(state->Name_type);
131
0
    Py_CLEAR(state->NamedExpr_type);
132
0
    Py_CLEAR(state->Nonlocal_type);
133
0
    Py_CLEAR(state->NotEq_singleton);
134
0
    Py_CLEAR(state->NotEq_type);
135
0
    Py_CLEAR(state->NotIn_singleton);
136
0
    Py_CLEAR(state->NotIn_type);
137
0
    Py_CLEAR(state->Not_singleton);
138
0
    Py_CLEAR(state->Not_type);
139
0
    Py_CLEAR(state->Or_singleton);
140
0
    Py_CLEAR(state->Or_type);
141
0
    Py_CLEAR(state->ParamSpec_type);
142
0
    Py_CLEAR(state->Pass_type);
143
0
    Py_CLEAR(state->Pow_singleton);
144
0
    Py_CLEAR(state->Pow_type);
145
0
    Py_CLEAR(state->RShift_singleton);
146
0
    Py_CLEAR(state->RShift_type);
147
0
    Py_CLEAR(state->Raise_type);
148
0
    Py_CLEAR(state->Return_type);
149
0
    Py_CLEAR(state->SetComp_type);
150
0
    Py_CLEAR(state->Set_type);
151
0
    Py_CLEAR(state->Slice_type);
152
0
    Py_CLEAR(state->Starred_type);
153
0
    Py_CLEAR(state->Store_singleton);
154
0
    Py_CLEAR(state->Store_type);
155
0
    Py_CLEAR(state->Sub_singleton);
156
0
    Py_CLEAR(state->Sub_type);
157
0
    Py_CLEAR(state->Subscript_type);
158
0
    Py_CLEAR(state->TemplateStr_type);
159
0
    Py_CLEAR(state->TryStar_type);
160
0
    Py_CLEAR(state->Try_type);
161
0
    Py_CLEAR(state->Tuple_type);
162
0
    Py_CLEAR(state->TypeAlias_type);
163
0
    Py_CLEAR(state->TypeIgnore_type);
164
0
    Py_CLEAR(state->TypeVarTuple_type);
165
0
    Py_CLEAR(state->TypeVar_type);
166
0
    Py_CLEAR(state->UAdd_singleton);
167
0
    Py_CLEAR(state->UAdd_type);
168
0
    Py_CLEAR(state->USub_singleton);
169
0
    Py_CLEAR(state->USub_type);
170
0
    Py_CLEAR(state->UnaryOp_type);
171
0
    Py_CLEAR(state->While_type);
172
0
    Py_CLEAR(state->With_type);
173
0
    Py_CLEAR(state->YieldFrom_type);
174
0
    Py_CLEAR(state->Yield_type);
175
0
    Py_CLEAR(state->__dict__);
176
0
    Py_CLEAR(state->__doc__);
177
0
    Py_CLEAR(state->__match_args__);
178
0
    Py_CLEAR(state->__module__);
179
0
    Py_CLEAR(state->_attributes);
180
0
    Py_CLEAR(state->_fields);
181
0
    Py_CLEAR(state->alias_type);
182
0
    Py_CLEAR(state->annotation);
183
0
    Py_CLEAR(state->arg);
184
0
    Py_CLEAR(state->arg_type);
185
0
    Py_CLEAR(state->args);
186
0
    Py_CLEAR(state->argtypes);
187
0
    Py_CLEAR(state->arguments_type);
188
0
    Py_CLEAR(state->asname);
189
0
    Py_CLEAR(state->ast);
190
0
    Py_CLEAR(state->attr);
191
0
    Py_CLEAR(state->bases);
192
0
    Py_CLEAR(state->body);
193
0
    Py_CLEAR(state->boolop_type);
194
0
    Py_CLEAR(state->bound);
195
0
    Py_CLEAR(state->cases);
196
0
    Py_CLEAR(state->cause);
197
0
    Py_CLEAR(state->cls);
198
0
    Py_CLEAR(state->cmpop_type);
199
0
    Py_CLEAR(state->col_offset);
200
0
    Py_CLEAR(state->comparators);
201
0
    Py_CLEAR(state->comprehension_type);
202
0
    Py_CLEAR(state->context_expr);
203
0
    Py_CLEAR(state->conversion);
204
0
    Py_CLEAR(state->ctx);
205
0
    Py_CLEAR(state->decorator_list);
206
0
    Py_CLEAR(state->default_value);
207
0
    Py_CLEAR(state->defaults);
208
0
    Py_CLEAR(state->elt);
209
0
    Py_CLEAR(state->elts);
210
0
    Py_CLEAR(state->end_col_offset);
211
0
    Py_CLEAR(state->end_lineno);
212
0
    Py_CLEAR(state->exc);
213
0
    Py_CLEAR(state->excepthandler_type);
214
0
    Py_CLEAR(state->expr_context_type);
215
0
    Py_CLEAR(state->expr_type);
216
0
    Py_CLEAR(state->finalbody);
217
0
    Py_CLEAR(state->format_spec);
218
0
    Py_CLEAR(state->func);
219
0
    Py_CLEAR(state->generators);
220
0
    Py_CLEAR(state->guard);
221
0
    Py_CLEAR(state->handlers);
222
0
    Py_CLEAR(state->id);
223
0
    Py_CLEAR(state->ifs);
224
0
    Py_CLEAR(state->is_async);
225
0
    Py_CLEAR(state->items);
226
0
    Py_CLEAR(state->iter);
227
0
    Py_CLEAR(state->key);
228
0
    Py_CLEAR(state->keys);
229
0
    Py_CLEAR(state->keyword_type);
230
0
    Py_CLEAR(state->keywords);
231
0
    Py_CLEAR(state->kind);
232
0
    Py_CLEAR(state->kw_defaults);
233
0
    Py_CLEAR(state->kwarg);
234
0
    Py_CLEAR(state->kwd_attrs);
235
0
    Py_CLEAR(state->kwd_patterns);
236
0
    Py_CLEAR(state->kwonlyargs);
237
0
    Py_CLEAR(state->left);
238
0
    Py_CLEAR(state->level);
239
0
    Py_CLEAR(state->lineno);
240
0
    Py_CLEAR(state->lower);
241
0
    Py_CLEAR(state->match_case_type);
242
0
    Py_CLEAR(state->mod_type);
243
0
    Py_CLEAR(state->module);
244
0
    Py_CLEAR(state->msg);
245
0
    Py_CLEAR(state->name);
246
0
    Py_CLEAR(state->names);
247
0
    Py_CLEAR(state->op);
248
0
    Py_CLEAR(state->operand);
249
0
    Py_CLEAR(state->operator_type);
250
0
    Py_CLEAR(state->ops);
251
0
    Py_CLEAR(state->optional_vars);
252
0
    Py_CLEAR(state->orelse);
253
0
    Py_CLEAR(state->pattern);
254
0
    Py_CLEAR(state->pattern_type);
255
0
    Py_CLEAR(state->patterns);
256
0
    Py_CLEAR(state->posonlyargs);
257
0
    Py_CLEAR(state->rest);
258
0
    Py_CLEAR(state->returns);
259
0
    Py_CLEAR(state->right);
260
0
    Py_CLEAR(state->simple);
261
0
    Py_CLEAR(state->slice);
262
0
    Py_CLEAR(state->step);
263
0
    Py_CLEAR(state->stmt_type);
264
0
    Py_CLEAR(state->str);
265
0
    Py_CLEAR(state->subject);
266
0
    Py_CLEAR(state->tag);
267
0
    Py_CLEAR(state->target);
268
0
    Py_CLEAR(state->targets);
269
0
    Py_CLEAR(state->test);
270
0
    Py_CLEAR(state->type);
271
0
    Py_CLEAR(state->type_comment);
272
0
    Py_CLEAR(state->type_ignore_type);
273
0
    Py_CLEAR(state->type_ignores);
274
0
    Py_CLEAR(state->type_param_type);
275
0
    Py_CLEAR(state->type_params);
276
0
    Py_CLEAR(state->unaryop_type);
277
0
    Py_CLEAR(state->upper);
278
0
    Py_CLEAR(state->value);
279
0
    Py_CLEAR(state->values);
280
0
    Py_CLEAR(state->vararg);
281
0
    Py_CLEAR(state->withitem_type);
282
283
0
    state->finalized = 1;
284
0
    state->once = (_PyOnceFlag){0};
285
0
}
286
287
static int init_identifiers(struct ast_state *state)
288
11
{
289
11
    if ((state->__dict__ = PyUnicode_InternFromString("__dict__")) == NULL) return -1;
290
11
    if ((state->__doc__ = PyUnicode_InternFromString("__doc__")) == NULL) return -1;
291
11
    if ((state->__match_args__ = PyUnicode_InternFromString("__match_args__")) == NULL) return -1;
292
11
    if ((state->__module__ = PyUnicode_InternFromString("__module__")) == NULL) return -1;
293
11
    if ((state->_attributes = PyUnicode_InternFromString("_attributes")) == NULL) return -1;
294
11
    if ((state->_fields = PyUnicode_InternFromString("_fields")) == NULL) return -1;
295
11
    if ((state->annotation = PyUnicode_InternFromString("annotation")) == NULL) return -1;
296
11
    if ((state->arg = PyUnicode_InternFromString("arg")) == NULL) return -1;
297
11
    if ((state->args = PyUnicode_InternFromString("args")) == NULL) return -1;
298
11
    if ((state->argtypes = PyUnicode_InternFromString("argtypes")) == NULL) return -1;
299
11
    if ((state->asname = PyUnicode_InternFromString("asname")) == NULL) return -1;
300
11
    if ((state->ast = PyUnicode_InternFromString("ast")) == NULL) return -1;
301
11
    if ((state->attr = PyUnicode_InternFromString("attr")) == NULL) return -1;
302
11
    if ((state->bases = PyUnicode_InternFromString("bases")) == NULL) return -1;
303
11
    if ((state->body = PyUnicode_InternFromString("body")) == NULL) return -1;
304
11
    if ((state->bound = PyUnicode_InternFromString("bound")) == NULL) return -1;
305
11
    if ((state->cases = PyUnicode_InternFromString("cases")) == NULL) return -1;
306
11
    if ((state->cause = PyUnicode_InternFromString("cause")) == NULL) return -1;
307
11
    if ((state->cls = PyUnicode_InternFromString("cls")) == NULL) return -1;
308
11
    if ((state->col_offset = PyUnicode_InternFromString("col_offset")) == NULL) return -1;
309
11
    if ((state->comparators = PyUnicode_InternFromString("comparators")) == NULL) return -1;
310
11
    if ((state->context_expr = PyUnicode_InternFromString("context_expr")) == NULL) return -1;
311
11
    if ((state->conversion = PyUnicode_InternFromString("conversion")) == NULL) return -1;
312
11
    if ((state->ctx = PyUnicode_InternFromString("ctx")) == NULL) return -1;
313
11
    if ((state->decorator_list = PyUnicode_InternFromString("decorator_list")) == NULL) return -1;
314
11
    if ((state->default_value = PyUnicode_InternFromString("default_value")) == NULL) return -1;
315
11
    if ((state->defaults = PyUnicode_InternFromString("defaults")) == NULL) return -1;
316
11
    if ((state->elt = PyUnicode_InternFromString("elt")) == NULL) return -1;
317
11
    if ((state->elts = PyUnicode_InternFromString("elts")) == NULL) return -1;
318
11
    if ((state->end_col_offset = PyUnicode_InternFromString("end_col_offset")) == NULL) return -1;
319
11
    if ((state->end_lineno = PyUnicode_InternFromString("end_lineno")) == NULL) return -1;
320
11
    if ((state->exc = PyUnicode_InternFromString("exc")) == NULL) return -1;
321
11
    if ((state->finalbody = PyUnicode_InternFromString("finalbody")) == NULL) return -1;
322
11
    if ((state->format_spec = PyUnicode_InternFromString("format_spec")) == NULL) return -1;
323
11
    if ((state->func = PyUnicode_InternFromString("func")) == NULL) return -1;
324
11
    if ((state->generators = PyUnicode_InternFromString("generators")) == NULL) return -1;
325
11
    if ((state->guard = PyUnicode_InternFromString("guard")) == NULL) return -1;
326
11
    if ((state->handlers = PyUnicode_InternFromString("handlers")) == NULL) return -1;
327
11
    if ((state->id = PyUnicode_InternFromString("id")) == NULL) return -1;
328
11
    if ((state->ifs = PyUnicode_InternFromString("ifs")) == NULL) return -1;
329
11
    if ((state->is_async = PyUnicode_InternFromString("is_async")) == NULL) return -1;
330
11
    if ((state->items = PyUnicode_InternFromString("items")) == NULL) return -1;
331
11
    if ((state->iter = PyUnicode_InternFromString("iter")) == NULL) return -1;
332
11
    if ((state->key = PyUnicode_InternFromString("key")) == NULL) return -1;
333
11
    if ((state->keys = PyUnicode_InternFromString("keys")) == NULL) return -1;
334
11
    if ((state->keywords = PyUnicode_InternFromString("keywords")) == NULL) return -1;
335
11
    if ((state->kind = PyUnicode_InternFromString("kind")) == NULL) return -1;
336
11
    if ((state->kw_defaults = PyUnicode_InternFromString("kw_defaults")) == NULL) return -1;
337
11
    if ((state->kwarg = PyUnicode_InternFromString("kwarg")) == NULL) return -1;
338
11
    if ((state->kwd_attrs = PyUnicode_InternFromString("kwd_attrs")) == NULL) return -1;
339
11
    if ((state->kwd_patterns = PyUnicode_InternFromString("kwd_patterns")) == NULL) return -1;
340
11
    if ((state->kwonlyargs = PyUnicode_InternFromString("kwonlyargs")) == NULL) return -1;
341
11
    if ((state->left = PyUnicode_InternFromString("left")) == NULL) return -1;
342
11
    if ((state->level = PyUnicode_InternFromString("level")) == NULL) return -1;
343
11
    if ((state->lineno = PyUnicode_InternFromString("lineno")) == NULL) return -1;
344
11
    if ((state->lower = PyUnicode_InternFromString("lower")) == NULL) return -1;
345
11
    if ((state->module = PyUnicode_InternFromString("module")) == NULL) return -1;
346
11
    if ((state->msg = PyUnicode_InternFromString("msg")) == NULL) return -1;
347
11
    if ((state->name = PyUnicode_InternFromString("name")) == NULL) return -1;
348
11
    if ((state->names = PyUnicode_InternFromString("names")) == NULL) return -1;
349
11
    if ((state->op = PyUnicode_InternFromString("op")) == NULL) return -1;
350
11
    if ((state->operand = PyUnicode_InternFromString("operand")) == NULL) return -1;
351
11
    if ((state->ops = PyUnicode_InternFromString("ops")) == NULL) return -1;
352
11
    if ((state->optional_vars = PyUnicode_InternFromString("optional_vars")) == NULL) return -1;
353
11
    if ((state->orelse = PyUnicode_InternFromString("orelse")) == NULL) return -1;
354
11
    if ((state->pattern = PyUnicode_InternFromString("pattern")) == NULL) return -1;
355
11
    if ((state->patterns = PyUnicode_InternFromString("patterns")) == NULL) return -1;
356
11
    if ((state->posonlyargs = PyUnicode_InternFromString("posonlyargs")) == NULL) return -1;
357
11
    if ((state->rest = PyUnicode_InternFromString("rest")) == NULL) return -1;
358
11
    if ((state->returns = PyUnicode_InternFromString("returns")) == NULL) return -1;
359
11
    if ((state->right = PyUnicode_InternFromString("right")) == NULL) return -1;
360
11
    if ((state->simple = PyUnicode_InternFromString("simple")) == NULL) return -1;
361
11
    if ((state->slice = PyUnicode_InternFromString("slice")) == NULL) return -1;
362
11
    if ((state->step = PyUnicode_InternFromString("step")) == NULL) return -1;
363
11
    if ((state->str = PyUnicode_InternFromString("str")) == NULL) return -1;
364
11
    if ((state->subject = PyUnicode_InternFromString("subject")) == NULL) return -1;
365
11
    if ((state->tag = PyUnicode_InternFromString("tag")) == NULL) return -1;
366
11
    if ((state->target = PyUnicode_InternFromString("target")) == NULL) return -1;
367
11
    if ((state->targets = PyUnicode_InternFromString("targets")) == NULL) return -1;
368
11
    if ((state->test = PyUnicode_InternFromString("test")) == NULL) return -1;
369
11
    if ((state->type = PyUnicode_InternFromString("type")) == NULL) return -1;
370
11
    if ((state->type_comment = PyUnicode_InternFromString("type_comment")) == NULL) return -1;
371
11
    if ((state->type_ignores = PyUnicode_InternFromString("type_ignores")) == NULL) return -1;
372
11
    if ((state->type_params = PyUnicode_InternFromString("type_params")) == NULL) return -1;
373
11
    if ((state->upper = PyUnicode_InternFromString("upper")) == NULL) return -1;
374
11
    if ((state->value = PyUnicode_InternFromString("value")) == NULL) return -1;
375
11
    if ((state->values = PyUnicode_InternFromString("values")) == NULL) return -1;
376
11
    if ((state->vararg = PyUnicode_InternFromString("vararg")) == NULL) return -1;
377
11
    return 0;
378
11
};
379
380
0
GENERATE_ASDL_SEQ_CONSTRUCTOR(mod, mod_ty)
381
0
GENERATE_ASDL_SEQ_CONSTRUCTOR(stmt, stmt_ty)
382
123k
GENERATE_ASDL_SEQ_CONSTRUCTOR(expr, expr_ty)
383
0
GENERATE_ASDL_SEQ_CONSTRUCTOR(comprehension, comprehension_ty)
384
0
GENERATE_ASDL_SEQ_CONSTRUCTOR(excepthandler, excepthandler_ty)
385
0
GENERATE_ASDL_SEQ_CONSTRUCTOR(arguments, arguments_ty)
386
61.5k
GENERATE_ASDL_SEQ_CONSTRUCTOR(arg, arg_ty)
387
10.5k
GENERATE_ASDL_SEQ_CONSTRUCTOR(keyword, keyword_ty)
388
0
GENERATE_ASDL_SEQ_CONSTRUCTOR(alias, alias_ty)
389
0
GENERATE_ASDL_SEQ_CONSTRUCTOR(withitem, withitem_ty)
390
0
GENERATE_ASDL_SEQ_CONSTRUCTOR(match_case, match_case_ty)
391
1.87k
GENERATE_ASDL_SEQ_CONSTRUCTOR(pattern, pattern_ty)
392
0
GENERATE_ASDL_SEQ_CONSTRUCTOR(type_ignore, type_ignore_ty)
393
0
GENERATE_ASDL_SEQ_CONSTRUCTOR(type_param, type_param_ty)
394
395
static PyObject* ast2obj_mod(struct ast_state *state, void*);
396
static const char * const Module_fields[]={
397
    "body",
398
    "type_ignores",
399
};
400
static const char * const Interactive_fields[]={
401
    "body",
402
};
403
static const char * const Expression_fields[]={
404
    "body",
405
};
406
static const char * const FunctionType_fields[]={
407
    "argtypes",
408
    "returns",
409
};
410
static const char * const stmt_attributes[] = {
411
    "lineno",
412
    "col_offset",
413
    "end_lineno",
414
    "end_col_offset",
415
};
416
static PyObject* ast2obj_stmt(struct ast_state *state, void*);
417
static const char * const FunctionDef_fields[]={
418
    "name",
419
    "args",
420
    "body",
421
    "decorator_list",
422
    "returns",
423
    "type_comment",
424
    "type_params",
425
};
426
static const char * const AsyncFunctionDef_fields[]={
427
    "name",
428
    "args",
429
    "body",
430
    "decorator_list",
431
    "returns",
432
    "type_comment",
433
    "type_params",
434
};
435
static const char * const ClassDef_fields[]={
436
    "name",
437
    "bases",
438
    "keywords",
439
    "body",
440
    "decorator_list",
441
    "type_params",
442
};
443
static const char * const Return_fields[]={
444
    "value",
445
};
446
static const char * const Delete_fields[]={
447
    "targets",
448
};
449
static const char * const Assign_fields[]={
450
    "targets",
451
    "value",
452
    "type_comment",
453
};
454
static const char * const TypeAlias_fields[]={
455
    "name",
456
    "type_params",
457
    "value",
458
};
459
static const char * const AugAssign_fields[]={
460
    "target",
461
    "op",
462
    "value",
463
};
464
static const char * const AnnAssign_fields[]={
465
    "target",
466
    "annotation",
467
    "value",
468
    "simple",
469
};
470
static const char * const For_fields[]={
471
    "target",
472
    "iter",
473
    "body",
474
    "orelse",
475
    "type_comment",
476
};
477
static const char * const AsyncFor_fields[]={
478
    "target",
479
    "iter",
480
    "body",
481
    "orelse",
482
    "type_comment",
483
};
484
static const char * const While_fields[]={
485
    "test",
486
    "body",
487
    "orelse",
488
};
489
static const char * const If_fields[]={
490
    "test",
491
    "body",
492
    "orelse",
493
};
494
static const char * const With_fields[]={
495
    "items",
496
    "body",
497
    "type_comment",
498
};
499
static const char * const AsyncWith_fields[]={
500
    "items",
501
    "body",
502
    "type_comment",
503
};
504
static const char * const Match_fields[]={
505
    "subject",
506
    "cases",
507
};
508
static const char * const Raise_fields[]={
509
    "exc",
510
    "cause",
511
};
512
static const char * const Try_fields[]={
513
    "body",
514
    "handlers",
515
    "orelse",
516
    "finalbody",
517
};
518
static const char * const TryStar_fields[]={
519
    "body",
520
    "handlers",
521
    "orelse",
522
    "finalbody",
523
};
524
static const char * const Assert_fields[]={
525
    "test",
526
    "msg",
527
};
528
static const char * const Import_fields[]={
529
    "names",
530
};
531
static const char * const ImportFrom_fields[]={
532
    "module",
533
    "names",
534
    "level",
535
};
536
static const char * const Global_fields[]={
537
    "names",
538
};
539
static const char * const Nonlocal_fields[]={
540
    "names",
541
};
542
static const char * const Expr_fields[]={
543
    "value",
544
};
545
static const char * const expr_attributes[] = {
546
    "lineno",
547
    "col_offset",
548
    "end_lineno",
549
    "end_col_offset",
550
};
551
static PyObject* ast2obj_expr(struct ast_state *state, void*);
552
static const char * const BoolOp_fields[]={
553
    "op",
554
    "values",
555
};
556
static const char * const NamedExpr_fields[]={
557
    "target",
558
    "value",
559
};
560
static const char * const BinOp_fields[]={
561
    "left",
562
    "op",
563
    "right",
564
};
565
static const char * const UnaryOp_fields[]={
566
    "op",
567
    "operand",
568
};
569
static const char * const Lambda_fields[]={
570
    "args",
571
    "body",
572
};
573
static const char * const IfExp_fields[]={
574
    "test",
575
    "body",
576
    "orelse",
577
};
578
static const char * const Dict_fields[]={
579
    "keys",
580
    "values",
581
};
582
static const char * const Set_fields[]={
583
    "elts",
584
};
585
static const char * const ListComp_fields[]={
586
    "elt",
587
    "generators",
588
};
589
static const char * const SetComp_fields[]={
590
    "elt",
591
    "generators",
592
};
593
static const char * const DictComp_fields[]={
594
    "key",
595
    "value",
596
    "generators",
597
};
598
static const char * const GeneratorExp_fields[]={
599
    "elt",
600
    "generators",
601
};
602
static const char * const Await_fields[]={
603
    "value",
604
};
605
static const char * const Yield_fields[]={
606
    "value",
607
};
608
static const char * const YieldFrom_fields[]={
609
    "value",
610
};
611
static const char * const Compare_fields[]={
612
    "left",
613
    "ops",
614
    "comparators",
615
};
616
static const char * const Call_fields[]={
617
    "func",
618
    "args",
619
    "keywords",
620
};
621
static const char * const FormattedValue_fields[]={
622
    "value",
623
    "conversion",
624
    "format_spec",
625
};
626
static const char * const Interpolation_fields[]={
627
    "value",
628
    "str",
629
    "conversion",
630
    "format_spec",
631
};
632
static const char * const JoinedStr_fields[]={
633
    "values",
634
};
635
static const char * const TemplateStr_fields[]={
636
    "values",
637
};
638
static const char * const Constant_fields[]={
639
    "value",
640
    "kind",
641
};
642
static const char * const Attribute_fields[]={
643
    "value",
644
    "attr",
645
    "ctx",
646
};
647
static const char * const Subscript_fields[]={
648
    "value",
649
    "slice",
650
    "ctx",
651
};
652
static const char * const Starred_fields[]={
653
    "value",
654
    "ctx",
655
};
656
static const char * const Name_fields[]={
657
    "id",
658
    "ctx",
659
};
660
static const char * const List_fields[]={
661
    "elts",
662
    "ctx",
663
};
664
static const char * const Tuple_fields[]={
665
    "elts",
666
    "ctx",
667
};
668
static const char * const Slice_fields[]={
669
    "lower",
670
    "upper",
671
    "step",
672
};
673
static PyObject* ast2obj_expr_context(struct ast_state *state, expr_context_ty);
674
static PyObject* ast2obj_boolop(struct ast_state *state, boolop_ty);
675
static PyObject* ast2obj_operator(struct ast_state *state, operator_ty);
676
static PyObject* ast2obj_unaryop(struct ast_state *state, unaryop_ty);
677
static PyObject* ast2obj_cmpop(struct ast_state *state, cmpop_ty);
678
static PyObject* ast2obj_comprehension(struct ast_state *state, void*);
679
static const char * const comprehension_fields[]={
680
    "target",
681
    "iter",
682
    "ifs",
683
    "is_async",
684
};
685
static const char * const excepthandler_attributes[] = {
686
    "lineno",
687
    "col_offset",
688
    "end_lineno",
689
    "end_col_offset",
690
};
691
static PyObject* ast2obj_excepthandler(struct ast_state *state, void*);
692
static const char * const ExceptHandler_fields[]={
693
    "type",
694
    "name",
695
    "body",
696
};
697
static PyObject* ast2obj_arguments(struct ast_state *state, void*);
698
static const char * const arguments_fields[]={
699
    "posonlyargs",
700
    "args",
701
    "vararg",
702
    "kwonlyargs",
703
    "kw_defaults",
704
    "kwarg",
705
    "defaults",
706
};
707
static PyObject* ast2obj_arg(struct ast_state *state, void*);
708
static const char * const arg_attributes[] = {
709
    "lineno",
710
    "col_offset",
711
    "end_lineno",
712
    "end_col_offset",
713
};
714
static const char * const arg_fields[]={
715
    "arg",
716
    "annotation",
717
    "type_comment",
718
};
719
static PyObject* ast2obj_keyword(struct ast_state *state, void*);
720
static const char * const keyword_attributes[] = {
721
    "lineno",
722
    "col_offset",
723
    "end_lineno",
724
    "end_col_offset",
725
};
726
static const char * const keyword_fields[]={
727
    "arg",
728
    "value",
729
};
730
static PyObject* ast2obj_alias(struct ast_state *state, void*);
731
static const char * const alias_attributes[] = {
732
    "lineno",
733
    "col_offset",
734
    "end_lineno",
735
    "end_col_offset",
736
};
737
static const char * const alias_fields[]={
738
    "name",
739
    "asname",
740
};
741
static PyObject* ast2obj_withitem(struct ast_state *state, void*);
742
static const char * const withitem_fields[]={
743
    "context_expr",
744
    "optional_vars",
745
};
746
static PyObject* ast2obj_match_case(struct ast_state *state, void*);
747
static const char * const match_case_fields[]={
748
    "pattern",
749
    "guard",
750
    "body",
751
};
752
static const char * const pattern_attributes[] = {
753
    "lineno",
754
    "col_offset",
755
    "end_lineno",
756
    "end_col_offset",
757
};
758
static PyObject* ast2obj_pattern(struct ast_state *state, void*);
759
static const char * const MatchValue_fields[]={
760
    "value",
761
};
762
static const char * const MatchSingleton_fields[]={
763
    "value",
764
};
765
static const char * const MatchSequence_fields[]={
766
    "patterns",
767
};
768
static const char * const MatchMapping_fields[]={
769
    "keys",
770
    "patterns",
771
    "rest",
772
};
773
static const char * const MatchClass_fields[]={
774
    "cls",
775
    "patterns",
776
    "kwd_attrs",
777
    "kwd_patterns",
778
};
779
static const char * const MatchStar_fields[]={
780
    "name",
781
};
782
static const char * const MatchAs_fields[]={
783
    "pattern",
784
    "name",
785
};
786
static const char * const MatchOr_fields[]={
787
    "patterns",
788
};
789
static PyObject* ast2obj_type_ignore(struct ast_state *state, void*);
790
static const char * const TypeIgnore_fields[]={
791
    "lineno",
792
    "tag",
793
};
794
static const char * const type_param_attributes[] = {
795
    "lineno",
796
    "col_offset",
797
    "end_lineno",
798
    "end_col_offset",
799
};
800
static PyObject* ast2obj_type_param(struct ast_state *state, void*);
801
static const char * const TypeVar_fields[]={
802
    "name",
803
    "bound",
804
    "default_value",
805
};
806
static const char * const ParamSpec_fields[]={
807
    "name",
808
    "default_value",
809
};
810
static const char * const TypeVarTuple_fields[]={
811
    "name",
812
    "default_value",
813
};
814
815
816
static int
817
add_ast_annotations(struct ast_state *state)
818
11
{
819
11
    bool cond;
820
11
    PyObject *Module_annotations = PyDict_New();
821
11
    if (!Module_annotations) return 0;
822
11
    {
823
11
        PyObject *type = state->stmt_type;
824
11
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
825
11
        cond = type != NULL;
826
11
        if (!cond) {
827
0
            Py_DECREF(Module_annotations);
828
0
            return 0;
829
0
        }
830
11
        cond = PyDict_SetItemString(Module_annotations, "body", type) == 0;
831
11
        Py_DECREF(type);
832
11
        if (!cond) {
833
0
            Py_DECREF(Module_annotations);
834
0
            return 0;
835
0
        }
836
11
    }
837
11
    {
838
11
        PyObject *type = state->type_ignore_type;
839
11
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
840
11
        cond = type != NULL;
841
11
        if (!cond) {
842
0
            Py_DECREF(Module_annotations);
843
0
            return 0;
844
0
        }
845
11
        cond = PyDict_SetItemString(Module_annotations, "type_ignores", type)
846
11
                                    == 0;
847
11
        Py_DECREF(type);
848
11
        if (!cond) {
849
0
            Py_DECREF(Module_annotations);
850
0
            return 0;
851
0
        }
852
11
    }
853
11
    cond = PyObject_SetAttrString(state->Module_type, "_field_types",
854
11
                                  Module_annotations) == 0;
855
11
    if (!cond) {
856
0
        Py_DECREF(Module_annotations);
857
0
        return 0;
858
0
    }
859
11
    cond = PyObject_SetAttrString(state->Module_type, "__annotations__",
860
11
                                  Module_annotations) == 0;
861
11
    if (!cond) {
862
0
        Py_DECREF(Module_annotations);
863
0
        return 0;
864
0
    }
865
11
    Py_DECREF(Module_annotations);
866
11
    PyObject *Interactive_annotations = PyDict_New();
867
11
    if (!Interactive_annotations) return 0;
868
11
    {
869
11
        PyObject *type = state->stmt_type;
870
11
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
871
11
        cond = type != NULL;
872
11
        if (!cond) {
873
0
            Py_DECREF(Interactive_annotations);
874
0
            return 0;
875
0
        }
876
11
        cond = PyDict_SetItemString(Interactive_annotations, "body", type) == 0;
877
11
        Py_DECREF(type);
878
11
        if (!cond) {
879
0
            Py_DECREF(Interactive_annotations);
880
0
            return 0;
881
0
        }
882
11
    }
883
11
    cond = PyObject_SetAttrString(state->Interactive_type, "_field_types",
884
11
                                  Interactive_annotations) == 0;
885
11
    if (!cond) {
886
0
        Py_DECREF(Interactive_annotations);
887
0
        return 0;
888
0
    }
889
11
    cond = PyObject_SetAttrString(state->Interactive_type, "__annotations__",
890
11
                                  Interactive_annotations) == 0;
891
11
    if (!cond) {
892
0
        Py_DECREF(Interactive_annotations);
893
0
        return 0;
894
0
    }
895
11
    Py_DECREF(Interactive_annotations);
896
11
    PyObject *Expression_annotations = PyDict_New();
897
11
    if (!Expression_annotations) return 0;
898
11
    {
899
11
        PyObject *type = state->expr_type;
900
11
        Py_INCREF(type);
901
11
        cond = PyDict_SetItemString(Expression_annotations, "body", type) == 0;
902
11
        Py_DECREF(type);
903
11
        if (!cond) {
904
0
            Py_DECREF(Expression_annotations);
905
0
            return 0;
906
0
        }
907
11
    }
908
11
    cond = PyObject_SetAttrString(state->Expression_type, "_field_types",
909
11
                                  Expression_annotations) == 0;
910
11
    if (!cond) {
911
0
        Py_DECREF(Expression_annotations);
912
0
        return 0;
913
0
    }
914
11
    cond = PyObject_SetAttrString(state->Expression_type, "__annotations__",
915
11
                                  Expression_annotations) == 0;
916
11
    if (!cond) {
917
0
        Py_DECREF(Expression_annotations);
918
0
        return 0;
919
0
    }
920
11
    Py_DECREF(Expression_annotations);
921
11
    PyObject *FunctionType_annotations = PyDict_New();
922
11
    if (!FunctionType_annotations) return 0;
923
11
    {
924
11
        PyObject *type = state->expr_type;
925
11
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
926
11
        cond = type != NULL;
927
11
        if (!cond) {
928
0
            Py_DECREF(FunctionType_annotations);
929
0
            return 0;
930
0
        }
931
11
        cond = PyDict_SetItemString(FunctionType_annotations, "argtypes", type)
932
11
                                    == 0;
933
11
        Py_DECREF(type);
934
11
        if (!cond) {
935
0
            Py_DECREF(FunctionType_annotations);
936
0
            return 0;
937
0
        }
938
11
    }
939
11
    {
940
11
        PyObject *type = state->expr_type;
941
11
        Py_INCREF(type);
942
11
        cond = PyDict_SetItemString(FunctionType_annotations, "returns", type)
943
11
                                    == 0;
944
11
        Py_DECREF(type);
945
11
        if (!cond) {
946
0
            Py_DECREF(FunctionType_annotations);
947
0
            return 0;
948
0
        }
949
11
    }
950
11
    cond = PyObject_SetAttrString(state->FunctionType_type, "_field_types",
951
11
                                  FunctionType_annotations) == 0;
952
11
    if (!cond) {
953
0
        Py_DECREF(FunctionType_annotations);
954
0
        return 0;
955
0
    }
956
11
    cond = PyObject_SetAttrString(state->FunctionType_type, "__annotations__",
957
11
                                  FunctionType_annotations) == 0;
958
11
    if (!cond) {
959
0
        Py_DECREF(FunctionType_annotations);
960
0
        return 0;
961
0
    }
962
11
    Py_DECREF(FunctionType_annotations);
963
11
    PyObject *FunctionDef_annotations = PyDict_New();
964
11
    if (!FunctionDef_annotations) return 0;
965
11
    {
966
11
        PyObject *type = (PyObject *)&PyUnicode_Type;
967
11
        Py_INCREF(type);
968
11
        cond = PyDict_SetItemString(FunctionDef_annotations, "name", type) == 0;
969
11
        Py_DECREF(type);
970
11
        if (!cond) {
971
0
            Py_DECREF(FunctionDef_annotations);
972
0
            return 0;
973
0
        }
974
11
    }
975
11
    {
976
11
        PyObject *type = state->arguments_type;
977
11
        Py_INCREF(type);
978
11
        cond = PyDict_SetItemString(FunctionDef_annotations, "args", type) == 0;
979
11
        Py_DECREF(type);
980
11
        if (!cond) {
981
0
            Py_DECREF(FunctionDef_annotations);
982
0
            return 0;
983
0
        }
984
11
    }
985
11
    {
986
11
        PyObject *type = state->stmt_type;
987
11
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
988
11
        cond = type != NULL;
989
11
        if (!cond) {
990
0
            Py_DECREF(FunctionDef_annotations);
991
0
            return 0;
992
0
        }
993
11
        cond = PyDict_SetItemString(FunctionDef_annotations, "body", type) == 0;
994
11
        Py_DECREF(type);
995
11
        if (!cond) {
996
0
            Py_DECREF(FunctionDef_annotations);
997
0
            return 0;
998
0
        }
999
11
    }
1000
11
    {
1001
11
        PyObject *type = state->expr_type;
1002
11
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
1003
11
        cond = type != NULL;
1004
11
        if (!cond) {
1005
0
            Py_DECREF(FunctionDef_annotations);
1006
0
            return 0;
1007
0
        }
1008
11
        cond = PyDict_SetItemString(FunctionDef_annotations, "decorator_list",
1009
11
                                    type) == 0;
1010
11
        Py_DECREF(type);
1011
11
        if (!cond) {
1012
0
            Py_DECREF(FunctionDef_annotations);
1013
0
            return 0;
1014
0
        }
1015
11
    }
1016
11
    {
1017
11
        PyObject *type = state->expr_type;
1018
11
        type = _Py_union_type_or(type, Py_None);
1019
11
        cond = type != NULL;
1020
11
        if (!cond) {
1021
0
            Py_DECREF(FunctionDef_annotations);
1022
0
            return 0;
1023
0
        }
1024
11
        cond = PyDict_SetItemString(FunctionDef_annotations, "returns", type)
1025
11
                                    == 0;
1026
11
        Py_DECREF(type);
1027
11
        if (!cond) {
1028
0
            Py_DECREF(FunctionDef_annotations);
1029
0
            return 0;
1030
0
        }
1031
11
    }
1032
11
    {
1033
11
        PyObject *type = (PyObject *)&PyUnicode_Type;
1034
11
        type = _Py_union_type_or(type, Py_None);
1035
11
        cond = type != NULL;
1036
11
        if (!cond) {
1037
0
            Py_DECREF(FunctionDef_annotations);
1038
0
            return 0;
1039
0
        }
1040
11
        cond = PyDict_SetItemString(FunctionDef_annotations, "type_comment",
1041
11
                                    type) == 0;
1042
11
        Py_DECREF(type);
1043
11
        if (!cond) {
1044
0
            Py_DECREF(FunctionDef_annotations);
1045
0
            return 0;
1046
0
        }
1047
11
    }
1048
11
    {
1049
11
        PyObject *type = state->type_param_type;
1050
11
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
1051
11
        cond = type != NULL;
1052
11
        if (!cond) {
1053
0
            Py_DECREF(FunctionDef_annotations);
1054
0
            return 0;
1055
0
        }
1056
11
        cond = PyDict_SetItemString(FunctionDef_annotations, "type_params",
1057
11
                                    type) == 0;
1058
11
        Py_DECREF(type);
1059
11
        if (!cond) {
1060
0
            Py_DECREF(FunctionDef_annotations);
1061
0
            return 0;
1062
0
        }
1063
11
    }
1064
11
    cond = PyObject_SetAttrString(state->FunctionDef_type, "_field_types",
1065
11
                                  FunctionDef_annotations) == 0;
1066
11
    if (!cond) {
1067
0
        Py_DECREF(FunctionDef_annotations);
1068
0
        return 0;
1069
0
    }
1070
11
    cond = PyObject_SetAttrString(state->FunctionDef_type, "__annotations__",
1071
11
                                  FunctionDef_annotations) == 0;
1072
11
    if (!cond) {
1073
0
        Py_DECREF(FunctionDef_annotations);
1074
0
        return 0;
1075
0
    }
1076
11
    Py_DECREF(FunctionDef_annotations);
1077
11
    PyObject *AsyncFunctionDef_annotations = PyDict_New();
1078
11
    if (!AsyncFunctionDef_annotations) return 0;
1079
11
    {
1080
11
        PyObject *type = (PyObject *)&PyUnicode_Type;
1081
11
        Py_INCREF(type);
1082
11
        cond = PyDict_SetItemString(AsyncFunctionDef_annotations, "name", type)
1083
11
                                    == 0;
1084
11
        Py_DECREF(type);
1085
11
        if (!cond) {
1086
0
            Py_DECREF(AsyncFunctionDef_annotations);
1087
0
            return 0;
1088
0
        }
1089
11
    }
1090
11
    {
1091
11
        PyObject *type = state->arguments_type;
1092
11
        Py_INCREF(type);
1093
11
        cond = PyDict_SetItemString(AsyncFunctionDef_annotations, "args", type)
1094
11
                                    == 0;
1095
11
        Py_DECREF(type);
1096
11
        if (!cond) {
1097
0
            Py_DECREF(AsyncFunctionDef_annotations);
1098
0
            return 0;
1099
0
        }
1100
11
    }
1101
11
    {
1102
11
        PyObject *type = state->stmt_type;
1103
11
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
1104
11
        cond = type != NULL;
1105
11
        if (!cond) {
1106
0
            Py_DECREF(AsyncFunctionDef_annotations);
1107
0
            return 0;
1108
0
        }
1109
11
        cond = PyDict_SetItemString(AsyncFunctionDef_annotations, "body", type)
1110
11
                                    == 0;
1111
11
        Py_DECREF(type);
1112
11
        if (!cond) {
1113
0
            Py_DECREF(AsyncFunctionDef_annotations);
1114
0
            return 0;
1115
0
        }
1116
11
    }
1117
11
    {
1118
11
        PyObject *type = state->expr_type;
1119
11
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
1120
11
        cond = type != NULL;
1121
11
        if (!cond) {
1122
0
            Py_DECREF(AsyncFunctionDef_annotations);
1123
0
            return 0;
1124
0
        }
1125
11
        cond = PyDict_SetItemString(AsyncFunctionDef_annotations,
1126
11
                                    "decorator_list", type) == 0;
1127
11
        Py_DECREF(type);
1128
11
        if (!cond) {
1129
0
            Py_DECREF(AsyncFunctionDef_annotations);
1130
0
            return 0;
1131
0
        }
1132
11
    }
1133
11
    {
1134
11
        PyObject *type = state->expr_type;
1135
11
        type = _Py_union_type_or(type, Py_None);
1136
11
        cond = type != NULL;
1137
11
        if (!cond) {
1138
0
            Py_DECREF(AsyncFunctionDef_annotations);
1139
0
            return 0;
1140
0
        }
1141
11
        cond = PyDict_SetItemString(AsyncFunctionDef_annotations, "returns",
1142
11
                                    type) == 0;
1143
11
        Py_DECREF(type);
1144
11
        if (!cond) {
1145
0
            Py_DECREF(AsyncFunctionDef_annotations);
1146
0
            return 0;
1147
0
        }
1148
11
    }
1149
11
    {
1150
11
        PyObject *type = (PyObject *)&PyUnicode_Type;
1151
11
        type = _Py_union_type_or(type, Py_None);
1152
11
        cond = type != NULL;
1153
11
        if (!cond) {
1154
0
            Py_DECREF(AsyncFunctionDef_annotations);
1155
0
            return 0;
1156
0
        }
1157
11
        cond = PyDict_SetItemString(AsyncFunctionDef_annotations,
1158
11
                                    "type_comment", type) == 0;
1159
11
        Py_DECREF(type);
1160
11
        if (!cond) {
1161
0
            Py_DECREF(AsyncFunctionDef_annotations);
1162
0
            return 0;
1163
0
        }
1164
11
    }
1165
11
    {
1166
11
        PyObject *type = state->type_param_type;
1167
11
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
1168
11
        cond = type != NULL;
1169
11
        if (!cond) {
1170
0
            Py_DECREF(AsyncFunctionDef_annotations);
1171
0
            return 0;
1172
0
        }
1173
11
        cond = PyDict_SetItemString(AsyncFunctionDef_annotations,
1174
11
                                    "type_params", type) == 0;
1175
11
        Py_DECREF(type);
1176
11
        if (!cond) {
1177
0
            Py_DECREF(AsyncFunctionDef_annotations);
1178
0
            return 0;
1179
0
        }
1180
11
    }
1181
11
    cond = PyObject_SetAttrString(state->AsyncFunctionDef_type, "_field_types",
1182
11
                                  AsyncFunctionDef_annotations) == 0;
1183
11
    if (!cond) {
1184
0
        Py_DECREF(AsyncFunctionDef_annotations);
1185
0
        return 0;
1186
0
    }
1187
11
    cond = PyObject_SetAttrString(state->AsyncFunctionDef_type,
1188
11
                                  "__annotations__",
1189
11
                                  AsyncFunctionDef_annotations) == 0;
1190
11
    if (!cond) {
1191
0
        Py_DECREF(AsyncFunctionDef_annotations);
1192
0
        return 0;
1193
0
    }
1194
11
    Py_DECREF(AsyncFunctionDef_annotations);
1195
11
    PyObject *ClassDef_annotations = PyDict_New();
1196
11
    if (!ClassDef_annotations) return 0;
1197
11
    {
1198
11
        PyObject *type = (PyObject *)&PyUnicode_Type;
1199
11
        Py_INCREF(type);
1200
11
        cond = PyDict_SetItemString(ClassDef_annotations, "name", type) == 0;
1201
11
        Py_DECREF(type);
1202
11
        if (!cond) {
1203
0
            Py_DECREF(ClassDef_annotations);
1204
0
            return 0;
1205
0
        }
1206
11
    }
1207
11
    {
1208
11
        PyObject *type = state->expr_type;
1209
11
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
1210
11
        cond = type != NULL;
1211
11
        if (!cond) {
1212
0
            Py_DECREF(ClassDef_annotations);
1213
0
            return 0;
1214
0
        }
1215
11
        cond = PyDict_SetItemString(ClassDef_annotations, "bases", type) == 0;
1216
11
        Py_DECREF(type);
1217
11
        if (!cond) {
1218
0
            Py_DECREF(ClassDef_annotations);
1219
0
            return 0;
1220
0
        }
1221
11
    }
1222
11
    {
1223
11
        PyObject *type = state->keyword_type;
1224
11
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
1225
11
        cond = type != NULL;
1226
11
        if (!cond) {
1227
0
            Py_DECREF(ClassDef_annotations);
1228
0
            return 0;
1229
0
        }
1230
11
        cond = PyDict_SetItemString(ClassDef_annotations, "keywords", type) ==
1231
11
                                    0;
1232
11
        Py_DECREF(type);
1233
11
        if (!cond) {
1234
0
            Py_DECREF(ClassDef_annotations);
1235
0
            return 0;
1236
0
        }
1237
11
    }
1238
11
    {
1239
11
        PyObject *type = state->stmt_type;
1240
11
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
1241
11
        cond = type != NULL;
1242
11
        if (!cond) {
1243
0
            Py_DECREF(ClassDef_annotations);
1244
0
            return 0;
1245
0
        }
1246
11
        cond = PyDict_SetItemString(ClassDef_annotations, "body", type) == 0;
1247
11
        Py_DECREF(type);
1248
11
        if (!cond) {
1249
0
            Py_DECREF(ClassDef_annotations);
1250
0
            return 0;
1251
0
        }
1252
11
    }
1253
11
    {
1254
11
        PyObject *type = state->expr_type;
1255
11
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
1256
11
        cond = type != NULL;
1257
11
        if (!cond) {
1258
0
            Py_DECREF(ClassDef_annotations);
1259
0
            return 0;
1260
0
        }
1261
11
        cond = PyDict_SetItemString(ClassDef_annotations, "decorator_list",
1262
11
                                    type) == 0;
1263
11
        Py_DECREF(type);
1264
11
        if (!cond) {
1265
0
            Py_DECREF(ClassDef_annotations);
1266
0
            return 0;
1267
0
        }
1268
11
    }
1269
11
    {
1270
11
        PyObject *type = state->type_param_type;
1271
11
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
1272
11
        cond = type != NULL;
1273
11
        if (!cond) {
1274
0
            Py_DECREF(ClassDef_annotations);
1275
0
            return 0;
1276
0
        }
1277
11
        cond = PyDict_SetItemString(ClassDef_annotations, "type_params", type)
1278
11
                                    == 0;
1279
11
        Py_DECREF(type);
1280
11
        if (!cond) {
1281
0
            Py_DECREF(ClassDef_annotations);
1282
0
            return 0;
1283
0
        }
1284
11
    }
1285
11
    cond = PyObject_SetAttrString(state->ClassDef_type, "_field_types",
1286
11
                                  ClassDef_annotations) == 0;
1287
11
    if (!cond) {
1288
0
        Py_DECREF(ClassDef_annotations);
1289
0
        return 0;
1290
0
    }
1291
11
    cond = PyObject_SetAttrString(state->ClassDef_type, "__annotations__",
1292
11
                                  ClassDef_annotations) == 0;
1293
11
    if (!cond) {
1294
0
        Py_DECREF(ClassDef_annotations);
1295
0
        return 0;
1296
0
    }
1297
11
    Py_DECREF(ClassDef_annotations);
1298
11
    PyObject *Return_annotations = PyDict_New();
1299
11
    if (!Return_annotations) return 0;
1300
11
    {
1301
11
        PyObject *type = state->expr_type;
1302
11
        type = _Py_union_type_or(type, Py_None);
1303
11
        cond = type != NULL;
1304
11
        if (!cond) {
1305
0
            Py_DECREF(Return_annotations);
1306
0
            return 0;
1307
0
        }
1308
11
        cond = PyDict_SetItemString(Return_annotations, "value", type) == 0;
1309
11
        Py_DECREF(type);
1310
11
        if (!cond) {
1311
0
            Py_DECREF(Return_annotations);
1312
0
            return 0;
1313
0
        }
1314
11
    }
1315
11
    cond = PyObject_SetAttrString(state->Return_type, "_field_types",
1316
11
                                  Return_annotations) == 0;
1317
11
    if (!cond) {
1318
0
        Py_DECREF(Return_annotations);
1319
0
        return 0;
1320
0
    }
1321
11
    cond = PyObject_SetAttrString(state->Return_type, "__annotations__",
1322
11
                                  Return_annotations) == 0;
1323
11
    if (!cond) {
1324
0
        Py_DECREF(Return_annotations);
1325
0
        return 0;
1326
0
    }
1327
11
    Py_DECREF(Return_annotations);
1328
11
    PyObject *Delete_annotations = PyDict_New();
1329
11
    if (!Delete_annotations) return 0;
1330
11
    {
1331
11
        PyObject *type = state->expr_type;
1332
11
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
1333
11
        cond = type != NULL;
1334
11
        if (!cond) {
1335
0
            Py_DECREF(Delete_annotations);
1336
0
            return 0;
1337
0
        }
1338
11
        cond = PyDict_SetItemString(Delete_annotations, "targets", type) == 0;
1339
11
        Py_DECREF(type);
1340
11
        if (!cond) {
1341
0
            Py_DECREF(Delete_annotations);
1342
0
            return 0;
1343
0
        }
1344
11
    }
1345
11
    cond = PyObject_SetAttrString(state->Delete_type, "_field_types",
1346
11
                                  Delete_annotations) == 0;
1347
11
    if (!cond) {
1348
0
        Py_DECREF(Delete_annotations);
1349
0
        return 0;
1350
0
    }
1351
11
    cond = PyObject_SetAttrString(state->Delete_type, "__annotations__",
1352
11
                                  Delete_annotations) == 0;
1353
11
    if (!cond) {
1354
0
        Py_DECREF(Delete_annotations);
1355
0
        return 0;
1356
0
    }
1357
11
    Py_DECREF(Delete_annotations);
1358
11
    PyObject *Assign_annotations = PyDict_New();
1359
11
    if (!Assign_annotations) return 0;
1360
11
    {
1361
11
        PyObject *type = state->expr_type;
1362
11
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
1363
11
        cond = type != NULL;
1364
11
        if (!cond) {
1365
0
            Py_DECREF(Assign_annotations);
1366
0
            return 0;
1367
0
        }
1368
11
        cond = PyDict_SetItemString(Assign_annotations, "targets", type) == 0;
1369
11
        Py_DECREF(type);
1370
11
        if (!cond) {
1371
0
            Py_DECREF(Assign_annotations);
1372
0
            return 0;
1373
0
        }
1374
11
    }
1375
11
    {
1376
11
        PyObject *type = state->expr_type;
1377
11
        Py_INCREF(type);
1378
11
        cond = PyDict_SetItemString(Assign_annotations, "value", type) == 0;
1379
11
        Py_DECREF(type);
1380
11
        if (!cond) {
1381
0
            Py_DECREF(Assign_annotations);
1382
0
            return 0;
1383
0
        }
1384
11
    }
1385
11
    {
1386
11
        PyObject *type = (PyObject *)&PyUnicode_Type;
1387
11
        type = _Py_union_type_or(type, Py_None);
1388
11
        cond = type != NULL;
1389
11
        if (!cond) {
1390
0
            Py_DECREF(Assign_annotations);
1391
0
            return 0;
1392
0
        }
1393
11
        cond = PyDict_SetItemString(Assign_annotations, "type_comment", type)
1394
11
                                    == 0;
1395
11
        Py_DECREF(type);
1396
11
        if (!cond) {
1397
0
            Py_DECREF(Assign_annotations);
1398
0
            return 0;
1399
0
        }
1400
11
    }
1401
11
    cond = PyObject_SetAttrString(state->Assign_type, "_field_types",
1402
11
                                  Assign_annotations) == 0;
1403
11
    if (!cond) {
1404
0
        Py_DECREF(Assign_annotations);
1405
0
        return 0;
1406
0
    }
1407
11
    cond = PyObject_SetAttrString(state->Assign_type, "__annotations__",
1408
11
                                  Assign_annotations) == 0;
1409
11
    if (!cond) {
1410
0
        Py_DECREF(Assign_annotations);
1411
0
        return 0;
1412
0
    }
1413
11
    Py_DECREF(Assign_annotations);
1414
11
    PyObject *TypeAlias_annotations = PyDict_New();
1415
11
    if (!TypeAlias_annotations) return 0;
1416
11
    {
1417
11
        PyObject *type = state->expr_type;
1418
11
        Py_INCREF(type);
1419
11
        cond = PyDict_SetItemString(TypeAlias_annotations, "name", type) == 0;
1420
11
        Py_DECREF(type);
1421
11
        if (!cond) {
1422
0
            Py_DECREF(TypeAlias_annotations);
1423
0
            return 0;
1424
0
        }
1425
11
    }
1426
11
    {
1427
11
        PyObject *type = state->type_param_type;
1428
11
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
1429
11
        cond = type != NULL;
1430
11
        if (!cond) {
1431
0
            Py_DECREF(TypeAlias_annotations);
1432
0
            return 0;
1433
0
        }
1434
11
        cond = PyDict_SetItemString(TypeAlias_annotations, "type_params", type)
1435
11
                                    == 0;
1436
11
        Py_DECREF(type);
1437
11
        if (!cond) {
1438
0
            Py_DECREF(TypeAlias_annotations);
1439
0
            return 0;
1440
0
        }
1441
11
    }
1442
11
    {
1443
11
        PyObject *type = state->expr_type;
1444
11
        Py_INCREF(type);
1445
11
        cond = PyDict_SetItemString(TypeAlias_annotations, "value", type) == 0;
1446
11
        Py_DECREF(type);
1447
11
        if (!cond) {
1448
0
            Py_DECREF(TypeAlias_annotations);
1449
0
            return 0;
1450
0
        }
1451
11
    }
1452
11
    cond = PyObject_SetAttrString(state->TypeAlias_type, "_field_types",
1453
11
                                  TypeAlias_annotations) == 0;
1454
11
    if (!cond) {
1455
0
        Py_DECREF(TypeAlias_annotations);
1456
0
        return 0;
1457
0
    }
1458
11
    cond = PyObject_SetAttrString(state->TypeAlias_type, "__annotations__",
1459
11
                                  TypeAlias_annotations) == 0;
1460
11
    if (!cond) {
1461
0
        Py_DECREF(TypeAlias_annotations);
1462
0
        return 0;
1463
0
    }
1464
11
    Py_DECREF(TypeAlias_annotations);
1465
11
    PyObject *AugAssign_annotations = PyDict_New();
1466
11
    if (!AugAssign_annotations) return 0;
1467
11
    {
1468
11
        PyObject *type = state->expr_type;
1469
11
        Py_INCREF(type);
1470
11
        cond = PyDict_SetItemString(AugAssign_annotations, "target", type) == 0;
1471
11
        Py_DECREF(type);
1472
11
        if (!cond) {
1473
0
            Py_DECREF(AugAssign_annotations);
1474
0
            return 0;
1475
0
        }
1476
11
    }
1477
11
    {
1478
11
        PyObject *type = state->operator_type;
1479
11
        Py_INCREF(type);
1480
11
        cond = PyDict_SetItemString(AugAssign_annotations, "op", type) == 0;
1481
11
        Py_DECREF(type);
1482
11
        if (!cond) {
1483
0
            Py_DECREF(AugAssign_annotations);
1484
0
            return 0;
1485
0
        }
1486
11
    }
1487
11
    {
1488
11
        PyObject *type = state->expr_type;
1489
11
        Py_INCREF(type);
1490
11
        cond = PyDict_SetItemString(AugAssign_annotations, "value", type) == 0;
1491
11
        Py_DECREF(type);
1492
11
        if (!cond) {
1493
0
            Py_DECREF(AugAssign_annotations);
1494
0
            return 0;
1495
0
        }
1496
11
    }
1497
11
    cond = PyObject_SetAttrString(state->AugAssign_type, "_field_types",
1498
11
                                  AugAssign_annotations) == 0;
1499
11
    if (!cond) {
1500
0
        Py_DECREF(AugAssign_annotations);
1501
0
        return 0;
1502
0
    }
1503
11
    cond = PyObject_SetAttrString(state->AugAssign_type, "__annotations__",
1504
11
                                  AugAssign_annotations) == 0;
1505
11
    if (!cond) {
1506
0
        Py_DECREF(AugAssign_annotations);
1507
0
        return 0;
1508
0
    }
1509
11
    Py_DECREF(AugAssign_annotations);
1510
11
    PyObject *AnnAssign_annotations = PyDict_New();
1511
11
    if (!AnnAssign_annotations) return 0;
1512
11
    {
1513
11
        PyObject *type = state->expr_type;
1514
11
        Py_INCREF(type);
1515
11
        cond = PyDict_SetItemString(AnnAssign_annotations, "target", type) == 0;
1516
11
        Py_DECREF(type);
1517
11
        if (!cond) {
1518
0
            Py_DECREF(AnnAssign_annotations);
1519
0
            return 0;
1520
0
        }
1521
11
    }
1522
11
    {
1523
11
        PyObject *type = state->expr_type;
1524
11
        Py_INCREF(type);
1525
11
        cond = PyDict_SetItemString(AnnAssign_annotations, "annotation", type)
1526
11
                                    == 0;
1527
11
        Py_DECREF(type);
1528
11
        if (!cond) {
1529
0
            Py_DECREF(AnnAssign_annotations);
1530
0
            return 0;
1531
0
        }
1532
11
    }
1533
11
    {
1534
11
        PyObject *type = state->expr_type;
1535
11
        type = _Py_union_type_or(type, Py_None);
1536
11
        cond = type != NULL;
1537
11
        if (!cond) {
1538
0
            Py_DECREF(AnnAssign_annotations);
1539
0
            return 0;
1540
0
        }
1541
11
        cond = PyDict_SetItemString(AnnAssign_annotations, "value", type) == 0;
1542
11
        Py_DECREF(type);
1543
11
        if (!cond) {
1544
0
            Py_DECREF(AnnAssign_annotations);
1545
0
            return 0;
1546
0
        }
1547
11
    }
1548
11
    {
1549
11
        PyObject *type = (PyObject *)&PyLong_Type;
1550
11
        Py_INCREF(type);
1551
11
        cond = PyDict_SetItemString(AnnAssign_annotations, "simple", type) == 0;
1552
11
        Py_DECREF(type);
1553
11
        if (!cond) {
1554
0
            Py_DECREF(AnnAssign_annotations);
1555
0
            return 0;
1556
0
        }
1557
11
    }
1558
11
    cond = PyObject_SetAttrString(state->AnnAssign_type, "_field_types",
1559
11
                                  AnnAssign_annotations) == 0;
1560
11
    if (!cond) {
1561
0
        Py_DECREF(AnnAssign_annotations);
1562
0
        return 0;
1563
0
    }
1564
11
    cond = PyObject_SetAttrString(state->AnnAssign_type, "__annotations__",
1565
11
                                  AnnAssign_annotations) == 0;
1566
11
    if (!cond) {
1567
0
        Py_DECREF(AnnAssign_annotations);
1568
0
        return 0;
1569
0
    }
1570
11
    Py_DECREF(AnnAssign_annotations);
1571
11
    PyObject *For_annotations = PyDict_New();
1572
11
    if (!For_annotations) return 0;
1573
11
    {
1574
11
        PyObject *type = state->expr_type;
1575
11
        Py_INCREF(type);
1576
11
        cond = PyDict_SetItemString(For_annotations, "target", type) == 0;
1577
11
        Py_DECREF(type);
1578
11
        if (!cond) {
1579
0
            Py_DECREF(For_annotations);
1580
0
            return 0;
1581
0
        }
1582
11
    }
1583
11
    {
1584
11
        PyObject *type = state->expr_type;
1585
11
        Py_INCREF(type);
1586
11
        cond = PyDict_SetItemString(For_annotations, "iter", type) == 0;
1587
11
        Py_DECREF(type);
1588
11
        if (!cond) {
1589
0
            Py_DECREF(For_annotations);
1590
0
            return 0;
1591
0
        }
1592
11
    }
1593
11
    {
1594
11
        PyObject *type = state->stmt_type;
1595
11
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
1596
11
        cond = type != NULL;
1597
11
        if (!cond) {
1598
0
            Py_DECREF(For_annotations);
1599
0
            return 0;
1600
0
        }
1601
11
        cond = PyDict_SetItemString(For_annotations, "body", type) == 0;
1602
11
        Py_DECREF(type);
1603
11
        if (!cond) {
1604
0
            Py_DECREF(For_annotations);
1605
0
            return 0;
1606
0
        }
1607
11
    }
1608
11
    {
1609
11
        PyObject *type = state->stmt_type;
1610
11
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
1611
11
        cond = type != NULL;
1612
11
        if (!cond) {
1613
0
            Py_DECREF(For_annotations);
1614
0
            return 0;
1615
0
        }
1616
11
        cond = PyDict_SetItemString(For_annotations, "orelse", type) == 0;
1617
11
        Py_DECREF(type);
1618
11
        if (!cond) {
1619
0
            Py_DECREF(For_annotations);
1620
0
            return 0;
1621
0
        }
1622
11
    }
1623
11
    {
1624
11
        PyObject *type = (PyObject *)&PyUnicode_Type;
1625
11
        type = _Py_union_type_or(type, Py_None);
1626
11
        cond = type != NULL;
1627
11
        if (!cond) {
1628
0
            Py_DECREF(For_annotations);
1629
0
            return 0;
1630
0
        }
1631
11
        cond = PyDict_SetItemString(For_annotations, "type_comment", type) == 0;
1632
11
        Py_DECREF(type);
1633
11
        if (!cond) {
1634
0
            Py_DECREF(For_annotations);
1635
0
            return 0;
1636
0
        }
1637
11
    }
1638
11
    cond = PyObject_SetAttrString(state->For_type, "_field_types",
1639
11
                                  For_annotations) == 0;
1640
11
    if (!cond) {
1641
0
        Py_DECREF(For_annotations);
1642
0
        return 0;
1643
0
    }
1644
11
    cond = PyObject_SetAttrString(state->For_type, "__annotations__",
1645
11
                                  For_annotations) == 0;
1646
11
    if (!cond) {
1647
0
        Py_DECREF(For_annotations);
1648
0
        return 0;
1649
0
    }
1650
11
    Py_DECREF(For_annotations);
1651
11
    PyObject *AsyncFor_annotations = PyDict_New();
1652
11
    if (!AsyncFor_annotations) return 0;
1653
11
    {
1654
11
        PyObject *type = state->expr_type;
1655
11
        Py_INCREF(type);
1656
11
        cond = PyDict_SetItemString(AsyncFor_annotations, "target", type) == 0;
1657
11
        Py_DECREF(type);
1658
11
        if (!cond) {
1659
0
            Py_DECREF(AsyncFor_annotations);
1660
0
            return 0;
1661
0
        }
1662
11
    }
1663
11
    {
1664
11
        PyObject *type = state->expr_type;
1665
11
        Py_INCREF(type);
1666
11
        cond = PyDict_SetItemString(AsyncFor_annotations, "iter", type) == 0;
1667
11
        Py_DECREF(type);
1668
11
        if (!cond) {
1669
0
            Py_DECREF(AsyncFor_annotations);
1670
0
            return 0;
1671
0
        }
1672
11
    }
1673
11
    {
1674
11
        PyObject *type = state->stmt_type;
1675
11
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
1676
11
        cond = type != NULL;
1677
11
        if (!cond) {
1678
0
            Py_DECREF(AsyncFor_annotations);
1679
0
            return 0;
1680
0
        }
1681
11
        cond = PyDict_SetItemString(AsyncFor_annotations, "body", type) == 0;
1682
11
        Py_DECREF(type);
1683
11
        if (!cond) {
1684
0
            Py_DECREF(AsyncFor_annotations);
1685
0
            return 0;
1686
0
        }
1687
11
    }
1688
11
    {
1689
11
        PyObject *type = state->stmt_type;
1690
11
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
1691
11
        cond = type != NULL;
1692
11
        if (!cond) {
1693
0
            Py_DECREF(AsyncFor_annotations);
1694
0
            return 0;
1695
0
        }
1696
11
        cond = PyDict_SetItemString(AsyncFor_annotations, "orelse", type) == 0;
1697
11
        Py_DECREF(type);
1698
11
        if (!cond) {
1699
0
            Py_DECREF(AsyncFor_annotations);
1700
0
            return 0;
1701
0
        }
1702
11
    }
1703
11
    {
1704
11
        PyObject *type = (PyObject *)&PyUnicode_Type;
1705
11
        type = _Py_union_type_or(type, Py_None);
1706
11
        cond = type != NULL;
1707
11
        if (!cond) {
1708
0
            Py_DECREF(AsyncFor_annotations);
1709
0
            return 0;
1710
0
        }
1711
11
        cond = PyDict_SetItemString(AsyncFor_annotations, "type_comment", type)
1712
11
                                    == 0;
1713
11
        Py_DECREF(type);
1714
11
        if (!cond) {
1715
0
            Py_DECREF(AsyncFor_annotations);
1716
0
            return 0;
1717
0
        }
1718
11
    }
1719
11
    cond = PyObject_SetAttrString(state->AsyncFor_type, "_field_types",
1720
11
                                  AsyncFor_annotations) == 0;
1721
11
    if (!cond) {
1722
0
        Py_DECREF(AsyncFor_annotations);
1723
0
        return 0;
1724
0
    }
1725
11
    cond = PyObject_SetAttrString(state->AsyncFor_type, "__annotations__",
1726
11
                                  AsyncFor_annotations) == 0;
1727
11
    if (!cond) {
1728
0
        Py_DECREF(AsyncFor_annotations);
1729
0
        return 0;
1730
0
    }
1731
11
    Py_DECREF(AsyncFor_annotations);
1732
11
    PyObject *While_annotations = PyDict_New();
1733
11
    if (!While_annotations) return 0;
1734
11
    {
1735
11
        PyObject *type = state->expr_type;
1736
11
        Py_INCREF(type);
1737
11
        cond = PyDict_SetItemString(While_annotations, "test", type) == 0;
1738
11
        Py_DECREF(type);
1739
11
        if (!cond) {
1740
0
            Py_DECREF(While_annotations);
1741
0
            return 0;
1742
0
        }
1743
11
    }
1744
11
    {
1745
11
        PyObject *type = state->stmt_type;
1746
11
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
1747
11
        cond = type != NULL;
1748
11
        if (!cond) {
1749
0
            Py_DECREF(While_annotations);
1750
0
            return 0;
1751
0
        }
1752
11
        cond = PyDict_SetItemString(While_annotations, "body", type) == 0;
1753
11
        Py_DECREF(type);
1754
11
        if (!cond) {
1755
0
            Py_DECREF(While_annotations);
1756
0
            return 0;
1757
0
        }
1758
11
    }
1759
11
    {
1760
11
        PyObject *type = state->stmt_type;
1761
11
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
1762
11
        cond = type != NULL;
1763
11
        if (!cond) {
1764
0
            Py_DECREF(While_annotations);
1765
0
            return 0;
1766
0
        }
1767
11
        cond = PyDict_SetItemString(While_annotations, "orelse", type) == 0;
1768
11
        Py_DECREF(type);
1769
11
        if (!cond) {
1770
0
            Py_DECREF(While_annotations);
1771
0
            return 0;
1772
0
        }
1773
11
    }
1774
11
    cond = PyObject_SetAttrString(state->While_type, "_field_types",
1775
11
                                  While_annotations) == 0;
1776
11
    if (!cond) {
1777
0
        Py_DECREF(While_annotations);
1778
0
        return 0;
1779
0
    }
1780
11
    cond = PyObject_SetAttrString(state->While_type, "__annotations__",
1781
11
                                  While_annotations) == 0;
1782
11
    if (!cond) {
1783
0
        Py_DECREF(While_annotations);
1784
0
        return 0;
1785
0
    }
1786
11
    Py_DECREF(While_annotations);
1787
11
    PyObject *If_annotations = PyDict_New();
1788
11
    if (!If_annotations) return 0;
1789
11
    {
1790
11
        PyObject *type = state->expr_type;
1791
11
        Py_INCREF(type);
1792
11
        cond = PyDict_SetItemString(If_annotations, "test", type) == 0;
1793
11
        Py_DECREF(type);
1794
11
        if (!cond) {
1795
0
            Py_DECREF(If_annotations);
1796
0
            return 0;
1797
0
        }
1798
11
    }
1799
11
    {
1800
11
        PyObject *type = state->stmt_type;
1801
11
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
1802
11
        cond = type != NULL;
1803
11
        if (!cond) {
1804
0
            Py_DECREF(If_annotations);
1805
0
            return 0;
1806
0
        }
1807
11
        cond = PyDict_SetItemString(If_annotations, "body", type) == 0;
1808
11
        Py_DECREF(type);
1809
11
        if (!cond) {
1810
0
            Py_DECREF(If_annotations);
1811
0
            return 0;
1812
0
        }
1813
11
    }
1814
11
    {
1815
11
        PyObject *type = state->stmt_type;
1816
11
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
1817
11
        cond = type != NULL;
1818
11
        if (!cond) {
1819
0
            Py_DECREF(If_annotations);
1820
0
            return 0;
1821
0
        }
1822
11
        cond = PyDict_SetItemString(If_annotations, "orelse", type) == 0;
1823
11
        Py_DECREF(type);
1824
11
        if (!cond) {
1825
0
            Py_DECREF(If_annotations);
1826
0
            return 0;
1827
0
        }
1828
11
    }
1829
11
    cond = PyObject_SetAttrString(state->If_type, "_field_types",
1830
11
                                  If_annotations) == 0;
1831
11
    if (!cond) {
1832
0
        Py_DECREF(If_annotations);
1833
0
        return 0;
1834
0
    }
1835
11
    cond = PyObject_SetAttrString(state->If_type, "__annotations__",
1836
11
                                  If_annotations) == 0;
1837
11
    if (!cond) {
1838
0
        Py_DECREF(If_annotations);
1839
0
        return 0;
1840
0
    }
1841
11
    Py_DECREF(If_annotations);
1842
11
    PyObject *With_annotations = PyDict_New();
1843
11
    if (!With_annotations) return 0;
1844
11
    {
1845
11
        PyObject *type = state->withitem_type;
1846
11
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
1847
11
        cond = type != NULL;
1848
11
        if (!cond) {
1849
0
            Py_DECREF(With_annotations);
1850
0
            return 0;
1851
0
        }
1852
11
        cond = PyDict_SetItemString(With_annotations, "items", type) == 0;
1853
11
        Py_DECREF(type);
1854
11
        if (!cond) {
1855
0
            Py_DECREF(With_annotations);
1856
0
            return 0;
1857
0
        }
1858
11
    }
1859
11
    {
1860
11
        PyObject *type = state->stmt_type;
1861
11
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
1862
11
        cond = type != NULL;
1863
11
        if (!cond) {
1864
0
            Py_DECREF(With_annotations);
1865
0
            return 0;
1866
0
        }
1867
11
        cond = PyDict_SetItemString(With_annotations, "body", type) == 0;
1868
11
        Py_DECREF(type);
1869
11
        if (!cond) {
1870
0
            Py_DECREF(With_annotations);
1871
0
            return 0;
1872
0
        }
1873
11
    }
1874
11
    {
1875
11
        PyObject *type = (PyObject *)&PyUnicode_Type;
1876
11
        type = _Py_union_type_or(type, Py_None);
1877
11
        cond = type != NULL;
1878
11
        if (!cond) {
1879
0
            Py_DECREF(With_annotations);
1880
0
            return 0;
1881
0
        }
1882
11
        cond = PyDict_SetItemString(With_annotations, "type_comment", type) ==
1883
11
                                    0;
1884
11
        Py_DECREF(type);
1885
11
        if (!cond) {
1886
0
            Py_DECREF(With_annotations);
1887
0
            return 0;
1888
0
        }
1889
11
    }
1890
11
    cond = PyObject_SetAttrString(state->With_type, "_field_types",
1891
11
                                  With_annotations) == 0;
1892
11
    if (!cond) {
1893
0
        Py_DECREF(With_annotations);
1894
0
        return 0;
1895
0
    }
1896
11
    cond = PyObject_SetAttrString(state->With_type, "__annotations__",
1897
11
                                  With_annotations) == 0;
1898
11
    if (!cond) {
1899
0
        Py_DECREF(With_annotations);
1900
0
        return 0;
1901
0
    }
1902
11
    Py_DECREF(With_annotations);
1903
11
    PyObject *AsyncWith_annotations = PyDict_New();
1904
11
    if (!AsyncWith_annotations) return 0;
1905
11
    {
1906
11
        PyObject *type = state->withitem_type;
1907
11
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
1908
11
        cond = type != NULL;
1909
11
        if (!cond) {
1910
0
            Py_DECREF(AsyncWith_annotations);
1911
0
            return 0;
1912
0
        }
1913
11
        cond = PyDict_SetItemString(AsyncWith_annotations, "items", type) == 0;
1914
11
        Py_DECREF(type);
1915
11
        if (!cond) {
1916
0
            Py_DECREF(AsyncWith_annotations);
1917
0
            return 0;
1918
0
        }
1919
11
    }
1920
11
    {
1921
11
        PyObject *type = state->stmt_type;
1922
11
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
1923
11
        cond = type != NULL;
1924
11
        if (!cond) {
1925
0
            Py_DECREF(AsyncWith_annotations);
1926
0
            return 0;
1927
0
        }
1928
11
        cond = PyDict_SetItemString(AsyncWith_annotations, "body", type) == 0;
1929
11
        Py_DECREF(type);
1930
11
        if (!cond) {
1931
0
            Py_DECREF(AsyncWith_annotations);
1932
0
            return 0;
1933
0
        }
1934
11
    }
1935
11
    {
1936
11
        PyObject *type = (PyObject *)&PyUnicode_Type;
1937
11
        type = _Py_union_type_or(type, Py_None);
1938
11
        cond = type != NULL;
1939
11
        if (!cond) {
1940
0
            Py_DECREF(AsyncWith_annotations);
1941
0
            return 0;
1942
0
        }
1943
11
        cond = PyDict_SetItemString(AsyncWith_annotations, "type_comment",
1944
11
                                    type) == 0;
1945
11
        Py_DECREF(type);
1946
11
        if (!cond) {
1947
0
            Py_DECREF(AsyncWith_annotations);
1948
0
            return 0;
1949
0
        }
1950
11
    }
1951
11
    cond = PyObject_SetAttrString(state->AsyncWith_type, "_field_types",
1952
11
                                  AsyncWith_annotations) == 0;
1953
11
    if (!cond) {
1954
0
        Py_DECREF(AsyncWith_annotations);
1955
0
        return 0;
1956
0
    }
1957
11
    cond = PyObject_SetAttrString(state->AsyncWith_type, "__annotations__",
1958
11
                                  AsyncWith_annotations) == 0;
1959
11
    if (!cond) {
1960
0
        Py_DECREF(AsyncWith_annotations);
1961
0
        return 0;
1962
0
    }
1963
11
    Py_DECREF(AsyncWith_annotations);
1964
11
    PyObject *Match_annotations = PyDict_New();
1965
11
    if (!Match_annotations) return 0;
1966
11
    {
1967
11
        PyObject *type = state->expr_type;
1968
11
        Py_INCREF(type);
1969
11
        cond = PyDict_SetItemString(Match_annotations, "subject", type) == 0;
1970
11
        Py_DECREF(type);
1971
11
        if (!cond) {
1972
0
            Py_DECREF(Match_annotations);
1973
0
            return 0;
1974
0
        }
1975
11
    }
1976
11
    {
1977
11
        PyObject *type = state->match_case_type;
1978
11
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
1979
11
        cond = type != NULL;
1980
11
        if (!cond) {
1981
0
            Py_DECREF(Match_annotations);
1982
0
            return 0;
1983
0
        }
1984
11
        cond = PyDict_SetItemString(Match_annotations, "cases", type) == 0;
1985
11
        Py_DECREF(type);
1986
11
        if (!cond) {
1987
0
            Py_DECREF(Match_annotations);
1988
0
            return 0;
1989
0
        }
1990
11
    }
1991
11
    cond = PyObject_SetAttrString(state->Match_type, "_field_types",
1992
11
                                  Match_annotations) == 0;
1993
11
    if (!cond) {
1994
0
        Py_DECREF(Match_annotations);
1995
0
        return 0;
1996
0
    }
1997
11
    cond = PyObject_SetAttrString(state->Match_type, "__annotations__",
1998
11
                                  Match_annotations) == 0;
1999
11
    if (!cond) {
2000
0
        Py_DECREF(Match_annotations);
2001
0
        return 0;
2002
0
    }
2003
11
    Py_DECREF(Match_annotations);
2004
11
    PyObject *Raise_annotations = PyDict_New();
2005
11
    if (!Raise_annotations) return 0;
2006
11
    {
2007
11
        PyObject *type = state->expr_type;
2008
11
        type = _Py_union_type_or(type, Py_None);
2009
11
        cond = type != NULL;
2010
11
        if (!cond) {
2011
0
            Py_DECREF(Raise_annotations);
2012
0
            return 0;
2013
0
        }
2014
11
        cond = PyDict_SetItemString(Raise_annotations, "exc", type) == 0;
2015
11
        Py_DECREF(type);
2016
11
        if (!cond) {
2017
0
            Py_DECREF(Raise_annotations);
2018
0
            return 0;
2019
0
        }
2020
11
    }
2021
11
    {
2022
11
        PyObject *type = state->expr_type;
2023
11
        type = _Py_union_type_or(type, Py_None);
2024
11
        cond = type != NULL;
2025
11
        if (!cond) {
2026
0
            Py_DECREF(Raise_annotations);
2027
0
            return 0;
2028
0
        }
2029
11
        cond = PyDict_SetItemString(Raise_annotations, "cause", type) == 0;
2030
11
        Py_DECREF(type);
2031
11
        if (!cond) {
2032
0
            Py_DECREF(Raise_annotations);
2033
0
            return 0;
2034
0
        }
2035
11
    }
2036
11
    cond = PyObject_SetAttrString(state->Raise_type, "_field_types",
2037
11
                                  Raise_annotations) == 0;
2038
11
    if (!cond) {
2039
0
        Py_DECREF(Raise_annotations);
2040
0
        return 0;
2041
0
    }
2042
11
    cond = PyObject_SetAttrString(state->Raise_type, "__annotations__",
2043
11
                                  Raise_annotations) == 0;
2044
11
    if (!cond) {
2045
0
        Py_DECREF(Raise_annotations);
2046
0
        return 0;
2047
0
    }
2048
11
    Py_DECREF(Raise_annotations);
2049
11
    PyObject *Try_annotations = PyDict_New();
2050
11
    if (!Try_annotations) return 0;
2051
11
    {
2052
11
        PyObject *type = state->stmt_type;
2053
11
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
2054
11
        cond = type != NULL;
2055
11
        if (!cond) {
2056
0
            Py_DECREF(Try_annotations);
2057
0
            return 0;
2058
0
        }
2059
11
        cond = PyDict_SetItemString(Try_annotations, "body", type) == 0;
2060
11
        Py_DECREF(type);
2061
11
        if (!cond) {
2062
0
            Py_DECREF(Try_annotations);
2063
0
            return 0;
2064
0
        }
2065
11
    }
2066
11
    {
2067
11
        PyObject *type = state->excepthandler_type;
2068
11
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
2069
11
        cond = type != NULL;
2070
11
        if (!cond) {
2071
0
            Py_DECREF(Try_annotations);
2072
0
            return 0;
2073
0
        }
2074
11
        cond = PyDict_SetItemString(Try_annotations, "handlers", type) == 0;
2075
11
        Py_DECREF(type);
2076
11
        if (!cond) {
2077
0
            Py_DECREF(Try_annotations);
2078
0
            return 0;
2079
0
        }
2080
11
    }
2081
11
    {
2082
11
        PyObject *type = state->stmt_type;
2083
11
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
2084
11
        cond = type != NULL;
2085
11
        if (!cond) {
2086
0
            Py_DECREF(Try_annotations);
2087
0
            return 0;
2088
0
        }
2089
11
        cond = PyDict_SetItemString(Try_annotations, "orelse", type) == 0;
2090
11
        Py_DECREF(type);
2091
11
        if (!cond) {
2092
0
            Py_DECREF(Try_annotations);
2093
0
            return 0;
2094
0
        }
2095
11
    }
2096
11
    {
2097
11
        PyObject *type = state->stmt_type;
2098
11
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
2099
11
        cond = type != NULL;
2100
11
        if (!cond) {
2101
0
            Py_DECREF(Try_annotations);
2102
0
            return 0;
2103
0
        }
2104
11
        cond = PyDict_SetItemString(Try_annotations, "finalbody", type) == 0;
2105
11
        Py_DECREF(type);
2106
11
        if (!cond) {
2107
0
            Py_DECREF(Try_annotations);
2108
0
            return 0;
2109
0
        }
2110
11
    }
2111
11
    cond = PyObject_SetAttrString(state->Try_type, "_field_types",
2112
11
                                  Try_annotations) == 0;
2113
11
    if (!cond) {
2114
0
        Py_DECREF(Try_annotations);
2115
0
        return 0;
2116
0
    }
2117
11
    cond = PyObject_SetAttrString(state->Try_type, "__annotations__",
2118
11
                                  Try_annotations) == 0;
2119
11
    if (!cond) {
2120
0
        Py_DECREF(Try_annotations);
2121
0
        return 0;
2122
0
    }
2123
11
    Py_DECREF(Try_annotations);
2124
11
    PyObject *TryStar_annotations = PyDict_New();
2125
11
    if (!TryStar_annotations) return 0;
2126
11
    {
2127
11
        PyObject *type = state->stmt_type;
2128
11
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
2129
11
        cond = type != NULL;
2130
11
        if (!cond) {
2131
0
            Py_DECREF(TryStar_annotations);
2132
0
            return 0;
2133
0
        }
2134
11
        cond = PyDict_SetItemString(TryStar_annotations, "body", type) == 0;
2135
11
        Py_DECREF(type);
2136
11
        if (!cond) {
2137
0
            Py_DECREF(TryStar_annotations);
2138
0
            return 0;
2139
0
        }
2140
11
    }
2141
11
    {
2142
11
        PyObject *type = state->excepthandler_type;
2143
11
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
2144
11
        cond = type != NULL;
2145
11
        if (!cond) {
2146
0
            Py_DECREF(TryStar_annotations);
2147
0
            return 0;
2148
0
        }
2149
11
        cond = PyDict_SetItemString(TryStar_annotations, "handlers", type) == 0;
2150
11
        Py_DECREF(type);
2151
11
        if (!cond) {
2152
0
            Py_DECREF(TryStar_annotations);
2153
0
            return 0;
2154
0
        }
2155
11
    }
2156
11
    {
2157
11
        PyObject *type = state->stmt_type;
2158
11
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
2159
11
        cond = type != NULL;
2160
11
        if (!cond) {
2161
0
            Py_DECREF(TryStar_annotations);
2162
0
            return 0;
2163
0
        }
2164
11
        cond = PyDict_SetItemString(TryStar_annotations, "orelse", type) == 0;
2165
11
        Py_DECREF(type);
2166
11
        if (!cond) {
2167
0
            Py_DECREF(TryStar_annotations);
2168
0
            return 0;
2169
0
        }
2170
11
    }
2171
11
    {
2172
11
        PyObject *type = state->stmt_type;
2173
11
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
2174
11
        cond = type != NULL;
2175
11
        if (!cond) {
2176
0
            Py_DECREF(TryStar_annotations);
2177
0
            return 0;
2178
0
        }
2179
11
        cond = PyDict_SetItemString(TryStar_annotations, "finalbody", type) ==
2180
11
                                    0;
2181
11
        Py_DECREF(type);
2182
11
        if (!cond) {
2183
0
            Py_DECREF(TryStar_annotations);
2184
0
            return 0;
2185
0
        }
2186
11
    }
2187
11
    cond = PyObject_SetAttrString(state->TryStar_type, "_field_types",
2188
11
                                  TryStar_annotations) == 0;
2189
11
    if (!cond) {
2190
0
        Py_DECREF(TryStar_annotations);
2191
0
        return 0;
2192
0
    }
2193
11
    cond = PyObject_SetAttrString(state->TryStar_type, "__annotations__",
2194
11
                                  TryStar_annotations) == 0;
2195
11
    if (!cond) {
2196
0
        Py_DECREF(TryStar_annotations);
2197
0
        return 0;
2198
0
    }
2199
11
    Py_DECREF(TryStar_annotations);
2200
11
    PyObject *Assert_annotations = PyDict_New();
2201
11
    if (!Assert_annotations) return 0;
2202
11
    {
2203
11
        PyObject *type = state->expr_type;
2204
11
        Py_INCREF(type);
2205
11
        cond = PyDict_SetItemString(Assert_annotations, "test", type) == 0;
2206
11
        Py_DECREF(type);
2207
11
        if (!cond) {
2208
0
            Py_DECREF(Assert_annotations);
2209
0
            return 0;
2210
0
        }
2211
11
    }
2212
11
    {
2213
11
        PyObject *type = state->expr_type;
2214
11
        type = _Py_union_type_or(type, Py_None);
2215
11
        cond = type != NULL;
2216
11
        if (!cond) {
2217
0
            Py_DECREF(Assert_annotations);
2218
0
            return 0;
2219
0
        }
2220
11
        cond = PyDict_SetItemString(Assert_annotations, "msg", type) == 0;
2221
11
        Py_DECREF(type);
2222
11
        if (!cond) {
2223
0
            Py_DECREF(Assert_annotations);
2224
0
            return 0;
2225
0
        }
2226
11
    }
2227
11
    cond = PyObject_SetAttrString(state->Assert_type, "_field_types",
2228
11
                                  Assert_annotations) == 0;
2229
11
    if (!cond) {
2230
0
        Py_DECREF(Assert_annotations);
2231
0
        return 0;
2232
0
    }
2233
11
    cond = PyObject_SetAttrString(state->Assert_type, "__annotations__",
2234
11
                                  Assert_annotations) == 0;
2235
11
    if (!cond) {
2236
0
        Py_DECREF(Assert_annotations);
2237
0
        return 0;
2238
0
    }
2239
11
    Py_DECREF(Assert_annotations);
2240
11
    PyObject *Import_annotations = PyDict_New();
2241
11
    if (!Import_annotations) return 0;
2242
11
    {
2243
11
        PyObject *type = state->alias_type;
2244
11
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
2245
11
        cond = type != NULL;
2246
11
        if (!cond) {
2247
0
            Py_DECREF(Import_annotations);
2248
0
            return 0;
2249
0
        }
2250
11
        cond = PyDict_SetItemString(Import_annotations, "names", type) == 0;
2251
11
        Py_DECREF(type);
2252
11
        if (!cond) {
2253
0
            Py_DECREF(Import_annotations);
2254
0
            return 0;
2255
0
        }
2256
11
    }
2257
11
    cond = PyObject_SetAttrString(state->Import_type, "_field_types",
2258
11
                                  Import_annotations) == 0;
2259
11
    if (!cond) {
2260
0
        Py_DECREF(Import_annotations);
2261
0
        return 0;
2262
0
    }
2263
11
    cond = PyObject_SetAttrString(state->Import_type, "__annotations__",
2264
11
                                  Import_annotations) == 0;
2265
11
    if (!cond) {
2266
0
        Py_DECREF(Import_annotations);
2267
0
        return 0;
2268
0
    }
2269
11
    Py_DECREF(Import_annotations);
2270
11
    PyObject *ImportFrom_annotations = PyDict_New();
2271
11
    if (!ImportFrom_annotations) return 0;
2272
11
    {
2273
11
        PyObject *type = (PyObject *)&PyUnicode_Type;
2274
11
        type = _Py_union_type_or(type, Py_None);
2275
11
        cond = type != NULL;
2276
11
        if (!cond) {
2277
0
            Py_DECREF(ImportFrom_annotations);
2278
0
            return 0;
2279
0
        }
2280
11
        cond = PyDict_SetItemString(ImportFrom_annotations, "module", type) ==
2281
11
                                    0;
2282
11
        Py_DECREF(type);
2283
11
        if (!cond) {
2284
0
            Py_DECREF(ImportFrom_annotations);
2285
0
            return 0;
2286
0
        }
2287
11
    }
2288
11
    {
2289
11
        PyObject *type = state->alias_type;
2290
11
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
2291
11
        cond = type != NULL;
2292
11
        if (!cond) {
2293
0
            Py_DECREF(ImportFrom_annotations);
2294
0
            return 0;
2295
0
        }
2296
11
        cond = PyDict_SetItemString(ImportFrom_annotations, "names", type) == 0;
2297
11
        Py_DECREF(type);
2298
11
        if (!cond) {
2299
0
            Py_DECREF(ImportFrom_annotations);
2300
0
            return 0;
2301
0
        }
2302
11
    }
2303
11
    {
2304
11
        PyObject *type = (PyObject *)&PyLong_Type;
2305
11
        type = _Py_union_type_or(type, Py_None);
2306
11
        cond = type != NULL;
2307
11
        if (!cond) {
2308
0
            Py_DECREF(ImportFrom_annotations);
2309
0
            return 0;
2310
0
        }
2311
11
        cond = PyDict_SetItemString(ImportFrom_annotations, "level", type) == 0;
2312
11
        Py_DECREF(type);
2313
11
        if (!cond) {
2314
0
            Py_DECREF(ImportFrom_annotations);
2315
0
            return 0;
2316
0
        }
2317
11
    }
2318
11
    cond = PyObject_SetAttrString(state->ImportFrom_type, "_field_types",
2319
11
                                  ImportFrom_annotations) == 0;
2320
11
    if (!cond) {
2321
0
        Py_DECREF(ImportFrom_annotations);
2322
0
        return 0;
2323
0
    }
2324
11
    cond = PyObject_SetAttrString(state->ImportFrom_type, "__annotations__",
2325
11
                                  ImportFrom_annotations) == 0;
2326
11
    if (!cond) {
2327
0
        Py_DECREF(ImportFrom_annotations);
2328
0
        return 0;
2329
0
    }
2330
11
    Py_DECREF(ImportFrom_annotations);
2331
11
    PyObject *Global_annotations = PyDict_New();
2332
11
    if (!Global_annotations) return 0;
2333
11
    {
2334
11
        PyObject *type = (PyObject *)&PyUnicode_Type;
2335
11
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
2336
11
        cond = type != NULL;
2337
11
        if (!cond) {
2338
0
            Py_DECREF(Global_annotations);
2339
0
            return 0;
2340
0
        }
2341
11
        cond = PyDict_SetItemString(Global_annotations, "names", type) == 0;
2342
11
        Py_DECREF(type);
2343
11
        if (!cond) {
2344
0
            Py_DECREF(Global_annotations);
2345
0
            return 0;
2346
0
        }
2347
11
    }
2348
11
    cond = PyObject_SetAttrString(state->Global_type, "_field_types",
2349
11
                                  Global_annotations) == 0;
2350
11
    if (!cond) {
2351
0
        Py_DECREF(Global_annotations);
2352
0
        return 0;
2353
0
    }
2354
11
    cond = PyObject_SetAttrString(state->Global_type, "__annotations__",
2355
11
                                  Global_annotations) == 0;
2356
11
    if (!cond) {
2357
0
        Py_DECREF(Global_annotations);
2358
0
        return 0;
2359
0
    }
2360
11
    Py_DECREF(Global_annotations);
2361
11
    PyObject *Nonlocal_annotations = PyDict_New();
2362
11
    if (!Nonlocal_annotations) return 0;
2363
11
    {
2364
11
        PyObject *type = (PyObject *)&PyUnicode_Type;
2365
11
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
2366
11
        cond = type != NULL;
2367
11
        if (!cond) {
2368
0
            Py_DECREF(Nonlocal_annotations);
2369
0
            return 0;
2370
0
        }
2371
11
        cond = PyDict_SetItemString(Nonlocal_annotations, "names", type) == 0;
2372
11
        Py_DECREF(type);
2373
11
        if (!cond) {
2374
0
            Py_DECREF(Nonlocal_annotations);
2375
0
            return 0;
2376
0
        }
2377
11
    }
2378
11
    cond = PyObject_SetAttrString(state->Nonlocal_type, "_field_types",
2379
11
                                  Nonlocal_annotations) == 0;
2380
11
    if (!cond) {
2381
0
        Py_DECREF(Nonlocal_annotations);
2382
0
        return 0;
2383
0
    }
2384
11
    cond = PyObject_SetAttrString(state->Nonlocal_type, "__annotations__",
2385
11
                                  Nonlocal_annotations) == 0;
2386
11
    if (!cond) {
2387
0
        Py_DECREF(Nonlocal_annotations);
2388
0
        return 0;
2389
0
    }
2390
11
    Py_DECREF(Nonlocal_annotations);
2391
11
    PyObject *Expr_annotations = PyDict_New();
2392
11
    if (!Expr_annotations) return 0;
2393
11
    {
2394
11
        PyObject *type = state->expr_type;
2395
11
        Py_INCREF(type);
2396
11
        cond = PyDict_SetItemString(Expr_annotations, "value", type) == 0;
2397
11
        Py_DECREF(type);
2398
11
        if (!cond) {
2399
0
            Py_DECREF(Expr_annotations);
2400
0
            return 0;
2401
0
        }
2402
11
    }
2403
11
    cond = PyObject_SetAttrString(state->Expr_type, "_field_types",
2404
11
                                  Expr_annotations) == 0;
2405
11
    if (!cond) {
2406
0
        Py_DECREF(Expr_annotations);
2407
0
        return 0;
2408
0
    }
2409
11
    cond = PyObject_SetAttrString(state->Expr_type, "__annotations__",
2410
11
                                  Expr_annotations) == 0;
2411
11
    if (!cond) {
2412
0
        Py_DECREF(Expr_annotations);
2413
0
        return 0;
2414
0
    }
2415
11
    Py_DECREF(Expr_annotations);
2416
11
    PyObject *Pass_annotations = PyDict_New();
2417
11
    if (!Pass_annotations) return 0;
2418
11
    cond = PyObject_SetAttrString(state->Pass_type, "_field_types",
2419
11
                                  Pass_annotations) == 0;
2420
11
    if (!cond) {
2421
0
        Py_DECREF(Pass_annotations);
2422
0
        return 0;
2423
0
    }
2424
11
    cond = PyObject_SetAttrString(state->Pass_type, "__annotations__",
2425
11
                                  Pass_annotations) == 0;
2426
11
    if (!cond) {
2427
0
        Py_DECREF(Pass_annotations);
2428
0
        return 0;
2429
0
    }
2430
11
    Py_DECREF(Pass_annotations);
2431
11
    PyObject *Break_annotations = PyDict_New();
2432
11
    if (!Break_annotations) return 0;
2433
11
    cond = PyObject_SetAttrString(state->Break_type, "_field_types",
2434
11
                                  Break_annotations) == 0;
2435
11
    if (!cond) {
2436
0
        Py_DECREF(Break_annotations);
2437
0
        return 0;
2438
0
    }
2439
11
    cond = PyObject_SetAttrString(state->Break_type, "__annotations__",
2440
11
                                  Break_annotations) == 0;
2441
11
    if (!cond) {
2442
0
        Py_DECREF(Break_annotations);
2443
0
        return 0;
2444
0
    }
2445
11
    Py_DECREF(Break_annotations);
2446
11
    PyObject *Continue_annotations = PyDict_New();
2447
11
    if (!Continue_annotations) return 0;
2448
11
    cond = PyObject_SetAttrString(state->Continue_type, "_field_types",
2449
11
                                  Continue_annotations) == 0;
2450
11
    if (!cond) {
2451
0
        Py_DECREF(Continue_annotations);
2452
0
        return 0;
2453
0
    }
2454
11
    cond = PyObject_SetAttrString(state->Continue_type, "__annotations__",
2455
11
                                  Continue_annotations) == 0;
2456
11
    if (!cond) {
2457
0
        Py_DECREF(Continue_annotations);
2458
0
        return 0;
2459
0
    }
2460
11
    Py_DECREF(Continue_annotations);
2461
11
    PyObject *BoolOp_annotations = PyDict_New();
2462
11
    if (!BoolOp_annotations) return 0;
2463
11
    {
2464
11
        PyObject *type = state->boolop_type;
2465
11
        Py_INCREF(type);
2466
11
        cond = PyDict_SetItemString(BoolOp_annotations, "op", type) == 0;
2467
11
        Py_DECREF(type);
2468
11
        if (!cond) {
2469
0
            Py_DECREF(BoolOp_annotations);
2470
0
            return 0;
2471
0
        }
2472
11
    }
2473
11
    {
2474
11
        PyObject *type = state->expr_type;
2475
11
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
2476
11
        cond = type != NULL;
2477
11
        if (!cond) {
2478
0
            Py_DECREF(BoolOp_annotations);
2479
0
            return 0;
2480
0
        }
2481
11
        cond = PyDict_SetItemString(BoolOp_annotations, "values", type) == 0;
2482
11
        Py_DECREF(type);
2483
11
        if (!cond) {
2484
0
            Py_DECREF(BoolOp_annotations);
2485
0
            return 0;
2486
0
        }
2487
11
    }
2488
11
    cond = PyObject_SetAttrString(state->BoolOp_type, "_field_types",
2489
11
                                  BoolOp_annotations) == 0;
2490
11
    if (!cond) {
2491
0
        Py_DECREF(BoolOp_annotations);
2492
0
        return 0;
2493
0
    }
2494
11
    cond = PyObject_SetAttrString(state->BoolOp_type, "__annotations__",
2495
11
                                  BoolOp_annotations) == 0;
2496
11
    if (!cond) {
2497
0
        Py_DECREF(BoolOp_annotations);
2498
0
        return 0;
2499
0
    }
2500
11
    Py_DECREF(BoolOp_annotations);
2501
11
    PyObject *NamedExpr_annotations = PyDict_New();
2502
11
    if (!NamedExpr_annotations) return 0;
2503
11
    {
2504
11
        PyObject *type = state->expr_type;
2505
11
        Py_INCREF(type);
2506
11
        cond = PyDict_SetItemString(NamedExpr_annotations, "target", type) == 0;
2507
11
        Py_DECREF(type);
2508
11
        if (!cond) {
2509
0
            Py_DECREF(NamedExpr_annotations);
2510
0
            return 0;
2511
0
        }
2512
11
    }
2513
11
    {
2514
11
        PyObject *type = state->expr_type;
2515
11
        Py_INCREF(type);
2516
11
        cond = PyDict_SetItemString(NamedExpr_annotations, "value", type) == 0;
2517
11
        Py_DECREF(type);
2518
11
        if (!cond) {
2519
0
            Py_DECREF(NamedExpr_annotations);
2520
0
            return 0;
2521
0
        }
2522
11
    }
2523
11
    cond = PyObject_SetAttrString(state->NamedExpr_type, "_field_types",
2524
11
                                  NamedExpr_annotations) == 0;
2525
11
    if (!cond) {
2526
0
        Py_DECREF(NamedExpr_annotations);
2527
0
        return 0;
2528
0
    }
2529
11
    cond = PyObject_SetAttrString(state->NamedExpr_type, "__annotations__",
2530
11
                                  NamedExpr_annotations) == 0;
2531
11
    if (!cond) {
2532
0
        Py_DECREF(NamedExpr_annotations);
2533
0
        return 0;
2534
0
    }
2535
11
    Py_DECREF(NamedExpr_annotations);
2536
11
    PyObject *BinOp_annotations = PyDict_New();
2537
11
    if (!BinOp_annotations) return 0;
2538
11
    {
2539
11
        PyObject *type = state->expr_type;
2540
11
        Py_INCREF(type);
2541
11
        cond = PyDict_SetItemString(BinOp_annotations, "left", type) == 0;
2542
11
        Py_DECREF(type);
2543
11
        if (!cond) {
2544
0
            Py_DECREF(BinOp_annotations);
2545
0
            return 0;
2546
0
        }
2547
11
    }
2548
11
    {
2549
11
        PyObject *type = state->operator_type;
2550
11
        Py_INCREF(type);
2551
11
        cond = PyDict_SetItemString(BinOp_annotations, "op", type) == 0;
2552
11
        Py_DECREF(type);
2553
11
        if (!cond) {
2554
0
            Py_DECREF(BinOp_annotations);
2555
0
            return 0;
2556
0
        }
2557
11
    }
2558
11
    {
2559
11
        PyObject *type = state->expr_type;
2560
11
        Py_INCREF(type);
2561
11
        cond = PyDict_SetItemString(BinOp_annotations, "right", type) == 0;
2562
11
        Py_DECREF(type);
2563
11
        if (!cond) {
2564
0
            Py_DECREF(BinOp_annotations);
2565
0
            return 0;
2566
0
        }
2567
11
    }
2568
11
    cond = PyObject_SetAttrString(state->BinOp_type, "_field_types",
2569
11
                                  BinOp_annotations) == 0;
2570
11
    if (!cond) {
2571
0
        Py_DECREF(BinOp_annotations);
2572
0
        return 0;
2573
0
    }
2574
11
    cond = PyObject_SetAttrString(state->BinOp_type, "__annotations__",
2575
11
                                  BinOp_annotations) == 0;
2576
11
    if (!cond) {
2577
0
        Py_DECREF(BinOp_annotations);
2578
0
        return 0;
2579
0
    }
2580
11
    Py_DECREF(BinOp_annotations);
2581
11
    PyObject *UnaryOp_annotations = PyDict_New();
2582
11
    if (!UnaryOp_annotations) return 0;
2583
11
    {
2584
11
        PyObject *type = state->unaryop_type;
2585
11
        Py_INCREF(type);
2586
11
        cond = PyDict_SetItemString(UnaryOp_annotations, "op", type) == 0;
2587
11
        Py_DECREF(type);
2588
11
        if (!cond) {
2589
0
            Py_DECREF(UnaryOp_annotations);
2590
0
            return 0;
2591
0
        }
2592
11
    }
2593
11
    {
2594
11
        PyObject *type = state->expr_type;
2595
11
        Py_INCREF(type);
2596
11
        cond = PyDict_SetItemString(UnaryOp_annotations, "operand", type) == 0;
2597
11
        Py_DECREF(type);
2598
11
        if (!cond) {
2599
0
            Py_DECREF(UnaryOp_annotations);
2600
0
            return 0;
2601
0
        }
2602
11
    }
2603
11
    cond = PyObject_SetAttrString(state->UnaryOp_type, "_field_types",
2604
11
                                  UnaryOp_annotations) == 0;
2605
11
    if (!cond) {
2606
0
        Py_DECREF(UnaryOp_annotations);
2607
0
        return 0;
2608
0
    }
2609
11
    cond = PyObject_SetAttrString(state->UnaryOp_type, "__annotations__",
2610
11
                                  UnaryOp_annotations) == 0;
2611
11
    if (!cond) {
2612
0
        Py_DECREF(UnaryOp_annotations);
2613
0
        return 0;
2614
0
    }
2615
11
    Py_DECREF(UnaryOp_annotations);
2616
11
    PyObject *Lambda_annotations = PyDict_New();
2617
11
    if (!Lambda_annotations) return 0;
2618
11
    {
2619
11
        PyObject *type = state->arguments_type;
2620
11
        Py_INCREF(type);
2621
11
        cond = PyDict_SetItemString(Lambda_annotations, "args", type) == 0;
2622
11
        Py_DECREF(type);
2623
11
        if (!cond) {
2624
0
            Py_DECREF(Lambda_annotations);
2625
0
            return 0;
2626
0
        }
2627
11
    }
2628
11
    {
2629
11
        PyObject *type = state->expr_type;
2630
11
        Py_INCREF(type);
2631
11
        cond = PyDict_SetItemString(Lambda_annotations, "body", type) == 0;
2632
11
        Py_DECREF(type);
2633
11
        if (!cond) {
2634
0
            Py_DECREF(Lambda_annotations);
2635
0
            return 0;
2636
0
        }
2637
11
    }
2638
11
    cond = PyObject_SetAttrString(state->Lambda_type, "_field_types",
2639
11
                                  Lambda_annotations) == 0;
2640
11
    if (!cond) {
2641
0
        Py_DECREF(Lambda_annotations);
2642
0
        return 0;
2643
0
    }
2644
11
    cond = PyObject_SetAttrString(state->Lambda_type, "__annotations__",
2645
11
                                  Lambda_annotations) == 0;
2646
11
    if (!cond) {
2647
0
        Py_DECREF(Lambda_annotations);
2648
0
        return 0;
2649
0
    }
2650
11
    Py_DECREF(Lambda_annotations);
2651
11
    PyObject *IfExp_annotations = PyDict_New();
2652
11
    if (!IfExp_annotations) return 0;
2653
11
    {
2654
11
        PyObject *type = state->expr_type;
2655
11
        Py_INCREF(type);
2656
11
        cond = PyDict_SetItemString(IfExp_annotations, "test", type) == 0;
2657
11
        Py_DECREF(type);
2658
11
        if (!cond) {
2659
0
            Py_DECREF(IfExp_annotations);
2660
0
            return 0;
2661
0
        }
2662
11
    }
2663
11
    {
2664
11
        PyObject *type = state->expr_type;
2665
11
        Py_INCREF(type);
2666
11
        cond = PyDict_SetItemString(IfExp_annotations, "body", type) == 0;
2667
11
        Py_DECREF(type);
2668
11
        if (!cond) {
2669
0
            Py_DECREF(IfExp_annotations);
2670
0
            return 0;
2671
0
        }
2672
11
    }
2673
11
    {
2674
11
        PyObject *type = state->expr_type;
2675
11
        Py_INCREF(type);
2676
11
        cond = PyDict_SetItemString(IfExp_annotations, "orelse", type) == 0;
2677
11
        Py_DECREF(type);
2678
11
        if (!cond) {
2679
0
            Py_DECREF(IfExp_annotations);
2680
0
            return 0;
2681
0
        }
2682
11
    }
2683
11
    cond = PyObject_SetAttrString(state->IfExp_type, "_field_types",
2684
11
                                  IfExp_annotations) == 0;
2685
11
    if (!cond) {
2686
0
        Py_DECREF(IfExp_annotations);
2687
0
        return 0;
2688
0
    }
2689
11
    cond = PyObject_SetAttrString(state->IfExp_type, "__annotations__",
2690
11
                                  IfExp_annotations) == 0;
2691
11
    if (!cond) {
2692
0
        Py_DECREF(IfExp_annotations);
2693
0
        return 0;
2694
0
    }
2695
11
    Py_DECREF(IfExp_annotations);
2696
11
    PyObject *Dict_annotations = PyDict_New();
2697
11
    if (!Dict_annotations) return 0;
2698
11
    {
2699
11
        PyObject *type = state->expr_type;
2700
11
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
2701
11
        cond = type != NULL;
2702
11
        if (!cond) {
2703
0
            Py_DECREF(Dict_annotations);
2704
0
            return 0;
2705
0
        }
2706
11
        cond = PyDict_SetItemString(Dict_annotations, "keys", type) == 0;
2707
11
        Py_DECREF(type);
2708
11
        if (!cond) {
2709
0
            Py_DECREF(Dict_annotations);
2710
0
            return 0;
2711
0
        }
2712
11
    }
2713
11
    {
2714
11
        PyObject *type = state->expr_type;
2715
11
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
2716
11
        cond = type != NULL;
2717
11
        if (!cond) {
2718
0
            Py_DECREF(Dict_annotations);
2719
0
            return 0;
2720
0
        }
2721
11
        cond = PyDict_SetItemString(Dict_annotations, "values", type) == 0;
2722
11
        Py_DECREF(type);
2723
11
        if (!cond) {
2724
0
            Py_DECREF(Dict_annotations);
2725
0
            return 0;
2726
0
        }
2727
11
    }
2728
11
    cond = PyObject_SetAttrString(state->Dict_type, "_field_types",
2729
11
                                  Dict_annotations) == 0;
2730
11
    if (!cond) {
2731
0
        Py_DECREF(Dict_annotations);
2732
0
        return 0;
2733
0
    }
2734
11
    cond = PyObject_SetAttrString(state->Dict_type, "__annotations__",
2735
11
                                  Dict_annotations) == 0;
2736
11
    if (!cond) {
2737
0
        Py_DECREF(Dict_annotations);
2738
0
        return 0;
2739
0
    }
2740
11
    Py_DECREF(Dict_annotations);
2741
11
    PyObject *Set_annotations = PyDict_New();
2742
11
    if (!Set_annotations) return 0;
2743
11
    {
2744
11
        PyObject *type = state->expr_type;
2745
11
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
2746
11
        cond = type != NULL;
2747
11
        if (!cond) {
2748
0
            Py_DECREF(Set_annotations);
2749
0
            return 0;
2750
0
        }
2751
11
        cond = PyDict_SetItemString(Set_annotations, "elts", type) == 0;
2752
11
        Py_DECREF(type);
2753
11
        if (!cond) {
2754
0
            Py_DECREF(Set_annotations);
2755
0
            return 0;
2756
0
        }
2757
11
    }
2758
11
    cond = PyObject_SetAttrString(state->Set_type, "_field_types",
2759
11
                                  Set_annotations) == 0;
2760
11
    if (!cond) {
2761
0
        Py_DECREF(Set_annotations);
2762
0
        return 0;
2763
0
    }
2764
11
    cond = PyObject_SetAttrString(state->Set_type, "__annotations__",
2765
11
                                  Set_annotations) == 0;
2766
11
    if (!cond) {
2767
0
        Py_DECREF(Set_annotations);
2768
0
        return 0;
2769
0
    }
2770
11
    Py_DECREF(Set_annotations);
2771
11
    PyObject *ListComp_annotations = PyDict_New();
2772
11
    if (!ListComp_annotations) return 0;
2773
11
    {
2774
11
        PyObject *type = state->expr_type;
2775
11
        Py_INCREF(type);
2776
11
        cond = PyDict_SetItemString(ListComp_annotations, "elt", type) == 0;
2777
11
        Py_DECREF(type);
2778
11
        if (!cond) {
2779
0
            Py_DECREF(ListComp_annotations);
2780
0
            return 0;
2781
0
        }
2782
11
    }
2783
11
    {
2784
11
        PyObject *type = state->comprehension_type;
2785
11
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
2786
11
        cond = type != NULL;
2787
11
        if (!cond) {
2788
0
            Py_DECREF(ListComp_annotations);
2789
0
            return 0;
2790
0
        }
2791
11
        cond = PyDict_SetItemString(ListComp_annotations, "generators", type)
2792
11
                                    == 0;
2793
11
        Py_DECREF(type);
2794
11
        if (!cond) {
2795
0
            Py_DECREF(ListComp_annotations);
2796
0
            return 0;
2797
0
        }
2798
11
    }
2799
11
    cond = PyObject_SetAttrString(state->ListComp_type, "_field_types",
2800
11
                                  ListComp_annotations) == 0;
2801
11
    if (!cond) {
2802
0
        Py_DECREF(ListComp_annotations);
2803
0
        return 0;
2804
0
    }
2805
11
    cond = PyObject_SetAttrString(state->ListComp_type, "__annotations__",
2806
11
                                  ListComp_annotations) == 0;
2807
11
    if (!cond) {
2808
0
        Py_DECREF(ListComp_annotations);
2809
0
        return 0;
2810
0
    }
2811
11
    Py_DECREF(ListComp_annotations);
2812
11
    PyObject *SetComp_annotations = PyDict_New();
2813
11
    if (!SetComp_annotations) return 0;
2814
11
    {
2815
11
        PyObject *type = state->expr_type;
2816
11
        Py_INCREF(type);
2817
11
        cond = PyDict_SetItemString(SetComp_annotations, "elt", type) == 0;
2818
11
        Py_DECREF(type);
2819
11
        if (!cond) {
2820
0
            Py_DECREF(SetComp_annotations);
2821
0
            return 0;
2822
0
        }
2823
11
    }
2824
11
    {
2825
11
        PyObject *type = state->comprehension_type;
2826
11
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
2827
11
        cond = type != NULL;
2828
11
        if (!cond) {
2829
0
            Py_DECREF(SetComp_annotations);
2830
0
            return 0;
2831
0
        }
2832
11
        cond = PyDict_SetItemString(SetComp_annotations, "generators", type) ==
2833
11
                                    0;
2834
11
        Py_DECREF(type);
2835
11
        if (!cond) {
2836
0
            Py_DECREF(SetComp_annotations);
2837
0
            return 0;
2838
0
        }
2839
11
    }
2840
11
    cond = PyObject_SetAttrString(state->SetComp_type, "_field_types",
2841
11
                                  SetComp_annotations) == 0;
2842
11
    if (!cond) {
2843
0
        Py_DECREF(SetComp_annotations);
2844
0
        return 0;
2845
0
    }
2846
11
    cond = PyObject_SetAttrString(state->SetComp_type, "__annotations__",
2847
11
                                  SetComp_annotations) == 0;
2848
11
    if (!cond) {
2849
0
        Py_DECREF(SetComp_annotations);
2850
0
        return 0;
2851
0
    }
2852
11
    Py_DECREF(SetComp_annotations);
2853
11
    PyObject *DictComp_annotations = PyDict_New();
2854
11
    if (!DictComp_annotations) return 0;
2855
11
    {
2856
11
        PyObject *type = state->expr_type;
2857
11
        Py_INCREF(type);
2858
11
        cond = PyDict_SetItemString(DictComp_annotations, "key", type) == 0;
2859
11
        Py_DECREF(type);
2860
11
        if (!cond) {
2861
0
            Py_DECREF(DictComp_annotations);
2862
0
            return 0;
2863
0
        }
2864
11
    }
2865
11
    {
2866
11
        PyObject *type = state->expr_type;
2867
11
        Py_INCREF(type);
2868
11
        cond = PyDict_SetItemString(DictComp_annotations, "value", type) == 0;
2869
11
        Py_DECREF(type);
2870
11
        if (!cond) {
2871
0
            Py_DECREF(DictComp_annotations);
2872
0
            return 0;
2873
0
        }
2874
11
    }
2875
11
    {
2876
11
        PyObject *type = state->comprehension_type;
2877
11
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
2878
11
        cond = type != NULL;
2879
11
        if (!cond) {
2880
0
            Py_DECREF(DictComp_annotations);
2881
0
            return 0;
2882
0
        }
2883
11
        cond = PyDict_SetItemString(DictComp_annotations, "generators", type)
2884
11
                                    == 0;
2885
11
        Py_DECREF(type);
2886
11
        if (!cond) {
2887
0
            Py_DECREF(DictComp_annotations);
2888
0
            return 0;
2889
0
        }
2890
11
    }
2891
11
    cond = PyObject_SetAttrString(state->DictComp_type, "_field_types",
2892
11
                                  DictComp_annotations) == 0;
2893
11
    if (!cond) {
2894
0
        Py_DECREF(DictComp_annotations);
2895
0
        return 0;
2896
0
    }
2897
11
    cond = PyObject_SetAttrString(state->DictComp_type, "__annotations__",
2898
11
                                  DictComp_annotations) == 0;
2899
11
    if (!cond) {
2900
0
        Py_DECREF(DictComp_annotations);
2901
0
        return 0;
2902
0
    }
2903
11
    Py_DECREF(DictComp_annotations);
2904
11
    PyObject *GeneratorExp_annotations = PyDict_New();
2905
11
    if (!GeneratorExp_annotations) return 0;
2906
11
    {
2907
11
        PyObject *type = state->expr_type;
2908
11
        Py_INCREF(type);
2909
11
        cond = PyDict_SetItemString(GeneratorExp_annotations, "elt", type) == 0;
2910
11
        Py_DECREF(type);
2911
11
        if (!cond) {
2912
0
            Py_DECREF(GeneratorExp_annotations);
2913
0
            return 0;
2914
0
        }
2915
11
    }
2916
11
    {
2917
11
        PyObject *type = state->comprehension_type;
2918
11
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
2919
11
        cond = type != NULL;
2920
11
        if (!cond) {
2921
0
            Py_DECREF(GeneratorExp_annotations);
2922
0
            return 0;
2923
0
        }
2924
11
        cond = PyDict_SetItemString(GeneratorExp_annotations, "generators",
2925
11
                                    type) == 0;
2926
11
        Py_DECREF(type);
2927
11
        if (!cond) {
2928
0
            Py_DECREF(GeneratorExp_annotations);
2929
0
            return 0;
2930
0
        }
2931
11
    }
2932
11
    cond = PyObject_SetAttrString(state->GeneratorExp_type, "_field_types",
2933
11
                                  GeneratorExp_annotations) == 0;
2934
11
    if (!cond) {
2935
0
        Py_DECREF(GeneratorExp_annotations);
2936
0
        return 0;
2937
0
    }
2938
11
    cond = PyObject_SetAttrString(state->GeneratorExp_type, "__annotations__",
2939
11
                                  GeneratorExp_annotations) == 0;
2940
11
    if (!cond) {
2941
0
        Py_DECREF(GeneratorExp_annotations);
2942
0
        return 0;
2943
0
    }
2944
11
    Py_DECREF(GeneratorExp_annotations);
2945
11
    PyObject *Await_annotations = PyDict_New();
2946
11
    if (!Await_annotations) return 0;
2947
11
    {
2948
11
        PyObject *type = state->expr_type;
2949
11
        Py_INCREF(type);
2950
11
        cond = PyDict_SetItemString(Await_annotations, "value", type) == 0;
2951
11
        Py_DECREF(type);
2952
11
        if (!cond) {
2953
0
            Py_DECREF(Await_annotations);
2954
0
            return 0;
2955
0
        }
2956
11
    }
2957
11
    cond = PyObject_SetAttrString(state->Await_type, "_field_types",
2958
11
                                  Await_annotations) == 0;
2959
11
    if (!cond) {
2960
0
        Py_DECREF(Await_annotations);
2961
0
        return 0;
2962
0
    }
2963
11
    cond = PyObject_SetAttrString(state->Await_type, "__annotations__",
2964
11
                                  Await_annotations) == 0;
2965
11
    if (!cond) {
2966
0
        Py_DECREF(Await_annotations);
2967
0
        return 0;
2968
0
    }
2969
11
    Py_DECREF(Await_annotations);
2970
11
    PyObject *Yield_annotations = PyDict_New();
2971
11
    if (!Yield_annotations) return 0;
2972
11
    {
2973
11
        PyObject *type = state->expr_type;
2974
11
        type = _Py_union_type_or(type, Py_None);
2975
11
        cond = type != NULL;
2976
11
        if (!cond) {
2977
0
            Py_DECREF(Yield_annotations);
2978
0
            return 0;
2979
0
        }
2980
11
        cond = PyDict_SetItemString(Yield_annotations, "value", type) == 0;
2981
11
        Py_DECREF(type);
2982
11
        if (!cond) {
2983
0
            Py_DECREF(Yield_annotations);
2984
0
            return 0;
2985
0
        }
2986
11
    }
2987
11
    cond = PyObject_SetAttrString(state->Yield_type, "_field_types",
2988
11
                                  Yield_annotations) == 0;
2989
11
    if (!cond) {
2990
0
        Py_DECREF(Yield_annotations);
2991
0
        return 0;
2992
0
    }
2993
11
    cond = PyObject_SetAttrString(state->Yield_type, "__annotations__",
2994
11
                                  Yield_annotations) == 0;
2995
11
    if (!cond) {
2996
0
        Py_DECREF(Yield_annotations);
2997
0
        return 0;
2998
0
    }
2999
11
    Py_DECREF(Yield_annotations);
3000
11
    PyObject *YieldFrom_annotations = PyDict_New();
3001
11
    if (!YieldFrom_annotations) return 0;
3002
11
    {
3003
11
        PyObject *type = state->expr_type;
3004
11
        Py_INCREF(type);
3005
11
        cond = PyDict_SetItemString(YieldFrom_annotations, "value", type) == 0;
3006
11
        Py_DECREF(type);
3007
11
        if (!cond) {
3008
0
            Py_DECREF(YieldFrom_annotations);
3009
0
            return 0;
3010
0
        }
3011
11
    }
3012
11
    cond = PyObject_SetAttrString(state->YieldFrom_type, "_field_types",
3013
11
                                  YieldFrom_annotations) == 0;
3014
11
    if (!cond) {
3015
0
        Py_DECREF(YieldFrom_annotations);
3016
0
        return 0;
3017
0
    }
3018
11
    cond = PyObject_SetAttrString(state->YieldFrom_type, "__annotations__",
3019
11
                                  YieldFrom_annotations) == 0;
3020
11
    if (!cond) {
3021
0
        Py_DECREF(YieldFrom_annotations);
3022
0
        return 0;
3023
0
    }
3024
11
    Py_DECREF(YieldFrom_annotations);
3025
11
    PyObject *Compare_annotations = PyDict_New();
3026
11
    if (!Compare_annotations) return 0;
3027
11
    {
3028
11
        PyObject *type = state->expr_type;
3029
11
        Py_INCREF(type);
3030
11
        cond = PyDict_SetItemString(Compare_annotations, "left", type) == 0;
3031
11
        Py_DECREF(type);
3032
11
        if (!cond) {
3033
0
            Py_DECREF(Compare_annotations);
3034
0
            return 0;
3035
0
        }
3036
11
    }
3037
11
    {
3038
11
        PyObject *type = state->cmpop_type;
3039
11
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
3040
11
        cond = type != NULL;
3041
11
        if (!cond) {
3042
0
            Py_DECREF(Compare_annotations);
3043
0
            return 0;
3044
0
        }
3045
11
        cond = PyDict_SetItemString(Compare_annotations, "ops", type) == 0;
3046
11
        Py_DECREF(type);
3047
11
        if (!cond) {
3048
0
            Py_DECREF(Compare_annotations);
3049
0
            return 0;
3050
0
        }
3051
11
    }
3052
11
    {
3053
11
        PyObject *type = state->expr_type;
3054
11
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
3055
11
        cond = type != NULL;
3056
11
        if (!cond) {
3057
0
            Py_DECREF(Compare_annotations);
3058
0
            return 0;
3059
0
        }
3060
11
        cond = PyDict_SetItemString(Compare_annotations, "comparators", type)
3061
11
                                    == 0;
3062
11
        Py_DECREF(type);
3063
11
        if (!cond) {
3064
0
            Py_DECREF(Compare_annotations);
3065
0
            return 0;
3066
0
        }
3067
11
    }
3068
11
    cond = PyObject_SetAttrString(state->Compare_type, "_field_types",
3069
11
                                  Compare_annotations) == 0;
3070
11
    if (!cond) {
3071
0
        Py_DECREF(Compare_annotations);
3072
0
        return 0;
3073
0
    }
3074
11
    cond = PyObject_SetAttrString(state->Compare_type, "__annotations__",
3075
11
                                  Compare_annotations) == 0;
3076
11
    if (!cond) {
3077
0
        Py_DECREF(Compare_annotations);
3078
0
        return 0;
3079
0
    }
3080
11
    Py_DECREF(Compare_annotations);
3081
11
    PyObject *Call_annotations = PyDict_New();
3082
11
    if (!Call_annotations) return 0;
3083
11
    {
3084
11
        PyObject *type = state->expr_type;
3085
11
        Py_INCREF(type);
3086
11
        cond = PyDict_SetItemString(Call_annotations, "func", type) == 0;
3087
11
        Py_DECREF(type);
3088
11
        if (!cond) {
3089
0
            Py_DECREF(Call_annotations);
3090
0
            return 0;
3091
0
        }
3092
11
    }
3093
11
    {
3094
11
        PyObject *type = state->expr_type;
3095
11
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
3096
11
        cond = type != NULL;
3097
11
        if (!cond) {
3098
0
            Py_DECREF(Call_annotations);
3099
0
            return 0;
3100
0
        }
3101
11
        cond = PyDict_SetItemString(Call_annotations, "args", type) == 0;
3102
11
        Py_DECREF(type);
3103
11
        if (!cond) {
3104
0
            Py_DECREF(Call_annotations);
3105
0
            return 0;
3106
0
        }
3107
11
    }
3108
11
    {
3109
11
        PyObject *type = state->keyword_type;
3110
11
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
3111
11
        cond = type != NULL;
3112
11
        if (!cond) {
3113
0
            Py_DECREF(Call_annotations);
3114
0
            return 0;
3115
0
        }
3116
11
        cond = PyDict_SetItemString(Call_annotations, "keywords", type) == 0;
3117
11
        Py_DECREF(type);
3118
11
        if (!cond) {
3119
0
            Py_DECREF(Call_annotations);
3120
0
            return 0;
3121
0
        }
3122
11
    }
3123
11
    cond = PyObject_SetAttrString(state->Call_type, "_field_types",
3124
11
                                  Call_annotations) == 0;
3125
11
    if (!cond) {
3126
0
        Py_DECREF(Call_annotations);
3127
0
        return 0;
3128
0
    }
3129
11
    cond = PyObject_SetAttrString(state->Call_type, "__annotations__",
3130
11
                                  Call_annotations) == 0;
3131
11
    if (!cond) {
3132
0
        Py_DECREF(Call_annotations);
3133
0
        return 0;
3134
0
    }
3135
11
    Py_DECREF(Call_annotations);
3136
11
    PyObject *FormattedValue_annotations = PyDict_New();
3137
11
    if (!FormattedValue_annotations) return 0;
3138
11
    {
3139
11
        PyObject *type = state->expr_type;
3140
11
        Py_INCREF(type);
3141
11
        cond = PyDict_SetItemString(FormattedValue_annotations, "value", type)
3142
11
                                    == 0;
3143
11
        Py_DECREF(type);
3144
11
        if (!cond) {
3145
0
            Py_DECREF(FormattedValue_annotations);
3146
0
            return 0;
3147
0
        }
3148
11
    }
3149
11
    {
3150
11
        PyObject *type = (PyObject *)&PyLong_Type;
3151
11
        Py_INCREF(type);
3152
11
        cond = PyDict_SetItemString(FormattedValue_annotations, "conversion",
3153
11
                                    type) == 0;
3154
11
        Py_DECREF(type);
3155
11
        if (!cond) {
3156
0
            Py_DECREF(FormattedValue_annotations);
3157
0
            return 0;
3158
0
        }
3159
11
    }
3160
11
    {
3161
11
        PyObject *type = state->expr_type;
3162
11
        type = _Py_union_type_or(type, Py_None);
3163
11
        cond = type != NULL;
3164
11
        if (!cond) {
3165
0
            Py_DECREF(FormattedValue_annotations);
3166
0
            return 0;
3167
0
        }
3168
11
        cond = PyDict_SetItemString(FormattedValue_annotations, "format_spec",
3169
11
                                    type) == 0;
3170
11
        Py_DECREF(type);
3171
11
        if (!cond) {
3172
0
            Py_DECREF(FormattedValue_annotations);
3173
0
            return 0;
3174
0
        }
3175
11
    }
3176
11
    cond = PyObject_SetAttrString(state->FormattedValue_type, "_field_types",
3177
11
                                  FormattedValue_annotations) == 0;
3178
11
    if (!cond) {
3179
0
        Py_DECREF(FormattedValue_annotations);
3180
0
        return 0;
3181
0
    }
3182
11
    cond = PyObject_SetAttrString(state->FormattedValue_type,
3183
11
                                  "__annotations__",
3184
11
                                  FormattedValue_annotations) == 0;
3185
11
    if (!cond) {
3186
0
        Py_DECREF(FormattedValue_annotations);
3187
0
        return 0;
3188
0
    }
3189
11
    Py_DECREF(FormattedValue_annotations);
3190
11
    PyObject *Interpolation_annotations = PyDict_New();
3191
11
    if (!Interpolation_annotations) return 0;
3192
11
    {
3193
11
        PyObject *type = state->expr_type;
3194
11
        Py_INCREF(type);
3195
11
        cond = PyDict_SetItemString(Interpolation_annotations, "value", type)
3196
11
                                    == 0;
3197
11
        Py_DECREF(type);
3198
11
        if (!cond) {
3199
0
            Py_DECREF(Interpolation_annotations);
3200
0
            return 0;
3201
0
        }
3202
11
    }
3203
11
    {
3204
11
        PyObject *type = (PyObject *)&PyBaseObject_Type;
3205
11
        Py_INCREF(type);
3206
11
        cond = PyDict_SetItemString(Interpolation_annotations, "str", type) ==
3207
11
                                    0;
3208
11
        Py_DECREF(type);
3209
11
        if (!cond) {
3210
0
            Py_DECREF(Interpolation_annotations);
3211
0
            return 0;
3212
0
        }
3213
11
    }
3214
11
    {
3215
11
        PyObject *type = (PyObject *)&PyLong_Type;
3216
11
        Py_INCREF(type);
3217
11
        cond = PyDict_SetItemString(Interpolation_annotations, "conversion",
3218
11
                                    type) == 0;
3219
11
        Py_DECREF(type);
3220
11
        if (!cond) {
3221
0
            Py_DECREF(Interpolation_annotations);
3222
0
            return 0;
3223
0
        }
3224
11
    }
3225
11
    {
3226
11
        PyObject *type = state->expr_type;
3227
11
        type = _Py_union_type_or(type, Py_None);
3228
11
        cond = type != NULL;
3229
11
        if (!cond) {
3230
0
            Py_DECREF(Interpolation_annotations);
3231
0
            return 0;
3232
0
        }
3233
11
        cond = PyDict_SetItemString(Interpolation_annotations, "format_spec",
3234
11
                                    type) == 0;
3235
11
        Py_DECREF(type);
3236
11
        if (!cond) {
3237
0
            Py_DECREF(Interpolation_annotations);
3238
0
            return 0;
3239
0
        }
3240
11
    }
3241
11
    cond = PyObject_SetAttrString(state->Interpolation_type, "_field_types",
3242
11
                                  Interpolation_annotations) == 0;
3243
11
    if (!cond) {
3244
0
        Py_DECREF(Interpolation_annotations);
3245
0
        return 0;
3246
0
    }
3247
11
    cond = PyObject_SetAttrString(state->Interpolation_type, "__annotations__",
3248
11
                                  Interpolation_annotations) == 0;
3249
11
    if (!cond) {
3250
0
        Py_DECREF(Interpolation_annotations);
3251
0
        return 0;
3252
0
    }
3253
11
    Py_DECREF(Interpolation_annotations);
3254
11
    PyObject *JoinedStr_annotations = PyDict_New();
3255
11
    if (!JoinedStr_annotations) return 0;
3256
11
    {
3257
11
        PyObject *type = state->expr_type;
3258
11
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
3259
11
        cond = type != NULL;
3260
11
        if (!cond) {
3261
0
            Py_DECREF(JoinedStr_annotations);
3262
0
            return 0;
3263
0
        }
3264
11
        cond = PyDict_SetItemString(JoinedStr_annotations, "values", type) == 0;
3265
11
        Py_DECREF(type);
3266
11
        if (!cond) {
3267
0
            Py_DECREF(JoinedStr_annotations);
3268
0
            return 0;
3269
0
        }
3270
11
    }
3271
11
    cond = PyObject_SetAttrString(state->JoinedStr_type, "_field_types",
3272
11
                                  JoinedStr_annotations) == 0;
3273
11
    if (!cond) {
3274
0
        Py_DECREF(JoinedStr_annotations);
3275
0
        return 0;
3276
0
    }
3277
11
    cond = PyObject_SetAttrString(state->JoinedStr_type, "__annotations__",
3278
11
                                  JoinedStr_annotations) == 0;
3279
11
    if (!cond) {
3280
0
        Py_DECREF(JoinedStr_annotations);
3281
0
        return 0;
3282
0
    }
3283
11
    Py_DECREF(JoinedStr_annotations);
3284
11
    PyObject *TemplateStr_annotations = PyDict_New();
3285
11
    if (!TemplateStr_annotations) return 0;
3286
11
    {
3287
11
        PyObject *type = state->expr_type;
3288
11
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
3289
11
        cond = type != NULL;
3290
11
        if (!cond) {
3291
0
            Py_DECREF(TemplateStr_annotations);
3292
0
            return 0;
3293
0
        }
3294
11
        cond = PyDict_SetItemString(TemplateStr_annotations, "values", type) ==
3295
11
                                    0;
3296
11
        Py_DECREF(type);
3297
11
        if (!cond) {
3298
0
            Py_DECREF(TemplateStr_annotations);
3299
0
            return 0;
3300
0
        }
3301
11
    }
3302
11
    cond = PyObject_SetAttrString(state->TemplateStr_type, "_field_types",
3303
11
                                  TemplateStr_annotations) == 0;
3304
11
    if (!cond) {
3305
0
        Py_DECREF(TemplateStr_annotations);
3306
0
        return 0;
3307
0
    }
3308
11
    cond = PyObject_SetAttrString(state->TemplateStr_type, "__annotations__",
3309
11
                                  TemplateStr_annotations) == 0;
3310
11
    if (!cond) {
3311
0
        Py_DECREF(TemplateStr_annotations);
3312
0
        return 0;
3313
0
    }
3314
11
    Py_DECREF(TemplateStr_annotations);
3315
11
    PyObject *Constant_annotations = PyDict_New();
3316
11
    if (!Constant_annotations) return 0;
3317
11
    {
3318
11
        PyObject *type = (PyObject *)&PyBaseObject_Type;
3319
11
        Py_INCREF(type);
3320
11
        cond = PyDict_SetItemString(Constant_annotations, "value", type) == 0;
3321
11
        Py_DECREF(type);
3322
11
        if (!cond) {
3323
0
            Py_DECREF(Constant_annotations);
3324
0
            return 0;
3325
0
        }
3326
11
    }
3327
11
    {
3328
11
        PyObject *type = (PyObject *)&PyUnicode_Type;
3329
11
        type = _Py_union_type_or(type, Py_None);
3330
11
        cond = type != NULL;
3331
11
        if (!cond) {
3332
0
            Py_DECREF(Constant_annotations);
3333
0
            return 0;
3334
0
        }
3335
11
        cond = PyDict_SetItemString(Constant_annotations, "kind", type) == 0;
3336
11
        Py_DECREF(type);
3337
11
        if (!cond) {
3338
0
            Py_DECREF(Constant_annotations);
3339
0
            return 0;
3340
0
        }
3341
11
    }
3342
11
    cond = PyObject_SetAttrString(state->Constant_type, "_field_types",
3343
11
                                  Constant_annotations) == 0;
3344
11
    if (!cond) {
3345
0
        Py_DECREF(Constant_annotations);
3346
0
        return 0;
3347
0
    }
3348
11
    cond = PyObject_SetAttrString(state->Constant_type, "__annotations__",
3349
11
                                  Constant_annotations) == 0;
3350
11
    if (!cond) {
3351
0
        Py_DECREF(Constant_annotations);
3352
0
        return 0;
3353
0
    }
3354
11
    Py_DECREF(Constant_annotations);
3355
11
    PyObject *Attribute_annotations = PyDict_New();
3356
11
    if (!Attribute_annotations) return 0;
3357
11
    {
3358
11
        PyObject *type = state->expr_type;
3359
11
        Py_INCREF(type);
3360
11
        cond = PyDict_SetItemString(Attribute_annotations, "value", type) == 0;
3361
11
        Py_DECREF(type);
3362
11
        if (!cond) {
3363
0
            Py_DECREF(Attribute_annotations);
3364
0
            return 0;
3365
0
        }
3366
11
    }
3367
11
    {
3368
11
        PyObject *type = (PyObject *)&PyUnicode_Type;
3369
11
        Py_INCREF(type);
3370
11
        cond = PyDict_SetItemString(Attribute_annotations, "attr", type) == 0;
3371
11
        Py_DECREF(type);
3372
11
        if (!cond) {
3373
0
            Py_DECREF(Attribute_annotations);
3374
0
            return 0;
3375
0
        }
3376
11
    }
3377
11
    {
3378
11
        PyObject *type = state->expr_context_type;
3379
11
        Py_INCREF(type);
3380
11
        cond = PyDict_SetItemString(Attribute_annotations, "ctx", type) == 0;
3381
11
        Py_DECREF(type);
3382
11
        if (!cond) {
3383
0
            Py_DECREF(Attribute_annotations);
3384
0
            return 0;
3385
0
        }
3386
11
    }
3387
11
    cond = PyObject_SetAttrString(state->Attribute_type, "_field_types",
3388
11
                                  Attribute_annotations) == 0;
3389
11
    if (!cond) {
3390
0
        Py_DECREF(Attribute_annotations);
3391
0
        return 0;
3392
0
    }
3393
11
    cond = PyObject_SetAttrString(state->Attribute_type, "__annotations__",
3394
11
                                  Attribute_annotations) == 0;
3395
11
    if (!cond) {
3396
0
        Py_DECREF(Attribute_annotations);
3397
0
        return 0;
3398
0
    }
3399
11
    Py_DECREF(Attribute_annotations);
3400
11
    PyObject *Subscript_annotations = PyDict_New();
3401
11
    if (!Subscript_annotations) return 0;
3402
11
    {
3403
11
        PyObject *type = state->expr_type;
3404
11
        Py_INCREF(type);
3405
11
        cond = PyDict_SetItemString(Subscript_annotations, "value", type) == 0;
3406
11
        Py_DECREF(type);
3407
11
        if (!cond) {
3408
0
            Py_DECREF(Subscript_annotations);
3409
0
            return 0;
3410
0
        }
3411
11
    }
3412
11
    {
3413
11
        PyObject *type = state->expr_type;
3414
11
        Py_INCREF(type);
3415
11
        cond = PyDict_SetItemString(Subscript_annotations, "slice", type) == 0;
3416
11
        Py_DECREF(type);
3417
11
        if (!cond) {
3418
0
            Py_DECREF(Subscript_annotations);
3419
0
            return 0;
3420
0
        }
3421
11
    }
3422
11
    {
3423
11
        PyObject *type = state->expr_context_type;
3424
11
        Py_INCREF(type);
3425
11
        cond = PyDict_SetItemString(Subscript_annotations, "ctx", type) == 0;
3426
11
        Py_DECREF(type);
3427
11
        if (!cond) {
3428
0
            Py_DECREF(Subscript_annotations);
3429
0
            return 0;
3430
0
        }
3431
11
    }
3432
11
    cond = PyObject_SetAttrString(state->Subscript_type, "_field_types",
3433
11
                                  Subscript_annotations) == 0;
3434
11
    if (!cond) {
3435
0
        Py_DECREF(Subscript_annotations);
3436
0
        return 0;
3437
0
    }
3438
11
    cond = PyObject_SetAttrString(state->Subscript_type, "__annotations__",
3439
11
                                  Subscript_annotations) == 0;
3440
11
    if (!cond) {
3441
0
        Py_DECREF(Subscript_annotations);
3442
0
        return 0;
3443
0
    }
3444
11
    Py_DECREF(Subscript_annotations);
3445
11
    PyObject *Starred_annotations = PyDict_New();
3446
11
    if (!Starred_annotations) return 0;
3447
11
    {
3448
11
        PyObject *type = state->expr_type;
3449
11
        Py_INCREF(type);
3450
11
        cond = PyDict_SetItemString(Starred_annotations, "value", type) == 0;
3451
11
        Py_DECREF(type);
3452
11
        if (!cond) {
3453
0
            Py_DECREF(Starred_annotations);
3454
0
            return 0;
3455
0
        }
3456
11
    }
3457
11
    {
3458
11
        PyObject *type = state->expr_context_type;
3459
11
        Py_INCREF(type);
3460
11
        cond = PyDict_SetItemString(Starred_annotations, "ctx", type) == 0;
3461
11
        Py_DECREF(type);
3462
11
        if (!cond) {
3463
0
            Py_DECREF(Starred_annotations);
3464
0
            return 0;
3465
0
        }
3466
11
    }
3467
11
    cond = PyObject_SetAttrString(state->Starred_type, "_field_types",
3468
11
                                  Starred_annotations) == 0;
3469
11
    if (!cond) {
3470
0
        Py_DECREF(Starred_annotations);
3471
0
        return 0;
3472
0
    }
3473
11
    cond = PyObject_SetAttrString(state->Starred_type, "__annotations__",
3474
11
                                  Starred_annotations) == 0;
3475
11
    if (!cond) {
3476
0
        Py_DECREF(Starred_annotations);
3477
0
        return 0;
3478
0
    }
3479
11
    Py_DECREF(Starred_annotations);
3480
11
    PyObject *Name_annotations = PyDict_New();
3481
11
    if (!Name_annotations) return 0;
3482
11
    {
3483
11
        PyObject *type = (PyObject *)&PyUnicode_Type;
3484
11
        Py_INCREF(type);
3485
11
        cond = PyDict_SetItemString(Name_annotations, "id", type) == 0;
3486
11
        Py_DECREF(type);
3487
11
        if (!cond) {
3488
0
            Py_DECREF(Name_annotations);
3489
0
            return 0;
3490
0
        }
3491
11
    }
3492
11
    {
3493
11
        PyObject *type = state->expr_context_type;
3494
11
        Py_INCREF(type);
3495
11
        cond = PyDict_SetItemString(Name_annotations, "ctx", type) == 0;
3496
11
        Py_DECREF(type);
3497
11
        if (!cond) {
3498
0
            Py_DECREF(Name_annotations);
3499
0
            return 0;
3500
0
        }
3501
11
    }
3502
11
    cond = PyObject_SetAttrString(state->Name_type, "_field_types",
3503
11
                                  Name_annotations) == 0;
3504
11
    if (!cond) {
3505
0
        Py_DECREF(Name_annotations);
3506
0
        return 0;
3507
0
    }
3508
11
    cond = PyObject_SetAttrString(state->Name_type, "__annotations__",
3509
11
                                  Name_annotations) == 0;
3510
11
    if (!cond) {
3511
0
        Py_DECREF(Name_annotations);
3512
0
        return 0;
3513
0
    }
3514
11
    Py_DECREF(Name_annotations);
3515
11
    PyObject *List_annotations = PyDict_New();
3516
11
    if (!List_annotations) return 0;
3517
11
    {
3518
11
        PyObject *type = state->expr_type;
3519
11
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
3520
11
        cond = type != NULL;
3521
11
        if (!cond) {
3522
0
            Py_DECREF(List_annotations);
3523
0
            return 0;
3524
0
        }
3525
11
        cond = PyDict_SetItemString(List_annotations, "elts", type) == 0;
3526
11
        Py_DECREF(type);
3527
11
        if (!cond) {
3528
0
            Py_DECREF(List_annotations);
3529
0
            return 0;
3530
0
        }
3531
11
    }
3532
11
    {
3533
11
        PyObject *type = state->expr_context_type;
3534
11
        Py_INCREF(type);
3535
11
        cond = PyDict_SetItemString(List_annotations, "ctx", type) == 0;
3536
11
        Py_DECREF(type);
3537
11
        if (!cond) {
3538
0
            Py_DECREF(List_annotations);
3539
0
            return 0;
3540
0
        }
3541
11
    }
3542
11
    cond = PyObject_SetAttrString(state->List_type, "_field_types",
3543
11
                                  List_annotations) == 0;
3544
11
    if (!cond) {
3545
0
        Py_DECREF(List_annotations);
3546
0
        return 0;
3547
0
    }
3548
11
    cond = PyObject_SetAttrString(state->List_type, "__annotations__",
3549
11
                                  List_annotations) == 0;
3550
11
    if (!cond) {
3551
0
        Py_DECREF(List_annotations);
3552
0
        return 0;
3553
0
    }
3554
11
    Py_DECREF(List_annotations);
3555
11
    PyObject *Tuple_annotations = PyDict_New();
3556
11
    if (!Tuple_annotations) return 0;
3557
11
    {
3558
11
        PyObject *type = state->expr_type;
3559
11
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
3560
11
        cond = type != NULL;
3561
11
        if (!cond) {
3562
0
            Py_DECREF(Tuple_annotations);
3563
0
            return 0;
3564
0
        }
3565
11
        cond = PyDict_SetItemString(Tuple_annotations, "elts", type) == 0;
3566
11
        Py_DECREF(type);
3567
11
        if (!cond) {
3568
0
            Py_DECREF(Tuple_annotations);
3569
0
            return 0;
3570
0
        }
3571
11
    }
3572
11
    {
3573
11
        PyObject *type = state->expr_context_type;
3574
11
        Py_INCREF(type);
3575
11
        cond = PyDict_SetItemString(Tuple_annotations, "ctx", type) == 0;
3576
11
        Py_DECREF(type);
3577
11
        if (!cond) {
3578
0
            Py_DECREF(Tuple_annotations);
3579
0
            return 0;
3580
0
        }
3581
11
    }
3582
11
    cond = PyObject_SetAttrString(state->Tuple_type, "_field_types",
3583
11
                                  Tuple_annotations) == 0;
3584
11
    if (!cond) {
3585
0
        Py_DECREF(Tuple_annotations);
3586
0
        return 0;
3587
0
    }
3588
11
    cond = PyObject_SetAttrString(state->Tuple_type, "__annotations__",
3589
11
                                  Tuple_annotations) == 0;
3590
11
    if (!cond) {
3591
0
        Py_DECREF(Tuple_annotations);
3592
0
        return 0;
3593
0
    }
3594
11
    Py_DECREF(Tuple_annotations);
3595
11
    PyObject *Slice_annotations = PyDict_New();
3596
11
    if (!Slice_annotations) return 0;
3597
11
    {
3598
11
        PyObject *type = state->expr_type;
3599
11
        type = _Py_union_type_or(type, Py_None);
3600
11
        cond = type != NULL;
3601
11
        if (!cond) {
3602
0
            Py_DECREF(Slice_annotations);
3603
0
            return 0;
3604
0
        }
3605
11
        cond = PyDict_SetItemString(Slice_annotations, "lower", type) == 0;
3606
11
        Py_DECREF(type);
3607
11
        if (!cond) {
3608
0
            Py_DECREF(Slice_annotations);
3609
0
            return 0;
3610
0
        }
3611
11
    }
3612
11
    {
3613
11
        PyObject *type = state->expr_type;
3614
11
        type = _Py_union_type_or(type, Py_None);
3615
11
        cond = type != NULL;
3616
11
        if (!cond) {
3617
0
            Py_DECREF(Slice_annotations);
3618
0
            return 0;
3619
0
        }
3620
11
        cond = PyDict_SetItemString(Slice_annotations, "upper", type) == 0;
3621
11
        Py_DECREF(type);
3622
11
        if (!cond) {
3623
0
            Py_DECREF(Slice_annotations);
3624
0
            return 0;
3625
0
        }
3626
11
    }
3627
11
    {
3628
11
        PyObject *type = state->expr_type;
3629
11
        type = _Py_union_type_or(type, Py_None);
3630
11
        cond = type != NULL;
3631
11
        if (!cond) {
3632
0
            Py_DECREF(Slice_annotations);
3633
0
            return 0;
3634
0
        }
3635
11
        cond = PyDict_SetItemString(Slice_annotations, "step", type) == 0;
3636
11
        Py_DECREF(type);
3637
11
        if (!cond) {
3638
0
            Py_DECREF(Slice_annotations);
3639
0
            return 0;
3640
0
        }
3641
11
    }
3642
11
    cond = PyObject_SetAttrString(state->Slice_type, "_field_types",
3643
11
                                  Slice_annotations) == 0;
3644
11
    if (!cond) {
3645
0
        Py_DECREF(Slice_annotations);
3646
0
        return 0;
3647
0
    }
3648
11
    cond = PyObject_SetAttrString(state->Slice_type, "__annotations__",
3649
11
                                  Slice_annotations) == 0;
3650
11
    if (!cond) {
3651
0
        Py_DECREF(Slice_annotations);
3652
0
        return 0;
3653
0
    }
3654
11
    Py_DECREF(Slice_annotations);
3655
11
    PyObject *Load_annotations = PyDict_New();
3656
11
    if (!Load_annotations) return 0;
3657
11
    cond = PyObject_SetAttrString(state->Load_type, "_field_types",
3658
11
                                  Load_annotations) == 0;
3659
11
    if (!cond) {
3660
0
        Py_DECREF(Load_annotations);
3661
0
        return 0;
3662
0
    }
3663
11
    cond = PyObject_SetAttrString(state->Load_type, "__annotations__",
3664
11
                                  Load_annotations) == 0;
3665
11
    if (!cond) {
3666
0
        Py_DECREF(Load_annotations);
3667
0
        return 0;
3668
0
    }
3669
11
    Py_DECREF(Load_annotations);
3670
11
    PyObject *Store_annotations = PyDict_New();
3671
11
    if (!Store_annotations) return 0;
3672
11
    cond = PyObject_SetAttrString(state->Store_type, "_field_types",
3673
11
                                  Store_annotations) == 0;
3674
11
    if (!cond) {
3675
0
        Py_DECREF(Store_annotations);
3676
0
        return 0;
3677
0
    }
3678
11
    cond = PyObject_SetAttrString(state->Store_type, "__annotations__",
3679
11
                                  Store_annotations) == 0;
3680
11
    if (!cond) {
3681
0
        Py_DECREF(Store_annotations);
3682
0
        return 0;
3683
0
    }
3684
11
    Py_DECREF(Store_annotations);
3685
11
    PyObject *Del_annotations = PyDict_New();
3686
11
    if (!Del_annotations) return 0;
3687
11
    cond = PyObject_SetAttrString(state->Del_type, "_field_types",
3688
11
                                  Del_annotations) == 0;
3689
11
    if (!cond) {
3690
0
        Py_DECREF(Del_annotations);
3691
0
        return 0;
3692
0
    }
3693
11
    cond = PyObject_SetAttrString(state->Del_type, "__annotations__",
3694
11
                                  Del_annotations) == 0;
3695
11
    if (!cond) {
3696
0
        Py_DECREF(Del_annotations);
3697
0
        return 0;
3698
0
    }
3699
11
    Py_DECREF(Del_annotations);
3700
11
    PyObject *And_annotations = PyDict_New();
3701
11
    if (!And_annotations) return 0;
3702
11
    cond = PyObject_SetAttrString(state->And_type, "_field_types",
3703
11
                                  And_annotations) == 0;
3704
11
    if (!cond) {
3705
0
        Py_DECREF(And_annotations);
3706
0
        return 0;
3707
0
    }
3708
11
    cond = PyObject_SetAttrString(state->And_type, "__annotations__",
3709
11
                                  And_annotations) == 0;
3710
11
    if (!cond) {
3711
0
        Py_DECREF(And_annotations);
3712
0
        return 0;
3713
0
    }
3714
11
    Py_DECREF(And_annotations);
3715
11
    PyObject *Or_annotations = PyDict_New();
3716
11
    if (!Or_annotations) return 0;
3717
11
    cond = PyObject_SetAttrString(state->Or_type, "_field_types",
3718
11
                                  Or_annotations) == 0;
3719
11
    if (!cond) {
3720
0
        Py_DECREF(Or_annotations);
3721
0
        return 0;
3722
0
    }
3723
11
    cond = PyObject_SetAttrString(state->Or_type, "__annotations__",
3724
11
                                  Or_annotations) == 0;
3725
11
    if (!cond) {
3726
0
        Py_DECREF(Or_annotations);
3727
0
        return 0;
3728
0
    }
3729
11
    Py_DECREF(Or_annotations);
3730
11
    PyObject *Add_annotations = PyDict_New();
3731
11
    if (!Add_annotations) return 0;
3732
11
    cond = PyObject_SetAttrString(state->Add_type, "_field_types",
3733
11
                                  Add_annotations) == 0;
3734
11
    if (!cond) {
3735
0
        Py_DECREF(Add_annotations);
3736
0
        return 0;
3737
0
    }
3738
11
    cond = PyObject_SetAttrString(state->Add_type, "__annotations__",
3739
11
                                  Add_annotations) == 0;
3740
11
    if (!cond) {
3741
0
        Py_DECREF(Add_annotations);
3742
0
        return 0;
3743
0
    }
3744
11
    Py_DECREF(Add_annotations);
3745
11
    PyObject *Sub_annotations = PyDict_New();
3746
11
    if (!Sub_annotations) return 0;
3747
11
    cond = PyObject_SetAttrString(state->Sub_type, "_field_types",
3748
11
                                  Sub_annotations) == 0;
3749
11
    if (!cond) {
3750
0
        Py_DECREF(Sub_annotations);
3751
0
        return 0;
3752
0
    }
3753
11
    cond = PyObject_SetAttrString(state->Sub_type, "__annotations__",
3754
11
                                  Sub_annotations) == 0;
3755
11
    if (!cond) {
3756
0
        Py_DECREF(Sub_annotations);
3757
0
        return 0;
3758
0
    }
3759
11
    Py_DECREF(Sub_annotations);
3760
11
    PyObject *Mult_annotations = PyDict_New();
3761
11
    if (!Mult_annotations) return 0;
3762
11
    cond = PyObject_SetAttrString(state->Mult_type, "_field_types",
3763
11
                                  Mult_annotations) == 0;
3764
11
    if (!cond) {
3765
0
        Py_DECREF(Mult_annotations);
3766
0
        return 0;
3767
0
    }
3768
11
    cond = PyObject_SetAttrString(state->Mult_type, "__annotations__",
3769
11
                                  Mult_annotations) == 0;
3770
11
    if (!cond) {
3771
0
        Py_DECREF(Mult_annotations);
3772
0
        return 0;
3773
0
    }
3774
11
    Py_DECREF(Mult_annotations);
3775
11
    PyObject *MatMult_annotations = PyDict_New();
3776
11
    if (!MatMult_annotations) return 0;
3777
11
    cond = PyObject_SetAttrString(state->MatMult_type, "_field_types",
3778
11
                                  MatMult_annotations) == 0;
3779
11
    if (!cond) {
3780
0
        Py_DECREF(MatMult_annotations);
3781
0
        return 0;
3782
0
    }
3783
11
    cond = PyObject_SetAttrString(state->MatMult_type, "__annotations__",
3784
11
                                  MatMult_annotations) == 0;
3785
11
    if (!cond) {
3786
0
        Py_DECREF(MatMult_annotations);
3787
0
        return 0;
3788
0
    }
3789
11
    Py_DECREF(MatMult_annotations);
3790
11
    PyObject *Div_annotations = PyDict_New();
3791
11
    if (!Div_annotations) return 0;
3792
11
    cond = PyObject_SetAttrString(state->Div_type, "_field_types",
3793
11
                                  Div_annotations) == 0;
3794
11
    if (!cond) {
3795
0
        Py_DECREF(Div_annotations);
3796
0
        return 0;
3797
0
    }
3798
11
    cond = PyObject_SetAttrString(state->Div_type, "__annotations__",
3799
11
                                  Div_annotations) == 0;
3800
11
    if (!cond) {
3801
0
        Py_DECREF(Div_annotations);
3802
0
        return 0;
3803
0
    }
3804
11
    Py_DECREF(Div_annotations);
3805
11
    PyObject *Mod_annotations = PyDict_New();
3806
11
    if (!Mod_annotations) return 0;
3807
11
    cond = PyObject_SetAttrString(state->Mod_type, "_field_types",
3808
11
                                  Mod_annotations) == 0;
3809
11
    if (!cond) {
3810
0
        Py_DECREF(Mod_annotations);
3811
0
        return 0;
3812
0
    }
3813
11
    cond = PyObject_SetAttrString(state->Mod_type, "__annotations__",
3814
11
                                  Mod_annotations) == 0;
3815
11
    if (!cond) {
3816
0
        Py_DECREF(Mod_annotations);
3817
0
        return 0;
3818
0
    }
3819
11
    Py_DECREF(Mod_annotations);
3820
11
    PyObject *Pow_annotations = PyDict_New();
3821
11
    if (!Pow_annotations) return 0;
3822
11
    cond = PyObject_SetAttrString(state->Pow_type, "_field_types",
3823
11
                                  Pow_annotations) == 0;
3824
11
    if (!cond) {
3825
0
        Py_DECREF(Pow_annotations);
3826
0
        return 0;
3827
0
    }
3828
11
    cond = PyObject_SetAttrString(state->Pow_type, "__annotations__",
3829
11
                                  Pow_annotations) == 0;
3830
11
    if (!cond) {
3831
0
        Py_DECREF(Pow_annotations);
3832
0
        return 0;
3833
0
    }
3834
11
    Py_DECREF(Pow_annotations);
3835
11
    PyObject *LShift_annotations = PyDict_New();
3836
11
    if (!LShift_annotations) return 0;
3837
11
    cond = PyObject_SetAttrString(state->LShift_type, "_field_types",
3838
11
                                  LShift_annotations) == 0;
3839
11
    if (!cond) {
3840
0
        Py_DECREF(LShift_annotations);
3841
0
        return 0;
3842
0
    }
3843
11
    cond = PyObject_SetAttrString(state->LShift_type, "__annotations__",
3844
11
                                  LShift_annotations) == 0;
3845
11
    if (!cond) {
3846
0
        Py_DECREF(LShift_annotations);
3847
0
        return 0;
3848
0
    }
3849
11
    Py_DECREF(LShift_annotations);
3850
11
    PyObject *RShift_annotations = PyDict_New();
3851
11
    if (!RShift_annotations) return 0;
3852
11
    cond = PyObject_SetAttrString(state->RShift_type, "_field_types",
3853
11
                                  RShift_annotations) == 0;
3854
11
    if (!cond) {
3855
0
        Py_DECREF(RShift_annotations);
3856
0
        return 0;
3857
0
    }
3858
11
    cond = PyObject_SetAttrString(state->RShift_type, "__annotations__",
3859
11
                                  RShift_annotations) == 0;
3860
11
    if (!cond) {
3861
0
        Py_DECREF(RShift_annotations);
3862
0
        return 0;
3863
0
    }
3864
11
    Py_DECREF(RShift_annotations);
3865
11
    PyObject *BitOr_annotations = PyDict_New();
3866
11
    if (!BitOr_annotations) return 0;
3867
11
    cond = PyObject_SetAttrString(state->BitOr_type, "_field_types",
3868
11
                                  BitOr_annotations) == 0;
3869
11
    if (!cond) {
3870
0
        Py_DECREF(BitOr_annotations);
3871
0
        return 0;
3872
0
    }
3873
11
    cond = PyObject_SetAttrString(state->BitOr_type, "__annotations__",
3874
11
                                  BitOr_annotations) == 0;
3875
11
    if (!cond) {
3876
0
        Py_DECREF(BitOr_annotations);
3877
0
        return 0;
3878
0
    }
3879
11
    Py_DECREF(BitOr_annotations);
3880
11
    PyObject *BitXor_annotations = PyDict_New();
3881
11
    if (!BitXor_annotations) return 0;
3882
11
    cond = PyObject_SetAttrString(state->BitXor_type, "_field_types",
3883
11
                                  BitXor_annotations) == 0;
3884
11
    if (!cond) {
3885
0
        Py_DECREF(BitXor_annotations);
3886
0
        return 0;
3887
0
    }
3888
11
    cond = PyObject_SetAttrString(state->BitXor_type, "__annotations__",
3889
11
                                  BitXor_annotations) == 0;
3890
11
    if (!cond) {
3891
0
        Py_DECREF(BitXor_annotations);
3892
0
        return 0;
3893
0
    }
3894
11
    Py_DECREF(BitXor_annotations);
3895
11
    PyObject *BitAnd_annotations = PyDict_New();
3896
11
    if (!BitAnd_annotations) return 0;
3897
11
    cond = PyObject_SetAttrString(state->BitAnd_type, "_field_types",
3898
11
                                  BitAnd_annotations) == 0;
3899
11
    if (!cond) {
3900
0
        Py_DECREF(BitAnd_annotations);
3901
0
        return 0;
3902
0
    }
3903
11
    cond = PyObject_SetAttrString(state->BitAnd_type, "__annotations__",
3904
11
                                  BitAnd_annotations) == 0;
3905
11
    if (!cond) {
3906
0
        Py_DECREF(BitAnd_annotations);
3907
0
        return 0;
3908
0
    }
3909
11
    Py_DECREF(BitAnd_annotations);
3910
11
    PyObject *FloorDiv_annotations = PyDict_New();
3911
11
    if (!FloorDiv_annotations) return 0;
3912
11
    cond = PyObject_SetAttrString(state->FloorDiv_type, "_field_types",
3913
11
                                  FloorDiv_annotations) == 0;
3914
11
    if (!cond) {
3915
0
        Py_DECREF(FloorDiv_annotations);
3916
0
        return 0;
3917
0
    }
3918
11
    cond = PyObject_SetAttrString(state->FloorDiv_type, "__annotations__",
3919
11
                                  FloorDiv_annotations) == 0;
3920
11
    if (!cond) {
3921
0
        Py_DECREF(FloorDiv_annotations);
3922
0
        return 0;
3923
0
    }
3924
11
    Py_DECREF(FloorDiv_annotations);
3925
11
    PyObject *Invert_annotations = PyDict_New();
3926
11
    if (!Invert_annotations) return 0;
3927
11
    cond = PyObject_SetAttrString(state->Invert_type, "_field_types",
3928
11
                                  Invert_annotations) == 0;
3929
11
    if (!cond) {
3930
0
        Py_DECREF(Invert_annotations);
3931
0
        return 0;
3932
0
    }
3933
11
    cond = PyObject_SetAttrString(state->Invert_type, "__annotations__",
3934
11
                                  Invert_annotations) == 0;
3935
11
    if (!cond) {
3936
0
        Py_DECREF(Invert_annotations);
3937
0
        return 0;
3938
0
    }
3939
11
    Py_DECREF(Invert_annotations);
3940
11
    PyObject *Not_annotations = PyDict_New();
3941
11
    if (!Not_annotations) return 0;
3942
11
    cond = PyObject_SetAttrString(state->Not_type, "_field_types",
3943
11
                                  Not_annotations) == 0;
3944
11
    if (!cond) {
3945
0
        Py_DECREF(Not_annotations);
3946
0
        return 0;
3947
0
    }
3948
11
    cond = PyObject_SetAttrString(state->Not_type, "__annotations__",
3949
11
                                  Not_annotations) == 0;
3950
11
    if (!cond) {
3951
0
        Py_DECREF(Not_annotations);
3952
0
        return 0;
3953
0
    }
3954
11
    Py_DECREF(Not_annotations);
3955
11
    PyObject *UAdd_annotations = PyDict_New();
3956
11
    if (!UAdd_annotations) return 0;
3957
11
    cond = PyObject_SetAttrString(state->UAdd_type, "_field_types",
3958
11
                                  UAdd_annotations) == 0;
3959
11
    if (!cond) {
3960
0
        Py_DECREF(UAdd_annotations);
3961
0
        return 0;
3962
0
    }
3963
11
    cond = PyObject_SetAttrString(state->UAdd_type, "__annotations__",
3964
11
                                  UAdd_annotations) == 0;
3965
11
    if (!cond) {
3966
0
        Py_DECREF(UAdd_annotations);
3967
0
        return 0;
3968
0
    }
3969
11
    Py_DECREF(UAdd_annotations);
3970
11
    PyObject *USub_annotations = PyDict_New();
3971
11
    if (!USub_annotations) return 0;
3972
11
    cond = PyObject_SetAttrString(state->USub_type, "_field_types",
3973
11
                                  USub_annotations) == 0;
3974
11
    if (!cond) {
3975
0
        Py_DECREF(USub_annotations);
3976
0
        return 0;
3977
0
    }
3978
11
    cond = PyObject_SetAttrString(state->USub_type, "__annotations__",
3979
11
                                  USub_annotations) == 0;
3980
11
    if (!cond) {
3981
0
        Py_DECREF(USub_annotations);
3982
0
        return 0;
3983
0
    }
3984
11
    Py_DECREF(USub_annotations);
3985
11
    PyObject *Eq_annotations = PyDict_New();
3986
11
    if (!Eq_annotations) return 0;
3987
11
    cond = PyObject_SetAttrString(state->Eq_type, "_field_types",
3988
11
                                  Eq_annotations) == 0;
3989
11
    if (!cond) {
3990
0
        Py_DECREF(Eq_annotations);
3991
0
        return 0;
3992
0
    }
3993
11
    cond = PyObject_SetAttrString(state->Eq_type, "__annotations__",
3994
11
                                  Eq_annotations) == 0;
3995
11
    if (!cond) {
3996
0
        Py_DECREF(Eq_annotations);
3997
0
        return 0;
3998
0
    }
3999
11
    Py_DECREF(Eq_annotations);
4000
11
    PyObject *NotEq_annotations = PyDict_New();
4001
11
    if (!NotEq_annotations) return 0;
4002
11
    cond = PyObject_SetAttrString(state->NotEq_type, "_field_types",
4003
11
                                  NotEq_annotations) == 0;
4004
11
    if (!cond) {
4005
0
        Py_DECREF(NotEq_annotations);
4006
0
        return 0;
4007
0
    }
4008
11
    cond = PyObject_SetAttrString(state->NotEq_type, "__annotations__",
4009
11
                                  NotEq_annotations) == 0;
4010
11
    if (!cond) {
4011
0
        Py_DECREF(NotEq_annotations);
4012
0
        return 0;
4013
0
    }
4014
11
    Py_DECREF(NotEq_annotations);
4015
11
    PyObject *Lt_annotations = PyDict_New();
4016
11
    if (!Lt_annotations) return 0;
4017
11
    cond = PyObject_SetAttrString(state->Lt_type, "_field_types",
4018
11
                                  Lt_annotations) == 0;
4019
11
    if (!cond) {
4020
0
        Py_DECREF(Lt_annotations);
4021
0
        return 0;
4022
0
    }
4023
11
    cond = PyObject_SetAttrString(state->Lt_type, "__annotations__",
4024
11
                                  Lt_annotations) == 0;
4025
11
    if (!cond) {
4026
0
        Py_DECREF(Lt_annotations);
4027
0
        return 0;
4028
0
    }
4029
11
    Py_DECREF(Lt_annotations);
4030
11
    PyObject *LtE_annotations = PyDict_New();
4031
11
    if (!LtE_annotations) return 0;
4032
11
    cond = PyObject_SetAttrString(state->LtE_type, "_field_types",
4033
11
                                  LtE_annotations) == 0;
4034
11
    if (!cond) {
4035
0
        Py_DECREF(LtE_annotations);
4036
0
        return 0;
4037
0
    }
4038
11
    cond = PyObject_SetAttrString(state->LtE_type, "__annotations__",
4039
11
                                  LtE_annotations) == 0;
4040
11
    if (!cond) {
4041
0
        Py_DECREF(LtE_annotations);
4042
0
        return 0;
4043
0
    }
4044
11
    Py_DECREF(LtE_annotations);
4045
11
    PyObject *Gt_annotations = PyDict_New();
4046
11
    if (!Gt_annotations) return 0;
4047
11
    cond = PyObject_SetAttrString(state->Gt_type, "_field_types",
4048
11
                                  Gt_annotations) == 0;
4049
11
    if (!cond) {
4050
0
        Py_DECREF(Gt_annotations);
4051
0
        return 0;
4052
0
    }
4053
11
    cond = PyObject_SetAttrString(state->Gt_type, "__annotations__",
4054
11
                                  Gt_annotations) == 0;
4055
11
    if (!cond) {
4056
0
        Py_DECREF(Gt_annotations);
4057
0
        return 0;
4058
0
    }
4059
11
    Py_DECREF(Gt_annotations);
4060
11
    PyObject *GtE_annotations = PyDict_New();
4061
11
    if (!GtE_annotations) return 0;
4062
11
    cond = PyObject_SetAttrString(state->GtE_type, "_field_types",
4063
11
                                  GtE_annotations) == 0;
4064
11
    if (!cond) {
4065
0
        Py_DECREF(GtE_annotations);
4066
0
        return 0;
4067
0
    }
4068
11
    cond = PyObject_SetAttrString(state->GtE_type, "__annotations__",
4069
11
                                  GtE_annotations) == 0;
4070
11
    if (!cond) {
4071
0
        Py_DECREF(GtE_annotations);
4072
0
        return 0;
4073
0
    }
4074
11
    Py_DECREF(GtE_annotations);
4075
11
    PyObject *Is_annotations = PyDict_New();
4076
11
    if (!Is_annotations) return 0;
4077
11
    cond = PyObject_SetAttrString(state->Is_type, "_field_types",
4078
11
                                  Is_annotations) == 0;
4079
11
    if (!cond) {
4080
0
        Py_DECREF(Is_annotations);
4081
0
        return 0;
4082
0
    }
4083
11
    cond = PyObject_SetAttrString(state->Is_type, "__annotations__",
4084
11
                                  Is_annotations) == 0;
4085
11
    if (!cond) {
4086
0
        Py_DECREF(Is_annotations);
4087
0
        return 0;
4088
0
    }
4089
11
    Py_DECREF(Is_annotations);
4090
11
    PyObject *IsNot_annotations = PyDict_New();
4091
11
    if (!IsNot_annotations) return 0;
4092
11
    cond = PyObject_SetAttrString(state->IsNot_type, "_field_types",
4093
11
                                  IsNot_annotations) == 0;
4094
11
    if (!cond) {
4095
0
        Py_DECREF(IsNot_annotations);
4096
0
        return 0;
4097
0
    }
4098
11
    cond = PyObject_SetAttrString(state->IsNot_type, "__annotations__",
4099
11
                                  IsNot_annotations) == 0;
4100
11
    if (!cond) {
4101
0
        Py_DECREF(IsNot_annotations);
4102
0
        return 0;
4103
0
    }
4104
11
    Py_DECREF(IsNot_annotations);
4105
11
    PyObject *In_annotations = PyDict_New();
4106
11
    if (!In_annotations) return 0;
4107
11
    cond = PyObject_SetAttrString(state->In_type, "_field_types",
4108
11
                                  In_annotations) == 0;
4109
11
    if (!cond) {
4110
0
        Py_DECREF(In_annotations);
4111
0
        return 0;
4112
0
    }
4113
11
    cond = PyObject_SetAttrString(state->In_type, "__annotations__",
4114
11
                                  In_annotations) == 0;
4115
11
    if (!cond) {
4116
0
        Py_DECREF(In_annotations);
4117
0
        return 0;
4118
0
    }
4119
11
    Py_DECREF(In_annotations);
4120
11
    PyObject *NotIn_annotations = PyDict_New();
4121
11
    if (!NotIn_annotations) return 0;
4122
11
    cond = PyObject_SetAttrString(state->NotIn_type, "_field_types",
4123
11
                                  NotIn_annotations) == 0;
4124
11
    if (!cond) {
4125
0
        Py_DECREF(NotIn_annotations);
4126
0
        return 0;
4127
0
    }
4128
11
    cond = PyObject_SetAttrString(state->NotIn_type, "__annotations__",
4129
11
                                  NotIn_annotations) == 0;
4130
11
    if (!cond) {
4131
0
        Py_DECREF(NotIn_annotations);
4132
0
        return 0;
4133
0
    }
4134
11
    Py_DECREF(NotIn_annotations);
4135
11
    PyObject *comprehension_annotations = PyDict_New();
4136
11
    if (!comprehension_annotations) return 0;
4137
11
    {
4138
11
        PyObject *type = state->expr_type;
4139
11
        Py_INCREF(type);
4140
11
        cond = PyDict_SetItemString(comprehension_annotations, "target", type)
4141
11
                                    == 0;
4142
11
        Py_DECREF(type);
4143
11
        if (!cond) {
4144
0
            Py_DECREF(comprehension_annotations);
4145
0
            return 0;
4146
0
        }
4147
11
    }
4148
11
    {
4149
11
        PyObject *type = state->expr_type;
4150
11
        Py_INCREF(type);
4151
11
        cond = PyDict_SetItemString(comprehension_annotations, "iter", type) ==
4152
11
                                    0;
4153
11
        Py_DECREF(type);
4154
11
        if (!cond) {
4155
0
            Py_DECREF(comprehension_annotations);
4156
0
            return 0;
4157
0
        }
4158
11
    }
4159
11
    {
4160
11
        PyObject *type = state->expr_type;
4161
11
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
4162
11
        cond = type != NULL;
4163
11
        if (!cond) {
4164
0
            Py_DECREF(comprehension_annotations);
4165
0
            return 0;
4166
0
        }
4167
11
        cond = PyDict_SetItemString(comprehension_annotations, "ifs", type) ==
4168
11
                                    0;
4169
11
        Py_DECREF(type);
4170
11
        if (!cond) {
4171
0
            Py_DECREF(comprehension_annotations);
4172
0
            return 0;
4173
0
        }
4174
11
    }
4175
11
    {
4176
11
        PyObject *type = (PyObject *)&PyLong_Type;
4177
11
        Py_INCREF(type);
4178
11
        cond = PyDict_SetItemString(comprehension_annotations, "is_async",
4179
11
                                    type) == 0;
4180
11
        Py_DECREF(type);
4181
11
        if (!cond) {
4182
0
            Py_DECREF(comprehension_annotations);
4183
0
            return 0;
4184
0
        }
4185
11
    }
4186
11
    cond = PyObject_SetAttrString(state->comprehension_type, "_field_types",
4187
11
                                  comprehension_annotations) == 0;
4188
11
    if (!cond) {
4189
0
        Py_DECREF(comprehension_annotations);
4190
0
        return 0;
4191
0
    }
4192
11
    cond = PyObject_SetAttrString(state->comprehension_type, "__annotations__",
4193
11
                                  comprehension_annotations) == 0;
4194
11
    if (!cond) {
4195
0
        Py_DECREF(comprehension_annotations);
4196
0
        return 0;
4197
0
    }
4198
11
    Py_DECREF(comprehension_annotations);
4199
11
    PyObject *ExceptHandler_annotations = PyDict_New();
4200
11
    if (!ExceptHandler_annotations) return 0;
4201
11
    {
4202
11
        PyObject *type = state->expr_type;
4203
11
        type = _Py_union_type_or(type, Py_None);
4204
11
        cond = type != NULL;
4205
11
        if (!cond) {
4206
0
            Py_DECREF(ExceptHandler_annotations);
4207
0
            return 0;
4208
0
        }
4209
11
        cond = PyDict_SetItemString(ExceptHandler_annotations, "type", type) ==
4210
11
                                    0;
4211
11
        Py_DECREF(type);
4212
11
        if (!cond) {
4213
0
            Py_DECREF(ExceptHandler_annotations);
4214
0
            return 0;
4215
0
        }
4216
11
    }
4217
11
    {
4218
11
        PyObject *type = (PyObject *)&PyUnicode_Type;
4219
11
        type = _Py_union_type_or(type, Py_None);
4220
11
        cond = type != NULL;
4221
11
        if (!cond) {
4222
0
            Py_DECREF(ExceptHandler_annotations);
4223
0
            return 0;
4224
0
        }
4225
11
        cond = PyDict_SetItemString(ExceptHandler_annotations, "name", type) ==
4226
11
                                    0;
4227
11
        Py_DECREF(type);
4228
11
        if (!cond) {
4229
0
            Py_DECREF(ExceptHandler_annotations);
4230
0
            return 0;
4231
0
        }
4232
11
    }
4233
11
    {
4234
11
        PyObject *type = state->stmt_type;
4235
11
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
4236
11
        cond = type != NULL;
4237
11
        if (!cond) {
4238
0
            Py_DECREF(ExceptHandler_annotations);
4239
0
            return 0;
4240
0
        }
4241
11
        cond = PyDict_SetItemString(ExceptHandler_annotations, "body", type) ==
4242
11
                                    0;
4243
11
        Py_DECREF(type);
4244
11
        if (!cond) {
4245
0
            Py_DECREF(ExceptHandler_annotations);
4246
0
            return 0;
4247
0
        }
4248
11
    }
4249
11
    cond = PyObject_SetAttrString(state->ExceptHandler_type, "_field_types",
4250
11
                                  ExceptHandler_annotations) == 0;
4251
11
    if (!cond) {
4252
0
        Py_DECREF(ExceptHandler_annotations);
4253
0
        return 0;
4254
0
    }
4255
11
    cond = PyObject_SetAttrString(state->ExceptHandler_type, "__annotations__",
4256
11
                                  ExceptHandler_annotations) == 0;
4257
11
    if (!cond) {
4258
0
        Py_DECREF(ExceptHandler_annotations);
4259
0
        return 0;
4260
0
    }
4261
11
    Py_DECREF(ExceptHandler_annotations);
4262
11
    PyObject *arguments_annotations = PyDict_New();
4263
11
    if (!arguments_annotations) return 0;
4264
11
    {
4265
11
        PyObject *type = state->arg_type;
4266
11
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
4267
11
        cond = type != NULL;
4268
11
        if (!cond) {
4269
0
            Py_DECREF(arguments_annotations);
4270
0
            return 0;
4271
0
        }
4272
11
        cond = PyDict_SetItemString(arguments_annotations, "posonlyargs", type)
4273
11
                                    == 0;
4274
11
        Py_DECREF(type);
4275
11
        if (!cond) {
4276
0
            Py_DECREF(arguments_annotations);
4277
0
            return 0;
4278
0
        }
4279
11
    }
4280
11
    {
4281
11
        PyObject *type = state->arg_type;
4282
11
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
4283
11
        cond = type != NULL;
4284
11
        if (!cond) {
4285
0
            Py_DECREF(arguments_annotations);
4286
0
            return 0;
4287
0
        }
4288
11
        cond = PyDict_SetItemString(arguments_annotations, "args", type) == 0;
4289
11
        Py_DECREF(type);
4290
11
        if (!cond) {
4291
0
            Py_DECREF(arguments_annotations);
4292
0
            return 0;
4293
0
        }
4294
11
    }
4295
11
    {
4296
11
        PyObject *type = state->arg_type;
4297
11
        type = _Py_union_type_or(type, Py_None);
4298
11
        cond = type != NULL;
4299
11
        if (!cond) {
4300
0
            Py_DECREF(arguments_annotations);
4301
0
            return 0;
4302
0
        }
4303
11
        cond = PyDict_SetItemString(arguments_annotations, "vararg", type) == 0;
4304
11
        Py_DECREF(type);
4305
11
        if (!cond) {
4306
0
            Py_DECREF(arguments_annotations);
4307
0
            return 0;
4308
0
        }
4309
11
    }
4310
11
    {
4311
11
        PyObject *type = state->arg_type;
4312
11
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
4313
11
        cond = type != NULL;
4314
11
        if (!cond) {
4315
0
            Py_DECREF(arguments_annotations);
4316
0
            return 0;
4317
0
        }
4318
11
        cond = PyDict_SetItemString(arguments_annotations, "kwonlyargs", type)
4319
11
                                    == 0;
4320
11
        Py_DECREF(type);
4321
11
        if (!cond) {
4322
0
            Py_DECREF(arguments_annotations);
4323
0
            return 0;
4324
0
        }
4325
11
    }
4326
11
    {
4327
11
        PyObject *type = state->expr_type;
4328
11
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
4329
11
        cond = type != NULL;
4330
11
        if (!cond) {
4331
0
            Py_DECREF(arguments_annotations);
4332
0
            return 0;
4333
0
        }
4334
11
        cond = PyDict_SetItemString(arguments_annotations, "kw_defaults", type)
4335
11
                                    == 0;
4336
11
        Py_DECREF(type);
4337
11
        if (!cond) {
4338
0
            Py_DECREF(arguments_annotations);
4339
0
            return 0;
4340
0
        }
4341
11
    }
4342
11
    {
4343
11
        PyObject *type = state->arg_type;
4344
11
        type = _Py_union_type_or(type, Py_None);
4345
11
        cond = type != NULL;
4346
11
        if (!cond) {
4347
0
            Py_DECREF(arguments_annotations);
4348
0
            return 0;
4349
0
        }
4350
11
        cond = PyDict_SetItemString(arguments_annotations, "kwarg", type) == 0;
4351
11
        Py_DECREF(type);
4352
11
        if (!cond) {
4353
0
            Py_DECREF(arguments_annotations);
4354
0
            return 0;
4355
0
        }
4356
11
    }
4357
11
    {
4358
11
        PyObject *type = state->expr_type;
4359
11
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
4360
11
        cond = type != NULL;
4361
11
        if (!cond) {
4362
0
            Py_DECREF(arguments_annotations);
4363
0
            return 0;
4364
0
        }
4365
11
        cond = PyDict_SetItemString(arguments_annotations, "defaults", type) ==
4366
11
                                    0;
4367
11
        Py_DECREF(type);
4368
11
        if (!cond) {
4369
0
            Py_DECREF(arguments_annotations);
4370
0
            return 0;
4371
0
        }
4372
11
    }
4373
11
    cond = PyObject_SetAttrString(state->arguments_type, "_field_types",
4374
11
                                  arguments_annotations) == 0;
4375
11
    if (!cond) {
4376
0
        Py_DECREF(arguments_annotations);
4377
0
        return 0;
4378
0
    }
4379
11
    cond = PyObject_SetAttrString(state->arguments_type, "__annotations__",
4380
11
                                  arguments_annotations) == 0;
4381
11
    if (!cond) {
4382
0
        Py_DECREF(arguments_annotations);
4383
0
        return 0;
4384
0
    }
4385
11
    Py_DECREF(arguments_annotations);
4386
11
    PyObject *arg_annotations = PyDict_New();
4387
11
    if (!arg_annotations) return 0;
4388
11
    {
4389
11
        PyObject *type = (PyObject *)&PyUnicode_Type;
4390
11
        Py_INCREF(type);
4391
11
        cond = PyDict_SetItemString(arg_annotations, "arg", type) == 0;
4392
11
        Py_DECREF(type);
4393
11
        if (!cond) {
4394
0
            Py_DECREF(arg_annotations);
4395
0
            return 0;
4396
0
        }
4397
11
    }
4398
11
    {
4399
11
        PyObject *type = state->expr_type;
4400
11
        type = _Py_union_type_or(type, Py_None);
4401
11
        cond = type != NULL;
4402
11
        if (!cond) {
4403
0
            Py_DECREF(arg_annotations);
4404
0
            return 0;
4405
0
        }
4406
11
        cond = PyDict_SetItemString(arg_annotations, "annotation", type) == 0;
4407
11
        Py_DECREF(type);
4408
11
        if (!cond) {
4409
0
            Py_DECREF(arg_annotations);
4410
0
            return 0;
4411
0
        }
4412
11
    }
4413
11
    {
4414
11
        PyObject *type = (PyObject *)&PyUnicode_Type;
4415
11
        type = _Py_union_type_or(type, Py_None);
4416
11
        cond = type != NULL;
4417
11
        if (!cond) {
4418
0
            Py_DECREF(arg_annotations);
4419
0
            return 0;
4420
0
        }
4421
11
        cond = PyDict_SetItemString(arg_annotations, "type_comment", type) == 0;
4422
11
        Py_DECREF(type);
4423
11
        if (!cond) {
4424
0
            Py_DECREF(arg_annotations);
4425
0
            return 0;
4426
0
        }
4427
11
    }
4428
11
    cond = PyObject_SetAttrString(state->arg_type, "_field_types",
4429
11
                                  arg_annotations) == 0;
4430
11
    if (!cond) {
4431
0
        Py_DECREF(arg_annotations);
4432
0
        return 0;
4433
0
    }
4434
11
    cond = PyObject_SetAttrString(state->arg_type, "__annotations__",
4435
11
                                  arg_annotations) == 0;
4436
11
    if (!cond) {
4437
0
        Py_DECREF(arg_annotations);
4438
0
        return 0;
4439
0
    }
4440
11
    Py_DECREF(arg_annotations);
4441
11
    PyObject *keyword_annotations = PyDict_New();
4442
11
    if (!keyword_annotations) return 0;
4443
11
    {
4444
11
        PyObject *type = (PyObject *)&PyUnicode_Type;
4445
11
        type = _Py_union_type_or(type, Py_None);
4446
11
        cond = type != NULL;
4447
11
        if (!cond) {
4448
0
            Py_DECREF(keyword_annotations);
4449
0
            return 0;
4450
0
        }
4451
11
        cond = PyDict_SetItemString(keyword_annotations, "arg", type) == 0;
4452
11
        Py_DECREF(type);
4453
11
        if (!cond) {
4454
0
            Py_DECREF(keyword_annotations);
4455
0
            return 0;
4456
0
        }
4457
11
    }
4458
11
    {
4459
11
        PyObject *type = state->expr_type;
4460
11
        Py_INCREF(type);
4461
11
        cond = PyDict_SetItemString(keyword_annotations, "value", type) == 0;
4462
11
        Py_DECREF(type);
4463
11
        if (!cond) {
4464
0
            Py_DECREF(keyword_annotations);
4465
0
            return 0;
4466
0
        }
4467
11
    }
4468
11
    cond = PyObject_SetAttrString(state->keyword_type, "_field_types",
4469
11
                                  keyword_annotations) == 0;
4470
11
    if (!cond) {
4471
0
        Py_DECREF(keyword_annotations);
4472
0
        return 0;
4473
0
    }
4474
11
    cond = PyObject_SetAttrString(state->keyword_type, "__annotations__",
4475
11
                                  keyword_annotations) == 0;
4476
11
    if (!cond) {
4477
0
        Py_DECREF(keyword_annotations);
4478
0
        return 0;
4479
0
    }
4480
11
    Py_DECREF(keyword_annotations);
4481
11
    PyObject *alias_annotations = PyDict_New();
4482
11
    if (!alias_annotations) return 0;
4483
11
    {
4484
11
        PyObject *type = (PyObject *)&PyUnicode_Type;
4485
11
        Py_INCREF(type);
4486
11
        cond = PyDict_SetItemString(alias_annotations, "name", type) == 0;
4487
11
        Py_DECREF(type);
4488
11
        if (!cond) {
4489
0
            Py_DECREF(alias_annotations);
4490
0
            return 0;
4491
0
        }
4492
11
    }
4493
11
    {
4494
11
        PyObject *type = (PyObject *)&PyUnicode_Type;
4495
11
        type = _Py_union_type_or(type, Py_None);
4496
11
        cond = type != NULL;
4497
11
        if (!cond) {
4498
0
            Py_DECREF(alias_annotations);
4499
0
            return 0;
4500
0
        }
4501
11
        cond = PyDict_SetItemString(alias_annotations, "asname", type) == 0;
4502
11
        Py_DECREF(type);
4503
11
        if (!cond) {
4504
0
            Py_DECREF(alias_annotations);
4505
0
            return 0;
4506
0
        }
4507
11
    }
4508
11
    cond = PyObject_SetAttrString(state->alias_type, "_field_types",
4509
11
                                  alias_annotations) == 0;
4510
11
    if (!cond) {
4511
0
        Py_DECREF(alias_annotations);
4512
0
        return 0;
4513
0
    }
4514
11
    cond = PyObject_SetAttrString(state->alias_type, "__annotations__",
4515
11
                                  alias_annotations) == 0;
4516
11
    if (!cond) {
4517
0
        Py_DECREF(alias_annotations);
4518
0
        return 0;
4519
0
    }
4520
11
    Py_DECREF(alias_annotations);
4521
11
    PyObject *withitem_annotations = PyDict_New();
4522
11
    if (!withitem_annotations) return 0;
4523
11
    {
4524
11
        PyObject *type = state->expr_type;
4525
11
        Py_INCREF(type);
4526
11
        cond = PyDict_SetItemString(withitem_annotations, "context_expr", type)
4527
11
                                    == 0;
4528
11
        Py_DECREF(type);
4529
11
        if (!cond) {
4530
0
            Py_DECREF(withitem_annotations);
4531
0
            return 0;
4532
0
        }
4533
11
    }
4534
11
    {
4535
11
        PyObject *type = state->expr_type;
4536
11
        type = _Py_union_type_or(type, Py_None);
4537
11
        cond = type != NULL;
4538
11
        if (!cond) {
4539
0
            Py_DECREF(withitem_annotations);
4540
0
            return 0;
4541
0
        }
4542
11
        cond = PyDict_SetItemString(withitem_annotations, "optional_vars",
4543
11
                                    type) == 0;
4544
11
        Py_DECREF(type);
4545
11
        if (!cond) {
4546
0
            Py_DECREF(withitem_annotations);
4547
0
            return 0;
4548
0
        }
4549
11
    }
4550
11
    cond = PyObject_SetAttrString(state->withitem_type, "_field_types",
4551
11
                                  withitem_annotations) == 0;
4552
11
    if (!cond) {
4553
0
        Py_DECREF(withitem_annotations);
4554
0
        return 0;
4555
0
    }
4556
11
    cond = PyObject_SetAttrString(state->withitem_type, "__annotations__",
4557
11
                                  withitem_annotations) == 0;
4558
11
    if (!cond) {
4559
0
        Py_DECREF(withitem_annotations);
4560
0
        return 0;
4561
0
    }
4562
11
    Py_DECREF(withitem_annotations);
4563
11
    PyObject *match_case_annotations = PyDict_New();
4564
11
    if (!match_case_annotations) return 0;
4565
11
    {
4566
11
        PyObject *type = state->pattern_type;
4567
11
        Py_INCREF(type);
4568
11
        cond = PyDict_SetItemString(match_case_annotations, "pattern", type) ==
4569
11
                                    0;
4570
11
        Py_DECREF(type);
4571
11
        if (!cond) {
4572
0
            Py_DECREF(match_case_annotations);
4573
0
            return 0;
4574
0
        }
4575
11
    }
4576
11
    {
4577
11
        PyObject *type = state->expr_type;
4578
11
        type = _Py_union_type_or(type, Py_None);
4579
11
        cond = type != NULL;
4580
11
        if (!cond) {
4581
0
            Py_DECREF(match_case_annotations);
4582
0
            return 0;
4583
0
        }
4584
11
        cond = PyDict_SetItemString(match_case_annotations, "guard", type) == 0;
4585
11
        Py_DECREF(type);
4586
11
        if (!cond) {
4587
0
            Py_DECREF(match_case_annotations);
4588
0
            return 0;
4589
0
        }
4590
11
    }
4591
11
    {
4592
11
        PyObject *type = state->stmt_type;
4593
11
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
4594
11
        cond = type != NULL;
4595
11
        if (!cond) {
4596
0
            Py_DECREF(match_case_annotations);
4597
0
            return 0;
4598
0
        }
4599
11
        cond = PyDict_SetItemString(match_case_annotations, "body", type) == 0;
4600
11
        Py_DECREF(type);
4601
11
        if (!cond) {
4602
0
            Py_DECREF(match_case_annotations);
4603
0
            return 0;
4604
0
        }
4605
11
    }
4606
11
    cond = PyObject_SetAttrString(state->match_case_type, "_field_types",
4607
11
                                  match_case_annotations) == 0;
4608
11
    if (!cond) {
4609
0
        Py_DECREF(match_case_annotations);
4610
0
        return 0;
4611
0
    }
4612
11
    cond = PyObject_SetAttrString(state->match_case_type, "__annotations__",
4613
11
                                  match_case_annotations) == 0;
4614
11
    if (!cond) {
4615
0
        Py_DECREF(match_case_annotations);
4616
0
        return 0;
4617
0
    }
4618
11
    Py_DECREF(match_case_annotations);
4619
11
    PyObject *MatchValue_annotations = PyDict_New();
4620
11
    if (!MatchValue_annotations) return 0;
4621
11
    {
4622
11
        PyObject *type = state->expr_type;
4623
11
        Py_INCREF(type);
4624
11
        cond = PyDict_SetItemString(MatchValue_annotations, "value", type) == 0;
4625
11
        Py_DECREF(type);
4626
11
        if (!cond) {
4627
0
            Py_DECREF(MatchValue_annotations);
4628
0
            return 0;
4629
0
        }
4630
11
    }
4631
11
    cond = PyObject_SetAttrString(state->MatchValue_type, "_field_types",
4632
11
                                  MatchValue_annotations) == 0;
4633
11
    if (!cond) {
4634
0
        Py_DECREF(MatchValue_annotations);
4635
0
        return 0;
4636
0
    }
4637
11
    cond = PyObject_SetAttrString(state->MatchValue_type, "__annotations__",
4638
11
                                  MatchValue_annotations) == 0;
4639
11
    if (!cond) {
4640
0
        Py_DECREF(MatchValue_annotations);
4641
0
        return 0;
4642
0
    }
4643
11
    Py_DECREF(MatchValue_annotations);
4644
11
    PyObject *MatchSingleton_annotations = PyDict_New();
4645
11
    if (!MatchSingleton_annotations) return 0;
4646
11
    {
4647
11
        PyObject *type = (PyObject *)&PyBaseObject_Type;
4648
11
        Py_INCREF(type);
4649
11
        cond = PyDict_SetItemString(MatchSingleton_annotations, "value", type)
4650
11
                                    == 0;
4651
11
        Py_DECREF(type);
4652
11
        if (!cond) {
4653
0
            Py_DECREF(MatchSingleton_annotations);
4654
0
            return 0;
4655
0
        }
4656
11
    }
4657
11
    cond = PyObject_SetAttrString(state->MatchSingleton_type, "_field_types",
4658
11
                                  MatchSingleton_annotations) == 0;
4659
11
    if (!cond) {
4660
0
        Py_DECREF(MatchSingleton_annotations);
4661
0
        return 0;
4662
0
    }
4663
11
    cond = PyObject_SetAttrString(state->MatchSingleton_type,
4664
11
                                  "__annotations__",
4665
11
                                  MatchSingleton_annotations) == 0;
4666
11
    if (!cond) {
4667
0
        Py_DECREF(MatchSingleton_annotations);
4668
0
        return 0;
4669
0
    }
4670
11
    Py_DECREF(MatchSingleton_annotations);
4671
11
    PyObject *MatchSequence_annotations = PyDict_New();
4672
11
    if (!MatchSequence_annotations) return 0;
4673
11
    {
4674
11
        PyObject *type = state->pattern_type;
4675
11
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
4676
11
        cond = type != NULL;
4677
11
        if (!cond) {
4678
0
            Py_DECREF(MatchSequence_annotations);
4679
0
            return 0;
4680
0
        }
4681
11
        cond = PyDict_SetItemString(MatchSequence_annotations, "patterns",
4682
11
                                    type) == 0;
4683
11
        Py_DECREF(type);
4684
11
        if (!cond) {
4685
0
            Py_DECREF(MatchSequence_annotations);
4686
0
            return 0;
4687
0
        }
4688
11
    }
4689
11
    cond = PyObject_SetAttrString(state->MatchSequence_type, "_field_types",
4690
11
                                  MatchSequence_annotations) == 0;
4691
11
    if (!cond) {
4692
0
        Py_DECREF(MatchSequence_annotations);
4693
0
        return 0;
4694
0
    }
4695
11
    cond = PyObject_SetAttrString(state->MatchSequence_type, "__annotations__",
4696
11
                                  MatchSequence_annotations) == 0;
4697
11
    if (!cond) {
4698
0
        Py_DECREF(MatchSequence_annotations);
4699
0
        return 0;
4700
0
    }
4701
11
    Py_DECREF(MatchSequence_annotations);
4702
11
    PyObject *MatchMapping_annotations = PyDict_New();
4703
11
    if (!MatchMapping_annotations) return 0;
4704
11
    {
4705
11
        PyObject *type = state->expr_type;
4706
11
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
4707
11
        cond = type != NULL;
4708
11
        if (!cond) {
4709
0
            Py_DECREF(MatchMapping_annotations);
4710
0
            return 0;
4711
0
        }
4712
11
        cond = PyDict_SetItemString(MatchMapping_annotations, "keys", type) ==
4713
11
                                    0;
4714
11
        Py_DECREF(type);
4715
11
        if (!cond) {
4716
0
            Py_DECREF(MatchMapping_annotations);
4717
0
            return 0;
4718
0
        }
4719
11
    }
4720
11
    {
4721
11
        PyObject *type = state->pattern_type;
4722
11
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
4723
11
        cond = type != NULL;
4724
11
        if (!cond) {
4725
0
            Py_DECREF(MatchMapping_annotations);
4726
0
            return 0;
4727
0
        }
4728
11
        cond = PyDict_SetItemString(MatchMapping_annotations, "patterns", type)
4729
11
                                    == 0;
4730
11
        Py_DECREF(type);
4731
11
        if (!cond) {
4732
0
            Py_DECREF(MatchMapping_annotations);
4733
0
            return 0;
4734
0
        }
4735
11
    }
4736
11
    {
4737
11
        PyObject *type = (PyObject *)&PyUnicode_Type;
4738
11
        type = _Py_union_type_or(type, Py_None);
4739
11
        cond = type != NULL;
4740
11
        if (!cond) {
4741
0
            Py_DECREF(MatchMapping_annotations);
4742
0
            return 0;
4743
0
        }
4744
11
        cond = PyDict_SetItemString(MatchMapping_annotations, "rest", type) ==
4745
11
                                    0;
4746
11
        Py_DECREF(type);
4747
11
        if (!cond) {
4748
0
            Py_DECREF(MatchMapping_annotations);
4749
0
            return 0;
4750
0
        }
4751
11
    }
4752
11
    cond = PyObject_SetAttrString(state->MatchMapping_type, "_field_types",
4753
11
                                  MatchMapping_annotations) == 0;
4754
11
    if (!cond) {
4755
0
        Py_DECREF(MatchMapping_annotations);
4756
0
        return 0;
4757
0
    }
4758
11
    cond = PyObject_SetAttrString(state->MatchMapping_type, "__annotations__",
4759
11
                                  MatchMapping_annotations) == 0;
4760
11
    if (!cond) {
4761
0
        Py_DECREF(MatchMapping_annotations);
4762
0
        return 0;
4763
0
    }
4764
11
    Py_DECREF(MatchMapping_annotations);
4765
11
    PyObject *MatchClass_annotations = PyDict_New();
4766
11
    if (!MatchClass_annotations) return 0;
4767
11
    {
4768
11
        PyObject *type = state->expr_type;
4769
11
        Py_INCREF(type);
4770
11
        cond = PyDict_SetItemString(MatchClass_annotations, "cls", type) == 0;
4771
11
        Py_DECREF(type);
4772
11
        if (!cond) {
4773
0
            Py_DECREF(MatchClass_annotations);
4774
0
            return 0;
4775
0
        }
4776
11
    }
4777
11
    {
4778
11
        PyObject *type = state->pattern_type;
4779
11
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
4780
11
        cond = type != NULL;
4781
11
        if (!cond) {
4782
0
            Py_DECREF(MatchClass_annotations);
4783
0
            return 0;
4784
0
        }
4785
11
        cond = PyDict_SetItemString(MatchClass_annotations, "patterns", type)
4786
11
                                    == 0;
4787
11
        Py_DECREF(type);
4788
11
        if (!cond) {
4789
0
            Py_DECREF(MatchClass_annotations);
4790
0
            return 0;
4791
0
        }
4792
11
    }
4793
11
    {
4794
11
        PyObject *type = (PyObject *)&PyUnicode_Type;
4795
11
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
4796
11
        cond = type != NULL;
4797
11
        if (!cond) {
4798
0
            Py_DECREF(MatchClass_annotations);
4799
0
            return 0;
4800
0
        }
4801
11
        cond = PyDict_SetItemString(MatchClass_annotations, "kwd_attrs", type)
4802
11
                                    == 0;
4803
11
        Py_DECREF(type);
4804
11
        if (!cond) {
4805
0
            Py_DECREF(MatchClass_annotations);
4806
0
            return 0;
4807
0
        }
4808
11
    }
4809
11
    {
4810
11
        PyObject *type = state->pattern_type;
4811
11
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
4812
11
        cond = type != NULL;
4813
11
        if (!cond) {
4814
0
            Py_DECREF(MatchClass_annotations);
4815
0
            return 0;
4816
0
        }
4817
11
        cond = PyDict_SetItemString(MatchClass_annotations, "kwd_patterns",
4818
11
                                    type) == 0;
4819
11
        Py_DECREF(type);
4820
11
        if (!cond) {
4821
0
            Py_DECREF(MatchClass_annotations);
4822
0
            return 0;
4823
0
        }
4824
11
    }
4825
11
    cond = PyObject_SetAttrString(state->MatchClass_type, "_field_types",
4826
11
                                  MatchClass_annotations) == 0;
4827
11
    if (!cond) {
4828
0
        Py_DECREF(MatchClass_annotations);
4829
0
        return 0;
4830
0
    }
4831
11
    cond = PyObject_SetAttrString(state->MatchClass_type, "__annotations__",
4832
11
                                  MatchClass_annotations) == 0;
4833
11
    if (!cond) {
4834
0
        Py_DECREF(MatchClass_annotations);
4835
0
        return 0;
4836
0
    }
4837
11
    Py_DECREF(MatchClass_annotations);
4838
11
    PyObject *MatchStar_annotations = PyDict_New();
4839
11
    if (!MatchStar_annotations) return 0;
4840
11
    {
4841
11
        PyObject *type = (PyObject *)&PyUnicode_Type;
4842
11
        type = _Py_union_type_or(type, Py_None);
4843
11
        cond = type != NULL;
4844
11
        if (!cond) {
4845
0
            Py_DECREF(MatchStar_annotations);
4846
0
            return 0;
4847
0
        }
4848
11
        cond = PyDict_SetItemString(MatchStar_annotations, "name", type) == 0;
4849
11
        Py_DECREF(type);
4850
11
        if (!cond) {
4851
0
            Py_DECREF(MatchStar_annotations);
4852
0
            return 0;
4853
0
        }
4854
11
    }
4855
11
    cond = PyObject_SetAttrString(state->MatchStar_type, "_field_types",
4856
11
                                  MatchStar_annotations) == 0;
4857
11
    if (!cond) {
4858
0
        Py_DECREF(MatchStar_annotations);
4859
0
        return 0;
4860
0
    }
4861
11
    cond = PyObject_SetAttrString(state->MatchStar_type, "__annotations__",
4862
11
                                  MatchStar_annotations) == 0;
4863
11
    if (!cond) {
4864
0
        Py_DECREF(MatchStar_annotations);
4865
0
        return 0;
4866
0
    }
4867
11
    Py_DECREF(MatchStar_annotations);
4868
11
    PyObject *MatchAs_annotations = PyDict_New();
4869
11
    if (!MatchAs_annotations) return 0;
4870
11
    {
4871
11
        PyObject *type = state->pattern_type;
4872
11
        type = _Py_union_type_or(type, Py_None);
4873
11
        cond = type != NULL;
4874
11
        if (!cond) {
4875
0
            Py_DECREF(MatchAs_annotations);
4876
0
            return 0;
4877
0
        }
4878
11
        cond = PyDict_SetItemString(MatchAs_annotations, "pattern", type) == 0;
4879
11
        Py_DECREF(type);
4880
11
        if (!cond) {
4881
0
            Py_DECREF(MatchAs_annotations);
4882
0
            return 0;
4883
0
        }
4884
11
    }
4885
11
    {
4886
11
        PyObject *type = (PyObject *)&PyUnicode_Type;
4887
11
        type = _Py_union_type_or(type, Py_None);
4888
11
        cond = type != NULL;
4889
11
        if (!cond) {
4890
0
            Py_DECREF(MatchAs_annotations);
4891
0
            return 0;
4892
0
        }
4893
11
        cond = PyDict_SetItemString(MatchAs_annotations, "name", type) == 0;
4894
11
        Py_DECREF(type);
4895
11
        if (!cond) {
4896
0
            Py_DECREF(MatchAs_annotations);
4897
0
            return 0;
4898
0
        }
4899
11
    }
4900
11
    cond = PyObject_SetAttrString(state->MatchAs_type, "_field_types",
4901
11
                                  MatchAs_annotations) == 0;
4902
11
    if (!cond) {
4903
0
        Py_DECREF(MatchAs_annotations);
4904
0
        return 0;
4905
0
    }
4906
11
    cond = PyObject_SetAttrString(state->MatchAs_type, "__annotations__",
4907
11
                                  MatchAs_annotations) == 0;
4908
11
    if (!cond) {
4909
0
        Py_DECREF(MatchAs_annotations);
4910
0
        return 0;
4911
0
    }
4912
11
    Py_DECREF(MatchAs_annotations);
4913
11
    PyObject *MatchOr_annotations = PyDict_New();
4914
11
    if (!MatchOr_annotations) return 0;
4915
11
    {
4916
11
        PyObject *type = state->pattern_type;
4917
11
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
4918
11
        cond = type != NULL;
4919
11
        if (!cond) {
4920
0
            Py_DECREF(MatchOr_annotations);
4921
0
            return 0;
4922
0
        }
4923
11
        cond = PyDict_SetItemString(MatchOr_annotations, "patterns", type) == 0;
4924
11
        Py_DECREF(type);
4925
11
        if (!cond) {
4926
0
            Py_DECREF(MatchOr_annotations);
4927
0
            return 0;
4928
0
        }
4929
11
    }
4930
11
    cond = PyObject_SetAttrString(state->MatchOr_type, "_field_types",
4931
11
                                  MatchOr_annotations) == 0;
4932
11
    if (!cond) {
4933
0
        Py_DECREF(MatchOr_annotations);
4934
0
        return 0;
4935
0
    }
4936
11
    cond = PyObject_SetAttrString(state->MatchOr_type, "__annotations__",
4937
11
                                  MatchOr_annotations) == 0;
4938
11
    if (!cond) {
4939
0
        Py_DECREF(MatchOr_annotations);
4940
0
        return 0;
4941
0
    }
4942
11
    Py_DECREF(MatchOr_annotations);
4943
11
    PyObject *TypeIgnore_annotations = PyDict_New();
4944
11
    if (!TypeIgnore_annotations) return 0;
4945
11
    {
4946
11
        PyObject *type = (PyObject *)&PyLong_Type;
4947
11
        Py_INCREF(type);
4948
11
        cond = PyDict_SetItemString(TypeIgnore_annotations, "lineno", type) ==
4949
11
                                    0;
4950
11
        Py_DECREF(type);
4951
11
        if (!cond) {
4952
0
            Py_DECREF(TypeIgnore_annotations);
4953
0
            return 0;
4954
0
        }
4955
11
    }
4956
11
    {
4957
11
        PyObject *type = (PyObject *)&PyUnicode_Type;
4958
11
        Py_INCREF(type);
4959
11
        cond = PyDict_SetItemString(TypeIgnore_annotations, "tag", type) == 0;
4960
11
        Py_DECREF(type);
4961
11
        if (!cond) {
4962
0
            Py_DECREF(TypeIgnore_annotations);
4963
0
            return 0;
4964
0
        }
4965
11
    }
4966
11
    cond = PyObject_SetAttrString(state->TypeIgnore_type, "_field_types",
4967
11
                                  TypeIgnore_annotations) == 0;
4968
11
    if (!cond) {
4969
0
        Py_DECREF(TypeIgnore_annotations);
4970
0
        return 0;
4971
0
    }
4972
11
    cond = PyObject_SetAttrString(state->TypeIgnore_type, "__annotations__",
4973
11
                                  TypeIgnore_annotations) == 0;
4974
11
    if (!cond) {
4975
0
        Py_DECREF(TypeIgnore_annotations);
4976
0
        return 0;
4977
0
    }
4978
11
    Py_DECREF(TypeIgnore_annotations);
4979
11
    PyObject *TypeVar_annotations = PyDict_New();
4980
11
    if (!TypeVar_annotations) return 0;
4981
11
    {
4982
11
        PyObject *type = (PyObject *)&PyUnicode_Type;
4983
11
        Py_INCREF(type);
4984
11
        cond = PyDict_SetItemString(TypeVar_annotations, "name", type) == 0;
4985
11
        Py_DECREF(type);
4986
11
        if (!cond) {
4987
0
            Py_DECREF(TypeVar_annotations);
4988
0
            return 0;
4989
0
        }
4990
11
    }
4991
11
    {
4992
11
        PyObject *type = state->expr_type;
4993
11
        type = _Py_union_type_or(type, Py_None);
4994
11
        cond = type != NULL;
4995
11
        if (!cond) {
4996
0
            Py_DECREF(TypeVar_annotations);
4997
0
            return 0;
4998
0
        }
4999
11
        cond = PyDict_SetItemString(TypeVar_annotations, "bound", type) == 0;
5000
11
        Py_DECREF(type);
5001
11
        if (!cond) {
5002
0
            Py_DECREF(TypeVar_annotations);
5003
0
            return 0;
5004
0
        }
5005
11
    }
5006
11
    {
5007
11
        PyObject *type = state->expr_type;
5008
11
        type = _Py_union_type_or(type, Py_None);
5009
11
        cond = type != NULL;
5010
11
        if (!cond) {
5011
0
            Py_DECREF(TypeVar_annotations);
5012
0
            return 0;
5013
0
        }
5014
11
        cond = PyDict_SetItemString(TypeVar_annotations, "default_value", type)
5015
11
                                    == 0;
5016
11
        Py_DECREF(type);
5017
11
        if (!cond) {
5018
0
            Py_DECREF(TypeVar_annotations);
5019
0
            return 0;
5020
0
        }
5021
11
    }
5022
11
    cond = PyObject_SetAttrString(state->TypeVar_type, "_field_types",
5023
11
                                  TypeVar_annotations) == 0;
5024
11
    if (!cond) {
5025
0
        Py_DECREF(TypeVar_annotations);
5026
0
        return 0;
5027
0
    }
5028
11
    cond = PyObject_SetAttrString(state->TypeVar_type, "__annotations__",
5029
11
                                  TypeVar_annotations) == 0;
5030
11
    if (!cond) {
5031
0
        Py_DECREF(TypeVar_annotations);
5032
0
        return 0;
5033
0
    }
5034
11
    Py_DECREF(TypeVar_annotations);
5035
11
    PyObject *ParamSpec_annotations = PyDict_New();
5036
11
    if (!ParamSpec_annotations) return 0;
5037
11
    {
5038
11
        PyObject *type = (PyObject *)&PyUnicode_Type;
5039
11
        Py_INCREF(type);
5040
11
        cond = PyDict_SetItemString(ParamSpec_annotations, "name", type) == 0;
5041
11
        Py_DECREF(type);
5042
11
        if (!cond) {
5043
0
            Py_DECREF(ParamSpec_annotations);
5044
0
            return 0;
5045
0
        }
5046
11
    }
5047
11
    {
5048
11
        PyObject *type = state->expr_type;
5049
11
        type = _Py_union_type_or(type, Py_None);
5050
11
        cond = type != NULL;
5051
11
        if (!cond) {
5052
0
            Py_DECREF(ParamSpec_annotations);
5053
0
            return 0;
5054
0
        }
5055
11
        cond = PyDict_SetItemString(ParamSpec_annotations, "default_value",
5056
11
                                    type) == 0;
5057
11
        Py_DECREF(type);
5058
11
        if (!cond) {
5059
0
            Py_DECREF(ParamSpec_annotations);
5060
0
            return 0;
5061
0
        }
5062
11
    }
5063
11
    cond = PyObject_SetAttrString(state->ParamSpec_type, "_field_types",
5064
11
                                  ParamSpec_annotations) == 0;
5065
11
    if (!cond) {
5066
0
        Py_DECREF(ParamSpec_annotations);
5067
0
        return 0;
5068
0
    }
5069
11
    cond = PyObject_SetAttrString(state->ParamSpec_type, "__annotations__",
5070
11
                                  ParamSpec_annotations) == 0;
5071
11
    if (!cond) {
5072
0
        Py_DECREF(ParamSpec_annotations);
5073
0
        return 0;
5074
0
    }
5075
11
    Py_DECREF(ParamSpec_annotations);
5076
11
    PyObject *TypeVarTuple_annotations = PyDict_New();
5077
11
    if (!TypeVarTuple_annotations) return 0;
5078
11
    {
5079
11
        PyObject *type = (PyObject *)&PyUnicode_Type;
5080
11
        Py_INCREF(type);
5081
11
        cond = PyDict_SetItemString(TypeVarTuple_annotations, "name", type) ==
5082
11
                                    0;
5083
11
        Py_DECREF(type);
5084
11
        if (!cond) {
5085
0
            Py_DECREF(TypeVarTuple_annotations);
5086
0
            return 0;
5087
0
        }
5088
11
    }
5089
11
    {
5090
11
        PyObject *type = state->expr_type;
5091
11
        type = _Py_union_type_or(type, Py_None);
5092
11
        cond = type != NULL;
5093
11
        if (!cond) {
5094
0
            Py_DECREF(TypeVarTuple_annotations);
5095
0
            return 0;
5096
0
        }
5097
11
        cond = PyDict_SetItemString(TypeVarTuple_annotations, "default_value",
5098
11
                                    type) == 0;
5099
11
        Py_DECREF(type);
5100
11
        if (!cond) {
5101
0
            Py_DECREF(TypeVarTuple_annotations);
5102
0
            return 0;
5103
0
        }
5104
11
    }
5105
11
    cond = PyObject_SetAttrString(state->TypeVarTuple_type, "_field_types",
5106
11
                                  TypeVarTuple_annotations) == 0;
5107
11
    if (!cond) {
5108
0
        Py_DECREF(TypeVarTuple_annotations);
5109
0
        return 0;
5110
0
    }
5111
11
    cond = PyObject_SetAttrString(state->TypeVarTuple_type, "__annotations__",
5112
11
                                  TypeVarTuple_annotations) == 0;
5113
11
    if (!cond) {
5114
0
        Py_DECREF(TypeVarTuple_annotations);
5115
0
        return 0;
5116
0
    }
5117
11
    Py_DECREF(TypeVarTuple_annotations);
5118
5119
11
    return 1;
5120
11
}
5121
5122
5123
5124
typedef struct {
5125
    PyObject_HEAD
5126
    PyObject *dict;
5127
} AST_object;
5128
5129
static void
5130
ast_dealloc(PyObject *op)
5131
487k
{
5132
487k
    AST_object *self = (AST_object*)op;
5133
    /* bpo-31095: UnTrack is needed before calling any callbacks */
5134
487k
    PyTypeObject *tp = Py_TYPE(self);
5135
487k
    PyObject_GC_UnTrack(self);
5136
487k
    Py_CLEAR(self->dict);
5137
487k
    freefunc free_func = PyType_GetSlot(tp, Py_tp_free);
5138
487k
    assert(free_func != NULL);
5139
487k
    free_func(self);
5140
487k
    Py_DECREF(tp);
5141
487k
}
5142
5143
static int
5144
ast_traverse(PyObject *op, visitproc visit, void *arg)
5145
303k
{
5146
303k
    AST_object *self = (AST_object*)op;
5147
303k
    Py_VISIT(Py_TYPE(self));
5148
303k
    Py_VISIT(self->dict);
5149
303k
    return 0;
5150
303k
}
5151
5152
static int
5153
ast_clear(PyObject *op)
5154
0
{
5155
0
    AST_object *self = (AST_object*)op;
5156
0
    Py_CLEAR(self->dict);
5157
0
    return 0;
5158
0
}
5159
5160
static int
5161
ast_type_init(PyObject *self, PyObject *args, PyObject *kw)
5162
70
{
5163
70
    struct ast_state *state = get_ast_state();
5164
70
    if (state == NULL) {
5165
0
        return -1;
5166
0
    }
5167
5168
70
    Py_ssize_t i, numfields = 0;
5169
70
    int res = -1;
5170
70
    PyObject *key, *value, *fields, *attributes = NULL, *remaining_fields = NULL;
5171
5172
70
    fields = PyObject_GetAttr((PyObject*)Py_TYPE(self), state->_fields);
5173
70
    if (fields == NULL) {
5174
0
        goto cleanup;
5175
0
    }
5176
5177
70
    numfields = PySequence_Size(fields);
5178
70
    if (numfields == -1) {
5179
0
        goto cleanup;
5180
0
    }
5181
70
    remaining_fields = PySet_New(fields);
5182
70
    if (remaining_fields == NULL) {
5183
0
        goto cleanup;
5184
0
    }
5185
5186
70
    res = 0; /* if no error occurs, this stays 0 to the end */
5187
70
    if (numfields < PyTuple_GET_SIZE(args)) {
5188
0
        PyErr_Format(PyExc_TypeError, "%.400s constructor takes at most "
5189
0
                     "%zd positional argument%s",
5190
0
                     _PyType_Name(Py_TYPE(self)),
5191
0
                     numfields, numfields == 1 ? "" : "s");
5192
0
        res = -1;
5193
0
        goto cleanup;
5194
0
    }
5195
70
    for (i = 0; i < PyTuple_GET_SIZE(args); i++) {
5196
        /* cannot be reached when fields is NULL */
5197
0
        PyObject *name = PySequence_GetItem(fields, i);
5198
0
        if (!name) {
5199
0
            res = -1;
5200
0
            goto cleanup;
5201
0
        }
5202
0
        res = PyObject_SetAttr(self, name, PyTuple_GET_ITEM(args, i));
5203
0
        if (PySet_Discard(remaining_fields, name) < 0) {
5204
0
            res = -1;
5205
0
            Py_DECREF(name);
5206
0
            goto cleanup;
5207
0
        }
5208
0
        Py_DECREF(name);
5209
0
        if (res < 0) {
5210
0
            goto cleanup;
5211
0
        }
5212
0
    }
5213
70
    if (kw) {
5214
0
        i = 0;  /* needed by PyDict_Next */
5215
0
        while (PyDict_Next(kw, &i, &key, &value)) {
5216
0
            int contains = PySequence_Contains(fields, key);
5217
0
            if (contains == -1) {
5218
0
                res = -1;
5219
0
                goto cleanup;
5220
0
            }
5221
0
            else if (contains == 1) {
5222
0
                int p = PySet_Discard(remaining_fields, key);
5223
0
                if (p == -1) {
5224
0
                    res = -1;
5225
0
                    goto cleanup;
5226
0
                }
5227
0
                if (p == 0) {
5228
0
                    PyErr_Format(PyExc_TypeError,
5229
0
                        "%.400s got multiple values for argument '%U'",
5230
0
                        Py_TYPE(self)->tp_name, key);
5231
0
                    res = -1;
5232
0
                    goto cleanup;
5233
0
                }
5234
0
            }
5235
0
            else {
5236
                // Lazily initialize "attributes"
5237
0
                if (attributes == NULL) {
5238
0
                    attributes = PyObject_GetAttr((PyObject*)Py_TYPE(self), state->_attributes);
5239
0
                    if (attributes == NULL) {
5240
0
                        res = -1;
5241
0
                        goto cleanup;
5242
0
                    }
5243
0
                }
5244
0
                int contains = PySequence_Contains(attributes, key);
5245
0
                if (contains == -1) {
5246
0
                    res = -1;
5247
0
                    goto cleanup;
5248
0
                }
5249
0
                else if (contains == 0) {
5250
0
                    if (PyErr_WarnFormat(
5251
0
                        PyExc_DeprecationWarning, 1,
5252
0
                        "%.400s.__init__ got an unexpected keyword argument '%U'. "
5253
0
                        "Support for arbitrary keyword arguments is deprecated "
5254
0
                        "and will be removed in Python 3.15.",
5255
0
                        Py_TYPE(self)->tp_name, key
5256
0
                    ) < 0) {
5257
0
                        res = -1;
5258
0
                        goto cleanup;
5259
0
                    }
5260
0
                }
5261
0
            }
5262
0
            res = PyObject_SetAttr(self, key, value);
5263
0
            if (res < 0) {
5264
0
                goto cleanup;
5265
0
            }
5266
0
        }
5267
0
    }
5268
70
    Py_ssize_t size = PySet_Size(remaining_fields);
5269
70
    PyObject *field_types = NULL, *remaining_list = NULL;
5270
70
    if (size > 0) {
5271
0
        if (PyObject_GetOptionalAttr((PyObject*)Py_TYPE(self), &_Py_ID(_field_types),
5272
0
                                     &field_types) < 0) {
5273
0
            res = -1;
5274
0
            goto cleanup;
5275
0
        }
5276
0
        if (field_types == NULL) {
5277
            // Probably a user-defined subclass of AST that lacks _field_types.
5278
            // This will continue to work as it did before 3.13; i.e., attributes
5279
            // that are not passed in simply do not exist on the instance.
5280
0
            goto cleanup;
5281
0
        }
5282
0
        remaining_list = PySequence_List(remaining_fields);
5283
0
        if (!remaining_list) {
5284
0
            goto set_remaining_cleanup;
5285
0
        }
5286
0
        for (Py_ssize_t i = 0; i < size; i++) {
5287
0
            PyObject *name = PyList_GET_ITEM(remaining_list, i);
5288
0
            PyObject *type = PyDict_GetItemWithError(field_types, name);
5289
0
            if (!type) {
5290
0
                if (PyErr_Occurred()) {
5291
0
                    goto set_remaining_cleanup;
5292
0
                }
5293
0
                else {
5294
0
                    if (PyErr_WarnFormat(
5295
0
                        PyExc_DeprecationWarning, 1,
5296
0
                        "Field '%U' is missing from %.400s._field_types. "
5297
0
                        "This will become an error in Python 3.15.",
5298
0
                        name, Py_TYPE(self)->tp_name
5299
0
                    ) < 0) {
5300
0
                        goto set_remaining_cleanup;
5301
0
                    }
5302
0
                }
5303
0
            }
5304
0
            else if (_PyUnion_Check(type)) {
5305
                // optional field
5306
                // do nothing, we'll have set a None default on the class
5307
0
            }
5308
0
            else if (Py_IS_TYPE(type, &Py_GenericAliasType)) {
5309
                // list field
5310
0
                PyObject *empty = PyList_New(0);
5311
0
                if (!empty) {
5312
0
                    goto set_remaining_cleanup;
5313
0
                }
5314
0
                res = PyObject_SetAttr(self, name, empty);
5315
0
                Py_DECREF(empty);
5316
0
                if (res < 0) {
5317
0
                    goto set_remaining_cleanup;
5318
0
                }
5319
0
            }
5320
0
            else if (type == state->expr_context_type) {
5321
                // special case for expr_context: default to Load()
5322
0
                res = PyObject_SetAttr(self, name, state->Load_singleton);
5323
0
                if (res < 0) {
5324
0
                    goto set_remaining_cleanup;
5325
0
                }
5326
0
            }
5327
0
            else {
5328
                // simple field (e.g., identifier)
5329
0
                if (PyErr_WarnFormat(
5330
0
                    PyExc_DeprecationWarning, 1,
5331
0
                    "%.400s.__init__ missing 1 required positional argument: '%U'. "
5332
0
                    "This will become an error in Python 3.15.",
5333
0
                    Py_TYPE(self)->tp_name, name
5334
0
                ) < 0) {
5335
0
                    goto set_remaining_cleanup;
5336
0
                }
5337
0
            }
5338
0
        }
5339
0
        Py_DECREF(remaining_list);
5340
0
        Py_DECREF(field_types);
5341
0
    }
5342
70
  cleanup:
5343
70
    Py_XDECREF(attributes);
5344
70
    Py_XDECREF(fields);
5345
70
    Py_XDECREF(remaining_fields);
5346
70
    return res;
5347
0
  set_remaining_cleanup:
5348
0
    Py_XDECREF(remaining_list);
5349
0
    Py_XDECREF(field_types);
5350
0
    res = -1;
5351
0
    goto cleanup;
5352
70
}
5353
5354
/* Pickling support */
5355
static PyObject *
5356
ast_type_reduce(PyObject *self, PyObject *unused)
5357
0
{
5358
0
    struct ast_state *state = get_ast_state();
5359
0
    if (state == NULL) {
5360
0
        return NULL;
5361
0
    }
5362
5363
0
    PyObject *dict = NULL, *fields = NULL, *positional_args = NULL;
5364
0
    if (PyObject_GetOptionalAttr(self, state->__dict__, &dict) < 0) {
5365
0
        return NULL;
5366
0
    }
5367
0
    PyObject *result = NULL;
5368
0
    if (dict) {
5369
        // Unpickling (or copying) works as follows:
5370
        // - Construct the object with only positional arguments
5371
        // - Set the fields from the dict
5372
        // We have two constraints:
5373
        // - We must set all the required fields in the initial constructor call,
5374
        //   or the unpickling or deepcopying of the object will trigger DeprecationWarnings.
5375
        // - We must not include child nodes in the positional args, because
5376
        //   that may trigger runaway recursion during copying (gh-120108).
5377
        // To satisfy both constraints, we set all the fields to None in the
5378
        // initial list of positional args, and then set the fields from the dict.
5379
0
        if (PyObject_GetOptionalAttr((PyObject*)Py_TYPE(self), state->_fields, &fields) < 0) {
5380
0
            goto cleanup;
5381
0
        }
5382
0
        if (fields) {
5383
0
            Py_ssize_t numfields = PySequence_Size(fields);
5384
0
            if (numfields == -1) {
5385
0
                Py_DECREF(dict);
5386
0
                goto cleanup;
5387
0
            }
5388
0
            positional_args = PyList_New(0);
5389
0
            if (!positional_args) {
5390
0
                goto cleanup;
5391
0
            }
5392
0
            for (Py_ssize_t i = 0; i < numfields; i++) {
5393
0
                PyObject *name = PySequence_GetItem(fields, i);
5394
0
                if (!name) {
5395
0
                    goto cleanup;
5396
0
                }
5397
0
                PyObject *value;
5398
0
                int rc = PyDict_GetItemRef(dict, name, &value);
5399
0
                Py_DECREF(name);
5400
0
                if (rc < 0) {
5401
0
                    goto cleanup;
5402
0
                }
5403
0
                if (!value) {
5404
0
                    break;
5405
0
                }
5406
0
                rc = PyList_Append(positional_args, Py_None);
5407
0
                Py_DECREF(value);
5408
0
                if (rc < 0) {
5409
0
                    goto cleanup;
5410
0
                }
5411
0
            }
5412
0
            PyObject *args_tuple = PyList_AsTuple(positional_args);
5413
0
            if (!args_tuple) {
5414
0
                goto cleanup;
5415
0
            }
5416
0
            result = Py_BuildValue("ONN", Py_TYPE(self), args_tuple, dict);
5417
0
        }
5418
0
        else {
5419
0
            result = Py_BuildValue("O()N", Py_TYPE(self), dict);
5420
0
        }
5421
0
    }
5422
0
    else {
5423
0
        result = Py_BuildValue("O()", Py_TYPE(self));
5424
0
    }
5425
0
cleanup:
5426
0
    Py_XDECREF(fields);
5427
0
    Py_XDECREF(positional_args);
5428
0
    return result;
5429
0
}
5430
5431
/*
5432
 * Perform the following validations:
5433
 *
5434
 *   - All keyword arguments are known 'fields' or 'attributes'.
5435
 *   - No field or attribute would be left unfilled after copy.replace().
5436
 *
5437
 * On success, this returns 1. Otherwise, set a TypeError
5438
 * exception and returns -1 (no exception is set if some
5439
 * other internal errors occur).
5440
 *
5441
 * Parameters
5442
 *
5443
 *      self          The AST node instance.
5444
 *      dict          The AST node instance dictionary (self.__dict__).
5445
 *      fields        The list of fields (self._fields).
5446
 *      attributes    The list of attributes (self._attributes).
5447
 *      kwargs        Keyword arguments passed to ast_type_replace().
5448
 *
5449
 * The 'dict', 'fields', 'attributes' and 'kwargs' arguments can be NULL.
5450
 *
5451
 * Note: this function can be removed in 3.15 since the verification
5452
 *       will be done inside the constructor.
5453
 */
5454
static inline int
5455
ast_type_replace_check(PyObject *self,
5456
                       PyObject *dict,
5457
                       PyObject *fields,
5458
                       PyObject *attributes,
5459
                       PyObject *kwargs)
5460
0
{
5461
    // While it is possible to make some fast paths that would avoid
5462
    // allocating objects on the stack, this would cost us readability.
5463
    // For instance, if 'fields' and 'attributes' are both empty, and
5464
    // 'kwargs' is not empty, we could raise a TypeError immediately.
5465
0
    PyObject *expecting = PySet_New(fields);
5466
0
    if (expecting == NULL) {
5467
0
        return -1;
5468
0
    }
5469
0
    if (attributes) {
5470
0
        if (_PySet_Update(expecting, attributes) < 0) {
5471
0
            Py_DECREF(expecting);
5472
0
            return -1;
5473
0
        }
5474
0
    }
5475
    // Any keyword argument that is neither a field nor attribute is rejected.
5476
    // We first need to check whether a keyword argument is accepted or not.
5477
    // If all keyword arguments are accepted, we compute the required fields
5478
    // and attributes. A field or attribute is not needed if:
5479
    //
5480
    //  1) it is given in 'kwargs', or
5481
    //  2) it already exists on 'self'.
5482
0
    if (kwargs) {
5483
0
        Py_ssize_t pos = 0;
5484
0
        PyObject *key, *value;
5485
0
        while (PyDict_Next(kwargs, &pos, &key, &value)) {
5486
0
            int rc = PySet_Discard(expecting, key);
5487
0
            if (rc < 0) {
5488
0
                Py_DECREF(expecting);
5489
0
                return -1;
5490
0
            }
5491
0
            if (rc == 0) {
5492
0
                PyErr_Format(PyExc_TypeError,
5493
0
                             "%.400s.__replace__ got an unexpected keyword "
5494
0
                             "argument '%U'.", Py_TYPE(self)->tp_name, key);
5495
0
                Py_DECREF(expecting);
5496
0
                return -1;
5497
0
            }
5498
0
        }
5499
0
    }
5500
    // check that the remaining fields or attributes would be filled
5501
0
    if (dict) {
5502
0
        Py_ssize_t pos = 0;
5503
0
        PyObject *key, *value;
5504
0
        while (PyDict_Next(dict, &pos, &key, &value)) {
5505
            // Mark fields or attributes that are found on the instance
5506
            // as non-mandatory. If they are not given in 'kwargs', they
5507
            // will be shallow-coied; otherwise, they would be replaced
5508
            // (not in this function).
5509
0
            if (PySet_Discard(expecting, key) < 0) {
5510
0
                Py_DECREF(expecting);
5511
0
                return -1;
5512
0
            }
5513
0
        }
5514
0
        if (attributes) {
5515
            // Some attributes may or may not be present at runtime.
5516
            // In particular, now that we checked whether 'kwargs'
5517
            // is correct or not, we allow any attribute to be missing.
5518
            //
5519
            // Note that fields must still be entirely determined when
5520
            // calling the constructor later.
5521
0
            PyObject *unused = PyObject_CallMethodOneArg(expecting,
5522
0
                                                         &_Py_ID(difference_update),
5523
0
                                                         attributes);
5524
0
            if (unused == NULL) {
5525
0
                Py_DECREF(expecting);
5526
0
                return -1;
5527
0
            }
5528
0
            Py_DECREF(unused);
5529
0
        }
5530
0
    }
5531
5532
    // Discard fields from 'expecting' that default to None
5533
0
    PyObject *field_types = NULL;
5534
0
    if (PyObject_GetOptionalAttr((PyObject*)Py_TYPE(self),
5535
0
                                 &_Py_ID(_field_types),
5536
0
                                 &field_types) < 0)
5537
0
    {
5538
0
        Py_DECREF(expecting);
5539
0
        return -1;
5540
0
    }
5541
0
    if (field_types != NULL) {
5542
0
        Py_ssize_t pos = 0;
5543
0
        PyObject *field_name, *field_type;
5544
0
        while (PyDict_Next(field_types, &pos, &field_name, &field_type)) {
5545
0
            if (_PyUnion_Check(field_type)) {
5546
                // optional field
5547
0
                if (PySet_Discard(expecting, field_name) < 0) {
5548
0
                    Py_DECREF(expecting);
5549
0
                    Py_DECREF(field_types);
5550
0
                    return -1;
5551
0
                }
5552
0
            }
5553
0
        }
5554
0
        Py_DECREF(field_types);
5555
0
    }
5556
5557
    // Now 'expecting' contains the fields or attributes
5558
    // that would not be filled inside ast_type_replace().
5559
0
    Py_ssize_t m = PySet_GET_SIZE(expecting);
5560
0
    if (m > 0) {
5561
0
        PyObject *names = PyList_New(m);
5562
0
        if (names == NULL) {
5563
0
            Py_DECREF(expecting);
5564
0
            return -1;
5565
0
        }
5566
0
        Py_ssize_t i = 0, pos = 0;
5567
0
        PyObject *item;
5568
0
        Py_hash_t hash;
5569
0
        while (_PySet_NextEntry(expecting, &pos, &item, &hash)) {
5570
0
            PyObject *name = PyObject_Repr(item);
5571
0
            if (name == NULL) {
5572
0
                Py_DECREF(expecting);
5573
0
                Py_DECREF(names);
5574
0
                return -1;
5575
0
            }
5576
            // steal the reference 'name'
5577
0
            PyList_SET_ITEM(names, i++, name);
5578
0
        }
5579
0
        Py_DECREF(expecting);
5580
0
        if (PyList_Sort(names) < 0) {
5581
0
            Py_DECREF(names);
5582
0
            return -1;
5583
0
        }
5584
0
        PyObject *sep = PyUnicode_FromString(", ");
5585
0
        if (sep == NULL) {
5586
0
            Py_DECREF(names);
5587
0
            return -1;
5588
0
        }
5589
0
        PyObject *str_names = PyUnicode_Join(sep, names);
5590
0
        Py_DECREF(sep);
5591
0
        Py_DECREF(names);
5592
0
        if (str_names == NULL) {
5593
0
            return -1;
5594
0
        }
5595
0
        PyErr_Format(PyExc_TypeError,
5596
0
                     "%.400s.__replace__ missing %ld keyword argument%s: %U.",
5597
0
                     Py_TYPE(self)->tp_name, m, m == 1 ? "" : "s", str_names);
5598
0
        Py_DECREF(str_names);
5599
0
        return -1;
5600
0
    }
5601
0
    else {
5602
0
        Py_DECREF(expecting);
5603
0
        return 1;
5604
0
    }
5605
0
}
5606
5607
/*
5608
 * Python equivalent:
5609
 *
5610
 *   for key in keys:
5611
 *       if hasattr(self, key):
5612
 *           payload[key] = getattr(self, key)
5613
 *
5614
 * The 'keys' argument is a sequence corresponding to
5615
 * the '_fields' or the '_attributes' of an AST node.
5616
 *
5617
 * This returns -1 if an error occurs and 0 otherwise.
5618
 *
5619
 * Parameters
5620
 *
5621
 *      payload   A dictionary to fill.
5622
 *      keys      A sequence of keys or NULL for an empty sequence.
5623
 *      dict      The AST node instance dictionary (must not be NULL).
5624
 */
5625
static inline int
5626
ast_type_replace_update_payload(PyObject *payload,
5627
                                PyObject *keys,
5628
                                PyObject *dict)
5629
0
{
5630
0
    assert(dict != NULL);
5631
0
    if (keys == NULL) {
5632
0
        return 0;
5633
0
    }
5634
0
    Py_ssize_t n = PySequence_Size(keys);
5635
0
    if (n == -1) {
5636
0
        return -1;
5637
0
    }
5638
0
    for (Py_ssize_t i = 0; i < n; i++) {
5639
0
        PyObject *key = PySequence_GetItem(keys, i);
5640
0
        if (key == NULL) {
5641
0
            return -1;
5642
0
        }
5643
0
        PyObject *value;
5644
0
        if (PyDict_GetItemRef(dict, key, &value) < 0) {
5645
0
            Py_DECREF(key);
5646
0
            return -1;
5647
0
        }
5648
0
        if (value == NULL) {
5649
0
            Py_DECREF(key);
5650
            // If a field or attribute is not present at runtime, it should
5651
            // be explicitly given in 'kwargs'. If not, the constructor will
5652
            // issue a warning (which becomes an error in 3.15).
5653
0
            continue;
5654
0
        }
5655
0
        int rc = PyDict_SetItem(payload, key, value);
5656
0
        Py_DECREF(key);
5657
0
        Py_DECREF(value);
5658
0
        if (rc < 0) {
5659
0
            return -1;
5660
0
        }
5661
0
    }
5662
0
    return 0;
5663
0
}
5664
5665
/* copy.replace() support (shallow copy) */
5666
static PyObject *
5667
ast_type_replace(PyObject *self, PyObject *args, PyObject *kwargs)
5668
0
{
5669
0
    if (!_PyArg_NoPositional("__replace__", args)) {
5670
0
        return NULL;
5671
0
    }
5672
5673
0
    struct ast_state *state = get_ast_state();
5674
0
    if (state == NULL) {
5675
0
        return NULL;
5676
0
    }
5677
5678
0
    PyObject *result = NULL;
5679
    // known AST class fields and attributes
5680
0
    PyObject *fields = NULL, *attributes = NULL;
5681
    // current instance dictionary
5682
0
    PyObject *dict = NULL;
5683
    // constructor positional and keyword arguments
5684
0
    PyObject *empty_tuple = NULL, *payload = NULL;
5685
5686
0
    PyObject *type = (PyObject *)Py_TYPE(self);
5687
0
    if (PyObject_GetOptionalAttr(type, state->_fields, &fields) < 0) {
5688
0
        goto cleanup;
5689
0
    }
5690
0
    if (PyObject_GetOptionalAttr(type, state->_attributes, &attributes) < 0) {
5691
0
        goto cleanup;
5692
0
    }
5693
0
    if (PyObject_GetOptionalAttr(self, state->__dict__, &dict) < 0) {
5694
0
        goto cleanup;
5695
0
    }
5696
0
    if (ast_type_replace_check(self, dict, fields, attributes, kwargs) < 0) {
5697
0
        goto cleanup;
5698
0
    }
5699
0
    empty_tuple = PyTuple_New(0);
5700
0
    if (empty_tuple == NULL) {
5701
0
        goto cleanup;
5702
0
    }
5703
0
    payload = PyDict_New();
5704
0
    if (payload == NULL) {
5705
0
        goto cleanup;
5706
0
    }
5707
0
    if (dict) { // in case __dict__ is missing (for some obscure reason)
5708
        // copy the instance's fields (possibly NULL)
5709
0
        if (ast_type_replace_update_payload(payload, fields, dict) < 0) {
5710
0
            goto cleanup;
5711
0
        }
5712
        // copy the instance's attributes (possibly NULL)
5713
0
        if (ast_type_replace_update_payload(payload, attributes, dict) < 0) {
5714
0
            goto cleanup;
5715
0
        }
5716
0
    }
5717
0
    if (kwargs && PyDict_Update(payload, kwargs) < 0) {
5718
0
        goto cleanup;
5719
0
    }
5720
0
    result = PyObject_Call(type, empty_tuple, payload);
5721
0
cleanup:
5722
0
    Py_XDECREF(payload);
5723
0
    Py_XDECREF(empty_tuple);
5724
0
    Py_XDECREF(dict);
5725
0
    Py_XDECREF(attributes);
5726
0
    Py_XDECREF(fields);
5727
0
    return result;
5728
0
}
5729
5730
static PyMemberDef ast_type_members[] = {
5731
    {"__dictoffset__", Py_T_PYSSIZET, offsetof(AST_object, dict), Py_READONLY},
5732
    {NULL}  /* Sentinel */
5733
};
5734
5735
static PyMethodDef ast_type_methods[] = {
5736
    {"__reduce__", ast_type_reduce, METH_NOARGS, NULL},
5737
    {"__replace__", _PyCFunction_CAST(ast_type_replace), METH_VARARGS | METH_KEYWORDS,
5738
     PyDoc_STR("__replace__($self, /, **fields)\n--\n\n"
5739
               "Return a copy of the AST node with new values "
5740
               "for the specified fields.")},
5741
    {NULL}
5742
};
5743
5744
static PyGetSetDef ast_type_getsets[] = {
5745
    {"__dict__", PyObject_GenericGetDict, PyObject_GenericSetDict},
5746
    {NULL}
5747
};
5748
5749
static PyObject *
5750
ast_repr_max_depth(AST_object *self, int depth);
5751
5752
/* Format list and tuple properties of AST nodes.
5753
   Note that, only the first and last elements are shown.
5754
   Anything in between is represented with an ellipsis ('...').
5755
   For example, the list [1, 2, 3] is formatted as
5756
   'List(elts=[Constant(1), ..., Constant(3)])'. */
5757
static PyObject *
5758
ast_repr_list(PyObject *list, int depth)
5759
0
{
5760
0
    assert(PyList_Check(list) || PyTuple_Check(list));
5761
5762
0
    struct ast_state *state = get_ast_state();
5763
0
    if (state == NULL) {
5764
0
        return NULL;
5765
0
    }
5766
5767
0
    Py_ssize_t length = PySequence_Size(list);
5768
0
    if (length < 0) {
5769
0
        return NULL;
5770
0
    }
5771
0
    else if (length == 0) {
5772
0
        return PyObject_Repr(list);
5773
0
    }
5774
5775
0
    PyObject *items[2] = {NULL, NULL};
5776
0
    PyUnicodeWriter *writer = PyUnicodeWriter_Create(0);
5777
0
    if (writer == NULL) {
5778
0
        goto error;
5779
0
    }
5780
5781
0
    items[0] = PySequence_GetItem(list, 0);
5782
0
    if (!items[0]) {
5783
0
        goto error;
5784
0
    }
5785
0
    if (length > 1) {
5786
0
        items[1] = PySequence_GetItem(list, length - 1);
5787
0
        if (!items[1]) {
5788
0
            goto error;
5789
0
        }
5790
0
    }
5791
5792
0
    bool is_list = PyList_Check(list);
5793
0
    if (PyUnicodeWriter_WriteChar(writer, is_list ? '[' : '(') < 0) {
5794
0
        goto error;
5795
0
    }
5796
5797
0
    for (Py_ssize_t i = 0; i < Py_MIN(length, 2); i++) {
5798
0
        if (i > 0) {
5799
0
            if (PyUnicodeWriter_WriteASCII(writer, ", ", 2) < 0) {
5800
0
                goto error;
5801
0
            }
5802
0
        }
5803
5804
0
        PyObject *item = items[i];
5805
0
        if (PyType_IsSubtype(Py_TYPE(item), (PyTypeObject *)state->AST_type)) {
5806
0
            PyObject *item_repr;
5807
0
            item_repr = ast_repr_max_depth((AST_object*)item, depth - 1);
5808
0
            if (!item_repr) {
5809
0
                goto error;
5810
0
            }
5811
0
            if (PyUnicodeWriter_WriteStr(writer, item_repr) < 0) {
5812
0
                Py_DECREF(item_repr);
5813
0
                goto error;
5814
0
            }
5815
0
            Py_DECREF(item_repr);
5816
0
        } else {
5817
0
            if (PyUnicodeWriter_WriteRepr(writer, item) < 0) {
5818
0
                goto error;
5819
0
            }
5820
0
        }
5821
5822
0
        if (i == 0 && length > 2) {
5823
0
            if (PyUnicodeWriter_WriteASCII(writer, ", ...", 5) < 0) {
5824
0
                goto error;
5825
0
            }
5826
0
        }
5827
0
    }
5828
5829
0
    if (PyUnicodeWriter_WriteChar(writer, is_list ? ']' : ')') < 0) {
5830
0
        goto error;
5831
0
    }
5832
5833
0
    Py_XDECREF(items[0]);
5834
0
    Py_XDECREF(items[1]);
5835
0
    return PyUnicodeWriter_Finish(writer);
5836
5837
0
error:
5838
0
    Py_XDECREF(items[0]);
5839
0
    Py_XDECREF(items[1]);
5840
0
    PyUnicodeWriter_Discard(writer);
5841
0
    return NULL;
5842
0
}
5843
5844
static PyObject *
5845
ast_repr_max_depth(AST_object *self, int depth)
5846
0
{
5847
0
    struct ast_state *state = get_ast_state();
5848
0
    if (state == NULL) {
5849
0
        return NULL;
5850
0
    }
5851
5852
0
    if (depth <= 0) {
5853
0
        return PyUnicode_FromFormat("%s(...)", Py_TYPE(self)->tp_name);
5854
0
    }
5855
5856
0
    int status = Py_ReprEnter((PyObject *)self);
5857
0
    if (status != 0) {
5858
0
        if (status < 0) {
5859
0
            return NULL;
5860
0
        }
5861
0
        return PyUnicode_FromFormat("%s(...)", Py_TYPE(self)->tp_name);
5862
0
    }
5863
5864
0
    PyObject *fields;
5865
0
    if (PyObject_GetOptionalAttr((PyObject *)Py_TYPE(self), state->_fields, &fields) < 0) {
5866
0
        Py_ReprLeave((PyObject *)self);
5867
0
        return NULL;
5868
0
    }
5869
5870
0
    Py_ssize_t numfields = PySequence_Size(fields);
5871
0
    if (numfields < 0) {
5872
0
        Py_ReprLeave((PyObject *)self);
5873
0
        Py_DECREF(fields);
5874
0
        return NULL;
5875
0
    }
5876
5877
0
    if (numfields == 0) {
5878
0
        Py_ReprLeave((PyObject *)self);
5879
0
        Py_DECREF(fields);
5880
0
        return PyUnicode_FromFormat("%s()", Py_TYPE(self)->tp_name);
5881
0
    }
5882
5883
0
    const char* tp_name = Py_TYPE(self)->tp_name;
5884
0
    PyUnicodeWriter *writer = PyUnicodeWriter_Create(0);
5885
0
    if (writer == NULL) {
5886
0
        goto error;
5887
0
    }
5888
5889
0
    if (PyUnicodeWriter_WriteUTF8(writer, tp_name, -1) < 0) {
5890
0
        goto error;
5891
0
    }
5892
0
    if (PyUnicodeWriter_WriteChar(writer, '(') < 0) {
5893
0
        goto error;
5894
0
    }
5895
5896
0
    for (Py_ssize_t i = 0; i < numfields; i++) {
5897
0
        PyObject *name = PySequence_GetItem(fields, i);
5898
0
        if (!name) {
5899
0
            goto error;
5900
0
        }
5901
5902
0
        PyObject *value = PyObject_GetAttr((PyObject *)self, name);
5903
0
        if (!value) {
5904
0
            Py_DECREF(name);
5905
0
            goto error;
5906
0
        }
5907
5908
0
        PyObject *value_repr;
5909
0
        if (PyList_Check(value) || PyTuple_Check(value)) {
5910
0
            value_repr = ast_repr_list(value, depth);
5911
0
        }
5912
0
        else if (PyType_IsSubtype(Py_TYPE(value), (PyTypeObject *)state->AST_type)) {
5913
0
            value_repr = ast_repr_max_depth((AST_object*)value, depth - 1);
5914
0
        }
5915
0
        else {
5916
0
            value_repr = PyObject_Repr(value);
5917
0
        }
5918
5919
0
        Py_DECREF(value);
5920
5921
0
        if (!value_repr) {
5922
0
            Py_DECREF(name);
5923
0
            goto error;
5924
0
        }
5925
5926
0
        if (i > 0) {
5927
0
            if (PyUnicodeWriter_WriteASCII(writer, ", ", 2) < 0) {
5928
0
                Py_DECREF(name);
5929
0
                Py_DECREF(value_repr);
5930
0
                goto error;
5931
0
            }
5932
0
        }
5933
0
        if (PyUnicodeWriter_WriteStr(writer, name) < 0) {
5934
0
            Py_DECREF(name);
5935
0
            Py_DECREF(value_repr);
5936
0
            goto error;
5937
0
        }
5938
5939
0
        Py_DECREF(name);
5940
5941
0
        if (PyUnicodeWriter_WriteChar(writer, '=') < 0) {
5942
0
            Py_DECREF(value_repr);
5943
0
            goto error;
5944
0
        }
5945
0
        if (PyUnicodeWriter_WriteStr(writer, value_repr) < 0) {
5946
0
            Py_DECREF(value_repr);
5947
0
            goto error;
5948
0
        }
5949
5950
0
        Py_DECREF(value_repr);
5951
0
    }
5952
5953
0
    if (PyUnicodeWriter_WriteChar(writer, ')') < 0) {
5954
0
        goto error;
5955
0
    }
5956
0
    Py_ReprLeave((PyObject *)self);
5957
0
    Py_DECREF(fields);
5958
0
    return PyUnicodeWriter_Finish(writer);
5959
5960
0
error:
5961
0
    Py_ReprLeave((PyObject *)self);
5962
0
    Py_DECREF(fields);
5963
0
    PyUnicodeWriter_Discard(writer);
5964
0
    return NULL;
5965
0
}
5966
5967
static PyObject *
5968
ast_repr(PyObject *self)
5969
0
{
5970
0
    return ast_repr_max_depth((AST_object*)self, 3);
5971
0
}
5972
5973
static PyType_Slot AST_type_slots[] = {
5974
    {Py_tp_dealloc, ast_dealloc},
5975
    {Py_tp_repr, ast_repr},
5976
    {Py_tp_getattro, PyObject_GenericGetAttr},
5977
    {Py_tp_setattro, PyObject_GenericSetAttr},
5978
    {Py_tp_traverse, ast_traverse},
5979
    {Py_tp_clear, ast_clear},
5980
    {Py_tp_members, ast_type_members},
5981
    {Py_tp_methods, ast_type_methods},
5982
    {Py_tp_getset, ast_type_getsets},
5983
    {Py_tp_init, ast_type_init},
5984
    {Py_tp_alloc, PyType_GenericAlloc},
5985
    {Py_tp_new, PyType_GenericNew},
5986
    {Py_tp_free, PyObject_GC_Del},
5987
    {0, 0},
5988
};
5989
5990
static PyType_Spec AST_type_spec = {
5991
    "ast.AST",
5992
    sizeof(AST_object),
5993
    0,
5994
    Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_HAVE_GC,
5995
    AST_type_slots
5996
};
5997
5998
static PyObject *
5999
make_type(struct ast_state *state, const char *type, PyObject* base,
6000
          const char* const* fields, int num_fields, const char *doc)
6001
1.37k
{
6002
1.37k
    PyObject *fnames, *result;
6003
1.37k
    int i;
6004
1.37k
    fnames = PyTuple_New(num_fields);
6005
1.37k
    if (!fnames) return NULL;
6006
3.53k
    for (i = 0; i < num_fields; i++) {
6007
2.15k
        PyObject *field = PyUnicode_InternFromString(fields[i]);
6008
2.15k
        if (!field) {
6009
0
            Py_DECREF(fnames);
6010
0
            return NULL;
6011
0
        }
6012
2.15k
        PyTuple_SET_ITEM(fnames, i, field);
6013
2.15k
    }
6014
1.37k
    result = PyObject_CallFunction((PyObject*)&PyType_Type, "s(O){OOOOOOOs}",
6015
1.37k
                    type, base,
6016
1.37k
                    state->_fields, fnames,
6017
1.37k
                    state->__match_args__, fnames,
6018
1.37k
                    state->__module__,
6019
1.37k
                    state->ast,
6020
1.37k
                    state->__doc__, doc);
6021
1.37k
    Py_DECREF(fnames);
6022
1.37k
    return result;
6023
1.37k
}
6024
6025
static int
6026
add_attributes(struct ast_state *state, PyObject *type, const char * const *attrs, int num_fields)
6027
209
{
6028
209
    int i, result;
6029
209
    PyObject *s, *l = PyTuple_New(num_fields);
6030
209
    if (!l)
6031
0
        return -1;
6032
561
    for (i = 0; i < num_fields; i++) {
6033
352
        s = PyUnicode_InternFromString(attrs[i]);
6034
352
        if (!s) {
6035
0
            Py_DECREF(l);
6036
0
            return -1;
6037
0
        }
6038
352
        PyTuple_SET_ITEM(l, i, s);
6039
352
    }
6040
209
    result = PyObject_SetAttr(type, state->_attributes, l);
6041
209
    Py_DECREF(l);
6042
209
    return result;
6043
209
}
6044
6045
/* Conversion AST -> Python */
6046
6047
static PyObject* ast2obj_list(struct ast_state *state, asdl_seq *seq,
6048
                              PyObject* (*func)(struct ast_state *state, void*))
6049
110k
{
6050
110k
    Py_ssize_t i, n = asdl_seq_LEN(seq);
6051
110k
    PyObject *result = PyList_New(n);
6052
110k
    PyObject *value;
6053
110k
    if (!result)
6054
0
        return NULL;
6055
286k
    for (i = 0; i < n; i++) {
6056
176k
        value = func(state, asdl_seq_GET_UNTYPED(seq, i));
6057
176k
        if (!value) {
6058
0
            Py_DECREF(result);
6059
0
            return NULL;
6060
0
        }
6061
176k
        PyList_SET_ITEM(result, i, value);
6062
176k
    }
6063
110k
    return result;
6064
110k
}
6065
6066
static PyObject* ast2obj_object(struct ast_state *Py_UNUSED(state), void *o)
6067
271k
{
6068
271k
    PyObject *op = (PyObject*)o;
6069
271k
    if (!op) {
6070
95.1k
        op = Py_None;
6071
95.1k
    }
6072
271k
    return Py_NewRef(op);
6073
271k
}
6074
67.8k
#define ast2obj_constant ast2obj_object
6075
120k
#define ast2obj_identifier ast2obj_object
6076
83.6k
#define ast2obj_string ast2obj_object
6077
6078
static PyObject* ast2obj_int(struct ast_state *Py_UNUSED(state), long b)
6079
1.90M
{
6080
1.90M
    return PyLong_FromLong(b);
6081
1.90M
}
6082
6083
/* Conversion Python -> AST */
6084
6085
static int obj2ast_object(struct ast_state *Py_UNUSED(state), PyObject* obj, PyObject** out, PyArena* arena)
6086
0
{
6087
0
    if (obj == Py_None)
6088
0
        obj = NULL;
6089
0
    if (obj) {
6090
0
        if (_PyArena_AddPyObject(arena, obj) < 0) {
6091
0
            *out = NULL;
6092
0
            return -1;
6093
0
        }
6094
0
        *out = Py_NewRef(obj);
6095
0
    }
6096
0
    else {
6097
0
        *out = NULL;
6098
0
    }
6099
0
    return 0;
6100
0
}
6101
6102
static int obj2ast_constant(struct ast_state *Py_UNUSED(state), PyObject* obj, PyObject** out, PyArena* arena)
6103
0
{
6104
0
    if (_PyArena_AddPyObject(arena, obj) < 0) {
6105
0
        *out = NULL;
6106
0
        return -1;
6107
0
    }
6108
0
    *out = Py_NewRef(obj);
6109
0
    return 0;
6110
0
}
6111
6112
static int obj2ast_identifier(struct ast_state *state, PyObject* obj, PyObject** out, PyArena* arena)
6113
0
{
6114
0
    if (!PyUnicode_CheckExact(obj) && obj != Py_None) {
6115
0
        PyErr_SetString(PyExc_TypeError, "AST identifier must be of type str");
6116
0
        return -1;
6117
0
    }
6118
0
    return obj2ast_object(state, obj, out, arena);
6119
0
}
6120
6121
static int obj2ast_string(struct ast_state *state, PyObject* obj, PyObject** out, PyArena* arena)
6122
0
{
6123
0
    if (!PyUnicode_CheckExact(obj) && !PyBytes_CheckExact(obj)) {
6124
0
        PyErr_SetString(PyExc_TypeError, "AST string must be of type str");
6125
0
        return -1;
6126
0
    }
6127
0
    return obj2ast_object(state, obj, out, arena);
6128
0
}
6129
6130
static int obj2ast_int(struct ast_state* Py_UNUSED(state), PyObject* obj, int* out, PyArena* arena)
6131
0
{
6132
0
    int i;
6133
0
    if (!PyLong_Check(obj)) {
6134
0
        PyErr_Format(PyExc_ValueError, "invalid integer value: %R", obj);
6135
0
        return -1;
6136
0
    }
6137
6138
0
    i = PyLong_AsInt(obj);
6139
0
    if (i == -1 && PyErr_Occurred())
6140
0
        return -1;
6141
0
    *out = i;
6142
0
    return 0;
6143
0
}
6144
6145
static int add_ast_fields(struct ast_state *state)
6146
11
{
6147
11
    PyObject *empty_tuple;
6148
11
    empty_tuple = PyTuple_New(0);
6149
11
    if (!empty_tuple ||
6150
11
        PyObject_SetAttrString(state->AST_type, "_fields", empty_tuple) < 0 ||
6151
11
        PyObject_SetAttrString(state->AST_type, "__match_args__", empty_tuple) < 0 ||
6152
11
        PyObject_SetAttrString(state->AST_type, "_attributes", empty_tuple) < 0) {
6153
0
        Py_XDECREF(empty_tuple);
6154
0
        return -1;
6155
0
    }
6156
11
    Py_DECREF(empty_tuple);
6157
11
    return 0;
6158
11
}
6159
6160
6161
6162
static int
6163
init_types(void *arg)
6164
11
{
6165
11
    struct ast_state *state = arg;
6166
11
    if (init_identifiers(state) < 0) {
6167
0
        return -1;
6168
0
    }
6169
11
    state->AST_type = PyType_FromSpec(&AST_type_spec);
6170
11
    if (!state->AST_type) {
6171
0
        return -1;
6172
0
    }
6173
11
    if (add_ast_fields(state) < 0) {
6174
0
        return -1;
6175
0
    }
6176
11
    state->mod_type = make_type(state, "mod", state->AST_type, NULL, 0,
6177
11
        "mod = Module(stmt* body, type_ignore* type_ignores)\n"
6178
11
        "    | Interactive(stmt* body)\n"
6179
11
        "    | Expression(expr body)\n"
6180
11
        "    | FunctionType(expr* argtypes, expr returns)");
6181
11
    if (!state->mod_type) return -1;
6182
11
    if (add_attributes(state, state->mod_type, NULL, 0) < 0) return -1;
6183
11
    state->Module_type = make_type(state, "Module", state->mod_type,
6184
11
                                   Module_fields, 2,
6185
11
        "Module(stmt* body, type_ignore* type_ignores)");
6186
11
    if (!state->Module_type) return -1;
6187
11
    state->Interactive_type = make_type(state, "Interactive", state->mod_type,
6188
11
                                        Interactive_fields, 1,
6189
11
        "Interactive(stmt* body)");
6190
11
    if (!state->Interactive_type) return -1;
6191
11
    state->Expression_type = make_type(state, "Expression", state->mod_type,
6192
11
                                       Expression_fields, 1,
6193
11
        "Expression(expr body)");
6194
11
    if (!state->Expression_type) return -1;
6195
11
    state->FunctionType_type = make_type(state, "FunctionType",
6196
11
                                         state->mod_type, FunctionType_fields,
6197
11
                                         2,
6198
11
        "FunctionType(expr* argtypes, expr returns)");
6199
11
    if (!state->FunctionType_type) return -1;
6200
11
    state->stmt_type = make_type(state, "stmt", state->AST_type, NULL, 0,
6201
11
        "stmt = FunctionDef(identifier name, arguments args, stmt* body, expr* decorator_list, expr? returns, string? type_comment, type_param* type_params)\n"
6202
11
        "     | AsyncFunctionDef(identifier name, arguments args, stmt* body, expr* decorator_list, expr? returns, string? type_comment, type_param* type_params)\n"
6203
11
        "     | ClassDef(identifier name, expr* bases, keyword* keywords, stmt* body, expr* decorator_list, type_param* type_params)\n"
6204
11
        "     | Return(expr? value)\n"
6205
11
        "     | Delete(expr* targets)\n"
6206
11
        "     | Assign(expr* targets, expr value, string? type_comment)\n"
6207
11
        "     | TypeAlias(expr name, type_param* type_params, expr value)\n"
6208
11
        "     | AugAssign(expr target, operator op, expr value)\n"
6209
11
        "     | AnnAssign(expr target, expr annotation, expr? value, int simple)\n"
6210
11
        "     | For(expr target, expr iter, stmt* body, stmt* orelse, string? type_comment)\n"
6211
11
        "     | AsyncFor(expr target, expr iter, stmt* body, stmt* orelse, string? type_comment)\n"
6212
11
        "     | While(expr test, stmt* body, stmt* orelse)\n"
6213
11
        "     | If(expr test, stmt* body, stmt* orelse)\n"
6214
11
        "     | With(withitem* items, stmt* body, string? type_comment)\n"
6215
11
        "     | AsyncWith(withitem* items, stmt* body, string? type_comment)\n"
6216
11
        "     | Match(expr subject, match_case* cases)\n"
6217
11
        "     | Raise(expr? exc, expr? cause)\n"
6218
11
        "     | Try(stmt* body, excepthandler* handlers, stmt* orelse, stmt* finalbody)\n"
6219
11
        "     | TryStar(stmt* body, excepthandler* handlers, stmt* orelse, stmt* finalbody)\n"
6220
11
        "     | Assert(expr test, expr? msg)\n"
6221
11
        "     | Import(alias* names)\n"
6222
11
        "     | ImportFrom(identifier? module, alias* names, int? level)\n"
6223
11
        "     | Global(identifier* names)\n"
6224
11
        "     | Nonlocal(identifier* names)\n"
6225
11
        "     | Expr(expr value)\n"
6226
11
        "     | Pass\n"
6227
11
        "     | Break\n"
6228
11
        "     | Continue");
6229
11
    if (!state->stmt_type) return -1;
6230
11
    if (add_attributes(state, state->stmt_type, stmt_attributes, 4) < 0) return
6231
0
        -1;
6232
11
    if (PyObject_SetAttr(state->stmt_type, state->end_lineno, Py_None) == -1)
6233
0
        return -1;
6234
11
    if (PyObject_SetAttr(state->stmt_type, state->end_col_offset, Py_None) ==
6235
11
        -1)
6236
0
        return -1;
6237
11
    state->FunctionDef_type = make_type(state, "FunctionDef", state->stmt_type,
6238
11
                                        FunctionDef_fields, 7,
6239
11
        "FunctionDef(identifier name, arguments args, stmt* body, expr* decorator_list, expr? returns, string? type_comment, type_param* type_params)");
6240
11
    if (!state->FunctionDef_type) return -1;
6241
11
    if (PyObject_SetAttr(state->FunctionDef_type, state->returns, Py_None) ==
6242
11
        -1)
6243
0
        return -1;
6244
11
    if (PyObject_SetAttr(state->FunctionDef_type, state->type_comment, Py_None)
6245
11
        == -1)
6246
0
        return -1;
6247
11
    state->AsyncFunctionDef_type = make_type(state, "AsyncFunctionDef",
6248
11
                                             state->stmt_type,
6249
11
                                             AsyncFunctionDef_fields, 7,
6250
11
        "AsyncFunctionDef(identifier name, arguments args, stmt* body, expr* decorator_list, expr? returns, string? type_comment, type_param* type_params)");
6251
11
    if (!state->AsyncFunctionDef_type) return -1;
6252
11
    if (PyObject_SetAttr(state->AsyncFunctionDef_type, state->returns, Py_None)
6253
11
        == -1)
6254
0
        return -1;
6255
11
    if (PyObject_SetAttr(state->AsyncFunctionDef_type, state->type_comment,
6256
11
        Py_None) == -1)
6257
0
        return -1;
6258
11
    state->ClassDef_type = make_type(state, "ClassDef", state->stmt_type,
6259
11
                                     ClassDef_fields, 6,
6260
11
        "ClassDef(identifier name, expr* bases, keyword* keywords, stmt* body, expr* decorator_list, type_param* type_params)");
6261
11
    if (!state->ClassDef_type) return -1;
6262
11
    state->Return_type = make_type(state, "Return", state->stmt_type,
6263
11
                                   Return_fields, 1,
6264
11
        "Return(expr? value)");
6265
11
    if (!state->Return_type) return -1;
6266
11
    if (PyObject_SetAttr(state->Return_type, state->value, Py_None) == -1)
6267
0
        return -1;
6268
11
    state->Delete_type = make_type(state, "Delete", state->stmt_type,
6269
11
                                   Delete_fields, 1,
6270
11
        "Delete(expr* targets)");
6271
11
    if (!state->Delete_type) return -1;
6272
11
    state->Assign_type = make_type(state, "Assign", state->stmt_type,
6273
11
                                   Assign_fields, 3,
6274
11
        "Assign(expr* targets, expr value, string? type_comment)");
6275
11
    if (!state->Assign_type) return -1;
6276
11
    if (PyObject_SetAttr(state->Assign_type, state->type_comment, Py_None) ==
6277
11
        -1)
6278
0
        return -1;
6279
11
    state->TypeAlias_type = make_type(state, "TypeAlias", state->stmt_type,
6280
11
                                      TypeAlias_fields, 3,
6281
11
        "TypeAlias(expr name, type_param* type_params, expr value)");
6282
11
    if (!state->TypeAlias_type) return -1;
6283
11
    state->AugAssign_type = make_type(state, "AugAssign", state->stmt_type,
6284
11
                                      AugAssign_fields, 3,
6285
11
        "AugAssign(expr target, operator op, expr value)");
6286
11
    if (!state->AugAssign_type) return -1;
6287
11
    state->AnnAssign_type = make_type(state, "AnnAssign", state->stmt_type,
6288
11
                                      AnnAssign_fields, 4,
6289
11
        "AnnAssign(expr target, expr annotation, expr? value, int simple)");
6290
11
    if (!state->AnnAssign_type) return -1;
6291
11
    if (PyObject_SetAttr(state->AnnAssign_type, state->value, Py_None) == -1)
6292
0
        return -1;
6293
11
    state->For_type = make_type(state, "For", state->stmt_type, For_fields, 5,
6294
11
        "For(expr target, expr iter, stmt* body, stmt* orelse, string? type_comment)");
6295
11
    if (!state->For_type) return -1;
6296
11
    if (PyObject_SetAttr(state->For_type, state->type_comment, Py_None) == -1)
6297
0
        return -1;
6298
11
    state->AsyncFor_type = make_type(state, "AsyncFor", state->stmt_type,
6299
11
                                     AsyncFor_fields, 5,
6300
11
        "AsyncFor(expr target, expr iter, stmt* body, stmt* orelse, string? type_comment)");
6301
11
    if (!state->AsyncFor_type) return -1;
6302
11
    if (PyObject_SetAttr(state->AsyncFor_type, state->type_comment, Py_None) ==
6303
11
        -1)
6304
0
        return -1;
6305
11
    state->While_type = make_type(state, "While", state->stmt_type,
6306
11
                                  While_fields, 3,
6307
11
        "While(expr test, stmt* body, stmt* orelse)");
6308
11
    if (!state->While_type) return -1;
6309
11
    state->If_type = make_type(state, "If", state->stmt_type, If_fields, 3,
6310
11
        "If(expr test, stmt* body, stmt* orelse)");
6311
11
    if (!state->If_type) return -1;
6312
11
    state->With_type = make_type(state, "With", state->stmt_type, With_fields,
6313
11
                                 3,
6314
11
        "With(withitem* items, stmt* body, string? type_comment)");
6315
11
    if (!state->With_type) return -1;
6316
11
    if (PyObject_SetAttr(state->With_type, state->type_comment, Py_None) == -1)
6317
0
        return -1;
6318
11
    state->AsyncWith_type = make_type(state, "AsyncWith", state->stmt_type,
6319
11
                                      AsyncWith_fields, 3,
6320
11
        "AsyncWith(withitem* items, stmt* body, string? type_comment)");
6321
11
    if (!state->AsyncWith_type) return -1;
6322
11
    if (PyObject_SetAttr(state->AsyncWith_type, state->type_comment, Py_None)
6323
11
        == -1)
6324
0
        return -1;
6325
11
    state->Match_type = make_type(state, "Match", state->stmt_type,
6326
11
                                  Match_fields, 2,
6327
11
        "Match(expr subject, match_case* cases)");
6328
11
    if (!state->Match_type) return -1;
6329
11
    state->Raise_type = make_type(state, "Raise", state->stmt_type,
6330
11
                                  Raise_fields, 2,
6331
11
        "Raise(expr? exc, expr? cause)");
6332
11
    if (!state->Raise_type) return -1;
6333
11
    if (PyObject_SetAttr(state->Raise_type, state->exc, Py_None) == -1)
6334
0
        return -1;
6335
11
    if (PyObject_SetAttr(state->Raise_type, state->cause, Py_None) == -1)
6336
0
        return -1;
6337
11
    state->Try_type = make_type(state, "Try", state->stmt_type, Try_fields, 4,
6338
11
        "Try(stmt* body, excepthandler* handlers, stmt* orelse, stmt* finalbody)");
6339
11
    if (!state->Try_type) return -1;
6340
11
    state->TryStar_type = make_type(state, "TryStar", state->stmt_type,
6341
11
                                    TryStar_fields, 4,
6342
11
        "TryStar(stmt* body, excepthandler* handlers, stmt* orelse, stmt* finalbody)");
6343
11
    if (!state->TryStar_type) return -1;
6344
11
    state->Assert_type = make_type(state, "Assert", state->stmt_type,
6345
11
                                   Assert_fields, 2,
6346
11
        "Assert(expr test, expr? msg)");
6347
11
    if (!state->Assert_type) return -1;
6348
11
    if (PyObject_SetAttr(state->Assert_type, state->msg, Py_None) == -1)
6349
0
        return -1;
6350
11
    state->Import_type = make_type(state, "Import", state->stmt_type,
6351
11
                                   Import_fields, 1,
6352
11
        "Import(alias* names)");
6353
11
    if (!state->Import_type) return -1;
6354
11
    state->ImportFrom_type = make_type(state, "ImportFrom", state->stmt_type,
6355
11
                                       ImportFrom_fields, 3,
6356
11
        "ImportFrom(identifier? module, alias* names, int? level)");
6357
11
    if (!state->ImportFrom_type) return -1;
6358
11
    if (PyObject_SetAttr(state->ImportFrom_type, state->module, Py_None) == -1)
6359
0
        return -1;
6360
11
    if (PyObject_SetAttr(state->ImportFrom_type, state->level, Py_None) == -1)
6361
0
        return -1;
6362
11
    state->Global_type = make_type(state, "Global", state->stmt_type,
6363
11
                                   Global_fields, 1,
6364
11
        "Global(identifier* names)");
6365
11
    if (!state->Global_type) return -1;
6366
11
    state->Nonlocal_type = make_type(state, "Nonlocal", state->stmt_type,
6367
11
                                     Nonlocal_fields, 1,
6368
11
        "Nonlocal(identifier* names)");
6369
11
    if (!state->Nonlocal_type) return -1;
6370
11
    state->Expr_type = make_type(state, "Expr", state->stmt_type, Expr_fields,
6371
11
                                 1,
6372
11
        "Expr(expr value)");
6373
11
    if (!state->Expr_type) return -1;
6374
11
    state->Pass_type = make_type(state, "Pass", state->stmt_type, NULL, 0,
6375
11
        "Pass");
6376
11
    if (!state->Pass_type) return -1;
6377
11
    state->Break_type = make_type(state, "Break", state->stmt_type, NULL, 0,
6378
11
        "Break");
6379
11
    if (!state->Break_type) return -1;
6380
11
    state->Continue_type = make_type(state, "Continue", state->stmt_type, NULL,
6381
11
                                     0,
6382
11
        "Continue");
6383
11
    if (!state->Continue_type) return -1;
6384
11
    state->expr_type = make_type(state, "expr", state->AST_type, NULL, 0,
6385
11
        "expr = BoolOp(boolop op, expr* values)\n"
6386
11
        "     | NamedExpr(expr target, expr value)\n"
6387
11
        "     | BinOp(expr left, operator op, expr right)\n"
6388
11
        "     | UnaryOp(unaryop op, expr operand)\n"
6389
11
        "     | Lambda(arguments args, expr body)\n"
6390
11
        "     | IfExp(expr test, expr body, expr orelse)\n"
6391
11
        "     | Dict(expr?* keys, expr* values)\n"
6392
11
        "     | Set(expr* elts)\n"
6393
11
        "     | ListComp(expr elt, comprehension* generators)\n"
6394
11
        "     | SetComp(expr elt, comprehension* generators)\n"
6395
11
        "     | DictComp(expr key, expr value, comprehension* generators)\n"
6396
11
        "     | GeneratorExp(expr elt, comprehension* generators)\n"
6397
11
        "     | Await(expr value)\n"
6398
11
        "     | Yield(expr? value)\n"
6399
11
        "     | YieldFrom(expr value)\n"
6400
11
        "     | Compare(expr left, cmpop* ops, expr* comparators)\n"
6401
11
        "     | Call(expr func, expr* args, keyword* keywords)\n"
6402
11
        "     | FormattedValue(expr value, int conversion, expr? format_spec)\n"
6403
11
        "     | Interpolation(expr value, constant str, int conversion, expr? format_spec)\n"
6404
11
        "     | JoinedStr(expr* values)\n"
6405
11
        "     | TemplateStr(expr* values)\n"
6406
11
        "     | Constant(constant value, string? kind)\n"
6407
11
        "     | Attribute(expr value, identifier attr, expr_context ctx)\n"
6408
11
        "     | Subscript(expr value, expr slice, expr_context ctx)\n"
6409
11
        "     | Starred(expr value, expr_context ctx)\n"
6410
11
        "     | Name(identifier id, expr_context ctx)\n"
6411
11
        "     | List(expr* elts, expr_context ctx)\n"
6412
11
        "     | Tuple(expr* elts, expr_context ctx)\n"
6413
11
        "     | Slice(expr? lower, expr? upper, expr? step)");
6414
11
    if (!state->expr_type) return -1;
6415
11
    if (add_attributes(state, state->expr_type, expr_attributes, 4) < 0) return
6416
0
        -1;
6417
11
    if (PyObject_SetAttr(state->expr_type, state->end_lineno, Py_None) == -1)
6418
0
        return -1;
6419
11
    if (PyObject_SetAttr(state->expr_type, state->end_col_offset, Py_None) ==
6420
11
        -1)
6421
0
        return -1;
6422
11
    state->BoolOp_type = make_type(state, "BoolOp", state->expr_type,
6423
11
                                   BoolOp_fields, 2,
6424
11
        "BoolOp(boolop op, expr* values)");
6425
11
    if (!state->BoolOp_type) return -1;
6426
11
    state->NamedExpr_type = make_type(state, "NamedExpr", state->expr_type,
6427
11
                                      NamedExpr_fields, 2,
6428
11
        "NamedExpr(expr target, expr value)");
6429
11
    if (!state->NamedExpr_type) return -1;
6430
11
    state->BinOp_type = make_type(state, "BinOp", state->expr_type,
6431
11
                                  BinOp_fields, 3,
6432
11
        "BinOp(expr left, operator op, expr right)");
6433
11
    if (!state->BinOp_type) return -1;
6434
11
    state->UnaryOp_type = make_type(state, "UnaryOp", state->expr_type,
6435
11
                                    UnaryOp_fields, 2,
6436
11
        "UnaryOp(unaryop op, expr operand)");
6437
11
    if (!state->UnaryOp_type) return -1;
6438
11
    state->Lambda_type = make_type(state, "Lambda", state->expr_type,
6439
11
                                   Lambda_fields, 2,
6440
11
        "Lambda(arguments args, expr body)");
6441
11
    if (!state->Lambda_type) return -1;
6442
11
    state->IfExp_type = make_type(state, "IfExp", state->expr_type,
6443
11
                                  IfExp_fields, 3,
6444
11
        "IfExp(expr test, expr body, expr orelse)");
6445
11
    if (!state->IfExp_type) return -1;
6446
11
    state->Dict_type = make_type(state, "Dict", state->expr_type, Dict_fields,
6447
11
                                 2,
6448
11
        "Dict(expr?* keys, expr* values)");
6449
11
    if (!state->Dict_type) return -1;
6450
11
    state->Set_type = make_type(state, "Set", state->expr_type, Set_fields, 1,
6451
11
        "Set(expr* elts)");
6452
11
    if (!state->Set_type) return -1;
6453
11
    state->ListComp_type = make_type(state, "ListComp", state->expr_type,
6454
11
                                     ListComp_fields, 2,
6455
11
        "ListComp(expr elt, comprehension* generators)");
6456
11
    if (!state->ListComp_type) return -1;
6457
11
    state->SetComp_type = make_type(state, "SetComp", state->expr_type,
6458
11
                                    SetComp_fields, 2,
6459
11
        "SetComp(expr elt, comprehension* generators)");
6460
11
    if (!state->SetComp_type) return -1;
6461
11
    state->DictComp_type = make_type(state, "DictComp", state->expr_type,
6462
11
                                     DictComp_fields, 3,
6463
11
        "DictComp(expr key, expr value, comprehension* generators)");
6464
11
    if (!state->DictComp_type) return -1;
6465
11
    state->GeneratorExp_type = make_type(state, "GeneratorExp",
6466
11
                                         state->expr_type, GeneratorExp_fields,
6467
11
                                         2,
6468
11
        "GeneratorExp(expr elt, comprehension* generators)");
6469
11
    if (!state->GeneratorExp_type) return -1;
6470
11
    state->Await_type = make_type(state, "Await", state->expr_type,
6471
11
                                  Await_fields, 1,
6472
11
        "Await(expr value)");
6473
11
    if (!state->Await_type) return -1;
6474
11
    state->Yield_type = make_type(state, "Yield", state->expr_type,
6475
11
                                  Yield_fields, 1,
6476
11
        "Yield(expr? value)");
6477
11
    if (!state->Yield_type) return -1;
6478
11
    if (PyObject_SetAttr(state->Yield_type, state->value, Py_None) == -1)
6479
0
        return -1;
6480
11
    state->YieldFrom_type = make_type(state, "YieldFrom", state->expr_type,
6481
11
                                      YieldFrom_fields, 1,
6482
11
        "YieldFrom(expr value)");
6483
11
    if (!state->YieldFrom_type) return -1;
6484
11
    state->Compare_type = make_type(state, "Compare", state->expr_type,
6485
11
                                    Compare_fields, 3,
6486
11
        "Compare(expr left, cmpop* ops, expr* comparators)");
6487
11
    if (!state->Compare_type) return -1;
6488
11
    state->Call_type = make_type(state, "Call", state->expr_type, Call_fields,
6489
11
                                 3,
6490
11
        "Call(expr func, expr* args, keyword* keywords)");
6491
11
    if (!state->Call_type) return -1;
6492
11
    state->FormattedValue_type = make_type(state, "FormattedValue",
6493
11
                                           state->expr_type,
6494
11
                                           FormattedValue_fields, 3,
6495
11
        "FormattedValue(expr value, int conversion, expr? format_spec)");
6496
11
    if (!state->FormattedValue_type) return -1;
6497
11
    if (PyObject_SetAttr(state->FormattedValue_type, state->format_spec,
6498
11
        Py_None) == -1)
6499
0
        return -1;
6500
11
    state->Interpolation_type = make_type(state, "Interpolation",
6501
11
                                          state->expr_type,
6502
11
                                          Interpolation_fields, 4,
6503
11
        "Interpolation(expr value, constant str, int conversion, expr? format_spec)");
6504
11
    if (!state->Interpolation_type) return -1;
6505
11
    if (PyObject_SetAttr(state->Interpolation_type, state->format_spec,
6506
11
        Py_None) == -1)
6507
0
        return -1;
6508
11
    state->JoinedStr_type = make_type(state, "JoinedStr", state->expr_type,
6509
11
                                      JoinedStr_fields, 1,
6510
11
        "JoinedStr(expr* values)");
6511
11
    if (!state->JoinedStr_type) return -1;
6512
11
    state->TemplateStr_type = make_type(state, "TemplateStr", state->expr_type,
6513
11
                                        TemplateStr_fields, 1,
6514
11
        "TemplateStr(expr* values)");
6515
11
    if (!state->TemplateStr_type) return -1;
6516
11
    state->Constant_type = make_type(state, "Constant", state->expr_type,
6517
11
                                     Constant_fields, 2,
6518
11
        "Constant(constant value, string? kind)");
6519
11
    if (!state->Constant_type) return -1;
6520
11
    if (PyObject_SetAttr(state->Constant_type, state->kind, Py_None) == -1)
6521
0
        return -1;
6522
11
    state->Attribute_type = make_type(state, "Attribute", state->expr_type,
6523
11
                                      Attribute_fields, 3,
6524
11
        "Attribute(expr value, identifier attr, expr_context ctx)");
6525
11
    if (!state->Attribute_type) return -1;
6526
11
    state->Subscript_type = make_type(state, "Subscript", state->expr_type,
6527
11
                                      Subscript_fields, 3,
6528
11
        "Subscript(expr value, expr slice, expr_context ctx)");
6529
11
    if (!state->Subscript_type) return -1;
6530
11
    state->Starred_type = make_type(state, "Starred", state->expr_type,
6531
11
                                    Starred_fields, 2,
6532
11
        "Starred(expr value, expr_context ctx)");
6533
11
    if (!state->Starred_type) return -1;
6534
11
    state->Name_type = make_type(state, "Name", state->expr_type, Name_fields,
6535
11
                                 2,
6536
11
        "Name(identifier id, expr_context ctx)");
6537
11
    if (!state->Name_type) return -1;
6538
11
    state->List_type = make_type(state, "List", state->expr_type, List_fields,
6539
11
                                 2,
6540
11
        "List(expr* elts, expr_context ctx)");
6541
11
    if (!state->List_type) return -1;
6542
11
    state->Tuple_type = make_type(state, "Tuple", state->expr_type,
6543
11
                                  Tuple_fields, 2,
6544
11
        "Tuple(expr* elts, expr_context ctx)");
6545
11
    if (!state->Tuple_type) return -1;
6546
11
    state->Slice_type = make_type(state, "Slice", state->expr_type,
6547
11
                                  Slice_fields, 3,
6548
11
        "Slice(expr? lower, expr? upper, expr? step)");
6549
11
    if (!state->Slice_type) return -1;
6550
11
    if (PyObject_SetAttr(state->Slice_type, state->lower, Py_None) == -1)
6551
0
        return -1;
6552
11
    if (PyObject_SetAttr(state->Slice_type, state->upper, Py_None) == -1)
6553
0
        return -1;
6554
11
    if (PyObject_SetAttr(state->Slice_type, state->step, Py_None) == -1)
6555
0
        return -1;
6556
11
    state->expr_context_type = make_type(state, "expr_context",
6557
11
                                         state->AST_type, NULL, 0,
6558
11
        "expr_context = Load | Store | Del");
6559
11
    if (!state->expr_context_type) return -1;
6560
11
    if (add_attributes(state, state->expr_context_type, NULL, 0) < 0) return -1;
6561
11
    state->Load_type = make_type(state, "Load", state->expr_context_type, NULL,
6562
11
                                 0,
6563
11
        "Load");
6564
11
    if (!state->Load_type) return -1;
6565
11
    state->Load_singleton = PyType_GenericNew((PyTypeObject *)state->Load_type,
6566
11
                                              NULL, NULL);
6567
11
    if (!state->Load_singleton) return -1;
6568
11
    state->Store_type = make_type(state, "Store", state->expr_context_type,
6569
11
                                  NULL, 0,
6570
11
        "Store");
6571
11
    if (!state->Store_type) return -1;
6572
11
    state->Store_singleton = PyType_GenericNew((PyTypeObject
6573
11
                                               *)state->Store_type, NULL, NULL);
6574
11
    if (!state->Store_singleton) return -1;
6575
11
    state->Del_type = make_type(state, "Del", state->expr_context_type, NULL, 0,
6576
11
        "Del");
6577
11
    if (!state->Del_type) return -1;
6578
11
    state->Del_singleton = PyType_GenericNew((PyTypeObject *)state->Del_type,
6579
11
                                             NULL, NULL);
6580
11
    if (!state->Del_singleton) return -1;
6581
11
    state->boolop_type = make_type(state, "boolop", state->AST_type, NULL, 0,
6582
11
        "boolop = And | Or");
6583
11
    if (!state->boolop_type) return -1;
6584
11
    if (add_attributes(state, state->boolop_type, NULL, 0) < 0) return -1;
6585
11
    state->And_type = make_type(state, "And", state->boolop_type, NULL, 0,
6586
11
        "And");
6587
11
    if (!state->And_type) return -1;
6588
11
    state->And_singleton = PyType_GenericNew((PyTypeObject *)state->And_type,
6589
11
                                             NULL, NULL);
6590
11
    if (!state->And_singleton) return -1;
6591
11
    state->Or_type = make_type(state, "Or", state->boolop_type, NULL, 0,
6592
11
        "Or");
6593
11
    if (!state->Or_type) return -1;
6594
11
    state->Or_singleton = PyType_GenericNew((PyTypeObject *)state->Or_type,
6595
11
                                            NULL, NULL);
6596
11
    if (!state->Or_singleton) return -1;
6597
11
    state->operator_type = make_type(state, "operator", state->AST_type, NULL,
6598
11
                                     0,
6599
11
        "operator = Add | Sub | Mult | MatMult | Div | Mod | Pow | LShift | RShift | BitOr | BitXor | BitAnd | FloorDiv");
6600
11
    if (!state->operator_type) return -1;
6601
11
    if (add_attributes(state, state->operator_type, NULL, 0) < 0) return -1;
6602
11
    state->Add_type = make_type(state, "Add", state->operator_type, NULL, 0,
6603
11
        "Add");
6604
11
    if (!state->Add_type) return -1;
6605
11
    state->Add_singleton = PyType_GenericNew((PyTypeObject *)state->Add_type,
6606
11
                                             NULL, NULL);
6607
11
    if (!state->Add_singleton) return -1;
6608
11
    state->Sub_type = make_type(state, "Sub", state->operator_type, NULL, 0,
6609
11
        "Sub");
6610
11
    if (!state->Sub_type) return -1;
6611
11
    state->Sub_singleton = PyType_GenericNew((PyTypeObject *)state->Sub_type,
6612
11
                                             NULL, NULL);
6613
11
    if (!state->Sub_singleton) return -1;
6614
11
    state->Mult_type = make_type(state, "Mult", state->operator_type, NULL, 0,
6615
11
        "Mult");
6616
11
    if (!state->Mult_type) return -1;
6617
11
    state->Mult_singleton = PyType_GenericNew((PyTypeObject *)state->Mult_type,
6618
11
                                              NULL, NULL);
6619
11
    if (!state->Mult_singleton) return -1;
6620
11
    state->MatMult_type = make_type(state, "MatMult", state->operator_type,
6621
11
                                    NULL, 0,
6622
11
        "MatMult");
6623
11
    if (!state->MatMult_type) return -1;
6624
11
    state->MatMult_singleton = PyType_GenericNew((PyTypeObject
6625
11
                                                 *)state->MatMult_type, NULL,
6626
11
                                                 NULL);
6627
11
    if (!state->MatMult_singleton) return -1;
6628
11
    state->Div_type = make_type(state, "Div", state->operator_type, NULL, 0,
6629
11
        "Div");
6630
11
    if (!state->Div_type) return -1;
6631
11
    state->Div_singleton = PyType_GenericNew((PyTypeObject *)state->Div_type,
6632
11
                                             NULL, NULL);
6633
11
    if (!state->Div_singleton) return -1;
6634
11
    state->Mod_type = make_type(state, "Mod", state->operator_type, NULL, 0,
6635
11
        "Mod");
6636
11
    if (!state->Mod_type) return -1;
6637
11
    state->Mod_singleton = PyType_GenericNew((PyTypeObject *)state->Mod_type,
6638
11
                                             NULL, NULL);
6639
11
    if (!state->Mod_singleton) return -1;
6640
11
    state->Pow_type = make_type(state, "Pow", state->operator_type, NULL, 0,
6641
11
        "Pow");
6642
11
    if (!state->Pow_type) return -1;
6643
11
    state->Pow_singleton = PyType_GenericNew((PyTypeObject *)state->Pow_type,
6644
11
                                             NULL, NULL);
6645
11
    if (!state->Pow_singleton) return -1;
6646
11
    state->LShift_type = make_type(state, "LShift", state->operator_type, NULL,
6647
11
                                   0,
6648
11
        "LShift");
6649
11
    if (!state->LShift_type) return -1;
6650
11
    state->LShift_singleton = PyType_GenericNew((PyTypeObject
6651
11
                                                *)state->LShift_type, NULL,
6652
11
                                                NULL);
6653
11
    if (!state->LShift_singleton) return -1;
6654
11
    state->RShift_type = make_type(state, "RShift", state->operator_type, NULL,
6655
11
                                   0,
6656
11
        "RShift");
6657
11
    if (!state->RShift_type) return -1;
6658
11
    state->RShift_singleton = PyType_GenericNew((PyTypeObject
6659
11
                                                *)state->RShift_type, NULL,
6660
11
                                                NULL);
6661
11
    if (!state->RShift_singleton) return -1;
6662
11
    state->BitOr_type = make_type(state, "BitOr", state->operator_type, NULL, 0,
6663
11
        "BitOr");
6664
11
    if (!state->BitOr_type) return -1;
6665
11
    state->BitOr_singleton = PyType_GenericNew((PyTypeObject
6666
11
                                               *)state->BitOr_type, NULL, NULL);
6667
11
    if (!state->BitOr_singleton) return -1;
6668
11
    state->BitXor_type = make_type(state, "BitXor", state->operator_type, NULL,
6669
11
                                   0,
6670
11
        "BitXor");
6671
11
    if (!state->BitXor_type) return -1;
6672
11
    state->BitXor_singleton = PyType_GenericNew((PyTypeObject
6673
11
                                                *)state->BitXor_type, NULL,
6674
11
                                                NULL);
6675
11
    if (!state->BitXor_singleton) return -1;
6676
11
    state->BitAnd_type = make_type(state, "BitAnd", state->operator_type, NULL,
6677
11
                                   0,
6678
11
        "BitAnd");
6679
11
    if (!state->BitAnd_type) return -1;
6680
11
    state->BitAnd_singleton = PyType_GenericNew((PyTypeObject
6681
11
                                                *)state->BitAnd_type, NULL,
6682
11
                                                NULL);
6683
11
    if (!state->BitAnd_singleton) return -1;
6684
11
    state->FloorDiv_type = make_type(state, "FloorDiv", state->operator_type,
6685
11
                                     NULL, 0,
6686
11
        "FloorDiv");
6687
11
    if (!state->FloorDiv_type) return -1;
6688
11
    state->FloorDiv_singleton = PyType_GenericNew((PyTypeObject
6689
11
                                                  *)state->FloorDiv_type, NULL,
6690
11
                                                  NULL);
6691
11
    if (!state->FloorDiv_singleton) return -1;
6692
11
    state->unaryop_type = make_type(state, "unaryop", state->AST_type, NULL, 0,
6693
11
        "unaryop = Invert | Not | UAdd | USub");
6694
11
    if (!state->unaryop_type) return -1;
6695
11
    if (add_attributes(state, state->unaryop_type, NULL, 0) < 0) return -1;
6696
11
    state->Invert_type = make_type(state, "Invert", state->unaryop_type, NULL,
6697
11
                                   0,
6698
11
        "Invert");
6699
11
    if (!state->Invert_type) return -1;
6700
11
    state->Invert_singleton = PyType_GenericNew((PyTypeObject
6701
11
                                                *)state->Invert_type, NULL,
6702
11
                                                NULL);
6703
11
    if (!state->Invert_singleton) return -1;
6704
11
    state->Not_type = make_type(state, "Not", state->unaryop_type, NULL, 0,
6705
11
        "Not");
6706
11
    if (!state->Not_type) return -1;
6707
11
    state->Not_singleton = PyType_GenericNew((PyTypeObject *)state->Not_type,
6708
11
                                             NULL, NULL);
6709
11
    if (!state->Not_singleton) return -1;
6710
11
    state->UAdd_type = make_type(state, "UAdd", state->unaryop_type, NULL, 0,
6711
11
        "UAdd");
6712
11
    if (!state->UAdd_type) return -1;
6713
11
    state->UAdd_singleton = PyType_GenericNew((PyTypeObject *)state->UAdd_type,
6714
11
                                              NULL, NULL);
6715
11
    if (!state->UAdd_singleton) return -1;
6716
11
    state->USub_type = make_type(state, "USub", state->unaryop_type, NULL, 0,
6717
11
        "USub");
6718
11
    if (!state->USub_type) return -1;
6719
11
    state->USub_singleton = PyType_GenericNew((PyTypeObject *)state->USub_type,
6720
11
                                              NULL, NULL);
6721
11
    if (!state->USub_singleton) return -1;
6722
11
    state->cmpop_type = make_type(state, "cmpop", state->AST_type, NULL, 0,
6723
11
        "cmpop = Eq | NotEq | Lt | LtE | Gt | GtE | Is | IsNot | In | NotIn");
6724
11
    if (!state->cmpop_type) return -1;
6725
11
    if (add_attributes(state, state->cmpop_type, NULL, 0) < 0) return -1;
6726
11
    state->Eq_type = make_type(state, "Eq", state->cmpop_type, NULL, 0,
6727
11
        "Eq");
6728
11
    if (!state->Eq_type) return -1;
6729
11
    state->Eq_singleton = PyType_GenericNew((PyTypeObject *)state->Eq_type,
6730
11
                                            NULL, NULL);
6731
11
    if (!state->Eq_singleton) return -1;
6732
11
    state->NotEq_type = make_type(state, "NotEq", state->cmpop_type, NULL, 0,
6733
11
        "NotEq");
6734
11
    if (!state->NotEq_type) return -1;
6735
11
    state->NotEq_singleton = PyType_GenericNew((PyTypeObject
6736
11
                                               *)state->NotEq_type, NULL, NULL);
6737
11
    if (!state->NotEq_singleton) return -1;
6738
11
    state->Lt_type = make_type(state, "Lt", state->cmpop_type, NULL, 0,
6739
11
        "Lt");
6740
11
    if (!state->Lt_type) return -1;
6741
11
    state->Lt_singleton = PyType_GenericNew((PyTypeObject *)state->Lt_type,
6742
11
                                            NULL, NULL);
6743
11
    if (!state->Lt_singleton) return -1;
6744
11
    state->LtE_type = make_type(state, "LtE", state->cmpop_type, NULL, 0,
6745
11
        "LtE");
6746
11
    if (!state->LtE_type) return -1;
6747
11
    state->LtE_singleton = PyType_GenericNew((PyTypeObject *)state->LtE_type,
6748
11
                                             NULL, NULL);
6749
11
    if (!state->LtE_singleton) return -1;
6750
11
    state->Gt_type = make_type(state, "Gt", state->cmpop_type, NULL, 0,
6751
11
        "Gt");
6752
11
    if (!state->Gt_type) return -1;
6753
11
    state->Gt_singleton = PyType_GenericNew((PyTypeObject *)state->Gt_type,
6754
11
                                            NULL, NULL);
6755
11
    if (!state->Gt_singleton) return -1;
6756
11
    state->GtE_type = make_type(state, "GtE", state->cmpop_type, NULL, 0,
6757
11
        "GtE");
6758
11
    if (!state->GtE_type) return -1;
6759
11
    state->GtE_singleton = PyType_GenericNew((PyTypeObject *)state->GtE_type,
6760
11
                                             NULL, NULL);
6761
11
    if (!state->GtE_singleton) return -1;
6762
11
    state->Is_type = make_type(state, "Is", state->cmpop_type, NULL, 0,
6763
11
        "Is");
6764
11
    if (!state->Is_type) return -1;
6765
11
    state->Is_singleton = PyType_GenericNew((PyTypeObject *)state->Is_type,
6766
11
                                            NULL, NULL);
6767
11
    if (!state->Is_singleton) return -1;
6768
11
    state->IsNot_type = make_type(state, "IsNot", state->cmpop_type, NULL, 0,
6769
11
        "IsNot");
6770
11
    if (!state->IsNot_type) return -1;
6771
11
    state->IsNot_singleton = PyType_GenericNew((PyTypeObject
6772
11
                                               *)state->IsNot_type, NULL, NULL);
6773
11
    if (!state->IsNot_singleton) return -1;
6774
11
    state->In_type = make_type(state, "In", state->cmpop_type, NULL, 0,
6775
11
        "In");
6776
11
    if (!state->In_type) return -1;
6777
11
    state->In_singleton = PyType_GenericNew((PyTypeObject *)state->In_type,
6778
11
                                            NULL, NULL);
6779
11
    if (!state->In_singleton) return -1;
6780
11
    state->NotIn_type = make_type(state, "NotIn", state->cmpop_type, NULL, 0,
6781
11
        "NotIn");
6782
11
    if (!state->NotIn_type) return -1;
6783
11
    state->NotIn_singleton = PyType_GenericNew((PyTypeObject
6784
11
                                               *)state->NotIn_type, NULL, NULL);
6785
11
    if (!state->NotIn_singleton) return -1;
6786
11
    state->comprehension_type = make_type(state, "comprehension",
6787
11
                                          state->AST_type,
6788
11
                                          comprehension_fields, 4,
6789
11
        "comprehension(expr target, expr iter, expr* ifs, int is_async)");
6790
11
    if (!state->comprehension_type) return -1;
6791
11
    if (add_attributes(state, state->comprehension_type, NULL, 0) < 0) return
6792
0
        -1;
6793
11
    state->excepthandler_type = make_type(state, "excepthandler",
6794
11
                                          state->AST_type, NULL, 0,
6795
11
        "excepthandler = ExceptHandler(expr? type, identifier? name, stmt* body)");
6796
11
    if (!state->excepthandler_type) return -1;
6797
11
    if (add_attributes(state, state->excepthandler_type,
6798
11
        excepthandler_attributes, 4) < 0) return -1;
6799
11
    if (PyObject_SetAttr(state->excepthandler_type, state->end_lineno, Py_None)
6800
11
        == -1)
6801
0
        return -1;
6802
11
    if (PyObject_SetAttr(state->excepthandler_type, state->end_col_offset,
6803
11
        Py_None) == -1)
6804
0
        return -1;
6805
11
    state->ExceptHandler_type = make_type(state, "ExceptHandler",
6806
11
                                          state->excepthandler_type,
6807
11
                                          ExceptHandler_fields, 3,
6808
11
        "ExceptHandler(expr? type, identifier? name, stmt* body)");
6809
11
    if (!state->ExceptHandler_type) return -1;
6810
11
    if (PyObject_SetAttr(state->ExceptHandler_type, state->type, Py_None) == -1)
6811
0
        return -1;
6812
11
    if (PyObject_SetAttr(state->ExceptHandler_type, state->name, Py_None) == -1)
6813
0
        return -1;
6814
11
    state->arguments_type = make_type(state, "arguments", state->AST_type,
6815
11
                                      arguments_fields, 7,
6816
11
        "arguments(arg* posonlyargs, arg* args, arg? vararg, arg* kwonlyargs, expr* kw_defaults, arg? kwarg, expr* defaults)");
6817
11
    if (!state->arguments_type) return -1;
6818
11
    if (add_attributes(state, state->arguments_type, NULL, 0) < 0) return -1;
6819
11
    if (PyObject_SetAttr(state->arguments_type, state->vararg, Py_None) == -1)
6820
0
        return -1;
6821
11
    if (PyObject_SetAttr(state->arguments_type, state->kwarg, Py_None) == -1)
6822
0
        return -1;
6823
11
    state->arg_type = make_type(state, "arg", state->AST_type, arg_fields, 3,
6824
11
        "arg(identifier arg, expr? annotation, string? type_comment)");
6825
11
    if (!state->arg_type) return -1;
6826
11
    if (add_attributes(state, state->arg_type, arg_attributes, 4) < 0) return
6827
0
        -1;
6828
11
    if (PyObject_SetAttr(state->arg_type, state->annotation, Py_None) == -1)
6829
0
        return -1;
6830
11
    if (PyObject_SetAttr(state->arg_type, state->type_comment, Py_None) == -1)
6831
0
        return -1;
6832
11
    if (PyObject_SetAttr(state->arg_type, state->end_lineno, Py_None) == -1)
6833
0
        return -1;
6834
11
    if (PyObject_SetAttr(state->arg_type, state->end_col_offset, Py_None) == -1)
6835
0
        return -1;
6836
11
    state->keyword_type = make_type(state, "keyword", state->AST_type,
6837
11
                                    keyword_fields, 2,
6838
11
        "keyword(identifier? arg, expr value)");
6839
11
    if (!state->keyword_type) return -1;
6840
11
    if (add_attributes(state, state->keyword_type, keyword_attributes, 4) < 0)
6841
0
        return -1;
6842
11
    if (PyObject_SetAttr(state->keyword_type, state->arg, Py_None) == -1)
6843
0
        return -1;
6844
11
    if (PyObject_SetAttr(state->keyword_type, state->end_lineno, Py_None) == -1)
6845
0
        return -1;
6846
11
    if (PyObject_SetAttr(state->keyword_type, state->end_col_offset, Py_None)
6847
11
        == -1)
6848
0
        return -1;
6849
11
    state->alias_type = make_type(state, "alias", state->AST_type,
6850
11
                                  alias_fields, 2,
6851
11
        "alias(identifier name, identifier? asname)");
6852
11
    if (!state->alias_type) return -1;
6853
11
    if (add_attributes(state, state->alias_type, alias_attributes, 4) < 0)
6854
0
        return -1;
6855
11
    if (PyObject_SetAttr(state->alias_type, state->asname, Py_None) == -1)
6856
0
        return -1;
6857
11
    if (PyObject_SetAttr(state->alias_type, state->end_lineno, Py_None) == -1)
6858
0
        return -1;
6859
11
    if (PyObject_SetAttr(state->alias_type, state->end_col_offset, Py_None) ==
6860
11
        -1)
6861
0
        return -1;
6862
11
    state->withitem_type = make_type(state, "withitem", state->AST_type,
6863
11
                                     withitem_fields, 2,
6864
11
        "withitem(expr context_expr, expr? optional_vars)");
6865
11
    if (!state->withitem_type) return -1;
6866
11
    if (add_attributes(state, state->withitem_type, NULL, 0) < 0) return -1;
6867
11
    if (PyObject_SetAttr(state->withitem_type, state->optional_vars, Py_None)
6868
11
        == -1)
6869
0
        return -1;
6870
11
    state->match_case_type = make_type(state, "match_case", state->AST_type,
6871
11
                                       match_case_fields, 3,
6872
11
        "match_case(pattern pattern, expr? guard, stmt* body)");
6873
11
    if (!state->match_case_type) return -1;
6874
11
    if (add_attributes(state, state->match_case_type, NULL, 0) < 0) return -1;
6875
11
    if (PyObject_SetAttr(state->match_case_type, state->guard, Py_None) == -1)
6876
0
        return -1;
6877
11
    state->pattern_type = make_type(state, "pattern", state->AST_type, NULL, 0,
6878
11
        "pattern = MatchValue(expr value)\n"
6879
11
        "        | MatchSingleton(constant value)\n"
6880
11
        "        | MatchSequence(pattern* patterns)\n"
6881
11
        "        | MatchMapping(expr* keys, pattern* patterns, identifier? rest)\n"
6882
11
        "        | MatchClass(expr cls, pattern* patterns, identifier* kwd_attrs, pattern* kwd_patterns)\n"
6883
11
        "        | MatchStar(identifier? name)\n"
6884
11
        "        | MatchAs(pattern? pattern, identifier? name)\n"
6885
11
        "        | MatchOr(pattern* patterns)");
6886
11
    if (!state->pattern_type) return -1;
6887
11
    if (add_attributes(state, state->pattern_type, pattern_attributes, 4) < 0)
6888
0
        return -1;
6889
11
    state->MatchValue_type = make_type(state, "MatchValue",
6890
11
                                       state->pattern_type, MatchValue_fields,
6891
11
                                       1,
6892
11
        "MatchValue(expr value)");
6893
11
    if (!state->MatchValue_type) return -1;
6894
11
    state->MatchSingleton_type = make_type(state, "MatchSingleton",
6895
11
                                           state->pattern_type,
6896
11
                                           MatchSingleton_fields, 1,
6897
11
        "MatchSingleton(constant value)");
6898
11
    if (!state->MatchSingleton_type) return -1;
6899
11
    state->MatchSequence_type = make_type(state, "MatchSequence",
6900
11
                                          state->pattern_type,
6901
11
                                          MatchSequence_fields, 1,
6902
11
        "MatchSequence(pattern* patterns)");
6903
11
    if (!state->MatchSequence_type) return -1;
6904
11
    state->MatchMapping_type = make_type(state, "MatchMapping",
6905
11
                                         state->pattern_type,
6906
11
                                         MatchMapping_fields, 3,
6907
11
        "MatchMapping(expr* keys, pattern* patterns, identifier? rest)");
6908
11
    if (!state->MatchMapping_type) return -1;
6909
11
    if (PyObject_SetAttr(state->MatchMapping_type, state->rest, Py_None) == -1)
6910
0
        return -1;
6911
11
    state->MatchClass_type = make_type(state, "MatchClass",
6912
11
                                       state->pattern_type, MatchClass_fields,
6913
11
                                       4,
6914
11
        "MatchClass(expr cls, pattern* patterns, identifier* kwd_attrs, pattern* kwd_patterns)");
6915
11
    if (!state->MatchClass_type) return -1;
6916
11
    state->MatchStar_type = make_type(state, "MatchStar", state->pattern_type,
6917
11
                                      MatchStar_fields, 1,
6918
11
        "MatchStar(identifier? name)");
6919
11
    if (!state->MatchStar_type) return -1;
6920
11
    if (PyObject_SetAttr(state->MatchStar_type, state->name, Py_None) == -1)
6921
0
        return -1;
6922
11
    state->MatchAs_type = make_type(state, "MatchAs", state->pattern_type,
6923
11
                                    MatchAs_fields, 2,
6924
11
        "MatchAs(pattern? pattern, identifier? name)");
6925
11
    if (!state->MatchAs_type) return -1;
6926
11
    if (PyObject_SetAttr(state->MatchAs_type, state->pattern, Py_None) == -1)
6927
0
        return -1;
6928
11
    if (PyObject_SetAttr(state->MatchAs_type, state->name, Py_None) == -1)
6929
0
        return -1;
6930
11
    state->MatchOr_type = make_type(state, "MatchOr", state->pattern_type,
6931
11
                                    MatchOr_fields, 1,
6932
11
        "MatchOr(pattern* patterns)");
6933
11
    if (!state->MatchOr_type) return -1;
6934
11
    state->type_ignore_type = make_type(state, "type_ignore", state->AST_type,
6935
11
                                        NULL, 0,
6936
11
        "type_ignore = TypeIgnore(int lineno, string tag)");
6937
11
    if (!state->type_ignore_type) return -1;
6938
11
    if (add_attributes(state, state->type_ignore_type, NULL, 0) < 0) return -1;
6939
11
    state->TypeIgnore_type = make_type(state, "TypeIgnore",
6940
11
                                       state->type_ignore_type,
6941
11
                                       TypeIgnore_fields, 2,
6942
11
        "TypeIgnore(int lineno, string tag)");
6943
11
    if (!state->TypeIgnore_type) return -1;
6944
11
    state->type_param_type = make_type(state, "type_param", state->AST_type,
6945
11
                                       NULL, 0,
6946
11
        "type_param = TypeVar(identifier name, expr? bound, expr? default_value)\n"
6947
11
        "           | ParamSpec(identifier name, expr? default_value)\n"
6948
11
        "           | TypeVarTuple(identifier name, expr? default_value)");
6949
11
    if (!state->type_param_type) return -1;
6950
11
    if (add_attributes(state, state->type_param_type, type_param_attributes, 4)
6951
11
        < 0) return -1;
6952
11
    state->TypeVar_type = make_type(state, "TypeVar", state->type_param_type,
6953
11
                                    TypeVar_fields, 3,
6954
11
        "TypeVar(identifier name, expr? bound, expr? default_value)");
6955
11
    if (!state->TypeVar_type) return -1;
6956
11
    if (PyObject_SetAttr(state->TypeVar_type, state->bound, Py_None) == -1)
6957
0
        return -1;
6958
11
    if (PyObject_SetAttr(state->TypeVar_type, state->default_value, Py_None) ==
6959
11
        -1)
6960
0
        return -1;
6961
11
    state->ParamSpec_type = make_type(state, "ParamSpec",
6962
11
                                      state->type_param_type, ParamSpec_fields,
6963
11
                                      2,
6964
11
        "ParamSpec(identifier name, expr? default_value)");
6965
11
    if (!state->ParamSpec_type) return -1;
6966
11
    if (PyObject_SetAttr(state->ParamSpec_type, state->default_value, Py_None)
6967
11
        == -1)
6968
0
        return -1;
6969
11
    state->TypeVarTuple_type = make_type(state, "TypeVarTuple",
6970
11
                                         state->type_param_type,
6971
11
                                         TypeVarTuple_fields, 2,
6972
11
        "TypeVarTuple(identifier name, expr? default_value)");
6973
11
    if (!state->TypeVarTuple_type) return -1;
6974
11
    if (PyObject_SetAttr(state->TypeVarTuple_type, state->default_value,
6975
11
        Py_None) == -1)
6976
0
        return -1;
6977
6978
11
    if (!add_ast_annotations(state)) {
6979
0
        return -1;
6980
0
    }
6981
11
    return 0;
6982
11
}
6983
6984
static int obj2ast_mod(struct ast_state *state, PyObject* obj, mod_ty* out,
6985
                       PyArena* arena);
6986
static int obj2ast_stmt(struct ast_state *state, PyObject* obj, stmt_ty* out,
6987
                        PyArena* arena);
6988
static int obj2ast_expr(struct ast_state *state, PyObject* obj, expr_ty* out,
6989
                        PyArena* arena);
6990
static int obj2ast_expr_context(struct ast_state *state, PyObject* obj,
6991
                                expr_context_ty* out, PyArena* arena);
6992
static int obj2ast_boolop(struct ast_state *state, PyObject* obj, boolop_ty*
6993
                          out, PyArena* arena);
6994
static int obj2ast_operator(struct ast_state *state, PyObject* obj,
6995
                            operator_ty* out, PyArena* arena);
6996
static int obj2ast_unaryop(struct ast_state *state, PyObject* obj, unaryop_ty*
6997
                           out, PyArena* arena);
6998
static int obj2ast_cmpop(struct ast_state *state, PyObject* obj, cmpop_ty* out,
6999
                         PyArena* arena);
7000
static int obj2ast_comprehension(struct ast_state *state, PyObject* obj,
7001
                                 comprehension_ty* out, PyArena* arena);
7002
static int obj2ast_excepthandler(struct ast_state *state, PyObject* obj,
7003
                                 excepthandler_ty* out, PyArena* arena);
7004
static int obj2ast_arguments(struct ast_state *state, PyObject* obj,
7005
                             arguments_ty* out, PyArena* arena);
7006
static int obj2ast_arg(struct ast_state *state, PyObject* obj, arg_ty* out,
7007
                       PyArena* arena);
7008
static int obj2ast_keyword(struct ast_state *state, PyObject* obj, keyword_ty*
7009
                           out, PyArena* arena);
7010
static int obj2ast_alias(struct ast_state *state, PyObject* obj, alias_ty* out,
7011
                         PyArena* arena);
7012
static int obj2ast_withitem(struct ast_state *state, PyObject* obj,
7013
                            withitem_ty* out, PyArena* arena);
7014
static int obj2ast_match_case(struct ast_state *state, PyObject* obj,
7015
                              match_case_ty* out, PyArena* arena);
7016
static int obj2ast_pattern(struct ast_state *state, PyObject* obj, pattern_ty*
7017
                           out, PyArena* arena);
7018
static int obj2ast_type_ignore(struct ast_state *state, PyObject* obj,
7019
                               type_ignore_ty* out, PyArena* arena);
7020
static int obj2ast_type_param(struct ast_state *state, PyObject* obj,
7021
                              type_param_ty* out, PyArena* arena);
7022
7023
mod_ty
7024
_PyAST_Module(asdl_stmt_seq * body, asdl_type_ignore_seq * type_ignores,
7025
              PyArena *arena)
7026
7.05k
{
7027
7.05k
    mod_ty p;
7028
7.05k
    p = (mod_ty)_PyArena_Malloc(arena, sizeof(*p));
7029
7.05k
    if (!p)
7030
0
        return NULL;
7031
7.05k
    p->kind = Module_kind;
7032
7.05k
    p->v.Module.body = body;
7033
7.05k
    p->v.Module.type_ignores = type_ignores;
7034
7.05k
    return p;
7035
7.05k
}
7036
7037
mod_ty
7038
_PyAST_Interactive(asdl_stmt_seq * body, PyArena *arena)
7039
0
{
7040
0
    mod_ty p;
7041
0
    p = (mod_ty)_PyArena_Malloc(arena, sizeof(*p));
7042
0
    if (!p)
7043
0
        return NULL;
7044
0
    p->kind = Interactive_kind;
7045
0
    p->v.Interactive.body = body;
7046
0
    return p;
7047
0
}
7048
7049
mod_ty
7050
_PyAST_Expression(expr_ty body, PyArena *arena)
7051
66
{
7052
66
    mod_ty p;
7053
66
    if (!body) {
7054
0
        PyErr_SetString(PyExc_ValueError,
7055
0
                        "field 'body' is required for Expression");
7056
0
        return NULL;
7057
0
    }
7058
66
    p = (mod_ty)_PyArena_Malloc(arena, sizeof(*p));
7059
66
    if (!p)
7060
0
        return NULL;
7061
66
    p->kind = Expression_kind;
7062
66
    p->v.Expression.body = body;
7063
66
    return p;
7064
66
}
7065
7066
mod_ty
7067
_PyAST_FunctionType(asdl_expr_seq * argtypes, expr_ty returns, PyArena *arena)
7068
0
{
7069
0
    mod_ty p;
7070
0
    if (!returns) {
7071
0
        PyErr_SetString(PyExc_ValueError,
7072
0
                        "field 'returns' is required for FunctionType");
7073
0
        return NULL;
7074
0
    }
7075
0
    p = (mod_ty)_PyArena_Malloc(arena, sizeof(*p));
7076
0
    if (!p)
7077
0
        return NULL;
7078
0
    p->kind = FunctionType_kind;
7079
0
    p->v.FunctionType.argtypes = argtypes;
7080
0
    p->v.FunctionType.returns = returns;
7081
0
    return p;
7082
0
}
7083
7084
stmt_ty
7085
_PyAST_FunctionDef(identifier name, arguments_ty args, asdl_stmt_seq * body,
7086
                   asdl_expr_seq * decorator_list, expr_ty returns, string
7087
                   type_comment, asdl_type_param_seq * type_params, int lineno,
7088
                   int col_offset, int end_lineno, int end_col_offset, PyArena
7089
                   *arena)
7090
9.56k
{
7091
9.56k
    stmt_ty p;
7092
9.56k
    if (!name) {
7093
0
        PyErr_SetString(PyExc_ValueError,
7094
0
                        "field 'name' is required for FunctionDef");
7095
0
        return NULL;
7096
0
    }
7097
9.56k
    if (!args) {
7098
0
        PyErr_SetString(PyExc_ValueError,
7099
0
                        "field 'args' is required for FunctionDef");
7100
0
        return NULL;
7101
0
    }
7102
9.56k
    p = (stmt_ty)_PyArena_Malloc(arena, sizeof(*p));
7103
9.56k
    if (!p)
7104
0
        return NULL;
7105
9.56k
    p->kind = FunctionDef_kind;
7106
9.56k
    p->v.FunctionDef.name = name;
7107
9.56k
    p->v.FunctionDef.args = args;
7108
9.56k
    p->v.FunctionDef.body = body;
7109
9.56k
    p->v.FunctionDef.decorator_list = decorator_list;
7110
9.56k
    p->v.FunctionDef.returns = returns;
7111
9.56k
    p->v.FunctionDef.type_comment = type_comment;
7112
9.56k
    p->v.FunctionDef.type_params = type_params;
7113
9.56k
    p->lineno = lineno;
7114
9.56k
    p->col_offset = col_offset;
7115
9.56k
    p->end_lineno = end_lineno;
7116
9.56k
    p->end_col_offset = end_col_offset;
7117
9.56k
    return p;
7118
9.56k
}
7119
7120
stmt_ty
7121
_PyAST_AsyncFunctionDef(identifier name, arguments_ty args, asdl_stmt_seq *
7122
                        body, asdl_expr_seq * decorator_list, expr_ty returns,
7123
                        string type_comment, asdl_type_param_seq * type_params,
7124
                        int lineno, int col_offset, int end_lineno, int
7125
                        end_col_offset, PyArena *arena)
7126
830
{
7127
830
    stmt_ty p;
7128
830
    if (!name) {
7129
0
        PyErr_SetString(PyExc_ValueError,
7130
0
                        "field 'name' is required for AsyncFunctionDef");
7131
0
        return NULL;
7132
0
    }
7133
830
    if (!args) {
7134
0
        PyErr_SetString(PyExc_ValueError,
7135
0
                        "field 'args' is required for AsyncFunctionDef");
7136
0
        return NULL;
7137
0
    }
7138
830
    p = (stmt_ty)_PyArena_Malloc(arena, sizeof(*p));
7139
830
    if (!p)
7140
0
        return NULL;
7141
830
    p->kind = AsyncFunctionDef_kind;
7142
830
    p->v.AsyncFunctionDef.name = name;
7143
830
    p->v.AsyncFunctionDef.args = args;
7144
830
    p->v.AsyncFunctionDef.body = body;
7145
830
    p->v.AsyncFunctionDef.decorator_list = decorator_list;
7146
830
    p->v.AsyncFunctionDef.returns = returns;
7147
830
    p->v.AsyncFunctionDef.type_comment = type_comment;
7148
830
    p->v.AsyncFunctionDef.type_params = type_params;
7149
830
    p->lineno = lineno;
7150
830
    p->col_offset = col_offset;
7151
830
    p->end_lineno = end_lineno;
7152
830
    p->end_col_offset = end_col_offset;
7153
830
    return p;
7154
830
}
7155
7156
stmt_ty
7157
_PyAST_ClassDef(identifier name, asdl_expr_seq * bases, asdl_keyword_seq *
7158
                keywords, asdl_stmt_seq * body, asdl_expr_seq * decorator_list,
7159
                asdl_type_param_seq * type_params, int lineno, int col_offset,
7160
                int end_lineno, int end_col_offset, PyArena *arena)
7161
4.24k
{
7162
4.24k
    stmt_ty p;
7163
4.24k
    if (!name) {
7164
0
        PyErr_SetString(PyExc_ValueError,
7165
0
                        "field 'name' is required for ClassDef");
7166
0
        return NULL;
7167
0
    }
7168
4.24k
    p = (stmt_ty)_PyArena_Malloc(arena, sizeof(*p));
7169
4.24k
    if (!p)
7170
0
        return NULL;
7171
4.24k
    p->kind = ClassDef_kind;
7172
4.24k
    p->v.ClassDef.name = name;
7173
4.24k
    p->v.ClassDef.bases = bases;
7174
4.24k
    p->v.ClassDef.keywords = keywords;
7175
4.24k
    p->v.ClassDef.body = body;
7176
4.24k
    p->v.ClassDef.decorator_list = decorator_list;
7177
4.24k
    p->v.ClassDef.type_params = type_params;
7178
4.24k
    p->lineno = lineno;
7179
4.24k
    p->col_offset = col_offset;
7180
4.24k
    p->end_lineno = end_lineno;
7181
4.24k
    p->end_col_offset = end_col_offset;
7182
4.24k
    return p;
7183
4.24k
}
7184
7185
stmt_ty
7186
_PyAST_Return(expr_ty value, int lineno, int col_offset, int end_lineno, int
7187
              end_col_offset, PyArena *arena)
7188
8.29k
{
7189
8.29k
    stmt_ty p;
7190
8.29k
    p = (stmt_ty)_PyArena_Malloc(arena, sizeof(*p));
7191
8.29k
    if (!p)
7192
0
        return NULL;
7193
8.29k
    p->kind = Return_kind;
7194
8.29k
    p->v.Return.value = value;
7195
8.29k
    p->lineno = lineno;
7196
8.29k
    p->col_offset = col_offset;
7197
8.29k
    p->end_lineno = end_lineno;
7198
8.29k
    p->end_col_offset = end_col_offset;
7199
8.29k
    return p;
7200
8.29k
}
7201
7202
stmt_ty
7203
_PyAST_Delete(asdl_expr_seq * targets, int lineno, int col_offset, int
7204
              end_lineno, int end_col_offset, PyArena *arena)
7205
1.09k
{
7206
1.09k
    stmt_ty p;
7207
1.09k
    p = (stmt_ty)_PyArena_Malloc(arena, sizeof(*p));
7208
1.09k
    if (!p)
7209
0
        return NULL;
7210
1.09k
    p->kind = Delete_kind;
7211
1.09k
    p->v.Delete.targets = targets;
7212
1.09k
    p->lineno = lineno;
7213
1.09k
    p->col_offset = col_offset;
7214
1.09k
    p->end_lineno = end_lineno;
7215
1.09k
    p->end_col_offset = end_col_offset;
7216
1.09k
    return p;
7217
1.09k
}
7218
7219
stmt_ty
7220
_PyAST_Assign(asdl_expr_seq * targets, expr_ty value, string type_comment, int
7221
              lineno, int col_offset, int end_lineno, int end_col_offset,
7222
              PyArena *arena)
7223
15.5k
{
7224
15.5k
    stmt_ty p;
7225
15.5k
    if (!value) {
7226
0
        PyErr_SetString(PyExc_ValueError,
7227
0
                        "field 'value' is required for Assign");
7228
0
        return NULL;
7229
0
    }
7230
15.5k
    p = (stmt_ty)_PyArena_Malloc(arena, sizeof(*p));
7231
15.5k
    if (!p)
7232
0
        return NULL;
7233
15.5k
    p->kind = Assign_kind;
7234
15.5k
    p->v.Assign.targets = targets;
7235
15.5k
    p->v.Assign.value = value;
7236
15.5k
    p->v.Assign.type_comment = type_comment;
7237
15.5k
    p->lineno = lineno;
7238
15.5k
    p->col_offset = col_offset;
7239
15.5k
    p->end_lineno = end_lineno;
7240
15.5k
    p->end_col_offset = end_col_offset;
7241
15.5k
    return p;
7242
15.5k
}
7243
7244
stmt_ty
7245
_PyAST_TypeAlias(expr_ty name, asdl_type_param_seq * type_params, expr_ty
7246
                 value, int lineno, int col_offset, int end_lineno, int
7247
                 end_col_offset, PyArena *arena)
7248
260
{
7249
260
    stmt_ty p;
7250
260
    if (!name) {
7251
0
        PyErr_SetString(PyExc_ValueError,
7252
0
                        "field 'name' is required for TypeAlias");
7253
0
        return NULL;
7254
0
    }
7255
260
    if (!value) {
7256
0
        PyErr_SetString(PyExc_ValueError,
7257
0
                        "field 'value' is required for TypeAlias");
7258
0
        return NULL;
7259
0
    }
7260
260
    p = (stmt_ty)_PyArena_Malloc(arena, sizeof(*p));
7261
260
    if (!p)
7262
0
        return NULL;
7263
260
    p->kind = TypeAlias_kind;
7264
260
    p->v.TypeAlias.name = name;
7265
260
    p->v.TypeAlias.type_params = type_params;
7266
260
    p->v.TypeAlias.value = value;
7267
260
    p->lineno = lineno;
7268
260
    p->col_offset = col_offset;
7269
260
    p->end_lineno = end_lineno;
7270
260
    p->end_col_offset = end_col_offset;
7271
260
    return p;
7272
260
}
7273
7274
stmt_ty
7275
_PyAST_AugAssign(expr_ty target, operator_ty op, expr_ty value, int lineno, int
7276
                 col_offset, int end_lineno, int end_col_offset, PyArena *arena)
7277
2.78k
{
7278
2.78k
    stmt_ty p;
7279
2.78k
    if (!target) {
7280
0
        PyErr_SetString(PyExc_ValueError,
7281
0
                        "field 'target' is required for AugAssign");
7282
0
        return NULL;
7283
0
    }
7284
2.78k
    if (!op) {
7285
0
        PyErr_SetString(PyExc_ValueError,
7286
0
                        "field 'op' is required for AugAssign");
7287
0
        return NULL;
7288
0
    }
7289
2.78k
    if (!value) {
7290
0
        PyErr_SetString(PyExc_ValueError,
7291
0
                        "field 'value' is required for AugAssign");
7292
0
        return NULL;
7293
0
    }
7294
2.78k
    p = (stmt_ty)_PyArena_Malloc(arena, sizeof(*p));
7295
2.78k
    if (!p)
7296
0
        return NULL;
7297
2.78k
    p->kind = AugAssign_kind;
7298
2.78k
    p->v.AugAssign.target = target;
7299
2.78k
    p->v.AugAssign.op = op;
7300
2.78k
    p->v.AugAssign.value = value;
7301
2.78k
    p->lineno = lineno;
7302
2.78k
    p->col_offset = col_offset;
7303
2.78k
    p->end_lineno = end_lineno;
7304
2.78k
    p->end_col_offset = end_col_offset;
7305
2.78k
    return p;
7306
2.78k
}
7307
7308
stmt_ty
7309
_PyAST_AnnAssign(expr_ty target, expr_ty annotation, expr_ty value, int simple,
7310
                 int lineno, int col_offset, int end_lineno, int
7311
                 end_col_offset, PyArena *arena)
7312
3.25k
{
7313
3.25k
    stmt_ty p;
7314
3.25k
    if (!target) {
7315
0
        PyErr_SetString(PyExc_ValueError,
7316
0
                        "field 'target' is required for AnnAssign");
7317
0
        return NULL;
7318
0
    }
7319
3.25k
    if (!annotation) {
7320
0
        PyErr_SetString(PyExc_ValueError,
7321
0
                        "field 'annotation' is required for AnnAssign");
7322
0
        return NULL;
7323
0
    }
7324
3.25k
    p = (stmt_ty)_PyArena_Malloc(arena, sizeof(*p));
7325
3.25k
    if (!p)
7326
0
        return NULL;
7327
3.25k
    p->kind = AnnAssign_kind;
7328
3.25k
    p->v.AnnAssign.target = target;
7329
3.25k
    p->v.AnnAssign.annotation = annotation;
7330
3.25k
    p->v.AnnAssign.value = value;
7331
3.25k
    p->v.AnnAssign.simple = simple;
7332
3.25k
    p->lineno = lineno;
7333
3.25k
    p->col_offset = col_offset;
7334
3.25k
    p->end_lineno = end_lineno;
7335
3.25k
    p->end_col_offset = end_col_offset;
7336
3.25k
    return p;
7337
3.25k
}
7338
7339
stmt_ty
7340
_PyAST_For(expr_ty target, expr_ty iter, asdl_stmt_seq * body, asdl_stmt_seq *
7341
           orelse, string type_comment, int lineno, int col_offset, int
7342
           end_lineno, int end_col_offset, PyArena *arena)
7343
1.85k
{
7344
1.85k
    stmt_ty p;
7345
1.85k
    if (!target) {
7346
0
        PyErr_SetString(PyExc_ValueError,
7347
0
                        "field 'target' is required for For");
7348
0
        return NULL;
7349
0
    }
7350
1.85k
    if (!iter) {
7351
0
        PyErr_SetString(PyExc_ValueError,
7352
0
                        "field 'iter' is required for For");
7353
0
        return NULL;
7354
0
    }
7355
1.85k
    p = (stmt_ty)_PyArena_Malloc(arena, sizeof(*p));
7356
1.85k
    if (!p)
7357
0
        return NULL;
7358
1.85k
    p->kind = For_kind;
7359
1.85k
    p->v.For.target = target;
7360
1.85k
    p->v.For.iter = iter;
7361
1.85k
    p->v.For.body = body;
7362
1.85k
    p->v.For.orelse = orelse;
7363
1.85k
    p->v.For.type_comment = type_comment;
7364
1.85k
    p->lineno = lineno;
7365
1.85k
    p->col_offset = col_offset;
7366
1.85k
    p->end_lineno = end_lineno;
7367
1.85k
    p->end_col_offset = end_col_offset;
7368
1.85k
    return p;
7369
1.85k
}
7370
7371
stmt_ty
7372
_PyAST_AsyncFor(expr_ty target, expr_ty iter, asdl_stmt_seq * body,
7373
                asdl_stmt_seq * orelse, string type_comment, int lineno, int
7374
                col_offset, int end_lineno, int end_col_offset, PyArena *arena)
7375
634
{
7376
634
    stmt_ty p;
7377
634
    if (!target) {
7378
0
        PyErr_SetString(PyExc_ValueError,
7379
0
                        "field 'target' is required for AsyncFor");
7380
0
        return NULL;
7381
0
    }
7382
634
    if (!iter) {
7383
0
        PyErr_SetString(PyExc_ValueError,
7384
0
                        "field 'iter' is required for AsyncFor");
7385
0
        return NULL;
7386
0
    }
7387
634
    p = (stmt_ty)_PyArena_Malloc(arena, sizeof(*p));
7388
634
    if (!p)
7389
0
        return NULL;
7390
634
    p->kind = AsyncFor_kind;
7391
634
    p->v.AsyncFor.target = target;
7392
634
    p->v.AsyncFor.iter = iter;
7393
634
    p->v.AsyncFor.body = body;
7394
634
    p->v.AsyncFor.orelse = orelse;
7395
634
    p->v.AsyncFor.type_comment = type_comment;
7396
634
    p->lineno = lineno;
7397
634
    p->col_offset = col_offset;
7398
634
    p->end_lineno = end_lineno;
7399
634
    p->end_col_offset = end_col_offset;
7400
634
    return p;
7401
634
}
7402
7403
stmt_ty
7404
_PyAST_While(expr_ty test, asdl_stmt_seq * body, asdl_stmt_seq * orelse, int
7405
             lineno, int col_offset, int end_lineno, int end_col_offset,
7406
             PyArena *arena)
7407
1.29k
{
7408
1.29k
    stmt_ty p;
7409
1.29k
    if (!test) {
7410
0
        PyErr_SetString(PyExc_ValueError,
7411
0
                        "field 'test' is required for While");
7412
0
        return NULL;
7413
0
    }
7414
1.29k
    p = (stmt_ty)_PyArena_Malloc(arena, sizeof(*p));
7415
1.29k
    if (!p)
7416
0
        return NULL;
7417
1.29k
    p->kind = While_kind;
7418
1.29k
    p->v.While.test = test;
7419
1.29k
    p->v.While.body = body;
7420
1.29k
    p->v.While.orelse = orelse;
7421
1.29k
    p->lineno = lineno;
7422
1.29k
    p->col_offset = col_offset;
7423
1.29k
    p->end_lineno = end_lineno;
7424
1.29k
    p->end_col_offset = end_col_offset;
7425
1.29k
    return p;
7426
1.29k
}
7427
7428
stmt_ty
7429
_PyAST_If(expr_ty test, asdl_stmt_seq * body, asdl_stmt_seq * orelse, int
7430
          lineno, int col_offset, int end_lineno, int end_col_offset, PyArena
7431
          *arena)
7432
10.4k
{
7433
10.4k
    stmt_ty p;
7434
10.4k
    if (!test) {
7435
0
        PyErr_SetString(PyExc_ValueError,
7436
0
                        "field 'test' is required for If");
7437
0
        return NULL;
7438
0
    }
7439
10.4k
    p = (stmt_ty)_PyArena_Malloc(arena, sizeof(*p));
7440
10.4k
    if (!p)
7441
0
        return NULL;
7442
10.4k
    p->kind = If_kind;
7443
10.4k
    p->v.If.test = test;
7444
10.4k
    p->v.If.body = body;
7445
10.4k
    p->v.If.orelse = orelse;
7446
10.4k
    p->lineno = lineno;
7447
10.4k
    p->col_offset = col_offset;
7448
10.4k
    p->end_lineno = end_lineno;
7449
10.4k
    p->end_col_offset = end_col_offset;
7450
10.4k
    return p;
7451
10.4k
}
7452
7453
stmt_ty
7454
_PyAST_With(asdl_withitem_seq * items, asdl_stmt_seq * body, string
7455
            type_comment, int lineno, int col_offset, int end_lineno, int
7456
            end_col_offset, PyArena *arena)
7457
3.49k
{
7458
3.49k
    stmt_ty p;
7459
3.49k
    p = (stmt_ty)_PyArena_Malloc(arena, sizeof(*p));
7460
3.49k
    if (!p)
7461
0
        return NULL;
7462
3.49k
    p->kind = With_kind;
7463
3.49k
    p->v.With.items = items;
7464
3.49k
    p->v.With.body = body;
7465
3.49k
    p->v.With.type_comment = type_comment;
7466
3.49k
    p->lineno = lineno;
7467
3.49k
    p->col_offset = col_offset;
7468
3.49k
    p->end_lineno = end_lineno;
7469
3.49k
    p->end_col_offset = end_col_offset;
7470
3.49k
    return p;
7471
3.49k
}
7472
7473
stmt_ty
7474
_PyAST_AsyncWith(asdl_withitem_seq * items, asdl_stmt_seq * body, string
7475
                 type_comment, int lineno, int col_offset, int end_lineno, int
7476
                 end_col_offset, PyArena *arena)
7477
1.15k
{
7478
1.15k
    stmt_ty p;
7479
1.15k
    p = (stmt_ty)_PyArena_Malloc(arena, sizeof(*p));
7480
1.15k
    if (!p)
7481
0
        return NULL;
7482
1.15k
    p->kind = AsyncWith_kind;
7483
1.15k
    p->v.AsyncWith.items = items;
7484
1.15k
    p->v.AsyncWith.body = body;
7485
1.15k
    p->v.AsyncWith.type_comment = type_comment;
7486
1.15k
    p->lineno = lineno;
7487
1.15k
    p->col_offset = col_offset;
7488
1.15k
    p->end_lineno = end_lineno;
7489
1.15k
    p->end_col_offset = end_col_offset;
7490
1.15k
    return p;
7491
1.15k
}
7492
7493
stmt_ty
7494
_PyAST_Match(expr_ty subject, asdl_match_case_seq * cases, int lineno, int
7495
             col_offset, int end_lineno, int end_col_offset, PyArena *arena)
7496
584
{
7497
584
    stmt_ty p;
7498
584
    if (!subject) {
7499
0
        PyErr_SetString(PyExc_ValueError,
7500
0
                        "field 'subject' is required for Match");
7501
0
        return NULL;
7502
0
    }
7503
584
    p = (stmt_ty)_PyArena_Malloc(arena, sizeof(*p));
7504
584
    if (!p)
7505
0
        return NULL;
7506
584
    p->kind = Match_kind;
7507
584
    p->v.Match.subject = subject;
7508
584
    p->v.Match.cases = cases;
7509
584
    p->lineno = lineno;
7510
584
    p->col_offset = col_offset;
7511
584
    p->end_lineno = end_lineno;
7512
584
    p->end_col_offset = end_col_offset;
7513
584
    return p;
7514
584
}
7515
7516
stmt_ty
7517
_PyAST_Raise(expr_ty exc, expr_ty cause, int lineno, int col_offset, int
7518
             end_lineno, int end_col_offset, PyArena *arena)
7519
3.55k
{
7520
3.55k
    stmt_ty p;
7521
3.55k
    p = (stmt_ty)_PyArena_Malloc(arena, sizeof(*p));
7522
3.55k
    if (!p)
7523
0
        return NULL;
7524
3.55k
    p->kind = Raise_kind;
7525
3.55k
    p->v.Raise.exc = exc;
7526
3.55k
    p->v.Raise.cause = cause;
7527
3.55k
    p->lineno = lineno;
7528
3.55k
    p->col_offset = col_offset;
7529
3.55k
    p->end_lineno = end_lineno;
7530
3.55k
    p->end_col_offset = end_col_offset;
7531
3.55k
    return p;
7532
3.55k
}
7533
7534
stmt_ty
7535
_PyAST_Try(asdl_stmt_seq * body, asdl_excepthandler_seq * handlers,
7536
           asdl_stmt_seq * orelse, asdl_stmt_seq * finalbody, int lineno, int
7537
           col_offset, int end_lineno, int end_col_offset, PyArena *arena)
7538
3.99k
{
7539
3.99k
    stmt_ty p;
7540
3.99k
    p = (stmt_ty)_PyArena_Malloc(arena, sizeof(*p));
7541
3.99k
    if (!p)
7542
0
        return NULL;
7543
3.99k
    p->kind = Try_kind;
7544
3.99k
    p->v.Try.body = body;
7545
3.99k
    p->v.Try.handlers = handlers;
7546
3.99k
    p->v.Try.orelse = orelse;
7547
3.99k
    p->v.Try.finalbody = finalbody;
7548
3.99k
    p->lineno = lineno;
7549
3.99k
    p->col_offset = col_offset;
7550
3.99k
    p->end_lineno = end_lineno;
7551
3.99k
    p->end_col_offset = end_col_offset;
7552
3.99k
    return p;
7553
3.99k
}
7554
7555
stmt_ty
7556
_PyAST_TryStar(asdl_stmt_seq * body, asdl_excepthandler_seq * handlers,
7557
               asdl_stmt_seq * orelse, asdl_stmt_seq * finalbody, int lineno,
7558
               int col_offset, int end_lineno, int end_col_offset, PyArena
7559
               *arena)
7560
1.56k
{
7561
1.56k
    stmt_ty p;
7562
1.56k
    p = (stmt_ty)_PyArena_Malloc(arena, sizeof(*p));
7563
1.56k
    if (!p)
7564
0
        return NULL;
7565
1.56k
    p->kind = TryStar_kind;
7566
1.56k
    p->v.TryStar.body = body;
7567
1.56k
    p->v.TryStar.handlers = handlers;
7568
1.56k
    p->v.TryStar.orelse = orelse;
7569
1.56k
    p->v.TryStar.finalbody = finalbody;
7570
1.56k
    p->lineno = lineno;
7571
1.56k
    p->col_offset = col_offset;
7572
1.56k
    p->end_lineno = end_lineno;
7573
1.56k
    p->end_col_offset = end_col_offset;
7574
1.56k
    return p;
7575
1.56k
}
7576
7577
stmt_ty
7578
_PyAST_Assert(expr_ty test, expr_ty msg, int lineno, int col_offset, int
7579
              end_lineno, int end_col_offset, PyArena *arena)
7580
1.15k
{
7581
1.15k
    stmt_ty p;
7582
1.15k
    if (!test) {
7583
0
        PyErr_SetString(PyExc_ValueError,
7584
0
                        "field 'test' is required for Assert");
7585
0
        return NULL;
7586
0
    }
7587
1.15k
    p = (stmt_ty)_PyArena_Malloc(arena, sizeof(*p));
7588
1.15k
    if (!p)
7589
0
        return NULL;
7590
1.15k
    p->kind = Assert_kind;
7591
1.15k
    p->v.Assert.test = test;
7592
1.15k
    p->v.Assert.msg = msg;
7593
1.15k
    p->lineno = lineno;
7594
1.15k
    p->col_offset = col_offset;
7595
1.15k
    p->end_lineno = end_lineno;
7596
1.15k
    p->end_col_offset = end_col_offset;
7597
1.15k
    return p;
7598
1.15k
}
7599
7600
stmt_ty
7601
_PyAST_Import(asdl_alias_seq * names, int lineno, int col_offset, int
7602
              end_lineno, int end_col_offset, PyArena *arena)
7603
2.82k
{
7604
2.82k
    stmt_ty p;
7605
2.82k
    p = (stmt_ty)_PyArena_Malloc(arena, sizeof(*p));
7606
2.82k
    if (!p)
7607
0
        return NULL;
7608
2.82k
    p->kind = Import_kind;
7609
2.82k
    p->v.Import.names = names;
7610
2.82k
    p->lineno = lineno;
7611
2.82k
    p->col_offset = col_offset;
7612
2.82k
    p->end_lineno = end_lineno;
7613
2.82k
    p->end_col_offset = end_col_offset;
7614
2.82k
    return p;
7615
2.82k
}
7616
7617
stmt_ty
7618
_PyAST_ImportFrom(identifier module, asdl_alias_seq * names, int level, int
7619
                  lineno, int col_offset, int end_lineno, int end_col_offset,
7620
                  PyArena *arena)
7621
3.00k
{
7622
3.00k
    stmt_ty p;
7623
3.00k
    p = (stmt_ty)_PyArena_Malloc(arena, sizeof(*p));
7624
3.00k
    if (!p)
7625
0
        return NULL;
7626
3.00k
    p->kind = ImportFrom_kind;
7627
3.00k
    p->v.ImportFrom.module = module;
7628
3.00k
    p->v.ImportFrom.names = names;
7629
3.00k
    p->v.ImportFrom.level = level;
7630
3.00k
    p->lineno = lineno;
7631
3.00k
    p->col_offset = col_offset;
7632
3.00k
    p->end_lineno = end_lineno;
7633
3.00k
    p->end_col_offset = end_col_offset;
7634
3.00k
    return p;
7635
3.00k
}
7636
7637
stmt_ty
7638
_PyAST_Global(asdl_identifier_seq * names, int lineno, int col_offset, int
7639
              end_lineno, int end_col_offset, PyArena *arena)
7640
688
{
7641
688
    stmt_ty p;
7642
688
    p = (stmt_ty)_PyArena_Malloc(arena, sizeof(*p));
7643
688
    if (!p)
7644
0
        return NULL;
7645
688
    p->kind = Global_kind;
7646
688
    p->v.Global.names = names;
7647
688
    p->lineno = lineno;
7648
688
    p->col_offset = col_offset;
7649
688
    p->end_lineno = end_lineno;
7650
688
    p->end_col_offset = end_col_offset;
7651
688
    return p;
7652
688
}
7653
7654
stmt_ty
7655
_PyAST_Nonlocal(asdl_identifier_seq * names, int lineno, int col_offset, int
7656
                end_lineno, int end_col_offset, PyArena *arena)
7657
579
{
7658
579
    stmt_ty p;
7659
579
    p = (stmt_ty)_PyArena_Malloc(arena, sizeof(*p));
7660
579
    if (!p)
7661
0
        return NULL;
7662
579
    p->kind = Nonlocal_kind;
7663
579
    p->v.Nonlocal.names = names;
7664
579
    p->lineno = lineno;
7665
579
    p->col_offset = col_offset;
7666
579
    p->end_lineno = end_lineno;
7667
579
    p->end_col_offset = end_col_offset;
7668
579
    return p;
7669
579
}
7670
7671
stmt_ty
7672
_PyAST_Expr(expr_ty value, int lineno, int col_offset, int end_lineno, int
7673
            end_col_offset, PyArena *arena)
7674
97.9k
{
7675
97.9k
    stmt_ty p;
7676
97.9k
    if (!value) {
7677
0
        PyErr_SetString(PyExc_ValueError,
7678
0
                        "field 'value' is required for Expr");
7679
0
        return NULL;
7680
0
    }
7681
97.9k
    p = (stmt_ty)_PyArena_Malloc(arena, sizeof(*p));
7682
97.9k
    if (!p)
7683
0
        return NULL;
7684
97.9k
    p->kind = Expr_kind;
7685
97.9k
    p->v.Expr.value = value;
7686
97.9k
    p->lineno = lineno;
7687
97.9k
    p->col_offset = col_offset;
7688
97.9k
    p->end_lineno = end_lineno;
7689
97.9k
    p->end_col_offset = end_col_offset;
7690
97.9k
    return p;
7691
97.9k
}
7692
7693
stmt_ty
7694
_PyAST_Pass(int lineno, int col_offset, int end_lineno, int end_col_offset,
7695
            PyArena *arena)
7696
1.88k
{
7697
1.88k
    stmt_ty p;
7698
1.88k
    p = (stmt_ty)_PyArena_Malloc(arena, sizeof(*p));
7699
1.88k
    if (!p)
7700
0
        return NULL;
7701
1.88k
    p->kind = Pass_kind;
7702
1.88k
    p->lineno = lineno;
7703
1.88k
    p->col_offset = col_offset;
7704
1.88k
    p->end_lineno = end_lineno;
7705
1.88k
    p->end_col_offset = end_col_offset;
7706
1.88k
    return p;
7707
1.88k
}
7708
7709
stmt_ty
7710
_PyAST_Break(int lineno, int col_offset, int end_lineno, int end_col_offset,
7711
             PyArena *arena)
7712
2.18k
{
7713
2.18k
    stmt_ty p;
7714
2.18k
    p = (stmt_ty)_PyArena_Malloc(arena, sizeof(*p));
7715
2.18k
    if (!p)
7716
0
        return NULL;
7717
2.18k
    p->kind = Break_kind;
7718
2.18k
    p->lineno = lineno;
7719
2.18k
    p->col_offset = col_offset;
7720
2.18k
    p->end_lineno = end_lineno;
7721
2.18k
    p->end_col_offset = end_col_offset;
7722
2.18k
    return p;
7723
2.18k
}
7724
7725
stmt_ty
7726
_PyAST_Continue(int lineno, int col_offset, int end_lineno, int end_col_offset,
7727
                PyArena *arena)
7728
2.93k
{
7729
2.93k
    stmt_ty p;
7730
2.93k
    p = (stmt_ty)_PyArena_Malloc(arena, sizeof(*p));
7731
2.93k
    if (!p)
7732
0
        return NULL;
7733
2.93k
    p->kind = Continue_kind;
7734
2.93k
    p->lineno = lineno;
7735
2.93k
    p->col_offset = col_offset;
7736
2.93k
    p->end_lineno = end_lineno;
7737
2.93k
    p->end_col_offset = end_col_offset;
7738
2.93k
    return p;
7739
2.93k
}
7740
7741
expr_ty
7742
_PyAST_BoolOp(boolop_ty op, asdl_expr_seq * values, int lineno, int col_offset,
7743
              int end_lineno, int end_col_offset, PyArena *arena)
7744
3.29k
{
7745
3.29k
    expr_ty p;
7746
3.29k
    if (!op) {
7747
0
        PyErr_SetString(PyExc_ValueError,
7748
0
                        "field 'op' is required for BoolOp");
7749
0
        return NULL;
7750
0
    }
7751
3.29k
    p = (expr_ty)_PyArena_Malloc(arena, sizeof(*p));
7752
3.29k
    if (!p)
7753
0
        return NULL;
7754
3.29k
    p->kind = BoolOp_kind;
7755
3.29k
    p->v.BoolOp.op = op;
7756
3.29k
    p->v.BoolOp.values = values;
7757
3.29k
    p->lineno = lineno;
7758
3.29k
    p->col_offset = col_offset;
7759
3.29k
    p->end_lineno = end_lineno;
7760
3.29k
    p->end_col_offset = end_col_offset;
7761
3.29k
    return p;
7762
3.29k
}
7763
7764
expr_ty
7765
_PyAST_NamedExpr(expr_ty target, expr_ty value, int lineno, int col_offset, int
7766
                 end_lineno, int end_col_offset, PyArena *arena)
7767
819
{
7768
819
    expr_ty p;
7769
819
    if (!target) {
7770
0
        PyErr_SetString(PyExc_ValueError,
7771
0
                        "field 'target' is required for NamedExpr");
7772
0
        return NULL;
7773
0
    }
7774
819
    if (!value) {
7775
0
        PyErr_SetString(PyExc_ValueError,
7776
0
                        "field 'value' is required for NamedExpr");
7777
0
        return NULL;
7778
0
    }
7779
819
    p = (expr_ty)_PyArena_Malloc(arena, sizeof(*p));
7780
819
    if (!p)
7781
0
        return NULL;
7782
819
    p->kind = NamedExpr_kind;
7783
819
    p->v.NamedExpr.target = target;
7784
819
    p->v.NamedExpr.value = value;
7785
819
    p->lineno = lineno;
7786
819
    p->col_offset = col_offset;
7787
819
    p->end_lineno = end_lineno;
7788
819
    p->end_col_offset = end_col_offset;
7789
819
    return p;
7790
819
}
7791
7792
expr_ty
7793
_PyAST_BinOp(expr_ty left, operator_ty op, expr_ty right, int lineno, int
7794
             col_offset, int end_lineno, int end_col_offset, PyArena *arena)
7795
44.6k
{
7796
44.6k
    expr_ty p;
7797
44.6k
    if (!left) {
7798
0
        PyErr_SetString(PyExc_ValueError,
7799
0
                        "field 'left' is required for BinOp");
7800
0
        return NULL;
7801
0
    }
7802
44.6k
    if (!op) {
7803
0
        PyErr_SetString(PyExc_ValueError,
7804
0
                        "field 'op' is required for BinOp");
7805
0
        return NULL;
7806
0
    }
7807
44.6k
    if (!right) {
7808
0
        PyErr_SetString(PyExc_ValueError,
7809
0
                        "field 'right' is required for BinOp");
7810
0
        return NULL;
7811
0
    }
7812
44.6k
    p = (expr_ty)_PyArena_Malloc(arena, sizeof(*p));
7813
44.6k
    if (!p)
7814
0
        return NULL;
7815
44.6k
    p->kind = BinOp_kind;
7816
44.6k
    p->v.BinOp.left = left;
7817
44.6k
    p->v.BinOp.op = op;
7818
44.6k
    p->v.BinOp.right = right;
7819
44.6k
    p->lineno = lineno;
7820
44.6k
    p->col_offset = col_offset;
7821
44.6k
    p->end_lineno = end_lineno;
7822
44.6k
    p->end_col_offset = end_col_offset;
7823
44.6k
    return p;
7824
44.6k
}
7825
7826
expr_ty
7827
_PyAST_UnaryOp(unaryop_ty op, expr_ty operand, int lineno, int col_offset, int
7828
               end_lineno, int end_col_offset, PyArena *arena)
7829
177k
{
7830
177k
    expr_ty p;
7831
177k
    if (!op) {
7832
0
        PyErr_SetString(PyExc_ValueError,
7833
0
                        "field 'op' is required for UnaryOp");
7834
0
        return NULL;
7835
0
    }
7836
177k
    if (!operand) {
7837
0
        PyErr_SetString(PyExc_ValueError,
7838
0
                        "field 'operand' is required for UnaryOp");
7839
0
        return NULL;
7840
0
    }
7841
177k
    p = (expr_ty)_PyArena_Malloc(arena, sizeof(*p));
7842
177k
    if (!p)
7843
0
        return NULL;
7844
177k
    p->kind = UnaryOp_kind;
7845
177k
    p->v.UnaryOp.op = op;
7846
177k
    p->v.UnaryOp.operand = operand;
7847
177k
    p->lineno = lineno;
7848
177k
    p->col_offset = col_offset;
7849
177k
    p->end_lineno = end_lineno;
7850
177k
    p->end_col_offset = end_col_offset;
7851
177k
    return p;
7852
177k
}
7853
7854
expr_ty
7855
_PyAST_Lambda(arguments_ty args, expr_ty body, int lineno, int col_offset, int
7856
              end_lineno, int end_col_offset, PyArena *arena)
7857
2.94k
{
7858
2.94k
    expr_ty p;
7859
2.94k
    if (!args) {
7860
0
        PyErr_SetString(PyExc_ValueError,
7861
0
                        "field 'args' is required for Lambda");
7862
0
        return NULL;
7863
0
    }
7864
2.94k
    if (!body) {
7865
0
        PyErr_SetString(PyExc_ValueError,
7866
0
                        "field 'body' is required for Lambda");
7867
0
        return NULL;
7868
0
    }
7869
2.94k
    p = (expr_ty)_PyArena_Malloc(arena, sizeof(*p));
7870
2.94k
    if (!p)
7871
0
        return NULL;
7872
2.94k
    p->kind = Lambda_kind;
7873
2.94k
    p->v.Lambda.args = args;
7874
2.94k
    p->v.Lambda.body = body;
7875
2.94k
    p->lineno = lineno;
7876
2.94k
    p->col_offset = col_offset;
7877
2.94k
    p->end_lineno = end_lineno;
7878
2.94k
    p->end_col_offset = end_col_offset;
7879
2.94k
    return p;
7880
2.94k
}
7881
7882
expr_ty
7883
_PyAST_IfExp(expr_ty test, expr_ty body, expr_ty orelse, int lineno, int
7884
             col_offset, int end_lineno, int end_col_offset, PyArena *arena)
7885
1.24k
{
7886
1.24k
    expr_ty p;
7887
1.24k
    if (!test) {
7888
0
        PyErr_SetString(PyExc_ValueError,
7889
0
                        "field 'test' is required for IfExp");
7890
0
        return NULL;
7891
0
    }
7892
1.24k
    if (!body) {
7893
0
        PyErr_SetString(PyExc_ValueError,
7894
0
                        "field 'body' is required for IfExp");
7895
0
        return NULL;
7896
0
    }
7897
1.24k
    if (!orelse) {
7898
0
        PyErr_SetString(PyExc_ValueError,
7899
0
                        "field 'orelse' is required for IfExp");
7900
0
        return NULL;
7901
0
    }
7902
1.24k
    p = (expr_ty)_PyArena_Malloc(arena, sizeof(*p));
7903
1.24k
    if (!p)
7904
0
        return NULL;
7905
1.24k
    p->kind = IfExp_kind;
7906
1.24k
    p->v.IfExp.test = test;
7907
1.24k
    p->v.IfExp.body = body;
7908
1.24k
    p->v.IfExp.orelse = orelse;
7909
1.24k
    p->lineno = lineno;
7910
1.24k
    p->col_offset = col_offset;
7911
1.24k
    p->end_lineno = end_lineno;
7912
1.24k
    p->end_col_offset = end_col_offset;
7913
1.24k
    return p;
7914
1.24k
}
7915
7916
expr_ty
7917
_PyAST_Dict(asdl_expr_seq * keys, asdl_expr_seq * values, int lineno, int
7918
            col_offset, int end_lineno, int end_col_offset, PyArena *arena)
7919
4.73k
{
7920
4.73k
    expr_ty p;
7921
4.73k
    p = (expr_ty)_PyArena_Malloc(arena, sizeof(*p));
7922
4.73k
    if (!p)
7923
0
        return NULL;
7924
4.73k
    p->kind = Dict_kind;
7925
4.73k
    p->v.Dict.keys = keys;
7926
4.73k
    p->v.Dict.values = values;
7927
4.73k
    p->lineno = lineno;
7928
4.73k
    p->col_offset = col_offset;
7929
4.73k
    p->end_lineno = end_lineno;
7930
4.73k
    p->end_col_offset = end_col_offset;
7931
4.73k
    return p;
7932
4.73k
}
7933
7934
expr_ty
7935
_PyAST_Set(asdl_expr_seq * elts, int lineno, int col_offset, int end_lineno,
7936
           int end_col_offset, PyArena *arena)
7937
1.53k
{
7938
1.53k
    expr_ty p;
7939
1.53k
    p = (expr_ty)_PyArena_Malloc(arena, sizeof(*p));
7940
1.53k
    if (!p)
7941
0
        return NULL;
7942
1.53k
    p->kind = Set_kind;
7943
1.53k
    p->v.Set.elts = elts;
7944
1.53k
    p->lineno = lineno;
7945
1.53k
    p->col_offset = col_offset;
7946
1.53k
    p->end_lineno = end_lineno;
7947
1.53k
    p->end_col_offset = end_col_offset;
7948
1.53k
    return p;
7949
1.53k
}
7950
7951
expr_ty
7952
_PyAST_ListComp(expr_ty elt, asdl_comprehension_seq * generators, int lineno,
7953
                int col_offset, int end_lineno, int end_col_offset, PyArena
7954
                *arena)
7955
1.56k
{
7956
1.56k
    expr_ty p;
7957
1.56k
    if (!elt) {
7958
0
        PyErr_SetString(PyExc_ValueError,
7959
0
                        "field 'elt' is required for ListComp");
7960
0
        return NULL;
7961
0
    }
7962
1.56k
    p = (expr_ty)_PyArena_Malloc(arena, sizeof(*p));
7963
1.56k
    if (!p)
7964
0
        return NULL;
7965
1.56k
    p->kind = ListComp_kind;
7966
1.56k
    p->v.ListComp.elt = elt;
7967
1.56k
    p->v.ListComp.generators = generators;
7968
1.56k
    p->lineno = lineno;
7969
1.56k
    p->col_offset = col_offset;
7970
1.56k
    p->end_lineno = end_lineno;
7971
1.56k
    p->end_col_offset = end_col_offset;
7972
1.56k
    return p;
7973
1.56k
}
7974
7975
expr_ty
7976
_PyAST_SetComp(expr_ty elt, asdl_comprehension_seq * generators, int lineno,
7977
               int col_offset, int end_lineno, int end_col_offset, PyArena
7978
               *arena)
7979
495
{
7980
495
    expr_ty p;
7981
495
    if (!elt) {
7982
0
        PyErr_SetString(PyExc_ValueError,
7983
0
                        "field 'elt' is required for SetComp");
7984
0
        return NULL;
7985
0
    }
7986
495
    p = (expr_ty)_PyArena_Malloc(arena, sizeof(*p));
7987
495
    if (!p)
7988
0
        return NULL;
7989
495
    p->kind = SetComp_kind;
7990
495
    p->v.SetComp.elt = elt;
7991
495
    p->v.SetComp.generators = generators;
7992
495
    p->lineno = lineno;
7993
495
    p->col_offset = col_offset;
7994
495
    p->end_lineno = end_lineno;
7995
495
    p->end_col_offset = end_col_offset;
7996
495
    return p;
7997
495
}
7998
7999
expr_ty
8000
_PyAST_DictComp(expr_ty key, expr_ty value, asdl_comprehension_seq *
8001
                generators, int lineno, int col_offset, int end_lineno, int
8002
                end_col_offset, PyArena *arena)
8003
1.46k
{
8004
1.46k
    expr_ty p;
8005
1.46k
    if (!key) {
8006
0
        PyErr_SetString(PyExc_ValueError,
8007
0
                        "field 'key' is required for DictComp");
8008
0
        return NULL;
8009
0
    }
8010
1.46k
    if (!value) {
8011
0
        PyErr_SetString(PyExc_ValueError,
8012
0
                        "field 'value' is required for DictComp");
8013
0
        return NULL;
8014
0
    }
8015
1.46k
    p = (expr_ty)_PyArena_Malloc(arena, sizeof(*p));
8016
1.46k
    if (!p)
8017
0
        return NULL;
8018
1.46k
    p->kind = DictComp_kind;
8019
1.46k
    p->v.DictComp.key = key;
8020
1.46k
    p->v.DictComp.value = value;
8021
1.46k
    p->v.DictComp.generators = generators;
8022
1.46k
    p->lineno = lineno;
8023
1.46k
    p->col_offset = col_offset;
8024
1.46k
    p->end_lineno = end_lineno;
8025
1.46k
    p->end_col_offset = end_col_offset;
8026
1.46k
    return p;
8027
1.46k
}
8028
8029
expr_ty
8030
_PyAST_GeneratorExp(expr_ty elt, asdl_comprehension_seq * generators, int
8031
                    lineno, int col_offset, int end_lineno, int end_col_offset,
8032
                    PyArena *arena)
8033
4.51k
{
8034
4.51k
    expr_ty p;
8035
4.51k
    if (!elt) {
8036
0
        PyErr_SetString(PyExc_ValueError,
8037
0
                        "field 'elt' is required for GeneratorExp");
8038
0
        return NULL;
8039
0
    }
8040
4.51k
    p = (expr_ty)_PyArena_Malloc(arena, sizeof(*p));
8041
4.51k
    if (!p)
8042
0
        return NULL;
8043
4.51k
    p->kind = GeneratorExp_kind;
8044
4.51k
    p->v.GeneratorExp.elt = elt;
8045
4.51k
    p->v.GeneratorExp.generators = generators;
8046
4.51k
    p->lineno = lineno;
8047
4.51k
    p->col_offset = col_offset;
8048
4.51k
    p->end_lineno = end_lineno;
8049
4.51k
    p->end_col_offset = end_col_offset;
8050
4.51k
    return p;
8051
4.51k
}
8052
8053
expr_ty
8054
_PyAST_Await(expr_ty value, int lineno, int col_offset, int end_lineno, int
8055
             end_col_offset, PyArena *arena)
8056
390
{
8057
390
    expr_ty p;
8058
390
    if (!value) {
8059
0
        PyErr_SetString(PyExc_ValueError,
8060
0
                        "field 'value' is required for Await");
8061
0
        return NULL;
8062
0
    }
8063
390
    p = (expr_ty)_PyArena_Malloc(arena, sizeof(*p));
8064
390
    if (!p)
8065
0
        return NULL;
8066
390
    p->kind = Await_kind;
8067
390
    p->v.Await.value = value;
8068
390
    p->lineno = lineno;
8069
390
    p->col_offset = col_offset;
8070
390
    p->end_lineno = end_lineno;
8071
390
    p->end_col_offset = end_col_offset;
8072
390
    return p;
8073
390
}
8074
8075
expr_ty
8076
_PyAST_Yield(expr_ty value, int lineno, int col_offset, int end_lineno, int
8077
             end_col_offset, PyArena *arena)
8078
2.94k
{
8079
2.94k
    expr_ty p;
8080
2.94k
    p = (expr_ty)_PyArena_Malloc(arena, sizeof(*p));
8081
2.94k
    if (!p)
8082
0
        return NULL;
8083
2.94k
    p->kind = Yield_kind;
8084
2.94k
    p->v.Yield.value = value;
8085
2.94k
    p->lineno = lineno;
8086
2.94k
    p->col_offset = col_offset;
8087
2.94k
    p->end_lineno = end_lineno;
8088
2.94k
    p->end_col_offset = end_col_offset;
8089
2.94k
    return p;
8090
2.94k
}
8091
8092
expr_ty
8093
_PyAST_YieldFrom(expr_ty value, int lineno, int col_offset, int end_lineno, int
8094
                 end_col_offset, PyArena *arena)
8095
304
{
8096
304
    expr_ty p;
8097
304
    if (!value) {
8098
0
        PyErr_SetString(PyExc_ValueError,
8099
0
                        "field 'value' is required for YieldFrom");
8100
0
        return NULL;
8101
0
    }
8102
304
    p = (expr_ty)_PyArena_Malloc(arena, sizeof(*p));
8103
304
    if (!p)
8104
0
        return NULL;
8105
304
    p->kind = YieldFrom_kind;
8106
304
    p->v.YieldFrom.value = value;
8107
304
    p->lineno = lineno;
8108
304
    p->col_offset = col_offset;
8109
304
    p->end_lineno = end_lineno;
8110
304
    p->end_col_offset = end_col_offset;
8111
304
    return p;
8112
304
}
8113
8114
expr_ty
8115
_PyAST_Compare(expr_ty left, asdl_int_seq * ops, asdl_expr_seq * comparators,
8116
               int lineno, int col_offset, int end_lineno, int end_col_offset,
8117
               PyArena *arena)
8118
11.0k
{
8119
11.0k
    expr_ty p;
8120
11.0k
    if (!left) {
8121
0
        PyErr_SetString(PyExc_ValueError,
8122
0
                        "field 'left' is required for Compare");
8123
0
        return NULL;
8124
0
    }
8125
11.0k
    p = (expr_ty)_PyArena_Malloc(arena, sizeof(*p));
8126
11.0k
    if (!p)
8127
0
        return NULL;
8128
11.0k
    p->kind = Compare_kind;
8129
11.0k
    p->v.Compare.left = left;
8130
11.0k
    p->v.Compare.ops = ops;
8131
11.0k
    p->v.Compare.comparators = comparators;
8132
11.0k
    p->lineno = lineno;
8133
11.0k
    p->col_offset = col_offset;
8134
11.0k
    p->end_lineno = end_lineno;
8135
11.0k
    p->end_col_offset = end_col_offset;
8136
11.0k
    return p;
8137
11.0k
}
8138
8139
expr_ty
8140
_PyAST_Call(expr_ty func, asdl_expr_seq * args, asdl_keyword_seq * keywords,
8141
            int lineno, int col_offset, int end_lineno, int end_col_offset,
8142
            PyArena *arena)
8143
82.3k
{
8144
82.3k
    expr_ty p;
8145
82.3k
    if (!func) {
8146
0
        PyErr_SetString(PyExc_ValueError,
8147
0
                        "field 'func' is required for Call");
8148
0
        return NULL;
8149
0
    }
8150
82.3k
    p = (expr_ty)_PyArena_Malloc(arena, sizeof(*p));
8151
82.3k
    if (!p)
8152
0
        return NULL;
8153
82.3k
    p->kind = Call_kind;
8154
82.3k
    p->v.Call.func = func;
8155
82.3k
    p->v.Call.args = args;
8156
82.3k
    p->v.Call.keywords = keywords;
8157
82.3k
    p->lineno = lineno;
8158
82.3k
    p->col_offset = col_offset;
8159
82.3k
    p->end_lineno = end_lineno;
8160
82.3k
    p->end_col_offset = end_col_offset;
8161
82.3k
    return p;
8162
82.3k
}
8163
8164
expr_ty
8165
_PyAST_FormattedValue(expr_ty value, int conversion, expr_ty format_spec, int
8166
                      lineno, int col_offset, int end_lineno, int
8167
                      end_col_offset, PyArena *arena)
8168
22.0k
{
8169
22.0k
    expr_ty p;
8170
22.0k
    if (!value) {
8171
0
        PyErr_SetString(PyExc_ValueError,
8172
0
                        "field 'value' is required for FormattedValue");
8173
0
        return NULL;
8174
0
    }
8175
22.0k
    p = (expr_ty)_PyArena_Malloc(arena, sizeof(*p));
8176
22.0k
    if (!p)
8177
0
        return NULL;
8178
22.0k
    p->kind = FormattedValue_kind;
8179
22.0k
    p->v.FormattedValue.value = value;
8180
22.0k
    p->v.FormattedValue.conversion = conversion;
8181
22.0k
    p->v.FormattedValue.format_spec = format_spec;
8182
22.0k
    p->lineno = lineno;
8183
22.0k
    p->col_offset = col_offset;
8184
22.0k
    p->end_lineno = end_lineno;
8185
22.0k
    p->end_col_offset = end_col_offset;
8186
22.0k
    return p;
8187
22.0k
}
8188
8189
expr_ty
8190
_PyAST_Interpolation(expr_ty value, constant str, int conversion, expr_ty
8191
                     format_spec, int lineno, int col_offset, int end_lineno,
8192
                     int end_col_offset, PyArena *arena)
8193
5.40k
{
8194
5.40k
    expr_ty p;
8195
5.40k
    if (!value) {
8196
0
        PyErr_SetString(PyExc_ValueError,
8197
0
                        "field 'value' is required for Interpolation");
8198
0
        return NULL;
8199
0
    }
8200
5.40k
    if (!str) {
8201
0
        PyErr_SetString(PyExc_ValueError,
8202
0
                        "field 'str' is required for Interpolation");
8203
0
        return NULL;
8204
0
    }
8205
5.40k
    p = (expr_ty)_PyArena_Malloc(arena, sizeof(*p));
8206
5.40k
    if (!p)
8207
0
        return NULL;
8208
5.40k
    p->kind = Interpolation_kind;
8209
5.40k
    p->v.Interpolation.value = value;
8210
5.40k
    p->v.Interpolation.str = str;
8211
5.40k
    p->v.Interpolation.conversion = conversion;
8212
5.40k
    p->v.Interpolation.format_spec = format_spec;
8213
5.40k
    p->lineno = lineno;
8214
5.40k
    p->col_offset = col_offset;
8215
5.40k
    p->end_lineno = end_lineno;
8216
5.40k
    p->end_col_offset = end_col_offset;
8217
5.40k
    return p;
8218
5.40k
}
8219
8220
expr_ty
8221
_PyAST_JoinedStr(asdl_expr_seq * values, int lineno, int col_offset, int
8222
                 end_lineno, int end_col_offset, PyArena *arena)
8223
34.4k
{
8224
34.4k
    expr_ty p;
8225
34.4k
    p = (expr_ty)_PyArena_Malloc(arena, sizeof(*p));
8226
34.4k
    if (!p)
8227
0
        return NULL;
8228
34.4k
    p->kind = JoinedStr_kind;
8229
34.4k
    p->v.JoinedStr.values = values;
8230
34.4k
    p->lineno = lineno;
8231
34.4k
    p->col_offset = col_offset;
8232
34.4k
    p->end_lineno = end_lineno;
8233
34.4k
    p->end_col_offset = end_col_offset;
8234
34.4k
    return p;
8235
34.4k
}
8236
8237
expr_ty
8238
_PyAST_TemplateStr(asdl_expr_seq * values, int lineno, int col_offset, int
8239
                   end_lineno, int end_col_offset, PyArena *arena)
8240
6.74k
{
8241
6.74k
    expr_ty p;
8242
6.74k
    p = (expr_ty)_PyArena_Malloc(arena, sizeof(*p));
8243
6.74k
    if (!p)
8244
0
        return NULL;
8245
6.74k
    p->kind = TemplateStr_kind;
8246
6.74k
    p->v.TemplateStr.values = values;
8247
6.74k
    p->lineno = lineno;
8248
6.74k
    p->col_offset = col_offset;
8249
6.74k
    p->end_lineno = end_lineno;
8250
6.74k
    p->end_col_offset = end_col_offset;
8251
6.74k
    return p;
8252
6.74k
}
8253
8254
expr_ty
8255
_PyAST_Constant(constant value, string kind, int lineno, int col_offset, int
8256
                end_lineno, int end_col_offset, PyArena *arena)
8257
425k
{
8258
425k
    expr_ty p;
8259
425k
    if (!value) {
8260
2
        PyErr_SetString(PyExc_ValueError,
8261
2
                        "field 'value' is required for Constant");
8262
2
        return NULL;
8263
2
    }
8264
425k
    p = (expr_ty)_PyArena_Malloc(arena, sizeof(*p));
8265
425k
    if (!p)
8266
0
        return NULL;
8267
425k
    p->kind = Constant_kind;
8268
425k
    p->v.Constant.value = value;
8269
425k
    p->v.Constant.kind = kind;
8270
425k
    p->lineno = lineno;
8271
425k
    p->col_offset = col_offset;
8272
425k
    p->end_lineno = end_lineno;
8273
425k
    p->end_col_offset = end_col_offset;
8274
425k
    return p;
8275
425k
}
8276
8277
expr_ty
8278
_PyAST_Attribute(expr_ty value, identifier attr, expr_context_ty ctx, int
8279
                 lineno, int col_offset, int end_lineno, int end_col_offset,
8280
                 PyArena *arena)
8281
43.4k
{
8282
43.4k
    expr_ty p;
8283
43.4k
    if (!value) {
8284
0
        PyErr_SetString(PyExc_ValueError,
8285
0
                        "field 'value' is required for Attribute");
8286
0
        return NULL;
8287
0
    }
8288
43.4k
    if (!attr) {
8289
0
        PyErr_SetString(PyExc_ValueError,
8290
0
                        "field 'attr' is required for Attribute");
8291
0
        return NULL;
8292
0
    }
8293
43.4k
    if (!ctx) {
8294
0
        PyErr_SetString(PyExc_ValueError,
8295
0
                        "field 'ctx' is required for Attribute");
8296
0
        return NULL;
8297
0
    }
8298
43.4k
    p = (expr_ty)_PyArena_Malloc(arena, sizeof(*p));
8299
43.4k
    if (!p)
8300
0
        return NULL;
8301
43.4k
    p->kind = Attribute_kind;
8302
43.4k
    p->v.Attribute.value = value;
8303
43.4k
    p->v.Attribute.attr = attr;
8304
43.4k
    p->v.Attribute.ctx = ctx;
8305
43.4k
    p->lineno = lineno;
8306
43.4k
    p->col_offset = col_offset;
8307
43.4k
    p->end_lineno = end_lineno;
8308
43.4k
    p->end_col_offset = end_col_offset;
8309
43.4k
    return p;
8310
43.4k
}
8311
8312
expr_ty
8313
_PyAST_Subscript(expr_ty value, expr_ty slice, expr_context_ty ctx, int lineno,
8314
                 int col_offset, int end_lineno, int end_col_offset, PyArena
8315
                 *arena)
8316
9.60k
{
8317
9.60k
    expr_ty p;
8318
9.60k
    if (!value) {
8319
0
        PyErr_SetString(PyExc_ValueError,
8320
0
                        "field 'value' is required for Subscript");
8321
0
        return NULL;
8322
0
    }
8323
9.60k
    if (!slice) {
8324
0
        PyErr_SetString(PyExc_ValueError,
8325
0
                        "field 'slice' is required for Subscript");
8326
0
        return NULL;
8327
0
    }
8328
9.60k
    if (!ctx) {
8329
0
        PyErr_SetString(PyExc_ValueError,
8330
0
                        "field 'ctx' is required for Subscript");
8331
0
        return NULL;
8332
0
    }
8333
9.60k
    p = (expr_ty)_PyArena_Malloc(arena, sizeof(*p));
8334
9.60k
    if (!p)
8335
0
        return NULL;
8336
9.60k
    p->kind = Subscript_kind;
8337
9.60k
    p->v.Subscript.value = value;
8338
9.60k
    p->v.Subscript.slice = slice;
8339
9.60k
    p->v.Subscript.ctx = ctx;
8340
9.60k
    p->lineno = lineno;
8341
9.60k
    p->col_offset = col_offset;
8342
9.60k
    p->end_lineno = end_lineno;
8343
9.60k
    p->end_col_offset = end_col_offset;
8344
9.60k
    return p;
8345
9.60k
}
8346
8347
expr_ty
8348
_PyAST_Starred(expr_ty value, expr_context_ty ctx, int lineno, int col_offset,
8349
               int end_lineno, int end_col_offset, PyArena *arena)
8350
21.7k
{
8351
21.7k
    expr_ty p;
8352
21.7k
    if (!value) {
8353
0
        PyErr_SetString(PyExc_ValueError,
8354
0
                        "field 'value' is required for Starred");
8355
0
        return NULL;
8356
0
    }
8357
21.7k
    if (!ctx) {
8358
0
        PyErr_SetString(PyExc_ValueError,
8359
0
                        "field 'ctx' is required for Starred");
8360
0
        return NULL;
8361
0
    }
8362
21.7k
    p = (expr_ty)_PyArena_Malloc(arena, sizeof(*p));
8363
21.7k
    if (!p)
8364
0
        return NULL;
8365
21.7k
    p->kind = Starred_kind;
8366
21.7k
    p->v.Starred.value = value;
8367
21.7k
    p->v.Starred.ctx = ctx;
8368
21.7k
    p->lineno = lineno;
8369
21.7k
    p->col_offset = col_offset;
8370
21.7k
    p->end_lineno = end_lineno;
8371
21.7k
    p->end_col_offset = end_col_offset;
8372
21.7k
    return p;
8373
21.7k
}
8374
8375
expr_ty
8376
_PyAST_Name(identifier id, expr_context_ty ctx, int lineno, int col_offset, int
8377
            end_lineno, int end_col_offset, PyArena *arena)
8378
2.66M
{
8379
2.66M
    expr_ty p;
8380
2.66M
    if (!id) {
8381
0
        PyErr_SetString(PyExc_ValueError,
8382
0
                        "field 'id' is required for Name");
8383
0
        return NULL;
8384
0
    }
8385
2.66M
    if (!ctx) {
8386
0
        PyErr_SetString(PyExc_ValueError,
8387
0
                        "field 'ctx' is required for Name");
8388
0
        return NULL;
8389
0
    }
8390
2.66M
    p = (expr_ty)_PyArena_Malloc(arena, sizeof(*p));
8391
2.66M
    if (!p)
8392
0
        return NULL;
8393
2.66M
    p->kind = Name_kind;
8394
2.66M
    p->v.Name.id = id;
8395
2.66M
    p->v.Name.ctx = ctx;
8396
2.66M
    p->lineno = lineno;
8397
2.66M
    p->col_offset = col_offset;
8398
2.66M
    p->end_lineno = end_lineno;
8399
2.66M
    p->end_col_offset = end_col_offset;
8400
2.66M
    return p;
8401
2.66M
}
8402
8403
expr_ty
8404
_PyAST_List(asdl_expr_seq * elts, expr_context_ty ctx, int lineno, int
8405
            col_offset, int end_lineno, int end_col_offset, PyArena *arena)
8406
21.7k
{
8407
21.7k
    expr_ty p;
8408
21.7k
    if (!ctx) {
8409
0
        PyErr_SetString(PyExc_ValueError,
8410
0
                        "field 'ctx' is required for List");
8411
0
        return NULL;
8412
0
    }
8413
21.7k
    p = (expr_ty)_PyArena_Malloc(arena, sizeof(*p));
8414
21.7k
    if (!p)
8415
0
        return NULL;
8416
21.7k
    p->kind = List_kind;
8417
21.7k
    p->v.List.elts = elts;
8418
21.7k
    p->v.List.ctx = ctx;
8419
21.7k
    p->lineno = lineno;
8420
21.7k
    p->col_offset = col_offset;
8421
21.7k
    p->end_lineno = end_lineno;
8422
21.7k
    p->end_col_offset = end_col_offset;
8423
21.7k
    return p;
8424
21.7k
}
8425
8426
expr_ty
8427
_PyAST_Tuple(asdl_expr_seq * elts, expr_context_ty ctx, int lineno, int
8428
             col_offset, int end_lineno, int end_col_offset, PyArena *arena)
8429
89.4k
{
8430
89.4k
    expr_ty p;
8431
89.4k
    if (!ctx) {
8432
0
        PyErr_SetString(PyExc_ValueError,
8433
0
                        "field 'ctx' is required for Tuple");
8434
0
        return NULL;
8435
0
    }
8436
89.4k
    p = (expr_ty)_PyArena_Malloc(arena, sizeof(*p));
8437
89.4k
    if (!p)
8438
0
        return NULL;
8439
89.4k
    p->kind = Tuple_kind;
8440
89.4k
    p->v.Tuple.elts = elts;
8441
89.4k
    p->v.Tuple.ctx = ctx;
8442
89.4k
    p->lineno = lineno;
8443
89.4k
    p->col_offset = col_offset;
8444
89.4k
    p->end_lineno = end_lineno;
8445
89.4k
    p->end_col_offset = end_col_offset;
8446
89.4k
    return p;
8447
89.4k
}
8448
8449
expr_ty
8450
_PyAST_Slice(expr_ty lower, expr_ty upper, expr_ty step, int lineno, int
8451
             col_offset, int end_lineno, int end_col_offset, PyArena *arena)
8452
14.7k
{
8453
14.7k
    expr_ty p;
8454
14.7k
    p = (expr_ty)_PyArena_Malloc(arena, sizeof(*p));
8455
14.7k
    if (!p)
8456
0
        return NULL;
8457
14.7k
    p->kind = Slice_kind;
8458
14.7k
    p->v.Slice.lower = lower;
8459
14.7k
    p->v.Slice.upper = upper;
8460
14.7k
    p->v.Slice.step = step;
8461
14.7k
    p->lineno = lineno;
8462
14.7k
    p->col_offset = col_offset;
8463
14.7k
    p->end_lineno = end_lineno;
8464
14.7k
    p->end_col_offset = end_col_offset;
8465
14.7k
    return p;
8466
14.7k
}
8467
8468
comprehension_ty
8469
_PyAST_comprehension(expr_ty target, expr_ty iter, asdl_expr_seq * ifs, int
8470
                     is_async, PyArena *arena)
8471
11.0k
{
8472
11.0k
    comprehension_ty p;
8473
11.0k
    if (!target) {
8474
0
        PyErr_SetString(PyExc_ValueError,
8475
0
                        "field 'target' is required for comprehension");
8476
0
        return NULL;
8477
0
    }
8478
11.0k
    if (!iter) {
8479
0
        PyErr_SetString(PyExc_ValueError,
8480
0
                        "field 'iter' is required for comprehension");
8481
0
        return NULL;
8482
0
    }
8483
11.0k
    p = (comprehension_ty)_PyArena_Malloc(arena, sizeof(*p));
8484
11.0k
    if (!p)
8485
0
        return NULL;
8486
11.0k
    p->target = target;
8487
11.0k
    p->iter = iter;
8488
11.0k
    p->ifs = ifs;
8489
11.0k
    p->is_async = is_async;
8490
11.0k
    return p;
8491
11.0k
}
8492
8493
excepthandler_ty
8494
_PyAST_ExceptHandler(expr_ty type, identifier name, asdl_stmt_seq * body, int
8495
                     lineno, int col_offset, int end_lineno, int
8496
                     end_col_offset, PyArena *arena)
8497
10.0k
{
8498
10.0k
    excepthandler_ty p;
8499
10.0k
    p = (excepthandler_ty)_PyArena_Malloc(arena, sizeof(*p));
8500
10.0k
    if (!p)
8501
0
        return NULL;
8502
10.0k
    p->kind = ExceptHandler_kind;
8503
10.0k
    p->v.ExceptHandler.type = type;
8504
10.0k
    p->v.ExceptHandler.name = name;
8505
10.0k
    p->v.ExceptHandler.body = body;
8506
10.0k
    p->lineno = lineno;
8507
10.0k
    p->col_offset = col_offset;
8508
10.0k
    p->end_lineno = end_lineno;
8509
10.0k
    p->end_col_offset = end_col_offset;
8510
10.0k
    return p;
8511
10.0k
}
8512
8513
arguments_ty
8514
_PyAST_arguments(asdl_arg_seq * posonlyargs, asdl_arg_seq * args, arg_ty
8515
                 vararg, asdl_arg_seq * kwonlyargs, asdl_expr_seq *
8516
                 kw_defaults, arg_ty kwarg, asdl_expr_seq * defaults, PyArena
8517
                 *arena)
8518
21.0k
{
8519
21.0k
    arguments_ty p;
8520
21.0k
    p = (arguments_ty)_PyArena_Malloc(arena, sizeof(*p));
8521
21.0k
    if (!p)
8522
0
        return NULL;
8523
21.0k
    p->posonlyargs = posonlyargs;
8524
21.0k
    p->args = args;
8525
21.0k
    p->vararg = vararg;
8526
21.0k
    p->kwonlyargs = kwonlyargs;
8527
21.0k
    p->kw_defaults = kw_defaults;
8528
21.0k
    p->kwarg = kwarg;
8529
21.0k
    p->defaults = defaults;
8530
21.0k
    return p;
8531
21.0k
}
8532
8533
arg_ty
8534
_PyAST_arg(identifier arg, expr_ty annotation, string type_comment, int lineno,
8535
           int col_offset, int end_lineno, int end_col_offset, PyArena *arena)
8536
689k
{
8537
689k
    arg_ty p;
8538
689k
    if (!arg) {
8539
0
        PyErr_SetString(PyExc_ValueError,
8540
0
                        "field 'arg' is required for arg");
8541
0
        return NULL;
8542
0
    }
8543
689k
    p = (arg_ty)_PyArena_Malloc(arena, sizeof(*p));
8544
689k
    if (!p)
8545
0
        return NULL;
8546
689k
    p->arg = arg;
8547
689k
    p->annotation = annotation;
8548
689k
    p->type_comment = type_comment;
8549
689k
    p->lineno = lineno;
8550
689k
    p->col_offset = col_offset;
8551
689k
    p->end_lineno = end_lineno;
8552
689k
    p->end_col_offset = end_col_offset;
8553
689k
    return p;
8554
689k
}
8555
8556
keyword_ty
8557
_PyAST_keyword(identifier arg, expr_ty value, int lineno, int col_offset, int
8558
               end_lineno, int end_col_offset, PyArena *arena)
8559
34.5k
{
8560
34.5k
    keyword_ty p;
8561
34.5k
    if (!value) {
8562
0
        PyErr_SetString(PyExc_ValueError,
8563
0
                        "field 'value' is required for keyword");
8564
0
        return NULL;
8565
0
    }
8566
34.5k
    p = (keyword_ty)_PyArena_Malloc(arena, sizeof(*p));
8567
34.5k
    if (!p)
8568
0
        return NULL;
8569
34.5k
    p->arg = arg;
8570
34.5k
    p->value = value;
8571
34.5k
    p->lineno = lineno;
8572
34.5k
    p->col_offset = col_offset;
8573
34.5k
    p->end_lineno = end_lineno;
8574
34.5k
    p->end_col_offset = end_col_offset;
8575
34.5k
    return p;
8576
34.5k
}
8577
8578
alias_ty
8579
_PyAST_alias(identifier name, identifier asname, int lineno, int col_offset,
8580
             int end_lineno, int end_col_offset, PyArena *arena)
8581
15.6k
{
8582
15.6k
    alias_ty p;
8583
15.6k
    if (!name) {
8584
0
        PyErr_SetString(PyExc_ValueError,
8585
0
                        "field 'name' is required for alias");
8586
0
        return NULL;
8587
0
    }
8588
15.6k
    p = (alias_ty)_PyArena_Malloc(arena, sizeof(*p));
8589
15.6k
    if (!p)
8590
0
        return NULL;
8591
15.6k
    p->name = name;
8592
15.6k
    p->asname = asname;
8593
15.6k
    p->lineno = lineno;
8594
15.6k
    p->col_offset = col_offset;
8595
15.6k
    p->end_lineno = end_lineno;
8596
15.6k
    p->end_col_offset = end_col_offset;
8597
15.6k
    return p;
8598
15.6k
}
8599
8600
withitem_ty
8601
_PyAST_withitem(expr_ty context_expr, expr_ty optional_vars, PyArena *arena)
8602
12.7k
{
8603
12.7k
    withitem_ty p;
8604
12.7k
    if (!context_expr) {
8605
0
        PyErr_SetString(PyExc_ValueError,
8606
0
                        "field 'context_expr' is required for withitem");
8607
0
        return NULL;
8608
0
    }
8609
12.7k
    p = (withitem_ty)_PyArena_Malloc(arena, sizeof(*p));
8610
12.7k
    if (!p)
8611
0
        return NULL;
8612
12.7k
    p->context_expr = context_expr;
8613
12.7k
    p->optional_vars = optional_vars;
8614
12.7k
    return p;
8615
12.7k
}
8616
8617
match_case_ty
8618
_PyAST_match_case(pattern_ty pattern, expr_ty guard, asdl_stmt_seq * body,
8619
                  PyArena *arena)
8620
4.00k
{
8621
4.00k
    match_case_ty p;
8622
4.00k
    if (!pattern) {
8623
0
        PyErr_SetString(PyExc_ValueError,
8624
0
                        "field 'pattern' is required for match_case");
8625
0
        return NULL;
8626
0
    }
8627
4.00k
    p = (match_case_ty)_PyArena_Malloc(arena, sizeof(*p));
8628
4.00k
    if (!p)
8629
0
        return NULL;
8630
4.00k
    p->pattern = pattern;
8631
4.00k
    p->guard = guard;
8632
4.00k
    p->body = body;
8633
4.00k
    return p;
8634
4.00k
}
8635
8636
pattern_ty
8637
_PyAST_MatchValue(expr_ty value, int lineno, int col_offset, int end_lineno,
8638
                  int end_col_offset, PyArena *arena)
8639
4.87k
{
8640
4.87k
    pattern_ty p;
8641
4.87k
    if (!value) {
8642
0
        PyErr_SetString(PyExc_ValueError,
8643
0
                        "field 'value' is required for MatchValue");
8644
0
        return NULL;
8645
0
    }
8646
4.87k
    p = (pattern_ty)_PyArena_Malloc(arena, sizeof(*p));
8647
4.87k
    if (!p)
8648
0
        return NULL;
8649
4.87k
    p->kind = MatchValue_kind;
8650
4.87k
    p->v.MatchValue.value = value;
8651
4.87k
    p->lineno = lineno;
8652
4.87k
    p->col_offset = col_offset;
8653
4.87k
    p->end_lineno = end_lineno;
8654
4.87k
    p->end_col_offset = end_col_offset;
8655
4.87k
    return p;
8656
4.87k
}
8657
8658
pattern_ty
8659
_PyAST_MatchSingleton(constant value, int lineno, int col_offset, int
8660
                      end_lineno, int end_col_offset, PyArena *arena)
8661
608
{
8662
608
    pattern_ty p;
8663
608
    if (!value) {
8664
0
        PyErr_SetString(PyExc_ValueError,
8665
0
                        "field 'value' is required for MatchSingleton");
8666
0
        return NULL;
8667
0
    }
8668
608
    p = (pattern_ty)_PyArena_Malloc(arena, sizeof(*p));
8669
608
    if (!p)
8670
0
        return NULL;
8671
608
    p->kind = MatchSingleton_kind;
8672
608
    p->v.MatchSingleton.value = value;
8673
608
    p->lineno = lineno;
8674
608
    p->col_offset = col_offset;
8675
608
    p->end_lineno = end_lineno;
8676
608
    p->end_col_offset = end_col_offset;
8677
608
    return p;
8678
608
}
8679
8680
pattern_ty
8681
_PyAST_MatchSequence(asdl_pattern_seq * patterns, int lineno, int col_offset,
8682
                     int end_lineno, int end_col_offset, PyArena *arena)
8683
3.87k
{
8684
3.87k
    pattern_ty p;
8685
3.87k
    p = (pattern_ty)_PyArena_Malloc(arena, sizeof(*p));
8686
3.87k
    if (!p)
8687
0
        return NULL;
8688
3.87k
    p->kind = MatchSequence_kind;
8689
3.87k
    p->v.MatchSequence.patterns = patterns;
8690
3.87k
    p->lineno = lineno;
8691
3.87k
    p->col_offset = col_offset;
8692
3.87k
    p->end_lineno = end_lineno;
8693
3.87k
    p->end_col_offset = end_col_offset;
8694
3.87k
    return p;
8695
3.87k
}
8696
8697
pattern_ty
8698
_PyAST_MatchMapping(asdl_expr_seq * keys, asdl_pattern_seq * patterns,
8699
                    identifier rest, int lineno, int col_offset, int
8700
                    end_lineno, int end_col_offset, PyArena *arena)
8701
2.64k
{
8702
2.64k
    pattern_ty p;
8703
2.64k
    p = (pattern_ty)_PyArena_Malloc(arena, sizeof(*p));
8704
2.64k
    if (!p)
8705
0
        return NULL;
8706
2.64k
    p->kind = MatchMapping_kind;
8707
2.64k
    p->v.MatchMapping.keys = keys;
8708
2.64k
    p->v.MatchMapping.patterns = patterns;
8709
2.64k
    p->v.MatchMapping.rest = rest;
8710
2.64k
    p->lineno = lineno;
8711
2.64k
    p->col_offset = col_offset;
8712
2.64k
    p->end_lineno = end_lineno;
8713
2.64k
    p->end_col_offset = end_col_offset;
8714
2.64k
    return p;
8715
2.64k
}
8716
8717
pattern_ty
8718
_PyAST_MatchClass(expr_ty cls, asdl_pattern_seq * patterns, asdl_identifier_seq
8719
                  * kwd_attrs, asdl_pattern_seq * kwd_patterns, int lineno, int
8720
                  col_offset, int end_lineno, int end_col_offset, PyArena
8721
                  *arena)
8722
2.91k
{
8723
2.91k
    pattern_ty p;
8724
2.91k
    if (!cls) {
8725
0
        PyErr_SetString(PyExc_ValueError,
8726
0
                        "field 'cls' is required for MatchClass");
8727
0
        return NULL;
8728
0
    }
8729
2.91k
    p = (pattern_ty)_PyArena_Malloc(arena, sizeof(*p));
8730
2.91k
    if (!p)
8731
0
        return NULL;
8732
2.91k
    p->kind = MatchClass_kind;
8733
2.91k
    p->v.MatchClass.cls = cls;
8734
2.91k
    p->v.MatchClass.patterns = patterns;
8735
2.91k
    p->v.MatchClass.kwd_attrs = kwd_attrs;
8736
2.91k
    p->v.MatchClass.kwd_patterns = kwd_patterns;
8737
2.91k
    p->lineno = lineno;
8738
2.91k
    p->col_offset = col_offset;
8739
2.91k
    p->end_lineno = end_lineno;
8740
2.91k
    p->end_col_offset = end_col_offset;
8741
2.91k
    return p;
8742
2.91k
}
8743
8744
pattern_ty
8745
_PyAST_MatchStar(identifier name, int lineno, int col_offset, int end_lineno,
8746
                 int end_col_offset, PyArena *arena)
8747
1.62k
{
8748
1.62k
    pattern_ty p;
8749
1.62k
    p = (pattern_ty)_PyArena_Malloc(arena, sizeof(*p));
8750
1.62k
    if (!p)
8751
0
        return NULL;
8752
1.62k
    p->kind = MatchStar_kind;
8753
1.62k
    p->v.MatchStar.name = name;
8754
1.62k
    p->lineno = lineno;
8755
1.62k
    p->col_offset = col_offset;
8756
1.62k
    p->end_lineno = end_lineno;
8757
1.62k
    p->end_col_offset = end_col_offset;
8758
1.62k
    return p;
8759
1.62k
}
8760
8761
pattern_ty
8762
_PyAST_MatchAs(pattern_ty pattern, identifier name, int lineno, int col_offset,
8763
               int end_lineno, int end_col_offset, PyArena *arena)
8764
22.9k
{
8765
22.9k
    pattern_ty p;
8766
22.9k
    p = (pattern_ty)_PyArena_Malloc(arena, sizeof(*p));
8767
22.9k
    if (!p)
8768
0
        return NULL;
8769
22.9k
    p->kind = MatchAs_kind;
8770
22.9k
    p->v.MatchAs.pattern = pattern;
8771
22.9k
    p->v.MatchAs.name = name;
8772
22.9k
    p->lineno = lineno;
8773
22.9k
    p->col_offset = col_offset;
8774
22.9k
    p->end_lineno = end_lineno;
8775
22.9k
    p->end_col_offset = end_col_offset;
8776
22.9k
    return p;
8777
22.9k
}
8778
8779
pattern_ty
8780
_PyAST_MatchOr(asdl_pattern_seq * patterns, int lineno, int col_offset, int
8781
               end_lineno, int end_col_offset, PyArena *arena)
8782
6.67k
{
8783
6.67k
    pattern_ty p;
8784
6.67k
    p = (pattern_ty)_PyArena_Malloc(arena, sizeof(*p));
8785
6.67k
    if (!p)
8786
0
        return NULL;
8787
6.67k
    p->kind = MatchOr_kind;
8788
6.67k
    p->v.MatchOr.patterns = patterns;
8789
6.67k
    p->lineno = lineno;
8790
6.67k
    p->col_offset = col_offset;
8791
6.67k
    p->end_lineno = end_lineno;
8792
6.67k
    p->end_col_offset = end_col_offset;
8793
6.67k
    return p;
8794
6.67k
}
8795
8796
type_ignore_ty
8797
_PyAST_TypeIgnore(int lineno, string tag, PyArena *arena)
8798
0
{
8799
0
    type_ignore_ty p;
8800
0
    if (!tag) {
8801
0
        PyErr_SetString(PyExc_ValueError,
8802
0
                        "field 'tag' is required for TypeIgnore");
8803
0
        return NULL;
8804
0
    }
8805
0
    p = (type_ignore_ty)_PyArena_Malloc(arena, sizeof(*p));
8806
0
    if (!p)
8807
0
        return NULL;
8808
0
    p->kind = TypeIgnore_kind;
8809
0
    p->v.TypeIgnore.lineno = lineno;
8810
0
    p->v.TypeIgnore.tag = tag;
8811
0
    return p;
8812
0
}
8813
8814
type_param_ty
8815
_PyAST_TypeVar(identifier name, expr_ty bound, expr_ty default_value, int
8816
               lineno, int col_offset, int end_lineno, int end_col_offset,
8817
               PyArena *arena)
8818
6.89k
{
8819
6.89k
    type_param_ty p;
8820
6.89k
    if (!name) {
8821
0
        PyErr_SetString(PyExc_ValueError,
8822
0
                        "field 'name' is required for TypeVar");
8823
0
        return NULL;
8824
0
    }
8825
6.89k
    p = (type_param_ty)_PyArena_Malloc(arena, sizeof(*p));
8826
6.89k
    if (!p)
8827
0
        return NULL;
8828
6.89k
    p->kind = TypeVar_kind;
8829
6.89k
    p->v.TypeVar.name = name;
8830
6.89k
    p->v.TypeVar.bound = bound;
8831
6.89k
    p->v.TypeVar.default_value = default_value;
8832
6.89k
    p->lineno = lineno;
8833
6.89k
    p->col_offset = col_offset;
8834
6.89k
    p->end_lineno = end_lineno;
8835
6.89k
    p->end_col_offset = end_col_offset;
8836
6.89k
    return p;
8837
6.89k
}
8838
8839
type_param_ty
8840
_PyAST_ParamSpec(identifier name, expr_ty default_value, int lineno, int
8841
                 col_offset, int end_lineno, int end_col_offset, PyArena *arena)
8842
970
{
8843
970
    type_param_ty p;
8844
970
    if (!name) {
8845
0
        PyErr_SetString(PyExc_ValueError,
8846
0
                        "field 'name' is required for ParamSpec");
8847
0
        return NULL;
8848
0
    }
8849
970
    p = (type_param_ty)_PyArena_Malloc(arena, sizeof(*p));
8850
970
    if (!p)
8851
0
        return NULL;
8852
970
    p->kind = ParamSpec_kind;
8853
970
    p->v.ParamSpec.name = name;
8854
970
    p->v.ParamSpec.default_value = default_value;
8855
970
    p->lineno = lineno;
8856
970
    p->col_offset = col_offset;
8857
970
    p->end_lineno = end_lineno;
8858
970
    p->end_col_offset = end_col_offset;
8859
970
    return p;
8860
970
}
8861
8862
type_param_ty
8863
_PyAST_TypeVarTuple(identifier name, expr_ty default_value, int lineno, int
8864
                    col_offset, int end_lineno, int end_col_offset, PyArena
8865
                    *arena)
8866
1.53k
{
8867
1.53k
    type_param_ty p;
8868
1.53k
    if (!name) {
8869
0
        PyErr_SetString(PyExc_ValueError,
8870
0
                        "field 'name' is required for TypeVarTuple");
8871
0
        return NULL;
8872
0
    }
8873
1.53k
    p = (type_param_ty)_PyArena_Malloc(arena, sizeof(*p));
8874
1.53k
    if (!p)
8875
0
        return NULL;
8876
1.53k
    p->kind = TypeVarTuple_kind;
8877
1.53k
    p->v.TypeVarTuple.name = name;
8878
1.53k
    p->v.TypeVarTuple.default_value = default_value;
8879
1.53k
    p->lineno = lineno;
8880
1.53k
    p->col_offset = col_offset;
8881
1.53k
    p->end_lineno = end_lineno;
8882
1.53k
    p->end_col_offset = end_col_offset;
8883
1.53k
    return p;
8884
1.53k
}
8885
8886
8887
PyObject*
8888
ast2obj_mod(struct ast_state *state, void* _o)
8889
6.73k
{
8890
6.73k
    mod_ty o = (mod_ty)_o;
8891
6.73k
    PyObject *result = NULL, *value = NULL;
8892
6.73k
    PyTypeObject *tp;
8893
6.73k
    if (!o) {
8894
0
        Py_RETURN_NONE;
8895
0
    }
8896
6.73k
    if (Py_EnterRecursiveCall("during  ast construction")) {
8897
0
        return NULL;
8898
0
    }
8899
6.73k
    switch (o->kind) {
8900
6.73k
    case Module_kind:
8901
6.73k
        tp = (PyTypeObject *)state->Module_type;
8902
6.73k
        result = PyType_GenericNew(tp, NULL, NULL);
8903
6.73k
        if (!result) goto failed;
8904
6.73k
        value = ast2obj_list(state, (asdl_seq*)o->v.Module.body, ast2obj_stmt);
8905
6.73k
        if (!value) goto failed;
8906
6.73k
        if (PyObject_SetAttr(result, state->body, value) == -1)
8907
0
            goto failed;
8908
6.73k
        Py_DECREF(value);
8909
6.73k
        value = ast2obj_list(state, (asdl_seq*)o->v.Module.type_ignores,
8910
6.73k
                             ast2obj_type_ignore);
8911
6.73k
        if (!value) goto failed;
8912
6.73k
        if (PyObject_SetAttr(result, state->type_ignores, value) == -1)
8913
0
            goto failed;
8914
6.73k
        Py_DECREF(value);
8915
6.73k
        break;
8916
0
    case Interactive_kind:
8917
0
        tp = (PyTypeObject *)state->Interactive_type;
8918
0
        result = PyType_GenericNew(tp, NULL, NULL);
8919
0
        if (!result) goto failed;
8920
0
        value = ast2obj_list(state, (asdl_seq*)o->v.Interactive.body,
8921
0
                             ast2obj_stmt);
8922
0
        if (!value) goto failed;
8923
0
        if (PyObject_SetAttr(result, state->body, value) == -1)
8924
0
            goto failed;
8925
0
        Py_DECREF(value);
8926
0
        break;
8927
0
    case Expression_kind:
8928
0
        tp = (PyTypeObject *)state->Expression_type;
8929
0
        result = PyType_GenericNew(tp, NULL, NULL);
8930
0
        if (!result) goto failed;
8931
0
        value = ast2obj_expr(state, o->v.Expression.body);
8932
0
        if (!value) goto failed;
8933
0
        if (PyObject_SetAttr(result, state->body, value) == -1)
8934
0
            goto failed;
8935
0
        Py_DECREF(value);
8936
0
        break;
8937
0
    case FunctionType_kind:
8938
0
        tp = (PyTypeObject *)state->FunctionType_type;
8939
0
        result = PyType_GenericNew(tp, NULL, NULL);
8940
0
        if (!result) goto failed;
8941
0
        value = ast2obj_list(state, (asdl_seq*)o->v.FunctionType.argtypes,
8942
0
                             ast2obj_expr);
8943
0
        if (!value) goto failed;
8944
0
        if (PyObject_SetAttr(result, state->argtypes, value) == -1)
8945
0
            goto failed;
8946
0
        Py_DECREF(value);
8947
0
        value = ast2obj_expr(state, o->v.FunctionType.returns);
8948
0
        if (!value) goto failed;
8949
0
        if (PyObject_SetAttr(result, state->returns, value) == -1)
8950
0
            goto failed;
8951
0
        Py_DECREF(value);
8952
0
        break;
8953
6.73k
    }
8954
6.73k
    Py_LeaveRecursiveCall();
8955
6.73k
    return result;
8956
0
failed:
8957
0
    Py_LeaveRecursiveCall();
8958
0
    Py_XDECREF(value);
8959
0
    Py_XDECREF(result);
8960
0
    return NULL;
8961
6.73k
}
8962
8963
PyObject*
8964
ast2obj_stmt(struct ast_state *state, void* _o)
8965
50.2k
{
8966
50.2k
    stmt_ty o = (stmt_ty)_o;
8967
50.2k
    PyObject *result = NULL, *value = NULL;
8968
50.2k
    PyTypeObject *tp;
8969
50.2k
    if (!o) {
8970
0
        Py_RETURN_NONE;
8971
0
    }
8972
50.2k
    if (Py_EnterRecursiveCall("during  ast construction")) {
8973
0
        return NULL;
8974
0
    }
8975
50.2k
    switch (o->kind) {
8976
1.77k
    case FunctionDef_kind:
8977
1.77k
        tp = (PyTypeObject *)state->FunctionDef_type;
8978
1.77k
        result = PyType_GenericNew(tp, NULL, NULL);
8979
1.77k
        if (!result) goto failed;
8980
1.77k
        value = ast2obj_identifier(state, o->v.FunctionDef.name);
8981
1.77k
        if (!value) goto failed;
8982
1.77k
        if (PyObject_SetAttr(result, state->name, value) == -1)
8983
0
            goto failed;
8984
1.77k
        Py_DECREF(value);
8985
1.77k
        value = ast2obj_arguments(state, o->v.FunctionDef.args);
8986
1.77k
        if (!value) goto failed;
8987
1.77k
        if (PyObject_SetAttr(result, state->args, value) == -1)
8988
0
            goto failed;
8989
1.77k
        Py_DECREF(value);
8990
1.77k
        value = ast2obj_list(state, (asdl_seq*)o->v.FunctionDef.body,
8991
1.77k
                             ast2obj_stmt);
8992
1.77k
        if (!value) goto failed;
8993
1.77k
        if (PyObject_SetAttr(result, state->body, value) == -1)
8994
0
            goto failed;
8995
1.77k
        Py_DECREF(value);
8996
1.77k
        value = ast2obj_list(state, (asdl_seq*)o->v.FunctionDef.decorator_list,
8997
1.77k
                             ast2obj_expr);
8998
1.77k
        if (!value) goto failed;
8999
1.77k
        if (PyObject_SetAttr(result, state->decorator_list, value) == -1)
9000
0
            goto failed;
9001
1.77k
        Py_DECREF(value);
9002
1.77k
        value = ast2obj_expr(state, o->v.FunctionDef.returns);
9003
1.77k
        if (!value) goto failed;
9004
1.77k
        if (PyObject_SetAttr(result, state->returns, value) == -1)
9005
0
            goto failed;
9006
1.77k
        Py_DECREF(value);
9007
1.77k
        value = ast2obj_string(state, o->v.FunctionDef.type_comment);
9008
1.77k
        if (!value) goto failed;
9009
1.77k
        if (PyObject_SetAttr(result, state->type_comment, value) == -1)
9010
0
            goto failed;
9011
1.77k
        Py_DECREF(value);
9012
1.77k
        value = ast2obj_list(state, (asdl_seq*)o->v.FunctionDef.type_params,
9013
1.77k
                             ast2obj_type_param);
9014
1.77k
        if (!value) goto failed;
9015
1.77k
        if (PyObject_SetAttr(result, state->type_params, value) == -1)
9016
0
            goto failed;
9017
1.77k
        Py_DECREF(value);
9018
1.77k
        break;
9019
367
    case AsyncFunctionDef_kind:
9020
367
        tp = (PyTypeObject *)state->AsyncFunctionDef_type;
9021
367
        result = PyType_GenericNew(tp, NULL, NULL);
9022
367
        if (!result) goto failed;
9023
367
        value = ast2obj_identifier(state, o->v.AsyncFunctionDef.name);
9024
367
        if (!value) goto failed;
9025
367
        if (PyObject_SetAttr(result, state->name, value) == -1)
9026
0
            goto failed;
9027
367
        Py_DECREF(value);
9028
367
        value = ast2obj_arguments(state, o->v.AsyncFunctionDef.args);
9029
367
        if (!value) goto failed;
9030
367
        if (PyObject_SetAttr(result, state->args, value) == -1)
9031
0
            goto failed;
9032
367
        Py_DECREF(value);
9033
367
        value = ast2obj_list(state, (asdl_seq*)o->v.AsyncFunctionDef.body,
9034
367
                             ast2obj_stmt);
9035
367
        if (!value) goto failed;
9036
367
        if (PyObject_SetAttr(result, state->body, value) == -1)
9037
0
            goto failed;
9038
367
        Py_DECREF(value);
9039
367
        value = ast2obj_list(state,
9040
367
                             (asdl_seq*)o->v.AsyncFunctionDef.decorator_list,
9041
367
                             ast2obj_expr);
9042
367
        if (!value) goto failed;
9043
367
        if (PyObject_SetAttr(result, state->decorator_list, value) == -1)
9044
0
            goto failed;
9045
367
        Py_DECREF(value);
9046
367
        value = ast2obj_expr(state, o->v.AsyncFunctionDef.returns);
9047
367
        if (!value) goto failed;
9048
367
        if (PyObject_SetAttr(result, state->returns, value) == -1)
9049
0
            goto failed;
9050
367
        Py_DECREF(value);
9051
367
        value = ast2obj_string(state, o->v.AsyncFunctionDef.type_comment);
9052
367
        if (!value) goto failed;
9053
367
        if (PyObject_SetAttr(result, state->type_comment, value) == -1)
9054
0
            goto failed;
9055
367
        Py_DECREF(value);
9056
367
        value = ast2obj_list(state,
9057
367
                             (asdl_seq*)o->v.AsyncFunctionDef.type_params,
9058
367
                             ast2obj_type_param);
9059
367
        if (!value) goto failed;
9060
367
        if (PyObject_SetAttr(result, state->type_params, value) == -1)
9061
0
            goto failed;
9062
367
        Py_DECREF(value);
9063
367
        break;
9064
873
    case ClassDef_kind:
9065
873
        tp = (PyTypeObject *)state->ClassDef_type;
9066
873
        result = PyType_GenericNew(tp, NULL, NULL);
9067
873
        if (!result) goto failed;
9068
873
        value = ast2obj_identifier(state, o->v.ClassDef.name);
9069
873
        if (!value) goto failed;
9070
873
        if (PyObject_SetAttr(result, state->name, value) == -1)
9071
0
            goto failed;
9072
873
        Py_DECREF(value);
9073
873
        value = ast2obj_list(state, (asdl_seq*)o->v.ClassDef.bases,
9074
873
                             ast2obj_expr);
9075
873
        if (!value) goto failed;
9076
873
        if (PyObject_SetAttr(result, state->bases, value) == -1)
9077
0
            goto failed;
9078
873
        Py_DECREF(value);
9079
873
        value = ast2obj_list(state, (asdl_seq*)o->v.ClassDef.keywords,
9080
873
                             ast2obj_keyword);
9081
873
        if (!value) goto failed;
9082
873
        if (PyObject_SetAttr(result, state->keywords, value) == -1)
9083
0
            goto failed;
9084
873
        Py_DECREF(value);
9085
873
        value = ast2obj_list(state, (asdl_seq*)o->v.ClassDef.body,
9086
873
                             ast2obj_stmt);
9087
873
        if (!value) goto failed;
9088
873
        if (PyObject_SetAttr(result, state->body, value) == -1)
9089
0
            goto failed;
9090
873
        Py_DECREF(value);
9091
873
        value = ast2obj_list(state, (asdl_seq*)o->v.ClassDef.decorator_list,
9092
873
                             ast2obj_expr);
9093
873
        if (!value) goto failed;
9094
873
        if (PyObject_SetAttr(result, state->decorator_list, value) == -1)
9095
0
            goto failed;
9096
873
        Py_DECREF(value);
9097
873
        value = ast2obj_list(state, (asdl_seq*)o->v.ClassDef.type_params,
9098
873
                             ast2obj_type_param);
9099
873
        if (!value) goto failed;
9100
873
        if (PyObject_SetAttr(result, state->type_params, value) == -1)
9101
0
            goto failed;
9102
873
        Py_DECREF(value);
9103
873
        break;
9104
2.50k
    case Return_kind:
9105
2.50k
        tp = (PyTypeObject *)state->Return_type;
9106
2.50k
        result = PyType_GenericNew(tp, NULL, NULL);
9107
2.50k
        if (!result) goto failed;
9108
2.50k
        value = ast2obj_expr(state, o->v.Return.value);
9109
2.50k
        if (!value) goto failed;
9110
2.50k
        if (PyObject_SetAttr(result, state->value, value) == -1)
9111
0
            goto failed;
9112
2.50k
        Py_DECREF(value);
9113
2.50k
        break;
9114
518
    case Delete_kind:
9115
518
        tp = (PyTypeObject *)state->Delete_type;
9116
518
        result = PyType_GenericNew(tp, NULL, NULL);
9117
518
        if (!result) goto failed;
9118
518
        value = ast2obj_list(state, (asdl_seq*)o->v.Delete.targets,
9119
518
                             ast2obj_expr);
9120
518
        if (!value) goto failed;
9121
518
        if (PyObject_SetAttr(result, state->targets, value) == -1)
9122
0
            goto failed;
9123
518
        Py_DECREF(value);
9124
518
        break;
9125
555
    case Assign_kind:
9126
555
        tp = (PyTypeObject *)state->Assign_type;
9127
555
        result = PyType_GenericNew(tp, NULL, NULL);
9128
555
        if (!result) goto failed;
9129
555
        value = ast2obj_list(state, (asdl_seq*)o->v.Assign.targets,
9130
555
                             ast2obj_expr);
9131
555
        if (!value) goto failed;
9132
555
        if (PyObject_SetAttr(result, state->targets, value) == -1)
9133
0
            goto failed;
9134
555
        Py_DECREF(value);
9135
555
        value = ast2obj_expr(state, o->v.Assign.value);
9136
555
        if (!value) goto failed;
9137
555
        if (PyObject_SetAttr(result, state->value, value) == -1)
9138
0
            goto failed;
9139
555
        Py_DECREF(value);
9140
555
        value = ast2obj_string(state, o->v.Assign.type_comment);
9141
555
        if (!value) goto failed;
9142
555
        if (PyObject_SetAttr(result, state->type_comment, value) == -1)
9143
0
            goto failed;
9144
555
        Py_DECREF(value);
9145
555
        break;
9146
74
    case TypeAlias_kind:
9147
74
        tp = (PyTypeObject *)state->TypeAlias_type;
9148
74
        result = PyType_GenericNew(tp, NULL, NULL);
9149
74
        if (!result) goto failed;
9150
74
        value = ast2obj_expr(state, o->v.TypeAlias.name);
9151
74
        if (!value) goto failed;
9152
74
        if (PyObject_SetAttr(result, state->name, value) == -1)
9153
0
            goto failed;
9154
74
        Py_DECREF(value);
9155
74
        value = ast2obj_list(state, (asdl_seq*)o->v.TypeAlias.type_params,
9156
74
                             ast2obj_type_param);
9157
74
        if (!value) goto failed;
9158
74
        if (PyObject_SetAttr(result, state->type_params, value) == -1)
9159
0
            goto failed;
9160
74
        Py_DECREF(value);
9161
74
        value = ast2obj_expr(state, o->v.TypeAlias.value);
9162
74
        if (!value) goto failed;
9163
74
        if (PyObject_SetAttr(result, state->value, value) == -1)
9164
0
            goto failed;
9165
74
        Py_DECREF(value);
9166
74
        break;
9167
223
    case AugAssign_kind:
9168
223
        tp = (PyTypeObject *)state->AugAssign_type;
9169
223
        result = PyType_GenericNew(tp, NULL, NULL);
9170
223
        if (!result) goto failed;
9171
223
        value = ast2obj_expr(state, o->v.AugAssign.target);
9172
223
        if (!value) goto failed;
9173
223
        if (PyObject_SetAttr(result, state->target, value) == -1)
9174
0
            goto failed;
9175
223
        Py_DECREF(value);
9176
223
        value = ast2obj_operator(state, o->v.AugAssign.op);
9177
223
        if (!value) goto failed;
9178
223
        if (PyObject_SetAttr(result, state->op, value) == -1)
9179
0
            goto failed;
9180
223
        Py_DECREF(value);
9181
223
        value = ast2obj_expr(state, o->v.AugAssign.value);
9182
223
        if (!value) goto failed;
9183
223
        if (PyObject_SetAttr(result, state->value, value) == -1)
9184
0
            goto failed;
9185
223
        Py_DECREF(value);
9186
223
        break;
9187
1.10k
    case AnnAssign_kind:
9188
1.10k
        tp = (PyTypeObject *)state->AnnAssign_type;
9189
1.10k
        result = PyType_GenericNew(tp, NULL, NULL);
9190
1.10k
        if (!result) goto failed;
9191
1.10k
        value = ast2obj_expr(state, o->v.AnnAssign.target);
9192
1.10k
        if (!value) goto failed;
9193
1.10k
        if (PyObject_SetAttr(result, state->target, value) == -1)
9194
0
            goto failed;
9195
1.10k
        Py_DECREF(value);
9196
1.10k
        value = ast2obj_expr(state, o->v.AnnAssign.annotation);
9197
1.10k
        if (!value) goto failed;
9198
1.10k
        if (PyObject_SetAttr(result, state->annotation, value) == -1)
9199
0
            goto failed;
9200
1.10k
        Py_DECREF(value);
9201
1.10k
        value = ast2obj_expr(state, o->v.AnnAssign.value);
9202
1.10k
        if (!value) goto failed;
9203
1.10k
        if (PyObject_SetAttr(result, state->value, value) == -1)
9204
0
            goto failed;
9205
1.10k
        Py_DECREF(value);
9206
1.10k
        value = ast2obj_int(state, o->v.AnnAssign.simple);
9207
1.10k
        if (!value) goto failed;
9208
1.10k
        if (PyObject_SetAttr(result, state->simple, value) == -1)
9209
0
            goto failed;
9210
1.10k
        Py_DECREF(value);
9211
1.10k
        break;
9212
273
    case For_kind:
9213
273
        tp = (PyTypeObject *)state->For_type;
9214
273
        result = PyType_GenericNew(tp, NULL, NULL);
9215
273
        if (!result) goto failed;
9216
273
        value = ast2obj_expr(state, o->v.For.target);
9217
273
        if (!value) goto failed;
9218
273
        if (PyObject_SetAttr(result, state->target, value) == -1)
9219
0
            goto failed;
9220
273
        Py_DECREF(value);
9221
273
        value = ast2obj_expr(state, o->v.For.iter);
9222
273
        if (!value) goto failed;
9223
273
        if (PyObject_SetAttr(result, state->iter, value) == -1)
9224
0
            goto failed;
9225
273
        Py_DECREF(value);
9226
273
        value = ast2obj_list(state, (asdl_seq*)o->v.For.body, ast2obj_stmt);
9227
273
        if (!value) goto failed;
9228
273
        if (PyObject_SetAttr(result, state->body, value) == -1)
9229
0
            goto failed;
9230
273
        Py_DECREF(value);
9231
273
        value = ast2obj_list(state, (asdl_seq*)o->v.For.orelse, ast2obj_stmt);
9232
273
        if (!value) goto failed;
9233
273
        if (PyObject_SetAttr(result, state->orelse, value) == -1)
9234
0
            goto failed;
9235
273
        Py_DECREF(value);
9236
273
        value = ast2obj_string(state, o->v.For.type_comment);
9237
273
        if (!value) goto failed;
9238
273
        if (PyObject_SetAttr(result, state->type_comment, value) == -1)
9239
0
            goto failed;
9240
273
        Py_DECREF(value);
9241
273
        break;
9242
72
    case AsyncFor_kind:
9243
72
        tp = (PyTypeObject *)state->AsyncFor_type;
9244
72
        result = PyType_GenericNew(tp, NULL, NULL);
9245
72
        if (!result) goto failed;
9246
72
        value = ast2obj_expr(state, o->v.AsyncFor.target);
9247
72
        if (!value) goto failed;
9248
72
        if (PyObject_SetAttr(result, state->target, value) == -1)
9249
0
            goto failed;
9250
72
        Py_DECREF(value);
9251
72
        value = ast2obj_expr(state, o->v.AsyncFor.iter);
9252
72
        if (!value) goto failed;
9253
72
        if (PyObject_SetAttr(result, state->iter, value) == -1)
9254
0
            goto failed;
9255
72
        Py_DECREF(value);
9256
72
        value = ast2obj_list(state, (asdl_seq*)o->v.AsyncFor.body,
9257
72
                             ast2obj_stmt);
9258
72
        if (!value) goto failed;
9259
72
        if (PyObject_SetAttr(result, state->body, value) == -1)
9260
0
            goto failed;
9261
72
        Py_DECREF(value);
9262
72
        value = ast2obj_list(state, (asdl_seq*)o->v.AsyncFor.orelse,
9263
72
                             ast2obj_stmt);
9264
72
        if (!value) goto failed;
9265
72
        if (PyObject_SetAttr(result, state->orelse, value) == -1)
9266
0
            goto failed;
9267
72
        Py_DECREF(value);
9268
72
        value = ast2obj_string(state, o->v.AsyncFor.type_comment);
9269
72
        if (!value) goto failed;
9270
72
        if (PyObject_SetAttr(result, state->type_comment, value) == -1)
9271
0
            goto failed;
9272
72
        Py_DECREF(value);
9273
72
        break;
9274
276
    case While_kind:
9275
276
        tp = (PyTypeObject *)state->While_type;
9276
276
        result = PyType_GenericNew(tp, NULL, NULL);
9277
276
        if (!result) goto failed;
9278
276
        value = ast2obj_expr(state, o->v.While.test);
9279
276
        if (!value) goto failed;
9280
276
        if (PyObject_SetAttr(result, state->test, value) == -1)
9281
0
            goto failed;
9282
276
        Py_DECREF(value);
9283
276
        value = ast2obj_list(state, (asdl_seq*)o->v.While.body, ast2obj_stmt);
9284
276
        if (!value) goto failed;
9285
276
        if (PyObject_SetAttr(result, state->body, value) == -1)
9286
0
            goto failed;
9287
276
        Py_DECREF(value);
9288
276
        value = ast2obj_list(state, (asdl_seq*)o->v.While.orelse, ast2obj_stmt);
9289
276
        if (!value) goto failed;
9290
276
        if (PyObject_SetAttr(result, state->orelse, value) == -1)
9291
0
            goto failed;
9292
276
        Py_DECREF(value);
9293
276
        break;
9294
384
    case If_kind:
9295
384
        tp = (PyTypeObject *)state->If_type;
9296
384
        result = PyType_GenericNew(tp, NULL, NULL);
9297
384
        if (!result) goto failed;
9298
384
        value = ast2obj_expr(state, o->v.If.test);
9299
384
        if (!value) goto failed;
9300
384
        if (PyObject_SetAttr(result, state->test, value) == -1)
9301
0
            goto failed;
9302
384
        Py_DECREF(value);
9303
384
        value = ast2obj_list(state, (asdl_seq*)o->v.If.body, ast2obj_stmt);
9304
384
        if (!value) goto failed;
9305
384
        if (PyObject_SetAttr(result, state->body, value) == -1)
9306
0
            goto failed;
9307
384
        Py_DECREF(value);
9308
384
        value = ast2obj_list(state, (asdl_seq*)o->v.If.orelse, ast2obj_stmt);
9309
384
        if (!value) goto failed;
9310
384
        if (PyObject_SetAttr(result, state->orelse, value) == -1)
9311
0
            goto failed;
9312
384
        Py_DECREF(value);
9313
384
        break;
9314
320
    case With_kind:
9315
320
        tp = (PyTypeObject *)state->With_type;
9316
320
        result = PyType_GenericNew(tp, NULL, NULL);
9317
320
        if (!result) goto failed;
9318
320
        value = ast2obj_list(state, (asdl_seq*)o->v.With.items,
9319
320
                             ast2obj_withitem);
9320
320
        if (!value) goto failed;
9321
320
        if (PyObject_SetAttr(result, state->items, value) == -1)
9322
0
            goto failed;
9323
320
        Py_DECREF(value);
9324
320
        value = ast2obj_list(state, (asdl_seq*)o->v.With.body, ast2obj_stmt);
9325
320
        if (!value) goto failed;
9326
320
        if (PyObject_SetAttr(result, state->body, value) == -1)
9327
0
            goto failed;
9328
320
        Py_DECREF(value);
9329
320
        value = ast2obj_string(state, o->v.With.type_comment);
9330
320
        if (!value) goto failed;
9331
320
        if (PyObject_SetAttr(result, state->type_comment, value) == -1)
9332
0
            goto failed;
9333
320
        Py_DECREF(value);
9334
320
        break;
9335
159
    case AsyncWith_kind:
9336
159
        tp = (PyTypeObject *)state->AsyncWith_type;
9337
159
        result = PyType_GenericNew(tp, NULL, NULL);
9338
159
        if (!result) goto failed;
9339
159
        value = ast2obj_list(state, (asdl_seq*)o->v.AsyncWith.items,
9340
159
                             ast2obj_withitem);
9341
159
        if (!value) goto failed;
9342
159
        if (PyObject_SetAttr(result, state->items, value) == -1)
9343
0
            goto failed;
9344
159
        Py_DECREF(value);
9345
159
        value = ast2obj_list(state, (asdl_seq*)o->v.AsyncWith.body,
9346
159
                             ast2obj_stmt);
9347
159
        if (!value) goto failed;
9348
159
        if (PyObject_SetAttr(result, state->body, value) == -1)
9349
0
            goto failed;
9350
159
        Py_DECREF(value);
9351
159
        value = ast2obj_string(state, o->v.AsyncWith.type_comment);
9352
159
        if (!value) goto failed;
9353
159
        if (PyObject_SetAttr(result, state->type_comment, value) == -1)
9354
0
            goto failed;
9355
159
        Py_DECREF(value);
9356
159
        break;
9357
270
    case Match_kind:
9358
270
        tp = (PyTypeObject *)state->Match_type;
9359
270
        result = PyType_GenericNew(tp, NULL, NULL);
9360
270
        if (!result) goto failed;
9361
270
        value = ast2obj_expr(state, o->v.Match.subject);
9362
270
        if (!value) goto failed;
9363
270
        if (PyObject_SetAttr(result, state->subject, value) == -1)
9364
0
            goto failed;
9365
270
        Py_DECREF(value);
9366
270
        value = ast2obj_list(state, (asdl_seq*)o->v.Match.cases,
9367
270
                             ast2obj_match_case);
9368
270
        if (!value) goto failed;
9369
270
        if (PyObject_SetAttr(result, state->cases, value) == -1)
9370
0
            goto failed;
9371
270
        Py_DECREF(value);
9372
270
        break;
9373
639
    case Raise_kind:
9374
639
        tp = (PyTypeObject *)state->Raise_type;
9375
639
        result = PyType_GenericNew(tp, NULL, NULL);
9376
639
        if (!result) goto failed;
9377
639
        value = ast2obj_expr(state, o->v.Raise.exc);
9378
639
        if (!value) goto failed;
9379
639
        if (PyObject_SetAttr(result, state->exc, value) == -1)
9380
0
            goto failed;
9381
639
        Py_DECREF(value);
9382
639
        value = ast2obj_expr(state, o->v.Raise.cause);
9383
639
        if (!value) goto failed;
9384
639
        if (PyObject_SetAttr(result, state->cause, value) == -1)
9385
0
            goto failed;
9386
639
        Py_DECREF(value);
9387
639
        break;
9388
732
    case Try_kind:
9389
732
        tp = (PyTypeObject *)state->Try_type;
9390
732
        result = PyType_GenericNew(tp, NULL, NULL);
9391
732
        if (!result) goto failed;
9392
732
        value = ast2obj_list(state, (asdl_seq*)o->v.Try.body, ast2obj_stmt);
9393
732
        if (!value) goto failed;
9394
732
        if (PyObject_SetAttr(result, state->body, value) == -1)
9395
0
            goto failed;
9396
732
        Py_DECREF(value);
9397
732
        value = ast2obj_list(state, (asdl_seq*)o->v.Try.handlers,
9398
732
                             ast2obj_excepthandler);
9399
732
        if (!value) goto failed;
9400
732
        if (PyObject_SetAttr(result, state->handlers, value) == -1)
9401
0
            goto failed;
9402
732
        Py_DECREF(value);
9403
732
        value = ast2obj_list(state, (asdl_seq*)o->v.Try.orelse, ast2obj_stmt);
9404
732
        if (!value) goto failed;
9405
732
        if (PyObject_SetAttr(result, state->orelse, value) == -1)
9406
0
            goto failed;
9407
732
        Py_DECREF(value);
9408
732
        value = ast2obj_list(state, (asdl_seq*)o->v.Try.finalbody,
9409
732
                             ast2obj_stmt);
9410
732
        if (!value) goto failed;
9411
732
        if (PyObject_SetAttr(result, state->finalbody, value) == -1)
9412
0
            goto failed;
9413
732
        Py_DECREF(value);
9414
732
        break;
9415
429
    case TryStar_kind:
9416
429
        tp = (PyTypeObject *)state->TryStar_type;
9417
429
        result = PyType_GenericNew(tp, NULL, NULL);
9418
429
        if (!result) goto failed;
9419
429
        value = ast2obj_list(state, (asdl_seq*)o->v.TryStar.body, ast2obj_stmt);
9420
429
        if (!value) goto failed;
9421
429
        if (PyObject_SetAttr(result, state->body, value) == -1)
9422
0
            goto failed;
9423
429
        Py_DECREF(value);
9424
429
        value = ast2obj_list(state, (asdl_seq*)o->v.TryStar.handlers,
9425
429
                             ast2obj_excepthandler);
9426
429
        if (!value) goto failed;
9427
429
        if (PyObject_SetAttr(result, state->handlers, value) == -1)
9428
0
            goto failed;
9429
429
        Py_DECREF(value);
9430
429
        value = ast2obj_list(state, (asdl_seq*)o->v.TryStar.orelse,
9431
429
                             ast2obj_stmt);
9432
429
        if (!value) goto failed;
9433
429
        if (PyObject_SetAttr(result, state->orelse, value) == -1)
9434
0
            goto failed;
9435
429
        Py_DECREF(value);
9436
429
        value = ast2obj_list(state, (asdl_seq*)o->v.TryStar.finalbody,
9437
429
                             ast2obj_stmt);
9438
429
        if (!value) goto failed;
9439
429
        if (PyObject_SetAttr(result, state->finalbody, value) == -1)
9440
0
            goto failed;
9441
429
        Py_DECREF(value);
9442
429
        break;
9443
268
    case Assert_kind:
9444
268
        tp = (PyTypeObject *)state->Assert_type;
9445
268
        result = PyType_GenericNew(tp, NULL, NULL);
9446
268
        if (!result) goto failed;
9447
268
        value = ast2obj_expr(state, o->v.Assert.test);
9448
268
        if (!value) goto failed;
9449
268
        if (PyObject_SetAttr(result, state->test, value) == -1)
9450
0
            goto failed;
9451
268
        Py_DECREF(value);
9452
268
        value = ast2obj_expr(state, o->v.Assert.msg);
9453
268
        if (!value) goto failed;
9454
268
        if (PyObject_SetAttr(result, state->msg, value) == -1)
9455
0
            goto failed;
9456
268
        Py_DECREF(value);
9457
268
        break;
9458
806
    case Import_kind:
9459
806
        tp = (PyTypeObject *)state->Import_type;
9460
806
        result = PyType_GenericNew(tp, NULL, NULL);
9461
806
        if (!result) goto failed;
9462
806
        value = ast2obj_list(state, (asdl_seq*)o->v.Import.names,
9463
806
                             ast2obj_alias);
9464
806
        if (!value) goto failed;
9465
806
        if (PyObject_SetAttr(result, state->names, value) == -1)
9466
0
            goto failed;
9467
806
        Py_DECREF(value);
9468
806
        break;
9469
876
    case ImportFrom_kind:
9470
876
        tp = (PyTypeObject *)state->ImportFrom_type;
9471
876
        result = PyType_GenericNew(tp, NULL, NULL);
9472
876
        if (!result) goto failed;
9473
876
        value = ast2obj_identifier(state, o->v.ImportFrom.module);
9474
876
        if (!value) goto failed;
9475
876
        if (PyObject_SetAttr(result, state->module, value) == -1)
9476
0
            goto failed;
9477
876
        Py_DECREF(value);
9478
876
        value = ast2obj_list(state, (asdl_seq*)o->v.ImportFrom.names,
9479
876
                             ast2obj_alias);
9480
876
        if (!value) goto failed;
9481
876
        if (PyObject_SetAttr(result, state->names, value) == -1)
9482
0
            goto failed;
9483
876
        Py_DECREF(value);
9484
876
        value = ast2obj_int(state, o->v.ImportFrom.level);
9485
876
        if (!value) goto failed;
9486
876
        if (PyObject_SetAttr(result, state->level, value) == -1)
9487
0
            goto failed;
9488
876
        Py_DECREF(value);
9489
876
        break;
9490
212
    case Global_kind:
9491
212
        tp = (PyTypeObject *)state->Global_type;
9492
212
        result = PyType_GenericNew(tp, NULL, NULL);
9493
212
        if (!result) goto failed;
9494
212
        value = ast2obj_list(state, (asdl_seq*)o->v.Global.names,
9495
212
                             ast2obj_identifier);
9496
212
        if (!value) goto failed;
9497
212
        if (PyObject_SetAttr(result, state->names, value) == -1)
9498
0
            goto failed;
9499
212
        Py_DECREF(value);
9500
212
        break;
9501
253
    case Nonlocal_kind:
9502
253
        tp = (PyTypeObject *)state->Nonlocal_type;
9503
253
        result = PyType_GenericNew(tp, NULL, NULL);
9504
253
        if (!result) goto failed;
9505
253
        value = ast2obj_list(state, (asdl_seq*)o->v.Nonlocal.names,
9506
253
                             ast2obj_identifier);
9507
253
        if (!value) goto failed;
9508
253
        if (PyObject_SetAttr(result, state->names, value) == -1)
9509
0
            goto failed;
9510
253
        Py_DECREF(value);
9511
253
        break;
9512
35.5k
    case Expr_kind:
9513
35.5k
        tp = (PyTypeObject *)state->Expr_type;
9514
35.5k
        result = PyType_GenericNew(tp, NULL, NULL);
9515
35.5k
        if (!result) goto failed;
9516
35.5k
        value = ast2obj_expr(state, o->v.Expr.value);
9517
35.5k
        if (!value) goto failed;
9518
35.5k
        if (PyObject_SetAttr(result, state->value, value) == -1)
9519
0
            goto failed;
9520
35.5k
        Py_DECREF(value);
9521
35.5k
        break;
9522
221
    case Pass_kind:
9523
221
        tp = (PyTypeObject *)state->Pass_type;
9524
221
        result = PyType_GenericNew(tp, NULL, NULL);
9525
221
        if (!result) goto failed;
9526
221
        break;
9527
378
    case Break_kind:
9528
378
        tp = (PyTypeObject *)state->Break_type;
9529
378
        result = PyType_GenericNew(tp, NULL, NULL);
9530
378
        if (!result) goto failed;
9531
378
        break;
9532
378
    case Continue_kind:
9533
195
        tp = (PyTypeObject *)state->Continue_type;
9534
195
        result = PyType_GenericNew(tp, NULL, NULL);
9535
195
        if (!result) goto failed;
9536
195
        break;
9537
50.2k
    }
9538
50.2k
    value = ast2obj_int(state, o->lineno);
9539
50.2k
    if (!value) goto failed;
9540
50.2k
    if (PyObject_SetAttr(result, state->lineno, value) < 0)
9541
0
        goto failed;
9542
50.2k
    Py_DECREF(value);
9543
50.2k
    value = ast2obj_int(state, o->col_offset);
9544
50.2k
    if (!value) goto failed;
9545
50.2k
    if (PyObject_SetAttr(result, state->col_offset, value) < 0)
9546
0
        goto failed;
9547
50.2k
    Py_DECREF(value);
9548
50.2k
    value = ast2obj_int(state, o->end_lineno);
9549
50.2k
    if (!value) goto failed;
9550
50.2k
    if (PyObject_SetAttr(result, state->end_lineno, value) < 0)
9551
0
        goto failed;
9552
50.2k
    Py_DECREF(value);
9553
50.2k
    value = ast2obj_int(state, o->end_col_offset);
9554
50.2k
    if (!value) goto failed;
9555
50.2k
    if (PyObject_SetAttr(result, state->end_col_offset, value) < 0)
9556
0
        goto failed;
9557
50.2k
    Py_DECREF(value);
9558
50.2k
    Py_LeaveRecursiveCall();
9559
50.2k
    return result;
9560
0
failed:
9561
0
    Py_LeaveRecursiveCall();
9562
0
    Py_XDECREF(value);
9563
0
    Py_XDECREF(result);
9564
0
    return NULL;
9565
50.2k
}
9566
9567
PyObject*
9568
ast2obj_expr(struct ast_state *state, void* _o)
9569
429k
{
9570
429k
    expr_ty o = (expr_ty)_o;
9571
429k
    PyObject *result = NULL, *value = NULL;
9572
429k
    PyTypeObject *tp;
9573
429k
    if (!o) {
9574
52.9k
        Py_RETURN_NONE;
9575
52.9k
    }
9576
376k
    if (Py_EnterRecursiveCall("during  ast construction")) {
9577
0
        return NULL;
9578
0
    }
9579
376k
    switch (o->kind) {
9580
700
    case BoolOp_kind:
9581
700
        tp = (PyTypeObject *)state->BoolOp_type;
9582
700
        result = PyType_GenericNew(tp, NULL, NULL);
9583
700
        if (!result) goto failed;
9584
700
        value = ast2obj_boolop(state, o->v.BoolOp.op);
9585
700
        if (!value) goto failed;
9586
700
        if (PyObject_SetAttr(result, state->op, value) == -1)
9587
0
            goto failed;
9588
700
        Py_DECREF(value);
9589
700
        value = ast2obj_list(state, (asdl_seq*)o->v.BoolOp.values,
9590
700
                             ast2obj_expr);
9591
700
        if (!value) goto failed;
9592
700
        if (PyObject_SetAttr(result, state->values, value) == -1)
9593
0
            goto failed;
9594
700
        Py_DECREF(value);
9595
700
        break;
9596
67
    case NamedExpr_kind:
9597
67
        tp = (PyTypeObject *)state->NamedExpr_type;
9598
67
        result = PyType_GenericNew(tp, NULL, NULL);
9599
67
        if (!result) goto failed;
9600
67
        value = ast2obj_expr(state, o->v.NamedExpr.target);
9601
67
        if (!value) goto failed;
9602
67
        if (PyObject_SetAttr(result, state->target, value) == -1)
9603
0
            goto failed;
9604
67
        Py_DECREF(value);
9605
67
        value = ast2obj_expr(state, o->v.NamedExpr.value);
9606
67
        if (!value) goto failed;
9607
67
        if (PyObject_SetAttr(result, state->value, value) == -1)
9608
0
            goto failed;
9609
67
        Py_DECREF(value);
9610
67
        break;
9611
23.2k
    case BinOp_kind:
9612
23.2k
        tp = (PyTypeObject *)state->BinOp_type;
9613
23.2k
        result = PyType_GenericNew(tp, NULL, NULL);
9614
23.2k
        if (!result) goto failed;
9615
23.2k
        value = ast2obj_expr(state, o->v.BinOp.left);
9616
23.2k
        if (!value) goto failed;
9617
23.2k
        if (PyObject_SetAttr(result, state->left, value) == -1)
9618
0
            goto failed;
9619
23.2k
        Py_DECREF(value);
9620
23.2k
        value = ast2obj_operator(state, o->v.BinOp.op);
9621
23.2k
        if (!value) goto failed;
9622
23.2k
        if (PyObject_SetAttr(result, state->op, value) == -1)
9623
0
            goto failed;
9624
23.2k
        Py_DECREF(value);
9625
23.2k
        value = ast2obj_expr(state, o->v.BinOp.right);
9626
23.2k
        if (!value) goto failed;
9627
23.2k
        if (PyObject_SetAttr(result, state->right, value) == -1)
9628
0
            goto failed;
9629
23.2k
        Py_DECREF(value);
9630
23.2k
        break;
9631
161k
    case UnaryOp_kind:
9632
161k
        tp = (PyTypeObject *)state->UnaryOp_type;
9633
161k
        result = PyType_GenericNew(tp, NULL, NULL);
9634
161k
        if (!result) goto failed;
9635
161k
        value = ast2obj_unaryop(state, o->v.UnaryOp.op);
9636
161k
        if (!value) goto failed;
9637
161k
        if (PyObject_SetAttr(result, state->op, value) == -1)
9638
0
            goto failed;
9639
161k
        Py_DECREF(value);
9640
161k
        value = ast2obj_expr(state, o->v.UnaryOp.operand);
9641
161k
        if (!value) goto failed;
9642
161k
        if (PyObject_SetAttr(result, state->operand, value) == -1)
9643
0
            goto failed;
9644
161k
        Py_DECREF(value);
9645
161k
        break;
9646
1.32k
    case Lambda_kind:
9647
1.32k
        tp = (PyTypeObject *)state->Lambda_type;
9648
1.32k
        result = PyType_GenericNew(tp, NULL, NULL);
9649
1.32k
        if (!result) goto failed;
9650
1.32k
        value = ast2obj_arguments(state, o->v.Lambda.args);
9651
1.32k
        if (!value) goto failed;
9652
1.32k
        if (PyObject_SetAttr(result, state->args, value) == -1)
9653
0
            goto failed;
9654
1.32k
        Py_DECREF(value);
9655
1.32k
        value = ast2obj_expr(state, o->v.Lambda.body);
9656
1.32k
        if (!value) goto failed;
9657
1.32k
        if (PyObject_SetAttr(result, state->body, value) == -1)
9658
0
            goto failed;
9659
1.32k
        Py_DECREF(value);
9660
1.32k
        break;
9661
198
    case IfExp_kind:
9662
198
        tp = (PyTypeObject *)state->IfExp_type;
9663
198
        result = PyType_GenericNew(tp, NULL, NULL);
9664
198
        if (!result) goto failed;
9665
198
        value = ast2obj_expr(state, o->v.IfExp.test);
9666
198
        if (!value) goto failed;
9667
198
        if (PyObject_SetAttr(result, state->test, value) == -1)
9668
0
            goto failed;
9669
198
        Py_DECREF(value);
9670
198
        value = ast2obj_expr(state, o->v.IfExp.body);
9671
198
        if (!value) goto failed;
9672
198
        if (PyObject_SetAttr(result, state->body, value) == -1)
9673
0
            goto failed;
9674
198
        Py_DECREF(value);
9675
198
        value = ast2obj_expr(state, o->v.IfExp.orelse);
9676
198
        if (!value) goto failed;
9677
198
        if (PyObject_SetAttr(result, state->orelse, value) == -1)
9678
0
            goto failed;
9679
198
        Py_DECREF(value);
9680
198
        break;
9681
1.41k
    case Dict_kind:
9682
1.41k
        tp = (PyTypeObject *)state->Dict_type;
9683
1.41k
        result = PyType_GenericNew(tp, NULL, NULL);
9684
1.41k
        if (!result) goto failed;
9685
1.41k
        value = ast2obj_list(state, (asdl_seq*)o->v.Dict.keys, ast2obj_expr);
9686
1.41k
        if (!value) goto failed;
9687
1.41k
        if (PyObject_SetAttr(result, state->keys, value) == -1)
9688
0
            goto failed;
9689
1.41k
        Py_DECREF(value);
9690
1.41k
        value = ast2obj_list(state, (asdl_seq*)o->v.Dict.values, ast2obj_expr);
9691
1.41k
        if (!value) goto failed;
9692
1.41k
        if (PyObject_SetAttr(result, state->values, value) == -1)
9693
0
            goto failed;
9694
1.41k
        Py_DECREF(value);
9695
1.41k
        break;
9696
391
    case Set_kind:
9697
391
        tp = (PyTypeObject *)state->Set_type;
9698
391
        result = PyType_GenericNew(tp, NULL, NULL);
9699
391
        if (!result) goto failed;
9700
391
        value = ast2obj_list(state, (asdl_seq*)o->v.Set.elts, ast2obj_expr);
9701
391
        if (!value) goto failed;
9702
391
        if (PyObject_SetAttr(result, state->elts, value) == -1)
9703
0
            goto failed;
9704
391
        Py_DECREF(value);
9705
391
        break;
9706
352
    case ListComp_kind:
9707
352
        tp = (PyTypeObject *)state->ListComp_type;
9708
352
        result = PyType_GenericNew(tp, NULL, NULL);
9709
352
        if (!result) goto failed;
9710
352
        value = ast2obj_expr(state, o->v.ListComp.elt);
9711
352
        if (!value) goto failed;
9712
352
        if (PyObject_SetAttr(result, state->elt, value) == -1)
9713
0
            goto failed;
9714
352
        Py_DECREF(value);
9715
352
        value = ast2obj_list(state, (asdl_seq*)o->v.ListComp.generators,
9716
352
                             ast2obj_comprehension);
9717
352
        if (!value) goto failed;
9718
352
        if (PyObject_SetAttr(result, state->generators, value) == -1)
9719
0
            goto failed;
9720
352
        Py_DECREF(value);
9721
352
        break;
9722
137
    case SetComp_kind:
9723
137
        tp = (PyTypeObject *)state->SetComp_type;
9724
137
        result = PyType_GenericNew(tp, NULL, NULL);
9725
137
        if (!result) goto failed;
9726
137
        value = ast2obj_expr(state, o->v.SetComp.elt);
9727
137
        if (!value) goto failed;
9728
137
        if (PyObject_SetAttr(result, state->elt, value) == -1)
9729
0
            goto failed;
9730
137
        Py_DECREF(value);
9731
137
        value = ast2obj_list(state, (asdl_seq*)o->v.SetComp.generators,
9732
137
                             ast2obj_comprehension);
9733
137
        if (!value) goto failed;
9734
137
        if (PyObject_SetAttr(result, state->generators, value) == -1)
9735
0
            goto failed;
9736
137
        Py_DECREF(value);
9737
137
        break;
9738
587
    case DictComp_kind:
9739
587
        tp = (PyTypeObject *)state->DictComp_type;
9740
587
        result = PyType_GenericNew(tp, NULL, NULL);
9741
587
        if (!result) goto failed;
9742
587
        value = ast2obj_expr(state, o->v.DictComp.key);
9743
587
        if (!value) goto failed;
9744
587
        if (PyObject_SetAttr(result, state->key, value) == -1)
9745
0
            goto failed;
9746
587
        Py_DECREF(value);
9747
587
        value = ast2obj_expr(state, o->v.DictComp.value);
9748
587
        if (!value) goto failed;
9749
587
        if (PyObject_SetAttr(result, state->value, value) == -1)
9750
0
            goto failed;
9751
587
        Py_DECREF(value);
9752
587
        value = ast2obj_list(state, (asdl_seq*)o->v.DictComp.generators,
9753
587
                             ast2obj_comprehension);
9754
587
        if (!value) goto failed;
9755
587
        if (PyObject_SetAttr(result, state->generators, value) == -1)
9756
0
            goto failed;
9757
587
        Py_DECREF(value);
9758
587
        break;
9759
472
    case GeneratorExp_kind:
9760
472
        tp = (PyTypeObject *)state->GeneratorExp_type;
9761
472
        result = PyType_GenericNew(tp, NULL, NULL);
9762
472
        if (!result) goto failed;
9763
472
        value = ast2obj_expr(state, o->v.GeneratorExp.elt);
9764
472
        if (!value) goto failed;
9765
472
        if (PyObject_SetAttr(result, state->elt, value) == -1)
9766
0
            goto failed;
9767
472
        Py_DECREF(value);
9768
472
        value = ast2obj_list(state, (asdl_seq*)o->v.GeneratorExp.generators,
9769
472
                             ast2obj_comprehension);
9770
472
        if (!value) goto failed;
9771
472
        if (PyObject_SetAttr(result, state->generators, value) == -1)
9772
0
            goto failed;
9773
472
        Py_DECREF(value);
9774
472
        break;
9775
194
    case Await_kind:
9776
194
        tp = (PyTypeObject *)state->Await_type;
9777
194
        result = PyType_GenericNew(tp, NULL, NULL);
9778
194
        if (!result) goto failed;
9779
194
        value = ast2obj_expr(state, o->v.Await.value);
9780
194
        if (!value) goto failed;
9781
194
        if (PyObject_SetAttr(result, state->value, value) == -1)
9782
0
            goto failed;
9783
194
        Py_DECREF(value);
9784
194
        break;
9785
913
    case Yield_kind:
9786
913
        tp = (PyTypeObject *)state->Yield_type;
9787
913
        result = PyType_GenericNew(tp, NULL, NULL);
9788
913
        if (!result) goto failed;
9789
913
        value = ast2obj_expr(state, o->v.Yield.value);
9790
913
        if (!value) goto failed;
9791
913
        if (PyObject_SetAttr(result, state->value, value) == -1)
9792
0
            goto failed;
9793
913
        Py_DECREF(value);
9794
913
        break;
9795
66
    case YieldFrom_kind:
9796
66
        tp = (PyTypeObject *)state->YieldFrom_type;
9797
66
        result = PyType_GenericNew(tp, NULL, NULL);
9798
66
        if (!result) goto failed;
9799
66
        value = ast2obj_expr(state, o->v.YieldFrom.value);
9800
66
        if (!value) goto failed;
9801
66
        if (PyObject_SetAttr(result, state->value, value) == -1)
9802
0
            goto failed;
9803
66
        Py_DECREF(value);
9804
66
        break;
9805
3.19k
    case Compare_kind:
9806
3.19k
        tp = (PyTypeObject *)state->Compare_type;
9807
3.19k
        result = PyType_GenericNew(tp, NULL, NULL);
9808
3.19k
        if (!result) goto failed;
9809
3.19k
        value = ast2obj_expr(state, o->v.Compare.left);
9810
3.19k
        if (!value) goto failed;
9811
3.19k
        if (PyObject_SetAttr(result, state->left, value) == -1)
9812
0
            goto failed;
9813
3.19k
        Py_DECREF(value);
9814
3.19k
        {
9815
3.19k
            Py_ssize_t i, n = asdl_seq_LEN(o->v.Compare.ops);
9816
3.19k
            value = PyList_New(n);
9817
3.19k
            if (!value) goto failed;
9818
15.5k
            for(i = 0; i < n; i++)
9819
12.4k
                PyList_SET_ITEM(value, i, ast2obj_cmpop(state, (cmpop_ty)asdl_seq_GET(o->v.Compare.ops, i)));
9820
3.19k
        }
9821
3.19k
        if (!value) goto failed;
9822
3.19k
        if (PyObject_SetAttr(result, state->ops, value) == -1)
9823
0
            goto failed;
9824
3.19k
        Py_DECREF(value);
9825
3.19k
        value = ast2obj_list(state, (asdl_seq*)o->v.Compare.comparators,
9826
3.19k
                             ast2obj_expr);
9827
3.19k
        if (!value) goto failed;
9828
3.19k
        if (PyObject_SetAttr(result, state->comparators, value) == -1)
9829
0
            goto failed;
9830
3.19k
        Py_DECREF(value);
9831
3.19k
        break;
9832
7.36k
    case Call_kind:
9833
7.36k
        tp = (PyTypeObject *)state->Call_type;
9834
7.36k
        result = PyType_GenericNew(tp, NULL, NULL);
9835
7.36k
        if (!result) goto failed;
9836
7.36k
        value = ast2obj_expr(state, o->v.Call.func);
9837
7.36k
        if (!value) goto failed;
9838
7.36k
        if (PyObject_SetAttr(result, state->func, value) == -1)
9839
0
            goto failed;
9840
7.36k
        Py_DECREF(value);
9841
7.36k
        value = ast2obj_list(state, (asdl_seq*)o->v.Call.args, ast2obj_expr);
9842
7.36k
        if (!value) goto failed;
9843
7.36k
        if (PyObject_SetAttr(result, state->args, value) == -1)
9844
0
            goto failed;
9845
7.36k
        Py_DECREF(value);
9846
7.36k
        value = ast2obj_list(state, (asdl_seq*)o->v.Call.keywords,
9847
7.36k
                             ast2obj_keyword);
9848
7.36k
        if (!value) goto failed;
9849
7.36k
        if (PyObject_SetAttr(result, state->keywords, value) == -1)
9850
0
            goto failed;
9851
7.36k
        Py_DECREF(value);
9852
7.36k
        break;
9853
13.7k
    case FormattedValue_kind:
9854
13.7k
        tp = (PyTypeObject *)state->FormattedValue_type;
9855
13.7k
        result = PyType_GenericNew(tp, NULL, NULL);
9856
13.7k
        if (!result) goto failed;
9857
13.7k
        value = ast2obj_expr(state, o->v.FormattedValue.value);
9858
13.7k
        if (!value) goto failed;
9859
13.7k
        if (PyObject_SetAttr(result, state->value, value) == -1)
9860
0
            goto failed;
9861
13.7k
        Py_DECREF(value);
9862
13.7k
        value = ast2obj_int(state, o->v.FormattedValue.conversion);
9863
13.7k
        if (!value) goto failed;
9864
13.7k
        if (PyObject_SetAttr(result, state->conversion, value) == -1)
9865
0
            goto failed;
9866
13.7k
        Py_DECREF(value);
9867
13.7k
        value = ast2obj_expr(state, o->v.FormattedValue.format_spec);
9868
13.7k
        if (!value) goto failed;
9869
13.7k
        if (PyObject_SetAttr(result, state->format_spec, value) == -1)
9870
0
            goto failed;
9871
13.7k
        Py_DECREF(value);
9872
13.7k
        break;
9873
1.26k
    case Interpolation_kind:
9874
1.26k
        tp = (PyTypeObject *)state->Interpolation_type;
9875
1.26k
        result = PyType_GenericNew(tp, NULL, NULL);
9876
1.26k
        if (!result) goto failed;
9877
1.26k
        value = ast2obj_expr(state, o->v.Interpolation.value);
9878
1.26k
        if (!value) goto failed;
9879
1.26k
        if (PyObject_SetAttr(result, state->value, value) == -1)
9880
0
            goto failed;
9881
1.26k
        Py_DECREF(value);
9882
1.26k
        value = ast2obj_constant(state, o->v.Interpolation.str);
9883
1.26k
        if (!value) goto failed;
9884
1.26k
        if (PyObject_SetAttr(result, state->str, value) == -1)
9885
0
            goto failed;
9886
1.26k
        Py_DECREF(value);
9887
1.26k
        value = ast2obj_int(state, o->v.Interpolation.conversion);
9888
1.26k
        if (!value) goto failed;
9889
1.26k
        if (PyObject_SetAttr(result, state->conversion, value) == -1)
9890
0
            goto failed;
9891
1.26k
        Py_DECREF(value);
9892
1.26k
        value = ast2obj_expr(state, o->v.Interpolation.format_spec);
9893
1.26k
        if (!value) goto failed;
9894
1.26k
        if (PyObject_SetAttr(result, state->format_spec, value) == -1)
9895
0
            goto failed;
9896
1.26k
        Py_DECREF(value);
9897
1.26k
        break;
9898
6.81k
    case JoinedStr_kind:
9899
6.81k
        tp = (PyTypeObject *)state->JoinedStr_type;
9900
6.81k
        result = PyType_GenericNew(tp, NULL, NULL);
9901
6.81k
        if (!result) goto failed;
9902
6.81k
        value = ast2obj_list(state, (asdl_seq*)o->v.JoinedStr.values,
9903
6.81k
                             ast2obj_expr);
9904
6.81k
        if (!value) goto failed;
9905
6.81k
        if (PyObject_SetAttr(result, state->values, value) == -1)
9906
0
            goto failed;
9907
6.81k
        Py_DECREF(value);
9908
6.81k
        break;
9909
284
    case TemplateStr_kind:
9910
284
        tp = (PyTypeObject *)state->TemplateStr_type;
9911
284
        result = PyType_GenericNew(tp, NULL, NULL);
9912
284
        if (!result) goto failed;
9913
284
        value = ast2obj_list(state, (asdl_seq*)o->v.TemplateStr.values,
9914
284
                             ast2obj_expr);
9915
284
        if (!value) goto failed;
9916
284
        if (PyObject_SetAttr(result, state->values, value) == -1)
9917
0
            goto failed;
9918
284
        Py_DECREF(value);
9919
284
        break;
9920
66.4k
    case Constant_kind:
9921
66.4k
        tp = (PyTypeObject *)state->Constant_type;
9922
66.4k
        result = PyType_GenericNew(tp, NULL, NULL);
9923
66.4k
        if (!result) goto failed;
9924
66.4k
        value = ast2obj_constant(state, o->v.Constant.value);
9925
66.4k
        if (!value) goto failed;
9926
66.4k
        if (PyObject_SetAttr(result, state->value, value) == -1)
9927
0
            goto failed;
9928
66.4k
        Py_DECREF(value);
9929
66.4k
        value = ast2obj_string(state, o->v.Constant.kind);
9930
66.4k
        if (!value) goto failed;
9931
66.4k
        if (PyObject_SetAttr(result, state->kind, value) == -1)
9932
0
            goto failed;
9933
66.4k
        Py_DECREF(value);
9934
66.4k
        break;
9935
1.49k
    case Attribute_kind:
9936
1.49k
        tp = (PyTypeObject *)state->Attribute_type;
9937
1.49k
        result = PyType_GenericNew(tp, NULL, NULL);
9938
1.49k
        if (!result) goto failed;
9939
1.49k
        value = ast2obj_expr(state, o->v.Attribute.value);
9940
1.49k
        if (!value) goto failed;
9941
1.49k
        if (PyObject_SetAttr(result, state->value, value) == -1)
9942
0
            goto failed;
9943
1.49k
        Py_DECREF(value);
9944
1.49k
        value = ast2obj_identifier(state, o->v.Attribute.attr);
9945
1.49k
        if (!value) goto failed;
9946
1.49k
        if (PyObject_SetAttr(result, state->attr, value) == -1)
9947
0
            goto failed;
9948
1.49k
        Py_DECREF(value);
9949
1.49k
        value = ast2obj_expr_context(state, o->v.Attribute.ctx);
9950
1.49k
        if (!value) goto failed;
9951
1.49k
        if (PyObject_SetAttr(result, state->ctx, value) == -1)
9952
0
            goto failed;
9953
1.49k
        Py_DECREF(value);
9954
1.49k
        break;
9955
530
    case Subscript_kind:
9956
530
        tp = (PyTypeObject *)state->Subscript_type;
9957
530
        result = PyType_GenericNew(tp, NULL, NULL);
9958
530
        if (!result) goto failed;
9959
530
        value = ast2obj_expr(state, o->v.Subscript.value);
9960
530
        if (!value) goto failed;
9961
530
        if (PyObject_SetAttr(result, state->value, value) == -1)
9962
0
            goto failed;
9963
530
        Py_DECREF(value);
9964
530
        value = ast2obj_expr(state, o->v.Subscript.slice);
9965
530
        if (!value) goto failed;
9966
530
        if (PyObject_SetAttr(result, state->slice, value) == -1)
9967
0
            goto failed;
9968
530
        Py_DECREF(value);
9969
530
        value = ast2obj_expr_context(state, o->v.Subscript.ctx);
9970
530
        if (!value) goto failed;
9971
530
        if (PyObject_SetAttr(result, state->ctx, value) == -1)
9972
0
            goto failed;
9973
530
        Py_DECREF(value);
9974
530
        break;
9975
687
    case Starred_kind:
9976
687
        tp = (PyTypeObject *)state->Starred_type;
9977
687
        result = PyType_GenericNew(tp, NULL, NULL);
9978
687
        if (!result) goto failed;
9979
687
        value = ast2obj_expr(state, o->v.Starred.value);
9980
687
        if (!value) goto failed;
9981
687
        if (PyObject_SetAttr(result, state->value, value) == -1)
9982
0
            goto failed;
9983
687
        Py_DECREF(value);
9984
687
        value = ast2obj_expr_context(state, o->v.Starred.ctx);
9985
687
        if (!value) goto failed;
9986
687
        if (PyObject_SetAttr(result, state->ctx, value) == -1)
9987
0
            goto failed;
9988
687
        Py_DECREF(value);
9989
687
        break;
9990
69.6k
    case Name_kind:
9991
69.6k
        tp = (PyTypeObject *)state->Name_type;
9992
69.6k
        result = PyType_GenericNew(tp, NULL, NULL);
9993
69.6k
        if (!result) goto failed;
9994
69.6k
        value = ast2obj_identifier(state, o->v.Name.id);
9995
69.6k
        if (!value) goto failed;
9996
69.6k
        if (PyObject_SetAttr(result, state->id, value) == -1)
9997
0
            goto failed;
9998
69.6k
        Py_DECREF(value);
9999
69.6k
        value = ast2obj_expr_context(state, o->v.Name.ctx);
10000
69.6k
        if (!value) goto failed;
10001
69.6k
        if (PyObject_SetAttr(result, state->ctx, value) == -1)
10002
0
            goto failed;
10003
69.6k
        Py_DECREF(value);
10004
69.6k
        break;
10005
2.18k
    case List_kind:
10006
2.18k
        tp = (PyTypeObject *)state->List_type;
10007
2.18k
        result = PyType_GenericNew(tp, NULL, NULL);
10008
2.18k
        if (!result) goto failed;
10009
2.18k
        value = ast2obj_list(state, (asdl_seq*)o->v.List.elts, ast2obj_expr);
10010
2.18k
        if (!value) goto failed;
10011
2.18k
        if (PyObject_SetAttr(result, state->elts, value) == -1)
10012
0
            goto failed;
10013
2.18k
        Py_DECREF(value);
10014
2.18k
        value = ast2obj_expr_context(state, o->v.List.ctx);
10015
2.18k
        if (!value) goto failed;
10016
2.18k
        if (PyObject_SetAttr(result, state->ctx, value) == -1)
10017
0
            goto failed;
10018
2.18k
        Py_DECREF(value);
10019
2.18k
        break;
10020
8.63k
    case Tuple_kind:
10021
8.63k
        tp = (PyTypeObject *)state->Tuple_type;
10022
8.63k
        result = PyType_GenericNew(tp, NULL, NULL);
10023
8.63k
        if (!result) goto failed;
10024
8.63k
        value = ast2obj_list(state, (asdl_seq*)o->v.Tuple.elts, ast2obj_expr);
10025
8.63k
        if (!value) goto failed;
10026
8.63k
        if (PyObject_SetAttr(result, state->elts, value) == -1)
10027
0
            goto failed;
10028
8.63k
        Py_DECREF(value);
10029
8.63k
        value = ast2obj_expr_context(state, o->v.Tuple.ctx);
10030
8.63k
        if (!value) goto failed;
10031
8.63k
        if (PyObject_SetAttr(result, state->ctx, value) == -1)
10032
0
            goto failed;
10033
8.63k
        Py_DECREF(value);
10034
8.63k
        break;
10035
2.55k
    case Slice_kind:
10036
2.55k
        tp = (PyTypeObject *)state->Slice_type;
10037
2.55k
        result = PyType_GenericNew(tp, NULL, NULL);
10038
2.55k
        if (!result) goto failed;
10039
2.55k
        value = ast2obj_expr(state, o->v.Slice.lower);
10040
2.55k
        if (!value) goto failed;
10041
2.55k
        if (PyObject_SetAttr(result, state->lower, value) == -1)
10042
0
            goto failed;
10043
2.55k
        Py_DECREF(value);
10044
2.55k
        value = ast2obj_expr(state, o->v.Slice.upper);
10045
2.55k
        if (!value) goto failed;
10046
2.55k
        if (PyObject_SetAttr(result, state->upper, value) == -1)
10047
0
            goto failed;
10048
2.55k
        Py_DECREF(value);
10049
2.55k
        value = ast2obj_expr(state, o->v.Slice.step);
10050
2.55k
        if (!value) goto failed;
10051
2.55k
        if (PyObject_SetAttr(result, state->step, value) == -1)
10052
0
            goto failed;
10053
2.55k
        Py_DECREF(value);
10054
2.55k
        break;
10055
376k
    }
10056
376k
    value = ast2obj_int(state, o->lineno);
10057
376k
    if (!value) goto failed;
10058
376k
    if (PyObject_SetAttr(result, state->lineno, value) < 0)
10059
0
        goto failed;
10060
376k
    Py_DECREF(value);
10061
376k
    value = ast2obj_int(state, o->col_offset);
10062
376k
    if (!value) goto failed;
10063
376k
    if (PyObject_SetAttr(result, state->col_offset, value) < 0)
10064
0
        goto failed;
10065
376k
    Py_DECREF(value);
10066
376k
    value = ast2obj_int(state, o->end_lineno);
10067
376k
    if (!value) goto failed;
10068
376k
    if (PyObject_SetAttr(result, state->end_lineno, value) < 0)
10069
0
        goto failed;
10070
376k
    Py_DECREF(value);
10071
376k
    value = ast2obj_int(state, o->end_col_offset);
10072
376k
    if (!value) goto failed;
10073
376k
    if (PyObject_SetAttr(result, state->end_col_offset, value) < 0)
10074
0
        goto failed;
10075
376k
    Py_DECREF(value);
10076
376k
    Py_LeaveRecursiveCall();
10077
376k
    return result;
10078
0
failed:
10079
0
    Py_LeaveRecursiveCall();
10080
0
    Py_XDECREF(value);
10081
0
    Py_XDECREF(result);
10082
0
    return NULL;
10083
376k
}
10084
10085
PyObject* ast2obj_expr_context(struct ast_state *state, expr_context_ty o)
10086
83.1k
{
10087
83.1k
    switch(o) {
10088
77.2k
        case Load:
10089
77.2k
            return Py_NewRef(state->Load_singleton);
10090
5.17k
        case Store:
10091
5.17k
            return Py_NewRef(state->Store_singleton);
10092
763
        case Del:
10093
763
            return Py_NewRef(state->Del_singleton);
10094
83.1k
    }
10095
83.1k
    Py_UNREACHABLE();
10096
83.1k
}
10097
PyObject* ast2obj_boolop(struct ast_state *state, boolop_ty o)
10098
700
{
10099
700
    switch(o) {
10100
124
        case And:
10101
124
            return Py_NewRef(state->And_singleton);
10102
576
        case Or:
10103
576
            return Py_NewRef(state->Or_singleton);
10104
700
    }
10105
700
    Py_UNREACHABLE();
10106
700
}
10107
PyObject* ast2obj_operator(struct ast_state *state, operator_ty o)
10108
23.4k
{
10109
23.4k
    switch(o) {
10110
4.37k
        case Add:
10111
4.37k
            return Py_NewRef(state->Add_singleton);
10112
8.16k
        case Sub:
10113
8.16k
            return Py_NewRef(state->Sub_singleton);
10114
1.96k
        case Mult:
10115
1.96k
            return Py_NewRef(state->Mult_singleton);
10116
1.51k
        case MatMult:
10117
1.51k
            return Py_NewRef(state->MatMult_singleton);
10118
1.44k
        case Div:
10119
1.44k
            return Py_NewRef(state->Div_singleton);
10120
1.30k
        case Mod:
10121
1.30k
            return Py_NewRef(state->Mod_singleton);
10122
1.09k
        case Pow:
10123
1.09k
            return Py_NewRef(state->Pow_singleton);
10124
478
        case LShift:
10125
478
            return Py_NewRef(state->LShift_singleton);
10126
392
        case RShift:
10127
392
            return Py_NewRef(state->RShift_singleton);
10128
921
        case BitOr:
10129
921
            return Py_NewRef(state->BitOr_singleton);
10130
378
        case BitXor:
10131
378
            return Py_NewRef(state->BitXor_singleton);
10132
1.13k
        case BitAnd:
10133
1.13k
            return Py_NewRef(state->BitAnd_singleton);
10134
286
        case FloorDiv:
10135
286
            return Py_NewRef(state->FloorDiv_singleton);
10136
23.4k
    }
10137
23.4k
    Py_UNREACHABLE();
10138
23.4k
}
10139
PyObject* ast2obj_unaryop(struct ast_state *state, unaryop_ty o)
10140
161k
{
10141
161k
    switch(o) {
10142
27.9k
        case Invert:
10143
27.9k
            return Py_NewRef(state->Invert_singleton);
10144
90
        case Not:
10145
90
            return Py_NewRef(state->Not_singleton);
10146
44.0k
        case UAdd:
10147
44.0k
            return Py_NewRef(state->UAdd_singleton);
10148
89.7k
        case USub:
10149
89.7k
            return Py_NewRef(state->USub_singleton);
10150
161k
    }
10151
161k
    Py_UNREACHABLE();
10152
161k
}
10153
PyObject* ast2obj_cmpop(struct ast_state *state, cmpop_ty o)
10154
12.4k
{
10155
12.4k
    switch(o) {
10156
90
        case Eq:
10157
90
            return Py_NewRef(state->Eq_singleton);
10158
95
        case NotEq:
10159
95
            return Py_NewRef(state->NotEq_singleton);
10160
2.77k
        case Lt:
10161
2.77k
            return Py_NewRef(state->Lt_singleton);
10162
194
        case LtE:
10163
194
            return Py_NewRef(state->LtE_singleton);
10164
8.37k
        case Gt:
10165
8.37k
            return Py_NewRef(state->Gt_singleton);
10166
222
        case GtE:
10167
222
            return Py_NewRef(state->GtE_singleton);
10168
116
        case Is:
10169
116
            return Py_NewRef(state->Is_singleton);
10170
74
        case IsNot:
10171
74
            return Py_NewRef(state->IsNot_singleton);
10172
392
        case In:
10173
392
            return Py_NewRef(state->In_singleton);
10174
69
        case NotIn:
10175
69
            return Py_NewRef(state->NotIn_singleton);
10176
12.4k
    }
10177
12.4k
    Py_UNREACHABLE();
10178
12.4k
}
10179
PyObject*
10180
ast2obj_comprehension(struct ast_state *state, void* _o)
10181
1.66k
{
10182
1.66k
    comprehension_ty o = (comprehension_ty)_o;
10183
1.66k
    PyObject *result = NULL, *value = NULL;
10184
1.66k
    PyTypeObject *tp;
10185
1.66k
    if (!o) {
10186
0
        Py_RETURN_NONE;
10187
0
    }
10188
1.66k
    if (Py_EnterRecursiveCall("during  ast construction")) {
10189
0
        return NULL;
10190
0
    }
10191
1.66k
    tp = (PyTypeObject *)state->comprehension_type;
10192
1.66k
    result = PyType_GenericNew(tp, NULL, NULL);
10193
1.66k
    if (!result) return NULL;
10194
1.66k
    value = ast2obj_expr(state, o->target);
10195
1.66k
    if (!value) goto failed;
10196
1.66k
    if (PyObject_SetAttr(result, state->target, value) == -1)
10197
0
        goto failed;
10198
1.66k
    Py_DECREF(value);
10199
1.66k
    value = ast2obj_expr(state, o->iter);
10200
1.66k
    if (!value) goto failed;
10201
1.66k
    if (PyObject_SetAttr(result, state->iter, value) == -1)
10202
0
        goto failed;
10203
1.66k
    Py_DECREF(value);
10204
1.66k
    value = ast2obj_list(state, (asdl_seq*)o->ifs, ast2obj_expr);
10205
1.66k
    if (!value) goto failed;
10206
1.66k
    if (PyObject_SetAttr(result, state->ifs, value) == -1)
10207
0
        goto failed;
10208
1.66k
    Py_DECREF(value);
10209
1.66k
    value = ast2obj_int(state, o->is_async);
10210
1.66k
    if (!value) goto failed;
10211
1.66k
    if (PyObject_SetAttr(result, state->is_async, value) == -1)
10212
0
        goto failed;
10213
1.66k
    Py_DECREF(value);
10214
1.66k
    Py_LeaveRecursiveCall();
10215
1.66k
    return result;
10216
0
failed:
10217
0
    Py_LeaveRecursiveCall();
10218
0
    Py_XDECREF(value);
10219
0
    Py_XDECREF(result);
10220
0
    return NULL;
10221
1.66k
}
10222
10223
PyObject*
10224
ast2obj_excepthandler(struct ast_state *state, void* _o)
10225
1.25k
{
10226
1.25k
    excepthandler_ty o = (excepthandler_ty)_o;
10227
1.25k
    PyObject *result = NULL, *value = NULL;
10228
1.25k
    PyTypeObject *tp;
10229
1.25k
    if (!o) {
10230
0
        Py_RETURN_NONE;
10231
0
    }
10232
1.25k
    if (Py_EnterRecursiveCall("during  ast construction")) {
10233
0
        return NULL;
10234
0
    }
10235
1.25k
    switch (o->kind) {
10236
1.25k
    case ExceptHandler_kind:
10237
1.25k
        tp = (PyTypeObject *)state->ExceptHandler_type;
10238
1.25k
        result = PyType_GenericNew(tp, NULL, NULL);
10239
1.25k
        if (!result) goto failed;
10240
1.25k
        value = ast2obj_expr(state, o->v.ExceptHandler.type);
10241
1.25k
        if (!value) goto failed;
10242
1.25k
        if (PyObject_SetAttr(result, state->type, value) == -1)
10243
0
            goto failed;
10244
1.25k
        Py_DECREF(value);
10245
1.25k
        value = ast2obj_identifier(state, o->v.ExceptHandler.name);
10246
1.25k
        if (!value) goto failed;
10247
1.25k
        if (PyObject_SetAttr(result, state->name, value) == -1)
10248
0
            goto failed;
10249
1.25k
        Py_DECREF(value);
10250
1.25k
        value = ast2obj_list(state, (asdl_seq*)o->v.ExceptHandler.body,
10251
1.25k
                             ast2obj_stmt);
10252
1.25k
        if (!value) goto failed;
10253
1.25k
        if (PyObject_SetAttr(result, state->body, value) == -1)
10254
0
            goto failed;
10255
1.25k
        Py_DECREF(value);
10256
1.25k
        break;
10257
1.25k
    }
10258
1.25k
    value = ast2obj_int(state, o->lineno);
10259
1.25k
    if (!value) goto failed;
10260
1.25k
    if (PyObject_SetAttr(result, state->lineno, value) < 0)
10261
0
        goto failed;
10262
1.25k
    Py_DECREF(value);
10263
1.25k
    value = ast2obj_int(state, o->col_offset);
10264
1.25k
    if (!value) goto failed;
10265
1.25k
    if (PyObject_SetAttr(result, state->col_offset, value) < 0)
10266
0
        goto failed;
10267
1.25k
    Py_DECREF(value);
10268
1.25k
    value = ast2obj_int(state, o->end_lineno);
10269
1.25k
    if (!value) goto failed;
10270
1.25k
    if (PyObject_SetAttr(result, state->end_lineno, value) < 0)
10271
0
        goto failed;
10272
1.25k
    Py_DECREF(value);
10273
1.25k
    value = ast2obj_int(state, o->end_col_offset);
10274
1.25k
    if (!value) goto failed;
10275
1.25k
    if (PyObject_SetAttr(result, state->end_col_offset, value) < 0)
10276
0
        goto failed;
10277
1.25k
    Py_DECREF(value);
10278
1.25k
    Py_LeaveRecursiveCall();
10279
1.25k
    return result;
10280
0
failed:
10281
0
    Py_LeaveRecursiveCall();
10282
0
    Py_XDECREF(value);
10283
0
    Py_XDECREF(result);
10284
0
    return NULL;
10285
1.25k
}
10286
10287
PyObject*
10288
ast2obj_arguments(struct ast_state *state, void* _o)
10289
3.47k
{
10290
3.47k
    arguments_ty o = (arguments_ty)_o;
10291
3.47k
    PyObject *result = NULL, *value = NULL;
10292
3.47k
    PyTypeObject *tp;
10293
3.47k
    if (!o) {
10294
0
        Py_RETURN_NONE;
10295
0
    }
10296
3.47k
    if (Py_EnterRecursiveCall("during  ast construction")) {
10297
0
        return NULL;
10298
0
    }
10299
3.47k
    tp = (PyTypeObject *)state->arguments_type;
10300
3.47k
    result = PyType_GenericNew(tp, NULL, NULL);
10301
3.47k
    if (!result) return NULL;
10302
3.47k
    value = ast2obj_list(state, (asdl_seq*)o->posonlyargs, ast2obj_arg);
10303
3.47k
    if (!value) goto failed;
10304
3.47k
    if (PyObject_SetAttr(result, state->posonlyargs, value) == -1)
10305
0
        goto failed;
10306
3.47k
    Py_DECREF(value);
10307
3.47k
    value = ast2obj_list(state, (asdl_seq*)o->args, ast2obj_arg);
10308
3.47k
    if (!value) goto failed;
10309
3.47k
    if (PyObject_SetAttr(result, state->args, value) == -1)
10310
0
        goto failed;
10311
3.47k
    Py_DECREF(value);
10312
3.47k
    value = ast2obj_arg(state, o->vararg);
10313
3.47k
    if (!value) goto failed;
10314
3.47k
    if (PyObject_SetAttr(result, state->vararg, value) == -1)
10315
0
        goto failed;
10316
3.47k
    Py_DECREF(value);
10317
3.47k
    value = ast2obj_list(state, (asdl_seq*)o->kwonlyargs, ast2obj_arg);
10318
3.47k
    if (!value) goto failed;
10319
3.47k
    if (PyObject_SetAttr(result, state->kwonlyargs, value) == -1)
10320
0
        goto failed;
10321
3.47k
    Py_DECREF(value);
10322
3.47k
    value = ast2obj_list(state, (asdl_seq*)o->kw_defaults, ast2obj_expr);
10323
3.47k
    if (!value) goto failed;
10324
3.47k
    if (PyObject_SetAttr(result, state->kw_defaults, value) == -1)
10325
0
        goto failed;
10326
3.47k
    Py_DECREF(value);
10327
3.47k
    value = ast2obj_arg(state, o->kwarg);
10328
3.47k
    if (!value) goto failed;
10329
3.47k
    if (PyObject_SetAttr(result, state->kwarg, value) == -1)
10330
0
        goto failed;
10331
3.47k
    Py_DECREF(value);
10332
3.47k
    value = ast2obj_list(state, (asdl_seq*)o->defaults, ast2obj_expr);
10333
3.47k
    if (!value) goto failed;
10334
3.47k
    if (PyObject_SetAttr(result, state->defaults, value) == -1)
10335
0
        goto failed;
10336
3.47k
    Py_DECREF(value);
10337
3.47k
    Py_LeaveRecursiveCall();
10338
3.47k
    return result;
10339
0
failed:
10340
0
    Py_LeaveRecursiveCall();
10341
0
    Py_XDECREF(value);
10342
0
    Py_XDECREF(result);
10343
0
    return NULL;
10344
3.47k
}
10345
10346
PyObject*
10347
ast2obj_arg(struct ast_state *state, void* _o)
10348
19.8k
{
10349
19.8k
    arg_ty o = (arg_ty)_o;
10350
19.8k
    PyObject *result = NULL, *value = NULL;
10351
19.8k
    PyTypeObject *tp;
10352
19.8k
    if (!o) {
10353
6.20k
        Py_RETURN_NONE;
10354
6.20k
    }
10355
13.6k
    if (Py_EnterRecursiveCall("during  ast construction")) {
10356
0
        return NULL;
10357
0
    }
10358
13.6k
    tp = (PyTypeObject *)state->arg_type;
10359
13.6k
    result = PyType_GenericNew(tp, NULL, NULL);
10360
13.6k
    if (!result) return NULL;
10361
13.6k
    value = ast2obj_identifier(state, o->arg);
10362
13.6k
    if (!value) goto failed;
10363
13.6k
    if (PyObject_SetAttr(result, state->arg, value) == -1)
10364
0
        goto failed;
10365
13.6k
    Py_DECREF(value);
10366
13.6k
    value = ast2obj_expr(state, o->annotation);
10367
13.6k
    if (!value) goto failed;
10368
13.6k
    if (PyObject_SetAttr(result, state->annotation, value) == -1)
10369
0
        goto failed;
10370
13.6k
    Py_DECREF(value);
10371
13.6k
    value = ast2obj_string(state, o->type_comment);
10372
13.6k
    if (!value) goto failed;
10373
13.6k
    if (PyObject_SetAttr(result, state->type_comment, value) == -1)
10374
0
        goto failed;
10375
13.6k
    Py_DECREF(value);
10376
13.6k
    value = ast2obj_int(state, o->lineno);
10377
13.6k
    if (!value) goto failed;
10378
13.6k
    if (PyObject_SetAttr(result, state->lineno, value) < 0)
10379
0
        goto failed;
10380
13.6k
    Py_DECREF(value);
10381
13.6k
    value = ast2obj_int(state, o->col_offset);
10382
13.6k
    if (!value) goto failed;
10383
13.6k
    if (PyObject_SetAttr(result, state->col_offset, value) < 0)
10384
0
        goto failed;
10385
13.6k
    Py_DECREF(value);
10386
13.6k
    value = ast2obj_int(state, o->end_lineno);
10387
13.6k
    if (!value) goto failed;
10388
13.6k
    if (PyObject_SetAttr(result, state->end_lineno, value) < 0)
10389
0
        goto failed;
10390
13.6k
    Py_DECREF(value);
10391
13.6k
    value = ast2obj_int(state, o->end_col_offset);
10392
13.6k
    if (!value) goto failed;
10393
13.6k
    if (PyObject_SetAttr(result, state->end_col_offset, value) < 0)
10394
0
        goto failed;
10395
13.6k
    Py_DECREF(value);
10396
13.6k
    Py_LeaveRecursiveCall();
10397
13.6k
    return result;
10398
0
failed:
10399
0
    Py_LeaveRecursiveCall();
10400
0
    Py_XDECREF(value);
10401
0
    Py_XDECREF(result);
10402
0
    return NULL;
10403
13.6k
}
10404
10405
PyObject*
10406
ast2obj_keyword(struct ast_state *state, void* _o)
10407
2.91k
{
10408
2.91k
    keyword_ty o = (keyword_ty)_o;
10409
2.91k
    PyObject *result = NULL, *value = NULL;
10410
2.91k
    PyTypeObject *tp;
10411
2.91k
    if (!o) {
10412
0
        Py_RETURN_NONE;
10413
0
    }
10414
2.91k
    if (Py_EnterRecursiveCall("during  ast construction")) {
10415
0
        return NULL;
10416
0
    }
10417
2.91k
    tp = (PyTypeObject *)state->keyword_type;
10418
2.91k
    result = PyType_GenericNew(tp, NULL, NULL);
10419
2.91k
    if (!result) return NULL;
10420
2.91k
    value = ast2obj_identifier(state, o->arg);
10421
2.91k
    if (!value) goto failed;
10422
2.91k
    if (PyObject_SetAttr(result, state->arg, value) == -1)
10423
0
        goto failed;
10424
2.91k
    Py_DECREF(value);
10425
2.91k
    value = ast2obj_expr(state, o->value);
10426
2.91k
    if (!value) goto failed;
10427
2.91k
    if (PyObject_SetAttr(result, state->value, value) == -1)
10428
0
        goto failed;
10429
2.91k
    Py_DECREF(value);
10430
2.91k
    value = ast2obj_int(state, o->lineno);
10431
2.91k
    if (!value) goto failed;
10432
2.91k
    if (PyObject_SetAttr(result, state->lineno, value) < 0)
10433
0
        goto failed;
10434
2.91k
    Py_DECREF(value);
10435
2.91k
    value = ast2obj_int(state, o->col_offset);
10436
2.91k
    if (!value) goto failed;
10437
2.91k
    if (PyObject_SetAttr(result, state->col_offset, value) < 0)
10438
0
        goto failed;
10439
2.91k
    Py_DECREF(value);
10440
2.91k
    value = ast2obj_int(state, o->end_lineno);
10441
2.91k
    if (!value) goto failed;
10442
2.91k
    if (PyObject_SetAttr(result, state->end_lineno, value) < 0)
10443
0
        goto failed;
10444
2.91k
    Py_DECREF(value);
10445
2.91k
    value = ast2obj_int(state, o->end_col_offset);
10446
2.91k
    if (!value) goto failed;
10447
2.91k
    if (PyObject_SetAttr(result, state->end_col_offset, value) < 0)
10448
0
        goto failed;
10449
2.91k
    Py_DECREF(value);
10450
2.91k
    Py_LeaveRecursiveCall();
10451
2.91k
    return result;
10452
0
failed:
10453
0
    Py_LeaveRecursiveCall();
10454
0
    Py_XDECREF(value);
10455
0
    Py_XDECREF(result);
10456
0
    return NULL;
10457
2.91k
}
10458
10459
PyObject*
10460
ast2obj_alias(struct ast_state *state, void* _o)
10461
4.25k
{
10462
4.25k
    alias_ty o = (alias_ty)_o;
10463
4.25k
    PyObject *result = NULL, *value = NULL;
10464
4.25k
    PyTypeObject *tp;
10465
4.25k
    if (!o) {
10466
0
        Py_RETURN_NONE;
10467
0
    }
10468
4.25k
    if (Py_EnterRecursiveCall("during  ast construction")) {
10469
0
        return NULL;
10470
0
    }
10471
4.25k
    tp = (PyTypeObject *)state->alias_type;
10472
4.25k
    result = PyType_GenericNew(tp, NULL, NULL);
10473
4.25k
    if (!result) return NULL;
10474
4.25k
    value = ast2obj_identifier(state, o->name);
10475
4.25k
    if (!value) goto failed;
10476
4.25k
    if (PyObject_SetAttr(result, state->name, value) == -1)
10477
0
        goto failed;
10478
4.25k
    Py_DECREF(value);
10479
4.25k
    value = ast2obj_identifier(state, o->asname);
10480
4.25k
    if (!value) goto failed;
10481
4.25k
    if (PyObject_SetAttr(result, state->asname, value) == -1)
10482
0
        goto failed;
10483
4.25k
    Py_DECREF(value);
10484
4.25k
    value = ast2obj_int(state, o->lineno);
10485
4.25k
    if (!value) goto failed;
10486
4.25k
    if (PyObject_SetAttr(result, state->lineno, value) < 0)
10487
0
        goto failed;
10488
4.25k
    Py_DECREF(value);
10489
4.25k
    value = ast2obj_int(state, o->col_offset);
10490
4.25k
    if (!value) goto failed;
10491
4.25k
    if (PyObject_SetAttr(result, state->col_offset, value) < 0)
10492
0
        goto failed;
10493
4.25k
    Py_DECREF(value);
10494
4.25k
    value = ast2obj_int(state, o->end_lineno);
10495
4.25k
    if (!value) goto failed;
10496
4.25k
    if (PyObject_SetAttr(result, state->end_lineno, value) < 0)
10497
0
        goto failed;
10498
4.25k
    Py_DECREF(value);
10499
4.25k
    value = ast2obj_int(state, o->end_col_offset);
10500
4.25k
    if (!value) goto failed;
10501
4.25k
    if (PyObject_SetAttr(result, state->end_col_offset, value) < 0)
10502
0
        goto failed;
10503
4.25k
    Py_DECREF(value);
10504
4.25k
    Py_LeaveRecursiveCall();
10505
4.25k
    return result;
10506
0
failed:
10507
0
    Py_LeaveRecursiveCall();
10508
0
    Py_XDECREF(value);
10509
0
    Py_XDECREF(result);
10510
0
    return NULL;
10511
4.25k
}
10512
10513
PyObject*
10514
ast2obj_withitem(struct ast_state *state, void* _o)
10515
1.82k
{
10516
1.82k
    withitem_ty o = (withitem_ty)_o;
10517
1.82k
    PyObject *result = NULL, *value = NULL;
10518
1.82k
    PyTypeObject *tp;
10519
1.82k
    if (!o) {
10520
0
        Py_RETURN_NONE;
10521
0
    }
10522
1.82k
    if (Py_EnterRecursiveCall("during  ast construction")) {
10523
0
        return NULL;
10524
0
    }
10525
1.82k
    tp = (PyTypeObject *)state->withitem_type;
10526
1.82k
    result = PyType_GenericNew(tp, NULL, NULL);
10527
1.82k
    if (!result) return NULL;
10528
1.82k
    value = ast2obj_expr(state, o->context_expr);
10529
1.82k
    if (!value) goto failed;
10530
1.82k
    if (PyObject_SetAttr(result, state->context_expr, value) == -1)
10531
0
        goto failed;
10532
1.82k
    Py_DECREF(value);
10533
1.82k
    value = ast2obj_expr(state, o->optional_vars);
10534
1.82k
    if (!value) goto failed;
10535
1.82k
    if (PyObject_SetAttr(result, state->optional_vars, value) == -1)
10536
0
        goto failed;
10537
1.82k
    Py_DECREF(value);
10538
1.82k
    Py_LeaveRecursiveCall();
10539
1.82k
    return result;
10540
0
failed:
10541
0
    Py_LeaveRecursiveCall();
10542
0
    Py_XDECREF(value);
10543
0
    Py_XDECREF(result);
10544
0
    return NULL;
10545
1.82k
}
10546
10547
PyObject*
10548
ast2obj_match_case(struct ast_state *state, void* _o)
10549
1.23k
{
10550
1.23k
    match_case_ty o = (match_case_ty)_o;
10551
1.23k
    PyObject *result = NULL, *value = NULL;
10552
1.23k
    PyTypeObject *tp;
10553
1.23k
    if (!o) {
10554
0
        Py_RETURN_NONE;
10555
0
    }
10556
1.23k
    if (Py_EnterRecursiveCall("during  ast construction")) {
10557
0
        return NULL;
10558
0
    }
10559
1.23k
    tp = (PyTypeObject *)state->match_case_type;
10560
1.23k
    result = PyType_GenericNew(tp, NULL, NULL);
10561
1.23k
    if (!result) return NULL;
10562
1.23k
    value = ast2obj_pattern(state, o->pattern);
10563
1.23k
    if (!value) goto failed;
10564
1.23k
    if (PyObject_SetAttr(result, state->pattern, value) == -1)
10565
0
        goto failed;
10566
1.23k
    Py_DECREF(value);
10567
1.23k
    value = ast2obj_expr(state, o->guard);
10568
1.23k
    if (!value) goto failed;
10569
1.23k
    if (PyObject_SetAttr(result, state->guard, value) == -1)
10570
0
        goto failed;
10571
1.23k
    Py_DECREF(value);
10572
1.23k
    value = ast2obj_list(state, (asdl_seq*)o->body, ast2obj_stmt);
10573
1.23k
    if (!value) goto failed;
10574
1.23k
    if (PyObject_SetAttr(result, state->body, value) == -1)
10575
0
        goto failed;
10576
1.23k
    Py_DECREF(value);
10577
1.23k
    Py_LeaveRecursiveCall();
10578
1.23k
    return result;
10579
0
failed:
10580
0
    Py_LeaveRecursiveCall();
10581
0
    Py_XDECREF(value);
10582
0
    Py_XDECREF(result);
10583
0
    return NULL;
10584
1.23k
}
10585
10586
PyObject*
10587
ast2obj_pattern(struct ast_state *state, void* _o)
10588
25.4k
{
10589
25.4k
    pattern_ty o = (pattern_ty)_o;
10590
25.4k
    PyObject *result = NULL, *value = NULL;
10591
25.4k
    PyTypeObject *tp;
10592
25.4k
    if (!o) {
10593
8.63k
        Py_RETURN_NONE;
10594
8.63k
    }
10595
16.7k
    if (Py_EnterRecursiveCall("during  ast construction")) {
10596
0
        return NULL;
10597
0
    }
10598
16.7k
    switch (o->kind) {
10599
851
    case MatchValue_kind:
10600
851
        tp = (PyTypeObject *)state->MatchValue_type;
10601
851
        result = PyType_GenericNew(tp, NULL, NULL);
10602
851
        if (!result) goto failed;
10603
851
        value = ast2obj_expr(state, o->v.MatchValue.value);
10604
851
        if (!value) goto failed;
10605
851
        if (PyObject_SetAttr(result, state->value, value) == -1)
10606
0
            goto failed;
10607
851
        Py_DECREF(value);
10608
851
        break;
10609
87
    case MatchSingleton_kind:
10610
87
        tp = (PyTypeObject *)state->MatchSingleton_type;
10611
87
        result = PyType_GenericNew(tp, NULL, NULL);
10612
87
        if (!result) goto failed;
10613
87
        value = ast2obj_constant(state, o->v.MatchSingleton.value);
10614
87
        if (!value) goto failed;
10615
87
        if (PyObject_SetAttr(result, state->value, value) == -1)
10616
0
            goto failed;
10617
87
        Py_DECREF(value);
10618
87
        break;
10619
799
    case MatchSequence_kind:
10620
799
        tp = (PyTypeObject *)state->MatchSequence_type;
10621
799
        result = PyType_GenericNew(tp, NULL, NULL);
10622
799
        if (!result) goto failed;
10623
799
        value = ast2obj_list(state, (asdl_seq*)o->v.MatchSequence.patterns,
10624
799
                             ast2obj_pattern);
10625
799
        if (!value) goto failed;
10626
799
        if (PyObject_SetAttr(result, state->patterns, value) == -1)
10627
0
            goto failed;
10628
799
        Py_DECREF(value);
10629
799
        break;
10630
1.36k
    case MatchMapping_kind:
10631
1.36k
        tp = (PyTypeObject *)state->MatchMapping_type;
10632
1.36k
        result = PyType_GenericNew(tp, NULL, NULL);
10633
1.36k
        if (!result) goto failed;
10634
1.36k
        value = ast2obj_list(state, (asdl_seq*)o->v.MatchMapping.keys,
10635
1.36k
                             ast2obj_expr);
10636
1.36k
        if (!value) goto failed;
10637
1.36k
        if (PyObject_SetAttr(result, state->keys, value) == -1)
10638
0
            goto failed;
10639
1.36k
        Py_DECREF(value);
10640
1.36k
        value = ast2obj_list(state, (asdl_seq*)o->v.MatchMapping.patterns,
10641
1.36k
                             ast2obj_pattern);
10642
1.36k
        if (!value) goto failed;
10643
1.36k
        if (PyObject_SetAttr(result, state->patterns, value) == -1)
10644
0
            goto failed;
10645
1.36k
        Py_DECREF(value);
10646
1.36k
        value = ast2obj_identifier(state, o->v.MatchMapping.rest);
10647
1.36k
        if (!value) goto failed;
10648
1.36k
        if (PyObject_SetAttr(result, state->rest, value) == -1)
10649
0
            goto failed;
10650
1.36k
        Py_DECREF(value);
10651
1.36k
        break;
10652
1.90k
    case MatchClass_kind:
10653
1.90k
        tp = (PyTypeObject *)state->MatchClass_type;
10654
1.90k
        result = PyType_GenericNew(tp, NULL, NULL);
10655
1.90k
        if (!result) goto failed;
10656
1.90k
        value = ast2obj_expr(state, o->v.MatchClass.cls);
10657
1.90k
        if (!value) goto failed;
10658
1.90k
        if (PyObject_SetAttr(result, state->cls, value) == -1)
10659
0
            goto failed;
10660
1.90k
        Py_DECREF(value);
10661
1.90k
        value = ast2obj_list(state, (asdl_seq*)o->v.MatchClass.patterns,
10662
1.90k
                             ast2obj_pattern);
10663
1.90k
        if (!value) goto failed;
10664
1.90k
        if (PyObject_SetAttr(result, state->patterns, value) == -1)
10665
0
            goto failed;
10666
1.90k
        Py_DECREF(value);
10667
1.90k
        value = ast2obj_list(state, (asdl_seq*)o->v.MatchClass.kwd_attrs,
10668
1.90k
                             ast2obj_identifier);
10669
1.90k
        if (!value) goto failed;
10670
1.90k
        if (PyObject_SetAttr(result, state->kwd_attrs, value) == -1)
10671
0
            goto failed;
10672
1.90k
        Py_DECREF(value);
10673
1.90k
        value = ast2obj_list(state, (asdl_seq*)o->v.MatchClass.kwd_patterns,
10674
1.90k
                             ast2obj_pattern);
10675
1.90k
        if (!value) goto failed;
10676
1.90k
        if (PyObject_SetAttr(result, state->kwd_patterns, value) == -1)
10677
0
            goto failed;
10678
1.90k
        Py_DECREF(value);
10679
1.90k
        break;
10680
474
    case MatchStar_kind:
10681
474
        tp = (PyTypeObject *)state->MatchStar_type;
10682
474
        result = PyType_GenericNew(tp, NULL, NULL);
10683
474
        if (!result) goto failed;
10684
474
        value = ast2obj_identifier(state, o->v.MatchStar.name);
10685
474
        if (!value) goto failed;
10686
474
        if (PyObject_SetAttr(result, state->name, value) == -1)
10687
0
            goto failed;
10688
474
        Py_DECREF(value);
10689
474
        break;
10690
8.71k
    case MatchAs_kind:
10691
8.71k
        tp = (PyTypeObject *)state->MatchAs_type;
10692
8.71k
        result = PyType_GenericNew(tp, NULL, NULL);
10693
8.71k
        if (!result) goto failed;
10694
8.71k
        value = ast2obj_pattern(state, o->v.MatchAs.pattern);
10695
8.71k
        if (!value) goto failed;
10696
8.71k
        if (PyObject_SetAttr(result, state->pattern, value) == -1)
10697
0
            goto failed;
10698
8.71k
        Py_DECREF(value);
10699
8.71k
        value = ast2obj_identifier(state, o->v.MatchAs.name);
10700
8.71k
        if (!value) goto failed;
10701
8.71k
        if (PyObject_SetAttr(result, state->name, value) == -1)
10702
0
            goto failed;
10703
8.71k
        Py_DECREF(value);
10704
8.71k
        break;
10705
2.58k
    case MatchOr_kind:
10706
2.58k
        tp = (PyTypeObject *)state->MatchOr_type;
10707
2.58k
        result = PyType_GenericNew(tp, NULL, NULL);
10708
2.58k
        if (!result) goto failed;
10709
2.58k
        value = ast2obj_list(state, (asdl_seq*)o->v.MatchOr.patterns,
10710
2.58k
                             ast2obj_pattern);
10711
2.58k
        if (!value) goto failed;
10712
2.58k
        if (PyObject_SetAttr(result, state->patterns, value) == -1)
10713
0
            goto failed;
10714
2.58k
        Py_DECREF(value);
10715
2.58k
        break;
10716
16.7k
    }
10717
16.7k
    value = ast2obj_int(state, o->lineno);
10718
16.7k
    if (!value) goto failed;
10719
16.7k
    if (PyObject_SetAttr(result, state->lineno, value) < 0)
10720
0
        goto failed;
10721
16.7k
    Py_DECREF(value);
10722
16.7k
    value = ast2obj_int(state, o->col_offset);
10723
16.7k
    if (!value) goto failed;
10724
16.7k
    if (PyObject_SetAttr(result, state->col_offset, value) < 0)
10725
0
        goto failed;
10726
16.7k
    Py_DECREF(value);
10727
16.7k
    value = ast2obj_int(state, o->end_lineno);
10728
16.7k
    if (!value) goto failed;
10729
16.7k
    if (PyObject_SetAttr(result, state->end_lineno, value) < 0)
10730
0
        goto failed;
10731
16.7k
    Py_DECREF(value);
10732
16.7k
    value = ast2obj_int(state, o->end_col_offset);
10733
16.7k
    if (!value) goto failed;
10734
16.7k
    if (PyObject_SetAttr(result, state->end_col_offset, value) < 0)
10735
0
        goto failed;
10736
16.7k
    Py_DECREF(value);
10737
16.7k
    Py_LeaveRecursiveCall();
10738
16.7k
    return result;
10739
0
failed:
10740
0
    Py_LeaveRecursiveCall();
10741
0
    Py_XDECREF(value);
10742
0
    Py_XDECREF(result);
10743
0
    return NULL;
10744
16.7k
}
10745
10746
PyObject*
10747
ast2obj_type_ignore(struct ast_state *state, void* _o)
10748
0
{
10749
0
    type_ignore_ty o = (type_ignore_ty)_o;
10750
0
    PyObject *result = NULL, *value = NULL;
10751
0
    PyTypeObject *tp;
10752
0
    if (!o) {
10753
0
        Py_RETURN_NONE;
10754
0
    }
10755
0
    if (Py_EnterRecursiveCall("during  ast construction")) {
10756
0
        return NULL;
10757
0
    }
10758
0
    switch (o->kind) {
10759
0
    case TypeIgnore_kind:
10760
0
        tp = (PyTypeObject *)state->TypeIgnore_type;
10761
0
        result = PyType_GenericNew(tp, NULL, NULL);
10762
0
        if (!result) goto failed;
10763
0
        value = ast2obj_int(state, o->v.TypeIgnore.lineno);
10764
0
        if (!value) goto failed;
10765
0
        if (PyObject_SetAttr(result, state->lineno, value) == -1)
10766
0
            goto failed;
10767
0
        Py_DECREF(value);
10768
0
        value = ast2obj_string(state, o->v.TypeIgnore.tag);
10769
0
        if (!value) goto failed;
10770
0
        if (PyObject_SetAttr(result, state->tag, value) == -1)
10771
0
            goto failed;
10772
0
        Py_DECREF(value);
10773
0
        break;
10774
0
    }
10775
0
    Py_LeaveRecursiveCall();
10776
0
    return result;
10777
0
failed:
10778
0
    Py_LeaveRecursiveCall();
10779
0
    Py_XDECREF(value);
10780
0
    Py_XDECREF(result);
10781
0
    return NULL;
10782
0
}
10783
10784
PyObject*
10785
ast2obj_type_param(struct ast_state *state, void* _o)
10786
6.16k
{
10787
6.16k
    type_param_ty o = (type_param_ty)_o;
10788
6.16k
    PyObject *result = NULL, *value = NULL;
10789
6.16k
    PyTypeObject *tp;
10790
6.16k
    if (!o) {
10791
0
        Py_RETURN_NONE;
10792
0
    }
10793
6.16k
    if (Py_EnterRecursiveCall("during  ast construction")) {
10794
0
        return NULL;
10795
0
    }
10796
6.16k
    switch (o->kind) {
10797
5.00k
    case TypeVar_kind:
10798
5.00k
        tp = (PyTypeObject *)state->TypeVar_type;
10799
5.00k
        result = PyType_GenericNew(tp, NULL, NULL);
10800
5.00k
        if (!result) goto failed;
10801
5.00k
        value = ast2obj_identifier(state, o->v.TypeVar.name);
10802
5.00k
        if (!value) goto failed;
10803
5.00k
        if (PyObject_SetAttr(result, state->name, value) == -1)
10804
0
            goto failed;
10805
5.00k
        Py_DECREF(value);
10806
5.00k
        value = ast2obj_expr(state, o->v.TypeVar.bound);
10807
5.00k
        if (!value) goto failed;
10808
5.00k
        if (PyObject_SetAttr(result, state->bound, value) == -1)
10809
0
            goto failed;
10810
5.00k
        Py_DECREF(value);
10811
5.00k
        value = ast2obj_expr(state, o->v.TypeVar.default_value);
10812
5.00k
        if (!value) goto failed;
10813
5.00k
        if (PyObject_SetAttr(result, state->default_value, value) == -1)
10814
0
            goto failed;
10815
5.00k
        Py_DECREF(value);
10816
5.00k
        break;
10817
433
    case ParamSpec_kind:
10818
433
        tp = (PyTypeObject *)state->ParamSpec_type;
10819
433
        result = PyType_GenericNew(tp, NULL, NULL);
10820
433
        if (!result) goto failed;
10821
433
        value = ast2obj_identifier(state, o->v.ParamSpec.name);
10822
433
        if (!value) goto failed;
10823
433
        if (PyObject_SetAttr(result, state->name, value) == -1)
10824
0
            goto failed;
10825
433
        Py_DECREF(value);
10826
433
        value = ast2obj_expr(state, o->v.ParamSpec.default_value);
10827
433
        if (!value) goto failed;
10828
433
        if (PyObject_SetAttr(result, state->default_value, value) == -1)
10829
0
            goto failed;
10830
433
        Py_DECREF(value);
10831
433
        break;
10832
718
    case TypeVarTuple_kind:
10833
718
        tp = (PyTypeObject *)state->TypeVarTuple_type;
10834
718
        result = PyType_GenericNew(tp, NULL, NULL);
10835
718
        if (!result) goto failed;
10836
718
        value = ast2obj_identifier(state, o->v.TypeVarTuple.name);
10837
718
        if (!value) goto failed;
10838
718
        if (PyObject_SetAttr(result, state->name, value) == -1)
10839
0
            goto failed;
10840
718
        Py_DECREF(value);
10841
718
        value = ast2obj_expr(state, o->v.TypeVarTuple.default_value);
10842
718
        if (!value) goto failed;
10843
718
        if (PyObject_SetAttr(result, state->default_value, value) == -1)
10844
0
            goto failed;
10845
718
        Py_DECREF(value);
10846
718
        break;
10847
6.16k
    }
10848
6.16k
    value = ast2obj_int(state, o->lineno);
10849
6.16k
    if (!value) goto failed;
10850
6.16k
    if (PyObject_SetAttr(result, state->lineno, value) < 0)
10851
0
        goto failed;
10852
6.16k
    Py_DECREF(value);
10853
6.16k
    value = ast2obj_int(state, o->col_offset);
10854
6.16k
    if (!value) goto failed;
10855
6.16k
    if (PyObject_SetAttr(result, state->col_offset, value) < 0)
10856
0
        goto failed;
10857
6.16k
    Py_DECREF(value);
10858
6.16k
    value = ast2obj_int(state, o->end_lineno);
10859
6.16k
    if (!value) goto failed;
10860
6.16k
    if (PyObject_SetAttr(result, state->end_lineno, value) < 0)
10861
0
        goto failed;
10862
6.16k
    Py_DECREF(value);
10863
6.16k
    value = ast2obj_int(state, o->end_col_offset);
10864
6.16k
    if (!value) goto failed;
10865
6.16k
    if (PyObject_SetAttr(result, state->end_col_offset, value) < 0)
10866
0
        goto failed;
10867
6.16k
    Py_DECREF(value);
10868
6.16k
    Py_LeaveRecursiveCall();
10869
6.16k
    return result;
10870
0
failed:
10871
0
    Py_LeaveRecursiveCall();
10872
0
    Py_XDECREF(value);
10873
0
    Py_XDECREF(result);
10874
0
    return NULL;
10875
6.16k
}
10876
10877
10878
int
10879
obj2ast_mod(struct ast_state *state, PyObject* obj, mod_ty* out, PyArena* arena)
10880
0
{
10881
0
    int isinstance;
10882
10883
0
    PyObject *tmp = NULL;
10884
0
    PyObject *tp;
10885
10886
0
    if (obj == Py_None) {
10887
0
        *out = NULL;
10888
0
        return 0;
10889
0
    }
10890
0
    tp = state->Module_type;
10891
0
    isinstance = PyObject_IsInstance(obj, tp);
10892
0
    if (isinstance == -1) {
10893
0
        return -1;
10894
0
    }
10895
0
    if (isinstance) {
10896
0
        asdl_stmt_seq* body;
10897
0
        asdl_type_ignore_seq* type_ignores;
10898
10899
0
        if (PyObject_GetOptionalAttr(obj, state->body, &tmp) < 0) {
10900
0
            return -1;
10901
0
        }
10902
0
        if (tmp == NULL) {
10903
0
            tmp = PyList_New(0);
10904
0
            if (tmp == NULL) {
10905
0
                return -1;
10906
0
            }
10907
0
        }
10908
0
        {
10909
0
            int res;
10910
0
            Py_ssize_t len;
10911
0
            Py_ssize_t i;
10912
0
            if (!PyList_Check(tmp)) {
10913
0
                PyErr_Format(PyExc_TypeError, "Module field \"body\" must be a list, not a %.200s", _PyType_Name(Py_TYPE(tmp)));
10914
0
                goto failed;
10915
0
            }
10916
0
            len = PyList_GET_SIZE(tmp);
10917
0
            body = _Py_asdl_stmt_seq_new(len, arena);
10918
0
            if (body == NULL) goto failed;
10919
0
            for (i = 0; i < len; i++) {
10920
0
                stmt_ty val;
10921
0
                PyObject *tmp2 = Py_NewRef(PyList_GET_ITEM(tmp, i));
10922
0
                if (_Py_EnterRecursiveCall(" while traversing 'Module' node")) {
10923
0
                    goto failed;
10924
0
                }
10925
0
                res = obj2ast_stmt(state, tmp2, &val, arena);
10926
0
                _Py_LeaveRecursiveCall();
10927
0
                Py_DECREF(tmp2);
10928
0
                if (res != 0) goto failed;
10929
0
                if (len != PyList_GET_SIZE(tmp)) {
10930
0
                    PyErr_SetString(PyExc_RuntimeError, "Module field \"body\" changed size during iteration");
10931
0
                    goto failed;
10932
0
                }
10933
0
                asdl_seq_SET(body, i, val);
10934
0
            }
10935
0
            Py_CLEAR(tmp);
10936
0
        }
10937
0
        if (PyObject_GetOptionalAttr(obj, state->type_ignores, &tmp) < 0) {
10938
0
            return -1;
10939
0
        }
10940
0
        if (tmp == NULL) {
10941
0
            tmp = PyList_New(0);
10942
0
            if (tmp == NULL) {
10943
0
                return -1;
10944
0
            }
10945
0
        }
10946
0
        {
10947
0
            int res;
10948
0
            Py_ssize_t len;
10949
0
            Py_ssize_t i;
10950
0
            if (!PyList_Check(tmp)) {
10951
0
                PyErr_Format(PyExc_TypeError, "Module field \"type_ignores\" must be a list, not a %.200s", _PyType_Name(Py_TYPE(tmp)));
10952
0
                goto failed;
10953
0
            }
10954
0
            len = PyList_GET_SIZE(tmp);
10955
0
            type_ignores = _Py_asdl_type_ignore_seq_new(len, arena);
10956
0
            if (type_ignores == NULL) goto failed;
10957
0
            for (i = 0; i < len; i++) {
10958
0
                type_ignore_ty val;
10959
0
                PyObject *tmp2 = Py_NewRef(PyList_GET_ITEM(tmp, i));
10960
0
                if (_Py_EnterRecursiveCall(" while traversing 'Module' node")) {
10961
0
                    goto failed;
10962
0
                }
10963
0
                res = obj2ast_type_ignore(state, tmp2, &val, arena);
10964
0
                _Py_LeaveRecursiveCall();
10965
0
                Py_DECREF(tmp2);
10966
0
                if (res != 0) goto failed;
10967
0
                if (len != PyList_GET_SIZE(tmp)) {
10968
0
                    PyErr_SetString(PyExc_RuntimeError, "Module field \"type_ignores\" changed size during iteration");
10969
0
                    goto failed;
10970
0
                }
10971
0
                asdl_seq_SET(type_ignores, i, val);
10972
0
            }
10973
0
            Py_CLEAR(tmp);
10974
0
        }
10975
0
        *out = _PyAST_Module(body, type_ignores, arena);
10976
0
        if (*out == NULL) goto failed;
10977
0
        return 0;
10978
0
    }
10979
0
    tp = state->Interactive_type;
10980
0
    isinstance = PyObject_IsInstance(obj, tp);
10981
0
    if (isinstance == -1) {
10982
0
        return -1;
10983
0
    }
10984
0
    if (isinstance) {
10985
0
        asdl_stmt_seq* body;
10986
10987
0
        if (PyObject_GetOptionalAttr(obj, state->body, &tmp) < 0) {
10988
0
            return -1;
10989
0
        }
10990
0
        if (tmp == NULL) {
10991
0
            tmp = PyList_New(0);
10992
0
            if (tmp == NULL) {
10993
0
                return -1;
10994
0
            }
10995
0
        }
10996
0
        {
10997
0
            int res;
10998
0
            Py_ssize_t len;
10999
0
            Py_ssize_t i;
11000
0
            if (!PyList_Check(tmp)) {
11001
0
                PyErr_Format(PyExc_TypeError, "Interactive field \"body\" must be a list, not a %.200s", _PyType_Name(Py_TYPE(tmp)));
11002
0
                goto failed;
11003
0
            }
11004
0
            len = PyList_GET_SIZE(tmp);
11005
0
            body = _Py_asdl_stmt_seq_new(len, arena);
11006
0
            if (body == NULL) goto failed;
11007
0
            for (i = 0; i < len; i++) {
11008
0
                stmt_ty val;
11009
0
                PyObject *tmp2 = Py_NewRef(PyList_GET_ITEM(tmp, i));
11010
0
                if (_Py_EnterRecursiveCall(" while traversing 'Interactive' node")) {
11011
0
                    goto failed;
11012
0
                }
11013
0
                res = obj2ast_stmt(state, tmp2, &val, arena);
11014
0
                _Py_LeaveRecursiveCall();
11015
0
                Py_DECREF(tmp2);
11016
0
                if (res != 0) goto failed;
11017
0
                if (len != PyList_GET_SIZE(tmp)) {
11018
0
                    PyErr_SetString(PyExc_RuntimeError, "Interactive field \"body\" changed size during iteration");
11019
0
                    goto failed;
11020
0
                }
11021
0
                asdl_seq_SET(body, i, val);
11022
0
            }
11023
0
            Py_CLEAR(tmp);
11024
0
        }
11025
0
        *out = _PyAST_Interactive(body, arena);
11026
0
        if (*out == NULL) goto failed;
11027
0
        return 0;
11028
0
    }
11029
0
    tp = state->Expression_type;
11030
0
    isinstance = PyObject_IsInstance(obj, tp);
11031
0
    if (isinstance == -1) {
11032
0
        return -1;
11033
0
    }
11034
0
    if (isinstance) {
11035
0
        expr_ty body;
11036
11037
0
        if (PyObject_GetOptionalAttr(obj, state->body, &tmp) < 0) {
11038
0
            return -1;
11039
0
        }
11040
0
        if (tmp == NULL) {
11041
0
            PyErr_SetString(PyExc_TypeError, "required field \"body\" missing from Expression");
11042
0
            return -1;
11043
0
        }
11044
0
        else {
11045
0
            int res;
11046
0
            if (_Py_EnterRecursiveCall(" while traversing 'Expression' node")) {
11047
0
                goto failed;
11048
0
            }
11049
0
            res = obj2ast_expr(state, tmp, &body, arena);
11050
0
            _Py_LeaveRecursiveCall();
11051
0
            if (res != 0) goto failed;
11052
0
            Py_CLEAR(tmp);
11053
0
        }
11054
0
        *out = _PyAST_Expression(body, arena);
11055
0
        if (*out == NULL) goto failed;
11056
0
        return 0;
11057
0
    }
11058
0
    tp = state->FunctionType_type;
11059
0
    isinstance = PyObject_IsInstance(obj, tp);
11060
0
    if (isinstance == -1) {
11061
0
        return -1;
11062
0
    }
11063
0
    if (isinstance) {
11064
0
        asdl_expr_seq* argtypes;
11065
0
        expr_ty returns;
11066
11067
0
        if (PyObject_GetOptionalAttr(obj, state->argtypes, &tmp) < 0) {
11068
0
            return -1;
11069
0
        }
11070
0
        if (tmp == NULL) {
11071
0
            tmp = PyList_New(0);
11072
0
            if (tmp == NULL) {
11073
0
                return -1;
11074
0
            }
11075
0
        }
11076
0
        {
11077
0
            int res;
11078
0
            Py_ssize_t len;
11079
0
            Py_ssize_t i;
11080
0
            if (!PyList_Check(tmp)) {
11081
0
                PyErr_Format(PyExc_TypeError, "FunctionType field \"argtypes\" must be a list, not a %.200s", _PyType_Name(Py_TYPE(tmp)));
11082
0
                goto failed;
11083
0
            }
11084
0
            len = PyList_GET_SIZE(tmp);
11085
0
            argtypes = _Py_asdl_expr_seq_new(len, arena);
11086
0
            if (argtypes == NULL) goto failed;
11087
0
            for (i = 0; i < len; i++) {
11088
0
                expr_ty val;
11089
0
                PyObject *tmp2 = Py_NewRef(PyList_GET_ITEM(tmp, i));
11090
0
                if (_Py_EnterRecursiveCall(" while traversing 'FunctionType' node")) {
11091
0
                    goto failed;
11092
0
                }
11093
0
                res = obj2ast_expr(state, tmp2, &val, arena);
11094
0
                _Py_LeaveRecursiveCall();
11095
0
                Py_DECREF(tmp2);
11096
0
                if (res != 0) goto failed;
11097
0
                if (len != PyList_GET_SIZE(tmp)) {
11098
0
                    PyErr_SetString(PyExc_RuntimeError, "FunctionType field \"argtypes\" changed size during iteration");
11099
0
                    goto failed;
11100
0
                }
11101
0
                asdl_seq_SET(argtypes, i, val);
11102
0
            }
11103
0
            Py_CLEAR(tmp);
11104
0
        }
11105
0
        if (PyObject_GetOptionalAttr(obj, state->returns, &tmp) < 0) {
11106
0
            return -1;
11107
0
        }
11108
0
        if (tmp == NULL) {
11109
0
            PyErr_SetString(PyExc_TypeError, "required field \"returns\" missing from FunctionType");
11110
0
            return -1;
11111
0
        }
11112
0
        else {
11113
0
            int res;
11114
0
            if (_Py_EnterRecursiveCall(" while traversing 'FunctionType' node")) {
11115
0
                goto failed;
11116
0
            }
11117
0
            res = obj2ast_expr(state, tmp, &returns, arena);
11118
0
            _Py_LeaveRecursiveCall();
11119
0
            if (res != 0) goto failed;
11120
0
            Py_CLEAR(tmp);
11121
0
        }
11122
0
        *out = _PyAST_FunctionType(argtypes, returns, arena);
11123
0
        if (*out == NULL) goto failed;
11124
0
        return 0;
11125
0
    }
11126
11127
0
    PyErr_Format(PyExc_TypeError, "expected some sort of mod, but got %R", obj);
11128
0
    failed:
11129
0
    Py_XDECREF(tmp);
11130
0
    return -1;
11131
0
}
11132
11133
int
11134
obj2ast_stmt(struct ast_state *state, PyObject* obj, stmt_ty* out, PyArena*
11135
             arena)
11136
0
{
11137
0
    int isinstance;
11138
11139
0
    PyObject *tmp = NULL;
11140
0
    PyObject *tp;
11141
0
    int lineno;
11142
0
    int col_offset;
11143
0
    int end_lineno;
11144
0
    int end_col_offset;
11145
11146
0
    if (obj == Py_None) {
11147
0
        *out = NULL;
11148
0
        return 0;
11149
0
    }
11150
0
    if (PyObject_GetOptionalAttr(obj, state->lineno, &tmp) < 0) {
11151
0
        return -1;
11152
0
    }
11153
0
    if (tmp == NULL) {
11154
0
        PyErr_SetString(PyExc_TypeError, "required field \"lineno\" missing from stmt");
11155
0
        return -1;
11156
0
    }
11157
0
    else {
11158
0
        int res;
11159
0
        if (_Py_EnterRecursiveCall(" while traversing 'stmt' node")) {
11160
0
            goto failed;
11161
0
        }
11162
0
        res = obj2ast_int(state, tmp, &lineno, arena);
11163
0
        _Py_LeaveRecursiveCall();
11164
0
        if (res != 0) goto failed;
11165
0
        Py_CLEAR(tmp);
11166
0
    }
11167
0
    if (PyObject_GetOptionalAttr(obj, state->col_offset, &tmp) < 0) {
11168
0
        return -1;
11169
0
    }
11170
0
    if (tmp == NULL) {
11171
0
        PyErr_SetString(PyExc_TypeError, "required field \"col_offset\" missing from stmt");
11172
0
        return -1;
11173
0
    }
11174
0
    else {
11175
0
        int res;
11176
0
        if (_Py_EnterRecursiveCall(" while traversing 'stmt' node")) {
11177
0
            goto failed;
11178
0
        }
11179
0
        res = obj2ast_int(state, tmp, &col_offset, arena);
11180
0
        _Py_LeaveRecursiveCall();
11181
0
        if (res != 0) goto failed;
11182
0
        Py_CLEAR(tmp);
11183
0
    }
11184
0
    if (PyObject_GetOptionalAttr(obj, state->end_lineno, &tmp) < 0) {
11185
0
        return -1;
11186
0
    }
11187
0
    if (tmp == NULL || tmp == Py_None) {
11188
0
        Py_CLEAR(tmp);
11189
0
        end_lineno = lineno;
11190
0
    }
11191
0
    else {
11192
0
        int res;
11193
0
        if (_Py_EnterRecursiveCall(" while traversing 'stmt' node")) {
11194
0
            goto failed;
11195
0
        }
11196
0
        res = obj2ast_int(state, tmp, &end_lineno, arena);
11197
0
        _Py_LeaveRecursiveCall();
11198
0
        if (res != 0) goto failed;
11199
0
        Py_CLEAR(tmp);
11200
0
    }
11201
0
    if (PyObject_GetOptionalAttr(obj, state->end_col_offset, &tmp) < 0) {
11202
0
        return -1;
11203
0
    }
11204
0
    if (tmp == NULL || tmp == Py_None) {
11205
0
        Py_CLEAR(tmp);
11206
0
        end_col_offset = col_offset;
11207
0
    }
11208
0
    else {
11209
0
        int res;
11210
0
        if (_Py_EnterRecursiveCall(" while traversing 'stmt' node")) {
11211
0
            goto failed;
11212
0
        }
11213
0
        res = obj2ast_int(state, tmp, &end_col_offset, arena);
11214
0
        _Py_LeaveRecursiveCall();
11215
0
        if (res != 0) goto failed;
11216
0
        Py_CLEAR(tmp);
11217
0
    }
11218
0
    tp = state->FunctionDef_type;
11219
0
    isinstance = PyObject_IsInstance(obj, tp);
11220
0
    if (isinstance == -1) {
11221
0
        return -1;
11222
0
    }
11223
0
    if (isinstance) {
11224
0
        identifier name;
11225
0
        arguments_ty args;
11226
0
        asdl_stmt_seq* body;
11227
0
        asdl_expr_seq* decorator_list;
11228
0
        expr_ty returns;
11229
0
        string type_comment;
11230
0
        asdl_type_param_seq* type_params;
11231
11232
0
        if (PyObject_GetOptionalAttr(obj, state->name, &tmp) < 0) {
11233
0
            return -1;
11234
0
        }
11235
0
        if (tmp == NULL) {
11236
0
            PyErr_SetString(PyExc_TypeError, "required field \"name\" missing from FunctionDef");
11237
0
            return -1;
11238
0
        }
11239
0
        else {
11240
0
            int res;
11241
0
            if (_Py_EnterRecursiveCall(" while traversing 'FunctionDef' node")) {
11242
0
                goto failed;
11243
0
            }
11244
0
            res = obj2ast_identifier(state, tmp, &name, arena);
11245
0
            _Py_LeaveRecursiveCall();
11246
0
            if (res != 0) goto failed;
11247
0
            Py_CLEAR(tmp);
11248
0
        }
11249
0
        if (PyObject_GetOptionalAttr(obj, state->args, &tmp) < 0) {
11250
0
            return -1;
11251
0
        }
11252
0
        if (tmp == NULL) {
11253
0
            PyErr_SetString(PyExc_TypeError, "required field \"args\" missing from FunctionDef");
11254
0
            return -1;
11255
0
        }
11256
0
        else {
11257
0
            int res;
11258
0
            if (_Py_EnterRecursiveCall(" while traversing 'FunctionDef' node")) {
11259
0
                goto failed;
11260
0
            }
11261
0
            res = obj2ast_arguments(state, tmp, &args, arena);
11262
0
            _Py_LeaveRecursiveCall();
11263
0
            if (res != 0) goto failed;
11264
0
            Py_CLEAR(tmp);
11265
0
        }
11266
0
        if (PyObject_GetOptionalAttr(obj, state->body, &tmp) < 0) {
11267
0
            return -1;
11268
0
        }
11269
0
        if (tmp == NULL) {
11270
0
            tmp = PyList_New(0);
11271
0
            if (tmp == NULL) {
11272
0
                return -1;
11273
0
            }
11274
0
        }
11275
0
        {
11276
0
            int res;
11277
0
            Py_ssize_t len;
11278
0
            Py_ssize_t i;
11279
0
            if (!PyList_Check(tmp)) {
11280
0
                PyErr_Format(PyExc_TypeError, "FunctionDef field \"body\" must be a list, not a %.200s", _PyType_Name(Py_TYPE(tmp)));
11281
0
                goto failed;
11282
0
            }
11283
0
            len = PyList_GET_SIZE(tmp);
11284
0
            body = _Py_asdl_stmt_seq_new(len, arena);
11285
0
            if (body == NULL) goto failed;
11286
0
            for (i = 0; i < len; i++) {
11287
0
                stmt_ty val;
11288
0
                PyObject *tmp2 = Py_NewRef(PyList_GET_ITEM(tmp, i));
11289
0
                if (_Py_EnterRecursiveCall(" while traversing 'FunctionDef' node")) {
11290
0
                    goto failed;
11291
0
                }
11292
0
                res = obj2ast_stmt(state, tmp2, &val, arena);
11293
0
                _Py_LeaveRecursiveCall();
11294
0
                Py_DECREF(tmp2);
11295
0
                if (res != 0) goto failed;
11296
0
                if (len != PyList_GET_SIZE(tmp)) {
11297
0
                    PyErr_SetString(PyExc_RuntimeError, "FunctionDef field \"body\" changed size during iteration");
11298
0
                    goto failed;
11299
0
                }
11300
0
                asdl_seq_SET(body, i, val);
11301
0
            }
11302
0
            Py_CLEAR(tmp);
11303
0
        }
11304
0
        if (PyObject_GetOptionalAttr(obj, state->decorator_list, &tmp) < 0) {
11305
0
            return -1;
11306
0
        }
11307
0
        if (tmp == NULL) {
11308
0
            tmp = PyList_New(0);
11309
0
            if (tmp == NULL) {
11310
0
                return -1;
11311
0
            }
11312
0
        }
11313
0
        {
11314
0
            int res;
11315
0
            Py_ssize_t len;
11316
0
            Py_ssize_t i;
11317
0
            if (!PyList_Check(tmp)) {
11318
0
                PyErr_Format(PyExc_TypeError, "FunctionDef field \"decorator_list\" must be a list, not a %.200s", _PyType_Name(Py_TYPE(tmp)));
11319
0
                goto failed;
11320
0
            }
11321
0
            len = PyList_GET_SIZE(tmp);
11322
0
            decorator_list = _Py_asdl_expr_seq_new(len, arena);
11323
0
            if (decorator_list == NULL) goto failed;
11324
0
            for (i = 0; i < len; i++) {
11325
0
                expr_ty val;
11326
0
                PyObject *tmp2 = Py_NewRef(PyList_GET_ITEM(tmp, i));
11327
0
                if (_Py_EnterRecursiveCall(" while traversing 'FunctionDef' node")) {
11328
0
                    goto failed;
11329
0
                }
11330
0
                res = obj2ast_expr(state, tmp2, &val, arena);
11331
0
                _Py_LeaveRecursiveCall();
11332
0
                Py_DECREF(tmp2);
11333
0
                if (res != 0) goto failed;
11334
0
                if (len != PyList_GET_SIZE(tmp)) {
11335
0
                    PyErr_SetString(PyExc_RuntimeError, "FunctionDef field \"decorator_list\" changed size during iteration");
11336
0
                    goto failed;
11337
0
                }
11338
0
                asdl_seq_SET(decorator_list, i, val);
11339
0
            }
11340
0
            Py_CLEAR(tmp);
11341
0
        }
11342
0
        if (PyObject_GetOptionalAttr(obj, state->returns, &tmp) < 0) {
11343
0
            return -1;
11344
0
        }
11345
0
        if (tmp == NULL || tmp == Py_None) {
11346
0
            Py_CLEAR(tmp);
11347
0
            returns = NULL;
11348
0
        }
11349
0
        else {
11350
0
            int res;
11351
0
            if (_Py_EnterRecursiveCall(" while traversing 'FunctionDef' node")) {
11352
0
                goto failed;
11353
0
            }
11354
0
            res = obj2ast_expr(state, tmp, &returns, arena);
11355
0
            _Py_LeaveRecursiveCall();
11356
0
            if (res != 0) goto failed;
11357
0
            Py_CLEAR(tmp);
11358
0
        }
11359
0
        if (PyObject_GetOptionalAttr(obj, state->type_comment, &tmp) < 0) {
11360
0
            return -1;
11361
0
        }
11362
0
        if (tmp == NULL || tmp == Py_None) {
11363
0
            Py_CLEAR(tmp);
11364
0
            type_comment = NULL;
11365
0
        }
11366
0
        else {
11367
0
            int res;
11368
0
            if (_Py_EnterRecursiveCall(" while traversing 'FunctionDef' node")) {
11369
0
                goto failed;
11370
0
            }
11371
0
            res = obj2ast_string(state, tmp, &type_comment, arena);
11372
0
            _Py_LeaveRecursiveCall();
11373
0
            if (res != 0) goto failed;
11374
0
            Py_CLEAR(tmp);
11375
0
        }
11376
0
        if (PyObject_GetOptionalAttr(obj, state->type_params, &tmp) < 0) {
11377
0
            return -1;
11378
0
        }
11379
0
        if (tmp == NULL) {
11380
0
            tmp = PyList_New(0);
11381
0
            if (tmp == NULL) {
11382
0
                return -1;
11383
0
            }
11384
0
        }
11385
0
        {
11386
0
            int res;
11387
0
            Py_ssize_t len;
11388
0
            Py_ssize_t i;
11389
0
            if (!PyList_Check(tmp)) {
11390
0
                PyErr_Format(PyExc_TypeError, "FunctionDef field \"type_params\" must be a list, not a %.200s", _PyType_Name(Py_TYPE(tmp)));
11391
0
                goto failed;
11392
0
            }
11393
0
            len = PyList_GET_SIZE(tmp);
11394
0
            type_params = _Py_asdl_type_param_seq_new(len, arena);
11395
0
            if (type_params == NULL) goto failed;
11396
0
            for (i = 0; i < len; i++) {
11397
0
                type_param_ty val;
11398
0
                PyObject *tmp2 = Py_NewRef(PyList_GET_ITEM(tmp, i));
11399
0
                if (_Py_EnterRecursiveCall(" while traversing 'FunctionDef' node")) {
11400
0
                    goto failed;
11401
0
                }
11402
0
                res = obj2ast_type_param(state, tmp2, &val, arena);
11403
0
                _Py_LeaveRecursiveCall();
11404
0
                Py_DECREF(tmp2);
11405
0
                if (res != 0) goto failed;
11406
0
                if (len != PyList_GET_SIZE(tmp)) {
11407
0
                    PyErr_SetString(PyExc_RuntimeError, "FunctionDef field \"type_params\" changed size during iteration");
11408
0
                    goto failed;
11409
0
                }
11410
0
                asdl_seq_SET(type_params, i, val);
11411
0
            }
11412
0
            Py_CLEAR(tmp);
11413
0
        }
11414
0
        *out = _PyAST_FunctionDef(name, args, body, decorator_list, returns,
11415
0
                                  type_comment, type_params, lineno,
11416
0
                                  col_offset, end_lineno, end_col_offset,
11417
0
                                  arena);
11418
0
        if (*out == NULL) goto failed;
11419
0
        return 0;
11420
0
    }
11421
0
    tp = state->AsyncFunctionDef_type;
11422
0
    isinstance = PyObject_IsInstance(obj, tp);
11423
0
    if (isinstance == -1) {
11424
0
        return -1;
11425
0
    }
11426
0
    if (isinstance) {
11427
0
        identifier name;
11428
0
        arguments_ty args;
11429
0
        asdl_stmt_seq* body;
11430
0
        asdl_expr_seq* decorator_list;
11431
0
        expr_ty returns;
11432
0
        string type_comment;
11433
0
        asdl_type_param_seq* type_params;
11434
11435
0
        if (PyObject_GetOptionalAttr(obj, state->name, &tmp) < 0) {
11436
0
            return -1;
11437
0
        }
11438
0
        if (tmp == NULL) {
11439
0
            PyErr_SetString(PyExc_TypeError, "required field \"name\" missing from AsyncFunctionDef");
11440
0
            return -1;
11441
0
        }
11442
0
        else {
11443
0
            int res;
11444
0
            if (_Py_EnterRecursiveCall(" while traversing 'AsyncFunctionDef' node")) {
11445
0
                goto failed;
11446
0
            }
11447
0
            res = obj2ast_identifier(state, tmp, &name, arena);
11448
0
            _Py_LeaveRecursiveCall();
11449
0
            if (res != 0) goto failed;
11450
0
            Py_CLEAR(tmp);
11451
0
        }
11452
0
        if (PyObject_GetOptionalAttr(obj, state->args, &tmp) < 0) {
11453
0
            return -1;
11454
0
        }
11455
0
        if (tmp == NULL) {
11456
0
            PyErr_SetString(PyExc_TypeError, "required field \"args\" missing from AsyncFunctionDef");
11457
0
            return -1;
11458
0
        }
11459
0
        else {
11460
0
            int res;
11461
0
            if (_Py_EnterRecursiveCall(" while traversing 'AsyncFunctionDef' node")) {
11462
0
                goto failed;
11463
0
            }
11464
0
            res = obj2ast_arguments(state, tmp, &args, arena);
11465
0
            _Py_LeaveRecursiveCall();
11466
0
            if (res != 0) goto failed;
11467
0
            Py_CLEAR(tmp);
11468
0
        }
11469
0
        if (PyObject_GetOptionalAttr(obj, state->body, &tmp) < 0) {
11470
0
            return -1;
11471
0
        }
11472
0
        if (tmp == NULL) {
11473
0
            tmp = PyList_New(0);
11474
0
            if (tmp == NULL) {
11475
0
                return -1;
11476
0
            }
11477
0
        }
11478
0
        {
11479
0
            int res;
11480
0
            Py_ssize_t len;
11481
0
            Py_ssize_t i;
11482
0
            if (!PyList_Check(tmp)) {
11483
0
                PyErr_Format(PyExc_TypeError, "AsyncFunctionDef field \"body\" must be a list, not a %.200s", _PyType_Name(Py_TYPE(tmp)));
11484
0
                goto failed;
11485
0
            }
11486
0
            len = PyList_GET_SIZE(tmp);
11487
0
            body = _Py_asdl_stmt_seq_new(len, arena);
11488
0
            if (body == NULL) goto failed;
11489
0
            for (i = 0; i < len; i++) {
11490
0
                stmt_ty val;
11491
0
                PyObject *tmp2 = Py_NewRef(PyList_GET_ITEM(tmp, i));
11492
0
                if (_Py_EnterRecursiveCall(" while traversing 'AsyncFunctionDef' node")) {
11493
0
                    goto failed;
11494
0
                }
11495
0
                res = obj2ast_stmt(state, tmp2, &val, arena);
11496
0
                _Py_LeaveRecursiveCall();
11497
0
                Py_DECREF(tmp2);
11498
0
                if (res != 0) goto failed;
11499
0
                if (len != PyList_GET_SIZE(tmp)) {
11500
0
                    PyErr_SetString(PyExc_RuntimeError, "AsyncFunctionDef field \"body\" changed size during iteration");
11501
0
                    goto failed;
11502
0
                }
11503
0
                asdl_seq_SET(body, i, val);
11504
0
            }
11505
0
            Py_CLEAR(tmp);
11506
0
        }
11507
0
        if (PyObject_GetOptionalAttr(obj, state->decorator_list, &tmp) < 0) {
11508
0
            return -1;
11509
0
        }
11510
0
        if (tmp == NULL) {
11511
0
            tmp = PyList_New(0);
11512
0
            if (tmp == NULL) {
11513
0
                return -1;
11514
0
            }
11515
0
        }
11516
0
        {
11517
0
            int res;
11518
0
            Py_ssize_t len;
11519
0
            Py_ssize_t i;
11520
0
            if (!PyList_Check(tmp)) {
11521
0
                PyErr_Format(PyExc_TypeError, "AsyncFunctionDef field \"decorator_list\" must be a list, not a %.200s", _PyType_Name(Py_TYPE(tmp)));
11522
0
                goto failed;
11523
0
            }
11524
0
            len = PyList_GET_SIZE(tmp);
11525
0
            decorator_list = _Py_asdl_expr_seq_new(len, arena);
11526
0
            if (decorator_list == NULL) goto failed;
11527
0
            for (i = 0; i < len; i++) {
11528
0
                expr_ty val;
11529
0
                PyObject *tmp2 = Py_NewRef(PyList_GET_ITEM(tmp, i));
11530
0
                if (_Py_EnterRecursiveCall(" while traversing 'AsyncFunctionDef' node")) {
11531
0
                    goto failed;
11532
0
                }
11533
0
                res = obj2ast_expr(state, tmp2, &val, arena);
11534
0
                _Py_LeaveRecursiveCall();
11535
0
                Py_DECREF(tmp2);
11536
0
                if (res != 0) goto failed;
11537
0
                if (len != PyList_GET_SIZE(tmp)) {
11538
0
                    PyErr_SetString(PyExc_RuntimeError, "AsyncFunctionDef field \"decorator_list\" changed size during iteration");
11539
0
                    goto failed;
11540
0
                }
11541
0
                asdl_seq_SET(decorator_list, i, val);
11542
0
            }
11543
0
            Py_CLEAR(tmp);
11544
0
        }
11545
0
        if (PyObject_GetOptionalAttr(obj, state->returns, &tmp) < 0) {
11546
0
            return -1;
11547
0
        }
11548
0
        if (tmp == NULL || tmp == Py_None) {
11549
0
            Py_CLEAR(tmp);
11550
0
            returns = NULL;
11551
0
        }
11552
0
        else {
11553
0
            int res;
11554
0
            if (_Py_EnterRecursiveCall(" while traversing 'AsyncFunctionDef' node")) {
11555
0
                goto failed;
11556
0
            }
11557
0
            res = obj2ast_expr(state, tmp, &returns, arena);
11558
0
            _Py_LeaveRecursiveCall();
11559
0
            if (res != 0) goto failed;
11560
0
            Py_CLEAR(tmp);
11561
0
        }
11562
0
        if (PyObject_GetOptionalAttr(obj, state->type_comment, &tmp) < 0) {
11563
0
            return -1;
11564
0
        }
11565
0
        if (tmp == NULL || tmp == Py_None) {
11566
0
            Py_CLEAR(tmp);
11567
0
            type_comment = NULL;
11568
0
        }
11569
0
        else {
11570
0
            int res;
11571
0
            if (_Py_EnterRecursiveCall(" while traversing 'AsyncFunctionDef' node")) {
11572
0
                goto failed;
11573
0
            }
11574
0
            res = obj2ast_string(state, tmp, &type_comment, arena);
11575
0
            _Py_LeaveRecursiveCall();
11576
0
            if (res != 0) goto failed;
11577
0
            Py_CLEAR(tmp);
11578
0
        }
11579
0
        if (PyObject_GetOptionalAttr(obj, state->type_params, &tmp) < 0) {
11580
0
            return -1;
11581
0
        }
11582
0
        if (tmp == NULL) {
11583
0
            tmp = PyList_New(0);
11584
0
            if (tmp == NULL) {
11585
0
                return -1;
11586
0
            }
11587
0
        }
11588
0
        {
11589
0
            int res;
11590
0
            Py_ssize_t len;
11591
0
            Py_ssize_t i;
11592
0
            if (!PyList_Check(tmp)) {
11593
0
                PyErr_Format(PyExc_TypeError, "AsyncFunctionDef field \"type_params\" must be a list, not a %.200s", _PyType_Name(Py_TYPE(tmp)));
11594
0
                goto failed;
11595
0
            }
11596
0
            len = PyList_GET_SIZE(tmp);
11597
0
            type_params = _Py_asdl_type_param_seq_new(len, arena);
11598
0
            if (type_params == NULL) goto failed;
11599
0
            for (i = 0; i < len; i++) {
11600
0
                type_param_ty val;
11601
0
                PyObject *tmp2 = Py_NewRef(PyList_GET_ITEM(tmp, i));
11602
0
                if (_Py_EnterRecursiveCall(" while traversing 'AsyncFunctionDef' node")) {
11603
0
                    goto failed;
11604
0
                }
11605
0
                res = obj2ast_type_param(state, tmp2, &val, arena);
11606
0
                _Py_LeaveRecursiveCall();
11607
0
                Py_DECREF(tmp2);
11608
0
                if (res != 0) goto failed;
11609
0
                if (len != PyList_GET_SIZE(tmp)) {
11610
0
                    PyErr_SetString(PyExc_RuntimeError, "AsyncFunctionDef field \"type_params\" changed size during iteration");
11611
0
                    goto failed;
11612
0
                }
11613
0
                asdl_seq_SET(type_params, i, val);
11614
0
            }
11615
0
            Py_CLEAR(tmp);
11616
0
        }
11617
0
        *out = _PyAST_AsyncFunctionDef(name, args, body, decorator_list,
11618
0
                                       returns, type_comment, type_params,
11619
0
                                       lineno, col_offset, end_lineno,
11620
0
                                       end_col_offset, arena);
11621
0
        if (*out == NULL) goto failed;
11622
0
        return 0;
11623
0
    }
11624
0
    tp = state->ClassDef_type;
11625
0
    isinstance = PyObject_IsInstance(obj, tp);
11626
0
    if (isinstance == -1) {
11627
0
        return -1;
11628
0
    }
11629
0
    if (isinstance) {
11630
0
        identifier name;
11631
0
        asdl_expr_seq* bases;
11632
0
        asdl_keyword_seq* keywords;
11633
0
        asdl_stmt_seq* body;
11634
0
        asdl_expr_seq* decorator_list;
11635
0
        asdl_type_param_seq* type_params;
11636
11637
0
        if (PyObject_GetOptionalAttr(obj, state->name, &tmp) < 0) {
11638
0
            return -1;
11639
0
        }
11640
0
        if (tmp == NULL) {
11641
0
            PyErr_SetString(PyExc_TypeError, "required field \"name\" missing from ClassDef");
11642
0
            return -1;
11643
0
        }
11644
0
        else {
11645
0
            int res;
11646
0
            if (_Py_EnterRecursiveCall(" while traversing 'ClassDef' node")) {
11647
0
                goto failed;
11648
0
            }
11649
0
            res = obj2ast_identifier(state, tmp, &name, arena);
11650
0
            _Py_LeaveRecursiveCall();
11651
0
            if (res != 0) goto failed;
11652
0
            Py_CLEAR(tmp);
11653
0
        }
11654
0
        if (PyObject_GetOptionalAttr(obj, state->bases, &tmp) < 0) {
11655
0
            return -1;
11656
0
        }
11657
0
        if (tmp == NULL) {
11658
0
            tmp = PyList_New(0);
11659
0
            if (tmp == NULL) {
11660
0
                return -1;
11661
0
            }
11662
0
        }
11663
0
        {
11664
0
            int res;
11665
0
            Py_ssize_t len;
11666
0
            Py_ssize_t i;
11667
0
            if (!PyList_Check(tmp)) {
11668
0
                PyErr_Format(PyExc_TypeError, "ClassDef field \"bases\" must be a list, not a %.200s", _PyType_Name(Py_TYPE(tmp)));
11669
0
                goto failed;
11670
0
            }
11671
0
            len = PyList_GET_SIZE(tmp);
11672
0
            bases = _Py_asdl_expr_seq_new(len, arena);
11673
0
            if (bases == NULL) goto failed;
11674
0
            for (i = 0; i < len; i++) {
11675
0
                expr_ty val;
11676
0
                PyObject *tmp2 = Py_NewRef(PyList_GET_ITEM(tmp, i));
11677
0
                if (_Py_EnterRecursiveCall(" while traversing 'ClassDef' node")) {
11678
0
                    goto failed;
11679
0
                }
11680
0
                res = obj2ast_expr(state, tmp2, &val, arena);
11681
0
                _Py_LeaveRecursiveCall();
11682
0
                Py_DECREF(tmp2);
11683
0
                if (res != 0) goto failed;
11684
0
                if (len != PyList_GET_SIZE(tmp)) {
11685
0
                    PyErr_SetString(PyExc_RuntimeError, "ClassDef field \"bases\" changed size during iteration");
11686
0
                    goto failed;
11687
0
                }
11688
0
                asdl_seq_SET(bases, i, val);
11689
0
            }
11690
0
            Py_CLEAR(tmp);
11691
0
        }
11692
0
        if (PyObject_GetOptionalAttr(obj, state->keywords, &tmp) < 0) {
11693
0
            return -1;
11694
0
        }
11695
0
        if (tmp == NULL) {
11696
0
            tmp = PyList_New(0);
11697
0
            if (tmp == NULL) {
11698
0
                return -1;
11699
0
            }
11700
0
        }
11701
0
        {
11702
0
            int res;
11703
0
            Py_ssize_t len;
11704
0
            Py_ssize_t i;
11705
0
            if (!PyList_Check(tmp)) {
11706
0
                PyErr_Format(PyExc_TypeError, "ClassDef field \"keywords\" must be a list, not a %.200s", _PyType_Name(Py_TYPE(tmp)));
11707
0
                goto failed;
11708
0
            }
11709
0
            len = PyList_GET_SIZE(tmp);
11710
0
            keywords = _Py_asdl_keyword_seq_new(len, arena);
11711
0
            if (keywords == NULL) goto failed;
11712
0
            for (i = 0; i < len; i++) {
11713
0
                keyword_ty val;
11714
0
                PyObject *tmp2 = Py_NewRef(PyList_GET_ITEM(tmp, i));
11715
0
                if (_Py_EnterRecursiveCall(" while traversing 'ClassDef' node")) {
11716
0
                    goto failed;
11717
0
                }
11718
0
                res = obj2ast_keyword(state, tmp2, &val, arena);
11719
0
                _Py_LeaveRecursiveCall();
11720
0
                Py_DECREF(tmp2);
11721
0
                if (res != 0) goto failed;
11722
0
                if (len != PyList_GET_SIZE(tmp)) {
11723
0
                    PyErr_SetString(PyExc_RuntimeError, "ClassDef field \"keywords\" changed size during iteration");
11724
0
                    goto failed;
11725
0
                }
11726
0
                asdl_seq_SET(keywords, i, val);
11727
0
            }
11728
0
            Py_CLEAR(tmp);
11729
0
        }
11730
0
        if (PyObject_GetOptionalAttr(obj, state->body, &tmp) < 0) {
11731
0
            return -1;
11732
0
        }
11733
0
        if (tmp == NULL) {
11734
0
            tmp = PyList_New(0);
11735
0
            if (tmp == NULL) {
11736
0
                return -1;
11737
0
            }
11738
0
        }
11739
0
        {
11740
0
            int res;
11741
0
            Py_ssize_t len;
11742
0
            Py_ssize_t i;
11743
0
            if (!PyList_Check(tmp)) {
11744
0
                PyErr_Format(PyExc_TypeError, "ClassDef field \"body\" must be a list, not a %.200s", _PyType_Name(Py_TYPE(tmp)));
11745
0
                goto failed;
11746
0
            }
11747
0
            len = PyList_GET_SIZE(tmp);
11748
0
            body = _Py_asdl_stmt_seq_new(len, arena);
11749
0
            if (body == NULL) goto failed;
11750
0
            for (i = 0; i < len; i++) {
11751
0
                stmt_ty val;
11752
0
                PyObject *tmp2 = Py_NewRef(PyList_GET_ITEM(tmp, i));
11753
0
                if (_Py_EnterRecursiveCall(" while traversing 'ClassDef' node")) {
11754
0
                    goto failed;
11755
0
                }
11756
0
                res = obj2ast_stmt(state, tmp2, &val, arena);
11757
0
                _Py_LeaveRecursiveCall();
11758
0
                Py_DECREF(tmp2);
11759
0
                if (res != 0) goto failed;
11760
0
                if (len != PyList_GET_SIZE(tmp)) {
11761
0
                    PyErr_SetString(PyExc_RuntimeError, "ClassDef field \"body\" changed size during iteration");
11762
0
                    goto failed;
11763
0
                }
11764
0
                asdl_seq_SET(body, i, val);
11765
0
            }
11766
0
            Py_CLEAR(tmp);
11767
0
        }
11768
0
        if (PyObject_GetOptionalAttr(obj, state->decorator_list, &tmp) < 0) {
11769
0
            return -1;
11770
0
        }
11771
0
        if (tmp == NULL) {
11772
0
            tmp = PyList_New(0);
11773
0
            if (tmp == NULL) {
11774
0
                return -1;
11775
0
            }
11776
0
        }
11777
0
        {
11778
0
            int res;
11779
0
            Py_ssize_t len;
11780
0
            Py_ssize_t i;
11781
0
            if (!PyList_Check(tmp)) {
11782
0
                PyErr_Format(PyExc_TypeError, "ClassDef field \"decorator_list\" must be a list, not a %.200s", _PyType_Name(Py_TYPE(tmp)));
11783
0
                goto failed;
11784
0
            }
11785
0
            len = PyList_GET_SIZE(tmp);
11786
0
            decorator_list = _Py_asdl_expr_seq_new(len, arena);
11787
0
            if (decorator_list == NULL) goto failed;
11788
0
            for (i = 0; i < len; i++) {
11789
0
                expr_ty val;
11790
0
                PyObject *tmp2 = Py_NewRef(PyList_GET_ITEM(tmp, i));
11791
0
                if (_Py_EnterRecursiveCall(" while traversing 'ClassDef' node")) {
11792
0
                    goto failed;
11793
0
                }
11794
0
                res = obj2ast_expr(state, tmp2, &val, arena);
11795
0
                _Py_LeaveRecursiveCall();
11796
0
                Py_DECREF(tmp2);
11797
0
                if (res != 0) goto failed;
11798
0
                if (len != PyList_GET_SIZE(tmp)) {
11799
0
                    PyErr_SetString(PyExc_RuntimeError, "ClassDef field \"decorator_list\" changed size during iteration");
11800
0
                    goto failed;
11801
0
                }
11802
0
                asdl_seq_SET(decorator_list, i, val);
11803
0
            }
11804
0
            Py_CLEAR(tmp);
11805
0
        }
11806
0
        if (PyObject_GetOptionalAttr(obj, state->type_params, &tmp) < 0) {
11807
0
            return -1;
11808
0
        }
11809
0
        if (tmp == NULL) {
11810
0
            tmp = PyList_New(0);
11811
0
            if (tmp == NULL) {
11812
0
                return -1;
11813
0
            }
11814
0
        }
11815
0
        {
11816
0
            int res;
11817
0
            Py_ssize_t len;
11818
0
            Py_ssize_t i;
11819
0
            if (!PyList_Check(tmp)) {
11820
0
                PyErr_Format(PyExc_TypeError, "ClassDef field \"type_params\" must be a list, not a %.200s", _PyType_Name(Py_TYPE(tmp)));
11821
0
                goto failed;
11822
0
            }
11823
0
            len = PyList_GET_SIZE(tmp);
11824
0
            type_params = _Py_asdl_type_param_seq_new(len, arena);
11825
0
            if (type_params == NULL) goto failed;
11826
0
            for (i = 0; i < len; i++) {
11827
0
                type_param_ty val;
11828
0
                PyObject *tmp2 = Py_NewRef(PyList_GET_ITEM(tmp, i));
11829
0
                if (_Py_EnterRecursiveCall(" while traversing 'ClassDef' node")) {
11830
0
                    goto failed;
11831
0
                }
11832
0
                res = obj2ast_type_param(state, tmp2, &val, arena);
11833
0
                _Py_LeaveRecursiveCall();
11834
0
                Py_DECREF(tmp2);
11835
0
                if (res != 0) goto failed;
11836
0
                if (len != PyList_GET_SIZE(tmp)) {
11837
0
                    PyErr_SetString(PyExc_RuntimeError, "ClassDef field \"type_params\" changed size during iteration");
11838
0
                    goto failed;
11839
0
                }
11840
0
                asdl_seq_SET(type_params, i, val);
11841
0
            }
11842
0
            Py_CLEAR(tmp);
11843
0
        }
11844
0
        *out = _PyAST_ClassDef(name, bases, keywords, body, decorator_list,
11845
0
                               type_params, lineno, col_offset, end_lineno,
11846
0
                               end_col_offset, arena);
11847
0
        if (*out == NULL) goto failed;
11848
0
        return 0;
11849
0
    }
11850
0
    tp = state->Return_type;
11851
0
    isinstance = PyObject_IsInstance(obj, tp);
11852
0
    if (isinstance == -1) {
11853
0
        return -1;
11854
0
    }
11855
0
    if (isinstance) {
11856
0
        expr_ty value;
11857
11858
0
        if (PyObject_GetOptionalAttr(obj, state->value, &tmp) < 0) {
11859
0
            return -1;
11860
0
        }
11861
0
        if (tmp == NULL || tmp == Py_None) {
11862
0
            Py_CLEAR(tmp);
11863
0
            value = NULL;
11864
0
        }
11865
0
        else {
11866
0
            int res;
11867
0
            if (_Py_EnterRecursiveCall(" while traversing 'Return' node")) {
11868
0
                goto failed;
11869
0
            }
11870
0
            res = obj2ast_expr(state, tmp, &value, arena);
11871
0
            _Py_LeaveRecursiveCall();
11872
0
            if (res != 0) goto failed;
11873
0
            Py_CLEAR(tmp);
11874
0
        }
11875
0
        *out = _PyAST_Return(value, lineno, col_offset, end_lineno,
11876
0
                             end_col_offset, arena);
11877
0
        if (*out == NULL) goto failed;
11878
0
        return 0;
11879
0
    }
11880
0
    tp = state->Delete_type;
11881
0
    isinstance = PyObject_IsInstance(obj, tp);
11882
0
    if (isinstance == -1) {
11883
0
        return -1;
11884
0
    }
11885
0
    if (isinstance) {
11886
0
        asdl_expr_seq* targets;
11887
11888
0
        if (PyObject_GetOptionalAttr(obj, state->targets, &tmp) < 0) {
11889
0
            return -1;
11890
0
        }
11891
0
        if (tmp == NULL) {
11892
0
            tmp = PyList_New(0);
11893
0
            if (tmp == NULL) {
11894
0
                return -1;
11895
0
            }
11896
0
        }
11897
0
        {
11898
0
            int res;
11899
0
            Py_ssize_t len;
11900
0
            Py_ssize_t i;
11901
0
            if (!PyList_Check(tmp)) {
11902
0
                PyErr_Format(PyExc_TypeError, "Delete field \"targets\" must be a list, not a %.200s", _PyType_Name(Py_TYPE(tmp)));
11903
0
                goto failed;
11904
0
            }
11905
0
            len = PyList_GET_SIZE(tmp);
11906
0
            targets = _Py_asdl_expr_seq_new(len, arena);
11907
0
            if (targets == NULL) goto failed;
11908
0
            for (i = 0; i < len; i++) {
11909
0
                expr_ty val;
11910
0
                PyObject *tmp2 = Py_NewRef(PyList_GET_ITEM(tmp, i));
11911
0
                if (_Py_EnterRecursiveCall(" while traversing 'Delete' node")) {
11912
0
                    goto failed;
11913
0
                }
11914
0
                res = obj2ast_expr(state, tmp2, &val, arena);
11915
0
                _Py_LeaveRecursiveCall();
11916
0
                Py_DECREF(tmp2);
11917
0
                if (res != 0) goto failed;
11918
0
                if (len != PyList_GET_SIZE(tmp)) {
11919
0
                    PyErr_SetString(PyExc_RuntimeError, "Delete field \"targets\" changed size during iteration");
11920
0
                    goto failed;
11921
0
                }
11922
0
                asdl_seq_SET(targets, i, val);
11923
0
            }
11924
0
            Py_CLEAR(tmp);
11925
0
        }
11926
0
        *out = _PyAST_Delete(targets, lineno, col_offset, end_lineno,
11927
0
                             end_col_offset, arena);
11928
0
        if (*out == NULL) goto failed;
11929
0
        return 0;
11930
0
    }
11931
0
    tp = state->Assign_type;
11932
0
    isinstance = PyObject_IsInstance(obj, tp);
11933
0
    if (isinstance == -1) {
11934
0
        return -1;
11935
0
    }
11936
0
    if (isinstance) {
11937
0
        asdl_expr_seq* targets;
11938
0
        expr_ty value;
11939
0
        string type_comment;
11940
11941
0
        if (PyObject_GetOptionalAttr(obj, state->targets, &tmp) < 0) {
11942
0
            return -1;
11943
0
        }
11944
0
        if (tmp == NULL) {
11945
0
            tmp = PyList_New(0);
11946
0
            if (tmp == NULL) {
11947
0
                return -1;
11948
0
            }
11949
0
        }
11950
0
        {
11951
0
            int res;
11952
0
            Py_ssize_t len;
11953
0
            Py_ssize_t i;
11954
0
            if (!PyList_Check(tmp)) {
11955
0
                PyErr_Format(PyExc_TypeError, "Assign field \"targets\" must be a list, not a %.200s", _PyType_Name(Py_TYPE(tmp)));
11956
0
                goto failed;
11957
0
            }
11958
0
            len = PyList_GET_SIZE(tmp);
11959
0
            targets = _Py_asdl_expr_seq_new(len, arena);
11960
0
            if (targets == NULL) goto failed;
11961
0
            for (i = 0; i < len; i++) {
11962
0
                expr_ty val;
11963
0
                PyObject *tmp2 = Py_NewRef(PyList_GET_ITEM(tmp, i));
11964
0
                if (_Py_EnterRecursiveCall(" while traversing 'Assign' node")) {
11965
0
                    goto failed;
11966
0
                }
11967
0
                res = obj2ast_expr(state, tmp2, &val, arena);
11968
0
                _Py_LeaveRecursiveCall();
11969
0
                Py_DECREF(tmp2);
11970
0
                if (res != 0) goto failed;
11971
0
                if (len != PyList_GET_SIZE(tmp)) {
11972
0
                    PyErr_SetString(PyExc_RuntimeError, "Assign field \"targets\" changed size during iteration");
11973
0
                    goto failed;
11974
0
                }
11975
0
                asdl_seq_SET(targets, i, val);
11976
0
            }
11977
0
            Py_CLEAR(tmp);
11978
0
        }
11979
0
        if (PyObject_GetOptionalAttr(obj, state->value, &tmp) < 0) {
11980
0
            return -1;
11981
0
        }
11982
0
        if (tmp == NULL) {
11983
0
            PyErr_SetString(PyExc_TypeError, "required field \"value\" missing from Assign");
11984
0
            return -1;
11985
0
        }
11986
0
        else {
11987
0
            int res;
11988
0
            if (_Py_EnterRecursiveCall(" while traversing 'Assign' node")) {
11989
0
                goto failed;
11990
0
            }
11991
0
            res = obj2ast_expr(state, tmp, &value, arena);
11992
0
            _Py_LeaveRecursiveCall();
11993
0
            if (res != 0) goto failed;
11994
0
            Py_CLEAR(tmp);
11995
0
        }
11996
0
        if (PyObject_GetOptionalAttr(obj, state->type_comment, &tmp) < 0) {
11997
0
            return -1;
11998
0
        }
11999
0
        if (tmp == NULL || tmp == Py_None) {
12000
0
            Py_CLEAR(tmp);
12001
0
            type_comment = NULL;
12002
0
        }
12003
0
        else {
12004
0
            int res;
12005
0
            if (_Py_EnterRecursiveCall(" while traversing 'Assign' node")) {
12006
0
                goto failed;
12007
0
            }
12008
0
            res = obj2ast_string(state, tmp, &type_comment, arena);
12009
0
            _Py_LeaveRecursiveCall();
12010
0
            if (res != 0) goto failed;
12011
0
            Py_CLEAR(tmp);
12012
0
        }
12013
0
        *out = _PyAST_Assign(targets, value, type_comment, lineno, col_offset,
12014
0
                             end_lineno, end_col_offset, arena);
12015
0
        if (*out == NULL) goto failed;
12016
0
        return 0;
12017
0
    }
12018
0
    tp = state->TypeAlias_type;
12019
0
    isinstance = PyObject_IsInstance(obj, tp);
12020
0
    if (isinstance == -1) {
12021
0
        return -1;
12022
0
    }
12023
0
    if (isinstance) {
12024
0
        expr_ty name;
12025
0
        asdl_type_param_seq* type_params;
12026
0
        expr_ty value;
12027
12028
0
        if (PyObject_GetOptionalAttr(obj, state->name, &tmp) < 0) {
12029
0
            return -1;
12030
0
        }
12031
0
        if (tmp == NULL) {
12032
0
            PyErr_SetString(PyExc_TypeError, "required field \"name\" missing from TypeAlias");
12033
0
            return -1;
12034
0
        }
12035
0
        else {
12036
0
            int res;
12037
0
            if (_Py_EnterRecursiveCall(" while traversing 'TypeAlias' node")) {
12038
0
                goto failed;
12039
0
            }
12040
0
            res = obj2ast_expr(state, tmp, &name, arena);
12041
0
            _Py_LeaveRecursiveCall();
12042
0
            if (res != 0) goto failed;
12043
0
            Py_CLEAR(tmp);
12044
0
        }
12045
0
        if (PyObject_GetOptionalAttr(obj, state->type_params, &tmp) < 0) {
12046
0
            return -1;
12047
0
        }
12048
0
        if (tmp == NULL) {
12049
0
            tmp = PyList_New(0);
12050
0
            if (tmp == NULL) {
12051
0
                return -1;
12052
0
            }
12053
0
        }
12054
0
        {
12055
0
            int res;
12056
0
            Py_ssize_t len;
12057
0
            Py_ssize_t i;
12058
0
            if (!PyList_Check(tmp)) {
12059
0
                PyErr_Format(PyExc_TypeError, "TypeAlias field \"type_params\" must be a list, not a %.200s", _PyType_Name(Py_TYPE(tmp)));
12060
0
                goto failed;
12061
0
            }
12062
0
            len = PyList_GET_SIZE(tmp);
12063
0
            type_params = _Py_asdl_type_param_seq_new(len, arena);
12064
0
            if (type_params == NULL) goto failed;
12065
0
            for (i = 0; i < len; i++) {
12066
0
                type_param_ty val;
12067
0
                PyObject *tmp2 = Py_NewRef(PyList_GET_ITEM(tmp, i));
12068
0
                if (_Py_EnterRecursiveCall(" while traversing 'TypeAlias' node")) {
12069
0
                    goto failed;
12070
0
                }
12071
0
                res = obj2ast_type_param(state, tmp2, &val, arena);
12072
0
                _Py_LeaveRecursiveCall();
12073
0
                Py_DECREF(tmp2);
12074
0
                if (res != 0) goto failed;
12075
0
                if (len != PyList_GET_SIZE(tmp)) {
12076
0
                    PyErr_SetString(PyExc_RuntimeError, "TypeAlias field \"type_params\" changed size during iteration");
12077
0
                    goto failed;
12078
0
                }
12079
0
                asdl_seq_SET(type_params, i, val);
12080
0
            }
12081
0
            Py_CLEAR(tmp);
12082
0
        }
12083
0
        if (PyObject_GetOptionalAttr(obj, state->value, &tmp) < 0) {
12084
0
            return -1;
12085
0
        }
12086
0
        if (tmp == NULL) {
12087
0
            PyErr_SetString(PyExc_TypeError, "required field \"value\" missing from TypeAlias");
12088
0
            return -1;
12089
0
        }
12090
0
        else {
12091
0
            int res;
12092
0
            if (_Py_EnterRecursiveCall(" while traversing 'TypeAlias' node")) {
12093
0
                goto failed;
12094
0
            }
12095
0
            res = obj2ast_expr(state, tmp, &value, arena);
12096
0
            _Py_LeaveRecursiveCall();
12097
0
            if (res != 0) goto failed;
12098
0
            Py_CLEAR(tmp);
12099
0
        }
12100
0
        *out = _PyAST_TypeAlias(name, type_params, value, lineno, col_offset,
12101
0
                                end_lineno, end_col_offset, arena);
12102
0
        if (*out == NULL) goto failed;
12103
0
        return 0;
12104
0
    }
12105
0
    tp = state->AugAssign_type;
12106
0
    isinstance = PyObject_IsInstance(obj, tp);
12107
0
    if (isinstance == -1) {
12108
0
        return -1;
12109
0
    }
12110
0
    if (isinstance) {
12111
0
        expr_ty target;
12112
0
        operator_ty op;
12113
0
        expr_ty value;
12114
12115
0
        if (PyObject_GetOptionalAttr(obj, state->target, &tmp) < 0) {
12116
0
            return -1;
12117
0
        }
12118
0
        if (tmp == NULL) {
12119
0
            PyErr_SetString(PyExc_TypeError, "required field \"target\" missing from AugAssign");
12120
0
            return -1;
12121
0
        }
12122
0
        else {
12123
0
            int res;
12124
0
            if (_Py_EnterRecursiveCall(" while traversing 'AugAssign' node")) {
12125
0
                goto failed;
12126
0
            }
12127
0
            res = obj2ast_expr(state, tmp, &target, arena);
12128
0
            _Py_LeaveRecursiveCall();
12129
0
            if (res != 0) goto failed;
12130
0
            Py_CLEAR(tmp);
12131
0
        }
12132
0
        if (PyObject_GetOptionalAttr(obj, state->op, &tmp) < 0) {
12133
0
            return -1;
12134
0
        }
12135
0
        if (tmp == NULL) {
12136
0
            PyErr_SetString(PyExc_TypeError, "required field \"op\" missing from AugAssign");
12137
0
            return -1;
12138
0
        }
12139
0
        else {
12140
0
            int res;
12141
0
            if (_Py_EnterRecursiveCall(" while traversing 'AugAssign' node")) {
12142
0
                goto failed;
12143
0
            }
12144
0
            res = obj2ast_operator(state, tmp, &op, arena);
12145
0
            _Py_LeaveRecursiveCall();
12146
0
            if (res != 0) goto failed;
12147
0
            Py_CLEAR(tmp);
12148
0
        }
12149
0
        if (PyObject_GetOptionalAttr(obj, state->value, &tmp) < 0) {
12150
0
            return -1;
12151
0
        }
12152
0
        if (tmp == NULL) {
12153
0
            PyErr_SetString(PyExc_TypeError, "required field \"value\" missing from AugAssign");
12154
0
            return -1;
12155
0
        }
12156
0
        else {
12157
0
            int res;
12158
0
            if (_Py_EnterRecursiveCall(" while traversing 'AugAssign' node")) {
12159
0
                goto failed;
12160
0
            }
12161
0
            res = obj2ast_expr(state, tmp, &value, arena);
12162
0
            _Py_LeaveRecursiveCall();
12163
0
            if (res != 0) goto failed;
12164
0
            Py_CLEAR(tmp);
12165
0
        }
12166
0
        *out = _PyAST_AugAssign(target, op, value, lineno, col_offset,
12167
0
                                end_lineno, end_col_offset, arena);
12168
0
        if (*out == NULL) goto failed;
12169
0
        return 0;
12170
0
    }
12171
0
    tp = state->AnnAssign_type;
12172
0
    isinstance = PyObject_IsInstance(obj, tp);
12173
0
    if (isinstance == -1) {
12174
0
        return -1;
12175
0
    }
12176
0
    if (isinstance) {
12177
0
        expr_ty target;
12178
0
        expr_ty annotation;
12179
0
        expr_ty value;
12180
0
        int simple;
12181
12182
0
        if (PyObject_GetOptionalAttr(obj, state->target, &tmp) < 0) {
12183
0
            return -1;
12184
0
        }
12185
0
        if (tmp == NULL) {
12186
0
            PyErr_SetString(PyExc_TypeError, "required field \"target\" missing from AnnAssign");
12187
0
            return -1;
12188
0
        }
12189
0
        else {
12190
0
            int res;
12191
0
            if (_Py_EnterRecursiveCall(" while traversing 'AnnAssign' node")) {
12192
0
                goto failed;
12193
0
            }
12194
0
            res = obj2ast_expr(state, tmp, &target, arena);
12195
0
            _Py_LeaveRecursiveCall();
12196
0
            if (res != 0) goto failed;
12197
0
            Py_CLEAR(tmp);
12198
0
        }
12199
0
        if (PyObject_GetOptionalAttr(obj, state->annotation, &tmp) < 0) {
12200
0
            return -1;
12201
0
        }
12202
0
        if (tmp == NULL) {
12203
0
            PyErr_SetString(PyExc_TypeError, "required field \"annotation\" missing from AnnAssign");
12204
0
            return -1;
12205
0
        }
12206
0
        else {
12207
0
            int res;
12208
0
            if (_Py_EnterRecursiveCall(" while traversing 'AnnAssign' node")) {
12209
0
                goto failed;
12210
0
            }
12211
0
            res = obj2ast_expr(state, tmp, &annotation, arena);
12212
0
            _Py_LeaveRecursiveCall();
12213
0
            if (res != 0) goto failed;
12214
0
            Py_CLEAR(tmp);
12215
0
        }
12216
0
        if (PyObject_GetOptionalAttr(obj, state->value, &tmp) < 0) {
12217
0
            return -1;
12218
0
        }
12219
0
        if (tmp == NULL || tmp == Py_None) {
12220
0
            Py_CLEAR(tmp);
12221
0
            value = NULL;
12222
0
        }
12223
0
        else {
12224
0
            int res;
12225
0
            if (_Py_EnterRecursiveCall(" while traversing 'AnnAssign' node")) {
12226
0
                goto failed;
12227
0
            }
12228
0
            res = obj2ast_expr(state, tmp, &value, arena);
12229
0
            _Py_LeaveRecursiveCall();
12230
0
            if (res != 0) goto failed;
12231
0
            Py_CLEAR(tmp);
12232
0
        }
12233
0
        if (PyObject_GetOptionalAttr(obj, state->simple, &tmp) < 0) {
12234
0
            return -1;
12235
0
        }
12236
0
        if (tmp == NULL) {
12237
0
            PyErr_SetString(PyExc_TypeError, "required field \"simple\" missing from AnnAssign");
12238
0
            return -1;
12239
0
        }
12240
0
        else {
12241
0
            int res;
12242
0
            if (_Py_EnterRecursiveCall(" while traversing 'AnnAssign' node")) {
12243
0
                goto failed;
12244
0
            }
12245
0
            res = obj2ast_int(state, tmp, &simple, arena);
12246
0
            _Py_LeaveRecursiveCall();
12247
0
            if (res != 0) goto failed;
12248
0
            Py_CLEAR(tmp);
12249
0
        }
12250
0
        *out = _PyAST_AnnAssign(target, annotation, value, simple, lineno,
12251
0
                                col_offset, end_lineno, end_col_offset, arena);
12252
0
        if (*out == NULL) goto failed;
12253
0
        return 0;
12254
0
    }
12255
0
    tp = state->For_type;
12256
0
    isinstance = PyObject_IsInstance(obj, tp);
12257
0
    if (isinstance == -1) {
12258
0
        return -1;
12259
0
    }
12260
0
    if (isinstance) {
12261
0
        expr_ty target;
12262
0
        expr_ty iter;
12263
0
        asdl_stmt_seq* body;
12264
0
        asdl_stmt_seq* orelse;
12265
0
        string type_comment;
12266
12267
0
        if (PyObject_GetOptionalAttr(obj, state->target, &tmp) < 0) {
12268
0
            return -1;
12269
0
        }
12270
0
        if (tmp == NULL) {
12271
0
            PyErr_SetString(PyExc_TypeError, "required field \"target\" missing from For");
12272
0
            return -1;
12273
0
        }
12274
0
        else {
12275
0
            int res;
12276
0
            if (_Py_EnterRecursiveCall(" while traversing 'For' node")) {
12277
0
                goto failed;
12278
0
            }
12279
0
            res = obj2ast_expr(state, tmp, &target, arena);
12280
0
            _Py_LeaveRecursiveCall();
12281
0
            if (res != 0) goto failed;
12282
0
            Py_CLEAR(tmp);
12283
0
        }
12284
0
        if (PyObject_GetOptionalAttr(obj, state->iter, &tmp) < 0) {
12285
0
            return -1;
12286
0
        }
12287
0
        if (tmp == NULL) {
12288
0
            PyErr_SetString(PyExc_TypeError, "required field \"iter\" missing from For");
12289
0
            return -1;
12290
0
        }
12291
0
        else {
12292
0
            int res;
12293
0
            if (_Py_EnterRecursiveCall(" while traversing 'For' node")) {
12294
0
                goto failed;
12295
0
            }
12296
0
            res = obj2ast_expr(state, tmp, &iter, arena);
12297
0
            _Py_LeaveRecursiveCall();
12298
0
            if (res != 0) goto failed;
12299
0
            Py_CLEAR(tmp);
12300
0
        }
12301
0
        if (PyObject_GetOptionalAttr(obj, state->body, &tmp) < 0) {
12302
0
            return -1;
12303
0
        }
12304
0
        if (tmp == NULL) {
12305
0
            tmp = PyList_New(0);
12306
0
            if (tmp == NULL) {
12307
0
                return -1;
12308
0
            }
12309
0
        }
12310
0
        {
12311
0
            int res;
12312
0
            Py_ssize_t len;
12313
0
            Py_ssize_t i;
12314
0
            if (!PyList_Check(tmp)) {
12315
0
                PyErr_Format(PyExc_TypeError, "For field \"body\" must be a list, not a %.200s", _PyType_Name(Py_TYPE(tmp)));
12316
0
                goto failed;
12317
0
            }
12318
0
            len = PyList_GET_SIZE(tmp);
12319
0
            body = _Py_asdl_stmt_seq_new(len, arena);
12320
0
            if (body == NULL) goto failed;
12321
0
            for (i = 0; i < len; i++) {
12322
0
                stmt_ty val;
12323
0
                PyObject *tmp2 = Py_NewRef(PyList_GET_ITEM(tmp, i));
12324
0
                if (_Py_EnterRecursiveCall(" while traversing 'For' node")) {
12325
0
                    goto failed;
12326
0
                }
12327
0
                res = obj2ast_stmt(state, tmp2, &val, arena);
12328
0
                _Py_LeaveRecursiveCall();
12329
0
                Py_DECREF(tmp2);
12330
0
                if (res != 0) goto failed;
12331
0
                if (len != PyList_GET_SIZE(tmp)) {
12332
0
                    PyErr_SetString(PyExc_RuntimeError, "For field \"body\" changed size during iteration");
12333
0
                    goto failed;
12334
0
                }
12335
0
                asdl_seq_SET(body, i, val);
12336
0
            }
12337
0
            Py_CLEAR(tmp);
12338
0
        }
12339
0
        if (PyObject_GetOptionalAttr(obj, state->orelse, &tmp) < 0) {
12340
0
            return -1;
12341
0
        }
12342
0
        if (tmp == NULL) {
12343
0
            tmp = PyList_New(0);
12344
0
            if (tmp == NULL) {
12345
0
                return -1;
12346
0
            }
12347
0
        }
12348
0
        {
12349
0
            int res;
12350
0
            Py_ssize_t len;
12351
0
            Py_ssize_t i;
12352
0
            if (!PyList_Check(tmp)) {
12353
0
                PyErr_Format(PyExc_TypeError, "For field \"orelse\" must be a list, not a %.200s", _PyType_Name(Py_TYPE(tmp)));
12354
0
                goto failed;
12355
0
            }
12356
0
            len = PyList_GET_SIZE(tmp);
12357
0
            orelse = _Py_asdl_stmt_seq_new(len, arena);
12358
0
            if (orelse == NULL) goto failed;
12359
0
            for (i = 0; i < len; i++) {
12360
0
                stmt_ty val;
12361
0
                PyObject *tmp2 = Py_NewRef(PyList_GET_ITEM(tmp, i));
12362
0
                if (_Py_EnterRecursiveCall(" while traversing 'For' node")) {
12363
0
                    goto failed;
12364
0
                }
12365
0
                res = obj2ast_stmt(state, tmp2, &val, arena);
12366
0
                _Py_LeaveRecursiveCall();
12367
0
                Py_DECREF(tmp2);
12368
0
                if (res != 0) goto failed;
12369
0
                if (len != PyList_GET_SIZE(tmp)) {
12370
0
                    PyErr_SetString(PyExc_RuntimeError, "For field \"orelse\" changed size during iteration");
12371
0
                    goto failed;
12372
0
                }
12373
0
                asdl_seq_SET(orelse, i, val);
12374
0
            }
12375
0
            Py_CLEAR(tmp);
12376
0
        }
12377
0
        if (PyObject_GetOptionalAttr(obj, state->type_comment, &tmp) < 0) {
12378
0
            return -1;
12379
0
        }
12380
0
        if (tmp == NULL || tmp == Py_None) {
12381
0
            Py_CLEAR(tmp);
12382
0
            type_comment = NULL;
12383
0
        }
12384
0
        else {
12385
0
            int res;
12386
0
            if (_Py_EnterRecursiveCall(" while traversing 'For' node")) {
12387
0
                goto failed;
12388
0
            }
12389
0
            res = obj2ast_string(state, tmp, &type_comment, arena);
12390
0
            _Py_LeaveRecursiveCall();
12391
0
            if (res != 0) goto failed;
12392
0
            Py_CLEAR(tmp);
12393
0
        }
12394
0
        *out = _PyAST_For(target, iter, body, orelse, type_comment, lineno,
12395
0
                          col_offset, end_lineno, end_col_offset, arena);
12396
0
        if (*out == NULL) goto failed;
12397
0
        return 0;
12398
0
    }
12399
0
    tp = state->AsyncFor_type;
12400
0
    isinstance = PyObject_IsInstance(obj, tp);
12401
0
    if (isinstance == -1) {
12402
0
        return -1;
12403
0
    }
12404
0
    if (isinstance) {
12405
0
        expr_ty target;
12406
0
        expr_ty iter;
12407
0
        asdl_stmt_seq* body;
12408
0
        asdl_stmt_seq* orelse;
12409
0
        string type_comment;
12410
12411
0
        if (PyObject_GetOptionalAttr(obj, state->target, &tmp) < 0) {
12412
0
            return -1;
12413
0
        }
12414
0
        if (tmp == NULL) {
12415
0
            PyErr_SetString(PyExc_TypeError, "required field \"target\" missing from AsyncFor");
12416
0
            return -1;
12417
0
        }
12418
0
        else {
12419
0
            int res;
12420
0
            if (_Py_EnterRecursiveCall(" while traversing 'AsyncFor' node")) {
12421
0
                goto failed;
12422
0
            }
12423
0
            res = obj2ast_expr(state, tmp, &target, arena);
12424
0
            _Py_LeaveRecursiveCall();
12425
0
            if (res != 0) goto failed;
12426
0
            Py_CLEAR(tmp);
12427
0
        }
12428
0
        if (PyObject_GetOptionalAttr(obj, state->iter, &tmp) < 0) {
12429
0
            return -1;
12430
0
        }
12431
0
        if (tmp == NULL) {
12432
0
            PyErr_SetString(PyExc_TypeError, "required field \"iter\" missing from AsyncFor");
12433
0
            return -1;
12434
0
        }
12435
0
        else {
12436
0
            int res;
12437
0
            if (_Py_EnterRecursiveCall(" while traversing 'AsyncFor' node")) {
12438
0
                goto failed;
12439
0
            }
12440
0
            res = obj2ast_expr(state, tmp, &iter, arena);
12441
0
            _Py_LeaveRecursiveCall();
12442
0
            if (res != 0) goto failed;
12443
0
            Py_CLEAR(tmp);
12444
0
        }
12445
0
        if (PyObject_GetOptionalAttr(obj, state->body, &tmp) < 0) {
12446
0
            return -1;
12447
0
        }
12448
0
        if (tmp == NULL) {
12449
0
            tmp = PyList_New(0);
12450
0
            if (tmp == NULL) {
12451
0
                return -1;
12452
0
            }
12453
0
        }
12454
0
        {
12455
0
            int res;
12456
0
            Py_ssize_t len;
12457
0
            Py_ssize_t i;
12458
0
            if (!PyList_Check(tmp)) {
12459
0
                PyErr_Format(PyExc_TypeError, "AsyncFor field \"body\" must be a list, not a %.200s", _PyType_Name(Py_TYPE(tmp)));
12460
0
                goto failed;
12461
0
            }
12462
0
            len = PyList_GET_SIZE(tmp);
12463
0
            body = _Py_asdl_stmt_seq_new(len, arena);
12464
0
            if (body == NULL) goto failed;
12465
0
            for (i = 0; i < len; i++) {
12466
0
                stmt_ty val;
12467
0
                PyObject *tmp2 = Py_NewRef(PyList_GET_ITEM(tmp, i));
12468
0
                if (_Py_EnterRecursiveCall(" while traversing 'AsyncFor' node")) {
12469
0
                    goto failed;
12470
0
                }
12471
0
                res = obj2ast_stmt(state, tmp2, &val, arena);
12472
0
                _Py_LeaveRecursiveCall();
12473
0
                Py_DECREF(tmp2);
12474
0
                if (res != 0) goto failed;
12475
0
                if (len != PyList_GET_SIZE(tmp)) {
12476
0
                    PyErr_SetString(PyExc_RuntimeError, "AsyncFor field \"body\" changed size during iteration");
12477
0
                    goto failed;
12478
0
                }
12479
0
                asdl_seq_SET(body, i, val);
12480
0
            }
12481
0
            Py_CLEAR(tmp);
12482
0
        }
12483
0
        if (PyObject_GetOptionalAttr(obj, state->orelse, &tmp) < 0) {
12484
0
            return -1;
12485
0
        }
12486
0
        if (tmp == NULL) {
12487
0
            tmp = PyList_New(0);
12488
0
            if (tmp == NULL) {
12489
0
                return -1;
12490
0
            }
12491
0
        }
12492
0
        {
12493
0
            int res;
12494
0
            Py_ssize_t len;
12495
0
            Py_ssize_t i;
12496
0
            if (!PyList_Check(tmp)) {
12497
0
                PyErr_Format(PyExc_TypeError, "AsyncFor field \"orelse\" must be a list, not a %.200s", _PyType_Name(Py_TYPE(tmp)));
12498
0
                goto failed;
12499
0
            }
12500
0
            len = PyList_GET_SIZE(tmp);
12501
0
            orelse = _Py_asdl_stmt_seq_new(len, arena);
12502
0
            if (orelse == NULL) goto failed;
12503
0
            for (i = 0; i < len; i++) {
12504
0
                stmt_ty val;
12505
0
                PyObject *tmp2 = Py_NewRef(PyList_GET_ITEM(tmp, i));
12506
0
                if (_Py_EnterRecursiveCall(" while traversing 'AsyncFor' node")) {
12507
0
                    goto failed;
12508
0
                }
12509
0
                res = obj2ast_stmt(state, tmp2, &val, arena);
12510
0
                _Py_LeaveRecursiveCall();
12511
0
                Py_DECREF(tmp2);
12512
0
                if (res != 0) goto failed;
12513
0
                if (len != PyList_GET_SIZE(tmp)) {
12514
0
                    PyErr_SetString(PyExc_RuntimeError, "AsyncFor field \"orelse\" changed size during iteration");
12515
0
                    goto failed;
12516
0
                }
12517
0
                asdl_seq_SET(orelse, i, val);
12518
0
            }
12519
0
            Py_CLEAR(tmp);
12520
0
        }
12521
0
        if (PyObject_GetOptionalAttr(obj, state->type_comment, &tmp) < 0) {
12522
0
            return -1;
12523
0
        }
12524
0
        if (tmp == NULL || tmp == Py_None) {
12525
0
            Py_CLEAR(tmp);
12526
0
            type_comment = NULL;
12527
0
        }
12528
0
        else {
12529
0
            int res;
12530
0
            if (_Py_EnterRecursiveCall(" while traversing 'AsyncFor' node")) {
12531
0
                goto failed;
12532
0
            }
12533
0
            res = obj2ast_string(state, tmp, &type_comment, arena);
12534
0
            _Py_LeaveRecursiveCall();
12535
0
            if (res != 0) goto failed;
12536
0
            Py_CLEAR(tmp);
12537
0
        }
12538
0
        *out = _PyAST_AsyncFor(target, iter, body, orelse, type_comment,
12539
0
                               lineno, col_offset, end_lineno, end_col_offset,
12540
0
                               arena);
12541
0
        if (*out == NULL) goto failed;
12542
0
        return 0;
12543
0
    }
12544
0
    tp = state->While_type;
12545
0
    isinstance = PyObject_IsInstance(obj, tp);
12546
0
    if (isinstance == -1) {
12547
0
        return -1;
12548
0
    }
12549
0
    if (isinstance) {
12550
0
        expr_ty test;
12551
0
        asdl_stmt_seq* body;
12552
0
        asdl_stmt_seq* orelse;
12553
12554
0
        if (PyObject_GetOptionalAttr(obj, state->test, &tmp) < 0) {
12555
0
            return -1;
12556
0
        }
12557
0
        if (tmp == NULL) {
12558
0
            PyErr_SetString(PyExc_TypeError, "required field \"test\" missing from While");
12559
0
            return -1;
12560
0
        }
12561
0
        else {
12562
0
            int res;
12563
0
            if (_Py_EnterRecursiveCall(" while traversing 'While' node")) {
12564
0
                goto failed;
12565
0
            }
12566
0
            res = obj2ast_expr(state, tmp, &test, arena);
12567
0
            _Py_LeaveRecursiveCall();
12568
0
            if (res != 0) goto failed;
12569
0
            Py_CLEAR(tmp);
12570
0
        }
12571
0
        if (PyObject_GetOptionalAttr(obj, state->body, &tmp) < 0) {
12572
0
            return -1;
12573
0
        }
12574
0
        if (tmp == NULL) {
12575
0
            tmp = PyList_New(0);
12576
0
            if (tmp == NULL) {
12577
0
                return -1;
12578
0
            }
12579
0
        }
12580
0
        {
12581
0
            int res;
12582
0
            Py_ssize_t len;
12583
0
            Py_ssize_t i;
12584
0
            if (!PyList_Check(tmp)) {
12585
0
                PyErr_Format(PyExc_TypeError, "While field \"body\" must be a list, not a %.200s", _PyType_Name(Py_TYPE(tmp)));
12586
0
                goto failed;
12587
0
            }
12588
0
            len = PyList_GET_SIZE(tmp);
12589
0
            body = _Py_asdl_stmt_seq_new(len, arena);
12590
0
            if (body == NULL) goto failed;
12591
0
            for (i = 0; i < len; i++) {
12592
0
                stmt_ty val;
12593
0
                PyObject *tmp2 = Py_NewRef(PyList_GET_ITEM(tmp, i));
12594
0
                if (_Py_EnterRecursiveCall(" while traversing 'While' node")) {
12595
0
                    goto failed;
12596
0
                }
12597
0
                res = obj2ast_stmt(state, tmp2, &val, arena);
12598
0
                _Py_LeaveRecursiveCall();
12599
0
                Py_DECREF(tmp2);
12600
0
                if (res != 0) goto failed;
12601
0
                if (len != PyList_GET_SIZE(tmp)) {
12602
0
                    PyErr_SetString(PyExc_RuntimeError, "While field \"body\" changed size during iteration");
12603
0
                    goto failed;
12604
0
                }
12605
0
                asdl_seq_SET(body, i, val);
12606
0
            }
12607
0
            Py_CLEAR(tmp);
12608
0
        }
12609
0
        if (PyObject_GetOptionalAttr(obj, state->orelse, &tmp) < 0) {
12610
0
            return -1;
12611
0
        }
12612
0
        if (tmp == NULL) {
12613
0
            tmp = PyList_New(0);
12614
0
            if (tmp == NULL) {
12615
0
                return -1;
12616
0
            }
12617
0
        }
12618
0
        {
12619
0
            int res;
12620
0
            Py_ssize_t len;
12621
0
            Py_ssize_t i;
12622
0
            if (!PyList_Check(tmp)) {
12623
0
                PyErr_Format(PyExc_TypeError, "While field \"orelse\" must be a list, not a %.200s", _PyType_Name(Py_TYPE(tmp)));
12624
0
                goto failed;
12625
0
            }
12626
0
            len = PyList_GET_SIZE(tmp);
12627
0
            orelse = _Py_asdl_stmt_seq_new(len, arena);
12628
0
            if (orelse == NULL) goto failed;
12629
0
            for (i = 0; i < len; i++) {
12630
0
                stmt_ty val;
12631
0
                PyObject *tmp2 = Py_NewRef(PyList_GET_ITEM(tmp, i));
12632
0
                if (_Py_EnterRecursiveCall(" while traversing 'While' node")) {
12633
0
                    goto failed;
12634
0
                }
12635
0
                res = obj2ast_stmt(state, tmp2, &val, arena);
12636
0
                _Py_LeaveRecursiveCall();
12637
0
                Py_DECREF(tmp2);
12638
0
                if (res != 0) goto failed;
12639
0
                if (len != PyList_GET_SIZE(tmp)) {
12640
0
                    PyErr_SetString(PyExc_RuntimeError, "While field \"orelse\" changed size during iteration");
12641
0
                    goto failed;
12642
0
                }
12643
0
                asdl_seq_SET(orelse, i, val);
12644
0
            }
12645
0
            Py_CLEAR(tmp);
12646
0
        }
12647
0
        *out = _PyAST_While(test, body, orelse, lineno, col_offset, end_lineno,
12648
0
                            end_col_offset, arena);
12649
0
        if (*out == NULL) goto failed;
12650
0
        return 0;
12651
0
    }
12652
0
    tp = state->If_type;
12653
0
    isinstance = PyObject_IsInstance(obj, tp);
12654
0
    if (isinstance == -1) {
12655
0
        return -1;
12656
0
    }
12657
0
    if (isinstance) {
12658
0
        expr_ty test;
12659
0
        asdl_stmt_seq* body;
12660
0
        asdl_stmt_seq* orelse;
12661
12662
0
        if (PyObject_GetOptionalAttr(obj, state->test, &tmp) < 0) {
12663
0
            return -1;
12664
0
        }
12665
0
        if (tmp == NULL) {
12666
0
            PyErr_SetString(PyExc_TypeError, "required field \"test\" missing from If");
12667
0
            return -1;
12668
0
        }
12669
0
        else {
12670
0
            int res;
12671
0
            if (_Py_EnterRecursiveCall(" while traversing 'If' node")) {
12672
0
                goto failed;
12673
0
            }
12674
0
            res = obj2ast_expr(state, tmp, &test, arena);
12675
0
            _Py_LeaveRecursiveCall();
12676
0
            if (res != 0) goto failed;
12677
0
            Py_CLEAR(tmp);
12678
0
        }
12679
0
        if (PyObject_GetOptionalAttr(obj, state->body, &tmp) < 0) {
12680
0
            return -1;
12681
0
        }
12682
0
        if (tmp == NULL) {
12683
0
            tmp = PyList_New(0);
12684
0
            if (tmp == NULL) {
12685
0
                return -1;
12686
0
            }
12687
0
        }
12688
0
        {
12689
0
            int res;
12690
0
            Py_ssize_t len;
12691
0
            Py_ssize_t i;
12692
0
            if (!PyList_Check(tmp)) {
12693
0
                PyErr_Format(PyExc_TypeError, "If field \"body\" must be a list, not a %.200s", _PyType_Name(Py_TYPE(tmp)));
12694
0
                goto failed;
12695
0
            }
12696
0
            len = PyList_GET_SIZE(tmp);
12697
0
            body = _Py_asdl_stmt_seq_new(len, arena);
12698
0
            if (body == NULL) goto failed;
12699
0
            for (i = 0; i < len; i++) {
12700
0
                stmt_ty val;
12701
0
                PyObject *tmp2 = Py_NewRef(PyList_GET_ITEM(tmp, i));
12702
0
                if (_Py_EnterRecursiveCall(" while traversing 'If' node")) {
12703
0
                    goto failed;
12704
0
                }
12705
0
                res = obj2ast_stmt(state, tmp2, &val, arena);
12706
0
                _Py_LeaveRecursiveCall();
12707
0
                Py_DECREF(tmp2);
12708
0
                if (res != 0) goto failed;
12709
0
                if (len != PyList_GET_SIZE(tmp)) {
12710
0
                    PyErr_SetString(PyExc_RuntimeError, "If field \"body\" changed size during iteration");
12711
0
                    goto failed;
12712
0
                }
12713
0
                asdl_seq_SET(body, i, val);
12714
0
            }
12715
0
            Py_CLEAR(tmp);
12716
0
        }
12717
0
        if (PyObject_GetOptionalAttr(obj, state->orelse, &tmp) < 0) {
12718
0
            return -1;
12719
0
        }
12720
0
        if (tmp == NULL) {
12721
0
            tmp = PyList_New(0);
12722
0
            if (tmp == NULL) {
12723
0
                return -1;
12724
0
            }
12725
0
        }
12726
0
        {
12727
0
            int res;
12728
0
            Py_ssize_t len;
12729
0
            Py_ssize_t i;
12730
0
            if (!PyList_Check(tmp)) {
12731
0
                PyErr_Format(PyExc_TypeError, "If field \"orelse\" must be a list, not a %.200s", _PyType_Name(Py_TYPE(tmp)));
12732
0
                goto failed;
12733
0
            }
12734
0
            len = PyList_GET_SIZE(tmp);
12735
0
            orelse = _Py_asdl_stmt_seq_new(len, arena);
12736
0
            if (orelse == NULL) goto failed;
12737
0
            for (i = 0; i < len; i++) {
12738
0
                stmt_ty val;
12739
0
                PyObject *tmp2 = Py_NewRef(PyList_GET_ITEM(tmp, i));
12740
0
                if (_Py_EnterRecursiveCall(" while traversing 'If' node")) {
12741
0
                    goto failed;
12742
0
                }
12743
0
                res = obj2ast_stmt(state, tmp2, &val, arena);
12744
0
                _Py_LeaveRecursiveCall();
12745
0
                Py_DECREF(tmp2);
12746
0
                if (res != 0) goto failed;
12747
0
                if (len != PyList_GET_SIZE(tmp)) {
12748
0
                    PyErr_SetString(PyExc_RuntimeError, "If field \"orelse\" changed size during iteration");
12749
0
                    goto failed;
12750
0
                }
12751
0
                asdl_seq_SET(orelse, i, val);
12752
0
            }
12753
0
            Py_CLEAR(tmp);
12754
0
        }
12755
0
        *out = _PyAST_If(test, body, orelse, lineno, col_offset, end_lineno,
12756
0
                         end_col_offset, arena);
12757
0
        if (*out == NULL) goto failed;
12758
0
        return 0;
12759
0
    }
12760
0
    tp = state->With_type;
12761
0
    isinstance = PyObject_IsInstance(obj, tp);
12762
0
    if (isinstance == -1) {
12763
0
        return -1;
12764
0
    }
12765
0
    if (isinstance) {
12766
0
        asdl_withitem_seq* items;
12767
0
        asdl_stmt_seq* body;
12768
0
        string type_comment;
12769
12770
0
        if (PyObject_GetOptionalAttr(obj, state->items, &tmp) < 0) {
12771
0
            return -1;
12772
0
        }
12773
0
        if (tmp == NULL) {
12774
0
            tmp = PyList_New(0);
12775
0
            if (tmp == NULL) {
12776
0
                return -1;
12777
0
            }
12778
0
        }
12779
0
        {
12780
0
            int res;
12781
0
            Py_ssize_t len;
12782
0
            Py_ssize_t i;
12783
0
            if (!PyList_Check(tmp)) {
12784
0
                PyErr_Format(PyExc_TypeError, "With field \"items\" must be a list, not a %.200s", _PyType_Name(Py_TYPE(tmp)));
12785
0
                goto failed;
12786
0
            }
12787
0
            len = PyList_GET_SIZE(tmp);
12788
0
            items = _Py_asdl_withitem_seq_new(len, arena);
12789
0
            if (items == NULL) goto failed;
12790
0
            for (i = 0; i < len; i++) {
12791
0
                withitem_ty val;
12792
0
                PyObject *tmp2 = Py_NewRef(PyList_GET_ITEM(tmp, i));
12793
0
                if (_Py_EnterRecursiveCall(" while traversing 'With' node")) {
12794
0
                    goto failed;
12795
0
                }
12796
0
                res = obj2ast_withitem(state, tmp2, &val, arena);
12797
0
                _Py_LeaveRecursiveCall();
12798
0
                Py_DECREF(tmp2);
12799
0
                if (res != 0) goto failed;
12800
0
                if (len != PyList_GET_SIZE(tmp)) {
12801
0
                    PyErr_SetString(PyExc_RuntimeError, "With field \"items\" changed size during iteration");
12802
0
                    goto failed;
12803
0
                }
12804
0
                asdl_seq_SET(items, i, val);
12805
0
            }
12806
0
            Py_CLEAR(tmp);
12807
0
        }
12808
0
        if (PyObject_GetOptionalAttr(obj, state->body, &tmp) < 0) {
12809
0
            return -1;
12810
0
        }
12811
0
        if (tmp == NULL) {
12812
0
            tmp = PyList_New(0);
12813
0
            if (tmp == NULL) {
12814
0
                return -1;
12815
0
            }
12816
0
        }
12817
0
        {
12818
0
            int res;
12819
0
            Py_ssize_t len;
12820
0
            Py_ssize_t i;
12821
0
            if (!PyList_Check(tmp)) {
12822
0
                PyErr_Format(PyExc_TypeError, "With field \"body\" must be a list, not a %.200s", _PyType_Name(Py_TYPE(tmp)));
12823
0
                goto failed;
12824
0
            }
12825
0
            len = PyList_GET_SIZE(tmp);
12826
0
            body = _Py_asdl_stmt_seq_new(len, arena);
12827
0
            if (body == NULL) goto failed;
12828
0
            for (i = 0; i < len; i++) {
12829
0
                stmt_ty val;
12830
0
                PyObject *tmp2 = Py_NewRef(PyList_GET_ITEM(tmp, i));
12831
0
                if (_Py_EnterRecursiveCall(" while traversing 'With' node")) {
12832
0
                    goto failed;
12833
0
                }
12834
0
                res = obj2ast_stmt(state, tmp2, &val, arena);
12835
0
                _Py_LeaveRecursiveCall();
12836
0
                Py_DECREF(tmp2);
12837
0
                if (res != 0) goto failed;
12838
0
                if (len != PyList_GET_SIZE(tmp)) {
12839
0
                    PyErr_SetString(PyExc_RuntimeError, "With field \"body\" changed size during iteration");
12840
0
                    goto failed;
12841
0
                }
12842
0
                asdl_seq_SET(body, i, val);
12843
0
            }
12844
0
            Py_CLEAR(tmp);
12845
0
        }
12846
0
        if (PyObject_GetOptionalAttr(obj, state->type_comment, &tmp) < 0) {
12847
0
            return -1;
12848
0
        }
12849
0
        if (tmp == NULL || tmp == Py_None) {
12850
0
            Py_CLEAR(tmp);
12851
0
            type_comment = NULL;
12852
0
        }
12853
0
        else {
12854
0
            int res;
12855
0
            if (_Py_EnterRecursiveCall(" while traversing 'With' node")) {
12856
0
                goto failed;
12857
0
            }
12858
0
            res = obj2ast_string(state, tmp, &type_comment, arena);
12859
0
            _Py_LeaveRecursiveCall();
12860
0
            if (res != 0) goto failed;
12861
0
            Py_CLEAR(tmp);
12862
0
        }
12863
0
        *out = _PyAST_With(items, body, type_comment, lineno, col_offset,
12864
0
                           end_lineno, end_col_offset, arena);
12865
0
        if (*out == NULL) goto failed;
12866
0
        return 0;
12867
0
    }
12868
0
    tp = state->AsyncWith_type;
12869
0
    isinstance = PyObject_IsInstance(obj, tp);
12870
0
    if (isinstance == -1) {
12871
0
        return -1;
12872
0
    }
12873
0
    if (isinstance) {
12874
0
        asdl_withitem_seq* items;
12875
0
        asdl_stmt_seq* body;
12876
0
        string type_comment;
12877
12878
0
        if (PyObject_GetOptionalAttr(obj, state->items, &tmp) < 0) {
12879
0
            return -1;
12880
0
        }
12881
0
        if (tmp == NULL) {
12882
0
            tmp = PyList_New(0);
12883
0
            if (tmp == NULL) {
12884
0
                return -1;
12885
0
            }
12886
0
        }
12887
0
        {
12888
0
            int res;
12889
0
            Py_ssize_t len;
12890
0
            Py_ssize_t i;
12891
0
            if (!PyList_Check(tmp)) {
12892
0
                PyErr_Format(PyExc_TypeError, "AsyncWith field \"items\" must be a list, not a %.200s", _PyType_Name(Py_TYPE(tmp)));
12893
0
                goto failed;
12894
0
            }
12895
0
            len = PyList_GET_SIZE(tmp);
12896
0
            items = _Py_asdl_withitem_seq_new(len, arena);
12897
0
            if (items == NULL) goto failed;
12898
0
            for (i = 0; i < len; i++) {
12899
0
                withitem_ty val;
12900
0
                PyObject *tmp2 = Py_NewRef(PyList_GET_ITEM(tmp, i));
12901
0
                if (_Py_EnterRecursiveCall(" while traversing 'AsyncWith' node")) {
12902
0
                    goto failed;
12903
0
                }
12904
0
                res = obj2ast_withitem(state, tmp2, &val, arena);
12905
0
                _Py_LeaveRecursiveCall();
12906
0
                Py_DECREF(tmp2);
12907
0
                if (res != 0) goto failed;
12908
0
                if (len != PyList_GET_SIZE(tmp)) {
12909
0
                    PyErr_SetString(PyExc_RuntimeError, "AsyncWith field \"items\" changed size during iteration");
12910
0
                    goto failed;
12911
0
                }
12912
0
                asdl_seq_SET(items, i, val);
12913
0
            }
12914
0
            Py_CLEAR(tmp);
12915
0
        }
12916
0
        if (PyObject_GetOptionalAttr(obj, state->body, &tmp) < 0) {
12917
0
            return -1;
12918
0
        }
12919
0
        if (tmp == NULL) {
12920
0
            tmp = PyList_New(0);
12921
0
            if (tmp == NULL) {
12922
0
                return -1;
12923
0
            }
12924
0
        }
12925
0
        {
12926
0
            int res;
12927
0
            Py_ssize_t len;
12928
0
            Py_ssize_t i;
12929
0
            if (!PyList_Check(tmp)) {
12930
0
                PyErr_Format(PyExc_TypeError, "AsyncWith field \"body\" must be a list, not a %.200s", _PyType_Name(Py_TYPE(tmp)));
12931
0
                goto failed;
12932
0
            }
12933
0
            len = PyList_GET_SIZE(tmp);
12934
0
            body = _Py_asdl_stmt_seq_new(len, arena);
12935
0
            if (body == NULL) goto failed;
12936
0
            for (i = 0; i < len; i++) {
12937
0
                stmt_ty val;
12938
0
                PyObject *tmp2 = Py_NewRef(PyList_GET_ITEM(tmp, i));
12939
0
                if (_Py_EnterRecursiveCall(" while traversing 'AsyncWith' node")) {
12940
0
                    goto failed;
12941
0
                }
12942
0
                res = obj2ast_stmt(state, tmp2, &val, arena);
12943
0
                _Py_LeaveRecursiveCall();
12944
0
                Py_DECREF(tmp2);
12945
0
                if (res != 0) goto failed;
12946
0
                if (len != PyList_GET_SIZE(tmp)) {
12947
0
                    PyErr_SetString(PyExc_RuntimeError, "AsyncWith field \"body\" changed size during iteration");
12948
0
                    goto failed;
12949
0
                }
12950
0
                asdl_seq_SET(body, i, val);
12951
0
            }
12952
0
            Py_CLEAR(tmp);
12953
0
        }
12954
0
        if (PyObject_GetOptionalAttr(obj, state->type_comment, &tmp) < 0) {
12955
0
            return -1;
12956
0
        }
12957
0
        if (tmp == NULL || tmp == Py_None) {
12958
0
            Py_CLEAR(tmp);
12959
0
            type_comment = NULL;
12960
0
        }
12961
0
        else {
12962
0
            int res;
12963
0
            if (_Py_EnterRecursiveCall(" while traversing 'AsyncWith' node")) {
12964
0
                goto failed;
12965
0
            }
12966
0
            res = obj2ast_string(state, tmp, &type_comment, arena);
12967
0
            _Py_LeaveRecursiveCall();
12968
0
            if (res != 0) goto failed;
12969
0
            Py_CLEAR(tmp);
12970
0
        }
12971
0
        *out = _PyAST_AsyncWith(items, body, type_comment, lineno, col_offset,
12972
0
                                end_lineno, end_col_offset, arena);
12973
0
        if (*out == NULL) goto failed;
12974
0
        return 0;
12975
0
    }
12976
0
    tp = state->Match_type;
12977
0
    isinstance = PyObject_IsInstance(obj, tp);
12978
0
    if (isinstance == -1) {
12979
0
        return -1;
12980
0
    }
12981
0
    if (isinstance) {
12982
0
        expr_ty subject;
12983
0
        asdl_match_case_seq* cases;
12984
12985
0
        if (PyObject_GetOptionalAttr(obj, state->subject, &tmp) < 0) {
12986
0
            return -1;
12987
0
        }
12988
0
        if (tmp == NULL) {
12989
0
            PyErr_SetString(PyExc_TypeError, "required field \"subject\" missing from Match");
12990
0
            return -1;
12991
0
        }
12992
0
        else {
12993
0
            int res;
12994
0
            if (_Py_EnterRecursiveCall(" while traversing 'Match' node")) {
12995
0
                goto failed;
12996
0
            }
12997
0
            res = obj2ast_expr(state, tmp, &subject, arena);
12998
0
            _Py_LeaveRecursiveCall();
12999
0
            if (res != 0) goto failed;
13000
0
            Py_CLEAR(tmp);
13001
0
        }
13002
0
        if (PyObject_GetOptionalAttr(obj, state->cases, &tmp) < 0) {
13003
0
            return -1;
13004
0
        }
13005
0
        if (tmp == NULL) {
13006
0
            tmp = PyList_New(0);
13007
0
            if (tmp == NULL) {
13008
0
                return -1;
13009
0
            }
13010
0
        }
13011
0
        {
13012
0
            int res;
13013
0
            Py_ssize_t len;
13014
0
            Py_ssize_t i;
13015
0
            if (!PyList_Check(tmp)) {
13016
0
                PyErr_Format(PyExc_TypeError, "Match field \"cases\" must be a list, not a %.200s", _PyType_Name(Py_TYPE(tmp)));
13017
0
                goto failed;
13018
0
            }
13019
0
            len = PyList_GET_SIZE(tmp);
13020
0
            cases = _Py_asdl_match_case_seq_new(len, arena);
13021
0
            if (cases == NULL) goto failed;
13022
0
            for (i = 0; i < len; i++) {
13023
0
                match_case_ty val;
13024
0
                PyObject *tmp2 = Py_NewRef(PyList_GET_ITEM(tmp, i));
13025
0
                if (_Py_EnterRecursiveCall(" while traversing 'Match' node")) {
13026
0
                    goto failed;
13027
0
                }
13028
0
                res = obj2ast_match_case(state, tmp2, &val, arena);
13029
0
                _Py_LeaveRecursiveCall();
13030
0
                Py_DECREF(tmp2);
13031
0
                if (res != 0) goto failed;
13032
0
                if (len != PyList_GET_SIZE(tmp)) {
13033
0
                    PyErr_SetString(PyExc_RuntimeError, "Match field \"cases\" changed size during iteration");
13034
0
                    goto failed;
13035
0
                }
13036
0
                asdl_seq_SET(cases, i, val);
13037
0
            }
13038
0
            Py_CLEAR(tmp);
13039
0
        }
13040
0
        *out = _PyAST_Match(subject, cases, lineno, col_offset, end_lineno,
13041
0
                            end_col_offset, arena);
13042
0
        if (*out == NULL) goto failed;
13043
0
        return 0;
13044
0
    }
13045
0
    tp = state->Raise_type;
13046
0
    isinstance = PyObject_IsInstance(obj, tp);
13047
0
    if (isinstance == -1) {
13048
0
        return -1;
13049
0
    }
13050
0
    if (isinstance) {
13051
0
        expr_ty exc;
13052
0
        expr_ty cause;
13053
13054
0
        if (PyObject_GetOptionalAttr(obj, state->exc, &tmp) < 0) {
13055
0
            return -1;
13056
0
        }
13057
0
        if (tmp == NULL || tmp == Py_None) {
13058
0
            Py_CLEAR(tmp);
13059
0
            exc = NULL;
13060
0
        }
13061
0
        else {
13062
0
            int res;
13063
0
            if (_Py_EnterRecursiveCall(" while traversing 'Raise' node")) {
13064
0
                goto failed;
13065
0
            }
13066
0
            res = obj2ast_expr(state, tmp, &exc, arena);
13067
0
            _Py_LeaveRecursiveCall();
13068
0
            if (res != 0) goto failed;
13069
0
            Py_CLEAR(tmp);
13070
0
        }
13071
0
        if (PyObject_GetOptionalAttr(obj, state->cause, &tmp) < 0) {
13072
0
            return -1;
13073
0
        }
13074
0
        if (tmp == NULL || tmp == Py_None) {
13075
0
            Py_CLEAR(tmp);
13076
0
            cause = NULL;
13077
0
        }
13078
0
        else {
13079
0
            int res;
13080
0
            if (_Py_EnterRecursiveCall(" while traversing 'Raise' node")) {
13081
0
                goto failed;
13082
0
            }
13083
0
            res = obj2ast_expr(state, tmp, &cause, arena);
13084
0
            _Py_LeaveRecursiveCall();
13085
0
            if (res != 0) goto failed;
13086
0
            Py_CLEAR(tmp);
13087
0
        }
13088
0
        *out = _PyAST_Raise(exc, cause, lineno, col_offset, end_lineno,
13089
0
                            end_col_offset, arena);
13090
0
        if (*out == NULL) goto failed;
13091
0
        return 0;
13092
0
    }
13093
0
    tp = state->Try_type;
13094
0
    isinstance = PyObject_IsInstance(obj, tp);
13095
0
    if (isinstance == -1) {
13096
0
        return -1;
13097
0
    }
13098
0
    if (isinstance) {
13099
0
        asdl_stmt_seq* body;
13100
0
        asdl_excepthandler_seq* handlers;
13101
0
        asdl_stmt_seq* orelse;
13102
0
        asdl_stmt_seq* finalbody;
13103
13104
0
        if (PyObject_GetOptionalAttr(obj, state->body, &tmp) < 0) {
13105
0
            return -1;
13106
0
        }
13107
0
        if (tmp == NULL) {
13108
0
            tmp = PyList_New(0);
13109
0
            if (tmp == NULL) {
13110
0
                return -1;
13111
0
            }
13112
0
        }
13113
0
        {
13114
0
            int res;
13115
0
            Py_ssize_t len;
13116
0
            Py_ssize_t i;
13117
0
            if (!PyList_Check(tmp)) {
13118
0
                PyErr_Format(PyExc_TypeError, "Try field \"body\" must be a list, not a %.200s", _PyType_Name(Py_TYPE(tmp)));
13119
0
                goto failed;
13120
0
            }
13121
0
            len = PyList_GET_SIZE(tmp);
13122
0
            body = _Py_asdl_stmt_seq_new(len, arena);
13123
0
            if (body == NULL) goto failed;
13124
0
            for (i = 0; i < len; i++) {
13125
0
                stmt_ty val;
13126
0
                PyObject *tmp2 = Py_NewRef(PyList_GET_ITEM(tmp, i));
13127
0
                if (_Py_EnterRecursiveCall(" while traversing 'Try' node")) {
13128
0
                    goto failed;
13129
0
                }
13130
0
                res = obj2ast_stmt(state, tmp2, &val, arena);
13131
0
                _Py_LeaveRecursiveCall();
13132
0
                Py_DECREF(tmp2);
13133
0
                if (res != 0) goto failed;
13134
0
                if (len != PyList_GET_SIZE(tmp)) {
13135
0
                    PyErr_SetString(PyExc_RuntimeError, "Try field \"body\" changed size during iteration");
13136
0
                    goto failed;
13137
0
                }
13138
0
                asdl_seq_SET(body, i, val);
13139
0
            }
13140
0
            Py_CLEAR(tmp);
13141
0
        }
13142
0
        if (PyObject_GetOptionalAttr(obj, state->handlers, &tmp) < 0) {
13143
0
            return -1;
13144
0
        }
13145
0
        if (tmp == NULL) {
13146
0
            tmp = PyList_New(0);
13147
0
            if (tmp == NULL) {
13148
0
                return -1;
13149
0
            }
13150
0
        }
13151
0
        {
13152
0
            int res;
13153
0
            Py_ssize_t len;
13154
0
            Py_ssize_t i;
13155
0
            if (!PyList_Check(tmp)) {
13156
0
                PyErr_Format(PyExc_TypeError, "Try field \"handlers\" must be a list, not a %.200s", _PyType_Name(Py_TYPE(tmp)));
13157
0
                goto failed;
13158
0
            }
13159
0
            len = PyList_GET_SIZE(tmp);
13160
0
            handlers = _Py_asdl_excepthandler_seq_new(len, arena);
13161
0
            if (handlers == NULL) goto failed;
13162
0
            for (i = 0; i < len; i++) {
13163
0
                excepthandler_ty val;
13164
0
                PyObject *tmp2 = Py_NewRef(PyList_GET_ITEM(tmp, i));
13165
0
                if (_Py_EnterRecursiveCall(" while traversing 'Try' node")) {
13166
0
                    goto failed;
13167
0
                }
13168
0
                res = obj2ast_excepthandler(state, tmp2, &val, arena);
13169
0
                _Py_LeaveRecursiveCall();
13170
0
                Py_DECREF(tmp2);
13171
0
                if (res != 0) goto failed;
13172
0
                if (len != PyList_GET_SIZE(tmp)) {
13173
0
                    PyErr_SetString(PyExc_RuntimeError, "Try field \"handlers\" changed size during iteration");
13174
0
                    goto failed;
13175
0
                }
13176
0
                asdl_seq_SET(handlers, i, val);
13177
0
            }
13178
0
            Py_CLEAR(tmp);
13179
0
        }
13180
0
        if (PyObject_GetOptionalAttr(obj, state->orelse, &tmp) < 0) {
13181
0
            return -1;
13182
0
        }
13183
0
        if (tmp == NULL) {
13184
0
            tmp = PyList_New(0);
13185
0
            if (tmp == NULL) {
13186
0
                return -1;
13187
0
            }
13188
0
        }
13189
0
        {
13190
0
            int res;
13191
0
            Py_ssize_t len;
13192
0
            Py_ssize_t i;
13193
0
            if (!PyList_Check(tmp)) {
13194
0
                PyErr_Format(PyExc_TypeError, "Try field \"orelse\" must be a list, not a %.200s", _PyType_Name(Py_TYPE(tmp)));
13195
0
                goto failed;
13196
0
            }
13197
0
            len = PyList_GET_SIZE(tmp);
13198
0
            orelse = _Py_asdl_stmt_seq_new(len, arena);
13199
0
            if (orelse == NULL) goto failed;
13200
0
            for (i = 0; i < len; i++) {
13201
0
                stmt_ty val;
13202
0
                PyObject *tmp2 = Py_NewRef(PyList_GET_ITEM(tmp, i));
13203
0
                if (_Py_EnterRecursiveCall(" while traversing 'Try' node")) {
13204
0
                    goto failed;
13205
0
                }
13206
0
                res = obj2ast_stmt(state, tmp2, &val, arena);
13207
0
                _Py_LeaveRecursiveCall();
13208
0
                Py_DECREF(tmp2);
13209
0
                if (res != 0) goto failed;
13210
0
                if (len != PyList_GET_SIZE(tmp)) {
13211
0
                    PyErr_SetString(PyExc_RuntimeError, "Try field \"orelse\" changed size during iteration");
13212
0
                    goto failed;
13213
0
                }
13214
0
                asdl_seq_SET(orelse, i, val);
13215
0
            }
13216
0
            Py_CLEAR(tmp);
13217
0
        }
13218
0
        if (PyObject_GetOptionalAttr(obj, state->finalbody, &tmp) < 0) {
13219
0
            return -1;
13220
0
        }
13221
0
        if (tmp == NULL) {
13222
0
            tmp = PyList_New(0);
13223
0
            if (tmp == NULL) {
13224
0
                return -1;
13225
0
            }
13226
0
        }
13227
0
        {
13228
0
            int res;
13229
0
            Py_ssize_t len;
13230
0
            Py_ssize_t i;
13231
0
            if (!PyList_Check(tmp)) {
13232
0
                PyErr_Format(PyExc_TypeError, "Try field \"finalbody\" must be a list, not a %.200s", _PyType_Name(Py_TYPE(tmp)));
13233
0
                goto failed;
13234
0
            }
13235
0
            len = PyList_GET_SIZE(tmp);
13236
0
            finalbody = _Py_asdl_stmt_seq_new(len, arena);
13237
0
            if (finalbody == NULL) goto failed;
13238
0
            for (i = 0; i < len; i++) {
13239
0
                stmt_ty val;
13240
0
                PyObject *tmp2 = Py_NewRef(PyList_GET_ITEM(tmp, i));
13241
0
                if (_Py_EnterRecursiveCall(" while traversing 'Try' node")) {
13242
0
                    goto failed;
13243
0
                }
13244
0
                res = obj2ast_stmt(state, tmp2, &val, arena);
13245
0
                _Py_LeaveRecursiveCall();
13246
0
                Py_DECREF(tmp2);
13247
0
                if (res != 0) goto failed;
13248
0
                if (len != PyList_GET_SIZE(tmp)) {
13249
0
                    PyErr_SetString(PyExc_RuntimeError, "Try field \"finalbody\" changed size during iteration");
13250
0
                    goto failed;
13251
0
                }
13252
0
                asdl_seq_SET(finalbody, i, val);
13253
0
            }
13254
0
            Py_CLEAR(tmp);
13255
0
        }
13256
0
        *out = _PyAST_Try(body, handlers, orelse, finalbody, lineno,
13257
0
                          col_offset, end_lineno, end_col_offset, arena);
13258
0
        if (*out == NULL) goto failed;
13259
0
        return 0;
13260
0
    }
13261
0
    tp = state->TryStar_type;
13262
0
    isinstance = PyObject_IsInstance(obj, tp);
13263
0
    if (isinstance == -1) {
13264
0
        return -1;
13265
0
    }
13266
0
    if (isinstance) {
13267
0
        asdl_stmt_seq* body;
13268
0
        asdl_excepthandler_seq* handlers;
13269
0
        asdl_stmt_seq* orelse;
13270
0
        asdl_stmt_seq* finalbody;
13271
13272
0
        if (PyObject_GetOptionalAttr(obj, state->body, &tmp) < 0) {
13273
0
            return -1;
13274
0
        }
13275
0
        if (tmp == NULL) {
13276
0
            tmp = PyList_New(0);
13277
0
            if (tmp == NULL) {
13278
0
                return -1;
13279
0
            }
13280
0
        }
13281
0
        {
13282
0
            int res;
13283
0
            Py_ssize_t len;
13284
0
            Py_ssize_t i;
13285
0
            if (!PyList_Check(tmp)) {
13286
0
                PyErr_Format(PyExc_TypeError, "TryStar field \"body\" must be a list, not a %.200s", _PyType_Name(Py_TYPE(tmp)));
13287
0
                goto failed;
13288
0
            }
13289
0
            len = PyList_GET_SIZE(tmp);
13290
0
            body = _Py_asdl_stmt_seq_new(len, arena);
13291
0
            if (body == NULL) goto failed;
13292
0
            for (i = 0; i < len; i++) {
13293
0
                stmt_ty val;
13294
0
                PyObject *tmp2 = Py_NewRef(PyList_GET_ITEM(tmp, i));
13295
0
                if (_Py_EnterRecursiveCall(" while traversing 'TryStar' node")) {
13296
0
                    goto failed;
13297
0
                }
13298
0
                res = obj2ast_stmt(state, tmp2, &val, arena);
13299
0
                _Py_LeaveRecursiveCall();
13300
0
                Py_DECREF(tmp2);
13301
0
                if (res != 0) goto failed;
13302
0
                if (len != PyList_GET_SIZE(tmp)) {
13303
0
                    PyErr_SetString(PyExc_RuntimeError, "TryStar field \"body\" changed size during iteration");
13304
0
                    goto failed;
13305
0
                }
13306
0
                asdl_seq_SET(body, i, val);
13307
0
            }
13308
0
            Py_CLEAR(tmp);
13309
0
        }
13310
0
        if (PyObject_GetOptionalAttr(obj, state->handlers, &tmp) < 0) {
13311
0
            return -1;
13312
0
        }
13313
0
        if (tmp == NULL) {
13314
0
            tmp = PyList_New(0);
13315
0
            if (tmp == NULL) {
13316
0
                return -1;
13317
0
            }
13318
0
        }
13319
0
        {
13320
0
            int res;
13321
0
            Py_ssize_t len;
13322
0
            Py_ssize_t i;
13323
0
            if (!PyList_Check(tmp)) {
13324
0
                PyErr_Format(PyExc_TypeError, "TryStar field \"handlers\" must be a list, not a %.200s", _PyType_Name(Py_TYPE(tmp)));
13325
0
                goto failed;
13326
0
            }
13327
0
            len = PyList_GET_SIZE(tmp);
13328
0
            handlers = _Py_asdl_excepthandler_seq_new(len, arena);
13329
0
            if (handlers == NULL) goto failed;
13330
0
            for (i = 0; i < len; i++) {
13331
0
                excepthandler_ty val;
13332
0
                PyObject *tmp2 = Py_NewRef(PyList_GET_ITEM(tmp, i));
13333
0
                if (_Py_EnterRecursiveCall(" while traversing 'TryStar' node")) {
13334
0
                    goto failed;
13335
0
                }
13336
0
                res = obj2ast_excepthandler(state, tmp2, &val, arena);
13337
0
                _Py_LeaveRecursiveCall();
13338
0
                Py_DECREF(tmp2);
13339
0
                if (res != 0) goto failed;
13340
0
                if (len != PyList_GET_SIZE(tmp)) {
13341
0
                    PyErr_SetString(PyExc_RuntimeError, "TryStar field \"handlers\" changed size during iteration");
13342
0
                    goto failed;
13343
0
                }
13344
0
                asdl_seq_SET(handlers, i, val);
13345
0
            }
13346
0
            Py_CLEAR(tmp);
13347
0
        }
13348
0
        if (PyObject_GetOptionalAttr(obj, state->orelse, &tmp) < 0) {
13349
0
            return -1;
13350
0
        }
13351
0
        if (tmp == NULL) {
13352
0
            tmp = PyList_New(0);
13353
0
            if (tmp == NULL) {
13354
0
                return -1;
13355
0
            }
13356
0
        }
13357
0
        {
13358
0
            int res;
13359
0
            Py_ssize_t len;
13360
0
            Py_ssize_t i;
13361
0
            if (!PyList_Check(tmp)) {
13362
0
                PyErr_Format(PyExc_TypeError, "TryStar field \"orelse\" must be a list, not a %.200s", _PyType_Name(Py_TYPE(tmp)));
13363
0
                goto failed;
13364
0
            }
13365
0
            len = PyList_GET_SIZE(tmp);
13366
0
            orelse = _Py_asdl_stmt_seq_new(len, arena);
13367
0
            if (orelse == NULL) goto failed;
13368
0
            for (i = 0; i < len; i++) {
13369
0
                stmt_ty val;
13370
0
                PyObject *tmp2 = Py_NewRef(PyList_GET_ITEM(tmp, i));
13371
0
                if (_Py_EnterRecursiveCall(" while traversing 'TryStar' node")) {
13372
0
                    goto failed;
13373
0
                }
13374
0
                res = obj2ast_stmt(state, tmp2, &val, arena);
13375
0
                _Py_LeaveRecursiveCall();
13376
0
                Py_DECREF(tmp2);
13377
0
                if (res != 0) goto failed;
13378
0
                if (len != PyList_GET_SIZE(tmp)) {
13379
0
                    PyErr_SetString(PyExc_RuntimeError, "TryStar field \"orelse\" changed size during iteration");
13380
0
                    goto failed;
13381
0
                }
13382
0
                asdl_seq_SET(orelse, i, val);
13383
0
            }
13384
0
            Py_CLEAR(tmp);
13385
0
        }
13386
0
        if (PyObject_GetOptionalAttr(obj, state->finalbody, &tmp) < 0) {
13387
0
            return -1;
13388
0
        }
13389
0
        if (tmp == NULL) {
13390
0
            tmp = PyList_New(0);
13391
0
            if (tmp == NULL) {
13392
0
                return -1;
13393
0
            }
13394
0
        }
13395
0
        {
13396
0
            int res;
13397
0
            Py_ssize_t len;
13398
0
            Py_ssize_t i;
13399
0
            if (!PyList_Check(tmp)) {
13400
0
                PyErr_Format(PyExc_TypeError, "TryStar field \"finalbody\" must be a list, not a %.200s", _PyType_Name(Py_TYPE(tmp)));
13401
0
                goto failed;
13402
0
            }
13403
0
            len = PyList_GET_SIZE(tmp);
13404
0
            finalbody = _Py_asdl_stmt_seq_new(len, arena);
13405
0
            if (finalbody == NULL) goto failed;
13406
0
            for (i = 0; i < len; i++) {
13407
0
                stmt_ty val;
13408
0
                PyObject *tmp2 = Py_NewRef(PyList_GET_ITEM(tmp, i));
13409
0
                if (_Py_EnterRecursiveCall(" while traversing 'TryStar' node")) {
13410
0
                    goto failed;
13411
0
                }
13412
0
                res = obj2ast_stmt(state, tmp2, &val, arena);
13413
0
                _Py_LeaveRecursiveCall();
13414
0
                Py_DECREF(tmp2);
13415
0
                if (res != 0) goto failed;
13416
0
                if (len != PyList_GET_SIZE(tmp)) {
13417
0
                    PyErr_SetString(PyExc_RuntimeError, "TryStar field \"finalbody\" changed size during iteration");
13418
0
                    goto failed;
13419
0
                }
13420
0
                asdl_seq_SET(finalbody, i, val);
13421
0
            }
13422
0
            Py_CLEAR(tmp);
13423
0
        }
13424
0
        *out = _PyAST_TryStar(body, handlers, orelse, finalbody, lineno,
13425
0
                              col_offset, end_lineno, end_col_offset, arena);
13426
0
        if (*out == NULL) goto failed;
13427
0
        return 0;
13428
0
    }
13429
0
    tp = state->Assert_type;
13430
0
    isinstance = PyObject_IsInstance(obj, tp);
13431
0
    if (isinstance == -1) {
13432
0
        return -1;
13433
0
    }
13434
0
    if (isinstance) {
13435
0
        expr_ty test;
13436
0
        expr_ty msg;
13437
13438
0
        if (PyObject_GetOptionalAttr(obj, state->test, &tmp) < 0) {
13439
0
            return -1;
13440
0
        }
13441
0
        if (tmp == NULL) {
13442
0
            PyErr_SetString(PyExc_TypeError, "required field \"test\" missing from Assert");
13443
0
            return -1;
13444
0
        }
13445
0
        else {
13446
0
            int res;
13447
0
            if (_Py_EnterRecursiveCall(" while traversing 'Assert' node")) {
13448
0
                goto failed;
13449
0
            }
13450
0
            res = obj2ast_expr(state, tmp, &test, arena);
13451
0
            _Py_LeaveRecursiveCall();
13452
0
            if (res != 0) goto failed;
13453
0
            Py_CLEAR(tmp);
13454
0
        }
13455
0
        if (PyObject_GetOptionalAttr(obj, state->msg, &tmp) < 0) {
13456
0
            return -1;
13457
0
        }
13458
0
        if (tmp == NULL || tmp == Py_None) {
13459
0
            Py_CLEAR(tmp);
13460
0
            msg = NULL;
13461
0
        }
13462
0
        else {
13463
0
            int res;
13464
0
            if (_Py_EnterRecursiveCall(" while traversing 'Assert' node")) {
13465
0
                goto failed;
13466
0
            }
13467
0
            res = obj2ast_expr(state, tmp, &msg, arena);
13468
0
            _Py_LeaveRecursiveCall();
13469
0
            if (res != 0) goto failed;
13470
0
            Py_CLEAR(tmp);
13471
0
        }
13472
0
        *out = _PyAST_Assert(test, msg, lineno, col_offset, end_lineno,
13473
0
                             end_col_offset, arena);
13474
0
        if (*out == NULL) goto failed;
13475
0
        return 0;
13476
0
    }
13477
0
    tp = state->Import_type;
13478
0
    isinstance = PyObject_IsInstance(obj, tp);
13479
0
    if (isinstance == -1) {
13480
0
        return -1;
13481
0
    }
13482
0
    if (isinstance) {
13483
0
        asdl_alias_seq* names;
13484
13485
0
        if (PyObject_GetOptionalAttr(obj, state->names, &tmp) < 0) {
13486
0
            return -1;
13487
0
        }
13488
0
        if (tmp == NULL) {
13489
0
            tmp = PyList_New(0);
13490
0
            if (tmp == NULL) {
13491
0
                return -1;
13492
0
            }
13493
0
        }
13494
0
        {
13495
0
            int res;
13496
0
            Py_ssize_t len;
13497
0
            Py_ssize_t i;
13498
0
            if (!PyList_Check(tmp)) {
13499
0
                PyErr_Format(PyExc_TypeError, "Import field \"names\" must be a list, not a %.200s", _PyType_Name(Py_TYPE(tmp)));
13500
0
                goto failed;
13501
0
            }
13502
0
            len = PyList_GET_SIZE(tmp);
13503
0
            names = _Py_asdl_alias_seq_new(len, arena);
13504
0
            if (names == NULL) goto failed;
13505
0
            for (i = 0; i < len; i++) {
13506
0
                alias_ty val;
13507
0
                PyObject *tmp2 = Py_NewRef(PyList_GET_ITEM(tmp, i));
13508
0
                if (_Py_EnterRecursiveCall(" while traversing 'Import' node")) {
13509
0
                    goto failed;
13510
0
                }
13511
0
                res = obj2ast_alias(state, tmp2, &val, arena);
13512
0
                _Py_LeaveRecursiveCall();
13513
0
                Py_DECREF(tmp2);
13514
0
                if (res != 0) goto failed;
13515
0
                if (len != PyList_GET_SIZE(tmp)) {
13516
0
                    PyErr_SetString(PyExc_RuntimeError, "Import field \"names\" changed size during iteration");
13517
0
                    goto failed;
13518
0
                }
13519
0
                asdl_seq_SET(names, i, val);
13520
0
            }
13521
0
            Py_CLEAR(tmp);
13522
0
        }
13523
0
        *out = _PyAST_Import(names, lineno, col_offset, end_lineno,
13524
0
                             end_col_offset, arena);
13525
0
        if (*out == NULL) goto failed;
13526
0
        return 0;
13527
0
    }
13528
0
    tp = state->ImportFrom_type;
13529
0
    isinstance = PyObject_IsInstance(obj, tp);
13530
0
    if (isinstance == -1) {
13531
0
        return -1;
13532
0
    }
13533
0
    if (isinstance) {
13534
0
        identifier module;
13535
0
        asdl_alias_seq* names;
13536
0
        int level;
13537
13538
0
        if (PyObject_GetOptionalAttr(obj, state->module, &tmp) < 0) {
13539
0
            return -1;
13540
0
        }
13541
0
        if (tmp == NULL || tmp == Py_None) {
13542
0
            Py_CLEAR(tmp);
13543
0
            module = NULL;
13544
0
        }
13545
0
        else {
13546
0
            int res;
13547
0
            if (_Py_EnterRecursiveCall(" while traversing 'ImportFrom' node")) {
13548
0
                goto failed;
13549
0
            }
13550
0
            res = obj2ast_identifier(state, tmp, &module, arena);
13551
0
            _Py_LeaveRecursiveCall();
13552
0
            if (res != 0) goto failed;
13553
0
            Py_CLEAR(tmp);
13554
0
        }
13555
0
        if (PyObject_GetOptionalAttr(obj, state->names, &tmp) < 0) {
13556
0
            return -1;
13557
0
        }
13558
0
        if (tmp == NULL) {
13559
0
            tmp = PyList_New(0);
13560
0
            if (tmp == NULL) {
13561
0
                return -1;
13562
0
            }
13563
0
        }
13564
0
        {
13565
0
            int res;
13566
0
            Py_ssize_t len;
13567
0
            Py_ssize_t i;
13568
0
            if (!PyList_Check(tmp)) {
13569
0
                PyErr_Format(PyExc_TypeError, "ImportFrom field \"names\" must be a list, not a %.200s", _PyType_Name(Py_TYPE(tmp)));
13570
0
                goto failed;
13571
0
            }
13572
0
            len = PyList_GET_SIZE(tmp);
13573
0
            names = _Py_asdl_alias_seq_new(len, arena);
13574
0
            if (names == NULL) goto failed;
13575
0
            for (i = 0; i < len; i++) {
13576
0
                alias_ty val;
13577
0
                PyObject *tmp2 = Py_NewRef(PyList_GET_ITEM(tmp, i));
13578
0
                if (_Py_EnterRecursiveCall(" while traversing 'ImportFrom' node")) {
13579
0
                    goto failed;
13580
0
                }
13581
0
                res = obj2ast_alias(state, tmp2, &val, arena);
13582
0
                _Py_LeaveRecursiveCall();
13583
0
                Py_DECREF(tmp2);
13584
0
                if (res != 0) goto failed;
13585
0
                if (len != PyList_GET_SIZE(tmp)) {
13586
0
                    PyErr_SetString(PyExc_RuntimeError, "ImportFrom field \"names\" changed size during iteration");
13587
0
                    goto failed;
13588
0
                }
13589
0
                asdl_seq_SET(names, i, val);
13590
0
            }
13591
0
            Py_CLEAR(tmp);
13592
0
        }
13593
0
        if (PyObject_GetOptionalAttr(obj, state->level, &tmp) < 0) {
13594
0
            return -1;
13595
0
        }
13596
0
        if (tmp == NULL || tmp == Py_None) {
13597
0
            Py_CLEAR(tmp);
13598
0
            level = 0;
13599
0
        }
13600
0
        else {
13601
0
            int res;
13602
0
            if (_Py_EnterRecursiveCall(" while traversing 'ImportFrom' node")) {
13603
0
                goto failed;
13604
0
            }
13605
0
            res = obj2ast_int(state, tmp, &level, arena);
13606
0
            _Py_LeaveRecursiveCall();
13607
0
            if (res != 0) goto failed;
13608
0
            Py_CLEAR(tmp);
13609
0
        }
13610
0
        *out = _PyAST_ImportFrom(module, names, level, lineno, col_offset,
13611
0
                                 end_lineno, end_col_offset, arena);
13612
0
        if (*out == NULL) goto failed;
13613
0
        return 0;
13614
0
    }
13615
0
    tp = state->Global_type;
13616
0
    isinstance = PyObject_IsInstance(obj, tp);
13617
0
    if (isinstance == -1) {
13618
0
        return -1;
13619
0
    }
13620
0
    if (isinstance) {
13621
0
        asdl_identifier_seq* names;
13622
13623
0
        if (PyObject_GetOptionalAttr(obj, state->names, &tmp) < 0) {
13624
0
            return -1;
13625
0
        }
13626
0
        if (tmp == NULL) {
13627
0
            tmp = PyList_New(0);
13628
0
            if (tmp == NULL) {
13629
0
                return -1;
13630
0
            }
13631
0
        }
13632
0
        {
13633
0
            int res;
13634
0
            Py_ssize_t len;
13635
0
            Py_ssize_t i;
13636
0
            if (!PyList_Check(tmp)) {
13637
0
                PyErr_Format(PyExc_TypeError, "Global field \"names\" must be a list, not a %.200s", _PyType_Name(Py_TYPE(tmp)));
13638
0
                goto failed;
13639
0
            }
13640
0
            len = PyList_GET_SIZE(tmp);
13641
0
            names = _Py_asdl_identifier_seq_new(len, arena);
13642
0
            if (names == NULL) goto failed;
13643
0
            for (i = 0; i < len; i++) {
13644
0
                identifier val;
13645
0
                PyObject *tmp2 = Py_NewRef(PyList_GET_ITEM(tmp, i));
13646
0
                if (_Py_EnterRecursiveCall(" while traversing 'Global' node")) {
13647
0
                    goto failed;
13648
0
                }
13649
0
                res = obj2ast_identifier(state, tmp2, &val, arena);
13650
0
                _Py_LeaveRecursiveCall();
13651
0
                Py_DECREF(tmp2);
13652
0
                if (res != 0) goto failed;
13653
0
                if (len != PyList_GET_SIZE(tmp)) {
13654
0
                    PyErr_SetString(PyExc_RuntimeError, "Global field \"names\" changed size during iteration");
13655
0
                    goto failed;
13656
0
                }
13657
0
                asdl_seq_SET(names, i, val);
13658
0
            }
13659
0
            Py_CLEAR(tmp);
13660
0
        }
13661
0
        *out = _PyAST_Global(names, lineno, col_offset, end_lineno,
13662
0
                             end_col_offset, arena);
13663
0
        if (*out == NULL) goto failed;
13664
0
        return 0;
13665
0
    }
13666
0
    tp = state->Nonlocal_type;
13667
0
    isinstance = PyObject_IsInstance(obj, tp);
13668
0
    if (isinstance == -1) {
13669
0
        return -1;
13670
0
    }
13671
0
    if (isinstance) {
13672
0
        asdl_identifier_seq* names;
13673
13674
0
        if (PyObject_GetOptionalAttr(obj, state->names, &tmp) < 0) {
13675
0
            return -1;
13676
0
        }
13677
0
        if (tmp == NULL) {
13678
0
            tmp = PyList_New(0);
13679
0
            if (tmp == NULL) {
13680
0
                return -1;
13681
0
            }
13682
0
        }
13683
0
        {
13684
0
            int res;
13685
0
            Py_ssize_t len;
13686
0
            Py_ssize_t i;
13687
0
            if (!PyList_Check(tmp)) {
13688
0
                PyErr_Format(PyExc_TypeError, "Nonlocal field \"names\" must be a list, not a %.200s", _PyType_Name(Py_TYPE(tmp)));
13689
0
                goto failed;
13690
0
            }
13691
0
            len = PyList_GET_SIZE(tmp);
13692
0
            names = _Py_asdl_identifier_seq_new(len, arena);
13693
0
            if (names == NULL) goto failed;
13694
0
            for (i = 0; i < len; i++) {
13695
0
                identifier val;
13696
0
                PyObject *tmp2 = Py_NewRef(PyList_GET_ITEM(tmp, i));
13697
0
                if (_Py_EnterRecursiveCall(" while traversing 'Nonlocal' node")) {
13698
0
                    goto failed;
13699
0
                }
13700
0
                res = obj2ast_identifier(state, tmp2, &val, arena);
13701
0
                _Py_LeaveRecursiveCall();
13702
0
                Py_DECREF(tmp2);
13703
0
                if (res != 0) goto failed;
13704
0
                if (len != PyList_GET_SIZE(tmp)) {
13705
0
                    PyErr_SetString(PyExc_RuntimeError, "Nonlocal field \"names\" changed size during iteration");
13706
0
                    goto failed;
13707
0
                }
13708
0
                asdl_seq_SET(names, i, val);
13709
0
            }
13710
0
            Py_CLEAR(tmp);
13711
0
        }
13712
0
        *out = _PyAST_Nonlocal(names, lineno, col_offset, end_lineno,
13713
0
                               end_col_offset, arena);
13714
0
        if (*out == NULL) goto failed;
13715
0
        return 0;
13716
0
    }
13717
0
    tp = state->Expr_type;
13718
0
    isinstance = PyObject_IsInstance(obj, tp);
13719
0
    if (isinstance == -1) {
13720
0
        return -1;
13721
0
    }
13722
0
    if (isinstance) {
13723
0
        expr_ty value;
13724
13725
0
        if (PyObject_GetOptionalAttr(obj, state->value, &tmp) < 0) {
13726
0
            return -1;
13727
0
        }
13728
0
        if (tmp == NULL) {
13729
0
            PyErr_SetString(PyExc_TypeError, "required field \"value\" missing from Expr");
13730
0
            return -1;
13731
0
        }
13732
0
        else {
13733
0
            int res;
13734
0
            if (_Py_EnterRecursiveCall(" while traversing 'Expr' node")) {
13735
0
                goto failed;
13736
0
            }
13737
0
            res = obj2ast_expr(state, tmp, &value, arena);
13738
0
            _Py_LeaveRecursiveCall();
13739
0
            if (res != 0) goto failed;
13740
0
            Py_CLEAR(tmp);
13741
0
        }
13742
0
        *out = _PyAST_Expr(value, lineno, col_offset, end_lineno,
13743
0
                           end_col_offset, arena);
13744
0
        if (*out == NULL) goto failed;
13745
0
        return 0;
13746
0
    }
13747
0
    tp = state->Pass_type;
13748
0
    isinstance = PyObject_IsInstance(obj, tp);
13749
0
    if (isinstance == -1) {
13750
0
        return -1;
13751
0
    }
13752
0
    if (isinstance) {
13753
13754
0
        *out = _PyAST_Pass(lineno, col_offset, end_lineno, end_col_offset,
13755
0
                           arena);
13756
0
        if (*out == NULL) goto failed;
13757
0
        return 0;
13758
0
    }
13759
0
    tp = state->Break_type;
13760
0
    isinstance = PyObject_IsInstance(obj, tp);
13761
0
    if (isinstance == -1) {
13762
0
        return -1;
13763
0
    }
13764
0
    if (isinstance) {
13765
13766
0
        *out = _PyAST_Break(lineno, col_offset, end_lineno, end_col_offset,
13767
0
                            arena);
13768
0
        if (*out == NULL) goto failed;
13769
0
        return 0;
13770
0
    }
13771
0
    tp = state->Continue_type;
13772
0
    isinstance = PyObject_IsInstance(obj, tp);
13773
0
    if (isinstance == -1) {
13774
0
        return -1;
13775
0
    }
13776
0
    if (isinstance) {
13777
13778
0
        *out = _PyAST_Continue(lineno, col_offset, end_lineno, end_col_offset,
13779
0
                               arena);
13780
0
        if (*out == NULL) goto failed;
13781
0
        return 0;
13782
0
    }
13783
13784
0
    PyErr_Format(PyExc_TypeError, "expected some sort of stmt, but got %R", obj);
13785
0
    failed:
13786
0
    Py_XDECREF(tmp);
13787
0
    return -1;
13788
0
}
13789
13790
int
13791
obj2ast_expr(struct ast_state *state, PyObject* obj, expr_ty* out, PyArena*
13792
             arena)
13793
0
{
13794
0
    int isinstance;
13795
13796
0
    PyObject *tmp = NULL;
13797
0
    PyObject *tp;
13798
0
    int lineno;
13799
0
    int col_offset;
13800
0
    int end_lineno;
13801
0
    int end_col_offset;
13802
13803
0
    if (obj == Py_None) {
13804
0
        *out = NULL;
13805
0
        return 0;
13806
0
    }
13807
0
    if (PyObject_GetOptionalAttr(obj, state->lineno, &tmp) < 0) {
13808
0
        return -1;
13809
0
    }
13810
0
    if (tmp == NULL) {
13811
0
        PyErr_SetString(PyExc_TypeError, "required field \"lineno\" missing from expr");
13812
0
        return -1;
13813
0
    }
13814
0
    else {
13815
0
        int res;
13816
0
        if (_Py_EnterRecursiveCall(" while traversing 'expr' node")) {
13817
0
            goto failed;
13818
0
        }
13819
0
        res = obj2ast_int(state, tmp, &lineno, arena);
13820
0
        _Py_LeaveRecursiveCall();
13821
0
        if (res != 0) goto failed;
13822
0
        Py_CLEAR(tmp);
13823
0
    }
13824
0
    if (PyObject_GetOptionalAttr(obj, state->col_offset, &tmp) < 0) {
13825
0
        return -1;
13826
0
    }
13827
0
    if (tmp == NULL) {
13828
0
        PyErr_SetString(PyExc_TypeError, "required field \"col_offset\" missing from expr");
13829
0
        return -1;
13830
0
    }
13831
0
    else {
13832
0
        int res;
13833
0
        if (_Py_EnterRecursiveCall(" while traversing 'expr' node")) {
13834
0
            goto failed;
13835
0
        }
13836
0
        res = obj2ast_int(state, tmp, &col_offset, arena);
13837
0
        _Py_LeaveRecursiveCall();
13838
0
        if (res != 0) goto failed;
13839
0
        Py_CLEAR(tmp);
13840
0
    }
13841
0
    if (PyObject_GetOptionalAttr(obj, state->end_lineno, &tmp) < 0) {
13842
0
        return -1;
13843
0
    }
13844
0
    if (tmp == NULL || tmp == Py_None) {
13845
0
        Py_CLEAR(tmp);
13846
0
        end_lineno = lineno;
13847
0
    }
13848
0
    else {
13849
0
        int res;
13850
0
        if (_Py_EnterRecursiveCall(" while traversing 'expr' node")) {
13851
0
            goto failed;
13852
0
        }
13853
0
        res = obj2ast_int(state, tmp, &end_lineno, arena);
13854
0
        _Py_LeaveRecursiveCall();
13855
0
        if (res != 0) goto failed;
13856
0
        Py_CLEAR(tmp);
13857
0
    }
13858
0
    if (PyObject_GetOptionalAttr(obj, state->end_col_offset, &tmp) < 0) {
13859
0
        return -1;
13860
0
    }
13861
0
    if (tmp == NULL || tmp == Py_None) {
13862
0
        Py_CLEAR(tmp);
13863
0
        end_col_offset = col_offset;
13864
0
    }
13865
0
    else {
13866
0
        int res;
13867
0
        if (_Py_EnterRecursiveCall(" while traversing 'expr' node")) {
13868
0
            goto failed;
13869
0
        }
13870
0
        res = obj2ast_int(state, tmp, &end_col_offset, arena);
13871
0
        _Py_LeaveRecursiveCall();
13872
0
        if (res != 0) goto failed;
13873
0
        Py_CLEAR(tmp);
13874
0
    }
13875
0
    tp = state->BoolOp_type;
13876
0
    isinstance = PyObject_IsInstance(obj, tp);
13877
0
    if (isinstance == -1) {
13878
0
        return -1;
13879
0
    }
13880
0
    if (isinstance) {
13881
0
        boolop_ty op;
13882
0
        asdl_expr_seq* values;
13883
13884
0
        if (PyObject_GetOptionalAttr(obj, state->op, &tmp) < 0) {
13885
0
            return -1;
13886
0
        }
13887
0
        if (tmp == NULL) {
13888
0
            PyErr_SetString(PyExc_TypeError, "required field \"op\" missing from BoolOp");
13889
0
            return -1;
13890
0
        }
13891
0
        else {
13892
0
            int res;
13893
0
            if (_Py_EnterRecursiveCall(" while traversing 'BoolOp' node")) {
13894
0
                goto failed;
13895
0
            }
13896
0
            res = obj2ast_boolop(state, tmp, &op, arena);
13897
0
            _Py_LeaveRecursiveCall();
13898
0
            if (res != 0) goto failed;
13899
0
            Py_CLEAR(tmp);
13900
0
        }
13901
0
        if (PyObject_GetOptionalAttr(obj, state->values, &tmp) < 0) {
13902
0
            return -1;
13903
0
        }
13904
0
        if (tmp == NULL) {
13905
0
            tmp = PyList_New(0);
13906
0
            if (tmp == NULL) {
13907
0
                return -1;
13908
0
            }
13909
0
        }
13910
0
        {
13911
0
            int res;
13912
0
            Py_ssize_t len;
13913
0
            Py_ssize_t i;
13914
0
            if (!PyList_Check(tmp)) {
13915
0
                PyErr_Format(PyExc_TypeError, "BoolOp field \"values\" must be a list, not a %.200s", _PyType_Name(Py_TYPE(tmp)));
13916
0
                goto failed;
13917
0
            }
13918
0
            len = PyList_GET_SIZE(tmp);
13919
0
            values = _Py_asdl_expr_seq_new(len, arena);
13920
0
            if (values == NULL) goto failed;
13921
0
            for (i = 0; i < len; i++) {
13922
0
                expr_ty val;
13923
0
                PyObject *tmp2 = Py_NewRef(PyList_GET_ITEM(tmp, i));
13924
0
                if (_Py_EnterRecursiveCall(" while traversing 'BoolOp' node")) {
13925
0
                    goto failed;
13926
0
                }
13927
0
                res = obj2ast_expr(state, tmp2, &val, arena);
13928
0
                _Py_LeaveRecursiveCall();
13929
0
                Py_DECREF(tmp2);
13930
0
                if (res != 0) goto failed;
13931
0
                if (len != PyList_GET_SIZE(tmp)) {
13932
0
                    PyErr_SetString(PyExc_RuntimeError, "BoolOp field \"values\" changed size during iteration");
13933
0
                    goto failed;
13934
0
                }
13935
0
                asdl_seq_SET(values, i, val);
13936
0
            }
13937
0
            Py_CLEAR(tmp);
13938
0
        }
13939
0
        *out = _PyAST_BoolOp(op, values, lineno, col_offset, end_lineno,
13940
0
                             end_col_offset, arena);
13941
0
        if (*out == NULL) goto failed;
13942
0
        return 0;
13943
0
    }
13944
0
    tp = state->NamedExpr_type;
13945
0
    isinstance = PyObject_IsInstance(obj, tp);
13946
0
    if (isinstance == -1) {
13947
0
        return -1;
13948
0
    }
13949
0
    if (isinstance) {
13950
0
        expr_ty target;
13951
0
        expr_ty value;
13952
13953
0
        if (PyObject_GetOptionalAttr(obj, state->target, &tmp) < 0) {
13954
0
            return -1;
13955
0
        }
13956
0
        if (tmp == NULL) {
13957
0
            PyErr_SetString(PyExc_TypeError, "required field \"target\" missing from NamedExpr");
13958
0
            return -1;
13959
0
        }
13960
0
        else {
13961
0
            int res;
13962
0
            if (_Py_EnterRecursiveCall(" while traversing 'NamedExpr' node")) {
13963
0
                goto failed;
13964
0
            }
13965
0
            res = obj2ast_expr(state, tmp, &target, arena);
13966
0
            _Py_LeaveRecursiveCall();
13967
0
            if (res != 0) goto failed;
13968
0
            Py_CLEAR(tmp);
13969
0
        }
13970
0
        if (PyObject_GetOptionalAttr(obj, state->value, &tmp) < 0) {
13971
0
            return -1;
13972
0
        }
13973
0
        if (tmp == NULL) {
13974
0
            PyErr_SetString(PyExc_TypeError, "required field \"value\" missing from NamedExpr");
13975
0
            return -1;
13976
0
        }
13977
0
        else {
13978
0
            int res;
13979
0
            if (_Py_EnterRecursiveCall(" while traversing 'NamedExpr' node")) {
13980
0
                goto failed;
13981
0
            }
13982
0
            res = obj2ast_expr(state, tmp, &value, arena);
13983
0
            _Py_LeaveRecursiveCall();
13984
0
            if (res != 0) goto failed;
13985
0
            Py_CLEAR(tmp);
13986
0
        }
13987
0
        *out = _PyAST_NamedExpr(target, value, lineno, col_offset, end_lineno,
13988
0
                                end_col_offset, arena);
13989
0
        if (*out == NULL) goto failed;
13990
0
        return 0;
13991
0
    }
13992
0
    tp = state->BinOp_type;
13993
0
    isinstance = PyObject_IsInstance(obj, tp);
13994
0
    if (isinstance == -1) {
13995
0
        return -1;
13996
0
    }
13997
0
    if (isinstance) {
13998
0
        expr_ty left;
13999
0
        operator_ty op;
14000
0
        expr_ty right;
14001
14002
0
        if (PyObject_GetOptionalAttr(obj, state->left, &tmp) < 0) {
14003
0
            return -1;
14004
0
        }
14005
0
        if (tmp == NULL) {
14006
0
            PyErr_SetString(PyExc_TypeError, "required field \"left\" missing from BinOp");
14007
0
            return -1;
14008
0
        }
14009
0
        else {
14010
0
            int res;
14011
0
            if (_Py_EnterRecursiveCall(" while traversing 'BinOp' node")) {
14012
0
                goto failed;
14013
0
            }
14014
0
            res = obj2ast_expr(state, tmp, &left, arena);
14015
0
            _Py_LeaveRecursiveCall();
14016
0
            if (res != 0) goto failed;
14017
0
            Py_CLEAR(tmp);
14018
0
        }
14019
0
        if (PyObject_GetOptionalAttr(obj, state->op, &tmp) < 0) {
14020
0
            return -1;
14021
0
        }
14022
0
        if (tmp == NULL) {
14023
0
            PyErr_SetString(PyExc_TypeError, "required field \"op\" missing from BinOp");
14024
0
            return -1;
14025
0
        }
14026
0
        else {
14027
0
            int res;
14028
0
            if (_Py_EnterRecursiveCall(" while traversing 'BinOp' node")) {
14029
0
                goto failed;
14030
0
            }
14031
0
            res = obj2ast_operator(state, tmp, &op, arena);
14032
0
            _Py_LeaveRecursiveCall();
14033
0
            if (res != 0) goto failed;
14034
0
            Py_CLEAR(tmp);
14035
0
        }
14036
0
        if (PyObject_GetOptionalAttr(obj, state->right, &tmp) < 0) {
14037
0
            return -1;
14038
0
        }
14039
0
        if (tmp == NULL) {
14040
0
            PyErr_SetString(PyExc_TypeError, "required field \"right\" missing from BinOp");
14041
0
            return -1;
14042
0
        }
14043
0
        else {
14044
0
            int res;
14045
0
            if (_Py_EnterRecursiveCall(" while traversing 'BinOp' node")) {
14046
0
                goto failed;
14047
0
            }
14048
0
            res = obj2ast_expr(state, tmp, &right, arena);
14049
0
            _Py_LeaveRecursiveCall();
14050
0
            if (res != 0) goto failed;
14051
0
            Py_CLEAR(tmp);
14052
0
        }
14053
0
        *out = _PyAST_BinOp(left, op, right, lineno, col_offset, end_lineno,
14054
0
                            end_col_offset, arena);
14055
0
        if (*out == NULL) goto failed;
14056
0
        return 0;
14057
0
    }
14058
0
    tp = state->UnaryOp_type;
14059
0
    isinstance = PyObject_IsInstance(obj, tp);
14060
0
    if (isinstance == -1) {
14061
0
        return -1;
14062
0
    }
14063
0
    if (isinstance) {
14064
0
        unaryop_ty op;
14065
0
        expr_ty operand;
14066
14067
0
        if (PyObject_GetOptionalAttr(obj, state->op, &tmp) < 0) {
14068
0
            return -1;
14069
0
        }
14070
0
        if (tmp == NULL) {
14071
0
            PyErr_SetString(PyExc_TypeError, "required field \"op\" missing from UnaryOp");
14072
0
            return -1;
14073
0
        }
14074
0
        else {
14075
0
            int res;
14076
0
            if (_Py_EnterRecursiveCall(" while traversing 'UnaryOp' node")) {
14077
0
                goto failed;
14078
0
            }
14079
0
            res = obj2ast_unaryop(state, tmp, &op, arena);
14080
0
            _Py_LeaveRecursiveCall();
14081
0
            if (res != 0) goto failed;
14082
0
            Py_CLEAR(tmp);
14083
0
        }
14084
0
        if (PyObject_GetOptionalAttr(obj, state->operand, &tmp) < 0) {
14085
0
            return -1;
14086
0
        }
14087
0
        if (tmp == NULL) {
14088
0
            PyErr_SetString(PyExc_TypeError, "required field \"operand\" missing from UnaryOp");
14089
0
            return -1;
14090
0
        }
14091
0
        else {
14092
0
            int res;
14093
0
            if (_Py_EnterRecursiveCall(" while traversing 'UnaryOp' node")) {
14094
0
                goto failed;
14095
0
            }
14096
0
            res = obj2ast_expr(state, tmp, &operand, arena);
14097
0
            _Py_LeaveRecursiveCall();
14098
0
            if (res != 0) goto failed;
14099
0
            Py_CLEAR(tmp);
14100
0
        }
14101
0
        *out = _PyAST_UnaryOp(op, operand, lineno, col_offset, end_lineno,
14102
0
                              end_col_offset, arena);
14103
0
        if (*out == NULL) goto failed;
14104
0
        return 0;
14105
0
    }
14106
0
    tp = state->Lambda_type;
14107
0
    isinstance = PyObject_IsInstance(obj, tp);
14108
0
    if (isinstance == -1) {
14109
0
        return -1;
14110
0
    }
14111
0
    if (isinstance) {
14112
0
        arguments_ty args;
14113
0
        expr_ty body;
14114
14115
0
        if (PyObject_GetOptionalAttr(obj, state->args, &tmp) < 0) {
14116
0
            return -1;
14117
0
        }
14118
0
        if (tmp == NULL) {
14119
0
            PyErr_SetString(PyExc_TypeError, "required field \"args\" missing from Lambda");
14120
0
            return -1;
14121
0
        }
14122
0
        else {
14123
0
            int res;
14124
0
            if (_Py_EnterRecursiveCall(" while traversing 'Lambda' node")) {
14125
0
                goto failed;
14126
0
            }
14127
0
            res = obj2ast_arguments(state, tmp, &args, arena);
14128
0
            _Py_LeaveRecursiveCall();
14129
0
            if (res != 0) goto failed;
14130
0
            Py_CLEAR(tmp);
14131
0
        }
14132
0
        if (PyObject_GetOptionalAttr(obj, state->body, &tmp) < 0) {
14133
0
            return -1;
14134
0
        }
14135
0
        if (tmp == NULL) {
14136
0
            PyErr_SetString(PyExc_TypeError, "required field \"body\" missing from Lambda");
14137
0
            return -1;
14138
0
        }
14139
0
        else {
14140
0
            int res;
14141
0
            if (_Py_EnterRecursiveCall(" while traversing 'Lambda' node")) {
14142
0
                goto failed;
14143
0
            }
14144
0
            res = obj2ast_expr(state, tmp, &body, arena);
14145
0
            _Py_LeaveRecursiveCall();
14146
0
            if (res != 0) goto failed;
14147
0
            Py_CLEAR(tmp);
14148
0
        }
14149
0
        *out = _PyAST_Lambda(args, body, lineno, col_offset, end_lineno,
14150
0
                             end_col_offset, arena);
14151
0
        if (*out == NULL) goto failed;
14152
0
        return 0;
14153
0
    }
14154
0
    tp = state->IfExp_type;
14155
0
    isinstance = PyObject_IsInstance(obj, tp);
14156
0
    if (isinstance == -1) {
14157
0
        return -1;
14158
0
    }
14159
0
    if (isinstance) {
14160
0
        expr_ty test;
14161
0
        expr_ty body;
14162
0
        expr_ty orelse;
14163
14164
0
        if (PyObject_GetOptionalAttr(obj, state->test, &tmp) < 0) {
14165
0
            return -1;
14166
0
        }
14167
0
        if (tmp == NULL) {
14168
0
            PyErr_SetString(PyExc_TypeError, "required field \"test\" missing from IfExp");
14169
0
            return -1;
14170
0
        }
14171
0
        else {
14172
0
            int res;
14173
0
            if (_Py_EnterRecursiveCall(" while traversing 'IfExp' node")) {
14174
0
                goto failed;
14175
0
            }
14176
0
            res = obj2ast_expr(state, tmp, &test, arena);
14177
0
            _Py_LeaveRecursiveCall();
14178
0
            if (res != 0) goto failed;
14179
0
            Py_CLEAR(tmp);
14180
0
        }
14181
0
        if (PyObject_GetOptionalAttr(obj, state->body, &tmp) < 0) {
14182
0
            return -1;
14183
0
        }
14184
0
        if (tmp == NULL) {
14185
0
            PyErr_SetString(PyExc_TypeError, "required field \"body\" missing from IfExp");
14186
0
            return -1;
14187
0
        }
14188
0
        else {
14189
0
            int res;
14190
0
            if (_Py_EnterRecursiveCall(" while traversing 'IfExp' node")) {
14191
0
                goto failed;
14192
0
            }
14193
0
            res = obj2ast_expr(state, tmp, &body, arena);
14194
0
            _Py_LeaveRecursiveCall();
14195
0
            if (res != 0) goto failed;
14196
0
            Py_CLEAR(tmp);
14197
0
        }
14198
0
        if (PyObject_GetOptionalAttr(obj, state->orelse, &tmp) < 0) {
14199
0
            return -1;
14200
0
        }
14201
0
        if (tmp == NULL) {
14202
0
            PyErr_SetString(PyExc_TypeError, "required field \"orelse\" missing from IfExp");
14203
0
            return -1;
14204
0
        }
14205
0
        else {
14206
0
            int res;
14207
0
            if (_Py_EnterRecursiveCall(" while traversing 'IfExp' node")) {
14208
0
                goto failed;
14209
0
            }
14210
0
            res = obj2ast_expr(state, tmp, &orelse, arena);
14211
0
            _Py_LeaveRecursiveCall();
14212
0
            if (res != 0) goto failed;
14213
0
            Py_CLEAR(tmp);
14214
0
        }
14215
0
        *out = _PyAST_IfExp(test, body, orelse, lineno, col_offset, end_lineno,
14216
0
                            end_col_offset, arena);
14217
0
        if (*out == NULL) goto failed;
14218
0
        return 0;
14219
0
    }
14220
0
    tp = state->Dict_type;
14221
0
    isinstance = PyObject_IsInstance(obj, tp);
14222
0
    if (isinstance == -1) {
14223
0
        return -1;
14224
0
    }
14225
0
    if (isinstance) {
14226
0
        asdl_expr_seq* keys;
14227
0
        asdl_expr_seq* values;
14228
14229
0
        if (PyObject_GetOptionalAttr(obj, state->keys, &tmp) < 0) {
14230
0
            return -1;
14231
0
        }
14232
0
        if (tmp == NULL) {
14233
0
            tmp = PyList_New(0);
14234
0
            if (tmp == NULL) {
14235
0
                return -1;
14236
0
            }
14237
0
        }
14238
0
        {
14239
0
            int res;
14240
0
            Py_ssize_t len;
14241
0
            Py_ssize_t i;
14242
0
            if (!PyList_Check(tmp)) {
14243
0
                PyErr_Format(PyExc_TypeError, "Dict field \"keys\" must be a list, not a %.200s", _PyType_Name(Py_TYPE(tmp)));
14244
0
                goto failed;
14245
0
            }
14246
0
            len = PyList_GET_SIZE(tmp);
14247
0
            keys = _Py_asdl_expr_seq_new(len, arena);
14248
0
            if (keys == NULL) goto failed;
14249
0
            for (i = 0; i < len; i++) {
14250
0
                expr_ty val;
14251
0
                PyObject *tmp2 = Py_NewRef(PyList_GET_ITEM(tmp, i));
14252
0
                if (_Py_EnterRecursiveCall(" while traversing 'Dict' node")) {
14253
0
                    goto failed;
14254
0
                }
14255
0
                res = obj2ast_expr(state, tmp2, &val, arena);
14256
0
                _Py_LeaveRecursiveCall();
14257
0
                Py_DECREF(tmp2);
14258
0
                if (res != 0) goto failed;
14259
0
                if (len != PyList_GET_SIZE(tmp)) {
14260
0
                    PyErr_SetString(PyExc_RuntimeError, "Dict field \"keys\" changed size during iteration");
14261
0
                    goto failed;
14262
0
                }
14263
0
                asdl_seq_SET(keys, i, val);
14264
0
            }
14265
0
            Py_CLEAR(tmp);
14266
0
        }
14267
0
        if (PyObject_GetOptionalAttr(obj, state->values, &tmp) < 0) {
14268
0
            return -1;
14269
0
        }
14270
0
        if (tmp == NULL) {
14271
0
            tmp = PyList_New(0);
14272
0
            if (tmp == NULL) {
14273
0
                return -1;
14274
0
            }
14275
0
        }
14276
0
        {
14277
0
            int res;
14278
0
            Py_ssize_t len;
14279
0
            Py_ssize_t i;
14280
0
            if (!PyList_Check(tmp)) {
14281
0
                PyErr_Format(PyExc_TypeError, "Dict field \"values\" must be a list, not a %.200s", _PyType_Name(Py_TYPE(tmp)));
14282
0
                goto failed;
14283
0
            }
14284
0
            len = PyList_GET_SIZE(tmp);
14285
0
            values = _Py_asdl_expr_seq_new(len, arena);
14286
0
            if (values == NULL) goto failed;
14287
0
            for (i = 0; i < len; i++) {
14288
0
                expr_ty val;
14289
0
                PyObject *tmp2 = Py_NewRef(PyList_GET_ITEM(tmp, i));
14290
0
                if (_Py_EnterRecursiveCall(" while traversing 'Dict' node")) {
14291
0
                    goto failed;
14292
0
                }
14293
0
                res = obj2ast_expr(state, tmp2, &val, arena);
14294
0
                _Py_LeaveRecursiveCall();
14295
0
                Py_DECREF(tmp2);
14296
0
                if (res != 0) goto failed;
14297
0
                if (len != PyList_GET_SIZE(tmp)) {
14298
0
                    PyErr_SetString(PyExc_RuntimeError, "Dict field \"values\" changed size during iteration");
14299
0
                    goto failed;
14300
0
                }
14301
0
                asdl_seq_SET(values, i, val);
14302
0
            }
14303
0
            Py_CLEAR(tmp);
14304
0
        }
14305
0
        *out = _PyAST_Dict(keys, values, lineno, col_offset, end_lineno,
14306
0
                           end_col_offset, arena);
14307
0
        if (*out == NULL) goto failed;
14308
0
        return 0;
14309
0
    }
14310
0
    tp = state->Set_type;
14311
0
    isinstance = PyObject_IsInstance(obj, tp);
14312
0
    if (isinstance == -1) {
14313
0
        return -1;
14314
0
    }
14315
0
    if (isinstance) {
14316
0
        asdl_expr_seq* elts;
14317
14318
0
        if (PyObject_GetOptionalAttr(obj, state->elts, &tmp) < 0) {
14319
0
            return -1;
14320
0
        }
14321
0
        if (tmp == NULL) {
14322
0
            tmp = PyList_New(0);
14323
0
            if (tmp == NULL) {
14324
0
                return -1;
14325
0
            }
14326
0
        }
14327
0
        {
14328
0
            int res;
14329
0
            Py_ssize_t len;
14330
0
            Py_ssize_t i;
14331
0
            if (!PyList_Check(tmp)) {
14332
0
                PyErr_Format(PyExc_TypeError, "Set field \"elts\" must be a list, not a %.200s", _PyType_Name(Py_TYPE(tmp)));
14333
0
                goto failed;
14334
0
            }
14335
0
            len = PyList_GET_SIZE(tmp);
14336
0
            elts = _Py_asdl_expr_seq_new(len, arena);
14337
0
            if (elts == NULL) goto failed;
14338
0
            for (i = 0; i < len; i++) {
14339
0
                expr_ty val;
14340
0
                PyObject *tmp2 = Py_NewRef(PyList_GET_ITEM(tmp, i));
14341
0
                if (_Py_EnterRecursiveCall(" while traversing 'Set' node")) {
14342
0
                    goto failed;
14343
0
                }
14344
0
                res = obj2ast_expr(state, tmp2, &val, arena);
14345
0
                _Py_LeaveRecursiveCall();
14346
0
                Py_DECREF(tmp2);
14347
0
                if (res != 0) goto failed;
14348
0
                if (len != PyList_GET_SIZE(tmp)) {
14349
0
                    PyErr_SetString(PyExc_RuntimeError, "Set field \"elts\" changed size during iteration");
14350
0
                    goto failed;
14351
0
                }
14352
0
                asdl_seq_SET(elts, i, val);
14353
0
            }
14354
0
            Py_CLEAR(tmp);
14355
0
        }
14356
0
        *out = _PyAST_Set(elts, lineno, col_offset, end_lineno, end_col_offset,
14357
0
                          arena);
14358
0
        if (*out == NULL) goto failed;
14359
0
        return 0;
14360
0
    }
14361
0
    tp = state->ListComp_type;
14362
0
    isinstance = PyObject_IsInstance(obj, tp);
14363
0
    if (isinstance == -1) {
14364
0
        return -1;
14365
0
    }
14366
0
    if (isinstance) {
14367
0
        expr_ty elt;
14368
0
        asdl_comprehension_seq* generators;
14369
14370
0
        if (PyObject_GetOptionalAttr(obj, state->elt, &tmp) < 0) {
14371
0
            return -1;
14372
0
        }
14373
0
        if (tmp == NULL) {
14374
0
            PyErr_SetString(PyExc_TypeError, "required field \"elt\" missing from ListComp");
14375
0
            return -1;
14376
0
        }
14377
0
        else {
14378
0
            int res;
14379
0
            if (_Py_EnterRecursiveCall(" while traversing 'ListComp' node")) {
14380
0
                goto failed;
14381
0
            }
14382
0
            res = obj2ast_expr(state, tmp, &elt, arena);
14383
0
            _Py_LeaveRecursiveCall();
14384
0
            if (res != 0) goto failed;
14385
0
            Py_CLEAR(tmp);
14386
0
        }
14387
0
        if (PyObject_GetOptionalAttr(obj, state->generators, &tmp) < 0) {
14388
0
            return -1;
14389
0
        }
14390
0
        if (tmp == NULL) {
14391
0
            tmp = PyList_New(0);
14392
0
            if (tmp == NULL) {
14393
0
                return -1;
14394
0
            }
14395
0
        }
14396
0
        {
14397
0
            int res;
14398
0
            Py_ssize_t len;
14399
0
            Py_ssize_t i;
14400
0
            if (!PyList_Check(tmp)) {
14401
0
                PyErr_Format(PyExc_TypeError, "ListComp field \"generators\" must be a list, not a %.200s", _PyType_Name(Py_TYPE(tmp)));
14402
0
                goto failed;
14403
0
            }
14404
0
            len = PyList_GET_SIZE(tmp);
14405
0
            generators = _Py_asdl_comprehension_seq_new(len, arena);
14406
0
            if (generators == NULL) goto failed;
14407
0
            for (i = 0; i < len; i++) {
14408
0
                comprehension_ty val;
14409
0
                PyObject *tmp2 = Py_NewRef(PyList_GET_ITEM(tmp, i));
14410
0
                if (_Py_EnterRecursiveCall(" while traversing 'ListComp' node")) {
14411
0
                    goto failed;
14412
0
                }
14413
0
                res = obj2ast_comprehension(state, tmp2, &val, arena);
14414
0
                _Py_LeaveRecursiveCall();
14415
0
                Py_DECREF(tmp2);
14416
0
                if (res != 0) goto failed;
14417
0
                if (len != PyList_GET_SIZE(tmp)) {
14418
0
                    PyErr_SetString(PyExc_RuntimeError, "ListComp field \"generators\" changed size during iteration");
14419
0
                    goto failed;
14420
0
                }
14421
0
                asdl_seq_SET(generators, i, val);
14422
0
            }
14423
0
            Py_CLEAR(tmp);
14424
0
        }
14425
0
        *out = _PyAST_ListComp(elt, generators, lineno, col_offset, end_lineno,
14426
0
                               end_col_offset, arena);
14427
0
        if (*out == NULL) goto failed;
14428
0
        return 0;
14429
0
    }
14430
0
    tp = state->SetComp_type;
14431
0
    isinstance = PyObject_IsInstance(obj, tp);
14432
0
    if (isinstance == -1) {
14433
0
        return -1;
14434
0
    }
14435
0
    if (isinstance) {
14436
0
        expr_ty elt;
14437
0
        asdl_comprehension_seq* generators;
14438
14439
0
        if (PyObject_GetOptionalAttr(obj, state->elt, &tmp) < 0) {
14440
0
            return -1;
14441
0
        }
14442
0
        if (tmp == NULL) {
14443
0
            PyErr_SetString(PyExc_TypeError, "required field \"elt\" missing from SetComp");
14444
0
            return -1;
14445
0
        }
14446
0
        else {
14447
0
            int res;
14448
0
            if (_Py_EnterRecursiveCall(" while traversing 'SetComp' node")) {
14449
0
                goto failed;
14450
0
            }
14451
0
            res = obj2ast_expr(state, tmp, &elt, arena);
14452
0
            _Py_LeaveRecursiveCall();
14453
0
            if (res != 0) goto failed;
14454
0
            Py_CLEAR(tmp);
14455
0
        }
14456
0
        if (PyObject_GetOptionalAttr(obj, state->generators, &tmp) < 0) {
14457
0
            return -1;
14458
0
        }
14459
0
        if (tmp == NULL) {
14460
0
            tmp = PyList_New(0);
14461
0
            if (tmp == NULL) {
14462
0
                return -1;
14463
0
            }
14464
0
        }
14465
0
        {
14466
0
            int res;
14467
0
            Py_ssize_t len;
14468
0
            Py_ssize_t i;
14469
0
            if (!PyList_Check(tmp)) {
14470
0
                PyErr_Format(PyExc_TypeError, "SetComp field \"generators\" must be a list, not a %.200s", _PyType_Name(Py_TYPE(tmp)));
14471
0
                goto failed;
14472
0
            }
14473
0
            len = PyList_GET_SIZE(tmp);
14474
0
            generators = _Py_asdl_comprehension_seq_new(len, arena);
14475
0
            if (generators == NULL) goto failed;
14476
0
            for (i = 0; i < len; i++) {
14477
0
                comprehension_ty val;
14478
0
                PyObject *tmp2 = Py_NewRef(PyList_GET_ITEM(tmp, i));
14479
0
                if (_Py_EnterRecursiveCall(" while traversing 'SetComp' node")) {
14480
0
                    goto failed;
14481
0
                }
14482
0
                res = obj2ast_comprehension(state, tmp2, &val, arena);
14483
0
                _Py_LeaveRecursiveCall();
14484
0
                Py_DECREF(tmp2);
14485
0
                if (res != 0) goto failed;
14486
0
                if (len != PyList_GET_SIZE(tmp)) {
14487
0
                    PyErr_SetString(PyExc_RuntimeError, "SetComp field \"generators\" changed size during iteration");
14488
0
                    goto failed;
14489
0
                }
14490
0
                asdl_seq_SET(generators, i, val);
14491
0
            }
14492
0
            Py_CLEAR(tmp);
14493
0
        }
14494
0
        *out = _PyAST_SetComp(elt, generators, lineno, col_offset, end_lineno,
14495
0
                              end_col_offset, arena);
14496
0
        if (*out == NULL) goto failed;
14497
0
        return 0;
14498
0
    }
14499
0
    tp = state->DictComp_type;
14500
0
    isinstance = PyObject_IsInstance(obj, tp);
14501
0
    if (isinstance == -1) {
14502
0
        return -1;
14503
0
    }
14504
0
    if (isinstance) {
14505
0
        expr_ty key;
14506
0
        expr_ty value;
14507
0
        asdl_comprehension_seq* generators;
14508
14509
0
        if (PyObject_GetOptionalAttr(obj, state->key, &tmp) < 0) {
14510
0
            return -1;
14511
0
        }
14512
0
        if (tmp == NULL) {
14513
0
            PyErr_SetString(PyExc_TypeError, "required field \"key\" missing from DictComp");
14514
0
            return -1;
14515
0
        }
14516
0
        else {
14517
0
            int res;
14518
0
            if (_Py_EnterRecursiveCall(" while traversing 'DictComp' node")) {
14519
0
                goto failed;
14520
0
            }
14521
0
            res = obj2ast_expr(state, tmp, &key, arena);
14522
0
            _Py_LeaveRecursiveCall();
14523
0
            if (res != 0) goto failed;
14524
0
            Py_CLEAR(tmp);
14525
0
        }
14526
0
        if (PyObject_GetOptionalAttr(obj, state->value, &tmp) < 0) {
14527
0
            return -1;
14528
0
        }
14529
0
        if (tmp == NULL) {
14530
0
            PyErr_SetString(PyExc_TypeError, "required field \"value\" missing from DictComp");
14531
0
            return -1;
14532
0
        }
14533
0
        else {
14534
0
            int res;
14535
0
            if (_Py_EnterRecursiveCall(" while traversing 'DictComp' node")) {
14536
0
                goto failed;
14537
0
            }
14538
0
            res = obj2ast_expr(state, tmp, &value, arena);
14539
0
            _Py_LeaveRecursiveCall();
14540
0
            if (res != 0) goto failed;
14541
0
            Py_CLEAR(tmp);
14542
0
        }
14543
0
        if (PyObject_GetOptionalAttr(obj, state->generators, &tmp) < 0) {
14544
0
            return -1;
14545
0
        }
14546
0
        if (tmp == NULL) {
14547
0
            tmp = PyList_New(0);
14548
0
            if (tmp == NULL) {
14549
0
                return -1;
14550
0
            }
14551
0
        }
14552
0
        {
14553
0
            int res;
14554
0
            Py_ssize_t len;
14555
0
            Py_ssize_t i;
14556
0
            if (!PyList_Check(tmp)) {
14557
0
                PyErr_Format(PyExc_TypeError, "DictComp field \"generators\" must be a list, not a %.200s", _PyType_Name(Py_TYPE(tmp)));
14558
0
                goto failed;
14559
0
            }
14560
0
            len = PyList_GET_SIZE(tmp);
14561
0
            generators = _Py_asdl_comprehension_seq_new(len, arena);
14562
0
            if (generators == NULL) goto failed;
14563
0
            for (i = 0; i < len; i++) {
14564
0
                comprehension_ty val;
14565
0
                PyObject *tmp2 = Py_NewRef(PyList_GET_ITEM(tmp, i));
14566
0
                if (_Py_EnterRecursiveCall(" while traversing 'DictComp' node")) {
14567
0
                    goto failed;
14568
0
                }
14569
0
                res = obj2ast_comprehension(state, tmp2, &val, arena);
14570
0
                _Py_LeaveRecursiveCall();
14571
0
                Py_DECREF(tmp2);
14572
0
                if (res != 0) goto failed;
14573
0
                if (len != PyList_GET_SIZE(tmp)) {
14574
0
                    PyErr_SetString(PyExc_RuntimeError, "DictComp field \"generators\" changed size during iteration");
14575
0
                    goto failed;
14576
0
                }
14577
0
                asdl_seq_SET(generators, i, val);
14578
0
            }
14579
0
            Py_CLEAR(tmp);
14580
0
        }
14581
0
        *out = _PyAST_DictComp(key, value, generators, lineno, col_offset,
14582
0
                               end_lineno, end_col_offset, arena);
14583
0
        if (*out == NULL) goto failed;
14584
0
        return 0;
14585
0
    }
14586
0
    tp = state->GeneratorExp_type;
14587
0
    isinstance = PyObject_IsInstance(obj, tp);
14588
0
    if (isinstance == -1) {
14589
0
        return -1;
14590
0
    }
14591
0
    if (isinstance) {
14592
0
        expr_ty elt;
14593
0
        asdl_comprehension_seq* generators;
14594
14595
0
        if (PyObject_GetOptionalAttr(obj, state->elt, &tmp) < 0) {
14596
0
            return -1;
14597
0
        }
14598
0
        if (tmp == NULL) {
14599
0
            PyErr_SetString(PyExc_TypeError, "required field \"elt\" missing from GeneratorExp");
14600
0
            return -1;
14601
0
        }
14602
0
        else {
14603
0
            int res;
14604
0
            if (_Py_EnterRecursiveCall(" while traversing 'GeneratorExp' node")) {
14605
0
                goto failed;
14606
0
            }
14607
0
            res = obj2ast_expr(state, tmp, &elt, arena);
14608
0
            _Py_LeaveRecursiveCall();
14609
0
            if (res != 0) goto failed;
14610
0
            Py_CLEAR(tmp);
14611
0
        }
14612
0
        if (PyObject_GetOptionalAttr(obj, state->generators, &tmp) < 0) {
14613
0
            return -1;
14614
0
        }
14615
0
        if (tmp == NULL) {
14616
0
            tmp = PyList_New(0);
14617
0
            if (tmp == NULL) {
14618
0
                return -1;
14619
0
            }
14620
0
        }
14621
0
        {
14622
0
            int res;
14623
0
            Py_ssize_t len;
14624
0
            Py_ssize_t i;
14625
0
            if (!PyList_Check(tmp)) {
14626
0
                PyErr_Format(PyExc_TypeError, "GeneratorExp field \"generators\" must be a list, not a %.200s", _PyType_Name(Py_TYPE(tmp)));
14627
0
                goto failed;
14628
0
            }
14629
0
            len = PyList_GET_SIZE(tmp);
14630
0
            generators = _Py_asdl_comprehension_seq_new(len, arena);
14631
0
            if (generators == NULL) goto failed;
14632
0
            for (i = 0; i < len; i++) {
14633
0
                comprehension_ty val;
14634
0
                PyObject *tmp2 = Py_NewRef(PyList_GET_ITEM(tmp, i));
14635
0
                if (_Py_EnterRecursiveCall(" while traversing 'GeneratorExp' node")) {
14636
0
                    goto failed;
14637
0
                }
14638
0
                res = obj2ast_comprehension(state, tmp2, &val, arena);
14639
0
                _Py_LeaveRecursiveCall();
14640
0
                Py_DECREF(tmp2);
14641
0
                if (res != 0) goto failed;
14642
0
                if (len != PyList_GET_SIZE(tmp)) {
14643
0
                    PyErr_SetString(PyExc_RuntimeError, "GeneratorExp field \"generators\" changed size during iteration");
14644
0
                    goto failed;
14645
0
                }
14646
0
                asdl_seq_SET(generators, i, val);
14647
0
            }
14648
0
            Py_CLEAR(tmp);
14649
0
        }
14650
0
        *out = _PyAST_GeneratorExp(elt, generators, lineno, col_offset,
14651
0
                                   end_lineno, end_col_offset, arena);
14652
0
        if (*out == NULL) goto failed;
14653
0
        return 0;
14654
0
    }
14655
0
    tp = state->Await_type;
14656
0
    isinstance = PyObject_IsInstance(obj, tp);
14657
0
    if (isinstance == -1) {
14658
0
        return -1;
14659
0
    }
14660
0
    if (isinstance) {
14661
0
        expr_ty value;
14662
14663
0
        if (PyObject_GetOptionalAttr(obj, state->value, &tmp) < 0) {
14664
0
            return -1;
14665
0
        }
14666
0
        if (tmp == NULL) {
14667
0
            PyErr_SetString(PyExc_TypeError, "required field \"value\" missing from Await");
14668
0
            return -1;
14669
0
        }
14670
0
        else {
14671
0
            int res;
14672
0
            if (_Py_EnterRecursiveCall(" while traversing 'Await' node")) {
14673
0
                goto failed;
14674
0
            }
14675
0
            res = obj2ast_expr(state, tmp, &value, arena);
14676
0
            _Py_LeaveRecursiveCall();
14677
0
            if (res != 0) goto failed;
14678
0
            Py_CLEAR(tmp);
14679
0
        }
14680
0
        *out = _PyAST_Await(value, lineno, col_offset, end_lineno,
14681
0
                            end_col_offset, arena);
14682
0
        if (*out == NULL) goto failed;
14683
0
        return 0;
14684
0
    }
14685
0
    tp = state->Yield_type;
14686
0
    isinstance = PyObject_IsInstance(obj, tp);
14687
0
    if (isinstance == -1) {
14688
0
        return -1;
14689
0
    }
14690
0
    if (isinstance) {
14691
0
        expr_ty value;
14692
14693
0
        if (PyObject_GetOptionalAttr(obj, state->value, &tmp) < 0) {
14694
0
            return -1;
14695
0
        }
14696
0
        if (tmp == NULL || tmp == Py_None) {
14697
0
            Py_CLEAR(tmp);
14698
0
            value = NULL;
14699
0
        }
14700
0
        else {
14701
0
            int res;
14702
0
            if (_Py_EnterRecursiveCall(" while traversing 'Yield' node")) {
14703
0
                goto failed;
14704
0
            }
14705
0
            res = obj2ast_expr(state, tmp, &value, arena);
14706
0
            _Py_LeaveRecursiveCall();
14707
0
            if (res != 0) goto failed;
14708
0
            Py_CLEAR(tmp);
14709
0
        }
14710
0
        *out = _PyAST_Yield(value, lineno, col_offset, end_lineno,
14711
0
                            end_col_offset, arena);
14712
0
        if (*out == NULL) goto failed;
14713
0
        return 0;
14714
0
    }
14715
0
    tp = state->YieldFrom_type;
14716
0
    isinstance = PyObject_IsInstance(obj, tp);
14717
0
    if (isinstance == -1) {
14718
0
        return -1;
14719
0
    }
14720
0
    if (isinstance) {
14721
0
        expr_ty value;
14722
14723
0
        if (PyObject_GetOptionalAttr(obj, state->value, &tmp) < 0) {
14724
0
            return -1;
14725
0
        }
14726
0
        if (tmp == NULL) {
14727
0
            PyErr_SetString(PyExc_TypeError, "required field \"value\" missing from YieldFrom");
14728
0
            return -1;
14729
0
        }
14730
0
        else {
14731
0
            int res;
14732
0
            if (_Py_EnterRecursiveCall(" while traversing 'YieldFrom' node")) {
14733
0
                goto failed;
14734
0
            }
14735
0
            res = obj2ast_expr(state, tmp, &value, arena);
14736
0
            _Py_LeaveRecursiveCall();
14737
0
            if (res != 0) goto failed;
14738
0
            Py_CLEAR(tmp);
14739
0
        }
14740
0
        *out = _PyAST_YieldFrom(value, lineno, col_offset, end_lineno,
14741
0
                                end_col_offset, arena);
14742
0
        if (*out == NULL) goto failed;
14743
0
        return 0;
14744
0
    }
14745
0
    tp = state->Compare_type;
14746
0
    isinstance = PyObject_IsInstance(obj, tp);
14747
0
    if (isinstance == -1) {
14748
0
        return -1;
14749
0
    }
14750
0
    if (isinstance) {
14751
0
        expr_ty left;
14752
0
        asdl_int_seq* ops;
14753
0
        asdl_expr_seq* comparators;
14754
14755
0
        if (PyObject_GetOptionalAttr(obj, state->left, &tmp) < 0) {
14756
0
            return -1;
14757
0
        }
14758
0
        if (tmp == NULL) {
14759
0
            PyErr_SetString(PyExc_TypeError, "required field \"left\" missing from Compare");
14760
0
            return -1;
14761
0
        }
14762
0
        else {
14763
0
            int res;
14764
0
            if (_Py_EnterRecursiveCall(" while traversing 'Compare' node")) {
14765
0
                goto failed;
14766
0
            }
14767
0
            res = obj2ast_expr(state, tmp, &left, arena);
14768
0
            _Py_LeaveRecursiveCall();
14769
0
            if (res != 0) goto failed;
14770
0
            Py_CLEAR(tmp);
14771
0
        }
14772
0
        if (PyObject_GetOptionalAttr(obj, state->ops, &tmp) < 0) {
14773
0
            return -1;
14774
0
        }
14775
0
        if (tmp == NULL) {
14776
0
            tmp = PyList_New(0);
14777
0
            if (tmp == NULL) {
14778
0
                return -1;
14779
0
            }
14780
0
        }
14781
0
        {
14782
0
            int res;
14783
0
            Py_ssize_t len;
14784
0
            Py_ssize_t i;
14785
0
            if (!PyList_Check(tmp)) {
14786
0
                PyErr_Format(PyExc_TypeError, "Compare field \"ops\" must be a list, not a %.200s", _PyType_Name(Py_TYPE(tmp)));
14787
0
                goto failed;
14788
0
            }
14789
0
            len = PyList_GET_SIZE(tmp);
14790
0
            ops = _Py_asdl_int_seq_new(len, arena);
14791
0
            if (ops == NULL) goto failed;
14792
0
            for (i = 0; i < len; i++) {
14793
0
                cmpop_ty val;
14794
0
                PyObject *tmp2 = Py_NewRef(PyList_GET_ITEM(tmp, i));
14795
0
                if (_Py_EnterRecursiveCall(" while traversing 'Compare' node")) {
14796
0
                    goto failed;
14797
0
                }
14798
0
                res = obj2ast_cmpop(state, tmp2, &val, arena);
14799
0
                _Py_LeaveRecursiveCall();
14800
0
                Py_DECREF(tmp2);
14801
0
                if (res != 0) goto failed;
14802
0
                if (len != PyList_GET_SIZE(tmp)) {
14803
0
                    PyErr_SetString(PyExc_RuntimeError, "Compare field \"ops\" changed size during iteration");
14804
0
                    goto failed;
14805
0
                }
14806
0
                asdl_seq_SET(ops, i, val);
14807
0
            }
14808
0
            Py_CLEAR(tmp);
14809
0
        }
14810
0
        if (PyObject_GetOptionalAttr(obj, state->comparators, &tmp) < 0) {
14811
0
            return -1;
14812
0
        }
14813
0
        if (tmp == NULL) {
14814
0
            tmp = PyList_New(0);
14815
0
            if (tmp == NULL) {
14816
0
                return -1;
14817
0
            }
14818
0
        }
14819
0
        {
14820
0
            int res;
14821
0
            Py_ssize_t len;
14822
0
            Py_ssize_t i;
14823
0
            if (!PyList_Check(tmp)) {
14824
0
                PyErr_Format(PyExc_TypeError, "Compare field \"comparators\" must be a list, not a %.200s", _PyType_Name(Py_TYPE(tmp)));
14825
0
                goto failed;
14826
0
            }
14827
0
            len = PyList_GET_SIZE(tmp);
14828
0
            comparators = _Py_asdl_expr_seq_new(len, arena);
14829
0
            if (comparators == NULL) goto failed;
14830
0
            for (i = 0; i < len; i++) {
14831
0
                expr_ty val;
14832
0
                PyObject *tmp2 = Py_NewRef(PyList_GET_ITEM(tmp, i));
14833
0
                if (_Py_EnterRecursiveCall(" while traversing 'Compare' node")) {
14834
0
                    goto failed;
14835
0
                }
14836
0
                res = obj2ast_expr(state, tmp2, &val, arena);
14837
0
                _Py_LeaveRecursiveCall();
14838
0
                Py_DECREF(tmp2);
14839
0
                if (res != 0) goto failed;
14840
0
                if (len != PyList_GET_SIZE(tmp)) {
14841
0
                    PyErr_SetString(PyExc_RuntimeError, "Compare field \"comparators\" changed size during iteration");
14842
0
                    goto failed;
14843
0
                }
14844
0
                asdl_seq_SET(comparators, i, val);
14845
0
            }
14846
0
            Py_CLEAR(tmp);
14847
0
        }
14848
0
        *out = _PyAST_Compare(left, ops, comparators, lineno, col_offset,
14849
0
                              end_lineno, end_col_offset, arena);
14850
0
        if (*out == NULL) goto failed;
14851
0
        return 0;
14852
0
    }
14853
0
    tp = state->Call_type;
14854
0
    isinstance = PyObject_IsInstance(obj, tp);
14855
0
    if (isinstance == -1) {
14856
0
        return -1;
14857
0
    }
14858
0
    if (isinstance) {
14859
0
        expr_ty func;
14860
0
        asdl_expr_seq* args;
14861
0
        asdl_keyword_seq* keywords;
14862
14863
0
        if (PyObject_GetOptionalAttr(obj, state->func, &tmp) < 0) {
14864
0
            return -1;
14865
0
        }
14866
0
        if (tmp == NULL) {
14867
0
            PyErr_SetString(PyExc_TypeError, "required field \"func\" missing from Call");
14868
0
            return -1;
14869
0
        }
14870
0
        else {
14871
0
            int res;
14872
0
            if (_Py_EnterRecursiveCall(" while traversing 'Call' node")) {
14873
0
                goto failed;
14874
0
            }
14875
0
            res = obj2ast_expr(state, tmp, &func, arena);
14876
0
            _Py_LeaveRecursiveCall();
14877
0
            if (res != 0) goto failed;
14878
0
            Py_CLEAR(tmp);
14879
0
        }
14880
0
        if (PyObject_GetOptionalAttr(obj, state->args, &tmp) < 0) {
14881
0
            return -1;
14882
0
        }
14883
0
        if (tmp == NULL) {
14884
0
            tmp = PyList_New(0);
14885
0
            if (tmp == NULL) {
14886
0
                return -1;
14887
0
            }
14888
0
        }
14889
0
        {
14890
0
            int res;
14891
0
            Py_ssize_t len;
14892
0
            Py_ssize_t i;
14893
0
            if (!PyList_Check(tmp)) {
14894
0
                PyErr_Format(PyExc_TypeError, "Call field \"args\" must be a list, not a %.200s", _PyType_Name(Py_TYPE(tmp)));
14895
0
                goto failed;
14896
0
            }
14897
0
            len = PyList_GET_SIZE(tmp);
14898
0
            args = _Py_asdl_expr_seq_new(len, arena);
14899
0
            if (args == NULL) goto failed;
14900
0
            for (i = 0; i < len; i++) {
14901
0
                expr_ty val;
14902
0
                PyObject *tmp2 = Py_NewRef(PyList_GET_ITEM(tmp, i));
14903
0
                if (_Py_EnterRecursiveCall(" while traversing 'Call' node")) {
14904
0
                    goto failed;
14905
0
                }
14906
0
                res = obj2ast_expr(state, tmp2, &val, arena);
14907
0
                _Py_LeaveRecursiveCall();
14908
0
                Py_DECREF(tmp2);
14909
0
                if (res != 0) goto failed;
14910
0
                if (len != PyList_GET_SIZE(tmp)) {
14911
0
                    PyErr_SetString(PyExc_RuntimeError, "Call field \"args\" changed size during iteration");
14912
0
                    goto failed;
14913
0
                }
14914
0
                asdl_seq_SET(args, i, val);
14915
0
            }
14916
0
            Py_CLEAR(tmp);
14917
0
        }
14918
0
        if (PyObject_GetOptionalAttr(obj, state->keywords, &tmp) < 0) {
14919
0
            return -1;
14920
0
        }
14921
0
        if (tmp == NULL) {
14922
0
            tmp = PyList_New(0);
14923
0
            if (tmp == NULL) {
14924
0
                return -1;
14925
0
            }
14926
0
        }
14927
0
        {
14928
0
            int res;
14929
0
            Py_ssize_t len;
14930
0
            Py_ssize_t i;
14931
0
            if (!PyList_Check(tmp)) {
14932
0
                PyErr_Format(PyExc_TypeError, "Call field \"keywords\" must be a list, not a %.200s", _PyType_Name(Py_TYPE(tmp)));
14933
0
                goto failed;
14934
0
            }
14935
0
            len = PyList_GET_SIZE(tmp);
14936
0
            keywords = _Py_asdl_keyword_seq_new(len, arena);
14937
0
            if (keywords == NULL) goto failed;
14938
0
            for (i = 0; i < len; i++) {
14939
0
                keyword_ty val;
14940
0
                PyObject *tmp2 = Py_NewRef(PyList_GET_ITEM(tmp, i));
14941
0
                if (_Py_EnterRecursiveCall(" while traversing 'Call' node")) {
14942
0
                    goto failed;
14943
0
                }
14944
0
                res = obj2ast_keyword(state, tmp2, &val, arena);
14945
0
                _Py_LeaveRecursiveCall();
14946
0
                Py_DECREF(tmp2);
14947
0
                if (res != 0) goto failed;
14948
0
                if (len != PyList_GET_SIZE(tmp)) {
14949
0
                    PyErr_SetString(PyExc_RuntimeError, "Call field \"keywords\" changed size during iteration");
14950
0
                    goto failed;
14951
0
                }
14952
0
                asdl_seq_SET(keywords, i, val);
14953
0
            }
14954
0
            Py_CLEAR(tmp);
14955
0
        }
14956
0
        *out = _PyAST_Call(func, args, keywords, lineno, col_offset,
14957
0
                           end_lineno, end_col_offset, arena);
14958
0
        if (*out == NULL) goto failed;
14959
0
        return 0;
14960
0
    }
14961
0
    tp = state->FormattedValue_type;
14962
0
    isinstance = PyObject_IsInstance(obj, tp);
14963
0
    if (isinstance == -1) {
14964
0
        return -1;
14965
0
    }
14966
0
    if (isinstance) {
14967
0
        expr_ty value;
14968
0
        int conversion;
14969
0
        expr_ty format_spec;
14970
14971
0
        if (PyObject_GetOptionalAttr(obj, state->value, &tmp) < 0) {
14972
0
            return -1;
14973
0
        }
14974
0
        if (tmp == NULL) {
14975
0
            PyErr_SetString(PyExc_TypeError, "required field \"value\" missing from FormattedValue");
14976
0
            return -1;
14977
0
        }
14978
0
        else {
14979
0
            int res;
14980
0
            if (_Py_EnterRecursiveCall(" while traversing 'FormattedValue' node")) {
14981
0
                goto failed;
14982
0
            }
14983
0
            res = obj2ast_expr(state, tmp, &value, arena);
14984
0
            _Py_LeaveRecursiveCall();
14985
0
            if (res != 0) goto failed;
14986
0
            Py_CLEAR(tmp);
14987
0
        }
14988
0
        if (PyObject_GetOptionalAttr(obj, state->conversion, &tmp) < 0) {
14989
0
            return -1;
14990
0
        }
14991
0
        if (tmp == NULL) {
14992
0
            PyErr_SetString(PyExc_TypeError, "required field \"conversion\" missing from FormattedValue");
14993
0
            return -1;
14994
0
        }
14995
0
        else {
14996
0
            int res;
14997
0
            if (_Py_EnterRecursiveCall(" while traversing 'FormattedValue' node")) {
14998
0
                goto failed;
14999
0
            }
15000
0
            res = obj2ast_int(state, tmp, &conversion, arena);
15001
0
            _Py_LeaveRecursiveCall();
15002
0
            if (res != 0) goto failed;
15003
0
            Py_CLEAR(tmp);
15004
0
        }
15005
0
        if (PyObject_GetOptionalAttr(obj, state->format_spec, &tmp) < 0) {
15006
0
            return -1;
15007
0
        }
15008
0
        if (tmp == NULL || tmp == Py_None) {
15009
0
            Py_CLEAR(tmp);
15010
0
            format_spec = NULL;
15011
0
        }
15012
0
        else {
15013
0
            int res;
15014
0
            if (_Py_EnterRecursiveCall(" while traversing 'FormattedValue' node")) {
15015
0
                goto failed;
15016
0
            }
15017
0
            res = obj2ast_expr(state, tmp, &format_spec, arena);
15018
0
            _Py_LeaveRecursiveCall();
15019
0
            if (res != 0) goto failed;
15020
0
            Py_CLEAR(tmp);
15021
0
        }
15022
0
        *out = _PyAST_FormattedValue(value, conversion, format_spec, lineno,
15023
0
                                     col_offset, end_lineno, end_col_offset,
15024
0
                                     arena);
15025
0
        if (*out == NULL) goto failed;
15026
0
        return 0;
15027
0
    }
15028
0
    tp = state->Interpolation_type;
15029
0
    isinstance = PyObject_IsInstance(obj, tp);
15030
0
    if (isinstance == -1) {
15031
0
        return -1;
15032
0
    }
15033
0
    if (isinstance) {
15034
0
        expr_ty value;
15035
0
        constant str;
15036
0
        int conversion;
15037
0
        expr_ty format_spec;
15038
15039
0
        if (PyObject_GetOptionalAttr(obj, state->value, &tmp) < 0) {
15040
0
            return -1;
15041
0
        }
15042
0
        if (tmp == NULL) {
15043
0
            PyErr_SetString(PyExc_TypeError, "required field \"value\" missing from Interpolation");
15044
0
            return -1;
15045
0
        }
15046
0
        else {
15047
0
            int res;
15048
0
            if (_Py_EnterRecursiveCall(" while traversing 'Interpolation' node")) {
15049
0
                goto failed;
15050
0
            }
15051
0
            res = obj2ast_expr(state, tmp, &value, arena);
15052
0
            _Py_LeaveRecursiveCall();
15053
0
            if (res != 0) goto failed;
15054
0
            Py_CLEAR(tmp);
15055
0
        }
15056
0
        if (PyObject_GetOptionalAttr(obj, state->str, &tmp) < 0) {
15057
0
            return -1;
15058
0
        }
15059
0
        if (tmp == NULL) {
15060
0
            PyErr_SetString(PyExc_TypeError, "required field \"str\" missing from Interpolation");
15061
0
            return -1;
15062
0
        }
15063
0
        else {
15064
0
            int res;
15065
0
            if (_Py_EnterRecursiveCall(" while traversing 'Interpolation' node")) {
15066
0
                goto failed;
15067
0
            }
15068
0
            res = obj2ast_constant(state, tmp, &str, arena);
15069
0
            _Py_LeaveRecursiveCall();
15070
0
            if (res != 0) goto failed;
15071
0
            Py_CLEAR(tmp);
15072
0
        }
15073
0
        if (PyObject_GetOptionalAttr(obj, state->conversion, &tmp) < 0) {
15074
0
            return -1;
15075
0
        }
15076
0
        if (tmp == NULL) {
15077
0
            PyErr_SetString(PyExc_TypeError, "required field \"conversion\" missing from Interpolation");
15078
0
            return -1;
15079
0
        }
15080
0
        else {
15081
0
            int res;
15082
0
            if (_Py_EnterRecursiveCall(" while traversing 'Interpolation' node")) {
15083
0
                goto failed;
15084
0
            }
15085
0
            res = obj2ast_int(state, tmp, &conversion, arena);
15086
0
            _Py_LeaveRecursiveCall();
15087
0
            if (res != 0) goto failed;
15088
0
            Py_CLEAR(tmp);
15089
0
        }
15090
0
        if (PyObject_GetOptionalAttr(obj, state->format_spec, &tmp) < 0) {
15091
0
            return -1;
15092
0
        }
15093
0
        if (tmp == NULL || tmp == Py_None) {
15094
0
            Py_CLEAR(tmp);
15095
0
            format_spec = NULL;
15096
0
        }
15097
0
        else {
15098
0
            int res;
15099
0
            if (_Py_EnterRecursiveCall(" while traversing 'Interpolation' node")) {
15100
0
                goto failed;
15101
0
            }
15102
0
            res = obj2ast_expr(state, tmp, &format_spec, arena);
15103
0
            _Py_LeaveRecursiveCall();
15104
0
            if (res != 0) goto failed;
15105
0
            Py_CLEAR(tmp);
15106
0
        }
15107
0
        *out = _PyAST_Interpolation(value, str, conversion, format_spec,
15108
0
                                    lineno, col_offset, end_lineno,
15109
0
                                    end_col_offset, arena);
15110
0
        if (*out == NULL) goto failed;
15111
0
        return 0;
15112
0
    }
15113
0
    tp = state->JoinedStr_type;
15114
0
    isinstance = PyObject_IsInstance(obj, tp);
15115
0
    if (isinstance == -1) {
15116
0
        return -1;
15117
0
    }
15118
0
    if (isinstance) {
15119
0
        asdl_expr_seq* values;
15120
15121
0
        if (PyObject_GetOptionalAttr(obj, state->values, &tmp) < 0) {
15122
0
            return -1;
15123
0
        }
15124
0
        if (tmp == NULL) {
15125
0
            tmp = PyList_New(0);
15126
0
            if (tmp == NULL) {
15127
0
                return -1;
15128
0
            }
15129
0
        }
15130
0
        {
15131
0
            int res;
15132
0
            Py_ssize_t len;
15133
0
            Py_ssize_t i;
15134
0
            if (!PyList_Check(tmp)) {
15135
0
                PyErr_Format(PyExc_TypeError, "JoinedStr field \"values\" must be a list, not a %.200s", _PyType_Name(Py_TYPE(tmp)));
15136
0
                goto failed;
15137
0
            }
15138
0
            len = PyList_GET_SIZE(tmp);
15139
0
            values = _Py_asdl_expr_seq_new(len, arena);
15140
0
            if (values == NULL) goto failed;
15141
0
            for (i = 0; i < len; i++) {
15142
0
                expr_ty val;
15143
0
                PyObject *tmp2 = Py_NewRef(PyList_GET_ITEM(tmp, i));
15144
0
                if (_Py_EnterRecursiveCall(" while traversing 'JoinedStr' node")) {
15145
0
                    goto failed;
15146
0
                }
15147
0
                res = obj2ast_expr(state, tmp2, &val, arena);
15148
0
                _Py_LeaveRecursiveCall();
15149
0
                Py_DECREF(tmp2);
15150
0
                if (res != 0) goto failed;
15151
0
                if (len != PyList_GET_SIZE(tmp)) {
15152
0
                    PyErr_SetString(PyExc_RuntimeError, "JoinedStr field \"values\" changed size during iteration");
15153
0
                    goto failed;
15154
0
                }
15155
0
                asdl_seq_SET(values, i, val);
15156
0
            }
15157
0
            Py_CLEAR(tmp);
15158
0
        }
15159
0
        *out = _PyAST_JoinedStr(values, lineno, col_offset, end_lineno,
15160
0
                                end_col_offset, arena);
15161
0
        if (*out == NULL) goto failed;
15162
0
        return 0;
15163
0
    }
15164
0
    tp = state->TemplateStr_type;
15165
0
    isinstance = PyObject_IsInstance(obj, tp);
15166
0
    if (isinstance == -1) {
15167
0
        return -1;
15168
0
    }
15169
0
    if (isinstance) {
15170
0
        asdl_expr_seq* values;
15171
15172
0
        if (PyObject_GetOptionalAttr(obj, state->values, &tmp) < 0) {
15173
0
            return -1;
15174
0
        }
15175
0
        if (tmp == NULL) {
15176
0
            tmp = PyList_New(0);
15177
0
            if (tmp == NULL) {
15178
0
                return -1;
15179
0
            }
15180
0
        }
15181
0
        {
15182
0
            int res;
15183
0
            Py_ssize_t len;
15184
0
            Py_ssize_t i;
15185
0
            if (!PyList_Check(tmp)) {
15186
0
                PyErr_Format(PyExc_TypeError, "TemplateStr field \"values\" must be a list, not a %.200s", _PyType_Name(Py_TYPE(tmp)));
15187
0
                goto failed;
15188
0
            }
15189
0
            len = PyList_GET_SIZE(tmp);
15190
0
            values = _Py_asdl_expr_seq_new(len, arena);
15191
0
            if (values == NULL) goto failed;
15192
0
            for (i = 0; i < len; i++) {
15193
0
                expr_ty val;
15194
0
                PyObject *tmp2 = Py_NewRef(PyList_GET_ITEM(tmp, i));
15195
0
                if (_Py_EnterRecursiveCall(" while traversing 'TemplateStr' node")) {
15196
0
                    goto failed;
15197
0
                }
15198
0
                res = obj2ast_expr(state, tmp2, &val, arena);
15199
0
                _Py_LeaveRecursiveCall();
15200
0
                Py_DECREF(tmp2);
15201
0
                if (res != 0) goto failed;
15202
0
                if (len != PyList_GET_SIZE(tmp)) {
15203
0
                    PyErr_SetString(PyExc_RuntimeError, "TemplateStr field \"values\" changed size during iteration");
15204
0
                    goto failed;
15205
0
                }
15206
0
                asdl_seq_SET(values, i, val);
15207
0
            }
15208
0
            Py_CLEAR(tmp);
15209
0
        }
15210
0
        *out = _PyAST_TemplateStr(values, lineno, col_offset, end_lineno,
15211
0
                                  end_col_offset, arena);
15212
0
        if (*out == NULL) goto failed;
15213
0
        return 0;
15214
0
    }
15215
0
    tp = state->Constant_type;
15216
0
    isinstance = PyObject_IsInstance(obj, tp);
15217
0
    if (isinstance == -1) {
15218
0
        return -1;
15219
0
    }
15220
0
    if (isinstance) {
15221
0
        constant value;
15222
0
        string kind;
15223
15224
0
        if (PyObject_GetOptionalAttr(obj, state->value, &tmp) < 0) {
15225
0
            return -1;
15226
0
        }
15227
0
        if (tmp == NULL) {
15228
0
            PyErr_SetString(PyExc_TypeError, "required field \"value\" missing from Constant");
15229
0
            return -1;
15230
0
        }
15231
0
        else {
15232
0
            int res;
15233
0
            if (_Py_EnterRecursiveCall(" while traversing 'Constant' node")) {
15234
0
                goto failed;
15235
0
            }
15236
0
            res = obj2ast_constant(state, tmp, &value, arena);
15237
0
            _Py_LeaveRecursiveCall();
15238
0
            if (res != 0) goto failed;
15239
0
            Py_CLEAR(tmp);
15240
0
        }
15241
0
        if (PyObject_GetOptionalAttr(obj, state->kind, &tmp) < 0) {
15242
0
            return -1;
15243
0
        }
15244
0
        if (tmp == NULL || tmp == Py_None) {
15245
0
            Py_CLEAR(tmp);
15246
0
            kind = NULL;
15247
0
        }
15248
0
        else {
15249
0
            int res;
15250
0
            if (_Py_EnterRecursiveCall(" while traversing 'Constant' node")) {
15251
0
                goto failed;
15252
0
            }
15253
0
            res = obj2ast_string(state, tmp, &kind, arena);
15254
0
            _Py_LeaveRecursiveCall();
15255
0
            if (res != 0) goto failed;
15256
0
            Py_CLEAR(tmp);
15257
0
        }
15258
0
        *out = _PyAST_Constant(value, kind, lineno, col_offset, end_lineno,
15259
0
                               end_col_offset, arena);
15260
0
        if (*out == NULL) goto failed;
15261
0
        return 0;
15262
0
    }
15263
0
    tp = state->Attribute_type;
15264
0
    isinstance = PyObject_IsInstance(obj, tp);
15265
0
    if (isinstance == -1) {
15266
0
        return -1;
15267
0
    }
15268
0
    if (isinstance) {
15269
0
        expr_ty value;
15270
0
        identifier attr;
15271
0
        expr_context_ty ctx;
15272
15273
0
        if (PyObject_GetOptionalAttr(obj, state->value, &tmp) < 0) {
15274
0
            return -1;
15275
0
        }
15276
0
        if (tmp == NULL) {
15277
0
            PyErr_SetString(PyExc_TypeError, "required field \"value\" missing from Attribute");
15278
0
            return -1;
15279
0
        }
15280
0
        else {
15281
0
            int res;
15282
0
            if (_Py_EnterRecursiveCall(" while traversing 'Attribute' node")) {
15283
0
                goto failed;
15284
0
            }
15285
0
            res = obj2ast_expr(state, tmp, &value, arena);
15286
0
            _Py_LeaveRecursiveCall();
15287
0
            if (res != 0) goto failed;
15288
0
            Py_CLEAR(tmp);
15289
0
        }
15290
0
        if (PyObject_GetOptionalAttr(obj, state->attr, &tmp) < 0) {
15291
0
            return -1;
15292
0
        }
15293
0
        if (tmp == NULL) {
15294
0
            PyErr_SetString(PyExc_TypeError, "required field \"attr\" missing from Attribute");
15295
0
            return -1;
15296
0
        }
15297
0
        else {
15298
0
            int res;
15299
0
            if (_Py_EnterRecursiveCall(" while traversing 'Attribute' node")) {
15300
0
                goto failed;
15301
0
            }
15302
0
            res = obj2ast_identifier(state, tmp, &attr, arena);
15303
0
            _Py_LeaveRecursiveCall();
15304
0
            if (res != 0) goto failed;
15305
0
            Py_CLEAR(tmp);
15306
0
        }
15307
0
        if (PyObject_GetOptionalAttr(obj, state->ctx, &tmp) < 0) {
15308
0
            return -1;
15309
0
        }
15310
0
        if (tmp == NULL) {
15311
0
            PyErr_SetString(PyExc_TypeError, "required field \"ctx\" missing from Attribute");
15312
0
            return -1;
15313
0
        }
15314
0
        else {
15315
0
            int res;
15316
0
            if (_Py_EnterRecursiveCall(" while traversing 'Attribute' node")) {
15317
0
                goto failed;
15318
0
            }
15319
0
            res = obj2ast_expr_context(state, tmp, &ctx, arena);
15320
0
            _Py_LeaveRecursiveCall();
15321
0
            if (res != 0) goto failed;
15322
0
            Py_CLEAR(tmp);
15323
0
        }
15324
0
        *out = _PyAST_Attribute(value, attr, ctx, lineno, col_offset,
15325
0
                                end_lineno, end_col_offset, arena);
15326
0
        if (*out == NULL) goto failed;
15327
0
        return 0;
15328
0
    }
15329
0
    tp = state->Subscript_type;
15330
0
    isinstance = PyObject_IsInstance(obj, tp);
15331
0
    if (isinstance == -1) {
15332
0
        return -1;
15333
0
    }
15334
0
    if (isinstance) {
15335
0
        expr_ty value;
15336
0
        expr_ty slice;
15337
0
        expr_context_ty ctx;
15338
15339
0
        if (PyObject_GetOptionalAttr(obj, state->value, &tmp) < 0) {
15340
0
            return -1;
15341
0
        }
15342
0
        if (tmp == NULL) {
15343
0
            PyErr_SetString(PyExc_TypeError, "required field \"value\" missing from Subscript");
15344
0
            return -1;
15345
0
        }
15346
0
        else {
15347
0
            int res;
15348
0
            if (_Py_EnterRecursiveCall(" while traversing 'Subscript' node")) {
15349
0
                goto failed;
15350
0
            }
15351
0
            res = obj2ast_expr(state, tmp, &value, arena);
15352
0
            _Py_LeaveRecursiveCall();
15353
0
            if (res != 0) goto failed;
15354
0
            Py_CLEAR(tmp);
15355
0
        }
15356
0
        if (PyObject_GetOptionalAttr(obj, state->slice, &tmp) < 0) {
15357
0
            return -1;
15358
0
        }
15359
0
        if (tmp == NULL) {
15360
0
            PyErr_SetString(PyExc_TypeError, "required field \"slice\" missing from Subscript");
15361
0
            return -1;
15362
0
        }
15363
0
        else {
15364
0
            int res;
15365
0
            if (_Py_EnterRecursiveCall(" while traversing 'Subscript' node")) {
15366
0
                goto failed;
15367
0
            }
15368
0
            res = obj2ast_expr(state, tmp, &slice, arena);
15369
0
            _Py_LeaveRecursiveCall();
15370
0
            if (res != 0) goto failed;
15371
0
            Py_CLEAR(tmp);
15372
0
        }
15373
0
        if (PyObject_GetOptionalAttr(obj, state->ctx, &tmp) < 0) {
15374
0
            return -1;
15375
0
        }
15376
0
        if (tmp == NULL) {
15377
0
            PyErr_SetString(PyExc_TypeError, "required field \"ctx\" missing from Subscript");
15378
0
            return -1;
15379
0
        }
15380
0
        else {
15381
0
            int res;
15382
0
            if (_Py_EnterRecursiveCall(" while traversing 'Subscript' node")) {
15383
0
                goto failed;
15384
0
            }
15385
0
            res = obj2ast_expr_context(state, tmp, &ctx, arena);
15386
0
            _Py_LeaveRecursiveCall();
15387
0
            if (res != 0) goto failed;
15388
0
            Py_CLEAR(tmp);
15389
0
        }
15390
0
        *out = _PyAST_Subscript(value, slice, ctx, lineno, col_offset,
15391
0
                                end_lineno, end_col_offset, arena);
15392
0
        if (*out == NULL) goto failed;
15393
0
        return 0;
15394
0
    }
15395
0
    tp = state->Starred_type;
15396
0
    isinstance = PyObject_IsInstance(obj, tp);
15397
0
    if (isinstance == -1) {
15398
0
        return -1;
15399
0
    }
15400
0
    if (isinstance) {
15401
0
        expr_ty value;
15402
0
        expr_context_ty ctx;
15403
15404
0
        if (PyObject_GetOptionalAttr(obj, state->value, &tmp) < 0) {
15405
0
            return -1;
15406
0
        }
15407
0
        if (tmp == NULL) {
15408
0
            PyErr_SetString(PyExc_TypeError, "required field \"value\" missing from Starred");
15409
0
            return -1;
15410
0
        }
15411
0
        else {
15412
0
            int res;
15413
0
            if (_Py_EnterRecursiveCall(" while traversing 'Starred' node")) {
15414
0
                goto failed;
15415
0
            }
15416
0
            res = obj2ast_expr(state, tmp, &value, arena);
15417
0
            _Py_LeaveRecursiveCall();
15418
0
            if (res != 0) goto failed;
15419
0
            Py_CLEAR(tmp);
15420
0
        }
15421
0
        if (PyObject_GetOptionalAttr(obj, state->ctx, &tmp) < 0) {
15422
0
            return -1;
15423
0
        }
15424
0
        if (tmp == NULL) {
15425
0
            PyErr_SetString(PyExc_TypeError, "required field \"ctx\" missing from Starred");
15426
0
            return -1;
15427
0
        }
15428
0
        else {
15429
0
            int res;
15430
0
            if (_Py_EnterRecursiveCall(" while traversing 'Starred' node")) {
15431
0
                goto failed;
15432
0
            }
15433
0
            res = obj2ast_expr_context(state, tmp, &ctx, arena);
15434
0
            _Py_LeaveRecursiveCall();
15435
0
            if (res != 0) goto failed;
15436
0
            Py_CLEAR(tmp);
15437
0
        }
15438
0
        *out = _PyAST_Starred(value, ctx, lineno, col_offset, end_lineno,
15439
0
                              end_col_offset, arena);
15440
0
        if (*out == NULL) goto failed;
15441
0
        return 0;
15442
0
    }
15443
0
    tp = state->Name_type;
15444
0
    isinstance = PyObject_IsInstance(obj, tp);
15445
0
    if (isinstance == -1) {
15446
0
        return -1;
15447
0
    }
15448
0
    if (isinstance) {
15449
0
        identifier id;
15450
0
        expr_context_ty ctx;
15451
15452
0
        if (PyObject_GetOptionalAttr(obj, state->id, &tmp) < 0) {
15453
0
            return -1;
15454
0
        }
15455
0
        if (tmp == NULL) {
15456
0
            PyErr_SetString(PyExc_TypeError, "required field \"id\" missing from Name");
15457
0
            return -1;
15458
0
        }
15459
0
        else {
15460
0
            int res;
15461
0
            if (_Py_EnterRecursiveCall(" while traversing 'Name' node")) {
15462
0
                goto failed;
15463
0
            }
15464
0
            res = obj2ast_identifier(state, tmp, &id, arena);
15465
0
            _Py_LeaveRecursiveCall();
15466
0
            if (res != 0) goto failed;
15467
0
            Py_CLEAR(tmp);
15468
0
        }
15469
0
        if (PyObject_GetOptionalAttr(obj, state->ctx, &tmp) < 0) {
15470
0
            return -1;
15471
0
        }
15472
0
        if (tmp == NULL) {
15473
0
            PyErr_SetString(PyExc_TypeError, "required field \"ctx\" missing from Name");
15474
0
            return -1;
15475
0
        }
15476
0
        else {
15477
0
            int res;
15478
0
            if (_Py_EnterRecursiveCall(" while traversing 'Name' node")) {
15479
0
                goto failed;
15480
0
            }
15481
0
            res = obj2ast_expr_context(state, tmp, &ctx, arena);
15482
0
            _Py_LeaveRecursiveCall();
15483
0
            if (res != 0) goto failed;
15484
0
            Py_CLEAR(tmp);
15485
0
        }
15486
0
        *out = _PyAST_Name(id, ctx, lineno, col_offset, end_lineno,
15487
0
                           end_col_offset, arena);
15488
0
        if (*out == NULL) goto failed;
15489
0
        return 0;
15490
0
    }
15491
0
    tp = state->List_type;
15492
0
    isinstance = PyObject_IsInstance(obj, tp);
15493
0
    if (isinstance == -1) {
15494
0
        return -1;
15495
0
    }
15496
0
    if (isinstance) {
15497
0
        asdl_expr_seq* elts;
15498
0
        expr_context_ty ctx;
15499
15500
0
        if (PyObject_GetOptionalAttr(obj, state->elts, &tmp) < 0) {
15501
0
            return -1;
15502
0
        }
15503
0
        if (tmp == NULL) {
15504
0
            tmp = PyList_New(0);
15505
0
            if (tmp == NULL) {
15506
0
                return -1;
15507
0
            }
15508
0
        }
15509
0
        {
15510
0
            int res;
15511
0
            Py_ssize_t len;
15512
0
            Py_ssize_t i;
15513
0
            if (!PyList_Check(tmp)) {
15514
0
                PyErr_Format(PyExc_TypeError, "List field \"elts\" must be a list, not a %.200s", _PyType_Name(Py_TYPE(tmp)));
15515
0
                goto failed;
15516
0
            }
15517
0
            len = PyList_GET_SIZE(tmp);
15518
0
            elts = _Py_asdl_expr_seq_new(len, arena);
15519
0
            if (elts == NULL) goto failed;
15520
0
            for (i = 0; i < len; i++) {
15521
0
                expr_ty val;
15522
0
                PyObject *tmp2 = Py_NewRef(PyList_GET_ITEM(tmp, i));
15523
0
                if (_Py_EnterRecursiveCall(" while traversing 'List' node")) {
15524
0
                    goto failed;
15525
0
                }
15526
0
                res = obj2ast_expr(state, tmp2, &val, arena);
15527
0
                _Py_LeaveRecursiveCall();
15528
0
                Py_DECREF(tmp2);
15529
0
                if (res != 0) goto failed;
15530
0
                if (len != PyList_GET_SIZE(tmp)) {
15531
0
                    PyErr_SetString(PyExc_RuntimeError, "List field \"elts\" changed size during iteration");
15532
0
                    goto failed;
15533
0
                }
15534
0
                asdl_seq_SET(elts, i, val);
15535
0
            }
15536
0
            Py_CLEAR(tmp);
15537
0
        }
15538
0
        if (PyObject_GetOptionalAttr(obj, state->ctx, &tmp) < 0) {
15539
0
            return -1;
15540
0
        }
15541
0
        if (tmp == NULL) {
15542
0
            PyErr_SetString(PyExc_TypeError, "required field \"ctx\" missing from List");
15543
0
            return -1;
15544
0
        }
15545
0
        else {
15546
0
            int res;
15547
0
            if (_Py_EnterRecursiveCall(" while traversing 'List' node")) {
15548
0
                goto failed;
15549
0
            }
15550
0
            res = obj2ast_expr_context(state, tmp, &ctx, arena);
15551
0
            _Py_LeaveRecursiveCall();
15552
0
            if (res != 0) goto failed;
15553
0
            Py_CLEAR(tmp);
15554
0
        }
15555
0
        *out = _PyAST_List(elts, ctx, lineno, col_offset, end_lineno,
15556
0
                           end_col_offset, arena);
15557
0
        if (*out == NULL) goto failed;
15558
0
        return 0;
15559
0
    }
15560
0
    tp = state->Tuple_type;
15561
0
    isinstance = PyObject_IsInstance(obj, tp);
15562
0
    if (isinstance == -1) {
15563
0
        return -1;
15564
0
    }
15565
0
    if (isinstance) {
15566
0
        asdl_expr_seq* elts;
15567
0
        expr_context_ty ctx;
15568
15569
0
        if (PyObject_GetOptionalAttr(obj, state->elts, &tmp) < 0) {
15570
0
            return -1;
15571
0
        }
15572
0
        if (tmp == NULL) {
15573
0
            tmp = PyList_New(0);
15574
0
            if (tmp == NULL) {
15575
0
                return -1;
15576
0
            }
15577
0
        }
15578
0
        {
15579
0
            int res;
15580
0
            Py_ssize_t len;
15581
0
            Py_ssize_t i;
15582
0
            if (!PyList_Check(tmp)) {
15583
0
                PyErr_Format(PyExc_TypeError, "Tuple field \"elts\" must be a list, not a %.200s", _PyType_Name(Py_TYPE(tmp)));
15584
0
                goto failed;
15585
0
            }
15586
0
            len = PyList_GET_SIZE(tmp);
15587
0
            elts = _Py_asdl_expr_seq_new(len, arena);
15588
0
            if (elts == NULL) goto failed;
15589
0
            for (i = 0; i < len; i++) {
15590
0
                expr_ty val;
15591
0
                PyObject *tmp2 = Py_NewRef(PyList_GET_ITEM(tmp, i));
15592
0
                if (_Py_EnterRecursiveCall(" while traversing 'Tuple' node")) {
15593
0
                    goto failed;
15594
0
                }
15595
0
                res = obj2ast_expr(state, tmp2, &val, arena);
15596
0
                _Py_LeaveRecursiveCall();
15597
0
                Py_DECREF(tmp2);
15598
0
                if (res != 0) goto failed;
15599
0
                if (len != PyList_GET_SIZE(tmp)) {
15600
0
                    PyErr_SetString(PyExc_RuntimeError, "Tuple field \"elts\" changed size during iteration");
15601
0
                    goto failed;
15602
0
                }
15603
0
                asdl_seq_SET(elts, i, val);
15604
0
            }
15605
0
            Py_CLEAR(tmp);
15606
0
        }
15607
0
        if (PyObject_GetOptionalAttr(obj, state->ctx, &tmp) < 0) {
15608
0
            return -1;
15609
0
        }
15610
0
        if (tmp == NULL) {
15611
0
            PyErr_SetString(PyExc_TypeError, "required field \"ctx\" missing from Tuple");
15612
0
            return -1;
15613
0
        }
15614
0
        else {
15615
0
            int res;
15616
0
            if (_Py_EnterRecursiveCall(" while traversing 'Tuple' node")) {
15617
0
                goto failed;
15618
0
            }
15619
0
            res = obj2ast_expr_context(state, tmp, &ctx, arena);
15620
0
            _Py_LeaveRecursiveCall();
15621
0
            if (res != 0) goto failed;
15622
0
            Py_CLEAR(tmp);
15623
0
        }
15624
0
        *out = _PyAST_Tuple(elts, ctx, lineno, col_offset, end_lineno,
15625
0
                            end_col_offset, arena);
15626
0
        if (*out == NULL) goto failed;
15627
0
        return 0;
15628
0
    }
15629
0
    tp = state->Slice_type;
15630
0
    isinstance = PyObject_IsInstance(obj, tp);
15631
0
    if (isinstance == -1) {
15632
0
        return -1;
15633
0
    }
15634
0
    if (isinstance) {
15635
0
        expr_ty lower;
15636
0
        expr_ty upper;
15637
0
        expr_ty step;
15638
15639
0
        if (PyObject_GetOptionalAttr(obj, state->lower, &tmp) < 0) {
15640
0
            return -1;
15641
0
        }
15642
0
        if (tmp == NULL || tmp == Py_None) {
15643
0
            Py_CLEAR(tmp);
15644
0
            lower = NULL;
15645
0
        }
15646
0
        else {
15647
0
            int res;
15648
0
            if (_Py_EnterRecursiveCall(" while traversing 'Slice' node")) {
15649
0
                goto failed;
15650
0
            }
15651
0
            res = obj2ast_expr(state, tmp, &lower, arena);
15652
0
            _Py_LeaveRecursiveCall();
15653
0
            if (res != 0) goto failed;
15654
0
            Py_CLEAR(tmp);
15655
0
        }
15656
0
        if (PyObject_GetOptionalAttr(obj, state->upper, &tmp) < 0) {
15657
0
            return -1;
15658
0
        }
15659
0
        if (tmp == NULL || tmp == Py_None) {
15660
0
            Py_CLEAR(tmp);
15661
0
            upper = NULL;
15662
0
        }
15663
0
        else {
15664
0
            int res;
15665
0
            if (_Py_EnterRecursiveCall(" while traversing 'Slice' node")) {
15666
0
                goto failed;
15667
0
            }
15668
0
            res = obj2ast_expr(state, tmp, &upper, arena);
15669
0
            _Py_LeaveRecursiveCall();
15670
0
            if (res != 0) goto failed;
15671
0
            Py_CLEAR(tmp);
15672
0
        }
15673
0
        if (PyObject_GetOptionalAttr(obj, state->step, &tmp) < 0) {
15674
0
            return -1;
15675
0
        }
15676
0
        if (tmp == NULL || tmp == Py_None) {
15677
0
            Py_CLEAR(tmp);
15678
0
            step = NULL;
15679
0
        }
15680
0
        else {
15681
0
            int res;
15682
0
            if (_Py_EnterRecursiveCall(" while traversing 'Slice' node")) {
15683
0
                goto failed;
15684
0
            }
15685
0
            res = obj2ast_expr(state, tmp, &step, arena);
15686
0
            _Py_LeaveRecursiveCall();
15687
0
            if (res != 0) goto failed;
15688
0
            Py_CLEAR(tmp);
15689
0
        }
15690
0
        *out = _PyAST_Slice(lower, upper, step, lineno, col_offset, end_lineno,
15691
0
                            end_col_offset, arena);
15692
0
        if (*out == NULL) goto failed;
15693
0
        return 0;
15694
0
    }
15695
15696
0
    PyErr_Format(PyExc_TypeError, "expected some sort of expr, but got %R", obj);
15697
0
    failed:
15698
0
    Py_XDECREF(tmp);
15699
0
    return -1;
15700
0
}
15701
15702
int
15703
obj2ast_expr_context(struct ast_state *state, PyObject* obj, expr_context_ty*
15704
                     out, PyArena* arena)
15705
0
{
15706
0
    int isinstance;
15707
15708
0
    isinstance = PyObject_IsInstance(obj, state->Load_type);
15709
0
    if (isinstance == -1) {
15710
0
        return -1;
15711
0
    }
15712
0
    if (isinstance) {
15713
0
        *out = Load;
15714
0
        return 0;
15715
0
    }
15716
0
    isinstance = PyObject_IsInstance(obj, state->Store_type);
15717
0
    if (isinstance == -1) {
15718
0
        return -1;
15719
0
    }
15720
0
    if (isinstance) {
15721
0
        *out = Store;
15722
0
        return 0;
15723
0
    }
15724
0
    isinstance = PyObject_IsInstance(obj, state->Del_type);
15725
0
    if (isinstance == -1) {
15726
0
        return -1;
15727
0
    }
15728
0
    if (isinstance) {
15729
0
        *out = Del;
15730
0
        return 0;
15731
0
    }
15732
15733
0
    PyErr_Format(PyExc_TypeError, "expected some sort of expr_context, but got %R", obj);
15734
0
    return -1;
15735
0
}
15736
15737
int
15738
obj2ast_boolop(struct ast_state *state, PyObject* obj, boolop_ty* out, PyArena*
15739
               arena)
15740
0
{
15741
0
    int isinstance;
15742
15743
0
    isinstance = PyObject_IsInstance(obj, state->And_type);
15744
0
    if (isinstance == -1) {
15745
0
        return -1;
15746
0
    }
15747
0
    if (isinstance) {
15748
0
        *out = And;
15749
0
        return 0;
15750
0
    }
15751
0
    isinstance = PyObject_IsInstance(obj, state->Or_type);
15752
0
    if (isinstance == -1) {
15753
0
        return -1;
15754
0
    }
15755
0
    if (isinstance) {
15756
0
        *out = Or;
15757
0
        return 0;
15758
0
    }
15759
15760
0
    PyErr_Format(PyExc_TypeError, "expected some sort of boolop, but got %R", obj);
15761
0
    return -1;
15762
0
}
15763
15764
int
15765
obj2ast_operator(struct ast_state *state, PyObject* obj, operator_ty* out,
15766
                 PyArena* arena)
15767
0
{
15768
0
    int isinstance;
15769
15770
0
    isinstance = PyObject_IsInstance(obj, state->Add_type);
15771
0
    if (isinstance == -1) {
15772
0
        return -1;
15773
0
    }
15774
0
    if (isinstance) {
15775
0
        *out = Add;
15776
0
        return 0;
15777
0
    }
15778
0
    isinstance = PyObject_IsInstance(obj, state->Sub_type);
15779
0
    if (isinstance == -1) {
15780
0
        return -1;
15781
0
    }
15782
0
    if (isinstance) {
15783
0
        *out = Sub;
15784
0
        return 0;
15785
0
    }
15786
0
    isinstance = PyObject_IsInstance(obj, state->Mult_type);
15787
0
    if (isinstance == -1) {
15788
0
        return -1;
15789
0
    }
15790
0
    if (isinstance) {
15791
0
        *out = Mult;
15792
0
        return 0;
15793
0
    }
15794
0
    isinstance = PyObject_IsInstance(obj, state->MatMult_type);
15795
0
    if (isinstance == -1) {
15796
0
        return -1;
15797
0
    }
15798
0
    if (isinstance) {
15799
0
        *out = MatMult;
15800
0
        return 0;
15801
0
    }
15802
0
    isinstance = PyObject_IsInstance(obj, state->Div_type);
15803
0
    if (isinstance == -1) {
15804
0
        return -1;
15805
0
    }
15806
0
    if (isinstance) {
15807
0
        *out = Div;
15808
0
        return 0;
15809
0
    }
15810
0
    isinstance = PyObject_IsInstance(obj, state->Mod_type);
15811
0
    if (isinstance == -1) {
15812
0
        return -1;
15813
0
    }
15814
0
    if (isinstance) {
15815
0
        *out = Mod;
15816
0
        return 0;
15817
0
    }
15818
0
    isinstance = PyObject_IsInstance(obj, state->Pow_type);
15819
0
    if (isinstance == -1) {
15820
0
        return -1;
15821
0
    }
15822
0
    if (isinstance) {
15823
0
        *out = Pow;
15824
0
        return 0;
15825
0
    }
15826
0
    isinstance = PyObject_IsInstance(obj, state->LShift_type);
15827
0
    if (isinstance == -1) {
15828
0
        return -1;
15829
0
    }
15830
0
    if (isinstance) {
15831
0
        *out = LShift;
15832
0
        return 0;
15833
0
    }
15834
0
    isinstance = PyObject_IsInstance(obj, state->RShift_type);
15835
0
    if (isinstance == -1) {
15836
0
        return -1;
15837
0
    }
15838
0
    if (isinstance) {
15839
0
        *out = RShift;
15840
0
        return 0;
15841
0
    }
15842
0
    isinstance = PyObject_IsInstance(obj, state->BitOr_type);
15843
0
    if (isinstance == -1) {
15844
0
        return -1;
15845
0
    }
15846
0
    if (isinstance) {
15847
0
        *out = BitOr;
15848
0
        return 0;
15849
0
    }
15850
0
    isinstance = PyObject_IsInstance(obj, state->BitXor_type);
15851
0
    if (isinstance == -1) {
15852
0
        return -1;
15853
0
    }
15854
0
    if (isinstance) {
15855
0
        *out = BitXor;
15856
0
        return 0;
15857
0
    }
15858
0
    isinstance = PyObject_IsInstance(obj, state->BitAnd_type);
15859
0
    if (isinstance == -1) {
15860
0
        return -1;
15861
0
    }
15862
0
    if (isinstance) {
15863
0
        *out = BitAnd;
15864
0
        return 0;
15865
0
    }
15866
0
    isinstance = PyObject_IsInstance(obj, state->FloorDiv_type);
15867
0
    if (isinstance == -1) {
15868
0
        return -1;
15869
0
    }
15870
0
    if (isinstance) {
15871
0
        *out = FloorDiv;
15872
0
        return 0;
15873
0
    }
15874
15875
0
    PyErr_Format(PyExc_TypeError, "expected some sort of operator, but got %R", obj);
15876
0
    return -1;
15877
0
}
15878
15879
int
15880
obj2ast_unaryop(struct ast_state *state, PyObject* obj, unaryop_ty* out,
15881
                PyArena* arena)
15882
0
{
15883
0
    int isinstance;
15884
15885
0
    isinstance = PyObject_IsInstance(obj, state->Invert_type);
15886
0
    if (isinstance == -1) {
15887
0
        return -1;
15888
0
    }
15889
0
    if (isinstance) {
15890
0
        *out = Invert;
15891
0
        return 0;
15892
0
    }
15893
0
    isinstance = PyObject_IsInstance(obj, state->Not_type);
15894
0
    if (isinstance == -1) {
15895
0
        return -1;
15896
0
    }
15897
0
    if (isinstance) {
15898
0
        *out = Not;
15899
0
        return 0;
15900
0
    }
15901
0
    isinstance = PyObject_IsInstance(obj, state->UAdd_type);
15902
0
    if (isinstance == -1) {
15903
0
        return -1;
15904
0
    }
15905
0
    if (isinstance) {
15906
0
        *out = UAdd;
15907
0
        return 0;
15908
0
    }
15909
0
    isinstance = PyObject_IsInstance(obj, state->USub_type);
15910
0
    if (isinstance == -1) {
15911
0
        return -1;
15912
0
    }
15913
0
    if (isinstance) {
15914
0
        *out = USub;
15915
0
        return 0;
15916
0
    }
15917
15918
0
    PyErr_Format(PyExc_TypeError, "expected some sort of unaryop, but got %R", obj);
15919
0
    return -1;
15920
0
}
15921
15922
int
15923
obj2ast_cmpop(struct ast_state *state, PyObject* obj, cmpop_ty* out, PyArena*
15924
              arena)
15925
0
{
15926
0
    int isinstance;
15927
15928
0
    isinstance = PyObject_IsInstance(obj, state->Eq_type);
15929
0
    if (isinstance == -1) {
15930
0
        return -1;
15931
0
    }
15932
0
    if (isinstance) {
15933
0
        *out = Eq;
15934
0
        return 0;
15935
0
    }
15936
0
    isinstance = PyObject_IsInstance(obj, state->NotEq_type);
15937
0
    if (isinstance == -1) {
15938
0
        return -1;
15939
0
    }
15940
0
    if (isinstance) {
15941
0
        *out = NotEq;
15942
0
        return 0;
15943
0
    }
15944
0
    isinstance = PyObject_IsInstance(obj, state->Lt_type);
15945
0
    if (isinstance == -1) {
15946
0
        return -1;
15947
0
    }
15948
0
    if (isinstance) {
15949
0
        *out = Lt;
15950
0
        return 0;
15951
0
    }
15952
0
    isinstance = PyObject_IsInstance(obj, state->LtE_type);
15953
0
    if (isinstance == -1) {
15954
0
        return -1;
15955
0
    }
15956
0
    if (isinstance) {
15957
0
        *out = LtE;
15958
0
        return 0;
15959
0
    }
15960
0
    isinstance = PyObject_IsInstance(obj, state->Gt_type);
15961
0
    if (isinstance == -1) {
15962
0
        return -1;
15963
0
    }
15964
0
    if (isinstance) {
15965
0
        *out = Gt;
15966
0
        return 0;
15967
0
    }
15968
0
    isinstance = PyObject_IsInstance(obj, state->GtE_type);
15969
0
    if (isinstance == -1) {
15970
0
        return -1;
15971
0
    }
15972
0
    if (isinstance) {
15973
0
        *out = GtE;
15974
0
        return 0;
15975
0
    }
15976
0
    isinstance = PyObject_IsInstance(obj, state->Is_type);
15977
0
    if (isinstance == -1) {
15978
0
        return -1;
15979
0
    }
15980
0
    if (isinstance) {
15981
0
        *out = Is;
15982
0
        return 0;
15983
0
    }
15984
0
    isinstance = PyObject_IsInstance(obj, state->IsNot_type);
15985
0
    if (isinstance == -1) {
15986
0
        return -1;
15987
0
    }
15988
0
    if (isinstance) {
15989
0
        *out = IsNot;
15990
0
        return 0;
15991
0
    }
15992
0
    isinstance = PyObject_IsInstance(obj, state->In_type);
15993
0
    if (isinstance == -1) {
15994
0
        return -1;
15995
0
    }
15996
0
    if (isinstance) {
15997
0
        *out = In;
15998
0
        return 0;
15999
0
    }
16000
0
    isinstance = PyObject_IsInstance(obj, state->NotIn_type);
16001
0
    if (isinstance == -1) {
16002
0
        return -1;
16003
0
    }
16004
0
    if (isinstance) {
16005
0
        *out = NotIn;
16006
0
        return 0;
16007
0
    }
16008
16009
0
    PyErr_Format(PyExc_TypeError, "expected some sort of cmpop, but got %R", obj);
16010
0
    return -1;
16011
0
}
16012
16013
int
16014
obj2ast_comprehension(struct ast_state *state, PyObject* obj, comprehension_ty*
16015
                      out, PyArena* arena)
16016
0
{
16017
0
    PyObject* tmp = NULL;
16018
0
    expr_ty target;
16019
0
    expr_ty iter;
16020
0
    asdl_expr_seq* ifs;
16021
0
    int is_async;
16022
16023
0
    if (PyObject_GetOptionalAttr(obj, state->target, &tmp) < 0) {
16024
0
        return -1;
16025
0
    }
16026
0
    if (tmp == NULL) {
16027
0
        PyErr_SetString(PyExc_TypeError, "required field \"target\" missing from comprehension");
16028
0
        return -1;
16029
0
    }
16030
0
    else {
16031
0
        int res;
16032
0
        if (_Py_EnterRecursiveCall(" while traversing 'comprehension' node")) {
16033
0
            goto failed;
16034
0
        }
16035
0
        res = obj2ast_expr(state, tmp, &target, arena);
16036
0
        _Py_LeaveRecursiveCall();
16037
0
        if (res != 0) goto failed;
16038
0
        Py_CLEAR(tmp);
16039
0
    }
16040
0
    if (PyObject_GetOptionalAttr(obj, state->iter, &tmp) < 0) {
16041
0
        return -1;
16042
0
    }
16043
0
    if (tmp == NULL) {
16044
0
        PyErr_SetString(PyExc_TypeError, "required field \"iter\" missing from comprehension");
16045
0
        return -1;
16046
0
    }
16047
0
    else {
16048
0
        int res;
16049
0
        if (_Py_EnterRecursiveCall(" while traversing 'comprehension' node")) {
16050
0
            goto failed;
16051
0
        }
16052
0
        res = obj2ast_expr(state, tmp, &iter, arena);
16053
0
        _Py_LeaveRecursiveCall();
16054
0
        if (res != 0) goto failed;
16055
0
        Py_CLEAR(tmp);
16056
0
    }
16057
0
    if (PyObject_GetOptionalAttr(obj, state->ifs, &tmp) < 0) {
16058
0
        return -1;
16059
0
    }
16060
0
    if (tmp == NULL) {
16061
0
        tmp = PyList_New(0);
16062
0
        if (tmp == NULL) {
16063
0
            return -1;
16064
0
        }
16065
0
    }
16066
0
    {
16067
0
        int res;
16068
0
        Py_ssize_t len;
16069
0
        Py_ssize_t i;
16070
0
        if (!PyList_Check(tmp)) {
16071
0
            PyErr_Format(PyExc_TypeError, "comprehension field \"ifs\" must be a list, not a %.200s", _PyType_Name(Py_TYPE(tmp)));
16072
0
            goto failed;
16073
0
        }
16074
0
        len = PyList_GET_SIZE(tmp);
16075
0
        ifs = _Py_asdl_expr_seq_new(len, arena);
16076
0
        if (ifs == NULL) goto failed;
16077
0
        for (i = 0; i < len; i++) {
16078
0
            expr_ty val;
16079
0
            PyObject *tmp2 = Py_NewRef(PyList_GET_ITEM(tmp, i));
16080
0
            if (_Py_EnterRecursiveCall(" while traversing 'comprehension' node")) {
16081
0
                goto failed;
16082
0
            }
16083
0
            res = obj2ast_expr(state, tmp2, &val, arena);
16084
0
            _Py_LeaveRecursiveCall();
16085
0
            Py_DECREF(tmp2);
16086
0
            if (res != 0) goto failed;
16087
0
            if (len != PyList_GET_SIZE(tmp)) {
16088
0
                PyErr_SetString(PyExc_RuntimeError, "comprehension field \"ifs\" changed size during iteration");
16089
0
                goto failed;
16090
0
            }
16091
0
            asdl_seq_SET(ifs, i, val);
16092
0
        }
16093
0
        Py_CLEAR(tmp);
16094
0
    }
16095
0
    if (PyObject_GetOptionalAttr(obj, state->is_async, &tmp) < 0) {
16096
0
        return -1;
16097
0
    }
16098
0
    if (tmp == NULL) {
16099
0
        PyErr_SetString(PyExc_TypeError, "required field \"is_async\" missing from comprehension");
16100
0
        return -1;
16101
0
    }
16102
0
    else {
16103
0
        int res;
16104
0
        if (_Py_EnterRecursiveCall(" while traversing 'comprehension' node")) {
16105
0
            goto failed;
16106
0
        }
16107
0
        res = obj2ast_int(state, tmp, &is_async, arena);
16108
0
        _Py_LeaveRecursiveCall();
16109
0
        if (res != 0) goto failed;
16110
0
        Py_CLEAR(tmp);
16111
0
    }
16112
0
    *out = _PyAST_comprehension(target, iter, ifs, is_async, arena);
16113
0
    if (*out == NULL) goto failed;
16114
0
    return 0;
16115
0
failed:
16116
0
    Py_XDECREF(tmp);
16117
0
    return -1;
16118
0
}
16119
16120
int
16121
obj2ast_excepthandler(struct ast_state *state, PyObject* obj, excepthandler_ty*
16122
                      out, PyArena* arena)
16123
0
{
16124
0
    int isinstance;
16125
16126
0
    PyObject *tmp = NULL;
16127
0
    PyObject *tp;
16128
0
    int lineno;
16129
0
    int col_offset;
16130
0
    int end_lineno;
16131
0
    int end_col_offset;
16132
16133
0
    if (obj == Py_None) {
16134
0
        *out = NULL;
16135
0
        return 0;
16136
0
    }
16137
0
    if (PyObject_GetOptionalAttr(obj, state->lineno, &tmp) < 0) {
16138
0
        return -1;
16139
0
    }
16140
0
    if (tmp == NULL) {
16141
0
        PyErr_SetString(PyExc_TypeError, "required field \"lineno\" missing from excepthandler");
16142
0
        return -1;
16143
0
    }
16144
0
    else {
16145
0
        int res;
16146
0
        if (_Py_EnterRecursiveCall(" while traversing 'excepthandler' node")) {
16147
0
            goto failed;
16148
0
        }
16149
0
        res = obj2ast_int(state, tmp, &lineno, arena);
16150
0
        _Py_LeaveRecursiveCall();
16151
0
        if (res != 0) goto failed;
16152
0
        Py_CLEAR(tmp);
16153
0
    }
16154
0
    if (PyObject_GetOptionalAttr(obj, state->col_offset, &tmp) < 0) {
16155
0
        return -1;
16156
0
    }
16157
0
    if (tmp == NULL) {
16158
0
        PyErr_SetString(PyExc_TypeError, "required field \"col_offset\" missing from excepthandler");
16159
0
        return -1;
16160
0
    }
16161
0
    else {
16162
0
        int res;
16163
0
        if (_Py_EnterRecursiveCall(" while traversing 'excepthandler' node")) {
16164
0
            goto failed;
16165
0
        }
16166
0
        res = obj2ast_int(state, tmp, &col_offset, arena);
16167
0
        _Py_LeaveRecursiveCall();
16168
0
        if (res != 0) goto failed;
16169
0
        Py_CLEAR(tmp);
16170
0
    }
16171
0
    if (PyObject_GetOptionalAttr(obj, state->end_lineno, &tmp) < 0) {
16172
0
        return -1;
16173
0
    }
16174
0
    if (tmp == NULL || tmp == Py_None) {
16175
0
        Py_CLEAR(tmp);
16176
0
        end_lineno = lineno;
16177
0
    }
16178
0
    else {
16179
0
        int res;
16180
0
        if (_Py_EnterRecursiveCall(" while traversing 'excepthandler' node")) {
16181
0
            goto failed;
16182
0
        }
16183
0
        res = obj2ast_int(state, tmp, &end_lineno, arena);
16184
0
        _Py_LeaveRecursiveCall();
16185
0
        if (res != 0) goto failed;
16186
0
        Py_CLEAR(tmp);
16187
0
    }
16188
0
    if (PyObject_GetOptionalAttr(obj, state->end_col_offset, &tmp) < 0) {
16189
0
        return -1;
16190
0
    }
16191
0
    if (tmp == NULL || tmp == Py_None) {
16192
0
        Py_CLEAR(tmp);
16193
0
        end_col_offset = col_offset;
16194
0
    }
16195
0
    else {
16196
0
        int res;
16197
0
        if (_Py_EnterRecursiveCall(" while traversing 'excepthandler' node")) {
16198
0
            goto failed;
16199
0
        }
16200
0
        res = obj2ast_int(state, tmp, &end_col_offset, arena);
16201
0
        _Py_LeaveRecursiveCall();
16202
0
        if (res != 0) goto failed;
16203
0
        Py_CLEAR(tmp);
16204
0
    }
16205
0
    tp = state->ExceptHandler_type;
16206
0
    isinstance = PyObject_IsInstance(obj, tp);
16207
0
    if (isinstance == -1) {
16208
0
        return -1;
16209
0
    }
16210
0
    if (isinstance) {
16211
0
        expr_ty type;
16212
0
        identifier name;
16213
0
        asdl_stmt_seq* body;
16214
16215
0
        if (PyObject_GetOptionalAttr(obj, state->type, &tmp) < 0) {
16216
0
            return -1;
16217
0
        }
16218
0
        if (tmp == NULL || tmp == Py_None) {
16219
0
            Py_CLEAR(tmp);
16220
0
            type = NULL;
16221
0
        }
16222
0
        else {
16223
0
            int res;
16224
0
            if (_Py_EnterRecursiveCall(" while traversing 'ExceptHandler' node")) {
16225
0
                goto failed;
16226
0
            }
16227
0
            res = obj2ast_expr(state, tmp, &type, arena);
16228
0
            _Py_LeaveRecursiveCall();
16229
0
            if (res != 0) goto failed;
16230
0
            Py_CLEAR(tmp);
16231
0
        }
16232
0
        if (PyObject_GetOptionalAttr(obj, state->name, &tmp) < 0) {
16233
0
            return -1;
16234
0
        }
16235
0
        if (tmp == NULL || tmp == Py_None) {
16236
0
            Py_CLEAR(tmp);
16237
0
            name = NULL;
16238
0
        }
16239
0
        else {
16240
0
            int res;
16241
0
            if (_Py_EnterRecursiveCall(" while traversing 'ExceptHandler' node")) {
16242
0
                goto failed;
16243
0
            }
16244
0
            res = obj2ast_identifier(state, tmp, &name, arena);
16245
0
            _Py_LeaveRecursiveCall();
16246
0
            if (res != 0) goto failed;
16247
0
            Py_CLEAR(tmp);
16248
0
        }
16249
0
        if (PyObject_GetOptionalAttr(obj, state->body, &tmp) < 0) {
16250
0
            return -1;
16251
0
        }
16252
0
        if (tmp == NULL) {
16253
0
            tmp = PyList_New(0);
16254
0
            if (tmp == NULL) {
16255
0
                return -1;
16256
0
            }
16257
0
        }
16258
0
        {
16259
0
            int res;
16260
0
            Py_ssize_t len;
16261
0
            Py_ssize_t i;
16262
0
            if (!PyList_Check(tmp)) {
16263
0
                PyErr_Format(PyExc_TypeError, "ExceptHandler field \"body\" must be a list, not a %.200s", _PyType_Name(Py_TYPE(tmp)));
16264
0
                goto failed;
16265
0
            }
16266
0
            len = PyList_GET_SIZE(tmp);
16267
0
            body = _Py_asdl_stmt_seq_new(len, arena);
16268
0
            if (body == NULL) goto failed;
16269
0
            for (i = 0; i < len; i++) {
16270
0
                stmt_ty val;
16271
0
                PyObject *tmp2 = Py_NewRef(PyList_GET_ITEM(tmp, i));
16272
0
                if (_Py_EnterRecursiveCall(" while traversing 'ExceptHandler' node")) {
16273
0
                    goto failed;
16274
0
                }
16275
0
                res = obj2ast_stmt(state, tmp2, &val, arena);
16276
0
                _Py_LeaveRecursiveCall();
16277
0
                Py_DECREF(tmp2);
16278
0
                if (res != 0) goto failed;
16279
0
                if (len != PyList_GET_SIZE(tmp)) {
16280
0
                    PyErr_SetString(PyExc_RuntimeError, "ExceptHandler field \"body\" changed size during iteration");
16281
0
                    goto failed;
16282
0
                }
16283
0
                asdl_seq_SET(body, i, val);
16284
0
            }
16285
0
            Py_CLEAR(tmp);
16286
0
        }
16287
0
        *out = _PyAST_ExceptHandler(type, name, body, lineno, col_offset,
16288
0
                                    end_lineno, end_col_offset, arena);
16289
0
        if (*out == NULL) goto failed;
16290
0
        return 0;
16291
0
    }
16292
16293
0
    PyErr_Format(PyExc_TypeError, "expected some sort of excepthandler, but got %R", obj);
16294
0
    failed:
16295
0
    Py_XDECREF(tmp);
16296
0
    return -1;
16297
0
}
16298
16299
int
16300
obj2ast_arguments(struct ast_state *state, PyObject* obj, arguments_ty* out,
16301
                  PyArena* arena)
16302
0
{
16303
0
    PyObject* tmp = NULL;
16304
0
    asdl_arg_seq* posonlyargs;
16305
0
    asdl_arg_seq* args;
16306
0
    arg_ty vararg;
16307
0
    asdl_arg_seq* kwonlyargs;
16308
0
    asdl_expr_seq* kw_defaults;
16309
0
    arg_ty kwarg;
16310
0
    asdl_expr_seq* defaults;
16311
16312
0
    if (PyObject_GetOptionalAttr(obj, state->posonlyargs, &tmp) < 0) {
16313
0
        return -1;
16314
0
    }
16315
0
    if (tmp == NULL) {
16316
0
        tmp = PyList_New(0);
16317
0
        if (tmp == NULL) {
16318
0
            return -1;
16319
0
        }
16320
0
    }
16321
0
    {
16322
0
        int res;
16323
0
        Py_ssize_t len;
16324
0
        Py_ssize_t i;
16325
0
        if (!PyList_Check(tmp)) {
16326
0
            PyErr_Format(PyExc_TypeError, "arguments field \"posonlyargs\" must be a list, not a %.200s", _PyType_Name(Py_TYPE(tmp)));
16327
0
            goto failed;
16328
0
        }
16329
0
        len = PyList_GET_SIZE(tmp);
16330
0
        posonlyargs = _Py_asdl_arg_seq_new(len, arena);
16331
0
        if (posonlyargs == NULL) goto failed;
16332
0
        for (i = 0; i < len; i++) {
16333
0
            arg_ty val;
16334
0
            PyObject *tmp2 = Py_NewRef(PyList_GET_ITEM(tmp, i));
16335
0
            if (_Py_EnterRecursiveCall(" while traversing 'arguments' node")) {
16336
0
                goto failed;
16337
0
            }
16338
0
            res = obj2ast_arg(state, tmp2, &val, arena);
16339
0
            _Py_LeaveRecursiveCall();
16340
0
            Py_DECREF(tmp2);
16341
0
            if (res != 0) goto failed;
16342
0
            if (len != PyList_GET_SIZE(tmp)) {
16343
0
                PyErr_SetString(PyExc_RuntimeError, "arguments field \"posonlyargs\" changed size during iteration");
16344
0
                goto failed;
16345
0
            }
16346
0
            asdl_seq_SET(posonlyargs, i, val);
16347
0
        }
16348
0
        Py_CLEAR(tmp);
16349
0
    }
16350
0
    if (PyObject_GetOptionalAttr(obj, state->args, &tmp) < 0) {
16351
0
        return -1;
16352
0
    }
16353
0
    if (tmp == NULL) {
16354
0
        tmp = PyList_New(0);
16355
0
        if (tmp == NULL) {
16356
0
            return -1;
16357
0
        }
16358
0
    }
16359
0
    {
16360
0
        int res;
16361
0
        Py_ssize_t len;
16362
0
        Py_ssize_t i;
16363
0
        if (!PyList_Check(tmp)) {
16364
0
            PyErr_Format(PyExc_TypeError, "arguments field \"args\" must be a list, not a %.200s", _PyType_Name(Py_TYPE(tmp)));
16365
0
            goto failed;
16366
0
        }
16367
0
        len = PyList_GET_SIZE(tmp);
16368
0
        args = _Py_asdl_arg_seq_new(len, arena);
16369
0
        if (args == NULL) goto failed;
16370
0
        for (i = 0; i < len; i++) {
16371
0
            arg_ty val;
16372
0
            PyObject *tmp2 = Py_NewRef(PyList_GET_ITEM(tmp, i));
16373
0
            if (_Py_EnterRecursiveCall(" while traversing 'arguments' node")) {
16374
0
                goto failed;
16375
0
            }
16376
0
            res = obj2ast_arg(state, tmp2, &val, arena);
16377
0
            _Py_LeaveRecursiveCall();
16378
0
            Py_DECREF(tmp2);
16379
0
            if (res != 0) goto failed;
16380
0
            if (len != PyList_GET_SIZE(tmp)) {
16381
0
                PyErr_SetString(PyExc_RuntimeError, "arguments field \"args\" changed size during iteration");
16382
0
                goto failed;
16383
0
            }
16384
0
            asdl_seq_SET(args, i, val);
16385
0
        }
16386
0
        Py_CLEAR(tmp);
16387
0
    }
16388
0
    if (PyObject_GetOptionalAttr(obj, state->vararg, &tmp) < 0) {
16389
0
        return -1;
16390
0
    }
16391
0
    if (tmp == NULL || tmp == Py_None) {
16392
0
        Py_CLEAR(tmp);
16393
0
        vararg = NULL;
16394
0
    }
16395
0
    else {
16396
0
        int res;
16397
0
        if (_Py_EnterRecursiveCall(" while traversing 'arguments' node")) {
16398
0
            goto failed;
16399
0
        }
16400
0
        res = obj2ast_arg(state, tmp, &vararg, arena);
16401
0
        _Py_LeaveRecursiveCall();
16402
0
        if (res != 0) goto failed;
16403
0
        Py_CLEAR(tmp);
16404
0
    }
16405
0
    if (PyObject_GetOptionalAttr(obj, state->kwonlyargs, &tmp) < 0) {
16406
0
        return -1;
16407
0
    }
16408
0
    if (tmp == NULL) {
16409
0
        tmp = PyList_New(0);
16410
0
        if (tmp == NULL) {
16411
0
            return -1;
16412
0
        }
16413
0
    }
16414
0
    {
16415
0
        int res;
16416
0
        Py_ssize_t len;
16417
0
        Py_ssize_t i;
16418
0
        if (!PyList_Check(tmp)) {
16419
0
            PyErr_Format(PyExc_TypeError, "arguments field \"kwonlyargs\" must be a list, not a %.200s", _PyType_Name(Py_TYPE(tmp)));
16420
0
            goto failed;
16421
0
        }
16422
0
        len = PyList_GET_SIZE(tmp);
16423
0
        kwonlyargs = _Py_asdl_arg_seq_new(len, arena);
16424
0
        if (kwonlyargs == NULL) goto failed;
16425
0
        for (i = 0; i < len; i++) {
16426
0
            arg_ty val;
16427
0
            PyObject *tmp2 = Py_NewRef(PyList_GET_ITEM(tmp, i));
16428
0
            if (_Py_EnterRecursiveCall(" while traversing 'arguments' node")) {
16429
0
                goto failed;
16430
0
            }
16431
0
            res = obj2ast_arg(state, tmp2, &val, arena);
16432
0
            _Py_LeaveRecursiveCall();
16433
0
            Py_DECREF(tmp2);
16434
0
            if (res != 0) goto failed;
16435
0
            if (len != PyList_GET_SIZE(tmp)) {
16436
0
                PyErr_SetString(PyExc_RuntimeError, "arguments field \"kwonlyargs\" changed size during iteration");
16437
0
                goto failed;
16438
0
            }
16439
0
            asdl_seq_SET(kwonlyargs, i, val);
16440
0
        }
16441
0
        Py_CLEAR(tmp);
16442
0
    }
16443
0
    if (PyObject_GetOptionalAttr(obj, state->kw_defaults, &tmp) < 0) {
16444
0
        return -1;
16445
0
    }
16446
0
    if (tmp == NULL) {
16447
0
        tmp = PyList_New(0);
16448
0
        if (tmp == NULL) {
16449
0
            return -1;
16450
0
        }
16451
0
    }
16452
0
    {
16453
0
        int res;
16454
0
        Py_ssize_t len;
16455
0
        Py_ssize_t i;
16456
0
        if (!PyList_Check(tmp)) {
16457
0
            PyErr_Format(PyExc_TypeError, "arguments field \"kw_defaults\" must be a list, not a %.200s", _PyType_Name(Py_TYPE(tmp)));
16458
0
            goto failed;
16459
0
        }
16460
0
        len = PyList_GET_SIZE(tmp);
16461
0
        kw_defaults = _Py_asdl_expr_seq_new(len, arena);
16462
0
        if (kw_defaults == NULL) goto failed;
16463
0
        for (i = 0; i < len; i++) {
16464
0
            expr_ty val;
16465
0
            PyObject *tmp2 = Py_NewRef(PyList_GET_ITEM(tmp, i));
16466
0
            if (_Py_EnterRecursiveCall(" while traversing 'arguments' node")) {
16467
0
                goto failed;
16468
0
            }
16469
0
            res = obj2ast_expr(state, tmp2, &val, arena);
16470
0
            _Py_LeaveRecursiveCall();
16471
0
            Py_DECREF(tmp2);
16472
0
            if (res != 0) goto failed;
16473
0
            if (len != PyList_GET_SIZE(tmp)) {
16474
0
                PyErr_SetString(PyExc_RuntimeError, "arguments field \"kw_defaults\" changed size during iteration");
16475
0
                goto failed;
16476
0
            }
16477
0
            asdl_seq_SET(kw_defaults, i, val);
16478
0
        }
16479
0
        Py_CLEAR(tmp);
16480
0
    }
16481
0
    if (PyObject_GetOptionalAttr(obj, state->kwarg, &tmp) < 0) {
16482
0
        return -1;
16483
0
    }
16484
0
    if (tmp == NULL || tmp == Py_None) {
16485
0
        Py_CLEAR(tmp);
16486
0
        kwarg = NULL;
16487
0
    }
16488
0
    else {
16489
0
        int res;
16490
0
        if (_Py_EnterRecursiveCall(" while traversing 'arguments' node")) {
16491
0
            goto failed;
16492
0
        }
16493
0
        res = obj2ast_arg(state, tmp, &kwarg, arena);
16494
0
        _Py_LeaveRecursiveCall();
16495
0
        if (res != 0) goto failed;
16496
0
        Py_CLEAR(tmp);
16497
0
    }
16498
0
    if (PyObject_GetOptionalAttr(obj, state->defaults, &tmp) < 0) {
16499
0
        return -1;
16500
0
    }
16501
0
    if (tmp == NULL) {
16502
0
        tmp = PyList_New(0);
16503
0
        if (tmp == NULL) {
16504
0
            return -1;
16505
0
        }
16506
0
    }
16507
0
    {
16508
0
        int res;
16509
0
        Py_ssize_t len;
16510
0
        Py_ssize_t i;
16511
0
        if (!PyList_Check(tmp)) {
16512
0
            PyErr_Format(PyExc_TypeError, "arguments field \"defaults\" must be a list, not a %.200s", _PyType_Name(Py_TYPE(tmp)));
16513
0
            goto failed;
16514
0
        }
16515
0
        len = PyList_GET_SIZE(tmp);
16516
0
        defaults = _Py_asdl_expr_seq_new(len, arena);
16517
0
        if (defaults == NULL) goto failed;
16518
0
        for (i = 0; i < len; i++) {
16519
0
            expr_ty val;
16520
0
            PyObject *tmp2 = Py_NewRef(PyList_GET_ITEM(tmp, i));
16521
0
            if (_Py_EnterRecursiveCall(" while traversing 'arguments' node")) {
16522
0
                goto failed;
16523
0
            }
16524
0
            res = obj2ast_expr(state, tmp2, &val, arena);
16525
0
            _Py_LeaveRecursiveCall();
16526
0
            Py_DECREF(tmp2);
16527
0
            if (res != 0) goto failed;
16528
0
            if (len != PyList_GET_SIZE(tmp)) {
16529
0
                PyErr_SetString(PyExc_RuntimeError, "arguments field \"defaults\" changed size during iteration");
16530
0
                goto failed;
16531
0
            }
16532
0
            asdl_seq_SET(defaults, i, val);
16533
0
        }
16534
0
        Py_CLEAR(tmp);
16535
0
    }
16536
0
    *out = _PyAST_arguments(posonlyargs, args, vararg, kwonlyargs, kw_defaults,
16537
0
                            kwarg, defaults, arena);
16538
0
    if (*out == NULL) goto failed;
16539
0
    return 0;
16540
0
failed:
16541
0
    Py_XDECREF(tmp);
16542
0
    return -1;
16543
0
}
16544
16545
int
16546
obj2ast_arg(struct ast_state *state, PyObject* obj, arg_ty* out, PyArena* arena)
16547
0
{
16548
0
    PyObject* tmp = NULL;
16549
0
    identifier arg;
16550
0
    expr_ty annotation;
16551
0
    string type_comment;
16552
0
    int lineno;
16553
0
    int col_offset;
16554
0
    int end_lineno;
16555
0
    int end_col_offset;
16556
16557
0
    if (PyObject_GetOptionalAttr(obj, state->arg, &tmp) < 0) {
16558
0
        return -1;
16559
0
    }
16560
0
    if (tmp == NULL) {
16561
0
        PyErr_SetString(PyExc_TypeError, "required field \"arg\" missing from arg");
16562
0
        return -1;
16563
0
    }
16564
0
    else {
16565
0
        int res;
16566
0
        if (_Py_EnterRecursiveCall(" while traversing 'arg' node")) {
16567
0
            goto failed;
16568
0
        }
16569
0
        res = obj2ast_identifier(state, tmp, &arg, arena);
16570
0
        _Py_LeaveRecursiveCall();
16571
0
        if (res != 0) goto failed;
16572
0
        Py_CLEAR(tmp);
16573
0
    }
16574
0
    if (PyObject_GetOptionalAttr(obj, state->annotation, &tmp) < 0) {
16575
0
        return -1;
16576
0
    }
16577
0
    if (tmp == NULL || tmp == Py_None) {
16578
0
        Py_CLEAR(tmp);
16579
0
        annotation = NULL;
16580
0
    }
16581
0
    else {
16582
0
        int res;
16583
0
        if (_Py_EnterRecursiveCall(" while traversing 'arg' node")) {
16584
0
            goto failed;
16585
0
        }
16586
0
        res = obj2ast_expr(state, tmp, &annotation, arena);
16587
0
        _Py_LeaveRecursiveCall();
16588
0
        if (res != 0) goto failed;
16589
0
        Py_CLEAR(tmp);
16590
0
    }
16591
0
    if (PyObject_GetOptionalAttr(obj, state->type_comment, &tmp) < 0) {
16592
0
        return -1;
16593
0
    }
16594
0
    if (tmp == NULL || tmp == Py_None) {
16595
0
        Py_CLEAR(tmp);
16596
0
        type_comment = NULL;
16597
0
    }
16598
0
    else {
16599
0
        int res;
16600
0
        if (_Py_EnterRecursiveCall(" while traversing 'arg' node")) {
16601
0
            goto failed;
16602
0
        }
16603
0
        res = obj2ast_string(state, tmp, &type_comment, arena);
16604
0
        _Py_LeaveRecursiveCall();
16605
0
        if (res != 0) goto failed;
16606
0
        Py_CLEAR(tmp);
16607
0
    }
16608
0
    if (PyObject_GetOptionalAttr(obj, state->lineno, &tmp) < 0) {
16609
0
        return -1;
16610
0
    }
16611
0
    if (tmp == NULL) {
16612
0
        PyErr_SetString(PyExc_TypeError, "required field \"lineno\" missing from arg");
16613
0
        return -1;
16614
0
    }
16615
0
    else {
16616
0
        int res;
16617
0
        if (_Py_EnterRecursiveCall(" while traversing 'arg' node")) {
16618
0
            goto failed;
16619
0
        }
16620
0
        res = obj2ast_int(state, tmp, &lineno, arena);
16621
0
        _Py_LeaveRecursiveCall();
16622
0
        if (res != 0) goto failed;
16623
0
        Py_CLEAR(tmp);
16624
0
    }
16625
0
    if (PyObject_GetOptionalAttr(obj, state->col_offset, &tmp) < 0) {
16626
0
        return -1;
16627
0
    }
16628
0
    if (tmp == NULL) {
16629
0
        PyErr_SetString(PyExc_TypeError, "required field \"col_offset\" missing from arg");
16630
0
        return -1;
16631
0
    }
16632
0
    else {
16633
0
        int res;
16634
0
        if (_Py_EnterRecursiveCall(" while traversing 'arg' node")) {
16635
0
            goto failed;
16636
0
        }
16637
0
        res = obj2ast_int(state, tmp, &col_offset, arena);
16638
0
        _Py_LeaveRecursiveCall();
16639
0
        if (res != 0) goto failed;
16640
0
        Py_CLEAR(tmp);
16641
0
    }
16642
0
    if (PyObject_GetOptionalAttr(obj, state->end_lineno, &tmp) < 0) {
16643
0
        return -1;
16644
0
    }
16645
0
    if (tmp == NULL || tmp == Py_None) {
16646
0
        Py_CLEAR(tmp);
16647
0
        end_lineno = lineno;
16648
0
    }
16649
0
    else {
16650
0
        int res;
16651
0
        if (_Py_EnterRecursiveCall(" while traversing 'arg' node")) {
16652
0
            goto failed;
16653
0
        }
16654
0
        res = obj2ast_int(state, tmp, &end_lineno, arena);
16655
0
        _Py_LeaveRecursiveCall();
16656
0
        if (res != 0) goto failed;
16657
0
        Py_CLEAR(tmp);
16658
0
    }
16659
0
    if (PyObject_GetOptionalAttr(obj, state->end_col_offset, &tmp) < 0) {
16660
0
        return -1;
16661
0
    }
16662
0
    if (tmp == NULL || tmp == Py_None) {
16663
0
        Py_CLEAR(tmp);
16664
0
        end_col_offset = col_offset;
16665
0
    }
16666
0
    else {
16667
0
        int res;
16668
0
        if (_Py_EnterRecursiveCall(" while traversing 'arg' node")) {
16669
0
            goto failed;
16670
0
        }
16671
0
        res = obj2ast_int(state, tmp, &end_col_offset, arena);
16672
0
        _Py_LeaveRecursiveCall();
16673
0
        if (res != 0) goto failed;
16674
0
        Py_CLEAR(tmp);
16675
0
    }
16676
0
    *out = _PyAST_arg(arg, annotation, type_comment, lineno, col_offset,
16677
0
                      end_lineno, end_col_offset, arena);
16678
0
    if (*out == NULL) goto failed;
16679
0
    return 0;
16680
0
failed:
16681
0
    Py_XDECREF(tmp);
16682
0
    return -1;
16683
0
}
16684
16685
int
16686
obj2ast_keyword(struct ast_state *state, PyObject* obj, keyword_ty* out,
16687
                PyArena* arena)
16688
0
{
16689
0
    PyObject* tmp = NULL;
16690
0
    identifier arg;
16691
0
    expr_ty value;
16692
0
    int lineno;
16693
0
    int col_offset;
16694
0
    int end_lineno;
16695
0
    int end_col_offset;
16696
16697
0
    if (PyObject_GetOptionalAttr(obj, state->arg, &tmp) < 0) {
16698
0
        return -1;
16699
0
    }
16700
0
    if (tmp == NULL || tmp == Py_None) {
16701
0
        Py_CLEAR(tmp);
16702
0
        arg = NULL;
16703
0
    }
16704
0
    else {
16705
0
        int res;
16706
0
        if (_Py_EnterRecursiveCall(" while traversing 'keyword' node")) {
16707
0
            goto failed;
16708
0
        }
16709
0
        res = obj2ast_identifier(state, tmp, &arg, arena);
16710
0
        _Py_LeaveRecursiveCall();
16711
0
        if (res != 0) goto failed;
16712
0
        Py_CLEAR(tmp);
16713
0
    }
16714
0
    if (PyObject_GetOptionalAttr(obj, state->value, &tmp) < 0) {
16715
0
        return -1;
16716
0
    }
16717
0
    if (tmp == NULL) {
16718
0
        PyErr_SetString(PyExc_TypeError, "required field \"value\" missing from keyword");
16719
0
        return -1;
16720
0
    }
16721
0
    else {
16722
0
        int res;
16723
0
        if (_Py_EnterRecursiveCall(" while traversing 'keyword' node")) {
16724
0
            goto failed;
16725
0
        }
16726
0
        res = obj2ast_expr(state, tmp, &value, arena);
16727
0
        _Py_LeaveRecursiveCall();
16728
0
        if (res != 0) goto failed;
16729
0
        Py_CLEAR(tmp);
16730
0
    }
16731
0
    if (PyObject_GetOptionalAttr(obj, state->lineno, &tmp) < 0) {
16732
0
        return -1;
16733
0
    }
16734
0
    if (tmp == NULL) {
16735
0
        PyErr_SetString(PyExc_TypeError, "required field \"lineno\" missing from keyword");
16736
0
        return -1;
16737
0
    }
16738
0
    else {
16739
0
        int res;
16740
0
        if (_Py_EnterRecursiveCall(" while traversing 'keyword' node")) {
16741
0
            goto failed;
16742
0
        }
16743
0
        res = obj2ast_int(state, tmp, &lineno, arena);
16744
0
        _Py_LeaveRecursiveCall();
16745
0
        if (res != 0) goto failed;
16746
0
        Py_CLEAR(tmp);
16747
0
    }
16748
0
    if (PyObject_GetOptionalAttr(obj, state->col_offset, &tmp) < 0) {
16749
0
        return -1;
16750
0
    }
16751
0
    if (tmp == NULL) {
16752
0
        PyErr_SetString(PyExc_TypeError, "required field \"col_offset\" missing from keyword");
16753
0
        return -1;
16754
0
    }
16755
0
    else {
16756
0
        int res;
16757
0
        if (_Py_EnterRecursiveCall(" while traversing 'keyword' node")) {
16758
0
            goto failed;
16759
0
        }
16760
0
        res = obj2ast_int(state, tmp, &col_offset, arena);
16761
0
        _Py_LeaveRecursiveCall();
16762
0
        if (res != 0) goto failed;
16763
0
        Py_CLEAR(tmp);
16764
0
    }
16765
0
    if (PyObject_GetOptionalAttr(obj, state->end_lineno, &tmp) < 0) {
16766
0
        return -1;
16767
0
    }
16768
0
    if (tmp == NULL || tmp == Py_None) {
16769
0
        Py_CLEAR(tmp);
16770
0
        end_lineno = lineno;
16771
0
    }
16772
0
    else {
16773
0
        int res;
16774
0
        if (_Py_EnterRecursiveCall(" while traversing 'keyword' node")) {
16775
0
            goto failed;
16776
0
        }
16777
0
        res = obj2ast_int(state, tmp, &end_lineno, arena);
16778
0
        _Py_LeaveRecursiveCall();
16779
0
        if (res != 0) goto failed;
16780
0
        Py_CLEAR(tmp);
16781
0
    }
16782
0
    if (PyObject_GetOptionalAttr(obj, state->end_col_offset, &tmp) < 0) {
16783
0
        return -1;
16784
0
    }
16785
0
    if (tmp == NULL || tmp == Py_None) {
16786
0
        Py_CLEAR(tmp);
16787
0
        end_col_offset = col_offset;
16788
0
    }
16789
0
    else {
16790
0
        int res;
16791
0
        if (_Py_EnterRecursiveCall(" while traversing 'keyword' node")) {
16792
0
            goto failed;
16793
0
        }
16794
0
        res = obj2ast_int(state, tmp, &end_col_offset, arena);
16795
0
        _Py_LeaveRecursiveCall();
16796
0
        if (res != 0) goto failed;
16797
0
        Py_CLEAR(tmp);
16798
0
    }
16799
0
    *out = _PyAST_keyword(arg, value, lineno, col_offset, end_lineno,
16800
0
                          end_col_offset, arena);
16801
0
    if (*out == NULL) goto failed;
16802
0
    return 0;
16803
0
failed:
16804
0
    Py_XDECREF(tmp);
16805
0
    return -1;
16806
0
}
16807
16808
int
16809
obj2ast_alias(struct ast_state *state, PyObject* obj, alias_ty* out, PyArena*
16810
              arena)
16811
0
{
16812
0
    PyObject* tmp = NULL;
16813
0
    identifier name;
16814
0
    identifier asname;
16815
0
    int lineno;
16816
0
    int col_offset;
16817
0
    int end_lineno;
16818
0
    int end_col_offset;
16819
16820
0
    if (PyObject_GetOptionalAttr(obj, state->name, &tmp) < 0) {
16821
0
        return -1;
16822
0
    }
16823
0
    if (tmp == NULL) {
16824
0
        PyErr_SetString(PyExc_TypeError, "required field \"name\" missing from alias");
16825
0
        return -1;
16826
0
    }
16827
0
    else {
16828
0
        int res;
16829
0
        if (_Py_EnterRecursiveCall(" while traversing 'alias' node")) {
16830
0
            goto failed;
16831
0
        }
16832
0
        res = obj2ast_identifier(state, tmp, &name, arena);
16833
0
        _Py_LeaveRecursiveCall();
16834
0
        if (res != 0) goto failed;
16835
0
        Py_CLEAR(tmp);
16836
0
    }
16837
0
    if (PyObject_GetOptionalAttr(obj, state->asname, &tmp) < 0) {
16838
0
        return -1;
16839
0
    }
16840
0
    if (tmp == NULL || tmp == Py_None) {
16841
0
        Py_CLEAR(tmp);
16842
0
        asname = NULL;
16843
0
    }
16844
0
    else {
16845
0
        int res;
16846
0
        if (_Py_EnterRecursiveCall(" while traversing 'alias' node")) {
16847
0
            goto failed;
16848
0
        }
16849
0
        res = obj2ast_identifier(state, tmp, &asname, arena);
16850
0
        _Py_LeaveRecursiveCall();
16851
0
        if (res != 0) goto failed;
16852
0
        Py_CLEAR(tmp);
16853
0
    }
16854
0
    if (PyObject_GetOptionalAttr(obj, state->lineno, &tmp) < 0) {
16855
0
        return -1;
16856
0
    }
16857
0
    if (tmp == NULL) {
16858
0
        PyErr_SetString(PyExc_TypeError, "required field \"lineno\" missing from alias");
16859
0
        return -1;
16860
0
    }
16861
0
    else {
16862
0
        int res;
16863
0
        if (_Py_EnterRecursiveCall(" while traversing 'alias' node")) {
16864
0
            goto failed;
16865
0
        }
16866
0
        res = obj2ast_int(state, tmp, &lineno, arena);
16867
0
        _Py_LeaveRecursiveCall();
16868
0
        if (res != 0) goto failed;
16869
0
        Py_CLEAR(tmp);
16870
0
    }
16871
0
    if (PyObject_GetOptionalAttr(obj, state->col_offset, &tmp) < 0) {
16872
0
        return -1;
16873
0
    }
16874
0
    if (tmp == NULL) {
16875
0
        PyErr_SetString(PyExc_TypeError, "required field \"col_offset\" missing from alias");
16876
0
        return -1;
16877
0
    }
16878
0
    else {
16879
0
        int res;
16880
0
        if (_Py_EnterRecursiveCall(" while traversing 'alias' node")) {
16881
0
            goto failed;
16882
0
        }
16883
0
        res = obj2ast_int(state, tmp, &col_offset, arena);
16884
0
        _Py_LeaveRecursiveCall();
16885
0
        if (res != 0) goto failed;
16886
0
        Py_CLEAR(tmp);
16887
0
    }
16888
0
    if (PyObject_GetOptionalAttr(obj, state->end_lineno, &tmp) < 0) {
16889
0
        return -1;
16890
0
    }
16891
0
    if (tmp == NULL || tmp == Py_None) {
16892
0
        Py_CLEAR(tmp);
16893
0
        end_lineno = lineno;
16894
0
    }
16895
0
    else {
16896
0
        int res;
16897
0
        if (_Py_EnterRecursiveCall(" while traversing 'alias' node")) {
16898
0
            goto failed;
16899
0
        }
16900
0
        res = obj2ast_int(state, tmp, &end_lineno, arena);
16901
0
        _Py_LeaveRecursiveCall();
16902
0
        if (res != 0) goto failed;
16903
0
        Py_CLEAR(tmp);
16904
0
    }
16905
0
    if (PyObject_GetOptionalAttr(obj, state->end_col_offset, &tmp) < 0) {
16906
0
        return -1;
16907
0
    }
16908
0
    if (tmp == NULL || tmp == Py_None) {
16909
0
        Py_CLEAR(tmp);
16910
0
        end_col_offset = col_offset;
16911
0
    }
16912
0
    else {
16913
0
        int res;
16914
0
        if (_Py_EnterRecursiveCall(" while traversing 'alias' node")) {
16915
0
            goto failed;
16916
0
        }
16917
0
        res = obj2ast_int(state, tmp, &end_col_offset, arena);
16918
0
        _Py_LeaveRecursiveCall();
16919
0
        if (res != 0) goto failed;
16920
0
        Py_CLEAR(tmp);
16921
0
    }
16922
0
    *out = _PyAST_alias(name, asname, lineno, col_offset, end_lineno,
16923
0
                        end_col_offset, arena);
16924
0
    if (*out == NULL) goto failed;
16925
0
    return 0;
16926
0
failed:
16927
0
    Py_XDECREF(tmp);
16928
0
    return -1;
16929
0
}
16930
16931
int
16932
obj2ast_withitem(struct ast_state *state, PyObject* obj, withitem_ty* out,
16933
                 PyArena* arena)
16934
0
{
16935
0
    PyObject* tmp = NULL;
16936
0
    expr_ty context_expr;
16937
0
    expr_ty optional_vars;
16938
16939
0
    if (PyObject_GetOptionalAttr(obj, state->context_expr, &tmp) < 0) {
16940
0
        return -1;
16941
0
    }
16942
0
    if (tmp == NULL) {
16943
0
        PyErr_SetString(PyExc_TypeError, "required field \"context_expr\" missing from withitem");
16944
0
        return -1;
16945
0
    }
16946
0
    else {
16947
0
        int res;
16948
0
        if (_Py_EnterRecursiveCall(" while traversing 'withitem' node")) {
16949
0
            goto failed;
16950
0
        }
16951
0
        res = obj2ast_expr(state, tmp, &context_expr, arena);
16952
0
        _Py_LeaveRecursiveCall();
16953
0
        if (res != 0) goto failed;
16954
0
        Py_CLEAR(tmp);
16955
0
    }
16956
0
    if (PyObject_GetOptionalAttr(obj, state->optional_vars, &tmp) < 0) {
16957
0
        return -1;
16958
0
    }
16959
0
    if (tmp == NULL || tmp == Py_None) {
16960
0
        Py_CLEAR(tmp);
16961
0
        optional_vars = NULL;
16962
0
    }
16963
0
    else {
16964
0
        int res;
16965
0
        if (_Py_EnterRecursiveCall(" while traversing 'withitem' node")) {
16966
0
            goto failed;
16967
0
        }
16968
0
        res = obj2ast_expr(state, tmp, &optional_vars, arena);
16969
0
        _Py_LeaveRecursiveCall();
16970
0
        if (res != 0) goto failed;
16971
0
        Py_CLEAR(tmp);
16972
0
    }
16973
0
    *out = _PyAST_withitem(context_expr, optional_vars, arena);
16974
0
    if (*out == NULL) goto failed;
16975
0
    return 0;
16976
0
failed:
16977
0
    Py_XDECREF(tmp);
16978
0
    return -1;
16979
0
}
16980
16981
int
16982
obj2ast_match_case(struct ast_state *state, PyObject* obj, match_case_ty* out,
16983
                   PyArena* arena)
16984
0
{
16985
0
    PyObject* tmp = NULL;
16986
0
    pattern_ty pattern;
16987
0
    expr_ty guard;
16988
0
    asdl_stmt_seq* body;
16989
16990
0
    if (PyObject_GetOptionalAttr(obj, state->pattern, &tmp) < 0) {
16991
0
        return -1;
16992
0
    }
16993
0
    if (tmp == NULL) {
16994
0
        PyErr_SetString(PyExc_TypeError, "required field \"pattern\" missing from match_case");
16995
0
        return -1;
16996
0
    }
16997
0
    else {
16998
0
        int res;
16999
0
        if (_Py_EnterRecursiveCall(" while traversing 'match_case' node")) {
17000
0
            goto failed;
17001
0
        }
17002
0
        res = obj2ast_pattern(state, tmp, &pattern, arena);
17003
0
        _Py_LeaveRecursiveCall();
17004
0
        if (res != 0) goto failed;
17005
0
        Py_CLEAR(tmp);
17006
0
    }
17007
0
    if (PyObject_GetOptionalAttr(obj, state->guard, &tmp) < 0) {
17008
0
        return -1;
17009
0
    }
17010
0
    if (tmp == NULL || tmp == Py_None) {
17011
0
        Py_CLEAR(tmp);
17012
0
        guard = NULL;
17013
0
    }
17014
0
    else {
17015
0
        int res;
17016
0
        if (_Py_EnterRecursiveCall(" while traversing 'match_case' node")) {
17017
0
            goto failed;
17018
0
        }
17019
0
        res = obj2ast_expr(state, tmp, &guard, arena);
17020
0
        _Py_LeaveRecursiveCall();
17021
0
        if (res != 0) goto failed;
17022
0
        Py_CLEAR(tmp);
17023
0
    }
17024
0
    if (PyObject_GetOptionalAttr(obj, state->body, &tmp) < 0) {
17025
0
        return -1;
17026
0
    }
17027
0
    if (tmp == NULL) {
17028
0
        tmp = PyList_New(0);
17029
0
        if (tmp == NULL) {
17030
0
            return -1;
17031
0
        }
17032
0
    }
17033
0
    {
17034
0
        int res;
17035
0
        Py_ssize_t len;
17036
0
        Py_ssize_t i;
17037
0
        if (!PyList_Check(tmp)) {
17038
0
            PyErr_Format(PyExc_TypeError, "match_case field \"body\" must be a list, not a %.200s", _PyType_Name(Py_TYPE(tmp)));
17039
0
            goto failed;
17040
0
        }
17041
0
        len = PyList_GET_SIZE(tmp);
17042
0
        body = _Py_asdl_stmt_seq_new(len, arena);
17043
0
        if (body == NULL) goto failed;
17044
0
        for (i = 0; i < len; i++) {
17045
0
            stmt_ty val;
17046
0
            PyObject *tmp2 = Py_NewRef(PyList_GET_ITEM(tmp, i));
17047
0
            if (_Py_EnterRecursiveCall(" while traversing 'match_case' node")) {
17048
0
                goto failed;
17049
0
            }
17050
0
            res = obj2ast_stmt(state, tmp2, &val, arena);
17051
0
            _Py_LeaveRecursiveCall();
17052
0
            Py_DECREF(tmp2);
17053
0
            if (res != 0) goto failed;
17054
0
            if (len != PyList_GET_SIZE(tmp)) {
17055
0
                PyErr_SetString(PyExc_RuntimeError, "match_case field \"body\" changed size during iteration");
17056
0
                goto failed;
17057
0
            }
17058
0
            asdl_seq_SET(body, i, val);
17059
0
        }
17060
0
        Py_CLEAR(tmp);
17061
0
    }
17062
0
    *out = _PyAST_match_case(pattern, guard, body, arena);
17063
0
    if (*out == NULL) goto failed;
17064
0
    return 0;
17065
0
failed:
17066
0
    Py_XDECREF(tmp);
17067
0
    return -1;
17068
0
}
17069
17070
int
17071
obj2ast_pattern(struct ast_state *state, PyObject* obj, pattern_ty* out,
17072
                PyArena* arena)
17073
0
{
17074
0
    int isinstance;
17075
17076
0
    PyObject *tmp = NULL;
17077
0
    PyObject *tp;
17078
0
    int lineno;
17079
0
    int col_offset;
17080
0
    int end_lineno;
17081
0
    int end_col_offset;
17082
17083
0
    if (obj == Py_None) {
17084
0
        *out = NULL;
17085
0
        return 0;
17086
0
    }
17087
0
    if (PyObject_GetOptionalAttr(obj, state->lineno, &tmp) < 0) {
17088
0
        return -1;
17089
0
    }
17090
0
    if (tmp == NULL) {
17091
0
        PyErr_SetString(PyExc_TypeError, "required field \"lineno\" missing from pattern");
17092
0
        return -1;
17093
0
    }
17094
0
    else {
17095
0
        int res;
17096
0
        if (_Py_EnterRecursiveCall(" while traversing 'pattern' node")) {
17097
0
            goto failed;
17098
0
        }
17099
0
        res = obj2ast_int(state, tmp, &lineno, arena);
17100
0
        _Py_LeaveRecursiveCall();
17101
0
        if (res != 0) goto failed;
17102
0
        Py_CLEAR(tmp);
17103
0
    }
17104
0
    if (PyObject_GetOptionalAttr(obj, state->col_offset, &tmp) < 0) {
17105
0
        return -1;
17106
0
    }
17107
0
    if (tmp == NULL) {
17108
0
        PyErr_SetString(PyExc_TypeError, "required field \"col_offset\" missing from pattern");
17109
0
        return -1;
17110
0
    }
17111
0
    else {
17112
0
        int res;
17113
0
        if (_Py_EnterRecursiveCall(" while traversing 'pattern' node")) {
17114
0
            goto failed;
17115
0
        }
17116
0
        res = obj2ast_int(state, tmp, &col_offset, arena);
17117
0
        _Py_LeaveRecursiveCall();
17118
0
        if (res != 0) goto failed;
17119
0
        Py_CLEAR(tmp);
17120
0
    }
17121
0
    if (PyObject_GetOptionalAttr(obj, state->end_lineno, &tmp) < 0) {
17122
0
        return -1;
17123
0
    }
17124
0
    if (tmp == NULL) {
17125
0
        PyErr_SetString(PyExc_TypeError, "required field \"end_lineno\" missing from pattern");
17126
0
        return -1;
17127
0
    }
17128
0
    else {
17129
0
        int res;
17130
0
        if (_Py_EnterRecursiveCall(" while traversing 'pattern' node")) {
17131
0
            goto failed;
17132
0
        }
17133
0
        res = obj2ast_int(state, tmp, &end_lineno, arena);
17134
0
        _Py_LeaveRecursiveCall();
17135
0
        if (res != 0) goto failed;
17136
0
        Py_CLEAR(tmp);
17137
0
    }
17138
0
    if (PyObject_GetOptionalAttr(obj, state->end_col_offset, &tmp) < 0) {
17139
0
        return -1;
17140
0
    }
17141
0
    if (tmp == NULL) {
17142
0
        PyErr_SetString(PyExc_TypeError, "required field \"end_col_offset\" missing from pattern");
17143
0
        return -1;
17144
0
    }
17145
0
    else {
17146
0
        int res;
17147
0
        if (_Py_EnterRecursiveCall(" while traversing 'pattern' node")) {
17148
0
            goto failed;
17149
0
        }
17150
0
        res = obj2ast_int(state, tmp, &end_col_offset, arena);
17151
0
        _Py_LeaveRecursiveCall();
17152
0
        if (res != 0) goto failed;
17153
0
        Py_CLEAR(tmp);
17154
0
    }
17155
0
    tp = state->MatchValue_type;
17156
0
    isinstance = PyObject_IsInstance(obj, tp);
17157
0
    if (isinstance == -1) {
17158
0
        return -1;
17159
0
    }
17160
0
    if (isinstance) {
17161
0
        expr_ty value;
17162
17163
0
        if (PyObject_GetOptionalAttr(obj, state->value, &tmp) < 0) {
17164
0
            return -1;
17165
0
        }
17166
0
        if (tmp == NULL) {
17167
0
            PyErr_SetString(PyExc_TypeError, "required field \"value\" missing from MatchValue");
17168
0
            return -1;
17169
0
        }
17170
0
        else {
17171
0
            int res;
17172
0
            if (_Py_EnterRecursiveCall(" while traversing 'MatchValue' node")) {
17173
0
                goto failed;
17174
0
            }
17175
0
            res = obj2ast_expr(state, tmp, &value, arena);
17176
0
            _Py_LeaveRecursiveCall();
17177
0
            if (res != 0) goto failed;
17178
0
            Py_CLEAR(tmp);
17179
0
        }
17180
0
        *out = _PyAST_MatchValue(value, lineno, col_offset, end_lineno,
17181
0
                                 end_col_offset, arena);
17182
0
        if (*out == NULL) goto failed;
17183
0
        return 0;
17184
0
    }
17185
0
    tp = state->MatchSingleton_type;
17186
0
    isinstance = PyObject_IsInstance(obj, tp);
17187
0
    if (isinstance == -1) {
17188
0
        return -1;
17189
0
    }
17190
0
    if (isinstance) {
17191
0
        constant value;
17192
17193
0
        if (PyObject_GetOptionalAttr(obj, state->value, &tmp) < 0) {
17194
0
            return -1;
17195
0
        }
17196
0
        if (tmp == NULL) {
17197
0
            PyErr_SetString(PyExc_TypeError, "required field \"value\" missing from MatchSingleton");
17198
0
            return -1;
17199
0
        }
17200
0
        else {
17201
0
            int res;
17202
0
            if (_Py_EnterRecursiveCall(" while traversing 'MatchSingleton' node")) {
17203
0
                goto failed;
17204
0
            }
17205
0
            res = obj2ast_constant(state, tmp, &value, arena);
17206
0
            _Py_LeaveRecursiveCall();
17207
0
            if (res != 0) goto failed;
17208
0
            Py_CLEAR(tmp);
17209
0
        }
17210
0
        *out = _PyAST_MatchSingleton(value, lineno, col_offset, end_lineno,
17211
0
                                     end_col_offset, arena);
17212
0
        if (*out == NULL) goto failed;
17213
0
        return 0;
17214
0
    }
17215
0
    tp = state->MatchSequence_type;
17216
0
    isinstance = PyObject_IsInstance(obj, tp);
17217
0
    if (isinstance == -1) {
17218
0
        return -1;
17219
0
    }
17220
0
    if (isinstance) {
17221
0
        asdl_pattern_seq* patterns;
17222
17223
0
        if (PyObject_GetOptionalAttr(obj, state->patterns, &tmp) < 0) {
17224
0
            return -1;
17225
0
        }
17226
0
        if (tmp == NULL) {
17227
0
            tmp = PyList_New(0);
17228
0
            if (tmp == NULL) {
17229
0
                return -1;
17230
0
            }
17231
0
        }
17232
0
        {
17233
0
            int res;
17234
0
            Py_ssize_t len;
17235
0
            Py_ssize_t i;
17236
0
            if (!PyList_Check(tmp)) {
17237
0
                PyErr_Format(PyExc_TypeError, "MatchSequence field \"patterns\" must be a list, not a %.200s", _PyType_Name(Py_TYPE(tmp)));
17238
0
                goto failed;
17239
0
            }
17240
0
            len = PyList_GET_SIZE(tmp);
17241
0
            patterns = _Py_asdl_pattern_seq_new(len, arena);
17242
0
            if (patterns == NULL) goto failed;
17243
0
            for (i = 0; i < len; i++) {
17244
0
                pattern_ty val;
17245
0
                PyObject *tmp2 = Py_NewRef(PyList_GET_ITEM(tmp, i));
17246
0
                if (_Py_EnterRecursiveCall(" while traversing 'MatchSequence' node")) {
17247
0
                    goto failed;
17248
0
                }
17249
0
                res = obj2ast_pattern(state, tmp2, &val, arena);
17250
0
                _Py_LeaveRecursiveCall();
17251
0
                Py_DECREF(tmp2);
17252
0
                if (res != 0) goto failed;
17253
0
                if (len != PyList_GET_SIZE(tmp)) {
17254
0
                    PyErr_SetString(PyExc_RuntimeError, "MatchSequence field \"patterns\" changed size during iteration");
17255
0
                    goto failed;
17256
0
                }
17257
0
                asdl_seq_SET(patterns, i, val);
17258
0
            }
17259
0
            Py_CLEAR(tmp);
17260
0
        }
17261
0
        *out = _PyAST_MatchSequence(patterns, lineno, col_offset, end_lineno,
17262
0
                                    end_col_offset, arena);
17263
0
        if (*out == NULL) goto failed;
17264
0
        return 0;
17265
0
    }
17266
0
    tp = state->MatchMapping_type;
17267
0
    isinstance = PyObject_IsInstance(obj, tp);
17268
0
    if (isinstance == -1) {
17269
0
        return -1;
17270
0
    }
17271
0
    if (isinstance) {
17272
0
        asdl_expr_seq* keys;
17273
0
        asdl_pattern_seq* patterns;
17274
0
        identifier rest;
17275
17276
0
        if (PyObject_GetOptionalAttr(obj, state->keys, &tmp) < 0) {
17277
0
            return -1;
17278
0
        }
17279
0
        if (tmp == NULL) {
17280
0
            tmp = PyList_New(0);
17281
0
            if (tmp == NULL) {
17282
0
                return -1;
17283
0
            }
17284
0
        }
17285
0
        {
17286
0
            int res;
17287
0
            Py_ssize_t len;
17288
0
            Py_ssize_t i;
17289
0
            if (!PyList_Check(tmp)) {
17290
0
                PyErr_Format(PyExc_TypeError, "MatchMapping field \"keys\" must be a list, not a %.200s", _PyType_Name(Py_TYPE(tmp)));
17291
0
                goto failed;
17292
0
            }
17293
0
            len = PyList_GET_SIZE(tmp);
17294
0
            keys = _Py_asdl_expr_seq_new(len, arena);
17295
0
            if (keys == NULL) goto failed;
17296
0
            for (i = 0; i < len; i++) {
17297
0
                expr_ty val;
17298
0
                PyObject *tmp2 = Py_NewRef(PyList_GET_ITEM(tmp, i));
17299
0
                if (_Py_EnterRecursiveCall(" while traversing 'MatchMapping' node")) {
17300
0
                    goto failed;
17301
0
                }
17302
0
                res = obj2ast_expr(state, tmp2, &val, arena);
17303
0
                _Py_LeaveRecursiveCall();
17304
0
                Py_DECREF(tmp2);
17305
0
                if (res != 0) goto failed;
17306
0
                if (len != PyList_GET_SIZE(tmp)) {
17307
0
                    PyErr_SetString(PyExc_RuntimeError, "MatchMapping field \"keys\" changed size during iteration");
17308
0
                    goto failed;
17309
0
                }
17310
0
                asdl_seq_SET(keys, i, val);
17311
0
            }
17312
0
            Py_CLEAR(tmp);
17313
0
        }
17314
0
        if (PyObject_GetOptionalAttr(obj, state->patterns, &tmp) < 0) {
17315
0
            return -1;
17316
0
        }
17317
0
        if (tmp == NULL) {
17318
0
            tmp = PyList_New(0);
17319
0
            if (tmp == NULL) {
17320
0
                return -1;
17321
0
            }
17322
0
        }
17323
0
        {
17324
0
            int res;
17325
0
            Py_ssize_t len;
17326
0
            Py_ssize_t i;
17327
0
            if (!PyList_Check(tmp)) {
17328
0
                PyErr_Format(PyExc_TypeError, "MatchMapping field \"patterns\" must be a list, not a %.200s", _PyType_Name(Py_TYPE(tmp)));
17329
0
                goto failed;
17330
0
            }
17331
0
            len = PyList_GET_SIZE(tmp);
17332
0
            patterns = _Py_asdl_pattern_seq_new(len, arena);
17333
0
            if (patterns == NULL) goto failed;
17334
0
            for (i = 0; i < len; i++) {
17335
0
                pattern_ty val;
17336
0
                PyObject *tmp2 = Py_NewRef(PyList_GET_ITEM(tmp, i));
17337
0
                if (_Py_EnterRecursiveCall(" while traversing 'MatchMapping' node")) {
17338
0
                    goto failed;
17339
0
                }
17340
0
                res = obj2ast_pattern(state, tmp2, &val, arena);
17341
0
                _Py_LeaveRecursiveCall();
17342
0
                Py_DECREF(tmp2);
17343
0
                if (res != 0) goto failed;
17344
0
                if (len != PyList_GET_SIZE(tmp)) {
17345
0
                    PyErr_SetString(PyExc_RuntimeError, "MatchMapping field \"patterns\" changed size during iteration");
17346
0
                    goto failed;
17347
0
                }
17348
0
                asdl_seq_SET(patterns, i, val);
17349
0
            }
17350
0
            Py_CLEAR(tmp);
17351
0
        }
17352
0
        if (PyObject_GetOptionalAttr(obj, state->rest, &tmp) < 0) {
17353
0
            return -1;
17354
0
        }
17355
0
        if (tmp == NULL || tmp == Py_None) {
17356
0
            Py_CLEAR(tmp);
17357
0
            rest = NULL;
17358
0
        }
17359
0
        else {
17360
0
            int res;
17361
0
            if (_Py_EnterRecursiveCall(" while traversing 'MatchMapping' node")) {
17362
0
                goto failed;
17363
0
            }
17364
0
            res = obj2ast_identifier(state, tmp, &rest, arena);
17365
0
            _Py_LeaveRecursiveCall();
17366
0
            if (res != 0) goto failed;
17367
0
            Py_CLEAR(tmp);
17368
0
        }
17369
0
        *out = _PyAST_MatchMapping(keys, patterns, rest, lineno, col_offset,
17370
0
                                   end_lineno, end_col_offset, arena);
17371
0
        if (*out == NULL) goto failed;
17372
0
        return 0;
17373
0
    }
17374
0
    tp = state->MatchClass_type;
17375
0
    isinstance = PyObject_IsInstance(obj, tp);
17376
0
    if (isinstance == -1) {
17377
0
        return -1;
17378
0
    }
17379
0
    if (isinstance) {
17380
0
        expr_ty cls;
17381
0
        asdl_pattern_seq* patterns;
17382
0
        asdl_identifier_seq* kwd_attrs;
17383
0
        asdl_pattern_seq* kwd_patterns;
17384
17385
0
        if (PyObject_GetOptionalAttr(obj, state->cls, &tmp) < 0) {
17386
0
            return -1;
17387
0
        }
17388
0
        if (tmp == NULL) {
17389
0
            PyErr_SetString(PyExc_TypeError, "required field \"cls\" missing from MatchClass");
17390
0
            return -1;
17391
0
        }
17392
0
        else {
17393
0
            int res;
17394
0
            if (_Py_EnterRecursiveCall(" while traversing 'MatchClass' node")) {
17395
0
                goto failed;
17396
0
            }
17397
0
            res = obj2ast_expr(state, tmp, &cls, arena);
17398
0
            _Py_LeaveRecursiveCall();
17399
0
            if (res != 0) goto failed;
17400
0
            Py_CLEAR(tmp);
17401
0
        }
17402
0
        if (PyObject_GetOptionalAttr(obj, state->patterns, &tmp) < 0) {
17403
0
            return -1;
17404
0
        }
17405
0
        if (tmp == NULL) {
17406
0
            tmp = PyList_New(0);
17407
0
            if (tmp == NULL) {
17408
0
                return -1;
17409
0
            }
17410
0
        }
17411
0
        {
17412
0
            int res;
17413
0
            Py_ssize_t len;
17414
0
            Py_ssize_t i;
17415
0
            if (!PyList_Check(tmp)) {
17416
0
                PyErr_Format(PyExc_TypeError, "MatchClass field \"patterns\" must be a list, not a %.200s", _PyType_Name(Py_TYPE(tmp)));
17417
0
                goto failed;
17418
0
            }
17419
0
            len = PyList_GET_SIZE(tmp);
17420
0
            patterns = _Py_asdl_pattern_seq_new(len, arena);
17421
0
            if (patterns == NULL) goto failed;
17422
0
            for (i = 0; i < len; i++) {
17423
0
                pattern_ty val;
17424
0
                PyObject *tmp2 = Py_NewRef(PyList_GET_ITEM(tmp, i));
17425
0
                if (_Py_EnterRecursiveCall(" while traversing 'MatchClass' node")) {
17426
0
                    goto failed;
17427
0
                }
17428
0
                res = obj2ast_pattern(state, tmp2, &val, arena);
17429
0
                _Py_LeaveRecursiveCall();
17430
0
                Py_DECREF(tmp2);
17431
0
                if (res != 0) goto failed;
17432
0
                if (len != PyList_GET_SIZE(tmp)) {
17433
0
                    PyErr_SetString(PyExc_RuntimeError, "MatchClass field \"patterns\" changed size during iteration");
17434
0
                    goto failed;
17435
0
                }
17436
0
                asdl_seq_SET(patterns, i, val);
17437
0
            }
17438
0
            Py_CLEAR(tmp);
17439
0
        }
17440
0
        if (PyObject_GetOptionalAttr(obj, state->kwd_attrs, &tmp) < 0) {
17441
0
            return -1;
17442
0
        }
17443
0
        if (tmp == NULL) {
17444
0
            tmp = PyList_New(0);
17445
0
            if (tmp == NULL) {
17446
0
                return -1;
17447
0
            }
17448
0
        }
17449
0
        {
17450
0
            int res;
17451
0
            Py_ssize_t len;
17452
0
            Py_ssize_t i;
17453
0
            if (!PyList_Check(tmp)) {
17454
0
                PyErr_Format(PyExc_TypeError, "MatchClass field \"kwd_attrs\" must be a list, not a %.200s", _PyType_Name(Py_TYPE(tmp)));
17455
0
                goto failed;
17456
0
            }
17457
0
            len = PyList_GET_SIZE(tmp);
17458
0
            kwd_attrs = _Py_asdl_identifier_seq_new(len, arena);
17459
0
            if (kwd_attrs == NULL) goto failed;
17460
0
            for (i = 0; i < len; i++) {
17461
0
                identifier val;
17462
0
                PyObject *tmp2 = Py_NewRef(PyList_GET_ITEM(tmp, i));
17463
0
                if (_Py_EnterRecursiveCall(" while traversing 'MatchClass' node")) {
17464
0
                    goto failed;
17465
0
                }
17466
0
                res = obj2ast_identifier(state, tmp2, &val, arena);
17467
0
                _Py_LeaveRecursiveCall();
17468
0
                Py_DECREF(tmp2);
17469
0
                if (res != 0) goto failed;
17470
0
                if (len != PyList_GET_SIZE(tmp)) {
17471
0
                    PyErr_SetString(PyExc_RuntimeError, "MatchClass field \"kwd_attrs\" changed size during iteration");
17472
0
                    goto failed;
17473
0
                }
17474
0
                asdl_seq_SET(kwd_attrs, i, val);
17475
0
            }
17476
0
            Py_CLEAR(tmp);
17477
0
        }
17478
0
        if (PyObject_GetOptionalAttr(obj, state->kwd_patterns, &tmp) < 0) {
17479
0
            return -1;
17480
0
        }
17481
0
        if (tmp == NULL) {
17482
0
            tmp = PyList_New(0);
17483
0
            if (tmp == NULL) {
17484
0
                return -1;
17485
0
            }
17486
0
        }
17487
0
        {
17488
0
            int res;
17489
0
            Py_ssize_t len;
17490
0
            Py_ssize_t i;
17491
0
            if (!PyList_Check(tmp)) {
17492
0
                PyErr_Format(PyExc_TypeError, "MatchClass field \"kwd_patterns\" must be a list, not a %.200s", _PyType_Name(Py_TYPE(tmp)));
17493
0
                goto failed;
17494
0
            }
17495
0
            len = PyList_GET_SIZE(tmp);
17496
0
            kwd_patterns = _Py_asdl_pattern_seq_new(len, arena);
17497
0
            if (kwd_patterns == NULL) goto failed;
17498
0
            for (i = 0; i < len; i++) {
17499
0
                pattern_ty val;
17500
0
                PyObject *tmp2 = Py_NewRef(PyList_GET_ITEM(tmp, i));
17501
0
                if (_Py_EnterRecursiveCall(" while traversing 'MatchClass' node")) {
17502
0
                    goto failed;
17503
0
                }
17504
0
                res = obj2ast_pattern(state, tmp2, &val, arena);
17505
0
                _Py_LeaveRecursiveCall();
17506
0
                Py_DECREF(tmp2);
17507
0
                if (res != 0) goto failed;
17508
0
                if (len != PyList_GET_SIZE(tmp)) {
17509
0
                    PyErr_SetString(PyExc_RuntimeError, "MatchClass field \"kwd_patterns\" changed size during iteration");
17510
0
                    goto failed;
17511
0
                }
17512
0
                asdl_seq_SET(kwd_patterns, i, val);
17513
0
            }
17514
0
            Py_CLEAR(tmp);
17515
0
        }
17516
0
        *out = _PyAST_MatchClass(cls, patterns, kwd_attrs, kwd_patterns,
17517
0
                                 lineno, col_offset, end_lineno,
17518
0
                                 end_col_offset, arena);
17519
0
        if (*out == NULL) goto failed;
17520
0
        return 0;
17521
0
    }
17522
0
    tp = state->MatchStar_type;
17523
0
    isinstance = PyObject_IsInstance(obj, tp);
17524
0
    if (isinstance == -1) {
17525
0
        return -1;
17526
0
    }
17527
0
    if (isinstance) {
17528
0
        identifier name;
17529
17530
0
        if (PyObject_GetOptionalAttr(obj, state->name, &tmp) < 0) {
17531
0
            return -1;
17532
0
        }
17533
0
        if (tmp == NULL || tmp == Py_None) {
17534
0
            Py_CLEAR(tmp);
17535
0
            name = NULL;
17536
0
        }
17537
0
        else {
17538
0
            int res;
17539
0
            if (_Py_EnterRecursiveCall(" while traversing 'MatchStar' node")) {
17540
0
                goto failed;
17541
0
            }
17542
0
            res = obj2ast_identifier(state, tmp, &name, arena);
17543
0
            _Py_LeaveRecursiveCall();
17544
0
            if (res != 0) goto failed;
17545
0
            Py_CLEAR(tmp);
17546
0
        }
17547
0
        *out = _PyAST_MatchStar(name, lineno, col_offset, end_lineno,
17548
0
                                end_col_offset, arena);
17549
0
        if (*out == NULL) goto failed;
17550
0
        return 0;
17551
0
    }
17552
0
    tp = state->MatchAs_type;
17553
0
    isinstance = PyObject_IsInstance(obj, tp);
17554
0
    if (isinstance == -1) {
17555
0
        return -1;
17556
0
    }
17557
0
    if (isinstance) {
17558
0
        pattern_ty pattern;
17559
0
        identifier name;
17560
17561
0
        if (PyObject_GetOptionalAttr(obj, state->pattern, &tmp) < 0) {
17562
0
            return -1;
17563
0
        }
17564
0
        if (tmp == NULL || tmp == Py_None) {
17565
0
            Py_CLEAR(tmp);
17566
0
            pattern = NULL;
17567
0
        }
17568
0
        else {
17569
0
            int res;
17570
0
            if (_Py_EnterRecursiveCall(" while traversing 'MatchAs' node")) {
17571
0
                goto failed;
17572
0
            }
17573
0
            res = obj2ast_pattern(state, tmp, &pattern, arena);
17574
0
            _Py_LeaveRecursiveCall();
17575
0
            if (res != 0) goto failed;
17576
0
            Py_CLEAR(tmp);
17577
0
        }
17578
0
        if (PyObject_GetOptionalAttr(obj, state->name, &tmp) < 0) {
17579
0
            return -1;
17580
0
        }
17581
0
        if (tmp == NULL || tmp == Py_None) {
17582
0
            Py_CLEAR(tmp);
17583
0
            name = NULL;
17584
0
        }
17585
0
        else {
17586
0
            int res;
17587
0
            if (_Py_EnterRecursiveCall(" while traversing 'MatchAs' node")) {
17588
0
                goto failed;
17589
0
            }
17590
0
            res = obj2ast_identifier(state, tmp, &name, arena);
17591
0
            _Py_LeaveRecursiveCall();
17592
0
            if (res != 0) goto failed;
17593
0
            Py_CLEAR(tmp);
17594
0
        }
17595
0
        *out = _PyAST_MatchAs(pattern, name, lineno, col_offset, end_lineno,
17596
0
                              end_col_offset, arena);
17597
0
        if (*out == NULL) goto failed;
17598
0
        return 0;
17599
0
    }
17600
0
    tp = state->MatchOr_type;
17601
0
    isinstance = PyObject_IsInstance(obj, tp);
17602
0
    if (isinstance == -1) {
17603
0
        return -1;
17604
0
    }
17605
0
    if (isinstance) {
17606
0
        asdl_pattern_seq* patterns;
17607
17608
0
        if (PyObject_GetOptionalAttr(obj, state->patterns, &tmp) < 0) {
17609
0
            return -1;
17610
0
        }
17611
0
        if (tmp == NULL) {
17612
0
            tmp = PyList_New(0);
17613
0
            if (tmp == NULL) {
17614
0
                return -1;
17615
0
            }
17616
0
        }
17617
0
        {
17618
0
            int res;
17619
0
            Py_ssize_t len;
17620
0
            Py_ssize_t i;
17621
0
            if (!PyList_Check(tmp)) {
17622
0
                PyErr_Format(PyExc_TypeError, "MatchOr field \"patterns\" must be a list, not a %.200s", _PyType_Name(Py_TYPE(tmp)));
17623
0
                goto failed;
17624
0
            }
17625
0
            len = PyList_GET_SIZE(tmp);
17626
0
            patterns = _Py_asdl_pattern_seq_new(len, arena);
17627
0
            if (patterns == NULL) goto failed;
17628
0
            for (i = 0; i < len; i++) {
17629
0
                pattern_ty val;
17630
0
                PyObject *tmp2 = Py_NewRef(PyList_GET_ITEM(tmp, i));
17631
0
                if (_Py_EnterRecursiveCall(" while traversing 'MatchOr' node")) {
17632
0
                    goto failed;
17633
0
                }
17634
0
                res = obj2ast_pattern(state, tmp2, &val, arena);
17635
0
                _Py_LeaveRecursiveCall();
17636
0
                Py_DECREF(tmp2);
17637
0
                if (res != 0) goto failed;
17638
0
                if (len != PyList_GET_SIZE(tmp)) {
17639
0
                    PyErr_SetString(PyExc_RuntimeError, "MatchOr field \"patterns\" changed size during iteration");
17640
0
                    goto failed;
17641
0
                }
17642
0
                asdl_seq_SET(patterns, i, val);
17643
0
            }
17644
0
            Py_CLEAR(tmp);
17645
0
        }
17646
0
        *out = _PyAST_MatchOr(patterns, lineno, col_offset, end_lineno,
17647
0
                              end_col_offset, arena);
17648
0
        if (*out == NULL) goto failed;
17649
0
        return 0;
17650
0
    }
17651
17652
0
    PyErr_Format(PyExc_TypeError, "expected some sort of pattern, but got %R", obj);
17653
0
    failed:
17654
0
    Py_XDECREF(tmp);
17655
0
    return -1;
17656
0
}
17657
17658
int
17659
obj2ast_type_ignore(struct ast_state *state, PyObject* obj, type_ignore_ty*
17660
                    out, PyArena* arena)
17661
0
{
17662
0
    int isinstance;
17663
17664
0
    PyObject *tmp = NULL;
17665
0
    PyObject *tp;
17666
17667
0
    if (obj == Py_None) {
17668
0
        *out = NULL;
17669
0
        return 0;
17670
0
    }
17671
0
    tp = state->TypeIgnore_type;
17672
0
    isinstance = PyObject_IsInstance(obj, tp);
17673
0
    if (isinstance == -1) {
17674
0
        return -1;
17675
0
    }
17676
0
    if (isinstance) {
17677
0
        int lineno;
17678
0
        string tag;
17679
17680
0
        if (PyObject_GetOptionalAttr(obj, state->lineno, &tmp) < 0) {
17681
0
            return -1;
17682
0
        }
17683
0
        if (tmp == NULL) {
17684
0
            PyErr_SetString(PyExc_TypeError, "required field \"lineno\" missing from TypeIgnore");
17685
0
            return -1;
17686
0
        }
17687
0
        else {
17688
0
            int res;
17689
0
            if (_Py_EnterRecursiveCall(" while traversing 'TypeIgnore' node")) {
17690
0
                goto failed;
17691
0
            }
17692
0
            res = obj2ast_int(state, tmp, &lineno, arena);
17693
0
            _Py_LeaveRecursiveCall();
17694
0
            if (res != 0) goto failed;
17695
0
            Py_CLEAR(tmp);
17696
0
        }
17697
0
        if (PyObject_GetOptionalAttr(obj, state->tag, &tmp) < 0) {
17698
0
            return -1;
17699
0
        }
17700
0
        if (tmp == NULL) {
17701
0
            PyErr_SetString(PyExc_TypeError, "required field \"tag\" missing from TypeIgnore");
17702
0
            return -1;
17703
0
        }
17704
0
        else {
17705
0
            int res;
17706
0
            if (_Py_EnterRecursiveCall(" while traversing 'TypeIgnore' node")) {
17707
0
                goto failed;
17708
0
            }
17709
0
            res = obj2ast_string(state, tmp, &tag, arena);
17710
0
            _Py_LeaveRecursiveCall();
17711
0
            if (res != 0) goto failed;
17712
0
            Py_CLEAR(tmp);
17713
0
        }
17714
0
        *out = _PyAST_TypeIgnore(lineno, tag, arena);
17715
0
        if (*out == NULL) goto failed;
17716
0
        return 0;
17717
0
    }
17718
17719
0
    PyErr_Format(PyExc_TypeError, "expected some sort of type_ignore, but got %R", obj);
17720
0
    failed:
17721
0
    Py_XDECREF(tmp);
17722
0
    return -1;
17723
0
}
17724
17725
int
17726
obj2ast_type_param(struct ast_state *state, PyObject* obj, type_param_ty* out,
17727
                   PyArena* arena)
17728
0
{
17729
0
    int isinstance;
17730
17731
0
    PyObject *tmp = NULL;
17732
0
    PyObject *tp;
17733
0
    int lineno;
17734
0
    int col_offset;
17735
0
    int end_lineno;
17736
0
    int end_col_offset;
17737
17738
0
    if (obj == Py_None) {
17739
0
        *out = NULL;
17740
0
        return 0;
17741
0
    }
17742
0
    if (PyObject_GetOptionalAttr(obj, state->lineno, &tmp) < 0) {
17743
0
        return -1;
17744
0
    }
17745
0
    if (tmp == NULL) {
17746
0
        PyErr_SetString(PyExc_TypeError, "required field \"lineno\" missing from type_param");
17747
0
        return -1;
17748
0
    }
17749
0
    else {
17750
0
        int res;
17751
0
        if (_Py_EnterRecursiveCall(" while traversing 'type_param' node")) {
17752
0
            goto failed;
17753
0
        }
17754
0
        res = obj2ast_int(state, tmp, &lineno, arena);
17755
0
        _Py_LeaveRecursiveCall();
17756
0
        if (res != 0) goto failed;
17757
0
        Py_CLEAR(tmp);
17758
0
    }
17759
0
    if (PyObject_GetOptionalAttr(obj, state->col_offset, &tmp) < 0) {
17760
0
        return -1;
17761
0
    }
17762
0
    if (tmp == NULL) {
17763
0
        PyErr_SetString(PyExc_TypeError, "required field \"col_offset\" missing from type_param");
17764
0
        return -1;
17765
0
    }
17766
0
    else {
17767
0
        int res;
17768
0
        if (_Py_EnterRecursiveCall(" while traversing 'type_param' node")) {
17769
0
            goto failed;
17770
0
        }
17771
0
        res = obj2ast_int(state, tmp, &col_offset, arena);
17772
0
        _Py_LeaveRecursiveCall();
17773
0
        if (res != 0) goto failed;
17774
0
        Py_CLEAR(tmp);
17775
0
    }
17776
0
    if (PyObject_GetOptionalAttr(obj, state->end_lineno, &tmp) < 0) {
17777
0
        return -1;
17778
0
    }
17779
0
    if (tmp == NULL) {
17780
0
        PyErr_SetString(PyExc_TypeError, "required field \"end_lineno\" missing from type_param");
17781
0
        return -1;
17782
0
    }
17783
0
    else {
17784
0
        int res;
17785
0
        if (_Py_EnterRecursiveCall(" while traversing 'type_param' node")) {
17786
0
            goto failed;
17787
0
        }
17788
0
        res = obj2ast_int(state, tmp, &end_lineno, arena);
17789
0
        _Py_LeaveRecursiveCall();
17790
0
        if (res != 0) goto failed;
17791
0
        Py_CLEAR(tmp);
17792
0
    }
17793
0
    if (PyObject_GetOptionalAttr(obj, state->end_col_offset, &tmp) < 0) {
17794
0
        return -1;
17795
0
    }
17796
0
    if (tmp == NULL) {
17797
0
        PyErr_SetString(PyExc_TypeError, "required field \"end_col_offset\" missing from type_param");
17798
0
        return -1;
17799
0
    }
17800
0
    else {
17801
0
        int res;
17802
0
        if (_Py_EnterRecursiveCall(" while traversing 'type_param' node")) {
17803
0
            goto failed;
17804
0
        }
17805
0
        res = obj2ast_int(state, tmp, &end_col_offset, arena);
17806
0
        _Py_LeaveRecursiveCall();
17807
0
        if (res != 0) goto failed;
17808
0
        Py_CLEAR(tmp);
17809
0
    }
17810
0
    tp = state->TypeVar_type;
17811
0
    isinstance = PyObject_IsInstance(obj, tp);
17812
0
    if (isinstance == -1) {
17813
0
        return -1;
17814
0
    }
17815
0
    if (isinstance) {
17816
0
        identifier name;
17817
0
        expr_ty bound;
17818
0
        expr_ty default_value;
17819
17820
0
        if (PyObject_GetOptionalAttr(obj, state->name, &tmp) < 0) {
17821
0
            return -1;
17822
0
        }
17823
0
        if (tmp == NULL) {
17824
0
            PyErr_SetString(PyExc_TypeError, "required field \"name\" missing from TypeVar");
17825
0
            return -1;
17826
0
        }
17827
0
        else {
17828
0
            int res;
17829
0
            if (_Py_EnterRecursiveCall(" while traversing 'TypeVar' node")) {
17830
0
                goto failed;
17831
0
            }
17832
0
            res = obj2ast_identifier(state, tmp, &name, arena);
17833
0
            _Py_LeaveRecursiveCall();
17834
0
            if (res != 0) goto failed;
17835
0
            Py_CLEAR(tmp);
17836
0
        }
17837
0
        if (PyObject_GetOptionalAttr(obj, state->bound, &tmp) < 0) {
17838
0
            return -1;
17839
0
        }
17840
0
        if (tmp == NULL || tmp == Py_None) {
17841
0
            Py_CLEAR(tmp);
17842
0
            bound = NULL;
17843
0
        }
17844
0
        else {
17845
0
            int res;
17846
0
            if (_Py_EnterRecursiveCall(" while traversing 'TypeVar' node")) {
17847
0
                goto failed;
17848
0
            }
17849
0
            res = obj2ast_expr(state, tmp, &bound, arena);
17850
0
            _Py_LeaveRecursiveCall();
17851
0
            if (res != 0) goto failed;
17852
0
            Py_CLEAR(tmp);
17853
0
        }
17854
0
        if (PyObject_GetOptionalAttr(obj, state->default_value, &tmp) < 0) {
17855
0
            return -1;
17856
0
        }
17857
0
        if (tmp == NULL || tmp == Py_None) {
17858
0
            Py_CLEAR(tmp);
17859
0
            default_value = NULL;
17860
0
        }
17861
0
        else {
17862
0
            int res;
17863
0
            if (_Py_EnterRecursiveCall(" while traversing 'TypeVar' node")) {
17864
0
                goto failed;
17865
0
            }
17866
0
            res = obj2ast_expr(state, tmp, &default_value, arena);
17867
0
            _Py_LeaveRecursiveCall();
17868
0
            if (res != 0) goto failed;
17869
0
            Py_CLEAR(tmp);
17870
0
        }
17871
0
        *out = _PyAST_TypeVar(name, bound, default_value, lineno, col_offset,
17872
0
                              end_lineno, end_col_offset, arena);
17873
0
        if (*out == NULL) goto failed;
17874
0
        return 0;
17875
0
    }
17876
0
    tp = state->ParamSpec_type;
17877
0
    isinstance = PyObject_IsInstance(obj, tp);
17878
0
    if (isinstance == -1) {
17879
0
        return -1;
17880
0
    }
17881
0
    if (isinstance) {
17882
0
        identifier name;
17883
0
        expr_ty default_value;
17884
17885
0
        if (PyObject_GetOptionalAttr(obj, state->name, &tmp) < 0) {
17886
0
            return -1;
17887
0
        }
17888
0
        if (tmp == NULL) {
17889
0
            PyErr_SetString(PyExc_TypeError, "required field \"name\" missing from ParamSpec");
17890
0
            return -1;
17891
0
        }
17892
0
        else {
17893
0
            int res;
17894
0
            if (_Py_EnterRecursiveCall(" while traversing 'ParamSpec' node")) {
17895
0
                goto failed;
17896
0
            }
17897
0
            res = obj2ast_identifier(state, tmp, &name, arena);
17898
0
            _Py_LeaveRecursiveCall();
17899
0
            if (res != 0) goto failed;
17900
0
            Py_CLEAR(tmp);
17901
0
        }
17902
0
        if (PyObject_GetOptionalAttr(obj, state->default_value, &tmp) < 0) {
17903
0
            return -1;
17904
0
        }
17905
0
        if (tmp == NULL || tmp == Py_None) {
17906
0
            Py_CLEAR(tmp);
17907
0
            default_value = NULL;
17908
0
        }
17909
0
        else {
17910
0
            int res;
17911
0
            if (_Py_EnterRecursiveCall(" while traversing 'ParamSpec' node")) {
17912
0
                goto failed;
17913
0
            }
17914
0
            res = obj2ast_expr(state, tmp, &default_value, arena);
17915
0
            _Py_LeaveRecursiveCall();
17916
0
            if (res != 0) goto failed;
17917
0
            Py_CLEAR(tmp);
17918
0
        }
17919
0
        *out = _PyAST_ParamSpec(name, default_value, lineno, col_offset,
17920
0
                                end_lineno, end_col_offset, arena);
17921
0
        if (*out == NULL) goto failed;
17922
0
        return 0;
17923
0
    }
17924
0
    tp = state->TypeVarTuple_type;
17925
0
    isinstance = PyObject_IsInstance(obj, tp);
17926
0
    if (isinstance == -1) {
17927
0
        return -1;
17928
0
    }
17929
0
    if (isinstance) {
17930
0
        identifier name;
17931
0
        expr_ty default_value;
17932
17933
0
        if (PyObject_GetOptionalAttr(obj, state->name, &tmp) < 0) {
17934
0
            return -1;
17935
0
        }
17936
0
        if (tmp == NULL) {
17937
0
            PyErr_SetString(PyExc_TypeError, "required field \"name\" missing from TypeVarTuple");
17938
0
            return -1;
17939
0
        }
17940
0
        else {
17941
0
            int res;
17942
0
            if (_Py_EnterRecursiveCall(" while traversing 'TypeVarTuple' node")) {
17943
0
                goto failed;
17944
0
            }
17945
0
            res = obj2ast_identifier(state, tmp, &name, arena);
17946
0
            _Py_LeaveRecursiveCall();
17947
0
            if (res != 0) goto failed;
17948
0
            Py_CLEAR(tmp);
17949
0
        }
17950
0
        if (PyObject_GetOptionalAttr(obj, state->default_value, &tmp) < 0) {
17951
0
            return -1;
17952
0
        }
17953
0
        if (tmp == NULL || tmp == Py_None) {
17954
0
            Py_CLEAR(tmp);
17955
0
            default_value = NULL;
17956
0
        }
17957
0
        else {
17958
0
            int res;
17959
0
            if (_Py_EnterRecursiveCall(" while traversing 'TypeVarTuple' node")) {
17960
0
                goto failed;
17961
0
            }
17962
0
            res = obj2ast_expr(state, tmp, &default_value, arena);
17963
0
            _Py_LeaveRecursiveCall();
17964
0
            if (res != 0) goto failed;
17965
0
            Py_CLEAR(tmp);
17966
0
        }
17967
0
        *out = _PyAST_TypeVarTuple(name, default_value, lineno, col_offset,
17968
0
                                   end_lineno, end_col_offset, arena);
17969
0
        if (*out == NULL) goto failed;
17970
0
        return 0;
17971
0
    }
17972
17973
0
    PyErr_Format(PyExc_TypeError, "expected some sort of type_param, but got %R", obj);
17974
0
    failed:
17975
0
    Py_XDECREF(tmp);
17976
0
    return -1;
17977
0
}
17978
17979
17980
static int
17981
astmodule_exec(PyObject *m)
17982
4
{
17983
4
    struct ast_state *state = get_ast_state();
17984
4
    if (state == NULL) {
17985
0
        return -1;
17986
0
    }
17987
4
    if (PyModule_AddObjectRef(m, "AST", state->AST_type) < 0) {
17988
0
        return -1;
17989
0
    }
17990
4
    if (PyModule_AddIntMacro(m, PyCF_ALLOW_TOP_LEVEL_AWAIT) < 0) {
17991
0
        return -1;
17992
0
    }
17993
4
    if (PyModule_AddIntMacro(m, PyCF_ONLY_AST) < 0) {
17994
0
        return -1;
17995
0
    }
17996
4
    if (PyModule_AddIntMacro(m, PyCF_TYPE_COMMENTS) < 0) {
17997
0
        return -1;
17998
0
    }
17999
4
    if (PyModule_AddIntMacro(m, PyCF_OPTIMIZED_AST) < 0) {
18000
0
        return -1;
18001
0
    }
18002
4
    if (PyModule_AddObjectRef(m, "mod", state->mod_type) < 0) {
18003
0
        return -1;
18004
0
    }
18005
4
    if (PyModule_AddObjectRef(m, "Module", state->Module_type) < 0) {
18006
0
        return -1;
18007
0
    }
18008
4
    if (PyModule_AddObjectRef(m, "Interactive", state->Interactive_type) < 0) {
18009
0
        return -1;
18010
0
    }
18011
4
    if (PyModule_AddObjectRef(m, "Expression", state->Expression_type) < 0) {
18012
0
        return -1;
18013
0
    }
18014
4
    if (PyModule_AddObjectRef(m, "FunctionType", state->FunctionType_type) < 0)
18015
0
        {
18016
0
        return -1;
18017
0
    }
18018
4
    if (PyModule_AddObjectRef(m, "stmt", state->stmt_type) < 0) {
18019
0
        return -1;
18020
0
    }
18021
4
    if (PyModule_AddObjectRef(m, "FunctionDef", state->FunctionDef_type) < 0) {
18022
0
        return -1;
18023
0
    }
18024
4
    if (PyModule_AddObjectRef(m, "AsyncFunctionDef",
18025
4
        state->AsyncFunctionDef_type) < 0) {
18026
0
        return -1;
18027
0
    }
18028
4
    if (PyModule_AddObjectRef(m, "ClassDef", state->ClassDef_type) < 0) {
18029
0
        return -1;
18030
0
    }
18031
4
    if (PyModule_AddObjectRef(m, "Return", state->Return_type) < 0) {
18032
0
        return -1;
18033
0
    }
18034
4
    if (PyModule_AddObjectRef(m, "Delete", state->Delete_type) < 0) {
18035
0
        return -1;
18036
0
    }
18037
4
    if (PyModule_AddObjectRef(m, "Assign", state->Assign_type) < 0) {
18038
0
        return -1;
18039
0
    }
18040
4
    if (PyModule_AddObjectRef(m, "TypeAlias", state->TypeAlias_type) < 0) {
18041
0
        return -1;
18042
0
    }
18043
4
    if (PyModule_AddObjectRef(m, "AugAssign", state->AugAssign_type) < 0) {
18044
0
        return -1;
18045
0
    }
18046
4
    if (PyModule_AddObjectRef(m, "AnnAssign", state->AnnAssign_type) < 0) {
18047
0
        return -1;
18048
0
    }
18049
4
    if (PyModule_AddObjectRef(m, "For", state->For_type) < 0) {
18050
0
        return -1;
18051
0
    }
18052
4
    if (PyModule_AddObjectRef(m, "AsyncFor", state->AsyncFor_type) < 0) {
18053
0
        return -1;
18054
0
    }
18055
4
    if (PyModule_AddObjectRef(m, "While", state->While_type) < 0) {
18056
0
        return -1;
18057
0
    }
18058
4
    if (PyModule_AddObjectRef(m, "If", state->If_type) < 0) {
18059
0
        return -1;
18060
0
    }
18061
4
    if (PyModule_AddObjectRef(m, "With", state->With_type) < 0) {
18062
0
        return -1;
18063
0
    }
18064
4
    if (PyModule_AddObjectRef(m, "AsyncWith", state->AsyncWith_type) < 0) {
18065
0
        return -1;
18066
0
    }
18067
4
    if (PyModule_AddObjectRef(m, "Match", state->Match_type) < 0) {
18068
0
        return -1;
18069
0
    }
18070
4
    if (PyModule_AddObjectRef(m, "Raise", state->Raise_type) < 0) {
18071
0
        return -1;
18072
0
    }
18073
4
    if (PyModule_AddObjectRef(m, "Try", state->Try_type) < 0) {
18074
0
        return -1;
18075
0
    }
18076
4
    if (PyModule_AddObjectRef(m, "TryStar", state->TryStar_type) < 0) {
18077
0
        return -1;
18078
0
    }
18079
4
    if (PyModule_AddObjectRef(m, "Assert", state->Assert_type) < 0) {
18080
0
        return -1;
18081
0
    }
18082
4
    if (PyModule_AddObjectRef(m, "Import", state->Import_type) < 0) {
18083
0
        return -1;
18084
0
    }
18085
4
    if (PyModule_AddObjectRef(m, "ImportFrom", state->ImportFrom_type) < 0) {
18086
0
        return -1;
18087
0
    }
18088
4
    if (PyModule_AddObjectRef(m, "Global", state->Global_type) < 0) {
18089
0
        return -1;
18090
0
    }
18091
4
    if (PyModule_AddObjectRef(m, "Nonlocal", state->Nonlocal_type) < 0) {
18092
0
        return -1;
18093
0
    }
18094
4
    if (PyModule_AddObjectRef(m, "Expr", state->Expr_type) < 0) {
18095
0
        return -1;
18096
0
    }
18097
4
    if (PyModule_AddObjectRef(m, "Pass", state->Pass_type) < 0) {
18098
0
        return -1;
18099
0
    }
18100
4
    if (PyModule_AddObjectRef(m, "Break", state->Break_type) < 0) {
18101
0
        return -1;
18102
0
    }
18103
4
    if (PyModule_AddObjectRef(m, "Continue", state->Continue_type) < 0) {
18104
0
        return -1;
18105
0
    }
18106
4
    if (PyModule_AddObjectRef(m, "expr", state->expr_type) < 0) {
18107
0
        return -1;
18108
0
    }
18109
4
    if (PyModule_AddObjectRef(m, "BoolOp", state->BoolOp_type) < 0) {
18110
0
        return -1;
18111
0
    }
18112
4
    if (PyModule_AddObjectRef(m, "NamedExpr", state->NamedExpr_type) < 0) {
18113
0
        return -1;
18114
0
    }
18115
4
    if (PyModule_AddObjectRef(m, "BinOp", state->BinOp_type) < 0) {
18116
0
        return -1;
18117
0
    }
18118
4
    if (PyModule_AddObjectRef(m, "UnaryOp", state->UnaryOp_type) < 0) {
18119
0
        return -1;
18120
0
    }
18121
4
    if (PyModule_AddObjectRef(m, "Lambda", state->Lambda_type) < 0) {
18122
0
        return -1;
18123
0
    }
18124
4
    if (PyModule_AddObjectRef(m, "IfExp", state->IfExp_type) < 0) {
18125
0
        return -1;
18126
0
    }
18127
4
    if (PyModule_AddObjectRef(m, "Dict", state->Dict_type) < 0) {
18128
0
        return -1;
18129
0
    }
18130
4
    if (PyModule_AddObjectRef(m, "Set", state->Set_type) < 0) {
18131
0
        return -1;
18132
0
    }
18133
4
    if (PyModule_AddObjectRef(m, "ListComp", state->ListComp_type) < 0) {
18134
0
        return -1;
18135
0
    }
18136
4
    if (PyModule_AddObjectRef(m, "SetComp", state->SetComp_type) < 0) {
18137
0
        return -1;
18138
0
    }
18139
4
    if (PyModule_AddObjectRef(m, "DictComp", state->DictComp_type) < 0) {
18140
0
        return -1;
18141
0
    }
18142
4
    if (PyModule_AddObjectRef(m, "GeneratorExp", state->GeneratorExp_type) < 0)
18143
0
        {
18144
0
        return -1;
18145
0
    }
18146
4
    if (PyModule_AddObjectRef(m, "Await", state->Await_type) < 0) {
18147
0
        return -1;
18148
0
    }
18149
4
    if (PyModule_AddObjectRef(m, "Yield", state->Yield_type) < 0) {
18150
0
        return -1;
18151
0
    }
18152
4
    if (PyModule_AddObjectRef(m, "YieldFrom", state->YieldFrom_type) < 0) {
18153
0
        return -1;
18154
0
    }
18155
4
    if (PyModule_AddObjectRef(m, "Compare", state->Compare_type) < 0) {
18156
0
        return -1;
18157
0
    }
18158
4
    if (PyModule_AddObjectRef(m, "Call", state->Call_type) < 0) {
18159
0
        return -1;
18160
0
    }
18161
4
    if (PyModule_AddObjectRef(m, "FormattedValue", state->FormattedValue_type)
18162
4
        < 0) {
18163
0
        return -1;
18164
0
    }
18165
4
    if (PyModule_AddObjectRef(m, "Interpolation", state->Interpolation_type) <
18166
4
        0) {
18167
0
        return -1;
18168
0
    }
18169
4
    if (PyModule_AddObjectRef(m, "JoinedStr", state->JoinedStr_type) < 0) {
18170
0
        return -1;
18171
0
    }
18172
4
    if (PyModule_AddObjectRef(m, "TemplateStr", state->TemplateStr_type) < 0) {
18173
0
        return -1;
18174
0
    }
18175
4
    if (PyModule_AddObjectRef(m, "Constant", state->Constant_type) < 0) {
18176
0
        return -1;
18177
0
    }
18178
4
    if (PyModule_AddObjectRef(m, "Attribute", state->Attribute_type) < 0) {
18179
0
        return -1;
18180
0
    }
18181
4
    if (PyModule_AddObjectRef(m, "Subscript", state->Subscript_type) < 0) {
18182
0
        return -1;
18183
0
    }
18184
4
    if (PyModule_AddObjectRef(m, "Starred", state->Starred_type) < 0) {
18185
0
        return -1;
18186
0
    }
18187
4
    if (PyModule_AddObjectRef(m, "Name", state->Name_type) < 0) {
18188
0
        return -1;
18189
0
    }
18190
4
    if (PyModule_AddObjectRef(m, "List", state->List_type) < 0) {
18191
0
        return -1;
18192
0
    }
18193
4
    if (PyModule_AddObjectRef(m, "Tuple", state->Tuple_type) < 0) {
18194
0
        return -1;
18195
0
    }
18196
4
    if (PyModule_AddObjectRef(m, "Slice", state->Slice_type) < 0) {
18197
0
        return -1;
18198
0
    }
18199
4
    if (PyModule_AddObjectRef(m, "expr_context", state->expr_context_type) < 0)
18200
0
        {
18201
0
        return -1;
18202
0
    }
18203
4
    if (PyModule_AddObjectRef(m, "Load", state->Load_type) < 0) {
18204
0
        return -1;
18205
0
    }
18206
4
    if (PyModule_AddObjectRef(m, "Store", state->Store_type) < 0) {
18207
0
        return -1;
18208
0
    }
18209
4
    if (PyModule_AddObjectRef(m, "Del", state->Del_type) < 0) {
18210
0
        return -1;
18211
0
    }
18212
4
    if (PyModule_AddObjectRef(m, "boolop", state->boolop_type) < 0) {
18213
0
        return -1;
18214
0
    }
18215
4
    if (PyModule_AddObjectRef(m, "And", state->And_type) < 0) {
18216
0
        return -1;
18217
0
    }
18218
4
    if (PyModule_AddObjectRef(m, "Or", state->Or_type) < 0) {
18219
0
        return -1;
18220
0
    }
18221
4
    if (PyModule_AddObjectRef(m, "operator", state->operator_type) < 0) {
18222
0
        return -1;
18223
0
    }
18224
4
    if (PyModule_AddObjectRef(m, "Add", state->Add_type) < 0) {
18225
0
        return -1;
18226
0
    }
18227
4
    if (PyModule_AddObjectRef(m, "Sub", state->Sub_type) < 0) {
18228
0
        return -1;
18229
0
    }
18230
4
    if (PyModule_AddObjectRef(m, "Mult", state->Mult_type) < 0) {
18231
0
        return -1;
18232
0
    }
18233
4
    if (PyModule_AddObjectRef(m, "MatMult", state->MatMult_type) < 0) {
18234
0
        return -1;
18235
0
    }
18236
4
    if (PyModule_AddObjectRef(m, "Div", state->Div_type) < 0) {
18237
0
        return -1;
18238
0
    }
18239
4
    if (PyModule_AddObjectRef(m, "Mod", state->Mod_type) < 0) {
18240
0
        return -1;
18241
0
    }
18242
4
    if (PyModule_AddObjectRef(m, "Pow", state->Pow_type) < 0) {
18243
0
        return -1;
18244
0
    }
18245
4
    if (PyModule_AddObjectRef(m, "LShift", state->LShift_type) < 0) {
18246
0
        return -1;
18247
0
    }
18248
4
    if (PyModule_AddObjectRef(m, "RShift", state->RShift_type) < 0) {
18249
0
        return -1;
18250
0
    }
18251
4
    if (PyModule_AddObjectRef(m, "BitOr", state->BitOr_type) < 0) {
18252
0
        return -1;
18253
0
    }
18254
4
    if (PyModule_AddObjectRef(m, "BitXor", state->BitXor_type) < 0) {
18255
0
        return -1;
18256
0
    }
18257
4
    if (PyModule_AddObjectRef(m, "BitAnd", state->BitAnd_type) < 0) {
18258
0
        return -1;
18259
0
    }
18260
4
    if (PyModule_AddObjectRef(m, "FloorDiv", state->FloorDiv_type) < 0) {
18261
0
        return -1;
18262
0
    }
18263
4
    if (PyModule_AddObjectRef(m, "unaryop", state->unaryop_type) < 0) {
18264
0
        return -1;
18265
0
    }
18266
4
    if (PyModule_AddObjectRef(m, "Invert", state->Invert_type) < 0) {
18267
0
        return -1;
18268
0
    }
18269
4
    if (PyModule_AddObjectRef(m, "Not", state->Not_type) < 0) {
18270
0
        return -1;
18271
0
    }
18272
4
    if (PyModule_AddObjectRef(m, "UAdd", state->UAdd_type) < 0) {
18273
0
        return -1;
18274
0
    }
18275
4
    if (PyModule_AddObjectRef(m, "USub", state->USub_type) < 0) {
18276
0
        return -1;
18277
0
    }
18278
4
    if (PyModule_AddObjectRef(m, "cmpop", state->cmpop_type) < 0) {
18279
0
        return -1;
18280
0
    }
18281
4
    if (PyModule_AddObjectRef(m, "Eq", state->Eq_type) < 0) {
18282
0
        return -1;
18283
0
    }
18284
4
    if (PyModule_AddObjectRef(m, "NotEq", state->NotEq_type) < 0) {
18285
0
        return -1;
18286
0
    }
18287
4
    if (PyModule_AddObjectRef(m, "Lt", state->Lt_type) < 0) {
18288
0
        return -1;
18289
0
    }
18290
4
    if (PyModule_AddObjectRef(m, "LtE", state->LtE_type) < 0) {
18291
0
        return -1;
18292
0
    }
18293
4
    if (PyModule_AddObjectRef(m, "Gt", state->Gt_type) < 0) {
18294
0
        return -1;
18295
0
    }
18296
4
    if (PyModule_AddObjectRef(m, "GtE", state->GtE_type) < 0) {
18297
0
        return -1;
18298
0
    }
18299
4
    if (PyModule_AddObjectRef(m, "Is", state->Is_type) < 0) {
18300
0
        return -1;
18301
0
    }
18302
4
    if (PyModule_AddObjectRef(m, "IsNot", state->IsNot_type) < 0) {
18303
0
        return -1;
18304
0
    }
18305
4
    if (PyModule_AddObjectRef(m, "In", state->In_type) < 0) {
18306
0
        return -1;
18307
0
    }
18308
4
    if (PyModule_AddObjectRef(m, "NotIn", state->NotIn_type) < 0) {
18309
0
        return -1;
18310
0
    }
18311
4
    if (PyModule_AddObjectRef(m, "comprehension", state->comprehension_type) <
18312
4
        0) {
18313
0
        return -1;
18314
0
    }
18315
4
    if (PyModule_AddObjectRef(m, "excepthandler", state->excepthandler_type) <
18316
4
        0) {
18317
0
        return -1;
18318
0
    }
18319
4
    if (PyModule_AddObjectRef(m, "ExceptHandler", state->ExceptHandler_type) <
18320
4
        0) {
18321
0
        return -1;
18322
0
    }
18323
4
    if (PyModule_AddObjectRef(m, "arguments", state->arguments_type) < 0) {
18324
0
        return -1;
18325
0
    }
18326
4
    if (PyModule_AddObjectRef(m, "arg", state->arg_type) < 0) {
18327
0
        return -1;
18328
0
    }
18329
4
    if (PyModule_AddObjectRef(m, "keyword", state->keyword_type) < 0) {
18330
0
        return -1;
18331
0
    }
18332
4
    if (PyModule_AddObjectRef(m, "alias", state->alias_type) < 0) {
18333
0
        return -1;
18334
0
    }
18335
4
    if (PyModule_AddObjectRef(m, "withitem", state->withitem_type) < 0) {
18336
0
        return -1;
18337
0
    }
18338
4
    if (PyModule_AddObjectRef(m, "match_case", state->match_case_type) < 0) {
18339
0
        return -1;
18340
0
    }
18341
4
    if (PyModule_AddObjectRef(m, "pattern", state->pattern_type) < 0) {
18342
0
        return -1;
18343
0
    }
18344
4
    if (PyModule_AddObjectRef(m, "MatchValue", state->MatchValue_type) < 0) {
18345
0
        return -1;
18346
0
    }
18347
4
    if (PyModule_AddObjectRef(m, "MatchSingleton", state->MatchSingleton_type)
18348
4
        < 0) {
18349
0
        return -1;
18350
0
    }
18351
4
    if (PyModule_AddObjectRef(m, "MatchSequence", state->MatchSequence_type) <
18352
4
        0) {
18353
0
        return -1;
18354
0
    }
18355
4
    if (PyModule_AddObjectRef(m, "MatchMapping", state->MatchMapping_type) < 0)
18356
0
        {
18357
0
        return -1;
18358
0
    }
18359
4
    if (PyModule_AddObjectRef(m, "MatchClass", state->MatchClass_type) < 0) {
18360
0
        return -1;
18361
0
    }
18362
4
    if (PyModule_AddObjectRef(m, "MatchStar", state->MatchStar_type) < 0) {
18363
0
        return -1;
18364
0
    }
18365
4
    if (PyModule_AddObjectRef(m, "MatchAs", state->MatchAs_type) < 0) {
18366
0
        return -1;
18367
0
    }
18368
4
    if (PyModule_AddObjectRef(m, "MatchOr", state->MatchOr_type) < 0) {
18369
0
        return -1;
18370
0
    }
18371
4
    if (PyModule_AddObjectRef(m, "type_ignore", state->type_ignore_type) < 0) {
18372
0
        return -1;
18373
0
    }
18374
4
    if (PyModule_AddObjectRef(m, "TypeIgnore", state->TypeIgnore_type) < 0) {
18375
0
        return -1;
18376
0
    }
18377
4
    if (PyModule_AddObjectRef(m, "type_param", state->type_param_type) < 0) {
18378
0
        return -1;
18379
0
    }
18380
4
    if (PyModule_AddObjectRef(m, "TypeVar", state->TypeVar_type) < 0) {
18381
0
        return -1;
18382
0
    }
18383
4
    if (PyModule_AddObjectRef(m, "ParamSpec", state->ParamSpec_type) < 0) {
18384
0
        return -1;
18385
0
    }
18386
4
    if (PyModule_AddObjectRef(m, "TypeVarTuple", state->TypeVarTuple_type) < 0)
18387
0
        {
18388
0
        return -1;
18389
0
    }
18390
4
    return 0;
18391
4
}
18392
18393
static PyModuleDef_Slot astmodule_slots[] = {
18394
    {Py_mod_exec, astmodule_exec},
18395
    {Py_mod_multiple_interpreters, Py_MOD_PER_INTERPRETER_GIL_SUPPORTED},
18396
    {Py_mod_gil, Py_MOD_GIL_NOT_USED},
18397
    {0, NULL}
18398
};
18399
18400
static struct PyModuleDef _astmodule = {
18401
    PyModuleDef_HEAD_INIT,
18402
    .m_name = "_ast",
18403
    // The _ast module uses a per-interpreter state (PyInterpreterState.ast)
18404
    .m_size = 0,
18405
    .m_slots = astmodule_slots,
18406
};
18407
18408
PyMODINIT_FUNC
18409
PyInit__ast(void)
18410
4
{
18411
4
    return PyModuleDef_Init(&_astmodule);
18412
4
}
18413
18414
18415
PyObject* PyAST_mod2obj(mod_ty t)
18416
6.73k
{
18417
6.73k
    struct ast_state *state = get_ast_state();
18418
6.73k
    if (state == NULL) {
18419
0
        return NULL;
18420
0
    }
18421
6.73k
    PyObject *result = ast2obj_mod(state, t);
18422
18423
6.73k
    return result;
18424
6.73k
}
18425
18426
/* mode is 0 for "exec", 1 for "eval" and 2 for "single" input */
18427
int PyAst_CheckMode(PyObject *ast, int mode)
18428
0
{
18429
0
    const char * const req_name[] = {"Module", "Expression", "Interactive"};
18430
18431
0
    struct ast_state *state = get_ast_state();
18432
0
    if (state == NULL) {
18433
0
        return -1;
18434
0
    }
18435
18436
0
    PyObject *req_type[3];
18437
0
    req_type[0] = state->Module_type;
18438
0
    req_type[1] = state->Expression_type;
18439
0
    req_type[2] = state->Interactive_type;
18440
18441
0
    assert(0 <= mode && mode <= 2);
18442
0
    int isinstance = PyObject_IsInstance(ast, req_type[mode]);
18443
0
    if (isinstance == -1) {
18444
0
        return -1;
18445
0
    }
18446
0
    if (!isinstance) {
18447
0
        PyErr_Format(PyExc_TypeError, "expected %s node, got %.400s",
18448
0
                     req_name[mode], _PyType_Name(Py_TYPE(ast)));
18449
0
        return -1;
18450
0
    }
18451
0
    return 0;
18452
0
}
18453
18454
mod_ty PyAST_obj2mod(PyObject* ast, PyArena* arena, int mode)
18455
0
{
18456
0
    if (PySys_Audit("compile", "OO", ast, Py_None) < 0) {
18457
0
        return NULL;
18458
0
    }
18459
18460
0
    struct ast_state *state = get_ast_state();
18461
0
    if (state == NULL) {
18462
0
        return NULL;
18463
0
    }
18464
18465
0
    if (PyAst_CheckMode(ast, mode) < 0) {
18466
0
        return NULL;
18467
0
    }
18468
18469
0
    mod_ty res = NULL;
18470
0
    if (obj2ast_mod(state, ast, &res, arena) != 0)
18471
0
        return NULL;
18472
0
    else
18473
0
        return res;
18474
0
}
18475
18476
int PyAST_Check(PyObject* obj)
18477
21.9k
{
18478
21.9k
    struct ast_state *state = get_ast_state();
18479
21.9k
    if (state == NULL) {
18480
0
        return -1;
18481
0
    }
18482
21.9k
    return PyObject_IsInstance(obj, state->AST_type);
18483
21.9k
}
18484
18485