Coverage Report

Created: 2025-11-11 06:44

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
27.7k
{
23
27.7k
    PyInterpreterState *interp = _PyInterpreterState_GET();
24
27.7k
    struct ast_state *state = &interp->ast;
25
27.7k
    assert(!state->finalized);
26
27.7k
    if (_PyOnceFlag_CallOnce(&state->once, (_Py_once_fn_t *)&init_types, state) < 0) {
27
0
        return NULL;
28
0
    }
29
27.7k
    return state;
30
27.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
16
{
289
16
    if ((state->__dict__ = PyUnicode_InternFromString("__dict__")) == NULL) return -1;
290
16
    if ((state->__doc__ = PyUnicode_InternFromString("__doc__")) == NULL) return -1;
291
16
    if ((state->__match_args__ = PyUnicode_InternFromString("__match_args__")) == NULL) return -1;
292
16
    if ((state->__module__ = PyUnicode_InternFromString("__module__")) == NULL) return -1;
293
16
    if ((state->_attributes = PyUnicode_InternFromString("_attributes")) == NULL) return -1;
294
16
    if ((state->_fields = PyUnicode_InternFromString("_fields")) == NULL) return -1;
295
16
    if ((state->annotation = PyUnicode_InternFromString("annotation")) == NULL) return -1;
296
16
    if ((state->arg = PyUnicode_InternFromString("arg")) == NULL) return -1;
297
16
    if ((state->args = PyUnicode_InternFromString("args")) == NULL) return -1;
298
16
    if ((state->argtypes = PyUnicode_InternFromString("argtypes")) == NULL) return -1;
299
16
    if ((state->asname = PyUnicode_InternFromString("asname")) == NULL) return -1;
300
16
    if ((state->ast = PyUnicode_InternFromString("ast")) == NULL) return -1;
301
16
    if ((state->attr = PyUnicode_InternFromString("attr")) == NULL) return -1;
302
16
    if ((state->bases = PyUnicode_InternFromString("bases")) == NULL) return -1;
303
16
    if ((state->body = PyUnicode_InternFromString("body")) == NULL) return -1;
304
16
    if ((state->bound = PyUnicode_InternFromString("bound")) == NULL) return -1;
305
16
    if ((state->cases = PyUnicode_InternFromString("cases")) == NULL) return -1;
306
16
    if ((state->cause = PyUnicode_InternFromString("cause")) == NULL) return -1;
307
16
    if ((state->cls = PyUnicode_InternFromString("cls")) == NULL) return -1;
308
16
    if ((state->col_offset = PyUnicode_InternFromString("col_offset")) == NULL) return -1;
309
16
    if ((state->comparators = PyUnicode_InternFromString("comparators")) == NULL) return -1;
310
16
    if ((state->context_expr = PyUnicode_InternFromString("context_expr")) == NULL) return -1;
311
16
    if ((state->conversion = PyUnicode_InternFromString("conversion")) == NULL) return -1;
312
16
    if ((state->ctx = PyUnicode_InternFromString("ctx")) == NULL) return -1;
313
16
    if ((state->decorator_list = PyUnicode_InternFromString("decorator_list")) == NULL) return -1;
314
16
    if ((state->default_value = PyUnicode_InternFromString("default_value")) == NULL) return -1;
315
16
    if ((state->defaults = PyUnicode_InternFromString("defaults")) == NULL) return -1;
316
16
    if ((state->elt = PyUnicode_InternFromString("elt")) == NULL) return -1;
317
16
    if ((state->elts = PyUnicode_InternFromString("elts")) == NULL) return -1;
318
16
    if ((state->end_col_offset = PyUnicode_InternFromString("end_col_offset")) == NULL) return -1;
319
16
    if ((state->end_lineno = PyUnicode_InternFromString("end_lineno")) == NULL) return -1;
320
16
    if ((state->exc = PyUnicode_InternFromString("exc")) == NULL) return -1;
321
16
    if ((state->finalbody = PyUnicode_InternFromString("finalbody")) == NULL) return -1;
322
16
    if ((state->format_spec = PyUnicode_InternFromString("format_spec")) == NULL) return -1;
323
16
    if ((state->func = PyUnicode_InternFromString("func")) == NULL) return -1;
324
16
    if ((state->generators = PyUnicode_InternFromString("generators")) == NULL) return -1;
325
16
    if ((state->guard = PyUnicode_InternFromString("guard")) == NULL) return -1;
326
16
    if ((state->handlers = PyUnicode_InternFromString("handlers")) == NULL) return -1;
327
16
    if ((state->id = PyUnicode_InternFromString("id")) == NULL) return -1;
328
16
    if ((state->ifs = PyUnicode_InternFromString("ifs")) == NULL) return -1;
329
16
    if ((state->is_async = PyUnicode_InternFromString("is_async")) == NULL) return -1;
330
16
    if ((state->items = PyUnicode_InternFromString("items")) == NULL) return -1;
331
16
    if ((state->iter = PyUnicode_InternFromString("iter")) == NULL) return -1;
332
16
    if ((state->key = PyUnicode_InternFromString("key")) == NULL) return -1;
333
16
    if ((state->keys = PyUnicode_InternFromString("keys")) == NULL) return -1;
334
16
    if ((state->keywords = PyUnicode_InternFromString("keywords")) == NULL) return -1;
335
16
    if ((state->kind = PyUnicode_InternFromString("kind")) == NULL) return -1;
336
16
    if ((state->kw_defaults = PyUnicode_InternFromString("kw_defaults")) == NULL) return -1;
337
16
    if ((state->kwarg = PyUnicode_InternFromString("kwarg")) == NULL) return -1;
338
16
    if ((state->kwd_attrs = PyUnicode_InternFromString("kwd_attrs")) == NULL) return -1;
339
16
    if ((state->kwd_patterns = PyUnicode_InternFromString("kwd_patterns")) == NULL) return -1;
340
16
    if ((state->kwonlyargs = PyUnicode_InternFromString("kwonlyargs")) == NULL) return -1;
341
16
    if ((state->left = PyUnicode_InternFromString("left")) == NULL) return -1;
342
16
    if ((state->level = PyUnicode_InternFromString("level")) == NULL) return -1;
343
16
    if ((state->lineno = PyUnicode_InternFromString("lineno")) == NULL) return -1;
344
16
    if ((state->lower = PyUnicode_InternFromString("lower")) == NULL) return -1;
345
16
    if ((state->module = PyUnicode_InternFromString("module")) == NULL) return -1;
346
16
    if ((state->msg = PyUnicode_InternFromString("msg")) == NULL) return -1;
347
16
    if ((state->name = PyUnicode_InternFromString("name")) == NULL) return -1;
348
16
    if ((state->names = PyUnicode_InternFromString("names")) == NULL) return -1;
349
16
    if ((state->op = PyUnicode_InternFromString("op")) == NULL) return -1;
350
16
    if ((state->operand = PyUnicode_InternFromString("operand")) == NULL) return -1;
351
16
    if ((state->ops = PyUnicode_InternFromString("ops")) == NULL) return -1;
352
16
    if ((state->optional_vars = PyUnicode_InternFromString("optional_vars")) == NULL) return -1;
353
16
    if ((state->orelse = PyUnicode_InternFromString("orelse")) == NULL) return -1;
354
16
    if ((state->pattern = PyUnicode_InternFromString("pattern")) == NULL) return -1;
355
16
    if ((state->patterns = PyUnicode_InternFromString("patterns")) == NULL) return -1;
356
16
    if ((state->posonlyargs = PyUnicode_InternFromString("posonlyargs")) == NULL) return -1;
357
16
    if ((state->rest = PyUnicode_InternFromString("rest")) == NULL) return -1;
358
16
    if ((state->returns = PyUnicode_InternFromString("returns")) == NULL) return -1;
359
16
    if ((state->right = PyUnicode_InternFromString("right")) == NULL) return -1;
360
16
    if ((state->simple = PyUnicode_InternFromString("simple")) == NULL) return -1;
361
16
    if ((state->slice = PyUnicode_InternFromString("slice")) == NULL) return -1;
362
16
    if ((state->step = PyUnicode_InternFromString("step")) == NULL) return -1;
363
16
    if ((state->str = PyUnicode_InternFromString("str")) == NULL) return -1;
364
16
    if ((state->subject = PyUnicode_InternFromString("subject")) == NULL) return -1;
365
16
    if ((state->tag = PyUnicode_InternFromString("tag")) == NULL) return -1;
366
16
    if ((state->target = PyUnicode_InternFromString("target")) == NULL) return -1;
367
16
    if ((state->targets = PyUnicode_InternFromString("targets")) == NULL) return -1;
368
16
    if ((state->test = PyUnicode_InternFromString("test")) == NULL) return -1;
369
16
    if ((state->type = PyUnicode_InternFromString("type")) == NULL) return -1;
370
16
    if ((state->type_comment = PyUnicode_InternFromString("type_comment")) == NULL) return -1;
371
16
    if ((state->type_ignores = PyUnicode_InternFromString("type_ignores")) == NULL) return -1;
372
16
    if ((state->type_params = PyUnicode_InternFromString("type_params")) == NULL) return -1;
373
16
    if ((state->upper = PyUnicode_InternFromString("upper")) == NULL) return -1;
374
16
    if ((state->value = PyUnicode_InternFromString("value")) == NULL) return -1;
375
16
    if ((state->values = PyUnicode_InternFromString("values")) == NULL) return -1;
376
16
    if ((state->vararg = PyUnicode_InternFromString("vararg")) == NULL) return -1;
377
16
    return 0;
378
16
};
379
380
0
GENERATE_ASDL_SEQ_CONSTRUCTOR(mod, mod_ty)
381
0
GENERATE_ASDL_SEQ_CONSTRUCTOR(stmt, stmt_ty)
382
121k
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.4k
GENERATE_ASDL_SEQ_CONSTRUCTOR(arg, arg_ty)
387
10.0k
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.27k
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
16
{
819
16
    bool cond;
820
16
    PyObject *Module_annotations = PyDict_New();
821
16
    if (!Module_annotations) return 0;
822
16
    {
823
16
        PyObject *type = state->stmt_type;
824
16
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
825
16
        cond = type != NULL;
826
16
        if (!cond) {
827
0
            Py_DECREF(Module_annotations);
828
0
            return 0;
829
0
        }
830
16
        cond = PyDict_SetItemString(Module_annotations, "body", type) == 0;
831
16
        Py_DECREF(type);
832
16
        if (!cond) {
833
0
            Py_DECREF(Module_annotations);
834
0
            return 0;
835
0
        }
836
16
    }
837
16
    {
838
16
        PyObject *type = state->type_ignore_type;
839
16
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
840
16
        cond = type != NULL;
841
16
        if (!cond) {
842
0
            Py_DECREF(Module_annotations);
843
0
            return 0;
844
0
        }
845
16
        cond = PyDict_SetItemString(Module_annotations, "type_ignores", type)
846
16
                                    == 0;
847
16
        Py_DECREF(type);
848
16
        if (!cond) {
849
0
            Py_DECREF(Module_annotations);
850
0
            return 0;
851
0
        }
852
16
    }
853
16
    cond = PyObject_SetAttrString(state->Module_type, "_field_types",
854
16
                                  Module_annotations) == 0;
855
16
    if (!cond) {
856
0
        Py_DECREF(Module_annotations);
857
0
        return 0;
858
0
    }
859
16
    cond = PyObject_SetAttrString(state->Module_type, "__annotations__",
860
16
                                  Module_annotations) == 0;
861
16
    if (!cond) {
862
0
        Py_DECREF(Module_annotations);
863
0
        return 0;
864
0
    }
865
16
    Py_DECREF(Module_annotations);
866
16
    PyObject *Interactive_annotations = PyDict_New();
867
16
    if (!Interactive_annotations) return 0;
868
16
    {
869
16
        PyObject *type = state->stmt_type;
870
16
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
871
16
        cond = type != NULL;
872
16
        if (!cond) {
873
0
            Py_DECREF(Interactive_annotations);
874
0
            return 0;
875
0
        }
876
16
        cond = PyDict_SetItemString(Interactive_annotations, "body", type) == 0;
877
16
        Py_DECREF(type);
878
16
        if (!cond) {
879
0
            Py_DECREF(Interactive_annotations);
880
0
            return 0;
881
0
        }
882
16
    }
883
16
    cond = PyObject_SetAttrString(state->Interactive_type, "_field_types",
884
16
                                  Interactive_annotations) == 0;
885
16
    if (!cond) {
886
0
        Py_DECREF(Interactive_annotations);
887
0
        return 0;
888
0
    }
889
16
    cond = PyObject_SetAttrString(state->Interactive_type, "__annotations__",
890
16
                                  Interactive_annotations) == 0;
891
16
    if (!cond) {
892
0
        Py_DECREF(Interactive_annotations);
893
0
        return 0;
894
0
    }
895
16
    Py_DECREF(Interactive_annotations);
896
16
    PyObject *Expression_annotations = PyDict_New();
897
16
    if (!Expression_annotations) return 0;
898
16
    {
899
16
        PyObject *type = state->expr_type;
900
16
        Py_INCREF(type);
901
16
        cond = PyDict_SetItemString(Expression_annotations, "body", type) == 0;
902
16
        Py_DECREF(type);
903
16
        if (!cond) {
904
0
            Py_DECREF(Expression_annotations);
905
0
            return 0;
906
0
        }
907
16
    }
908
16
    cond = PyObject_SetAttrString(state->Expression_type, "_field_types",
909
16
                                  Expression_annotations) == 0;
910
16
    if (!cond) {
911
0
        Py_DECREF(Expression_annotations);
912
0
        return 0;
913
0
    }
914
16
    cond = PyObject_SetAttrString(state->Expression_type, "__annotations__",
915
16
                                  Expression_annotations) == 0;
916
16
    if (!cond) {
917
0
        Py_DECREF(Expression_annotations);
918
0
        return 0;
919
0
    }
920
16
    Py_DECREF(Expression_annotations);
921
16
    PyObject *FunctionType_annotations = PyDict_New();
922
16
    if (!FunctionType_annotations) return 0;
923
16
    {
924
16
        PyObject *type = state->expr_type;
925
16
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
926
16
        cond = type != NULL;
927
16
        if (!cond) {
928
0
            Py_DECREF(FunctionType_annotations);
929
0
            return 0;
930
0
        }
931
16
        cond = PyDict_SetItemString(FunctionType_annotations, "argtypes", type)
932
16
                                    == 0;
933
16
        Py_DECREF(type);
934
16
        if (!cond) {
935
0
            Py_DECREF(FunctionType_annotations);
936
0
            return 0;
937
0
        }
938
16
    }
939
16
    {
940
16
        PyObject *type = state->expr_type;
941
16
        Py_INCREF(type);
942
16
        cond = PyDict_SetItemString(FunctionType_annotations, "returns", type)
943
16
                                    == 0;
944
16
        Py_DECREF(type);
945
16
        if (!cond) {
946
0
            Py_DECREF(FunctionType_annotations);
947
0
            return 0;
948
0
        }
949
16
    }
950
16
    cond = PyObject_SetAttrString(state->FunctionType_type, "_field_types",
951
16
                                  FunctionType_annotations) == 0;
952
16
    if (!cond) {
953
0
        Py_DECREF(FunctionType_annotations);
954
0
        return 0;
955
0
    }
956
16
    cond = PyObject_SetAttrString(state->FunctionType_type, "__annotations__",
957
16
                                  FunctionType_annotations) == 0;
958
16
    if (!cond) {
959
0
        Py_DECREF(FunctionType_annotations);
960
0
        return 0;
961
0
    }
962
16
    Py_DECREF(FunctionType_annotations);
963
16
    PyObject *FunctionDef_annotations = PyDict_New();
964
16
    if (!FunctionDef_annotations) return 0;
965
16
    {
966
16
        PyObject *type = (PyObject *)&PyUnicode_Type;
967
16
        Py_INCREF(type);
968
16
        cond = PyDict_SetItemString(FunctionDef_annotations, "name", type) == 0;
969
16
        Py_DECREF(type);
970
16
        if (!cond) {
971
0
            Py_DECREF(FunctionDef_annotations);
972
0
            return 0;
973
0
        }
974
16
    }
975
16
    {
976
16
        PyObject *type = state->arguments_type;
977
16
        Py_INCREF(type);
978
16
        cond = PyDict_SetItemString(FunctionDef_annotations, "args", type) == 0;
979
16
        Py_DECREF(type);
980
16
        if (!cond) {
981
0
            Py_DECREF(FunctionDef_annotations);
982
0
            return 0;
983
0
        }
984
16
    }
985
16
    {
986
16
        PyObject *type = state->stmt_type;
987
16
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
988
16
        cond = type != NULL;
989
16
        if (!cond) {
990
0
            Py_DECREF(FunctionDef_annotations);
991
0
            return 0;
992
0
        }
993
16
        cond = PyDict_SetItemString(FunctionDef_annotations, "body", type) == 0;
994
16
        Py_DECREF(type);
995
16
        if (!cond) {
996
0
            Py_DECREF(FunctionDef_annotations);
997
0
            return 0;
998
0
        }
999
16
    }
1000
16
    {
1001
16
        PyObject *type = state->expr_type;
1002
16
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
1003
16
        cond = type != NULL;
1004
16
        if (!cond) {
1005
0
            Py_DECREF(FunctionDef_annotations);
1006
0
            return 0;
1007
0
        }
1008
16
        cond = PyDict_SetItemString(FunctionDef_annotations, "decorator_list",
1009
16
                                    type) == 0;
1010
16
        Py_DECREF(type);
1011
16
        if (!cond) {
1012
0
            Py_DECREF(FunctionDef_annotations);
1013
0
            return 0;
1014
0
        }
1015
16
    }
1016
16
    {
1017
16
        PyObject *type = state->expr_type;
1018
16
        type = _Py_union_type_or(type, Py_None);
1019
16
        cond = type != NULL;
1020
16
        if (!cond) {
1021
0
            Py_DECREF(FunctionDef_annotations);
1022
0
            return 0;
1023
0
        }
1024
16
        cond = PyDict_SetItemString(FunctionDef_annotations, "returns", type)
1025
16
                                    == 0;
1026
16
        Py_DECREF(type);
1027
16
        if (!cond) {
1028
0
            Py_DECREF(FunctionDef_annotations);
1029
0
            return 0;
1030
0
        }
1031
16
    }
1032
16
    {
1033
16
        PyObject *type = (PyObject *)&PyUnicode_Type;
1034
16
        type = _Py_union_type_or(type, Py_None);
1035
16
        cond = type != NULL;
1036
16
        if (!cond) {
1037
0
            Py_DECREF(FunctionDef_annotations);
1038
0
            return 0;
1039
0
        }
1040
16
        cond = PyDict_SetItemString(FunctionDef_annotations, "type_comment",
1041
16
                                    type) == 0;
1042
16
        Py_DECREF(type);
1043
16
        if (!cond) {
1044
0
            Py_DECREF(FunctionDef_annotations);
1045
0
            return 0;
1046
0
        }
1047
16
    }
1048
16
    {
1049
16
        PyObject *type = state->type_param_type;
1050
16
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
1051
16
        cond = type != NULL;
1052
16
        if (!cond) {
1053
0
            Py_DECREF(FunctionDef_annotations);
1054
0
            return 0;
1055
0
        }
1056
16
        cond = PyDict_SetItemString(FunctionDef_annotations, "type_params",
1057
16
                                    type) == 0;
1058
16
        Py_DECREF(type);
1059
16
        if (!cond) {
1060
0
            Py_DECREF(FunctionDef_annotations);
1061
0
            return 0;
1062
0
        }
1063
16
    }
1064
16
    cond = PyObject_SetAttrString(state->FunctionDef_type, "_field_types",
1065
16
                                  FunctionDef_annotations) == 0;
1066
16
    if (!cond) {
1067
0
        Py_DECREF(FunctionDef_annotations);
1068
0
        return 0;
1069
0
    }
1070
16
    cond = PyObject_SetAttrString(state->FunctionDef_type, "__annotations__",
1071
16
                                  FunctionDef_annotations) == 0;
1072
16
    if (!cond) {
1073
0
        Py_DECREF(FunctionDef_annotations);
1074
0
        return 0;
1075
0
    }
1076
16
    Py_DECREF(FunctionDef_annotations);
1077
16
    PyObject *AsyncFunctionDef_annotations = PyDict_New();
1078
16
    if (!AsyncFunctionDef_annotations) return 0;
1079
16
    {
1080
16
        PyObject *type = (PyObject *)&PyUnicode_Type;
1081
16
        Py_INCREF(type);
1082
16
        cond = PyDict_SetItemString(AsyncFunctionDef_annotations, "name", type)
1083
16
                                    == 0;
1084
16
        Py_DECREF(type);
1085
16
        if (!cond) {
1086
0
            Py_DECREF(AsyncFunctionDef_annotations);
1087
0
            return 0;
1088
0
        }
1089
16
    }
1090
16
    {
1091
16
        PyObject *type = state->arguments_type;
1092
16
        Py_INCREF(type);
1093
16
        cond = PyDict_SetItemString(AsyncFunctionDef_annotations, "args", type)
1094
16
                                    == 0;
1095
16
        Py_DECREF(type);
1096
16
        if (!cond) {
1097
0
            Py_DECREF(AsyncFunctionDef_annotations);
1098
0
            return 0;
1099
0
        }
1100
16
    }
1101
16
    {
1102
16
        PyObject *type = state->stmt_type;
1103
16
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
1104
16
        cond = type != NULL;
1105
16
        if (!cond) {
1106
0
            Py_DECREF(AsyncFunctionDef_annotations);
1107
0
            return 0;
1108
0
        }
1109
16
        cond = PyDict_SetItemString(AsyncFunctionDef_annotations, "body", type)
1110
16
                                    == 0;
1111
16
        Py_DECREF(type);
1112
16
        if (!cond) {
1113
0
            Py_DECREF(AsyncFunctionDef_annotations);
1114
0
            return 0;
1115
0
        }
1116
16
    }
1117
16
    {
1118
16
        PyObject *type = state->expr_type;
1119
16
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
1120
16
        cond = type != NULL;
1121
16
        if (!cond) {
1122
0
            Py_DECREF(AsyncFunctionDef_annotations);
1123
0
            return 0;
1124
0
        }
1125
16
        cond = PyDict_SetItemString(AsyncFunctionDef_annotations,
1126
16
                                    "decorator_list", type) == 0;
1127
16
        Py_DECREF(type);
1128
16
        if (!cond) {
1129
0
            Py_DECREF(AsyncFunctionDef_annotations);
1130
0
            return 0;
1131
0
        }
1132
16
    }
1133
16
    {
1134
16
        PyObject *type = state->expr_type;
1135
16
        type = _Py_union_type_or(type, Py_None);
1136
16
        cond = type != NULL;
1137
16
        if (!cond) {
1138
0
            Py_DECREF(AsyncFunctionDef_annotations);
1139
0
            return 0;
1140
0
        }
1141
16
        cond = PyDict_SetItemString(AsyncFunctionDef_annotations, "returns",
1142
16
                                    type) == 0;
1143
16
        Py_DECREF(type);
1144
16
        if (!cond) {
1145
0
            Py_DECREF(AsyncFunctionDef_annotations);
1146
0
            return 0;
1147
0
        }
1148
16
    }
1149
16
    {
1150
16
        PyObject *type = (PyObject *)&PyUnicode_Type;
1151
16
        type = _Py_union_type_or(type, Py_None);
1152
16
        cond = type != NULL;
1153
16
        if (!cond) {
1154
0
            Py_DECREF(AsyncFunctionDef_annotations);
1155
0
            return 0;
1156
0
        }
1157
16
        cond = PyDict_SetItemString(AsyncFunctionDef_annotations,
1158
16
                                    "type_comment", type) == 0;
1159
16
        Py_DECREF(type);
1160
16
        if (!cond) {
1161
0
            Py_DECREF(AsyncFunctionDef_annotations);
1162
0
            return 0;
1163
0
        }
1164
16
    }
1165
16
    {
1166
16
        PyObject *type = state->type_param_type;
1167
16
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
1168
16
        cond = type != NULL;
1169
16
        if (!cond) {
1170
0
            Py_DECREF(AsyncFunctionDef_annotations);
1171
0
            return 0;
1172
0
        }
1173
16
        cond = PyDict_SetItemString(AsyncFunctionDef_annotations,
1174
16
                                    "type_params", type) == 0;
1175
16
        Py_DECREF(type);
1176
16
        if (!cond) {
1177
0
            Py_DECREF(AsyncFunctionDef_annotations);
1178
0
            return 0;
1179
0
        }
1180
16
    }
1181
16
    cond = PyObject_SetAttrString(state->AsyncFunctionDef_type, "_field_types",
1182
16
                                  AsyncFunctionDef_annotations) == 0;
1183
16
    if (!cond) {
1184
0
        Py_DECREF(AsyncFunctionDef_annotations);
1185
0
        return 0;
1186
0
    }
1187
16
    cond = PyObject_SetAttrString(state->AsyncFunctionDef_type,
1188
16
                                  "__annotations__",
1189
16
                                  AsyncFunctionDef_annotations) == 0;
1190
16
    if (!cond) {
1191
0
        Py_DECREF(AsyncFunctionDef_annotations);
1192
0
        return 0;
1193
0
    }
1194
16
    Py_DECREF(AsyncFunctionDef_annotations);
1195
16
    PyObject *ClassDef_annotations = PyDict_New();
1196
16
    if (!ClassDef_annotations) return 0;
1197
16
    {
1198
16
        PyObject *type = (PyObject *)&PyUnicode_Type;
1199
16
        Py_INCREF(type);
1200
16
        cond = PyDict_SetItemString(ClassDef_annotations, "name", type) == 0;
1201
16
        Py_DECREF(type);
1202
16
        if (!cond) {
1203
0
            Py_DECREF(ClassDef_annotations);
1204
0
            return 0;
1205
0
        }
1206
16
    }
1207
16
    {
1208
16
        PyObject *type = state->expr_type;
1209
16
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
1210
16
        cond = type != NULL;
1211
16
        if (!cond) {
1212
0
            Py_DECREF(ClassDef_annotations);
1213
0
            return 0;
1214
0
        }
1215
16
        cond = PyDict_SetItemString(ClassDef_annotations, "bases", type) == 0;
1216
16
        Py_DECREF(type);
1217
16
        if (!cond) {
1218
0
            Py_DECREF(ClassDef_annotations);
1219
0
            return 0;
1220
0
        }
1221
16
    }
1222
16
    {
1223
16
        PyObject *type = state->keyword_type;
1224
16
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
1225
16
        cond = type != NULL;
1226
16
        if (!cond) {
1227
0
            Py_DECREF(ClassDef_annotations);
1228
0
            return 0;
1229
0
        }
1230
16
        cond = PyDict_SetItemString(ClassDef_annotations, "keywords", type) ==
1231
16
                                    0;
1232
16
        Py_DECREF(type);
1233
16
        if (!cond) {
1234
0
            Py_DECREF(ClassDef_annotations);
1235
0
            return 0;
1236
0
        }
1237
16
    }
1238
16
    {
1239
16
        PyObject *type = state->stmt_type;
1240
16
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
1241
16
        cond = type != NULL;
1242
16
        if (!cond) {
1243
0
            Py_DECREF(ClassDef_annotations);
1244
0
            return 0;
1245
0
        }
1246
16
        cond = PyDict_SetItemString(ClassDef_annotations, "body", type) == 0;
1247
16
        Py_DECREF(type);
1248
16
        if (!cond) {
1249
0
            Py_DECREF(ClassDef_annotations);
1250
0
            return 0;
1251
0
        }
1252
16
    }
1253
16
    {
1254
16
        PyObject *type = state->expr_type;
1255
16
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
1256
16
        cond = type != NULL;
1257
16
        if (!cond) {
1258
0
            Py_DECREF(ClassDef_annotations);
1259
0
            return 0;
1260
0
        }
1261
16
        cond = PyDict_SetItemString(ClassDef_annotations, "decorator_list",
1262
16
                                    type) == 0;
1263
16
        Py_DECREF(type);
1264
16
        if (!cond) {
1265
0
            Py_DECREF(ClassDef_annotations);
1266
0
            return 0;
1267
0
        }
1268
16
    }
1269
16
    {
1270
16
        PyObject *type = state->type_param_type;
1271
16
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
1272
16
        cond = type != NULL;
1273
16
        if (!cond) {
1274
0
            Py_DECREF(ClassDef_annotations);
1275
0
            return 0;
1276
0
        }
1277
16
        cond = PyDict_SetItemString(ClassDef_annotations, "type_params", type)
1278
16
                                    == 0;
1279
16
        Py_DECREF(type);
1280
16
        if (!cond) {
1281
0
            Py_DECREF(ClassDef_annotations);
1282
0
            return 0;
1283
0
        }
1284
16
    }
1285
16
    cond = PyObject_SetAttrString(state->ClassDef_type, "_field_types",
1286
16
                                  ClassDef_annotations) == 0;
1287
16
    if (!cond) {
1288
0
        Py_DECREF(ClassDef_annotations);
1289
0
        return 0;
1290
0
    }
1291
16
    cond = PyObject_SetAttrString(state->ClassDef_type, "__annotations__",
1292
16
                                  ClassDef_annotations) == 0;
1293
16
    if (!cond) {
1294
0
        Py_DECREF(ClassDef_annotations);
1295
0
        return 0;
1296
0
    }
1297
16
    Py_DECREF(ClassDef_annotations);
1298
16
    PyObject *Return_annotations = PyDict_New();
1299
16
    if (!Return_annotations) return 0;
1300
16
    {
1301
16
        PyObject *type = state->expr_type;
1302
16
        type = _Py_union_type_or(type, Py_None);
1303
16
        cond = type != NULL;
1304
16
        if (!cond) {
1305
0
            Py_DECREF(Return_annotations);
1306
0
            return 0;
1307
0
        }
1308
16
        cond = PyDict_SetItemString(Return_annotations, "value", type) == 0;
1309
16
        Py_DECREF(type);
1310
16
        if (!cond) {
1311
0
            Py_DECREF(Return_annotations);
1312
0
            return 0;
1313
0
        }
1314
16
    }
1315
16
    cond = PyObject_SetAttrString(state->Return_type, "_field_types",
1316
16
                                  Return_annotations) == 0;
1317
16
    if (!cond) {
1318
0
        Py_DECREF(Return_annotations);
1319
0
        return 0;
1320
0
    }
1321
16
    cond = PyObject_SetAttrString(state->Return_type, "__annotations__",
1322
16
                                  Return_annotations) == 0;
1323
16
    if (!cond) {
1324
0
        Py_DECREF(Return_annotations);
1325
0
        return 0;
1326
0
    }
1327
16
    Py_DECREF(Return_annotations);
1328
16
    PyObject *Delete_annotations = PyDict_New();
1329
16
    if (!Delete_annotations) return 0;
1330
16
    {
1331
16
        PyObject *type = state->expr_type;
1332
16
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
1333
16
        cond = type != NULL;
1334
16
        if (!cond) {
1335
0
            Py_DECREF(Delete_annotations);
1336
0
            return 0;
1337
0
        }
1338
16
        cond = PyDict_SetItemString(Delete_annotations, "targets", type) == 0;
1339
16
        Py_DECREF(type);
1340
16
        if (!cond) {
1341
0
            Py_DECREF(Delete_annotations);
1342
0
            return 0;
1343
0
        }
1344
16
    }
1345
16
    cond = PyObject_SetAttrString(state->Delete_type, "_field_types",
1346
16
                                  Delete_annotations) == 0;
1347
16
    if (!cond) {
1348
0
        Py_DECREF(Delete_annotations);
1349
0
        return 0;
1350
0
    }
1351
16
    cond = PyObject_SetAttrString(state->Delete_type, "__annotations__",
1352
16
                                  Delete_annotations) == 0;
1353
16
    if (!cond) {
1354
0
        Py_DECREF(Delete_annotations);
1355
0
        return 0;
1356
0
    }
1357
16
    Py_DECREF(Delete_annotations);
1358
16
    PyObject *Assign_annotations = PyDict_New();
1359
16
    if (!Assign_annotations) return 0;
1360
16
    {
1361
16
        PyObject *type = state->expr_type;
1362
16
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
1363
16
        cond = type != NULL;
1364
16
        if (!cond) {
1365
0
            Py_DECREF(Assign_annotations);
1366
0
            return 0;
1367
0
        }
1368
16
        cond = PyDict_SetItemString(Assign_annotations, "targets", type) == 0;
1369
16
        Py_DECREF(type);
1370
16
        if (!cond) {
1371
0
            Py_DECREF(Assign_annotations);
1372
0
            return 0;
1373
0
        }
1374
16
    }
1375
16
    {
1376
16
        PyObject *type = state->expr_type;
1377
16
        Py_INCREF(type);
1378
16
        cond = PyDict_SetItemString(Assign_annotations, "value", type) == 0;
1379
16
        Py_DECREF(type);
1380
16
        if (!cond) {
1381
0
            Py_DECREF(Assign_annotations);
1382
0
            return 0;
1383
0
        }
1384
16
    }
1385
16
    {
1386
16
        PyObject *type = (PyObject *)&PyUnicode_Type;
1387
16
        type = _Py_union_type_or(type, Py_None);
1388
16
        cond = type != NULL;
1389
16
        if (!cond) {
1390
0
            Py_DECREF(Assign_annotations);
1391
0
            return 0;
1392
0
        }
1393
16
        cond = PyDict_SetItemString(Assign_annotations, "type_comment", type)
1394
16
                                    == 0;
1395
16
        Py_DECREF(type);
1396
16
        if (!cond) {
1397
0
            Py_DECREF(Assign_annotations);
1398
0
            return 0;
1399
0
        }
1400
16
    }
1401
16
    cond = PyObject_SetAttrString(state->Assign_type, "_field_types",
1402
16
                                  Assign_annotations) == 0;
1403
16
    if (!cond) {
1404
0
        Py_DECREF(Assign_annotations);
1405
0
        return 0;
1406
0
    }
1407
16
    cond = PyObject_SetAttrString(state->Assign_type, "__annotations__",
1408
16
                                  Assign_annotations) == 0;
1409
16
    if (!cond) {
1410
0
        Py_DECREF(Assign_annotations);
1411
0
        return 0;
1412
0
    }
1413
16
    Py_DECREF(Assign_annotations);
1414
16
    PyObject *TypeAlias_annotations = PyDict_New();
1415
16
    if (!TypeAlias_annotations) return 0;
1416
16
    {
1417
16
        PyObject *type = state->expr_type;
1418
16
        Py_INCREF(type);
1419
16
        cond = PyDict_SetItemString(TypeAlias_annotations, "name", type) == 0;
1420
16
        Py_DECREF(type);
1421
16
        if (!cond) {
1422
0
            Py_DECREF(TypeAlias_annotations);
1423
0
            return 0;
1424
0
        }
1425
16
    }
1426
16
    {
1427
16
        PyObject *type = state->type_param_type;
1428
16
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
1429
16
        cond = type != NULL;
1430
16
        if (!cond) {
1431
0
            Py_DECREF(TypeAlias_annotations);
1432
0
            return 0;
1433
0
        }
1434
16
        cond = PyDict_SetItemString(TypeAlias_annotations, "type_params", type)
1435
16
                                    == 0;
1436
16
        Py_DECREF(type);
1437
16
        if (!cond) {
1438
0
            Py_DECREF(TypeAlias_annotations);
1439
0
            return 0;
1440
0
        }
1441
16
    }
1442
16
    {
1443
16
        PyObject *type = state->expr_type;
1444
16
        Py_INCREF(type);
1445
16
        cond = PyDict_SetItemString(TypeAlias_annotations, "value", type) == 0;
1446
16
        Py_DECREF(type);
1447
16
        if (!cond) {
1448
0
            Py_DECREF(TypeAlias_annotations);
1449
0
            return 0;
1450
0
        }
1451
16
    }
1452
16
    cond = PyObject_SetAttrString(state->TypeAlias_type, "_field_types",
1453
16
                                  TypeAlias_annotations) == 0;
1454
16
    if (!cond) {
1455
0
        Py_DECREF(TypeAlias_annotations);
1456
0
        return 0;
1457
0
    }
1458
16
    cond = PyObject_SetAttrString(state->TypeAlias_type, "__annotations__",
1459
16
                                  TypeAlias_annotations) == 0;
1460
16
    if (!cond) {
1461
0
        Py_DECREF(TypeAlias_annotations);
1462
0
        return 0;
1463
0
    }
1464
16
    Py_DECREF(TypeAlias_annotations);
1465
16
    PyObject *AugAssign_annotations = PyDict_New();
1466
16
    if (!AugAssign_annotations) return 0;
1467
16
    {
1468
16
        PyObject *type = state->expr_type;
1469
16
        Py_INCREF(type);
1470
16
        cond = PyDict_SetItemString(AugAssign_annotations, "target", type) == 0;
1471
16
        Py_DECREF(type);
1472
16
        if (!cond) {
1473
0
            Py_DECREF(AugAssign_annotations);
1474
0
            return 0;
1475
0
        }
1476
16
    }
1477
16
    {
1478
16
        PyObject *type = state->operator_type;
1479
16
        Py_INCREF(type);
1480
16
        cond = PyDict_SetItemString(AugAssign_annotations, "op", type) == 0;
1481
16
        Py_DECREF(type);
1482
16
        if (!cond) {
1483
0
            Py_DECREF(AugAssign_annotations);
1484
0
            return 0;
1485
0
        }
1486
16
    }
1487
16
    {
1488
16
        PyObject *type = state->expr_type;
1489
16
        Py_INCREF(type);
1490
16
        cond = PyDict_SetItemString(AugAssign_annotations, "value", type) == 0;
1491
16
        Py_DECREF(type);
1492
16
        if (!cond) {
1493
0
            Py_DECREF(AugAssign_annotations);
1494
0
            return 0;
1495
0
        }
1496
16
    }
1497
16
    cond = PyObject_SetAttrString(state->AugAssign_type, "_field_types",
1498
16
                                  AugAssign_annotations) == 0;
1499
16
    if (!cond) {
1500
0
        Py_DECREF(AugAssign_annotations);
1501
0
        return 0;
1502
0
    }
1503
16
    cond = PyObject_SetAttrString(state->AugAssign_type, "__annotations__",
1504
16
                                  AugAssign_annotations) == 0;
1505
16
    if (!cond) {
1506
0
        Py_DECREF(AugAssign_annotations);
1507
0
        return 0;
1508
0
    }
1509
16
    Py_DECREF(AugAssign_annotations);
1510
16
    PyObject *AnnAssign_annotations = PyDict_New();
1511
16
    if (!AnnAssign_annotations) return 0;
1512
16
    {
1513
16
        PyObject *type = state->expr_type;
1514
16
        Py_INCREF(type);
1515
16
        cond = PyDict_SetItemString(AnnAssign_annotations, "target", type) == 0;
1516
16
        Py_DECREF(type);
1517
16
        if (!cond) {
1518
0
            Py_DECREF(AnnAssign_annotations);
1519
0
            return 0;
1520
0
        }
1521
16
    }
1522
16
    {
1523
16
        PyObject *type = state->expr_type;
1524
16
        Py_INCREF(type);
1525
16
        cond = PyDict_SetItemString(AnnAssign_annotations, "annotation", type)
1526
16
                                    == 0;
1527
16
        Py_DECREF(type);
1528
16
        if (!cond) {
1529
0
            Py_DECREF(AnnAssign_annotations);
1530
0
            return 0;
1531
0
        }
1532
16
    }
1533
16
    {
1534
16
        PyObject *type = state->expr_type;
1535
16
        type = _Py_union_type_or(type, Py_None);
1536
16
        cond = type != NULL;
1537
16
        if (!cond) {
1538
0
            Py_DECREF(AnnAssign_annotations);
1539
0
            return 0;
1540
0
        }
1541
16
        cond = PyDict_SetItemString(AnnAssign_annotations, "value", type) == 0;
1542
16
        Py_DECREF(type);
1543
16
        if (!cond) {
1544
0
            Py_DECREF(AnnAssign_annotations);
1545
0
            return 0;
1546
0
        }
1547
16
    }
1548
16
    {
1549
16
        PyObject *type = (PyObject *)&PyLong_Type;
1550
16
        Py_INCREF(type);
1551
16
        cond = PyDict_SetItemString(AnnAssign_annotations, "simple", type) == 0;
1552
16
        Py_DECREF(type);
1553
16
        if (!cond) {
1554
0
            Py_DECREF(AnnAssign_annotations);
1555
0
            return 0;
1556
0
        }
1557
16
    }
1558
16
    cond = PyObject_SetAttrString(state->AnnAssign_type, "_field_types",
1559
16
                                  AnnAssign_annotations) == 0;
1560
16
    if (!cond) {
1561
0
        Py_DECREF(AnnAssign_annotations);
1562
0
        return 0;
1563
0
    }
1564
16
    cond = PyObject_SetAttrString(state->AnnAssign_type, "__annotations__",
1565
16
                                  AnnAssign_annotations) == 0;
1566
16
    if (!cond) {
1567
0
        Py_DECREF(AnnAssign_annotations);
1568
0
        return 0;
1569
0
    }
1570
16
    Py_DECREF(AnnAssign_annotations);
1571
16
    PyObject *For_annotations = PyDict_New();
1572
16
    if (!For_annotations) return 0;
1573
16
    {
1574
16
        PyObject *type = state->expr_type;
1575
16
        Py_INCREF(type);
1576
16
        cond = PyDict_SetItemString(For_annotations, "target", type) == 0;
1577
16
        Py_DECREF(type);
1578
16
        if (!cond) {
1579
0
            Py_DECREF(For_annotations);
1580
0
            return 0;
1581
0
        }
1582
16
    }
1583
16
    {
1584
16
        PyObject *type = state->expr_type;
1585
16
        Py_INCREF(type);
1586
16
        cond = PyDict_SetItemString(For_annotations, "iter", type) == 0;
1587
16
        Py_DECREF(type);
1588
16
        if (!cond) {
1589
0
            Py_DECREF(For_annotations);
1590
0
            return 0;
1591
0
        }
1592
16
    }
1593
16
    {
1594
16
        PyObject *type = state->stmt_type;
1595
16
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
1596
16
        cond = type != NULL;
1597
16
        if (!cond) {
1598
0
            Py_DECREF(For_annotations);
1599
0
            return 0;
1600
0
        }
1601
16
        cond = PyDict_SetItemString(For_annotations, "body", type) == 0;
1602
16
        Py_DECREF(type);
1603
16
        if (!cond) {
1604
0
            Py_DECREF(For_annotations);
1605
0
            return 0;
1606
0
        }
1607
16
    }
1608
16
    {
1609
16
        PyObject *type = state->stmt_type;
1610
16
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
1611
16
        cond = type != NULL;
1612
16
        if (!cond) {
1613
0
            Py_DECREF(For_annotations);
1614
0
            return 0;
1615
0
        }
1616
16
        cond = PyDict_SetItemString(For_annotations, "orelse", type) == 0;
1617
16
        Py_DECREF(type);
1618
16
        if (!cond) {
1619
0
            Py_DECREF(For_annotations);
1620
0
            return 0;
1621
0
        }
1622
16
    }
1623
16
    {
1624
16
        PyObject *type = (PyObject *)&PyUnicode_Type;
1625
16
        type = _Py_union_type_or(type, Py_None);
1626
16
        cond = type != NULL;
1627
16
        if (!cond) {
1628
0
            Py_DECREF(For_annotations);
1629
0
            return 0;
1630
0
        }
1631
16
        cond = PyDict_SetItemString(For_annotations, "type_comment", type) == 0;
1632
16
        Py_DECREF(type);
1633
16
        if (!cond) {
1634
0
            Py_DECREF(For_annotations);
1635
0
            return 0;
1636
0
        }
1637
16
    }
1638
16
    cond = PyObject_SetAttrString(state->For_type, "_field_types",
1639
16
                                  For_annotations) == 0;
1640
16
    if (!cond) {
1641
0
        Py_DECREF(For_annotations);
1642
0
        return 0;
1643
0
    }
1644
16
    cond = PyObject_SetAttrString(state->For_type, "__annotations__",
1645
16
                                  For_annotations) == 0;
1646
16
    if (!cond) {
1647
0
        Py_DECREF(For_annotations);
1648
0
        return 0;
1649
0
    }
1650
16
    Py_DECREF(For_annotations);
1651
16
    PyObject *AsyncFor_annotations = PyDict_New();
1652
16
    if (!AsyncFor_annotations) return 0;
1653
16
    {
1654
16
        PyObject *type = state->expr_type;
1655
16
        Py_INCREF(type);
1656
16
        cond = PyDict_SetItemString(AsyncFor_annotations, "target", type) == 0;
1657
16
        Py_DECREF(type);
1658
16
        if (!cond) {
1659
0
            Py_DECREF(AsyncFor_annotations);
1660
0
            return 0;
1661
0
        }
1662
16
    }
1663
16
    {
1664
16
        PyObject *type = state->expr_type;
1665
16
        Py_INCREF(type);
1666
16
        cond = PyDict_SetItemString(AsyncFor_annotations, "iter", type) == 0;
1667
16
        Py_DECREF(type);
1668
16
        if (!cond) {
1669
0
            Py_DECREF(AsyncFor_annotations);
1670
0
            return 0;
1671
0
        }
1672
16
    }
1673
16
    {
1674
16
        PyObject *type = state->stmt_type;
1675
16
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
1676
16
        cond = type != NULL;
1677
16
        if (!cond) {
1678
0
            Py_DECREF(AsyncFor_annotations);
1679
0
            return 0;
1680
0
        }
1681
16
        cond = PyDict_SetItemString(AsyncFor_annotations, "body", type) == 0;
1682
16
        Py_DECREF(type);
1683
16
        if (!cond) {
1684
0
            Py_DECREF(AsyncFor_annotations);
1685
0
            return 0;
1686
0
        }
1687
16
    }
1688
16
    {
1689
16
        PyObject *type = state->stmt_type;
1690
16
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
1691
16
        cond = type != NULL;
1692
16
        if (!cond) {
1693
0
            Py_DECREF(AsyncFor_annotations);
1694
0
            return 0;
1695
0
        }
1696
16
        cond = PyDict_SetItemString(AsyncFor_annotations, "orelse", type) == 0;
1697
16
        Py_DECREF(type);
1698
16
        if (!cond) {
1699
0
            Py_DECREF(AsyncFor_annotations);
1700
0
            return 0;
1701
0
        }
1702
16
    }
1703
16
    {
1704
16
        PyObject *type = (PyObject *)&PyUnicode_Type;
1705
16
        type = _Py_union_type_or(type, Py_None);
1706
16
        cond = type != NULL;
1707
16
        if (!cond) {
1708
0
            Py_DECREF(AsyncFor_annotations);
1709
0
            return 0;
1710
0
        }
1711
16
        cond = PyDict_SetItemString(AsyncFor_annotations, "type_comment", type)
1712
16
                                    == 0;
1713
16
        Py_DECREF(type);
1714
16
        if (!cond) {
1715
0
            Py_DECREF(AsyncFor_annotations);
1716
0
            return 0;
1717
0
        }
1718
16
    }
1719
16
    cond = PyObject_SetAttrString(state->AsyncFor_type, "_field_types",
1720
16
                                  AsyncFor_annotations) == 0;
1721
16
    if (!cond) {
1722
0
        Py_DECREF(AsyncFor_annotations);
1723
0
        return 0;
1724
0
    }
1725
16
    cond = PyObject_SetAttrString(state->AsyncFor_type, "__annotations__",
1726
16
                                  AsyncFor_annotations) == 0;
1727
16
    if (!cond) {
1728
0
        Py_DECREF(AsyncFor_annotations);
1729
0
        return 0;
1730
0
    }
1731
16
    Py_DECREF(AsyncFor_annotations);
1732
16
    PyObject *While_annotations = PyDict_New();
1733
16
    if (!While_annotations) return 0;
1734
16
    {
1735
16
        PyObject *type = state->expr_type;
1736
16
        Py_INCREF(type);
1737
16
        cond = PyDict_SetItemString(While_annotations, "test", type) == 0;
1738
16
        Py_DECREF(type);
1739
16
        if (!cond) {
1740
0
            Py_DECREF(While_annotations);
1741
0
            return 0;
1742
0
        }
1743
16
    }
1744
16
    {
1745
16
        PyObject *type = state->stmt_type;
1746
16
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
1747
16
        cond = type != NULL;
1748
16
        if (!cond) {
1749
0
            Py_DECREF(While_annotations);
1750
0
            return 0;
1751
0
        }
1752
16
        cond = PyDict_SetItemString(While_annotations, "body", type) == 0;
1753
16
        Py_DECREF(type);
1754
16
        if (!cond) {
1755
0
            Py_DECREF(While_annotations);
1756
0
            return 0;
1757
0
        }
1758
16
    }
1759
16
    {
1760
16
        PyObject *type = state->stmt_type;
1761
16
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
1762
16
        cond = type != NULL;
1763
16
        if (!cond) {
1764
0
            Py_DECREF(While_annotations);
1765
0
            return 0;
1766
0
        }
1767
16
        cond = PyDict_SetItemString(While_annotations, "orelse", type) == 0;
1768
16
        Py_DECREF(type);
1769
16
        if (!cond) {
1770
0
            Py_DECREF(While_annotations);
1771
0
            return 0;
1772
0
        }
1773
16
    }
1774
16
    cond = PyObject_SetAttrString(state->While_type, "_field_types",
1775
16
                                  While_annotations) == 0;
1776
16
    if (!cond) {
1777
0
        Py_DECREF(While_annotations);
1778
0
        return 0;
1779
0
    }
1780
16
    cond = PyObject_SetAttrString(state->While_type, "__annotations__",
1781
16
                                  While_annotations) == 0;
1782
16
    if (!cond) {
1783
0
        Py_DECREF(While_annotations);
1784
0
        return 0;
1785
0
    }
1786
16
    Py_DECREF(While_annotations);
1787
16
    PyObject *If_annotations = PyDict_New();
1788
16
    if (!If_annotations) return 0;
1789
16
    {
1790
16
        PyObject *type = state->expr_type;
1791
16
        Py_INCREF(type);
1792
16
        cond = PyDict_SetItemString(If_annotations, "test", type) == 0;
1793
16
        Py_DECREF(type);
1794
16
        if (!cond) {
1795
0
            Py_DECREF(If_annotations);
1796
0
            return 0;
1797
0
        }
1798
16
    }
1799
16
    {
1800
16
        PyObject *type = state->stmt_type;
1801
16
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
1802
16
        cond = type != NULL;
1803
16
        if (!cond) {
1804
0
            Py_DECREF(If_annotations);
1805
0
            return 0;
1806
0
        }
1807
16
        cond = PyDict_SetItemString(If_annotations, "body", type) == 0;
1808
16
        Py_DECREF(type);
1809
16
        if (!cond) {
1810
0
            Py_DECREF(If_annotations);
1811
0
            return 0;
1812
0
        }
1813
16
    }
1814
16
    {
1815
16
        PyObject *type = state->stmt_type;
1816
16
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
1817
16
        cond = type != NULL;
1818
16
        if (!cond) {
1819
0
            Py_DECREF(If_annotations);
1820
0
            return 0;
1821
0
        }
1822
16
        cond = PyDict_SetItemString(If_annotations, "orelse", type) == 0;
1823
16
        Py_DECREF(type);
1824
16
        if (!cond) {
1825
0
            Py_DECREF(If_annotations);
1826
0
            return 0;
1827
0
        }
1828
16
    }
1829
16
    cond = PyObject_SetAttrString(state->If_type, "_field_types",
1830
16
                                  If_annotations) == 0;
1831
16
    if (!cond) {
1832
0
        Py_DECREF(If_annotations);
1833
0
        return 0;
1834
0
    }
1835
16
    cond = PyObject_SetAttrString(state->If_type, "__annotations__",
1836
16
                                  If_annotations) == 0;
1837
16
    if (!cond) {
1838
0
        Py_DECREF(If_annotations);
1839
0
        return 0;
1840
0
    }
1841
16
    Py_DECREF(If_annotations);
1842
16
    PyObject *With_annotations = PyDict_New();
1843
16
    if (!With_annotations) return 0;
1844
16
    {
1845
16
        PyObject *type = state->withitem_type;
1846
16
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
1847
16
        cond = type != NULL;
1848
16
        if (!cond) {
1849
0
            Py_DECREF(With_annotations);
1850
0
            return 0;
1851
0
        }
1852
16
        cond = PyDict_SetItemString(With_annotations, "items", type) == 0;
1853
16
        Py_DECREF(type);
1854
16
        if (!cond) {
1855
0
            Py_DECREF(With_annotations);
1856
0
            return 0;
1857
0
        }
1858
16
    }
1859
16
    {
1860
16
        PyObject *type = state->stmt_type;
1861
16
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
1862
16
        cond = type != NULL;
1863
16
        if (!cond) {
1864
0
            Py_DECREF(With_annotations);
1865
0
            return 0;
1866
0
        }
1867
16
        cond = PyDict_SetItemString(With_annotations, "body", type) == 0;
1868
16
        Py_DECREF(type);
1869
16
        if (!cond) {
1870
0
            Py_DECREF(With_annotations);
1871
0
            return 0;
1872
0
        }
1873
16
    }
1874
16
    {
1875
16
        PyObject *type = (PyObject *)&PyUnicode_Type;
1876
16
        type = _Py_union_type_or(type, Py_None);
1877
16
        cond = type != NULL;
1878
16
        if (!cond) {
1879
0
            Py_DECREF(With_annotations);
1880
0
            return 0;
1881
0
        }
1882
16
        cond = PyDict_SetItemString(With_annotations, "type_comment", type) ==
1883
16
                                    0;
1884
16
        Py_DECREF(type);
1885
16
        if (!cond) {
1886
0
            Py_DECREF(With_annotations);
1887
0
            return 0;
1888
0
        }
1889
16
    }
1890
16
    cond = PyObject_SetAttrString(state->With_type, "_field_types",
1891
16
                                  With_annotations) == 0;
1892
16
    if (!cond) {
1893
0
        Py_DECREF(With_annotations);
1894
0
        return 0;
1895
0
    }
1896
16
    cond = PyObject_SetAttrString(state->With_type, "__annotations__",
1897
16
                                  With_annotations) == 0;
1898
16
    if (!cond) {
1899
0
        Py_DECREF(With_annotations);
1900
0
        return 0;
1901
0
    }
1902
16
    Py_DECREF(With_annotations);
1903
16
    PyObject *AsyncWith_annotations = PyDict_New();
1904
16
    if (!AsyncWith_annotations) return 0;
1905
16
    {
1906
16
        PyObject *type = state->withitem_type;
1907
16
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
1908
16
        cond = type != NULL;
1909
16
        if (!cond) {
1910
0
            Py_DECREF(AsyncWith_annotations);
1911
0
            return 0;
1912
0
        }
1913
16
        cond = PyDict_SetItemString(AsyncWith_annotations, "items", type) == 0;
1914
16
        Py_DECREF(type);
1915
16
        if (!cond) {
1916
0
            Py_DECREF(AsyncWith_annotations);
1917
0
            return 0;
1918
0
        }
1919
16
    }
1920
16
    {
1921
16
        PyObject *type = state->stmt_type;
1922
16
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
1923
16
        cond = type != NULL;
1924
16
        if (!cond) {
1925
0
            Py_DECREF(AsyncWith_annotations);
1926
0
            return 0;
1927
0
        }
1928
16
        cond = PyDict_SetItemString(AsyncWith_annotations, "body", type) == 0;
1929
16
        Py_DECREF(type);
1930
16
        if (!cond) {
1931
0
            Py_DECREF(AsyncWith_annotations);
1932
0
            return 0;
1933
0
        }
1934
16
    }
1935
16
    {
1936
16
        PyObject *type = (PyObject *)&PyUnicode_Type;
1937
16
        type = _Py_union_type_or(type, Py_None);
1938
16
        cond = type != NULL;
1939
16
        if (!cond) {
1940
0
            Py_DECREF(AsyncWith_annotations);
1941
0
            return 0;
1942
0
        }
1943
16
        cond = PyDict_SetItemString(AsyncWith_annotations, "type_comment",
1944
16
                                    type) == 0;
1945
16
        Py_DECREF(type);
1946
16
        if (!cond) {
1947
0
            Py_DECREF(AsyncWith_annotations);
1948
0
            return 0;
1949
0
        }
1950
16
    }
1951
16
    cond = PyObject_SetAttrString(state->AsyncWith_type, "_field_types",
1952
16
                                  AsyncWith_annotations) == 0;
1953
16
    if (!cond) {
1954
0
        Py_DECREF(AsyncWith_annotations);
1955
0
        return 0;
1956
0
    }
1957
16
    cond = PyObject_SetAttrString(state->AsyncWith_type, "__annotations__",
1958
16
                                  AsyncWith_annotations) == 0;
1959
16
    if (!cond) {
1960
0
        Py_DECREF(AsyncWith_annotations);
1961
0
        return 0;
1962
0
    }
1963
16
    Py_DECREF(AsyncWith_annotations);
1964
16
    PyObject *Match_annotations = PyDict_New();
1965
16
    if (!Match_annotations) return 0;
1966
16
    {
1967
16
        PyObject *type = state->expr_type;
1968
16
        Py_INCREF(type);
1969
16
        cond = PyDict_SetItemString(Match_annotations, "subject", type) == 0;
1970
16
        Py_DECREF(type);
1971
16
        if (!cond) {
1972
0
            Py_DECREF(Match_annotations);
1973
0
            return 0;
1974
0
        }
1975
16
    }
1976
16
    {
1977
16
        PyObject *type = state->match_case_type;
1978
16
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
1979
16
        cond = type != NULL;
1980
16
        if (!cond) {
1981
0
            Py_DECREF(Match_annotations);
1982
0
            return 0;
1983
0
        }
1984
16
        cond = PyDict_SetItemString(Match_annotations, "cases", type) == 0;
1985
16
        Py_DECREF(type);
1986
16
        if (!cond) {
1987
0
            Py_DECREF(Match_annotations);
1988
0
            return 0;
1989
0
        }
1990
16
    }
1991
16
    cond = PyObject_SetAttrString(state->Match_type, "_field_types",
1992
16
                                  Match_annotations) == 0;
1993
16
    if (!cond) {
1994
0
        Py_DECREF(Match_annotations);
1995
0
        return 0;
1996
0
    }
1997
16
    cond = PyObject_SetAttrString(state->Match_type, "__annotations__",
1998
16
                                  Match_annotations) == 0;
1999
16
    if (!cond) {
2000
0
        Py_DECREF(Match_annotations);
2001
0
        return 0;
2002
0
    }
2003
16
    Py_DECREF(Match_annotations);
2004
16
    PyObject *Raise_annotations = PyDict_New();
2005
16
    if (!Raise_annotations) return 0;
2006
16
    {
2007
16
        PyObject *type = state->expr_type;
2008
16
        type = _Py_union_type_or(type, Py_None);
2009
16
        cond = type != NULL;
2010
16
        if (!cond) {
2011
0
            Py_DECREF(Raise_annotations);
2012
0
            return 0;
2013
0
        }
2014
16
        cond = PyDict_SetItemString(Raise_annotations, "exc", type) == 0;
2015
16
        Py_DECREF(type);
2016
16
        if (!cond) {
2017
0
            Py_DECREF(Raise_annotations);
2018
0
            return 0;
2019
0
        }
2020
16
    }
2021
16
    {
2022
16
        PyObject *type = state->expr_type;
2023
16
        type = _Py_union_type_or(type, Py_None);
2024
16
        cond = type != NULL;
2025
16
        if (!cond) {
2026
0
            Py_DECREF(Raise_annotations);
2027
0
            return 0;
2028
0
        }
2029
16
        cond = PyDict_SetItemString(Raise_annotations, "cause", type) == 0;
2030
16
        Py_DECREF(type);
2031
16
        if (!cond) {
2032
0
            Py_DECREF(Raise_annotations);
2033
0
            return 0;
2034
0
        }
2035
16
    }
2036
16
    cond = PyObject_SetAttrString(state->Raise_type, "_field_types",
2037
16
                                  Raise_annotations) == 0;
2038
16
    if (!cond) {
2039
0
        Py_DECREF(Raise_annotations);
2040
0
        return 0;
2041
0
    }
2042
16
    cond = PyObject_SetAttrString(state->Raise_type, "__annotations__",
2043
16
                                  Raise_annotations) == 0;
2044
16
    if (!cond) {
2045
0
        Py_DECREF(Raise_annotations);
2046
0
        return 0;
2047
0
    }
2048
16
    Py_DECREF(Raise_annotations);
2049
16
    PyObject *Try_annotations = PyDict_New();
2050
16
    if (!Try_annotations) return 0;
2051
16
    {
2052
16
        PyObject *type = state->stmt_type;
2053
16
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
2054
16
        cond = type != NULL;
2055
16
        if (!cond) {
2056
0
            Py_DECREF(Try_annotations);
2057
0
            return 0;
2058
0
        }
2059
16
        cond = PyDict_SetItemString(Try_annotations, "body", type) == 0;
2060
16
        Py_DECREF(type);
2061
16
        if (!cond) {
2062
0
            Py_DECREF(Try_annotations);
2063
0
            return 0;
2064
0
        }
2065
16
    }
2066
16
    {
2067
16
        PyObject *type = state->excepthandler_type;
2068
16
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
2069
16
        cond = type != NULL;
2070
16
        if (!cond) {
2071
0
            Py_DECREF(Try_annotations);
2072
0
            return 0;
2073
0
        }
2074
16
        cond = PyDict_SetItemString(Try_annotations, "handlers", type) == 0;
2075
16
        Py_DECREF(type);
2076
16
        if (!cond) {
2077
0
            Py_DECREF(Try_annotations);
2078
0
            return 0;
2079
0
        }
2080
16
    }
2081
16
    {
2082
16
        PyObject *type = state->stmt_type;
2083
16
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
2084
16
        cond = type != NULL;
2085
16
        if (!cond) {
2086
0
            Py_DECREF(Try_annotations);
2087
0
            return 0;
2088
0
        }
2089
16
        cond = PyDict_SetItemString(Try_annotations, "orelse", type) == 0;
2090
16
        Py_DECREF(type);
2091
16
        if (!cond) {
2092
0
            Py_DECREF(Try_annotations);
2093
0
            return 0;
2094
0
        }
2095
16
    }
2096
16
    {
2097
16
        PyObject *type = state->stmt_type;
2098
16
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
2099
16
        cond = type != NULL;
2100
16
        if (!cond) {
2101
0
            Py_DECREF(Try_annotations);
2102
0
            return 0;
2103
0
        }
2104
16
        cond = PyDict_SetItemString(Try_annotations, "finalbody", type) == 0;
2105
16
        Py_DECREF(type);
2106
16
        if (!cond) {
2107
0
            Py_DECREF(Try_annotations);
2108
0
            return 0;
2109
0
        }
2110
16
    }
2111
16
    cond = PyObject_SetAttrString(state->Try_type, "_field_types",
2112
16
                                  Try_annotations) == 0;
2113
16
    if (!cond) {
2114
0
        Py_DECREF(Try_annotations);
2115
0
        return 0;
2116
0
    }
2117
16
    cond = PyObject_SetAttrString(state->Try_type, "__annotations__",
2118
16
                                  Try_annotations) == 0;
2119
16
    if (!cond) {
2120
0
        Py_DECREF(Try_annotations);
2121
0
        return 0;
2122
0
    }
2123
16
    Py_DECREF(Try_annotations);
2124
16
    PyObject *TryStar_annotations = PyDict_New();
2125
16
    if (!TryStar_annotations) return 0;
2126
16
    {
2127
16
        PyObject *type = state->stmt_type;
2128
16
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
2129
16
        cond = type != NULL;
2130
16
        if (!cond) {
2131
0
            Py_DECREF(TryStar_annotations);
2132
0
            return 0;
2133
0
        }
2134
16
        cond = PyDict_SetItemString(TryStar_annotations, "body", type) == 0;
2135
16
        Py_DECREF(type);
2136
16
        if (!cond) {
2137
0
            Py_DECREF(TryStar_annotations);
2138
0
            return 0;
2139
0
        }
2140
16
    }
2141
16
    {
2142
16
        PyObject *type = state->excepthandler_type;
2143
16
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
2144
16
        cond = type != NULL;
2145
16
        if (!cond) {
2146
0
            Py_DECREF(TryStar_annotations);
2147
0
            return 0;
2148
0
        }
2149
16
        cond = PyDict_SetItemString(TryStar_annotations, "handlers", type) == 0;
2150
16
        Py_DECREF(type);
2151
16
        if (!cond) {
2152
0
            Py_DECREF(TryStar_annotations);
2153
0
            return 0;
2154
0
        }
2155
16
    }
2156
16
    {
2157
16
        PyObject *type = state->stmt_type;
2158
16
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
2159
16
        cond = type != NULL;
2160
16
        if (!cond) {
2161
0
            Py_DECREF(TryStar_annotations);
2162
0
            return 0;
2163
0
        }
2164
16
        cond = PyDict_SetItemString(TryStar_annotations, "orelse", type) == 0;
2165
16
        Py_DECREF(type);
2166
16
        if (!cond) {
2167
0
            Py_DECREF(TryStar_annotations);
2168
0
            return 0;
2169
0
        }
2170
16
    }
2171
16
    {
2172
16
        PyObject *type = state->stmt_type;
2173
16
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
2174
16
        cond = type != NULL;
2175
16
        if (!cond) {
2176
0
            Py_DECREF(TryStar_annotations);
2177
0
            return 0;
2178
0
        }
2179
16
        cond = PyDict_SetItemString(TryStar_annotations, "finalbody", type) ==
2180
16
                                    0;
2181
16
        Py_DECREF(type);
2182
16
        if (!cond) {
2183
0
            Py_DECREF(TryStar_annotations);
2184
0
            return 0;
2185
0
        }
2186
16
    }
2187
16
    cond = PyObject_SetAttrString(state->TryStar_type, "_field_types",
2188
16
                                  TryStar_annotations) == 0;
2189
16
    if (!cond) {
2190
0
        Py_DECREF(TryStar_annotations);
2191
0
        return 0;
2192
0
    }
2193
16
    cond = PyObject_SetAttrString(state->TryStar_type, "__annotations__",
2194
16
                                  TryStar_annotations) == 0;
2195
16
    if (!cond) {
2196
0
        Py_DECREF(TryStar_annotations);
2197
0
        return 0;
2198
0
    }
2199
16
    Py_DECREF(TryStar_annotations);
2200
16
    PyObject *Assert_annotations = PyDict_New();
2201
16
    if (!Assert_annotations) return 0;
2202
16
    {
2203
16
        PyObject *type = state->expr_type;
2204
16
        Py_INCREF(type);
2205
16
        cond = PyDict_SetItemString(Assert_annotations, "test", type) == 0;
2206
16
        Py_DECREF(type);
2207
16
        if (!cond) {
2208
0
            Py_DECREF(Assert_annotations);
2209
0
            return 0;
2210
0
        }
2211
16
    }
2212
16
    {
2213
16
        PyObject *type = state->expr_type;
2214
16
        type = _Py_union_type_or(type, Py_None);
2215
16
        cond = type != NULL;
2216
16
        if (!cond) {
2217
0
            Py_DECREF(Assert_annotations);
2218
0
            return 0;
2219
0
        }
2220
16
        cond = PyDict_SetItemString(Assert_annotations, "msg", type) == 0;
2221
16
        Py_DECREF(type);
2222
16
        if (!cond) {
2223
0
            Py_DECREF(Assert_annotations);
2224
0
            return 0;
2225
0
        }
2226
16
    }
2227
16
    cond = PyObject_SetAttrString(state->Assert_type, "_field_types",
2228
16
                                  Assert_annotations) == 0;
2229
16
    if (!cond) {
2230
0
        Py_DECREF(Assert_annotations);
2231
0
        return 0;
2232
0
    }
2233
16
    cond = PyObject_SetAttrString(state->Assert_type, "__annotations__",
2234
16
                                  Assert_annotations) == 0;
2235
16
    if (!cond) {
2236
0
        Py_DECREF(Assert_annotations);
2237
0
        return 0;
2238
0
    }
2239
16
    Py_DECREF(Assert_annotations);
2240
16
    PyObject *Import_annotations = PyDict_New();
2241
16
    if (!Import_annotations) return 0;
2242
16
    {
2243
16
        PyObject *type = state->alias_type;
2244
16
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
2245
16
        cond = type != NULL;
2246
16
        if (!cond) {
2247
0
            Py_DECREF(Import_annotations);
2248
0
            return 0;
2249
0
        }
2250
16
        cond = PyDict_SetItemString(Import_annotations, "names", type) == 0;
2251
16
        Py_DECREF(type);
2252
16
        if (!cond) {
2253
0
            Py_DECREF(Import_annotations);
2254
0
            return 0;
2255
0
        }
2256
16
    }
2257
16
    cond = PyObject_SetAttrString(state->Import_type, "_field_types",
2258
16
                                  Import_annotations) == 0;
2259
16
    if (!cond) {
2260
0
        Py_DECREF(Import_annotations);
2261
0
        return 0;
2262
0
    }
2263
16
    cond = PyObject_SetAttrString(state->Import_type, "__annotations__",
2264
16
                                  Import_annotations) == 0;
2265
16
    if (!cond) {
2266
0
        Py_DECREF(Import_annotations);
2267
0
        return 0;
2268
0
    }
2269
16
    Py_DECREF(Import_annotations);
2270
16
    PyObject *ImportFrom_annotations = PyDict_New();
2271
16
    if (!ImportFrom_annotations) return 0;
2272
16
    {
2273
16
        PyObject *type = (PyObject *)&PyUnicode_Type;
2274
16
        type = _Py_union_type_or(type, Py_None);
2275
16
        cond = type != NULL;
2276
16
        if (!cond) {
2277
0
            Py_DECREF(ImportFrom_annotations);
2278
0
            return 0;
2279
0
        }
2280
16
        cond = PyDict_SetItemString(ImportFrom_annotations, "module", type) ==
2281
16
                                    0;
2282
16
        Py_DECREF(type);
2283
16
        if (!cond) {
2284
0
            Py_DECREF(ImportFrom_annotations);
2285
0
            return 0;
2286
0
        }
2287
16
    }
2288
16
    {
2289
16
        PyObject *type = state->alias_type;
2290
16
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
2291
16
        cond = type != NULL;
2292
16
        if (!cond) {
2293
0
            Py_DECREF(ImportFrom_annotations);
2294
0
            return 0;
2295
0
        }
2296
16
        cond = PyDict_SetItemString(ImportFrom_annotations, "names", type) == 0;
2297
16
        Py_DECREF(type);
2298
16
        if (!cond) {
2299
0
            Py_DECREF(ImportFrom_annotations);
2300
0
            return 0;
2301
0
        }
2302
16
    }
2303
16
    {
2304
16
        PyObject *type = (PyObject *)&PyLong_Type;
2305
16
        type = _Py_union_type_or(type, Py_None);
2306
16
        cond = type != NULL;
2307
16
        if (!cond) {
2308
0
            Py_DECREF(ImportFrom_annotations);
2309
0
            return 0;
2310
0
        }
2311
16
        cond = PyDict_SetItemString(ImportFrom_annotations, "level", type) == 0;
2312
16
        Py_DECREF(type);
2313
16
        if (!cond) {
2314
0
            Py_DECREF(ImportFrom_annotations);
2315
0
            return 0;
2316
0
        }
2317
16
    }
2318
16
    cond = PyObject_SetAttrString(state->ImportFrom_type, "_field_types",
2319
16
                                  ImportFrom_annotations) == 0;
2320
16
    if (!cond) {
2321
0
        Py_DECREF(ImportFrom_annotations);
2322
0
        return 0;
2323
0
    }
2324
16
    cond = PyObject_SetAttrString(state->ImportFrom_type, "__annotations__",
2325
16
                                  ImportFrom_annotations) == 0;
2326
16
    if (!cond) {
2327
0
        Py_DECREF(ImportFrom_annotations);
2328
0
        return 0;
2329
0
    }
2330
16
    Py_DECREF(ImportFrom_annotations);
2331
16
    PyObject *Global_annotations = PyDict_New();
2332
16
    if (!Global_annotations) return 0;
2333
16
    {
2334
16
        PyObject *type = (PyObject *)&PyUnicode_Type;
2335
16
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
2336
16
        cond = type != NULL;
2337
16
        if (!cond) {
2338
0
            Py_DECREF(Global_annotations);
2339
0
            return 0;
2340
0
        }
2341
16
        cond = PyDict_SetItemString(Global_annotations, "names", type) == 0;
2342
16
        Py_DECREF(type);
2343
16
        if (!cond) {
2344
0
            Py_DECREF(Global_annotations);
2345
0
            return 0;
2346
0
        }
2347
16
    }
2348
16
    cond = PyObject_SetAttrString(state->Global_type, "_field_types",
2349
16
                                  Global_annotations) == 0;
2350
16
    if (!cond) {
2351
0
        Py_DECREF(Global_annotations);
2352
0
        return 0;
2353
0
    }
2354
16
    cond = PyObject_SetAttrString(state->Global_type, "__annotations__",
2355
16
                                  Global_annotations) == 0;
2356
16
    if (!cond) {
2357
0
        Py_DECREF(Global_annotations);
2358
0
        return 0;
2359
0
    }
2360
16
    Py_DECREF(Global_annotations);
2361
16
    PyObject *Nonlocal_annotations = PyDict_New();
2362
16
    if (!Nonlocal_annotations) return 0;
2363
16
    {
2364
16
        PyObject *type = (PyObject *)&PyUnicode_Type;
2365
16
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
2366
16
        cond = type != NULL;
2367
16
        if (!cond) {
2368
0
            Py_DECREF(Nonlocal_annotations);
2369
0
            return 0;
2370
0
        }
2371
16
        cond = PyDict_SetItemString(Nonlocal_annotations, "names", type) == 0;
2372
16
        Py_DECREF(type);
2373
16
        if (!cond) {
2374
0
            Py_DECREF(Nonlocal_annotations);
2375
0
            return 0;
2376
0
        }
2377
16
    }
2378
16
    cond = PyObject_SetAttrString(state->Nonlocal_type, "_field_types",
2379
16
                                  Nonlocal_annotations) == 0;
2380
16
    if (!cond) {
2381
0
        Py_DECREF(Nonlocal_annotations);
2382
0
        return 0;
2383
0
    }
2384
16
    cond = PyObject_SetAttrString(state->Nonlocal_type, "__annotations__",
2385
16
                                  Nonlocal_annotations) == 0;
2386
16
    if (!cond) {
2387
0
        Py_DECREF(Nonlocal_annotations);
2388
0
        return 0;
2389
0
    }
2390
16
    Py_DECREF(Nonlocal_annotations);
2391
16
    PyObject *Expr_annotations = PyDict_New();
2392
16
    if (!Expr_annotations) return 0;
2393
16
    {
2394
16
        PyObject *type = state->expr_type;
2395
16
        Py_INCREF(type);
2396
16
        cond = PyDict_SetItemString(Expr_annotations, "value", type) == 0;
2397
16
        Py_DECREF(type);
2398
16
        if (!cond) {
2399
0
            Py_DECREF(Expr_annotations);
2400
0
            return 0;
2401
0
        }
2402
16
    }
2403
16
    cond = PyObject_SetAttrString(state->Expr_type, "_field_types",
2404
16
                                  Expr_annotations) == 0;
2405
16
    if (!cond) {
2406
0
        Py_DECREF(Expr_annotations);
2407
0
        return 0;
2408
0
    }
2409
16
    cond = PyObject_SetAttrString(state->Expr_type, "__annotations__",
2410
16
                                  Expr_annotations) == 0;
2411
16
    if (!cond) {
2412
0
        Py_DECREF(Expr_annotations);
2413
0
        return 0;
2414
0
    }
2415
16
    Py_DECREF(Expr_annotations);
2416
16
    PyObject *Pass_annotations = PyDict_New();
2417
16
    if (!Pass_annotations) return 0;
2418
16
    cond = PyObject_SetAttrString(state->Pass_type, "_field_types",
2419
16
                                  Pass_annotations) == 0;
2420
16
    if (!cond) {
2421
0
        Py_DECREF(Pass_annotations);
2422
0
        return 0;
2423
0
    }
2424
16
    cond = PyObject_SetAttrString(state->Pass_type, "__annotations__",
2425
16
                                  Pass_annotations) == 0;
2426
16
    if (!cond) {
2427
0
        Py_DECREF(Pass_annotations);
2428
0
        return 0;
2429
0
    }
2430
16
    Py_DECREF(Pass_annotations);
2431
16
    PyObject *Break_annotations = PyDict_New();
2432
16
    if (!Break_annotations) return 0;
2433
16
    cond = PyObject_SetAttrString(state->Break_type, "_field_types",
2434
16
                                  Break_annotations) == 0;
2435
16
    if (!cond) {
2436
0
        Py_DECREF(Break_annotations);
2437
0
        return 0;
2438
0
    }
2439
16
    cond = PyObject_SetAttrString(state->Break_type, "__annotations__",
2440
16
                                  Break_annotations) == 0;
2441
16
    if (!cond) {
2442
0
        Py_DECREF(Break_annotations);
2443
0
        return 0;
2444
0
    }
2445
16
    Py_DECREF(Break_annotations);
2446
16
    PyObject *Continue_annotations = PyDict_New();
2447
16
    if (!Continue_annotations) return 0;
2448
16
    cond = PyObject_SetAttrString(state->Continue_type, "_field_types",
2449
16
                                  Continue_annotations) == 0;
2450
16
    if (!cond) {
2451
0
        Py_DECREF(Continue_annotations);
2452
0
        return 0;
2453
0
    }
2454
16
    cond = PyObject_SetAttrString(state->Continue_type, "__annotations__",
2455
16
                                  Continue_annotations) == 0;
2456
16
    if (!cond) {
2457
0
        Py_DECREF(Continue_annotations);
2458
0
        return 0;
2459
0
    }
2460
16
    Py_DECREF(Continue_annotations);
2461
16
    PyObject *BoolOp_annotations = PyDict_New();
2462
16
    if (!BoolOp_annotations) return 0;
2463
16
    {
2464
16
        PyObject *type = state->boolop_type;
2465
16
        Py_INCREF(type);
2466
16
        cond = PyDict_SetItemString(BoolOp_annotations, "op", type) == 0;
2467
16
        Py_DECREF(type);
2468
16
        if (!cond) {
2469
0
            Py_DECREF(BoolOp_annotations);
2470
0
            return 0;
2471
0
        }
2472
16
    }
2473
16
    {
2474
16
        PyObject *type = state->expr_type;
2475
16
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
2476
16
        cond = type != NULL;
2477
16
        if (!cond) {
2478
0
            Py_DECREF(BoolOp_annotations);
2479
0
            return 0;
2480
0
        }
2481
16
        cond = PyDict_SetItemString(BoolOp_annotations, "values", type) == 0;
2482
16
        Py_DECREF(type);
2483
16
        if (!cond) {
2484
0
            Py_DECREF(BoolOp_annotations);
2485
0
            return 0;
2486
0
        }
2487
16
    }
2488
16
    cond = PyObject_SetAttrString(state->BoolOp_type, "_field_types",
2489
16
                                  BoolOp_annotations) == 0;
2490
16
    if (!cond) {
2491
0
        Py_DECREF(BoolOp_annotations);
2492
0
        return 0;
2493
0
    }
2494
16
    cond = PyObject_SetAttrString(state->BoolOp_type, "__annotations__",
2495
16
                                  BoolOp_annotations) == 0;
2496
16
    if (!cond) {
2497
0
        Py_DECREF(BoolOp_annotations);
2498
0
        return 0;
2499
0
    }
2500
16
    Py_DECREF(BoolOp_annotations);
2501
16
    PyObject *NamedExpr_annotations = PyDict_New();
2502
16
    if (!NamedExpr_annotations) return 0;
2503
16
    {
2504
16
        PyObject *type = state->expr_type;
2505
16
        Py_INCREF(type);
2506
16
        cond = PyDict_SetItemString(NamedExpr_annotations, "target", type) == 0;
2507
16
        Py_DECREF(type);
2508
16
        if (!cond) {
2509
0
            Py_DECREF(NamedExpr_annotations);
2510
0
            return 0;
2511
0
        }
2512
16
    }
2513
16
    {
2514
16
        PyObject *type = state->expr_type;
2515
16
        Py_INCREF(type);
2516
16
        cond = PyDict_SetItemString(NamedExpr_annotations, "value", type) == 0;
2517
16
        Py_DECREF(type);
2518
16
        if (!cond) {
2519
0
            Py_DECREF(NamedExpr_annotations);
2520
0
            return 0;
2521
0
        }
2522
16
    }
2523
16
    cond = PyObject_SetAttrString(state->NamedExpr_type, "_field_types",
2524
16
                                  NamedExpr_annotations) == 0;
2525
16
    if (!cond) {
2526
0
        Py_DECREF(NamedExpr_annotations);
2527
0
        return 0;
2528
0
    }
2529
16
    cond = PyObject_SetAttrString(state->NamedExpr_type, "__annotations__",
2530
16
                                  NamedExpr_annotations) == 0;
2531
16
    if (!cond) {
2532
0
        Py_DECREF(NamedExpr_annotations);
2533
0
        return 0;
2534
0
    }
2535
16
    Py_DECREF(NamedExpr_annotations);
2536
16
    PyObject *BinOp_annotations = PyDict_New();
2537
16
    if (!BinOp_annotations) return 0;
2538
16
    {
2539
16
        PyObject *type = state->expr_type;
2540
16
        Py_INCREF(type);
2541
16
        cond = PyDict_SetItemString(BinOp_annotations, "left", type) == 0;
2542
16
        Py_DECREF(type);
2543
16
        if (!cond) {
2544
0
            Py_DECREF(BinOp_annotations);
2545
0
            return 0;
2546
0
        }
2547
16
    }
2548
16
    {
2549
16
        PyObject *type = state->operator_type;
2550
16
        Py_INCREF(type);
2551
16
        cond = PyDict_SetItemString(BinOp_annotations, "op", type) == 0;
2552
16
        Py_DECREF(type);
2553
16
        if (!cond) {
2554
0
            Py_DECREF(BinOp_annotations);
2555
0
            return 0;
2556
0
        }
2557
16
    }
2558
16
    {
2559
16
        PyObject *type = state->expr_type;
2560
16
        Py_INCREF(type);
2561
16
        cond = PyDict_SetItemString(BinOp_annotations, "right", type) == 0;
2562
16
        Py_DECREF(type);
2563
16
        if (!cond) {
2564
0
            Py_DECREF(BinOp_annotations);
2565
0
            return 0;
2566
0
        }
2567
16
    }
2568
16
    cond = PyObject_SetAttrString(state->BinOp_type, "_field_types",
2569
16
                                  BinOp_annotations) == 0;
2570
16
    if (!cond) {
2571
0
        Py_DECREF(BinOp_annotations);
2572
0
        return 0;
2573
0
    }
2574
16
    cond = PyObject_SetAttrString(state->BinOp_type, "__annotations__",
2575
16
                                  BinOp_annotations) == 0;
2576
16
    if (!cond) {
2577
0
        Py_DECREF(BinOp_annotations);
2578
0
        return 0;
2579
0
    }
2580
16
    Py_DECREF(BinOp_annotations);
2581
16
    PyObject *UnaryOp_annotations = PyDict_New();
2582
16
    if (!UnaryOp_annotations) return 0;
2583
16
    {
2584
16
        PyObject *type = state->unaryop_type;
2585
16
        Py_INCREF(type);
2586
16
        cond = PyDict_SetItemString(UnaryOp_annotations, "op", type) == 0;
2587
16
        Py_DECREF(type);
2588
16
        if (!cond) {
2589
0
            Py_DECREF(UnaryOp_annotations);
2590
0
            return 0;
2591
0
        }
2592
16
    }
2593
16
    {
2594
16
        PyObject *type = state->expr_type;
2595
16
        Py_INCREF(type);
2596
16
        cond = PyDict_SetItemString(UnaryOp_annotations, "operand", type) == 0;
2597
16
        Py_DECREF(type);
2598
16
        if (!cond) {
2599
0
            Py_DECREF(UnaryOp_annotations);
2600
0
            return 0;
2601
0
        }
2602
16
    }
2603
16
    cond = PyObject_SetAttrString(state->UnaryOp_type, "_field_types",
2604
16
                                  UnaryOp_annotations) == 0;
2605
16
    if (!cond) {
2606
0
        Py_DECREF(UnaryOp_annotations);
2607
0
        return 0;
2608
0
    }
2609
16
    cond = PyObject_SetAttrString(state->UnaryOp_type, "__annotations__",
2610
16
                                  UnaryOp_annotations) == 0;
2611
16
    if (!cond) {
2612
0
        Py_DECREF(UnaryOp_annotations);
2613
0
        return 0;
2614
0
    }
2615
16
    Py_DECREF(UnaryOp_annotations);
2616
16
    PyObject *Lambda_annotations = PyDict_New();
2617
16
    if (!Lambda_annotations) return 0;
2618
16
    {
2619
16
        PyObject *type = state->arguments_type;
2620
16
        Py_INCREF(type);
2621
16
        cond = PyDict_SetItemString(Lambda_annotations, "args", type) == 0;
2622
16
        Py_DECREF(type);
2623
16
        if (!cond) {
2624
0
            Py_DECREF(Lambda_annotations);
2625
0
            return 0;
2626
0
        }
2627
16
    }
2628
16
    {
2629
16
        PyObject *type = state->expr_type;
2630
16
        Py_INCREF(type);
2631
16
        cond = PyDict_SetItemString(Lambda_annotations, "body", type) == 0;
2632
16
        Py_DECREF(type);
2633
16
        if (!cond) {
2634
0
            Py_DECREF(Lambda_annotations);
2635
0
            return 0;
2636
0
        }
2637
16
    }
2638
16
    cond = PyObject_SetAttrString(state->Lambda_type, "_field_types",
2639
16
                                  Lambda_annotations) == 0;
2640
16
    if (!cond) {
2641
0
        Py_DECREF(Lambda_annotations);
2642
0
        return 0;
2643
0
    }
2644
16
    cond = PyObject_SetAttrString(state->Lambda_type, "__annotations__",
2645
16
                                  Lambda_annotations) == 0;
2646
16
    if (!cond) {
2647
0
        Py_DECREF(Lambda_annotations);
2648
0
        return 0;
2649
0
    }
2650
16
    Py_DECREF(Lambda_annotations);
2651
16
    PyObject *IfExp_annotations = PyDict_New();
2652
16
    if (!IfExp_annotations) return 0;
2653
16
    {
2654
16
        PyObject *type = state->expr_type;
2655
16
        Py_INCREF(type);
2656
16
        cond = PyDict_SetItemString(IfExp_annotations, "test", type) == 0;
2657
16
        Py_DECREF(type);
2658
16
        if (!cond) {
2659
0
            Py_DECREF(IfExp_annotations);
2660
0
            return 0;
2661
0
        }
2662
16
    }
2663
16
    {
2664
16
        PyObject *type = state->expr_type;
2665
16
        Py_INCREF(type);
2666
16
        cond = PyDict_SetItemString(IfExp_annotations, "body", type) == 0;
2667
16
        Py_DECREF(type);
2668
16
        if (!cond) {
2669
0
            Py_DECREF(IfExp_annotations);
2670
0
            return 0;
2671
0
        }
2672
16
    }
2673
16
    {
2674
16
        PyObject *type = state->expr_type;
2675
16
        Py_INCREF(type);
2676
16
        cond = PyDict_SetItemString(IfExp_annotations, "orelse", type) == 0;
2677
16
        Py_DECREF(type);
2678
16
        if (!cond) {
2679
0
            Py_DECREF(IfExp_annotations);
2680
0
            return 0;
2681
0
        }
2682
16
    }
2683
16
    cond = PyObject_SetAttrString(state->IfExp_type, "_field_types",
2684
16
                                  IfExp_annotations) == 0;
2685
16
    if (!cond) {
2686
0
        Py_DECREF(IfExp_annotations);
2687
0
        return 0;
2688
0
    }
2689
16
    cond = PyObject_SetAttrString(state->IfExp_type, "__annotations__",
2690
16
                                  IfExp_annotations) == 0;
2691
16
    if (!cond) {
2692
0
        Py_DECREF(IfExp_annotations);
2693
0
        return 0;
2694
0
    }
2695
16
    Py_DECREF(IfExp_annotations);
2696
16
    PyObject *Dict_annotations = PyDict_New();
2697
16
    if (!Dict_annotations) return 0;
2698
16
    {
2699
16
        PyObject *type = state->expr_type;
2700
16
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
2701
16
        cond = type != NULL;
2702
16
        if (!cond) {
2703
0
            Py_DECREF(Dict_annotations);
2704
0
            return 0;
2705
0
        }
2706
16
        cond = PyDict_SetItemString(Dict_annotations, "keys", type) == 0;
2707
16
        Py_DECREF(type);
2708
16
        if (!cond) {
2709
0
            Py_DECREF(Dict_annotations);
2710
0
            return 0;
2711
0
        }
2712
16
    }
2713
16
    {
2714
16
        PyObject *type = state->expr_type;
2715
16
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
2716
16
        cond = type != NULL;
2717
16
        if (!cond) {
2718
0
            Py_DECREF(Dict_annotations);
2719
0
            return 0;
2720
0
        }
2721
16
        cond = PyDict_SetItemString(Dict_annotations, "values", type) == 0;
2722
16
        Py_DECREF(type);
2723
16
        if (!cond) {
2724
0
            Py_DECREF(Dict_annotations);
2725
0
            return 0;
2726
0
        }
2727
16
    }
2728
16
    cond = PyObject_SetAttrString(state->Dict_type, "_field_types",
2729
16
                                  Dict_annotations) == 0;
2730
16
    if (!cond) {
2731
0
        Py_DECREF(Dict_annotations);
2732
0
        return 0;
2733
0
    }
2734
16
    cond = PyObject_SetAttrString(state->Dict_type, "__annotations__",
2735
16
                                  Dict_annotations) == 0;
2736
16
    if (!cond) {
2737
0
        Py_DECREF(Dict_annotations);
2738
0
        return 0;
2739
0
    }
2740
16
    Py_DECREF(Dict_annotations);
2741
16
    PyObject *Set_annotations = PyDict_New();
2742
16
    if (!Set_annotations) return 0;
2743
16
    {
2744
16
        PyObject *type = state->expr_type;
2745
16
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
2746
16
        cond = type != NULL;
2747
16
        if (!cond) {
2748
0
            Py_DECREF(Set_annotations);
2749
0
            return 0;
2750
0
        }
2751
16
        cond = PyDict_SetItemString(Set_annotations, "elts", type) == 0;
2752
16
        Py_DECREF(type);
2753
16
        if (!cond) {
2754
0
            Py_DECREF(Set_annotations);
2755
0
            return 0;
2756
0
        }
2757
16
    }
2758
16
    cond = PyObject_SetAttrString(state->Set_type, "_field_types",
2759
16
                                  Set_annotations) == 0;
2760
16
    if (!cond) {
2761
0
        Py_DECREF(Set_annotations);
2762
0
        return 0;
2763
0
    }
2764
16
    cond = PyObject_SetAttrString(state->Set_type, "__annotations__",
2765
16
                                  Set_annotations) == 0;
2766
16
    if (!cond) {
2767
0
        Py_DECREF(Set_annotations);
2768
0
        return 0;
2769
0
    }
2770
16
    Py_DECREF(Set_annotations);
2771
16
    PyObject *ListComp_annotations = PyDict_New();
2772
16
    if (!ListComp_annotations) return 0;
2773
16
    {
2774
16
        PyObject *type = state->expr_type;
2775
16
        Py_INCREF(type);
2776
16
        cond = PyDict_SetItemString(ListComp_annotations, "elt", type) == 0;
2777
16
        Py_DECREF(type);
2778
16
        if (!cond) {
2779
0
            Py_DECREF(ListComp_annotations);
2780
0
            return 0;
2781
0
        }
2782
16
    }
2783
16
    {
2784
16
        PyObject *type = state->comprehension_type;
2785
16
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
2786
16
        cond = type != NULL;
2787
16
        if (!cond) {
2788
0
            Py_DECREF(ListComp_annotations);
2789
0
            return 0;
2790
0
        }
2791
16
        cond = PyDict_SetItemString(ListComp_annotations, "generators", type)
2792
16
                                    == 0;
2793
16
        Py_DECREF(type);
2794
16
        if (!cond) {
2795
0
            Py_DECREF(ListComp_annotations);
2796
0
            return 0;
2797
0
        }
2798
16
    }
2799
16
    cond = PyObject_SetAttrString(state->ListComp_type, "_field_types",
2800
16
                                  ListComp_annotations) == 0;
2801
16
    if (!cond) {
2802
0
        Py_DECREF(ListComp_annotations);
2803
0
        return 0;
2804
0
    }
2805
16
    cond = PyObject_SetAttrString(state->ListComp_type, "__annotations__",
2806
16
                                  ListComp_annotations) == 0;
2807
16
    if (!cond) {
2808
0
        Py_DECREF(ListComp_annotations);
2809
0
        return 0;
2810
0
    }
2811
16
    Py_DECREF(ListComp_annotations);
2812
16
    PyObject *SetComp_annotations = PyDict_New();
2813
16
    if (!SetComp_annotations) return 0;
2814
16
    {
2815
16
        PyObject *type = state->expr_type;
2816
16
        Py_INCREF(type);
2817
16
        cond = PyDict_SetItemString(SetComp_annotations, "elt", type) == 0;
2818
16
        Py_DECREF(type);
2819
16
        if (!cond) {
2820
0
            Py_DECREF(SetComp_annotations);
2821
0
            return 0;
2822
0
        }
2823
16
    }
2824
16
    {
2825
16
        PyObject *type = state->comprehension_type;
2826
16
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
2827
16
        cond = type != NULL;
2828
16
        if (!cond) {
2829
0
            Py_DECREF(SetComp_annotations);
2830
0
            return 0;
2831
0
        }
2832
16
        cond = PyDict_SetItemString(SetComp_annotations, "generators", type) ==
2833
16
                                    0;
2834
16
        Py_DECREF(type);
2835
16
        if (!cond) {
2836
0
            Py_DECREF(SetComp_annotations);
2837
0
            return 0;
2838
0
        }
2839
16
    }
2840
16
    cond = PyObject_SetAttrString(state->SetComp_type, "_field_types",
2841
16
                                  SetComp_annotations) == 0;
2842
16
    if (!cond) {
2843
0
        Py_DECREF(SetComp_annotations);
2844
0
        return 0;
2845
0
    }
2846
16
    cond = PyObject_SetAttrString(state->SetComp_type, "__annotations__",
2847
16
                                  SetComp_annotations) == 0;
2848
16
    if (!cond) {
2849
0
        Py_DECREF(SetComp_annotations);
2850
0
        return 0;
2851
0
    }
2852
16
    Py_DECREF(SetComp_annotations);
2853
16
    PyObject *DictComp_annotations = PyDict_New();
2854
16
    if (!DictComp_annotations) return 0;
2855
16
    {
2856
16
        PyObject *type = state->expr_type;
2857
16
        Py_INCREF(type);
2858
16
        cond = PyDict_SetItemString(DictComp_annotations, "key", type) == 0;
2859
16
        Py_DECREF(type);
2860
16
        if (!cond) {
2861
0
            Py_DECREF(DictComp_annotations);
2862
0
            return 0;
2863
0
        }
2864
16
    }
2865
16
    {
2866
16
        PyObject *type = state->expr_type;
2867
16
        Py_INCREF(type);
2868
16
        cond = PyDict_SetItemString(DictComp_annotations, "value", type) == 0;
2869
16
        Py_DECREF(type);
2870
16
        if (!cond) {
2871
0
            Py_DECREF(DictComp_annotations);
2872
0
            return 0;
2873
0
        }
2874
16
    }
2875
16
    {
2876
16
        PyObject *type = state->comprehension_type;
2877
16
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
2878
16
        cond = type != NULL;
2879
16
        if (!cond) {
2880
0
            Py_DECREF(DictComp_annotations);
2881
0
            return 0;
2882
0
        }
2883
16
        cond = PyDict_SetItemString(DictComp_annotations, "generators", type)
2884
16
                                    == 0;
2885
16
        Py_DECREF(type);
2886
16
        if (!cond) {
2887
0
            Py_DECREF(DictComp_annotations);
2888
0
            return 0;
2889
0
        }
2890
16
    }
2891
16
    cond = PyObject_SetAttrString(state->DictComp_type, "_field_types",
2892
16
                                  DictComp_annotations) == 0;
2893
16
    if (!cond) {
2894
0
        Py_DECREF(DictComp_annotations);
2895
0
        return 0;
2896
0
    }
2897
16
    cond = PyObject_SetAttrString(state->DictComp_type, "__annotations__",
2898
16
                                  DictComp_annotations) == 0;
2899
16
    if (!cond) {
2900
0
        Py_DECREF(DictComp_annotations);
2901
0
        return 0;
2902
0
    }
2903
16
    Py_DECREF(DictComp_annotations);
2904
16
    PyObject *GeneratorExp_annotations = PyDict_New();
2905
16
    if (!GeneratorExp_annotations) return 0;
2906
16
    {
2907
16
        PyObject *type = state->expr_type;
2908
16
        Py_INCREF(type);
2909
16
        cond = PyDict_SetItemString(GeneratorExp_annotations, "elt", type) == 0;
2910
16
        Py_DECREF(type);
2911
16
        if (!cond) {
2912
0
            Py_DECREF(GeneratorExp_annotations);
2913
0
            return 0;
2914
0
        }
2915
16
    }
2916
16
    {
2917
16
        PyObject *type = state->comprehension_type;
2918
16
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
2919
16
        cond = type != NULL;
2920
16
        if (!cond) {
2921
0
            Py_DECREF(GeneratorExp_annotations);
2922
0
            return 0;
2923
0
        }
2924
16
        cond = PyDict_SetItemString(GeneratorExp_annotations, "generators",
2925
16
                                    type) == 0;
2926
16
        Py_DECREF(type);
2927
16
        if (!cond) {
2928
0
            Py_DECREF(GeneratorExp_annotations);
2929
0
            return 0;
2930
0
        }
2931
16
    }
2932
16
    cond = PyObject_SetAttrString(state->GeneratorExp_type, "_field_types",
2933
16
                                  GeneratorExp_annotations) == 0;
2934
16
    if (!cond) {
2935
0
        Py_DECREF(GeneratorExp_annotations);
2936
0
        return 0;
2937
0
    }
2938
16
    cond = PyObject_SetAttrString(state->GeneratorExp_type, "__annotations__",
2939
16
                                  GeneratorExp_annotations) == 0;
2940
16
    if (!cond) {
2941
0
        Py_DECREF(GeneratorExp_annotations);
2942
0
        return 0;
2943
0
    }
2944
16
    Py_DECREF(GeneratorExp_annotations);
2945
16
    PyObject *Await_annotations = PyDict_New();
2946
16
    if (!Await_annotations) return 0;
2947
16
    {
2948
16
        PyObject *type = state->expr_type;
2949
16
        Py_INCREF(type);
2950
16
        cond = PyDict_SetItemString(Await_annotations, "value", type) == 0;
2951
16
        Py_DECREF(type);
2952
16
        if (!cond) {
2953
0
            Py_DECREF(Await_annotations);
2954
0
            return 0;
2955
0
        }
2956
16
    }
2957
16
    cond = PyObject_SetAttrString(state->Await_type, "_field_types",
2958
16
                                  Await_annotations) == 0;
2959
16
    if (!cond) {
2960
0
        Py_DECREF(Await_annotations);
2961
0
        return 0;
2962
0
    }
2963
16
    cond = PyObject_SetAttrString(state->Await_type, "__annotations__",
2964
16
                                  Await_annotations) == 0;
2965
16
    if (!cond) {
2966
0
        Py_DECREF(Await_annotations);
2967
0
        return 0;
2968
0
    }
2969
16
    Py_DECREF(Await_annotations);
2970
16
    PyObject *Yield_annotations = PyDict_New();
2971
16
    if (!Yield_annotations) return 0;
2972
16
    {
2973
16
        PyObject *type = state->expr_type;
2974
16
        type = _Py_union_type_or(type, Py_None);
2975
16
        cond = type != NULL;
2976
16
        if (!cond) {
2977
0
            Py_DECREF(Yield_annotations);
2978
0
            return 0;
2979
0
        }
2980
16
        cond = PyDict_SetItemString(Yield_annotations, "value", type) == 0;
2981
16
        Py_DECREF(type);
2982
16
        if (!cond) {
2983
0
            Py_DECREF(Yield_annotations);
2984
0
            return 0;
2985
0
        }
2986
16
    }
2987
16
    cond = PyObject_SetAttrString(state->Yield_type, "_field_types",
2988
16
                                  Yield_annotations) == 0;
2989
16
    if (!cond) {
2990
0
        Py_DECREF(Yield_annotations);
2991
0
        return 0;
2992
0
    }
2993
16
    cond = PyObject_SetAttrString(state->Yield_type, "__annotations__",
2994
16
                                  Yield_annotations) == 0;
2995
16
    if (!cond) {
2996
0
        Py_DECREF(Yield_annotations);
2997
0
        return 0;
2998
0
    }
2999
16
    Py_DECREF(Yield_annotations);
3000
16
    PyObject *YieldFrom_annotations = PyDict_New();
3001
16
    if (!YieldFrom_annotations) return 0;
3002
16
    {
3003
16
        PyObject *type = state->expr_type;
3004
16
        Py_INCREF(type);
3005
16
        cond = PyDict_SetItemString(YieldFrom_annotations, "value", type) == 0;
3006
16
        Py_DECREF(type);
3007
16
        if (!cond) {
3008
0
            Py_DECREF(YieldFrom_annotations);
3009
0
            return 0;
3010
0
        }
3011
16
    }
3012
16
    cond = PyObject_SetAttrString(state->YieldFrom_type, "_field_types",
3013
16
                                  YieldFrom_annotations) == 0;
3014
16
    if (!cond) {
3015
0
        Py_DECREF(YieldFrom_annotations);
3016
0
        return 0;
3017
0
    }
3018
16
    cond = PyObject_SetAttrString(state->YieldFrom_type, "__annotations__",
3019
16
                                  YieldFrom_annotations) == 0;
3020
16
    if (!cond) {
3021
0
        Py_DECREF(YieldFrom_annotations);
3022
0
        return 0;
3023
0
    }
3024
16
    Py_DECREF(YieldFrom_annotations);
3025
16
    PyObject *Compare_annotations = PyDict_New();
3026
16
    if (!Compare_annotations) return 0;
3027
16
    {
3028
16
        PyObject *type = state->expr_type;
3029
16
        Py_INCREF(type);
3030
16
        cond = PyDict_SetItemString(Compare_annotations, "left", type) == 0;
3031
16
        Py_DECREF(type);
3032
16
        if (!cond) {
3033
0
            Py_DECREF(Compare_annotations);
3034
0
            return 0;
3035
0
        }
3036
16
    }
3037
16
    {
3038
16
        PyObject *type = state->cmpop_type;
3039
16
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
3040
16
        cond = type != NULL;
3041
16
        if (!cond) {
3042
0
            Py_DECREF(Compare_annotations);
3043
0
            return 0;
3044
0
        }
3045
16
        cond = PyDict_SetItemString(Compare_annotations, "ops", type) == 0;
3046
16
        Py_DECREF(type);
3047
16
        if (!cond) {
3048
0
            Py_DECREF(Compare_annotations);
3049
0
            return 0;
3050
0
        }
3051
16
    }
3052
16
    {
3053
16
        PyObject *type = state->expr_type;
3054
16
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
3055
16
        cond = type != NULL;
3056
16
        if (!cond) {
3057
0
            Py_DECREF(Compare_annotations);
3058
0
            return 0;
3059
0
        }
3060
16
        cond = PyDict_SetItemString(Compare_annotations, "comparators", type)
3061
16
                                    == 0;
3062
16
        Py_DECREF(type);
3063
16
        if (!cond) {
3064
0
            Py_DECREF(Compare_annotations);
3065
0
            return 0;
3066
0
        }
3067
16
    }
3068
16
    cond = PyObject_SetAttrString(state->Compare_type, "_field_types",
3069
16
                                  Compare_annotations) == 0;
3070
16
    if (!cond) {
3071
0
        Py_DECREF(Compare_annotations);
3072
0
        return 0;
3073
0
    }
3074
16
    cond = PyObject_SetAttrString(state->Compare_type, "__annotations__",
3075
16
                                  Compare_annotations) == 0;
3076
16
    if (!cond) {
3077
0
        Py_DECREF(Compare_annotations);
3078
0
        return 0;
3079
0
    }
3080
16
    Py_DECREF(Compare_annotations);
3081
16
    PyObject *Call_annotations = PyDict_New();
3082
16
    if (!Call_annotations) return 0;
3083
16
    {
3084
16
        PyObject *type = state->expr_type;
3085
16
        Py_INCREF(type);
3086
16
        cond = PyDict_SetItemString(Call_annotations, "func", type) == 0;
3087
16
        Py_DECREF(type);
3088
16
        if (!cond) {
3089
0
            Py_DECREF(Call_annotations);
3090
0
            return 0;
3091
0
        }
3092
16
    }
3093
16
    {
3094
16
        PyObject *type = state->expr_type;
3095
16
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
3096
16
        cond = type != NULL;
3097
16
        if (!cond) {
3098
0
            Py_DECREF(Call_annotations);
3099
0
            return 0;
3100
0
        }
3101
16
        cond = PyDict_SetItemString(Call_annotations, "args", type) == 0;
3102
16
        Py_DECREF(type);
3103
16
        if (!cond) {
3104
0
            Py_DECREF(Call_annotations);
3105
0
            return 0;
3106
0
        }
3107
16
    }
3108
16
    {
3109
16
        PyObject *type = state->keyword_type;
3110
16
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
3111
16
        cond = type != NULL;
3112
16
        if (!cond) {
3113
0
            Py_DECREF(Call_annotations);
3114
0
            return 0;
3115
0
        }
3116
16
        cond = PyDict_SetItemString(Call_annotations, "keywords", type) == 0;
3117
16
        Py_DECREF(type);
3118
16
        if (!cond) {
3119
0
            Py_DECREF(Call_annotations);
3120
0
            return 0;
3121
0
        }
3122
16
    }
3123
16
    cond = PyObject_SetAttrString(state->Call_type, "_field_types",
3124
16
                                  Call_annotations) == 0;
3125
16
    if (!cond) {
3126
0
        Py_DECREF(Call_annotations);
3127
0
        return 0;
3128
0
    }
3129
16
    cond = PyObject_SetAttrString(state->Call_type, "__annotations__",
3130
16
                                  Call_annotations) == 0;
3131
16
    if (!cond) {
3132
0
        Py_DECREF(Call_annotations);
3133
0
        return 0;
3134
0
    }
3135
16
    Py_DECREF(Call_annotations);
3136
16
    PyObject *FormattedValue_annotations = PyDict_New();
3137
16
    if (!FormattedValue_annotations) return 0;
3138
16
    {
3139
16
        PyObject *type = state->expr_type;
3140
16
        Py_INCREF(type);
3141
16
        cond = PyDict_SetItemString(FormattedValue_annotations, "value", type)
3142
16
                                    == 0;
3143
16
        Py_DECREF(type);
3144
16
        if (!cond) {
3145
0
            Py_DECREF(FormattedValue_annotations);
3146
0
            return 0;
3147
0
        }
3148
16
    }
3149
16
    {
3150
16
        PyObject *type = (PyObject *)&PyLong_Type;
3151
16
        Py_INCREF(type);
3152
16
        cond = PyDict_SetItemString(FormattedValue_annotations, "conversion",
3153
16
                                    type) == 0;
3154
16
        Py_DECREF(type);
3155
16
        if (!cond) {
3156
0
            Py_DECREF(FormattedValue_annotations);
3157
0
            return 0;
3158
0
        }
3159
16
    }
3160
16
    {
3161
16
        PyObject *type = state->expr_type;
3162
16
        type = _Py_union_type_or(type, Py_None);
3163
16
        cond = type != NULL;
3164
16
        if (!cond) {
3165
0
            Py_DECREF(FormattedValue_annotations);
3166
0
            return 0;
3167
0
        }
3168
16
        cond = PyDict_SetItemString(FormattedValue_annotations, "format_spec",
3169
16
                                    type) == 0;
3170
16
        Py_DECREF(type);
3171
16
        if (!cond) {
3172
0
            Py_DECREF(FormattedValue_annotations);
3173
0
            return 0;
3174
0
        }
3175
16
    }
3176
16
    cond = PyObject_SetAttrString(state->FormattedValue_type, "_field_types",
3177
16
                                  FormattedValue_annotations) == 0;
3178
16
    if (!cond) {
3179
0
        Py_DECREF(FormattedValue_annotations);
3180
0
        return 0;
3181
0
    }
3182
16
    cond = PyObject_SetAttrString(state->FormattedValue_type,
3183
16
                                  "__annotations__",
3184
16
                                  FormattedValue_annotations) == 0;
3185
16
    if (!cond) {
3186
0
        Py_DECREF(FormattedValue_annotations);
3187
0
        return 0;
3188
0
    }
3189
16
    Py_DECREF(FormattedValue_annotations);
3190
16
    PyObject *Interpolation_annotations = PyDict_New();
3191
16
    if (!Interpolation_annotations) return 0;
3192
16
    {
3193
16
        PyObject *type = state->expr_type;
3194
16
        Py_INCREF(type);
3195
16
        cond = PyDict_SetItemString(Interpolation_annotations, "value", type)
3196
16
                                    == 0;
3197
16
        Py_DECREF(type);
3198
16
        if (!cond) {
3199
0
            Py_DECREF(Interpolation_annotations);
3200
0
            return 0;
3201
0
        }
3202
16
    }
3203
16
    {
3204
16
        PyObject *type = (PyObject *)&PyBaseObject_Type;
3205
16
        Py_INCREF(type);
3206
16
        cond = PyDict_SetItemString(Interpolation_annotations, "str", type) ==
3207
16
                                    0;
3208
16
        Py_DECREF(type);
3209
16
        if (!cond) {
3210
0
            Py_DECREF(Interpolation_annotations);
3211
0
            return 0;
3212
0
        }
3213
16
    }
3214
16
    {
3215
16
        PyObject *type = (PyObject *)&PyLong_Type;
3216
16
        Py_INCREF(type);
3217
16
        cond = PyDict_SetItemString(Interpolation_annotations, "conversion",
3218
16
                                    type) == 0;
3219
16
        Py_DECREF(type);
3220
16
        if (!cond) {
3221
0
            Py_DECREF(Interpolation_annotations);
3222
0
            return 0;
3223
0
        }
3224
16
    }
3225
16
    {
3226
16
        PyObject *type = state->expr_type;
3227
16
        type = _Py_union_type_or(type, Py_None);
3228
16
        cond = type != NULL;
3229
16
        if (!cond) {
3230
0
            Py_DECREF(Interpolation_annotations);
3231
0
            return 0;
3232
0
        }
3233
16
        cond = PyDict_SetItemString(Interpolation_annotations, "format_spec",
3234
16
                                    type) == 0;
3235
16
        Py_DECREF(type);
3236
16
        if (!cond) {
3237
0
            Py_DECREF(Interpolation_annotations);
3238
0
            return 0;
3239
0
        }
3240
16
    }
3241
16
    cond = PyObject_SetAttrString(state->Interpolation_type, "_field_types",
3242
16
                                  Interpolation_annotations) == 0;
3243
16
    if (!cond) {
3244
0
        Py_DECREF(Interpolation_annotations);
3245
0
        return 0;
3246
0
    }
3247
16
    cond = PyObject_SetAttrString(state->Interpolation_type, "__annotations__",
3248
16
                                  Interpolation_annotations) == 0;
3249
16
    if (!cond) {
3250
0
        Py_DECREF(Interpolation_annotations);
3251
0
        return 0;
3252
0
    }
3253
16
    Py_DECREF(Interpolation_annotations);
3254
16
    PyObject *JoinedStr_annotations = PyDict_New();
3255
16
    if (!JoinedStr_annotations) return 0;
3256
16
    {
3257
16
        PyObject *type = state->expr_type;
3258
16
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
3259
16
        cond = type != NULL;
3260
16
        if (!cond) {
3261
0
            Py_DECREF(JoinedStr_annotations);
3262
0
            return 0;
3263
0
        }
3264
16
        cond = PyDict_SetItemString(JoinedStr_annotations, "values", type) == 0;
3265
16
        Py_DECREF(type);
3266
16
        if (!cond) {
3267
0
            Py_DECREF(JoinedStr_annotations);
3268
0
            return 0;
3269
0
        }
3270
16
    }
3271
16
    cond = PyObject_SetAttrString(state->JoinedStr_type, "_field_types",
3272
16
                                  JoinedStr_annotations) == 0;
3273
16
    if (!cond) {
3274
0
        Py_DECREF(JoinedStr_annotations);
3275
0
        return 0;
3276
0
    }
3277
16
    cond = PyObject_SetAttrString(state->JoinedStr_type, "__annotations__",
3278
16
                                  JoinedStr_annotations) == 0;
3279
16
    if (!cond) {
3280
0
        Py_DECREF(JoinedStr_annotations);
3281
0
        return 0;
3282
0
    }
3283
16
    Py_DECREF(JoinedStr_annotations);
3284
16
    PyObject *TemplateStr_annotations = PyDict_New();
3285
16
    if (!TemplateStr_annotations) return 0;
3286
16
    {
3287
16
        PyObject *type = state->expr_type;
3288
16
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
3289
16
        cond = type != NULL;
3290
16
        if (!cond) {
3291
0
            Py_DECREF(TemplateStr_annotations);
3292
0
            return 0;
3293
0
        }
3294
16
        cond = PyDict_SetItemString(TemplateStr_annotations, "values", type) ==
3295
16
                                    0;
3296
16
        Py_DECREF(type);
3297
16
        if (!cond) {
3298
0
            Py_DECREF(TemplateStr_annotations);
3299
0
            return 0;
3300
0
        }
3301
16
    }
3302
16
    cond = PyObject_SetAttrString(state->TemplateStr_type, "_field_types",
3303
16
                                  TemplateStr_annotations) == 0;
3304
16
    if (!cond) {
3305
0
        Py_DECREF(TemplateStr_annotations);
3306
0
        return 0;
3307
0
    }
3308
16
    cond = PyObject_SetAttrString(state->TemplateStr_type, "__annotations__",
3309
16
                                  TemplateStr_annotations) == 0;
3310
16
    if (!cond) {
3311
0
        Py_DECREF(TemplateStr_annotations);
3312
0
        return 0;
3313
0
    }
3314
16
    Py_DECREF(TemplateStr_annotations);
3315
16
    PyObject *Constant_annotations = PyDict_New();
3316
16
    if (!Constant_annotations) return 0;
3317
16
    {
3318
16
        PyObject *type = (PyObject *)&PyBaseObject_Type;
3319
16
        Py_INCREF(type);
3320
16
        cond = PyDict_SetItemString(Constant_annotations, "value", type) == 0;
3321
16
        Py_DECREF(type);
3322
16
        if (!cond) {
3323
0
            Py_DECREF(Constant_annotations);
3324
0
            return 0;
3325
0
        }
3326
16
    }
3327
16
    {
3328
16
        PyObject *type = (PyObject *)&PyUnicode_Type;
3329
16
        type = _Py_union_type_or(type, Py_None);
3330
16
        cond = type != NULL;
3331
16
        if (!cond) {
3332
0
            Py_DECREF(Constant_annotations);
3333
0
            return 0;
3334
0
        }
3335
16
        cond = PyDict_SetItemString(Constant_annotations, "kind", type) == 0;
3336
16
        Py_DECREF(type);
3337
16
        if (!cond) {
3338
0
            Py_DECREF(Constant_annotations);
3339
0
            return 0;
3340
0
        }
3341
16
    }
3342
16
    cond = PyObject_SetAttrString(state->Constant_type, "_field_types",
3343
16
                                  Constant_annotations) == 0;
3344
16
    if (!cond) {
3345
0
        Py_DECREF(Constant_annotations);
3346
0
        return 0;
3347
0
    }
3348
16
    cond = PyObject_SetAttrString(state->Constant_type, "__annotations__",
3349
16
                                  Constant_annotations) == 0;
3350
16
    if (!cond) {
3351
0
        Py_DECREF(Constant_annotations);
3352
0
        return 0;
3353
0
    }
3354
16
    Py_DECREF(Constant_annotations);
3355
16
    PyObject *Attribute_annotations = PyDict_New();
3356
16
    if (!Attribute_annotations) return 0;
3357
16
    {
3358
16
        PyObject *type = state->expr_type;
3359
16
        Py_INCREF(type);
3360
16
        cond = PyDict_SetItemString(Attribute_annotations, "value", type) == 0;
3361
16
        Py_DECREF(type);
3362
16
        if (!cond) {
3363
0
            Py_DECREF(Attribute_annotations);
3364
0
            return 0;
3365
0
        }
3366
16
    }
3367
16
    {
3368
16
        PyObject *type = (PyObject *)&PyUnicode_Type;
3369
16
        Py_INCREF(type);
3370
16
        cond = PyDict_SetItemString(Attribute_annotations, "attr", type) == 0;
3371
16
        Py_DECREF(type);
3372
16
        if (!cond) {
3373
0
            Py_DECREF(Attribute_annotations);
3374
0
            return 0;
3375
0
        }
3376
16
    }
3377
16
    {
3378
16
        PyObject *type = state->expr_context_type;
3379
16
        Py_INCREF(type);
3380
16
        cond = PyDict_SetItemString(Attribute_annotations, "ctx", type) == 0;
3381
16
        Py_DECREF(type);
3382
16
        if (!cond) {
3383
0
            Py_DECREF(Attribute_annotations);
3384
0
            return 0;
3385
0
        }
3386
16
    }
3387
16
    cond = PyObject_SetAttrString(state->Attribute_type, "_field_types",
3388
16
                                  Attribute_annotations) == 0;
3389
16
    if (!cond) {
3390
0
        Py_DECREF(Attribute_annotations);
3391
0
        return 0;
3392
0
    }
3393
16
    cond = PyObject_SetAttrString(state->Attribute_type, "__annotations__",
3394
16
                                  Attribute_annotations) == 0;
3395
16
    if (!cond) {
3396
0
        Py_DECREF(Attribute_annotations);
3397
0
        return 0;
3398
0
    }
3399
16
    Py_DECREF(Attribute_annotations);
3400
16
    PyObject *Subscript_annotations = PyDict_New();
3401
16
    if (!Subscript_annotations) return 0;
3402
16
    {
3403
16
        PyObject *type = state->expr_type;
3404
16
        Py_INCREF(type);
3405
16
        cond = PyDict_SetItemString(Subscript_annotations, "value", type) == 0;
3406
16
        Py_DECREF(type);
3407
16
        if (!cond) {
3408
0
            Py_DECREF(Subscript_annotations);
3409
0
            return 0;
3410
0
        }
3411
16
    }
3412
16
    {
3413
16
        PyObject *type = state->expr_type;
3414
16
        Py_INCREF(type);
3415
16
        cond = PyDict_SetItemString(Subscript_annotations, "slice", type) == 0;
3416
16
        Py_DECREF(type);
3417
16
        if (!cond) {
3418
0
            Py_DECREF(Subscript_annotations);
3419
0
            return 0;
3420
0
        }
3421
16
    }
3422
16
    {
3423
16
        PyObject *type = state->expr_context_type;
3424
16
        Py_INCREF(type);
3425
16
        cond = PyDict_SetItemString(Subscript_annotations, "ctx", type) == 0;
3426
16
        Py_DECREF(type);
3427
16
        if (!cond) {
3428
0
            Py_DECREF(Subscript_annotations);
3429
0
            return 0;
3430
0
        }
3431
16
    }
3432
16
    cond = PyObject_SetAttrString(state->Subscript_type, "_field_types",
3433
16
                                  Subscript_annotations) == 0;
3434
16
    if (!cond) {
3435
0
        Py_DECREF(Subscript_annotations);
3436
0
        return 0;
3437
0
    }
3438
16
    cond = PyObject_SetAttrString(state->Subscript_type, "__annotations__",
3439
16
                                  Subscript_annotations) == 0;
3440
16
    if (!cond) {
3441
0
        Py_DECREF(Subscript_annotations);
3442
0
        return 0;
3443
0
    }
3444
16
    Py_DECREF(Subscript_annotations);
3445
16
    PyObject *Starred_annotations = PyDict_New();
3446
16
    if (!Starred_annotations) return 0;
3447
16
    {
3448
16
        PyObject *type = state->expr_type;
3449
16
        Py_INCREF(type);
3450
16
        cond = PyDict_SetItemString(Starred_annotations, "value", type) == 0;
3451
16
        Py_DECREF(type);
3452
16
        if (!cond) {
3453
0
            Py_DECREF(Starred_annotations);
3454
0
            return 0;
3455
0
        }
3456
16
    }
3457
16
    {
3458
16
        PyObject *type = state->expr_context_type;
3459
16
        Py_INCREF(type);
3460
16
        cond = PyDict_SetItemString(Starred_annotations, "ctx", type) == 0;
3461
16
        Py_DECREF(type);
3462
16
        if (!cond) {
3463
0
            Py_DECREF(Starred_annotations);
3464
0
            return 0;
3465
0
        }
3466
16
    }
3467
16
    cond = PyObject_SetAttrString(state->Starred_type, "_field_types",
3468
16
                                  Starred_annotations) == 0;
3469
16
    if (!cond) {
3470
0
        Py_DECREF(Starred_annotations);
3471
0
        return 0;
3472
0
    }
3473
16
    cond = PyObject_SetAttrString(state->Starred_type, "__annotations__",
3474
16
                                  Starred_annotations) == 0;
3475
16
    if (!cond) {
3476
0
        Py_DECREF(Starred_annotations);
3477
0
        return 0;
3478
0
    }
3479
16
    Py_DECREF(Starred_annotations);
3480
16
    PyObject *Name_annotations = PyDict_New();
3481
16
    if (!Name_annotations) return 0;
3482
16
    {
3483
16
        PyObject *type = (PyObject *)&PyUnicode_Type;
3484
16
        Py_INCREF(type);
3485
16
        cond = PyDict_SetItemString(Name_annotations, "id", type) == 0;
3486
16
        Py_DECREF(type);
3487
16
        if (!cond) {
3488
0
            Py_DECREF(Name_annotations);
3489
0
            return 0;
3490
0
        }
3491
16
    }
3492
16
    {
3493
16
        PyObject *type = state->expr_context_type;
3494
16
        Py_INCREF(type);
3495
16
        cond = PyDict_SetItemString(Name_annotations, "ctx", type) == 0;
3496
16
        Py_DECREF(type);
3497
16
        if (!cond) {
3498
0
            Py_DECREF(Name_annotations);
3499
0
            return 0;
3500
0
        }
3501
16
    }
3502
16
    cond = PyObject_SetAttrString(state->Name_type, "_field_types",
3503
16
                                  Name_annotations) == 0;
3504
16
    if (!cond) {
3505
0
        Py_DECREF(Name_annotations);
3506
0
        return 0;
3507
0
    }
3508
16
    cond = PyObject_SetAttrString(state->Name_type, "__annotations__",
3509
16
                                  Name_annotations) == 0;
3510
16
    if (!cond) {
3511
0
        Py_DECREF(Name_annotations);
3512
0
        return 0;
3513
0
    }
3514
16
    Py_DECREF(Name_annotations);
3515
16
    PyObject *List_annotations = PyDict_New();
3516
16
    if (!List_annotations) return 0;
3517
16
    {
3518
16
        PyObject *type = state->expr_type;
3519
16
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
3520
16
        cond = type != NULL;
3521
16
        if (!cond) {
3522
0
            Py_DECREF(List_annotations);
3523
0
            return 0;
3524
0
        }
3525
16
        cond = PyDict_SetItemString(List_annotations, "elts", type) == 0;
3526
16
        Py_DECREF(type);
3527
16
        if (!cond) {
3528
0
            Py_DECREF(List_annotations);
3529
0
            return 0;
3530
0
        }
3531
16
    }
3532
16
    {
3533
16
        PyObject *type = state->expr_context_type;
3534
16
        Py_INCREF(type);
3535
16
        cond = PyDict_SetItemString(List_annotations, "ctx", type) == 0;
3536
16
        Py_DECREF(type);
3537
16
        if (!cond) {
3538
0
            Py_DECREF(List_annotations);
3539
0
            return 0;
3540
0
        }
3541
16
    }
3542
16
    cond = PyObject_SetAttrString(state->List_type, "_field_types",
3543
16
                                  List_annotations) == 0;
3544
16
    if (!cond) {
3545
0
        Py_DECREF(List_annotations);
3546
0
        return 0;
3547
0
    }
3548
16
    cond = PyObject_SetAttrString(state->List_type, "__annotations__",
3549
16
                                  List_annotations) == 0;
3550
16
    if (!cond) {
3551
0
        Py_DECREF(List_annotations);
3552
0
        return 0;
3553
0
    }
3554
16
    Py_DECREF(List_annotations);
3555
16
    PyObject *Tuple_annotations = PyDict_New();
3556
16
    if (!Tuple_annotations) return 0;
3557
16
    {
3558
16
        PyObject *type = state->expr_type;
3559
16
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
3560
16
        cond = type != NULL;
3561
16
        if (!cond) {
3562
0
            Py_DECREF(Tuple_annotations);
3563
0
            return 0;
3564
0
        }
3565
16
        cond = PyDict_SetItemString(Tuple_annotations, "elts", type) == 0;
3566
16
        Py_DECREF(type);
3567
16
        if (!cond) {
3568
0
            Py_DECREF(Tuple_annotations);
3569
0
            return 0;
3570
0
        }
3571
16
    }
3572
16
    {
3573
16
        PyObject *type = state->expr_context_type;
3574
16
        Py_INCREF(type);
3575
16
        cond = PyDict_SetItemString(Tuple_annotations, "ctx", type) == 0;
3576
16
        Py_DECREF(type);
3577
16
        if (!cond) {
3578
0
            Py_DECREF(Tuple_annotations);
3579
0
            return 0;
3580
0
        }
3581
16
    }
3582
16
    cond = PyObject_SetAttrString(state->Tuple_type, "_field_types",
3583
16
                                  Tuple_annotations) == 0;
3584
16
    if (!cond) {
3585
0
        Py_DECREF(Tuple_annotations);
3586
0
        return 0;
3587
0
    }
3588
16
    cond = PyObject_SetAttrString(state->Tuple_type, "__annotations__",
3589
16
                                  Tuple_annotations) == 0;
3590
16
    if (!cond) {
3591
0
        Py_DECREF(Tuple_annotations);
3592
0
        return 0;
3593
0
    }
3594
16
    Py_DECREF(Tuple_annotations);
3595
16
    PyObject *Slice_annotations = PyDict_New();
3596
16
    if (!Slice_annotations) return 0;
3597
16
    {
3598
16
        PyObject *type = state->expr_type;
3599
16
        type = _Py_union_type_or(type, Py_None);
3600
16
        cond = type != NULL;
3601
16
        if (!cond) {
3602
0
            Py_DECREF(Slice_annotations);
3603
0
            return 0;
3604
0
        }
3605
16
        cond = PyDict_SetItemString(Slice_annotations, "lower", type) == 0;
3606
16
        Py_DECREF(type);
3607
16
        if (!cond) {
3608
0
            Py_DECREF(Slice_annotations);
3609
0
            return 0;
3610
0
        }
3611
16
    }
3612
16
    {
3613
16
        PyObject *type = state->expr_type;
3614
16
        type = _Py_union_type_or(type, Py_None);
3615
16
        cond = type != NULL;
3616
16
        if (!cond) {
3617
0
            Py_DECREF(Slice_annotations);
3618
0
            return 0;
3619
0
        }
3620
16
        cond = PyDict_SetItemString(Slice_annotations, "upper", type) == 0;
3621
16
        Py_DECREF(type);
3622
16
        if (!cond) {
3623
0
            Py_DECREF(Slice_annotations);
3624
0
            return 0;
3625
0
        }
3626
16
    }
3627
16
    {
3628
16
        PyObject *type = state->expr_type;
3629
16
        type = _Py_union_type_or(type, Py_None);
3630
16
        cond = type != NULL;
3631
16
        if (!cond) {
3632
0
            Py_DECREF(Slice_annotations);
3633
0
            return 0;
3634
0
        }
3635
16
        cond = PyDict_SetItemString(Slice_annotations, "step", type) == 0;
3636
16
        Py_DECREF(type);
3637
16
        if (!cond) {
3638
0
            Py_DECREF(Slice_annotations);
3639
0
            return 0;
3640
0
        }
3641
16
    }
3642
16
    cond = PyObject_SetAttrString(state->Slice_type, "_field_types",
3643
16
                                  Slice_annotations) == 0;
3644
16
    if (!cond) {
3645
0
        Py_DECREF(Slice_annotations);
3646
0
        return 0;
3647
0
    }
3648
16
    cond = PyObject_SetAttrString(state->Slice_type, "__annotations__",
3649
16
                                  Slice_annotations) == 0;
3650
16
    if (!cond) {
3651
0
        Py_DECREF(Slice_annotations);
3652
0
        return 0;
3653
0
    }
3654
16
    Py_DECREF(Slice_annotations);
3655
16
    PyObject *Load_annotations = PyDict_New();
3656
16
    if (!Load_annotations) return 0;
3657
16
    cond = PyObject_SetAttrString(state->Load_type, "_field_types",
3658
16
                                  Load_annotations) == 0;
3659
16
    if (!cond) {
3660
0
        Py_DECREF(Load_annotations);
3661
0
        return 0;
3662
0
    }
3663
16
    cond = PyObject_SetAttrString(state->Load_type, "__annotations__",
3664
16
                                  Load_annotations) == 0;
3665
16
    if (!cond) {
3666
0
        Py_DECREF(Load_annotations);
3667
0
        return 0;
3668
0
    }
3669
16
    Py_DECREF(Load_annotations);
3670
16
    PyObject *Store_annotations = PyDict_New();
3671
16
    if (!Store_annotations) return 0;
3672
16
    cond = PyObject_SetAttrString(state->Store_type, "_field_types",
3673
16
                                  Store_annotations) == 0;
3674
16
    if (!cond) {
3675
0
        Py_DECREF(Store_annotations);
3676
0
        return 0;
3677
0
    }
3678
16
    cond = PyObject_SetAttrString(state->Store_type, "__annotations__",
3679
16
                                  Store_annotations) == 0;
3680
16
    if (!cond) {
3681
0
        Py_DECREF(Store_annotations);
3682
0
        return 0;
3683
0
    }
3684
16
    Py_DECREF(Store_annotations);
3685
16
    PyObject *Del_annotations = PyDict_New();
3686
16
    if (!Del_annotations) return 0;
3687
16
    cond = PyObject_SetAttrString(state->Del_type, "_field_types",
3688
16
                                  Del_annotations) == 0;
3689
16
    if (!cond) {
3690
0
        Py_DECREF(Del_annotations);
3691
0
        return 0;
3692
0
    }
3693
16
    cond = PyObject_SetAttrString(state->Del_type, "__annotations__",
3694
16
                                  Del_annotations) == 0;
3695
16
    if (!cond) {
3696
0
        Py_DECREF(Del_annotations);
3697
0
        return 0;
3698
0
    }
3699
16
    Py_DECREF(Del_annotations);
3700
16
    PyObject *And_annotations = PyDict_New();
3701
16
    if (!And_annotations) return 0;
3702
16
    cond = PyObject_SetAttrString(state->And_type, "_field_types",
3703
16
                                  And_annotations) == 0;
3704
16
    if (!cond) {
3705
0
        Py_DECREF(And_annotations);
3706
0
        return 0;
3707
0
    }
3708
16
    cond = PyObject_SetAttrString(state->And_type, "__annotations__",
3709
16
                                  And_annotations) == 0;
3710
16
    if (!cond) {
3711
0
        Py_DECREF(And_annotations);
3712
0
        return 0;
3713
0
    }
3714
16
    Py_DECREF(And_annotations);
3715
16
    PyObject *Or_annotations = PyDict_New();
3716
16
    if (!Or_annotations) return 0;
3717
16
    cond = PyObject_SetAttrString(state->Or_type, "_field_types",
3718
16
                                  Or_annotations) == 0;
3719
16
    if (!cond) {
3720
0
        Py_DECREF(Or_annotations);
3721
0
        return 0;
3722
0
    }
3723
16
    cond = PyObject_SetAttrString(state->Or_type, "__annotations__",
3724
16
                                  Or_annotations) == 0;
3725
16
    if (!cond) {
3726
0
        Py_DECREF(Or_annotations);
3727
0
        return 0;
3728
0
    }
3729
16
    Py_DECREF(Or_annotations);
3730
16
    PyObject *Add_annotations = PyDict_New();
3731
16
    if (!Add_annotations) return 0;
3732
16
    cond = PyObject_SetAttrString(state->Add_type, "_field_types",
3733
16
                                  Add_annotations) == 0;
3734
16
    if (!cond) {
3735
0
        Py_DECREF(Add_annotations);
3736
0
        return 0;
3737
0
    }
3738
16
    cond = PyObject_SetAttrString(state->Add_type, "__annotations__",
3739
16
                                  Add_annotations) == 0;
3740
16
    if (!cond) {
3741
0
        Py_DECREF(Add_annotations);
3742
0
        return 0;
3743
0
    }
3744
16
    Py_DECREF(Add_annotations);
3745
16
    PyObject *Sub_annotations = PyDict_New();
3746
16
    if (!Sub_annotations) return 0;
3747
16
    cond = PyObject_SetAttrString(state->Sub_type, "_field_types",
3748
16
                                  Sub_annotations) == 0;
3749
16
    if (!cond) {
3750
0
        Py_DECREF(Sub_annotations);
3751
0
        return 0;
3752
0
    }
3753
16
    cond = PyObject_SetAttrString(state->Sub_type, "__annotations__",
3754
16
                                  Sub_annotations) == 0;
3755
16
    if (!cond) {
3756
0
        Py_DECREF(Sub_annotations);
3757
0
        return 0;
3758
0
    }
3759
16
    Py_DECREF(Sub_annotations);
3760
16
    PyObject *Mult_annotations = PyDict_New();
3761
16
    if (!Mult_annotations) return 0;
3762
16
    cond = PyObject_SetAttrString(state->Mult_type, "_field_types",
3763
16
                                  Mult_annotations) == 0;
3764
16
    if (!cond) {
3765
0
        Py_DECREF(Mult_annotations);
3766
0
        return 0;
3767
0
    }
3768
16
    cond = PyObject_SetAttrString(state->Mult_type, "__annotations__",
3769
16
                                  Mult_annotations) == 0;
3770
16
    if (!cond) {
3771
0
        Py_DECREF(Mult_annotations);
3772
0
        return 0;
3773
0
    }
3774
16
    Py_DECREF(Mult_annotations);
3775
16
    PyObject *MatMult_annotations = PyDict_New();
3776
16
    if (!MatMult_annotations) return 0;
3777
16
    cond = PyObject_SetAttrString(state->MatMult_type, "_field_types",
3778
16
                                  MatMult_annotations) == 0;
3779
16
    if (!cond) {
3780
0
        Py_DECREF(MatMult_annotations);
3781
0
        return 0;
3782
0
    }
3783
16
    cond = PyObject_SetAttrString(state->MatMult_type, "__annotations__",
3784
16
                                  MatMult_annotations) == 0;
3785
16
    if (!cond) {
3786
0
        Py_DECREF(MatMult_annotations);
3787
0
        return 0;
3788
0
    }
3789
16
    Py_DECREF(MatMult_annotations);
3790
16
    PyObject *Div_annotations = PyDict_New();
3791
16
    if (!Div_annotations) return 0;
3792
16
    cond = PyObject_SetAttrString(state->Div_type, "_field_types",
3793
16
                                  Div_annotations) == 0;
3794
16
    if (!cond) {
3795
0
        Py_DECREF(Div_annotations);
3796
0
        return 0;
3797
0
    }
3798
16
    cond = PyObject_SetAttrString(state->Div_type, "__annotations__",
3799
16
                                  Div_annotations) == 0;
3800
16
    if (!cond) {
3801
0
        Py_DECREF(Div_annotations);
3802
0
        return 0;
3803
0
    }
3804
16
    Py_DECREF(Div_annotations);
3805
16
    PyObject *Mod_annotations = PyDict_New();
3806
16
    if (!Mod_annotations) return 0;
3807
16
    cond = PyObject_SetAttrString(state->Mod_type, "_field_types",
3808
16
                                  Mod_annotations) == 0;
3809
16
    if (!cond) {
3810
0
        Py_DECREF(Mod_annotations);
3811
0
        return 0;
3812
0
    }
3813
16
    cond = PyObject_SetAttrString(state->Mod_type, "__annotations__",
3814
16
                                  Mod_annotations) == 0;
3815
16
    if (!cond) {
3816
0
        Py_DECREF(Mod_annotations);
3817
0
        return 0;
3818
0
    }
3819
16
    Py_DECREF(Mod_annotations);
3820
16
    PyObject *Pow_annotations = PyDict_New();
3821
16
    if (!Pow_annotations) return 0;
3822
16
    cond = PyObject_SetAttrString(state->Pow_type, "_field_types",
3823
16
                                  Pow_annotations) == 0;
3824
16
    if (!cond) {
3825
0
        Py_DECREF(Pow_annotations);
3826
0
        return 0;
3827
0
    }
3828
16
    cond = PyObject_SetAttrString(state->Pow_type, "__annotations__",
3829
16
                                  Pow_annotations) == 0;
3830
16
    if (!cond) {
3831
0
        Py_DECREF(Pow_annotations);
3832
0
        return 0;
3833
0
    }
3834
16
    Py_DECREF(Pow_annotations);
3835
16
    PyObject *LShift_annotations = PyDict_New();
3836
16
    if (!LShift_annotations) return 0;
3837
16
    cond = PyObject_SetAttrString(state->LShift_type, "_field_types",
3838
16
                                  LShift_annotations) == 0;
3839
16
    if (!cond) {
3840
0
        Py_DECREF(LShift_annotations);
3841
0
        return 0;
3842
0
    }
3843
16
    cond = PyObject_SetAttrString(state->LShift_type, "__annotations__",
3844
16
                                  LShift_annotations) == 0;
3845
16
    if (!cond) {
3846
0
        Py_DECREF(LShift_annotations);
3847
0
        return 0;
3848
0
    }
3849
16
    Py_DECREF(LShift_annotations);
3850
16
    PyObject *RShift_annotations = PyDict_New();
3851
16
    if (!RShift_annotations) return 0;
3852
16
    cond = PyObject_SetAttrString(state->RShift_type, "_field_types",
3853
16
                                  RShift_annotations) == 0;
3854
16
    if (!cond) {
3855
0
        Py_DECREF(RShift_annotations);
3856
0
        return 0;
3857
0
    }
3858
16
    cond = PyObject_SetAttrString(state->RShift_type, "__annotations__",
3859
16
                                  RShift_annotations) == 0;
3860
16
    if (!cond) {
3861
0
        Py_DECREF(RShift_annotations);
3862
0
        return 0;
3863
0
    }
3864
16
    Py_DECREF(RShift_annotations);
3865
16
    PyObject *BitOr_annotations = PyDict_New();
3866
16
    if (!BitOr_annotations) return 0;
3867
16
    cond = PyObject_SetAttrString(state->BitOr_type, "_field_types",
3868
16
                                  BitOr_annotations) == 0;
3869
16
    if (!cond) {
3870
0
        Py_DECREF(BitOr_annotations);
3871
0
        return 0;
3872
0
    }
3873
16
    cond = PyObject_SetAttrString(state->BitOr_type, "__annotations__",
3874
16
                                  BitOr_annotations) == 0;
3875
16
    if (!cond) {
3876
0
        Py_DECREF(BitOr_annotations);
3877
0
        return 0;
3878
0
    }
3879
16
    Py_DECREF(BitOr_annotations);
3880
16
    PyObject *BitXor_annotations = PyDict_New();
3881
16
    if (!BitXor_annotations) return 0;
3882
16
    cond = PyObject_SetAttrString(state->BitXor_type, "_field_types",
3883
16
                                  BitXor_annotations) == 0;
3884
16
    if (!cond) {
3885
0
        Py_DECREF(BitXor_annotations);
3886
0
        return 0;
3887
0
    }
3888
16
    cond = PyObject_SetAttrString(state->BitXor_type, "__annotations__",
3889
16
                                  BitXor_annotations) == 0;
3890
16
    if (!cond) {
3891
0
        Py_DECREF(BitXor_annotations);
3892
0
        return 0;
3893
0
    }
3894
16
    Py_DECREF(BitXor_annotations);
3895
16
    PyObject *BitAnd_annotations = PyDict_New();
3896
16
    if (!BitAnd_annotations) return 0;
3897
16
    cond = PyObject_SetAttrString(state->BitAnd_type, "_field_types",
3898
16
                                  BitAnd_annotations) == 0;
3899
16
    if (!cond) {
3900
0
        Py_DECREF(BitAnd_annotations);
3901
0
        return 0;
3902
0
    }
3903
16
    cond = PyObject_SetAttrString(state->BitAnd_type, "__annotations__",
3904
16
                                  BitAnd_annotations) == 0;
3905
16
    if (!cond) {
3906
0
        Py_DECREF(BitAnd_annotations);
3907
0
        return 0;
3908
0
    }
3909
16
    Py_DECREF(BitAnd_annotations);
3910
16
    PyObject *FloorDiv_annotations = PyDict_New();
3911
16
    if (!FloorDiv_annotations) return 0;
3912
16
    cond = PyObject_SetAttrString(state->FloorDiv_type, "_field_types",
3913
16
                                  FloorDiv_annotations) == 0;
3914
16
    if (!cond) {
3915
0
        Py_DECREF(FloorDiv_annotations);
3916
0
        return 0;
3917
0
    }
3918
16
    cond = PyObject_SetAttrString(state->FloorDiv_type, "__annotations__",
3919
16
                                  FloorDiv_annotations) == 0;
3920
16
    if (!cond) {
3921
0
        Py_DECREF(FloorDiv_annotations);
3922
0
        return 0;
3923
0
    }
3924
16
    Py_DECREF(FloorDiv_annotations);
3925
16
    PyObject *Invert_annotations = PyDict_New();
3926
16
    if (!Invert_annotations) return 0;
3927
16
    cond = PyObject_SetAttrString(state->Invert_type, "_field_types",
3928
16
                                  Invert_annotations) == 0;
3929
16
    if (!cond) {
3930
0
        Py_DECREF(Invert_annotations);
3931
0
        return 0;
3932
0
    }
3933
16
    cond = PyObject_SetAttrString(state->Invert_type, "__annotations__",
3934
16
                                  Invert_annotations) == 0;
3935
16
    if (!cond) {
3936
0
        Py_DECREF(Invert_annotations);
3937
0
        return 0;
3938
0
    }
3939
16
    Py_DECREF(Invert_annotations);
3940
16
    PyObject *Not_annotations = PyDict_New();
3941
16
    if (!Not_annotations) return 0;
3942
16
    cond = PyObject_SetAttrString(state->Not_type, "_field_types",
3943
16
                                  Not_annotations) == 0;
3944
16
    if (!cond) {
3945
0
        Py_DECREF(Not_annotations);
3946
0
        return 0;
3947
0
    }
3948
16
    cond = PyObject_SetAttrString(state->Not_type, "__annotations__",
3949
16
                                  Not_annotations) == 0;
3950
16
    if (!cond) {
3951
0
        Py_DECREF(Not_annotations);
3952
0
        return 0;
3953
0
    }
3954
16
    Py_DECREF(Not_annotations);
3955
16
    PyObject *UAdd_annotations = PyDict_New();
3956
16
    if (!UAdd_annotations) return 0;
3957
16
    cond = PyObject_SetAttrString(state->UAdd_type, "_field_types",
3958
16
                                  UAdd_annotations) == 0;
3959
16
    if (!cond) {
3960
0
        Py_DECREF(UAdd_annotations);
3961
0
        return 0;
3962
0
    }
3963
16
    cond = PyObject_SetAttrString(state->UAdd_type, "__annotations__",
3964
16
                                  UAdd_annotations) == 0;
3965
16
    if (!cond) {
3966
0
        Py_DECREF(UAdd_annotations);
3967
0
        return 0;
3968
0
    }
3969
16
    Py_DECREF(UAdd_annotations);
3970
16
    PyObject *USub_annotations = PyDict_New();
3971
16
    if (!USub_annotations) return 0;
3972
16
    cond = PyObject_SetAttrString(state->USub_type, "_field_types",
3973
16
                                  USub_annotations) == 0;
3974
16
    if (!cond) {
3975
0
        Py_DECREF(USub_annotations);
3976
0
        return 0;
3977
0
    }
3978
16
    cond = PyObject_SetAttrString(state->USub_type, "__annotations__",
3979
16
                                  USub_annotations) == 0;
3980
16
    if (!cond) {
3981
0
        Py_DECREF(USub_annotations);
3982
0
        return 0;
3983
0
    }
3984
16
    Py_DECREF(USub_annotations);
3985
16
    PyObject *Eq_annotations = PyDict_New();
3986
16
    if (!Eq_annotations) return 0;
3987
16
    cond = PyObject_SetAttrString(state->Eq_type, "_field_types",
3988
16
                                  Eq_annotations) == 0;
3989
16
    if (!cond) {
3990
0
        Py_DECREF(Eq_annotations);
3991
0
        return 0;
3992
0
    }
3993
16
    cond = PyObject_SetAttrString(state->Eq_type, "__annotations__",
3994
16
                                  Eq_annotations) == 0;
3995
16
    if (!cond) {
3996
0
        Py_DECREF(Eq_annotations);
3997
0
        return 0;
3998
0
    }
3999
16
    Py_DECREF(Eq_annotations);
4000
16
    PyObject *NotEq_annotations = PyDict_New();
4001
16
    if (!NotEq_annotations) return 0;
4002
16
    cond = PyObject_SetAttrString(state->NotEq_type, "_field_types",
4003
16
                                  NotEq_annotations) == 0;
4004
16
    if (!cond) {
4005
0
        Py_DECREF(NotEq_annotations);
4006
0
        return 0;
4007
0
    }
4008
16
    cond = PyObject_SetAttrString(state->NotEq_type, "__annotations__",
4009
16
                                  NotEq_annotations) == 0;
4010
16
    if (!cond) {
4011
0
        Py_DECREF(NotEq_annotations);
4012
0
        return 0;
4013
0
    }
4014
16
    Py_DECREF(NotEq_annotations);
4015
16
    PyObject *Lt_annotations = PyDict_New();
4016
16
    if (!Lt_annotations) return 0;
4017
16
    cond = PyObject_SetAttrString(state->Lt_type, "_field_types",
4018
16
                                  Lt_annotations) == 0;
4019
16
    if (!cond) {
4020
0
        Py_DECREF(Lt_annotations);
4021
0
        return 0;
4022
0
    }
4023
16
    cond = PyObject_SetAttrString(state->Lt_type, "__annotations__",
4024
16
                                  Lt_annotations) == 0;
4025
16
    if (!cond) {
4026
0
        Py_DECREF(Lt_annotations);
4027
0
        return 0;
4028
0
    }
4029
16
    Py_DECREF(Lt_annotations);
4030
16
    PyObject *LtE_annotations = PyDict_New();
4031
16
    if (!LtE_annotations) return 0;
4032
16
    cond = PyObject_SetAttrString(state->LtE_type, "_field_types",
4033
16
                                  LtE_annotations) == 0;
4034
16
    if (!cond) {
4035
0
        Py_DECREF(LtE_annotations);
4036
0
        return 0;
4037
0
    }
4038
16
    cond = PyObject_SetAttrString(state->LtE_type, "__annotations__",
4039
16
                                  LtE_annotations) == 0;
4040
16
    if (!cond) {
4041
0
        Py_DECREF(LtE_annotations);
4042
0
        return 0;
4043
0
    }
4044
16
    Py_DECREF(LtE_annotations);
4045
16
    PyObject *Gt_annotations = PyDict_New();
4046
16
    if (!Gt_annotations) return 0;
4047
16
    cond = PyObject_SetAttrString(state->Gt_type, "_field_types",
4048
16
                                  Gt_annotations) == 0;
4049
16
    if (!cond) {
4050
0
        Py_DECREF(Gt_annotations);
4051
0
        return 0;
4052
0
    }
4053
16
    cond = PyObject_SetAttrString(state->Gt_type, "__annotations__",
4054
16
                                  Gt_annotations) == 0;
4055
16
    if (!cond) {
4056
0
        Py_DECREF(Gt_annotations);
4057
0
        return 0;
4058
0
    }
4059
16
    Py_DECREF(Gt_annotations);
4060
16
    PyObject *GtE_annotations = PyDict_New();
4061
16
    if (!GtE_annotations) return 0;
4062
16
    cond = PyObject_SetAttrString(state->GtE_type, "_field_types",
4063
16
                                  GtE_annotations) == 0;
4064
16
    if (!cond) {
4065
0
        Py_DECREF(GtE_annotations);
4066
0
        return 0;
4067
0
    }
4068
16
    cond = PyObject_SetAttrString(state->GtE_type, "__annotations__",
4069
16
                                  GtE_annotations) == 0;
4070
16
    if (!cond) {
4071
0
        Py_DECREF(GtE_annotations);
4072
0
        return 0;
4073
0
    }
4074
16
    Py_DECREF(GtE_annotations);
4075
16
    PyObject *Is_annotations = PyDict_New();
4076
16
    if (!Is_annotations) return 0;
4077
16
    cond = PyObject_SetAttrString(state->Is_type, "_field_types",
4078
16
                                  Is_annotations) == 0;
4079
16
    if (!cond) {
4080
0
        Py_DECREF(Is_annotations);
4081
0
        return 0;
4082
0
    }
4083
16
    cond = PyObject_SetAttrString(state->Is_type, "__annotations__",
4084
16
                                  Is_annotations) == 0;
4085
16
    if (!cond) {
4086
0
        Py_DECREF(Is_annotations);
4087
0
        return 0;
4088
0
    }
4089
16
    Py_DECREF(Is_annotations);
4090
16
    PyObject *IsNot_annotations = PyDict_New();
4091
16
    if (!IsNot_annotations) return 0;
4092
16
    cond = PyObject_SetAttrString(state->IsNot_type, "_field_types",
4093
16
                                  IsNot_annotations) == 0;
4094
16
    if (!cond) {
4095
0
        Py_DECREF(IsNot_annotations);
4096
0
        return 0;
4097
0
    }
4098
16
    cond = PyObject_SetAttrString(state->IsNot_type, "__annotations__",
4099
16
                                  IsNot_annotations) == 0;
4100
16
    if (!cond) {
4101
0
        Py_DECREF(IsNot_annotations);
4102
0
        return 0;
4103
0
    }
4104
16
    Py_DECREF(IsNot_annotations);
4105
16
    PyObject *In_annotations = PyDict_New();
4106
16
    if (!In_annotations) return 0;
4107
16
    cond = PyObject_SetAttrString(state->In_type, "_field_types",
4108
16
                                  In_annotations) == 0;
4109
16
    if (!cond) {
4110
0
        Py_DECREF(In_annotations);
4111
0
        return 0;
4112
0
    }
4113
16
    cond = PyObject_SetAttrString(state->In_type, "__annotations__",
4114
16
                                  In_annotations) == 0;
4115
16
    if (!cond) {
4116
0
        Py_DECREF(In_annotations);
4117
0
        return 0;
4118
0
    }
4119
16
    Py_DECREF(In_annotations);
4120
16
    PyObject *NotIn_annotations = PyDict_New();
4121
16
    if (!NotIn_annotations) return 0;
4122
16
    cond = PyObject_SetAttrString(state->NotIn_type, "_field_types",
4123
16
                                  NotIn_annotations) == 0;
4124
16
    if (!cond) {
4125
0
        Py_DECREF(NotIn_annotations);
4126
0
        return 0;
4127
0
    }
4128
16
    cond = PyObject_SetAttrString(state->NotIn_type, "__annotations__",
4129
16
                                  NotIn_annotations) == 0;
4130
16
    if (!cond) {
4131
0
        Py_DECREF(NotIn_annotations);
4132
0
        return 0;
4133
0
    }
4134
16
    Py_DECREF(NotIn_annotations);
4135
16
    PyObject *comprehension_annotations = PyDict_New();
4136
16
    if (!comprehension_annotations) return 0;
4137
16
    {
4138
16
        PyObject *type = state->expr_type;
4139
16
        Py_INCREF(type);
4140
16
        cond = PyDict_SetItemString(comprehension_annotations, "target", type)
4141
16
                                    == 0;
4142
16
        Py_DECREF(type);
4143
16
        if (!cond) {
4144
0
            Py_DECREF(comprehension_annotations);
4145
0
            return 0;
4146
0
        }
4147
16
    }
4148
16
    {
4149
16
        PyObject *type = state->expr_type;
4150
16
        Py_INCREF(type);
4151
16
        cond = PyDict_SetItemString(comprehension_annotations, "iter", type) ==
4152
16
                                    0;
4153
16
        Py_DECREF(type);
4154
16
        if (!cond) {
4155
0
            Py_DECREF(comprehension_annotations);
4156
0
            return 0;
4157
0
        }
4158
16
    }
4159
16
    {
4160
16
        PyObject *type = state->expr_type;
4161
16
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
4162
16
        cond = type != NULL;
4163
16
        if (!cond) {
4164
0
            Py_DECREF(comprehension_annotations);
4165
0
            return 0;
4166
0
        }
4167
16
        cond = PyDict_SetItemString(comprehension_annotations, "ifs", type) ==
4168
16
                                    0;
4169
16
        Py_DECREF(type);
4170
16
        if (!cond) {
4171
0
            Py_DECREF(comprehension_annotations);
4172
0
            return 0;
4173
0
        }
4174
16
    }
4175
16
    {
4176
16
        PyObject *type = (PyObject *)&PyLong_Type;
4177
16
        Py_INCREF(type);
4178
16
        cond = PyDict_SetItemString(comprehension_annotations, "is_async",
4179
16
                                    type) == 0;
4180
16
        Py_DECREF(type);
4181
16
        if (!cond) {
4182
0
            Py_DECREF(comprehension_annotations);
4183
0
            return 0;
4184
0
        }
4185
16
    }
4186
16
    cond = PyObject_SetAttrString(state->comprehension_type, "_field_types",
4187
16
                                  comprehension_annotations) == 0;
4188
16
    if (!cond) {
4189
0
        Py_DECREF(comprehension_annotations);
4190
0
        return 0;
4191
0
    }
4192
16
    cond = PyObject_SetAttrString(state->comprehension_type, "__annotations__",
4193
16
                                  comprehension_annotations) == 0;
4194
16
    if (!cond) {
4195
0
        Py_DECREF(comprehension_annotations);
4196
0
        return 0;
4197
0
    }
4198
16
    Py_DECREF(comprehension_annotations);
4199
16
    PyObject *ExceptHandler_annotations = PyDict_New();
4200
16
    if (!ExceptHandler_annotations) return 0;
4201
16
    {
4202
16
        PyObject *type = state->expr_type;
4203
16
        type = _Py_union_type_or(type, Py_None);
4204
16
        cond = type != NULL;
4205
16
        if (!cond) {
4206
0
            Py_DECREF(ExceptHandler_annotations);
4207
0
            return 0;
4208
0
        }
4209
16
        cond = PyDict_SetItemString(ExceptHandler_annotations, "type", type) ==
4210
16
                                    0;
4211
16
        Py_DECREF(type);
4212
16
        if (!cond) {
4213
0
            Py_DECREF(ExceptHandler_annotations);
4214
0
            return 0;
4215
0
        }
4216
16
    }
4217
16
    {
4218
16
        PyObject *type = (PyObject *)&PyUnicode_Type;
4219
16
        type = _Py_union_type_or(type, Py_None);
4220
16
        cond = type != NULL;
4221
16
        if (!cond) {
4222
0
            Py_DECREF(ExceptHandler_annotations);
4223
0
            return 0;
4224
0
        }
4225
16
        cond = PyDict_SetItemString(ExceptHandler_annotations, "name", type) ==
4226
16
                                    0;
4227
16
        Py_DECREF(type);
4228
16
        if (!cond) {
4229
0
            Py_DECREF(ExceptHandler_annotations);
4230
0
            return 0;
4231
0
        }
4232
16
    }
4233
16
    {
4234
16
        PyObject *type = state->stmt_type;
4235
16
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
4236
16
        cond = type != NULL;
4237
16
        if (!cond) {
4238
0
            Py_DECREF(ExceptHandler_annotations);
4239
0
            return 0;
4240
0
        }
4241
16
        cond = PyDict_SetItemString(ExceptHandler_annotations, "body", type) ==
4242
16
                                    0;
4243
16
        Py_DECREF(type);
4244
16
        if (!cond) {
4245
0
            Py_DECREF(ExceptHandler_annotations);
4246
0
            return 0;
4247
0
        }
4248
16
    }
4249
16
    cond = PyObject_SetAttrString(state->ExceptHandler_type, "_field_types",
4250
16
                                  ExceptHandler_annotations) == 0;
4251
16
    if (!cond) {
4252
0
        Py_DECREF(ExceptHandler_annotations);
4253
0
        return 0;
4254
0
    }
4255
16
    cond = PyObject_SetAttrString(state->ExceptHandler_type, "__annotations__",
4256
16
                                  ExceptHandler_annotations) == 0;
4257
16
    if (!cond) {
4258
0
        Py_DECREF(ExceptHandler_annotations);
4259
0
        return 0;
4260
0
    }
4261
16
    Py_DECREF(ExceptHandler_annotations);
4262
16
    PyObject *arguments_annotations = PyDict_New();
4263
16
    if (!arguments_annotations) return 0;
4264
16
    {
4265
16
        PyObject *type = state->arg_type;
4266
16
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
4267
16
        cond = type != NULL;
4268
16
        if (!cond) {
4269
0
            Py_DECREF(arguments_annotations);
4270
0
            return 0;
4271
0
        }
4272
16
        cond = PyDict_SetItemString(arguments_annotations, "posonlyargs", type)
4273
16
                                    == 0;
4274
16
        Py_DECREF(type);
4275
16
        if (!cond) {
4276
0
            Py_DECREF(arguments_annotations);
4277
0
            return 0;
4278
0
        }
4279
16
    }
4280
16
    {
4281
16
        PyObject *type = state->arg_type;
4282
16
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
4283
16
        cond = type != NULL;
4284
16
        if (!cond) {
4285
0
            Py_DECREF(arguments_annotations);
4286
0
            return 0;
4287
0
        }
4288
16
        cond = PyDict_SetItemString(arguments_annotations, "args", type) == 0;
4289
16
        Py_DECREF(type);
4290
16
        if (!cond) {
4291
0
            Py_DECREF(arguments_annotations);
4292
0
            return 0;
4293
0
        }
4294
16
    }
4295
16
    {
4296
16
        PyObject *type = state->arg_type;
4297
16
        type = _Py_union_type_or(type, Py_None);
4298
16
        cond = type != NULL;
4299
16
        if (!cond) {
4300
0
            Py_DECREF(arguments_annotations);
4301
0
            return 0;
4302
0
        }
4303
16
        cond = PyDict_SetItemString(arguments_annotations, "vararg", type) == 0;
4304
16
        Py_DECREF(type);
4305
16
        if (!cond) {
4306
0
            Py_DECREF(arguments_annotations);
4307
0
            return 0;
4308
0
        }
4309
16
    }
4310
16
    {
4311
16
        PyObject *type = state->arg_type;
4312
16
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
4313
16
        cond = type != NULL;
4314
16
        if (!cond) {
4315
0
            Py_DECREF(arguments_annotations);
4316
0
            return 0;
4317
0
        }
4318
16
        cond = PyDict_SetItemString(arguments_annotations, "kwonlyargs", type)
4319
16
                                    == 0;
4320
16
        Py_DECREF(type);
4321
16
        if (!cond) {
4322
0
            Py_DECREF(arguments_annotations);
4323
0
            return 0;
4324
0
        }
4325
16
    }
4326
16
    {
4327
16
        PyObject *type = state->expr_type;
4328
16
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
4329
16
        cond = type != NULL;
4330
16
        if (!cond) {
4331
0
            Py_DECREF(arguments_annotations);
4332
0
            return 0;
4333
0
        }
4334
16
        cond = PyDict_SetItemString(arguments_annotations, "kw_defaults", type)
4335
16
                                    == 0;
4336
16
        Py_DECREF(type);
4337
16
        if (!cond) {
4338
0
            Py_DECREF(arguments_annotations);
4339
0
            return 0;
4340
0
        }
4341
16
    }
4342
16
    {
4343
16
        PyObject *type = state->arg_type;
4344
16
        type = _Py_union_type_or(type, Py_None);
4345
16
        cond = type != NULL;
4346
16
        if (!cond) {
4347
0
            Py_DECREF(arguments_annotations);
4348
0
            return 0;
4349
0
        }
4350
16
        cond = PyDict_SetItemString(arguments_annotations, "kwarg", type) == 0;
4351
16
        Py_DECREF(type);
4352
16
        if (!cond) {
4353
0
            Py_DECREF(arguments_annotations);
4354
0
            return 0;
4355
0
        }
4356
16
    }
4357
16
    {
4358
16
        PyObject *type = state->expr_type;
4359
16
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
4360
16
        cond = type != NULL;
4361
16
        if (!cond) {
4362
0
            Py_DECREF(arguments_annotations);
4363
0
            return 0;
4364
0
        }
4365
16
        cond = PyDict_SetItemString(arguments_annotations, "defaults", type) ==
4366
16
                                    0;
4367
16
        Py_DECREF(type);
4368
16
        if (!cond) {
4369
0
            Py_DECREF(arguments_annotations);
4370
0
            return 0;
4371
0
        }
4372
16
    }
4373
16
    cond = PyObject_SetAttrString(state->arguments_type, "_field_types",
4374
16
                                  arguments_annotations) == 0;
4375
16
    if (!cond) {
4376
0
        Py_DECREF(arguments_annotations);
4377
0
        return 0;
4378
0
    }
4379
16
    cond = PyObject_SetAttrString(state->arguments_type, "__annotations__",
4380
16
                                  arguments_annotations) == 0;
4381
16
    if (!cond) {
4382
0
        Py_DECREF(arguments_annotations);
4383
0
        return 0;
4384
0
    }
4385
16
    Py_DECREF(arguments_annotations);
4386
16
    PyObject *arg_annotations = PyDict_New();
4387
16
    if (!arg_annotations) return 0;
4388
16
    {
4389
16
        PyObject *type = (PyObject *)&PyUnicode_Type;
4390
16
        Py_INCREF(type);
4391
16
        cond = PyDict_SetItemString(arg_annotations, "arg", type) == 0;
4392
16
        Py_DECREF(type);
4393
16
        if (!cond) {
4394
0
            Py_DECREF(arg_annotations);
4395
0
            return 0;
4396
0
        }
4397
16
    }
4398
16
    {
4399
16
        PyObject *type = state->expr_type;
4400
16
        type = _Py_union_type_or(type, Py_None);
4401
16
        cond = type != NULL;
4402
16
        if (!cond) {
4403
0
            Py_DECREF(arg_annotations);
4404
0
            return 0;
4405
0
        }
4406
16
        cond = PyDict_SetItemString(arg_annotations, "annotation", type) == 0;
4407
16
        Py_DECREF(type);
4408
16
        if (!cond) {
4409
0
            Py_DECREF(arg_annotations);
4410
0
            return 0;
4411
0
        }
4412
16
    }
4413
16
    {
4414
16
        PyObject *type = (PyObject *)&PyUnicode_Type;
4415
16
        type = _Py_union_type_or(type, Py_None);
4416
16
        cond = type != NULL;
4417
16
        if (!cond) {
4418
0
            Py_DECREF(arg_annotations);
4419
0
            return 0;
4420
0
        }
4421
16
        cond = PyDict_SetItemString(arg_annotations, "type_comment", type) == 0;
4422
16
        Py_DECREF(type);
4423
16
        if (!cond) {
4424
0
            Py_DECREF(arg_annotations);
4425
0
            return 0;
4426
0
        }
4427
16
    }
4428
16
    cond = PyObject_SetAttrString(state->arg_type, "_field_types",
4429
16
                                  arg_annotations) == 0;
4430
16
    if (!cond) {
4431
0
        Py_DECREF(arg_annotations);
4432
0
        return 0;
4433
0
    }
4434
16
    cond = PyObject_SetAttrString(state->arg_type, "__annotations__",
4435
16
                                  arg_annotations) == 0;
4436
16
    if (!cond) {
4437
0
        Py_DECREF(arg_annotations);
4438
0
        return 0;
4439
0
    }
4440
16
    Py_DECREF(arg_annotations);
4441
16
    PyObject *keyword_annotations = PyDict_New();
4442
16
    if (!keyword_annotations) return 0;
4443
16
    {
4444
16
        PyObject *type = (PyObject *)&PyUnicode_Type;
4445
16
        type = _Py_union_type_or(type, Py_None);
4446
16
        cond = type != NULL;
4447
16
        if (!cond) {
4448
0
            Py_DECREF(keyword_annotations);
4449
0
            return 0;
4450
0
        }
4451
16
        cond = PyDict_SetItemString(keyword_annotations, "arg", type) == 0;
4452
16
        Py_DECREF(type);
4453
16
        if (!cond) {
4454
0
            Py_DECREF(keyword_annotations);
4455
0
            return 0;
4456
0
        }
4457
16
    }
4458
16
    {
4459
16
        PyObject *type = state->expr_type;
4460
16
        Py_INCREF(type);
4461
16
        cond = PyDict_SetItemString(keyword_annotations, "value", type) == 0;
4462
16
        Py_DECREF(type);
4463
16
        if (!cond) {
4464
0
            Py_DECREF(keyword_annotations);
4465
0
            return 0;
4466
0
        }
4467
16
    }
4468
16
    cond = PyObject_SetAttrString(state->keyword_type, "_field_types",
4469
16
                                  keyword_annotations) == 0;
4470
16
    if (!cond) {
4471
0
        Py_DECREF(keyword_annotations);
4472
0
        return 0;
4473
0
    }
4474
16
    cond = PyObject_SetAttrString(state->keyword_type, "__annotations__",
4475
16
                                  keyword_annotations) == 0;
4476
16
    if (!cond) {
4477
0
        Py_DECREF(keyword_annotations);
4478
0
        return 0;
4479
0
    }
4480
16
    Py_DECREF(keyword_annotations);
4481
16
    PyObject *alias_annotations = PyDict_New();
4482
16
    if (!alias_annotations) return 0;
4483
16
    {
4484
16
        PyObject *type = (PyObject *)&PyUnicode_Type;
4485
16
        Py_INCREF(type);
4486
16
        cond = PyDict_SetItemString(alias_annotations, "name", type) == 0;
4487
16
        Py_DECREF(type);
4488
16
        if (!cond) {
4489
0
            Py_DECREF(alias_annotations);
4490
0
            return 0;
4491
0
        }
4492
16
    }
4493
16
    {
4494
16
        PyObject *type = (PyObject *)&PyUnicode_Type;
4495
16
        type = _Py_union_type_or(type, Py_None);
4496
16
        cond = type != NULL;
4497
16
        if (!cond) {
4498
0
            Py_DECREF(alias_annotations);
4499
0
            return 0;
4500
0
        }
4501
16
        cond = PyDict_SetItemString(alias_annotations, "asname", type) == 0;
4502
16
        Py_DECREF(type);
4503
16
        if (!cond) {
4504
0
            Py_DECREF(alias_annotations);
4505
0
            return 0;
4506
0
        }
4507
16
    }
4508
16
    cond = PyObject_SetAttrString(state->alias_type, "_field_types",
4509
16
                                  alias_annotations) == 0;
4510
16
    if (!cond) {
4511
0
        Py_DECREF(alias_annotations);
4512
0
        return 0;
4513
0
    }
4514
16
    cond = PyObject_SetAttrString(state->alias_type, "__annotations__",
4515
16
                                  alias_annotations) == 0;
4516
16
    if (!cond) {
4517
0
        Py_DECREF(alias_annotations);
4518
0
        return 0;
4519
0
    }
4520
16
    Py_DECREF(alias_annotations);
4521
16
    PyObject *withitem_annotations = PyDict_New();
4522
16
    if (!withitem_annotations) return 0;
4523
16
    {
4524
16
        PyObject *type = state->expr_type;
4525
16
        Py_INCREF(type);
4526
16
        cond = PyDict_SetItemString(withitem_annotations, "context_expr", type)
4527
16
                                    == 0;
4528
16
        Py_DECREF(type);
4529
16
        if (!cond) {
4530
0
            Py_DECREF(withitem_annotations);
4531
0
            return 0;
4532
0
        }
4533
16
    }
4534
16
    {
4535
16
        PyObject *type = state->expr_type;
4536
16
        type = _Py_union_type_or(type, Py_None);
4537
16
        cond = type != NULL;
4538
16
        if (!cond) {
4539
0
            Py_DECREF(withitem_annotations);
4540
0
            return 0;
4541
0
        }
4542
16
        cond = PyDict_SetItemString(withitem_annotations, "optional_vars",
4543
16
                                    type) == 0;
4544
16
        Py_DECREF(type);
4545
16
        if (!cond) {
4546
0
            Py_DECREF(withitem_annotations);
4547
0
            return 0;
4548
0
        }
4549
16
    }
4550
16
    cond = PyObject_SetAttrString(state->withitem_type, "_field_types",
4551
16
                                  withitem_annotations) == 0;
4552
16
    if (!cond) {
4553
0
        Py_DECREF(withitem_annotations);
4554
0
        return 0;
4555
0
    }
4556
16
    cond = PyObject_SetAttrString(state->withitem_type, "__annotations__",
4557
16
                                  withitem_annotations) == 0;
4558
16
    if (!cond) {
4559
0
        Py_DECREF(withitem_annotations);
4560
0
        return 0;
4561
0
    }
4562
16
    Py_DECREF(withitem_annotations);
4563
16
    PyObject *match_case_annotations = PyDict_New();
4564
16
    if (!match_case_annotations) return 0;
4565
16
    {
4566
16
        PyObject *type = state->pattern_type;
4567
16
        Py_INCREF(type);
4568
16
        cond = PyDict_SetItemString(match_case_annotations, "pattern", type) ==
4569
16
                                    0;
4570
16
        Py_DECREF(type);
4571
16
        if (!cond) {
4572
0
            Py_DECREF(match_case_annotations);
4573
0
            return 0;
4574
0
        }
4575
16
    }
4576
16
    {
4577
16
        PyObject *type = state->expr_type;
4578
16
        type = _Py_union_type_or(type, Py_None);
4579
16
        cond = type != NULL;
4580
16
        if (!cond) {
4581
0
            Py_DECREF(match_case_annotations);
4582
0
            return 0;
4583
0
        }
4584
16
        cond = PyDict_SetItemString(match_case_annotations, "guard", type) == 0;
4585
16
        Py_DECREF(type);
4586
16
        if (!cond) {
4587
0
            Py_DECREF(match_case_annotations);
4588
0
            return 0;
4589
0
        }
4590
16
    }
4591
16
    {
4592
16
        PyObject *type = state->stmt_type;
4593
16
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
4594
16
        cond = type != NULL;
4595
16
        if (!cond) {
4596
0
            Py_DECREF(match_case_annotations);
4597
0
            return 0;
4598
0
        }
4599
16
        cond = PyDict_SetItemString(match_case_annotations, "body", type) == 0;
4600
16
        Py_DECREF(type);
4601
16
        if (!cond) {
4602
0
            Py_DECREF(match_case_annotations);
4603
0
            return 0;
4604
0
        }
4605
16
    }
4606
16
    cond = PyObject_SetAttrString(state->match_case_type, "_field_types",
4607
16
                                  match_case_annotations) == 0;
4608
16
    if (!cond) {
4609
0
        Py_DECREF(match_case_annotations);
4610
0
        return 0;
4611
0
    }
4612
16
    cond = PyObject_SetAttrString(state->match_case_type, "__annotations__",
4613
16
                                  match_case_annotations) == 0;
4614
16
    if (!cond) {
4615
0
        Py_DECREF(match_case_annotations);
4616
0
        return 0;
4617
0
    }
4618
16
    Py_DECREF(match_case_annotations);
4619
16
    PyObject *MatchValue_annotations = PyDict_New();
4620
16
    if (!MatchValue_annotations) return 0;
4621
16
    {
4622
16
        PyObject *type = state->expr_type;
4623
16
        Py_INCREF(type);
4624
16
        cond = PyDict_SetItemString(MatchValue_annotations, "value", type) == 0;
4625
16
        Py_DECREF(type);
4626
16
        if (!cond) {
4627
0
            Py_DECREF(MatchValue_annotations);
4628
0
            return 0;
4629
0
        }
4630
16
    }
4631
16
    cond = PyObject_SetAttrString(state->MatchValue_type, "_field_types",
4632
16
                                  MatchValue_annotations) == 0;
4633
16
    if (!cond) {
4634
0
        Py_DECREF(MatchValue_annotations);
4635
0
        return 0;
4636
0
    }
4637
16
    cond = PyObject_SetAttrString(state->MatchValue_type, "__annotations__",
4638
16
                                  MatchValue_annotations) == 0;
4639
16
    if (!cond) {
4640
0
        Py_DECREF(MatchValue_annotations);
4641
0
        return 0;
4642
0
    }
4643
16
    Py_DECREF(MatchValue_annotations);
4644
16
    PyObject *MatchSingleton_annotations = PyDict_New();
4645
16
    if (!MatchSingleton_annotations) return 0;
4646
16
    {
4647
16
        PyObject *type = (PyObject *)&PyBaseObject_Type;
4648
16
        Py_INCREF(type);
4649
16
        cond = PyDict_SetItemString(MatchSingleton_annotations, "value", type)
4650
16
                                    == 0;
4651
16
        Py_DECREF(type);
4652
16
        if (!cond) {
4653
0
            Py_DECREF(MatchSingleton_annotations);
4654
0
            return 0;
4655
0
        }
4656
16
    }
4657
16
    cond = PyObject_SetAttrString(state->MatchSingleton_type, "_field_types",
4658
16
                                  MatchSingleton_annotations) == 0;
4659
16
    if (!cond) {
4660
0
        Py_DECREF(MatchSingleton_annotations);
4661
0
        return 0;
4662
0
    }
4663
16
    cond = PyObject_SetAttrString(state->MatchSingleton_type,
4664
16
                                  "__annotations__",
4665
16
                                  MatchSingleton_annotations) == 0;
4666
16
    if (!cond) {
4667
0
        Py_DECREF(MatchSingleton_annotations);
4668
0
        return 0;
4669
0
    }
4670
16
    Py_DECREF(MatchSingleton_annotations);
4671
16
    PyObject *MatchSequence_annotations = PyDict_New();
4672
16
    if (!MatchSequence_annotations) return 0;
4673
16
    {
4674
16
        PyObject *type = state->pattern_type;
4675
16
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
4676
16
        cond = type != NULL;
4677
16
        if (!cond) {
4678
0
            Py_DECREF(MatchSequence_annotations);
4679
0
            return 0;
4680
0
        }
4681
16
        cond = PyDict_SetItemString(MatchSequence_annotations, "patterns",
4682
16
                                    type) == 0;
4683
16
        Py_DECREF(type);
4684
16
        if (!cond) {
4685
0
            Py_DECREF(MatchSequence_annotations);
4686
0
            return 0;
4687
0
        }
4688
16
    }
4689
16
    cond = PyObject_SetAttrString(state->MatchSequence_type, "_field_types",
4690
16
                                  MatchSequence_annotations) == 0;
4691
16
    if (!cond) {
4692
0
        Py_DECREF(MatchSequence_annotations);
4693
0
        return 0;
4694
0
    }
4695
16
    cond = PyObject_SetAttrString(state->MatchSequence_type, "__annotations__",
4696
16
                                  MatchSequence_annotations) == 0;
4697
16
    if (!cond) {
4698
0
        Py_DECREF(MatchSequence_annotations);
4699
0
        return 0;
4700
0
    }
4701
16
    Py_DECREF(MatchSequence_annotations);
4702
16
    PyObject *MatchMapping_annotations = PyDict_New();
4703
16
    if (!MatchMapping_annotations) return 0;
4704
16
    {
4705
16
        PyObject *type = state->expr_type;
4706
16
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
4707
16
        cond = type != NULL;
4708
16
        if (!cond) {
4709
0
            Py_DECREF(MatchMapping_annotations);
4710
0
            return 0;
4711
0
        }
4712
16
        cond = PyDict_SetItemString(MatchMapping_annotations, "keys", type) ==
4713
16
                                    0;
4714
16
        Py_DECREF(type);
4715
16
        if (!cond) {
4716
0
            Py_DECREF(MatchMapping_annotations);
4717
0
            return 0;
4718
0
        }
4719
16
    }
4720
16
    {
4721
16
        PyObject *type = state->pattern_type;
4722
16
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
4723
16
        cond = type != NULL;
4724
16
        if (!cond) {
4725
0
            Py_DECREF(MatchMapping_annotations);
4726
0
            return 0;
4727
0
        }
4728
16
        cond = PyDict_SetItemString(MatchMapping_annotations, "patterns", type)
4729
16
                                    == 0;
4730
16
        Py_DECREF(type);
4731
16
        if (!cond) {
4732
0
            Py_DECREF(MatchMapping_annotations);
4733
0
            return 0;
4734
0
        }
4735
16
    }
4736
16
    {
4737
16
        PyObject *type = (PyObject *)&PyUnicode_Type;
4738
16
        type = _Py_union_type_or(type, Py_None);
4739
16
        cond = type != NULL;
4740
16
        if (!cond) {
4741
0
            Py_DECREF(MatchMapping_annotations);
4742
0
            return 0;
4743
0
        }
4744
16
        cond = PyDict_SetItemString(MatchMapping_annotations, "rest", type) ==
4745
16
                                    0;
4746
16
        Py_DECREF(type);
4747
16
        if (!cond) {
4748
0
            Py_DECREF(MatchMapping_annotations);
4749
0
            return 0;
4750
0
        }
4751
16
    }
4752
16
    cond = PyObject_SetAttrString(state->MatchMapping_type, "_field_types",
4753
16
                                  MatchMapping_annotations) == 0;
4754
16
    if (!cond) {
4755
0
        Py_DECREF(MatchMapping_annotations);
4756
0
        return 0;
4757
0
    }
4758
16
    cond = PyObject_SetAttrString(state->MatchMapping_type, "__annotations__",
4759
16
                                  MatchMapping_annotations) == 0;
4760
16
    if (!cond) {
4761
0
        Py_DECREF(MatchMapping_annotations);
4762
0
        return 0;
4763
0
    }
4764
16
    Py_DECREF(MatchMapping_annotations);
4765
16
    PyObject *MatchClass_annotations = PyDict_New();
4766
16
    if (!MatchClass_annotations) return 0;
4767
16
    {
4768
16
        PyObject *type = state->expr_type;
4769
16
        Py_INCREF(type);
4770
16
        cond = PyDict_SetItemString(MatchClass_annotations, "cls", type) == 0;
4771
16
        Py_DECREF(type);
4772
16
        if (!cond) {
4773
0
            Py_DECREF(MatchClass_annotations);
4774
0
            return 0;
4775
0
        }
4776
16
    }
4777
16
    {
4778
16
        PyObject *type = state->pattern_type;
4779
16
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
4780
16
        cond = type != NULL;
4781
16
        if (!cond) {
4782
0
            Py_DECREF(MatchClass_annotations);
4783
0
            return 0;
4784
0
        }
4785
16
        cond = PyDict_SetItemString(MatchClass_annotations, "patterns", type)
4786
16
                                    == 0;
4787
16
        Py_DECREF(type);
4788
16
        if (!cond) {
4789
0
            Py_DECREF(MatchClass_annotations);
4790
0
            return 0;
4791
0
        }
4792
16
    }
4793
16
    {
4794
16
        PyObject *type = (PyObject *)&PyUnicode_Type;
4795
16
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
4796
16
        cond = type != NULL;
4797
16
        if (!cond) {
4798
0
            Py_DECREF(MatchClass_annotations);
4799
0
            return 0;
4800
0
        }
4801
16
        cond = PyDict_SetItemString(MatchClass_annotations, "kwd_attrs", type)
4802
16
                                    == 0;
4803
16
        Py_DECREF(type);
4804
16
        if (!cond) {
4805
0
            Py_DECREF(MatchClass_annotations);
4806
0
            return 0;
4807
0
        }
4808
16
    }
4809
16
    {
4810
16
        PyObject *type = state->pattern_type;
4811
16
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
4812
16
        cond = type != NULL;
4813
16
        if (!cond) {
4814
0
            Py_DECREF(MatchClass_annotations);
4815
0
            return 0;
4816
0
        }
4817
16
        cond = PyDict_SetItemString(MatchClass_annotations, "kwd_patterns",
4818
16
                                    type) == 0;
4819
16
        Py_DECREF(type);
4820
16
        if (!cond) {
4821
0
            Py_DECREF(MatchClass_annotations);
4822
0
            return 0;
4823
0
        }
4824
16
    }
4825
16
    cond = PyObject_SetAttrString(state->MatchClass_type, "_field_types",
4826
16
                                  MatchClass_annotations) == 0;
4827
16
    if (!cond) {
4828
0
        Py_DECREF(MatchClass_annotations);
4829
0
        return 0;
4830
0
    }
4831
16
    cond = PyObject_SetAttrString(state->MatchClass_type, "__annotations__",
4832
16
                                  MatchClass_annotations) == 0;
4833
16
    if (!cond) {
4834
0
        Py_DECREF(MatchClass_annotations);
4835
0
        return 0;
4836
0
    }
4837
16
    Py_DECREF(MatchClass_annotations);
4838
16
    PyObject *MatchStar_annotations = PyDict_New();
4839
16
    if (!MatchStar_annotations) return 0;
4840
16
    {
4841
16
        PyObject *type = (PyObject *)&PyUnicode_Type;
4842
16
        type = _Py_union_type_or(type, Py_None);
4843
16
        cond = type != NULL;
4844
16
        if (!cond) {
4845
0
            Py_DECREF(MatchStar_annotations);
4846
0
            return 0;
4847
0
        }
4848
16
        cond = PyDict_SetItemString(MatchStar_annotations, "name", type) == 0;
4849
16
        Py_DECREF(type);
4850
16
        if (!cond) {
4851
0
            Py_DECREF(MatchStar_annotations);
4852
0
            return 0;
4853
0
        }
4854
16
    }
4855
16
    cond = PyObject_SetAttrString(state->MatchStar_type, "_field_types",
4856
16
                                  MatchStar_annotations) == 0;
4857
16
    if (!cond) {
4858
0
        Py_DECREF(MatchStar_annotations);
4859
0
        return 0;
4860
0
    }
4861
16
    cond = PyObject_SetAttrString(state->MatchStar_type, "__annotations__",
4862
16
                                  MatchStar_annotations) == 0;
4863
16
    if (!cond) {
4864
0
        Py_DECREF(MatchStar_annotations);
4865
0
        return 0;
4866
0
    }
4867
16
    Py_DECREF(MatchStar_annotations);
4868
16
    PyObject *MatchAs_annotations = PyDict_New();
4869
16
    if (!MatchAs_annotations) return 0;
4870
16
    {
4871
16
        PyObject *type = state->pattern_type;
4872
16
        type = _Py_union_type_or(type, Py_None);
4873
16
        cond = type != NULL;
4874
16
        if (!cond) {
4875
0
            Py_DECREF(MatchAs_annotations);
4876
0
            return 0;
4877
0
        }
4878
16
        cond = PyDict_SetItemString(MatchAs_annotations, "pattern", type) == 0;
4879
16
        Py_DECREF(type);
4880
16
        if (!cond) {
4881
0
            Py_DECREF(MatchAs_annotations);
4882
0
            return 0;
4883
0
        }
4884
16
    }
4885
16
    {
4886
16
        PyObject *type = (PyObject *)&PyUnicode_Type;
4887
16
        type = _Py_union_type_or(type, Py_None);
4888
16
        cond = type != NULL;
4889
16
        if (!cond) {
4890
0
            Py_DECREF(MatchAs_annotations);
4891
0
            return 0;
4892
0
        }
4893
16
        cond = PyDict_SetItemString(MatchAs_annotations, "name", type) == 0;
4894
16
        Py_DECREF(type);
4895
16
        if (!cond) {
4896
0
            Py_DECREF(MatchAs_annotations);
4897
0
            return 0;
4898
0
        }
4899
16
    }
4900
16
    cond = PyObject_SetAttrString(state->MatchAs_type, "_field_types",
4901
16
                                  MatchAs_annotations) == 0;
4902
16
    if (!cond) {
4903
0
        Py_DECREF(MatchAs_annotations);
4904
0
        return 0;
4905
0
    }
4906
16
    cond = PyObject_SetAttrString(state->MatchAs_type, "__annotations__",
4907
16
                                  MatchAs_annotations) == 0;
4908
16
    if (!cond) {
4909
0
        Py_DECREF(MatchAs_annotations);
4910
0
        return 0;
4911
0
    }
4912
16
    Py_DECREF(MatchAs_annotations);
4913
16
    PyObject *MatchOr_annotations = PyDict_New();
4914
16
    if (!MatchOr_annotations) return 0;
4915
16
    {
4916
16
        PyObject *type = state->pattern_type;
4917
16
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
4918
16
        cond = type != NULL;
4919
16
        if (!cond) {
4920
0
            Py_DECREF(MatchOr_annotations);
4921
0
            return 0;
4922
0
        }
4923
16
        cond = PyDict_SetItemString(MatchOr_annotations, "patterns", type) == 0;
4924
16
        Py_DECREF(type);
4925
16
        if (!cond) {
4926
0
            Py_DECREF(MatchOr_annotations);
4927
0
            return 0;
4928
0
        }
4929
16
    }
4930
16
    cond = PyObject_SetAttrString(state->MatchOr_type, "_field_types",
4931
16
                                  MatchOr_annotations) == 0;
4932
16
    if (!cond) {
4933
0
        Py_DECREF(MatchOr_annotations);
4934
0
        return 0;
4935
0
    }
4936
16
    cond = PyObject_SetAttrString(state->MatchOr_type, "__annotations__",
4937
16
                                  MatchOr_annotations) == 0;
4938
16
    if (!cond) {
4939
0
        Py_DECREF(MatchOr_annotations);
4940
0
        return 0;
4941
0
    }
4942
16
    Py_DECREF(MatchOr_annotations);
4943
16
    PyObject *TypeIgnore_annotations = PyDict_New();
4944
16
    if (!TypeIgnore_annotations) return 0;
4945
16
    {
4946
16
        PyObject *type = (PyObject *)&PyLong_Type;
4947
16
        Py_INCREF(type);
4948
16
        cond = PyDict_SetItemString(TypeIgnore_annotations, "lineno", type) ==
4949
16
                                    0;
4950
16
        Py_DECREF(type);
4951
16
        if (!cond) {
4952
0
            Py_DECREF(TypeIgnore_annotations);
4953
0
            return 0;
4954
0
        }
4955
16
    }
4956
16
    {
4957
16
        PyObject *type = (PyObject *)&PyUnicode_Type;
4958
16
        Py_INCREF(type);
4959
16
        cond = PyDict_SetItemString(TypeIgnore_annotations, "tag", type) == 0;
4960
16
        Py_DECREF(type);
4961
16
        if (!cond) {
4962
0
            Py_DECREF(TypeIgnore_annotations);
4963
0
            return 0;
4964
0
        }
4965
16
    }
4966
16
    cond = PyObject_SetAttrString(state->TypeIgnore_type, "_field_types",
4967
16
                                  TypeIgnore_annotations) == 0;
4968
16
    if (!cond) {
4969
0
        Py_DECREF(TypeIgnore_annotations);
4970
0
        return 0;
4971
0
    }
4972
16
    cond = PyObject_SetAttrString(state->TypeIgnore_type, "__annotations__",
4973
16
                                  TypeIgnore_annotations) == 0;
4974
16
    if (!cond) {
4975
0
        Py_DECREF(TypeIgnore_annotations);
4976
0
        return 0;
4977
0
    }
4978
16
    Py_DECREF(TypeIgnore_annotations);
4979
16
    PyObject *TypeVar_annotations = PyDict_New();
4980
16
    if (!TypeVar_annotations) return 0;
4981
16
    {
4982
16
        PyObject *type = (PyObject *)&PyUnicode_Type;
4983
16
        Py_INCREF(type);
4984
16
        cond = PyDict_SetItemString(TypeVar_annotations, "name", type) == 0;
4985
16
        Py_DECREF(type);
4986
16
        if (!cond) {
4987
0
            Py_DECREF(TypeVar_annotations);
4988
0
            return 0;
4989
0
        }
4990
16
    }
4991
16
    {
4992
16
        PyObject *type = state->expr_type;
4993
16
        type = _Py_union_type_or(type, Py_None);
4994
16
        cond = type != NULL;
4995
16
        if (!cond) {
4996
0
            Py_DECREF(TypeVar_annotations);
4997
0
            return 0;
4998
0
        }
4999
16
        cond = PyDict_SetItemString(TypeVar_annotations, "bound", type) == 0;
5000
16
        Py_DECREF(type);
5001
16
        if (!cond) {
5002
0
            Py_DECREF(TypeVar_annotations);
5003
0
            return 0;
5004
0
        }
5005
16
    }
5006
16
    {
5007
16
        PyObject *type = state->expr_type;
5008
16
        type = _Py_union_type_or(type, Py_None);
5009
16
        cond = type != NULL;
5010
16
        if (!cond) {
5011
0
            Py_DECREF(TypeVar_annotations);
5012
0
            return 0;
5013
0
        }
5014
16
        cond = PyDict_SetItemString(TypeVar_annotations, "default_value", type)
5015
16
                                    == 0;
5016
16
        Py_DECREF(type);
5017
16
        if (!cond) {
5018
0
            Py_DECREF(TypeVar_annotations);
5019
0
            return 0;
5020
0
        }
5021
16
    }
5022
16
    cond = PyObject_SetAttrString(state->TypeVar_type, "_field_types",
5023
16
                                  TypeVar_annotations) == 0;
5024
16
    if (!cond) {
5025
0
        Py_DECREF(TypeVar_annotations);
5026
0
        return 0;
5027
0
    }
5028
16
    cond = PyObject_SetAttrString(state->TypeVar_type, "__annotations__",
5029
16
                                  TypeVar_annotations) == 0;
5030
16
    if (!cond) {
5031
0
        Py_DECREF(TypeVar_annotations);
5032
0
        return 0;
5033
0
    }
5034
16
    Py_DECREF(TypeVar_annotations);
5035
16
    PyObject *ParamSpec_annotations = PyDict_New();
5036
16
    if (!ParamSpec_annotations) return 0;
5037
16
    {
5038
16
        PyObject *type = (PyObject *)&PyUnicode_Type;
5039
16
        Py_INCREF(type);
5040
16
        cond = PyDict_SetItemString(ParamSpec_annotations, "name", type) == 0;
5041
16
        Py_DECREF(type);
5042
16
        if (!cond) {
5043
0
            Py_DECREF(ParamSpec_annotations);
5044
0
            return 0;
5045
0
        }
5046
16
    }
5047
16
    {
5048
16
        PyObject *type = state->expr_type;
5049
16
        type = _Py_union_type_or(type, Py_None);
5050
16
        cond = type != NULL;
5051
16
        if (!cond) {
5052
0
            Py_DECREF(ParamSpec_annotations);
5053
0
            return 0;
5054
0
        }
5055
16
        cond = PyDict_SetItemString(ParamSpec_annotations, "default_value",
5056
16
                                    type) == 0;
5057
16
        Py_DECREF(type);
5058
16
        if (!cond) {
5059
0
            Py_DECREF(ParamSpec_annotations);
5060
0
            return 0;
5061
0
        }
5062
16
    }
5063
16
    cond = PyObject_SetAttrString(state->ParamSpec_type, "_field_types",
5064
16
                                  ParamSpec_annotations) == 0;
5065
16
    if (!cond) {
5066
0
        Py_DECREF(ParamSpec_annotations);
5067
0
        return 0;
5068
0
    }
5069
16
    cond = PyObject_SetAttrString(state->ParamSpec_type, "__annotations__",
5070
16
                                  ParamSpec_annotations) == 0;
5071
16
    if (!cond) {
5072
0
        Py_DECREF(ParamSpec_annotations);
5073
0
        return 0;
5074
0
    }
5075
16
    Py_DECREF(ParamSpec_annotations);
5076
16
    PyObject *TypeVarTuple_annotations = PyDict_New();
5077
16
    if (!TypeVarTuple_annotations) return 0;
5078
16
    {
5079
16
        PyObject *type = (PyObject *)&PyUnicode_Type;
5080
16
        Py_INCREF(type);
5081
16
        cond = PyDict_SetItemString(TypeVarTuple_annotations, "name", type) ==
5082
16
                                    0;
5083
16
        Py_DECREF(type);
5084
16
        if (!cond) {
5085
0
            Py_DECREF(TypeVarTuple_annotations);
5086
0
            return 0;
5087
0
        }
5088
16
    }
5089
16
    {
5090
16
        PyObject *type = state->expr_type;
5091
16
        type = _Py_union_type_or(type, Py_None);
5092
16
        cond = type != NULL;
5093
16
        if (!cond) {
5094
0
            Py_DECREF(TypeVarTuple_annotations);
5095
0
            return 0;
5096
0
        }
5097
16
        cond = PyDict_SetItemString(TypeVarTuple_annotations, "default_value",
5098
16
                                    type) == 0;
5099
16
        Py_DECREF(type);
5100
16
        if (!cond) {
5101
0
            Py_DECREF(TypeVarTuple_annotations);
5102
0
            return 0;
5103
0
        }
5104
16
    }
5105
16
    cond = PyObject_SetAttrString(state->TypeVarTuple_type, "_field_types",
5106
16
                                  TypeVarTuple_annotations) == 0;
5107
16
    if (!cond) {
5108
0
        Py_DECREF(TypeVarTuple_annotations);
5109
0
        return 0;
5110
0
    }
5111
16
    cond = PyObject_SetAttrString(state->TypeVarTuple_type, "__annotations__",
5112
16
                                  TypeVarTuple_annotations) == 0;
5113
16
    if (!cond) {
5114
0
        Py_DECREF(TypeVarTuple_annotations);
5115
0
        return 0;
5116
0
    }
5117
16
    Py_DECREF(TypeVarTuple_annotations);
5118
5119
16
    return 1;
5120
16
}
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
370k
{
5132
370k
    AST_object *self = (AST_object*)op;
5133
    /* bpo-31095: UnTrack is needed before calling any callbacks */
5134
370k
    PyTypeObject *tp = Py_TYPE(self);
5135
370k
    PyObject_GC_UnTrack(self);
5136
370k
    Py_CLEAR(self->dict);
5137
370k
    freefunc free_func = PyType_GetSlot(tp, Py_tp_free);
5138
370k
    assert(free_func != NULL);
5139
370k
    free_func(self);
5140
370k
    Py_DECREF(tp);
5141
370k
}
5142
5143
static int
5144
ast_traverse(PyObject *op, visitproc visit, void *arg)
5145
114k
{
5146
114k
    AST_object *self = (AST_object*)op;
5147
114k
    Py_VISIT(Py_TYPE(self));
5148
114k
    Py_VISIT(self->dict);
5149
114k
    return 0;
5150
114k
}
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
94
{
5163
94
    struct ast_state *state = get_ast_state();
5164
94
    if (state == NULL) {
5165
0
        return -1;
5166
0
    }
5167
5168
94
    Py_ssize_t i, numfields = 0;
5169
94
    int res = -1;
5170
94
    PyObject *key, *value, *fields, *attributes = NULL, *remaining_fields = NULL;
5171
5172
94
    fields = PyObject_GetAttr((PyObject*)Py_TYPE(self), state->_fields);
5173
94
    if (fields == NULL) {
5174
0
        goto cleanup;
5175
0
    }
5176
5177
94
    numfields = PySequence_Size(fields);
5178
94
    if (numfields == -1) {
5179
0
        goto cleanup;
5180
0
    }
5181
94
    remaining_fields = PySet_New(fields);
5182
94
    if (remaining_fields == NULL) {
5183
0
        goto cleanup;
5184
0
    }
5185
5186
94
    res = 0; /* if no error occurs, this stays 0 to the end */
5187
94
    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
110
    for (i = 0; i < PyTuple_GET_SIZE(args); i++) {
5196
        /* cannot be reached when fields is NULL */
5197
16
        PyObject *name = PySequence_GetItem(fields, i);
5198
16
        if (!name) {
5199
0
            res = -1;
5200
0
            goto cleanup;
5201
0
        }
5202
16
        res = PyObject_SetAttr(self, name, PyTuple_GET_ITEM(args, i));
5203
16
        if (PySet_Discard(remaining_fields, name) < 0) {
5204
0
            res = -1;
5205
0
            Py_DECREF(name);
5206
0
            goto cleanup;
5207
0
        }
5208
16
        Py_DECREF(name);
5209
16
        if (res < 0) {
5210
0
            goto cleanup;
5211
0
        }
5212
16
    }
5213
94
    if (kw) {
5214
16
        i = 0;  /* needed by PyDict_Next */
5215
32
        while (PyDict_Next(kw, &i, &key, &value)) {
5216
16
            int contains = PySequence_Contains(fields, key);
5217
16
            if (contains == -1) {
5218
0
                res = -1;
5219
0
                goto cleanup;
5220
0
            }
5221
16
            else if (contains == 1) {
5222
16
                int p = PySet_Discard(remaining_fields, key);
5223
16
                if (p == -1) {
5224
0
                    res = -1;
5225
0
                    goto cleanup;
5226
0
                }
5227
16
                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
16
            }
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
16
            res = PyObject_SetAttr(self, key, value);
5263
16
            if (res < 0) {
5264
0
                goto cleanup;
5265
0
            }
5266
16
        }
5267
16
    }
5268
94
    Py_ssize_t size = PySet_Size(remaining_fields);
5269
94
    PyObject *field_types = NULL, *remaining_list = NULL;
5270
94
    if (size > 0) {
5271
24
        if (PyObject_GetOptionalAttr((PyObject*)Py_TYPE(self), &_Py_ID(_field_types),
5272
24
                                     &field_types) < 0) {
5273
0
            res = -1;
5274
0
            goto cleanup;
5275
0
        }
5276
24
        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
24
        remaining_list = PySequence_List(remaining_fields);
5283
24
        if (!remaining_list) {
5284
0
            goto set_remaining_cleanup;
5285
0
        }
5286
48
        for (Py_ssize_t i = 0; i < size; i++) {
5287
24
            PyObject *name = PyList_GET_ITEM(remaining_list, i);
5288
24
            PyObject *type = PyDict_GetItemWithError(field_types, name);
5289
24
            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 %R 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
24
            else if (_PyUnion_Check(type)) {
5305
                // optional field
5306
                // do nothing, we'll have set a None default on the class
5307
0
            }
5308
24
            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
24
            else if (type == state->expr_context_type) {
5321
                // special case for expr_context: default to Load()
5322
24
                res = PyObject_SetAttr(self, name, state->Load_singleton);
5323
24
                if (res < 0) {
5324
0
                    goto set_remaining_cleanup;
5325
0
                }
5326
24
            }
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: %R. "
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
24
        }
5339
24
        Py_DECREF(remaining_list);
5340
24
        Py_DECREF(field_types);
5341
24
    }
5342
94
  cleanup:
5343
94
    Py_XDECREF(attributes);
5344
94
    Py_XDECREF(fields);
5345
94
    Py_XDECREF(remaining_fields);
5346
94
    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
94
}
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
2.00k
{
6002
2.00k
    PyObject *fnames, *result;
6003
2.00k
    int i;
6004
2.00k
    fnames = PyTuple_New(num_fields);
6005
2.00k
    if (!fnames) return NULL;
6006
5.13k
    for (i = 0; i < num_fields; i++) {
6007
3.13k
        PyObject *field = PyUnicode_InternFromString(fields[i]);
6008
3.13k
        if (!field) {
6009
0
            Py_DECREF(fnames);
6010
0
            return NULL;
6011
0
        }
6012
3.13k
        PyTuple_SET_ITEM(fnames, i, field);
6013
3.13k
    }
6014
2.00k
    result = PyObject_CallFunction((PyObject*)&PyType_Type, "s(O){OOOOOOOs}",
6015
2.00k
                    type, base,
6016
2.00k
                    state->_fields, fnames,
6017
2.00k
                    state->__match_args__, fnames,
6018
2.00k
                    state->__module__,
6019
2.00k
                    state->ast,
6020
2.00k
                    state->__doc__, doc);
6021
2.00k
    Py_DECREF(fnames);
6022
2.00k
    return result;
6023
2.00k
}
6024
6025
static int
6026
add_attributes(struct ast_state *state, PyObject *type, const char * const *attrs, int num_fields)
6027
304
{
6028
304
    int i, result;
6029
304
    PyObject *s, *l = PyTuple_New(num_fields);
6030
304
    if (!l)
6031
0
        return -1;
6032
816
    for (i = 0; i < num_fields; i++) {
6033
512
        s = PyUnicode_InternFromString(attrs[i]);
6034
512
        if (!s) {
6035
0
            Py_DECREF(l);
6036
0
            return -1;
6037
0
        }
6038
512
        PyTuple_SET_ITEM(l, i, s);
6039
512
    }
6040
304
    result = PyObject_SetAttr(type, state->_attributes, l);
6041
304
    Py_DECREF(l);
6042
304
    return result;
6043
304
}
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
91.8k
{
6050
91.8k
    Py_ssize_t i, n = asdl_seq_LEN(seq);
6051
91.8k
    PyObject *result = PyList_New(n);
6052
91.8k
    PyObject *value;
6053
91.8k
    if (!result)
6054
0
        return NULL;
6055
246k
    for (i = 0; i < n; i++) {
6056
154k
        value = func(state, asdl_seq_GET_UNTYPED(seq, i));
6057
154k
        if (!value) {
6058
0
            Py_DECREF(result);
6059
0
            return NULL;
6060
0
        }
6061
154k
        PyList_SET_ITEM(result, i, value);
6062
154k
    }
6063
91.8k
    return result;
6064
91.8k
}
6065
6066
static PyObject* ast2obj_object(struct ast_state *Py_UNUSED(state), void *o)
6067
245k
{
6068
245k
    PyObject *op = (PyObject*)o;
6069
245k
    if (!op) {
6070
85.4k
        op = Py_None;
6071
85.4k
    }
6072
245k
    return Py_NewRef(op);
6073
245k
}
6074
63.3k
#define ast2obj_constant ast2obj_object
6075
108k
#define ast2obj_identifier ast2obj_object
6076
74.1k
#define ast2obj_string ast2obj_object
6077
6078
static PyObject* ast2obj_int(struct ast_state *Py_UNUSED(state), long b)
6079
1.44M
{
6080
1.44M
    return PyLong_FromLong(b);
6081
1.44M
}
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
16
{
6147
16
    PyObject *empty_tuple;
6148
16
    empty_tuple = PyTuple_New(0);
6149
16
    if (!empty_tuple ||
6150
16
        PyObject_SetAttrString(state->AST_type, "_fields", empty_tuple) < 0 ||
6151
16
        PyObject_SetAttrString(state->AST_type, "__match_args__", empty_tuple) < 0 ||
6152
16
        PyObject_SetAttrString(state->AST_type, "_attributes", empty_tuple) < 0) {
6153
0
        Py_XDECREF(empty_tuple);
6154
0
        return -1;
6155
0
    }
6156
16
    Py_DECREF(empty_tuple);
6157
16
    return 0;
6158
16
}
6159
6160
6161
6162
static int
6163
init_types(void *arg)
6164
16
{
6165
16
    struct ast_state *state = arg;
6166
16
    if (init_identifiers(state) < 0) {
6167
0
        return -1;
6168
0
    }
6169
16
    state->AST_type = PyType_FromSpec(&AST_type_spec);
6170
16
    if (!state->AST_type) {
6171
0
        return -1;
6172
0
    }
6173
16
    if (add_ast_fields(state) < 0) {
6174
0
        return -1;
6175
0
    }
6176
16
    state->mod_type = make_type(state, "mod", state->AST_type, NULL, 0,
6177
16
        "mod = Module(stmt* body, type_ignore* type_ignores)\n"
6178
16
        "    | Interactive(stmt* body)\n"
6179
16
        "    | Expression(expr body)\n"
6180
16
        "    | FunctionType(expr* argtypes, expr returns)");
6181
16
    if (!state->mod_type) return -1;
6182
16
    if (add_attributes(state, state->mod_type, NULL, 0) < 0) return -1;
6183
16
    state->Module_type = make_type(state, "Module", state->mod_type,
6184
16
                                   Module_fields, 2,
6185
16
        "Module(stmt* body, type_ignore* type_ignores)");
6186
16
    if (!state->Module_type) return -1;
6187
16
    state->Interactive_type = make_type(state, "Interactive", state->mod_type,
6188
16
                                        Interactive_fields, 1,
6189
16
        "Interactive(stmt* body)");
6190
16
    if (!state->Interactive_type) return -1;
6191
16
    state->Expression_type = make_type(state, "Expression", state->mod_type,
6192
16
                                       Expression_fields, 1,
6193
16
        "Expression(expr body)");
6194
16
    if (!state->Expression_type) return -1;
6195
16
    state->FunctionType_type = make_type(state, "FunctionType",
6196
16
                                         state->mod_type, FunctionType_fields,
6197
16
                                         2,
6198
16
        "FunctionType(expr* argtypes, expr returns)");
6199
16
    if (!state->FunctionType_type) return -1;
6200
16
    state->stmt_type = make_type(state, "stmt", state->AST_type, NULL, 0,
6201
16
        "stmt = FunctionDef(identifier name, arguments args, stmt* body, expr* decorator_list, expr? returns, string? type_comment, type_param* type_params)\n"
6202
16
        "     | AsyncFunctionDef(identifier name, arguments args, stmt* body, expr* decorator_list, expr? returns, string? type_comment, type_param* type_params)\n"
6203
16
        "     | ClassDef(identifier name, expr* bases, keyword* keywords, stmt* body, expr* decorator_list, type_param* type_params)\n"
6204
16
        "     | Return(expr? value)\n"
6205
16
        "     | Delete(expr* targets)\n"
6206
16
        "     | Assign(expr* targets, expr value, string? type_comment)\n"
6207
16
        "     | TypeAlias(expr name, type_param* type_params, expr value)\n"
6208
16
        "     | AugAssign(expr target, operator op, expr value)\n"
6209
16
        "     | AnnAssign(expr target, expr annotation, expr? value, int simple)\n"
6210
16
        "     | For(expr target, expr iter, stmt* body, stmt* orelse, string? type_comment)\n"
6211
16
        "     | AsyncFor(expr target, expr iter, stmt* body, stmt* orelse, string? type_comment)\n"
6212
16
        "     | While(expr test, stmt* body, stmt* orelse)\n"
6213
16
        "     | If(expr test, stmt* body, stmt* orelse)\n"
6214
16
        "     | With(withitem* items, stmt* body, string? type_comment)\n"
6215
16
        "     | AsyncWith(withitem* items, stmt* body, string? type_comment)\n"
6216
16
        "     | Match(expr subject, match_case* cases)\n"
6217
16
        "     | Raise(expr? exc, expr? cause)\n"
6218
16
        "     | Try(stmt* body, excepthandler* handlers, stmt* orelse, stmt* finalbody)\n"
6219
16
        "     | TryStar(stmt* body, excepthandler* handlers, stmt* orelse, stmt* finalbody)\n"
6220
16
        "     | Assert(expr test, expr? msg)\n"
6221
16
        "     | Import(alias* names)\n"
6222
16
        "     | ImportFrom(identifier? module, alias* names, int? level)\n"
6223
16
        "     | Global(identifier* names)\n"
6224
16
        "     | Nonlocal(identifier* names)\n"
6225
16
        "     | Expr(expr value)\n"
6226
16
        "     | Pass\n"
6227
16
        "     | Break\n"
6228
16
        "     | Continue");
6229
16
    if (!state->stmt_type) return -1;
6230
16
    if (add_attributes(state, state->stmt_type, stmt_attributes, 4) < 0) return
6231
0
        -1;
6232
16
    if (PyObject_SetAttr(state->stmt_type, state->end_lineno, Py_None) == -1)
6233
0
        return -1;
6234
16
    if (PyObject_SetAttr(state->stmt_type, state->end_col_offset, Py_None) ==
6235
16
        -1)
6236
0
        return -1;
6237
16
    state->FunctionDef_type = make_type(state, "FunctionDef", state->stmt_type,
6238
16
                                        FunctionDef_fields, 7,
6239
16
        "FunctionDef(identifier name, arguments args, stmt* body, expr* decorator_list, expr? returns, string? type_comment, type_param* type_params)");
6240
16
    if (!state->FunctionDef_type) return -1;
6241
16
    if (PyObject_SetAttr(state->FunctionDef_type, state->returns, Py_None) ==
6242
16
        -1)
6243
0
        return -1;
6244
16
    if (PyObject_SetAttr(state->FunctionDef_type, state->type_comment, Py_None)
6245
16
        == -1)
6246
0
        return -1;
6247
16
    state->AsyncFunctionDef_type = make_type(state, "AsyncFunctionDef",
6248
16
                                             state->stmt_type,
6249
16
                                             AsyncFunctionDef_fields, 7,
6250
16
        "AsyncFunctionDef(identifier name, arguments args, stmt* body, expr* decorator_list, expr? returns, string? type_comment, type_param* type_params)");
6251
16
    if (!state->AsyncFunctionDef_type) return -1;
6252
16
    if (PyObject_SetAttr(state->AsyncFunctionDef_type, state->returns, Py_None)
6253
16
        == -1)
6254
0
        return -1;
6255
16
    if (PyObject_SetAttr(state->AsyncFunctionDef_type, state->type_comment,
6256
16
        Py_None) == -1)
6257
0
        return -1;
6258
16
    state->ClassDef_type = make_type(state, "ClassDef", state->stmt_type,
6259
16
                                     ClassDef_fields, 6,
6260
16
        "ClassDef(identifier name, expr* bases, keyword* keywords, stmt* body, expr* decorator_list, type_param* type_params)");
6261
16
    if (!state->ClassDef_type) return -1;
6262
16
    state->Return_type = make_type(state, "Return", state->stmt_type,
6263
16
                                   Return_fields, 1,
6264
16
        "Return(expr? value)");
6265
16
    if (!state->Return_type) return -1;
6266
16
    if (PyObject_SetAttr(state->Return_type, state->value, Py_None) == -1)
6267
0
        return -1;
6268
16
    state->Delete_type = make_type(state, "Delete", state->stmt_type,
6269
16
                                   Delete_fields, 1,
6270
16
        "Delete(expr* targets)");
6271
16
    if (!state->Delete_type) return -1;
6272
16
    state->Assign_type = make_type(state, "Assign", state->stmt_type,
6273
16
                                   Assign_fields, 3,
6274
16
        "Assign(expr* targets, expr value, string? type_comment)");
6275
16
    if (!state->Assign_type) return -1;
6276
16
    if (PyObject_SetAttr(state->Assign_type, state->type_comment, Py_None) ==
6277
16
        -1)
6278
0
        return -1;
6279
16
    state->TypeAlias_type = make_type(state, "TypeAlias", state->stmt_type,
6280
16
                                      TypeAlias_fields, 3,
6281
16
        "TypeAlias(expr name, type_param* type_params, expr value)");
6282
16
    if (!state->TypeAlias_type) return -1;
6283
16
    state->AugAssign_type = make_type(state, "AugAssign", state->stmt_type,
6284
16
                                      AugAssign_fields, 3,
6285
16
        "AugAssign(expr target, operator op, expr value)");
6286
16
    if (!state->AugAssign_type) return -1;
6287
16
    state->AnnAssign_type = make_type(state, "AnnAssign", state->stmt_type,
6288
16
                                      AnnAssign_fields, 4,
6289
16
        "AnnAssign(expr target, expr annotation, expr? value, int simple)");
6290
16
    if (!state->AnnAssign_type) return -1;
6291
16
    if (PyObject_SetAttr(state->AnnAssign_type, state->value, Py_None) == -1)
6292
0
        return -1;
6293
16
    state->For_type = make_type(state, "For", state->stmt_type, For_fields, 5,
6294
16
        "For(expr target, expr iter, stmt* body, stmt* orelse, string? type_comment)");
6295
16
    if (!state->For_type) return -1;
6296
16
    if (PyObject_SetAttr(state->For_type, state->type_comment, Py_None) == -1)
6297
0
        return -1;
6298
16
    state->AsyncFor_type = make_type(state, "AsyncFor", state->stmt_type,
6299
16
                                     AsyncFor_fields, 5,
6300
16
        "AsyncFor(expr target, expr iter, stmt* body, stmt* orelse, string? type_comment)");
6301
16
    if (!state->AsyncFor_type) return -1;
6302
16
    if (PyObject_SetAttr(state->AsyncFor_type, state->type_comment, Py_None) ==
6303
16
        -1)
6304
0
        return -1;
6305
16
    state->While_type = make_type(state, "While", state->stmt_type,
6306
16
                                  While_fields, 3,
6307
16
        "While(expr test, stmt* body, stmt* orelse)");
6308
16
    if (!state->While_type) return -1;
6309
16
    state->If_type = make_type(state, "If", state->stmt_type, If_fields, 3,
6310
16
        "If(expr test, stmt* body, stmt* orelse)");
6311
16
    if (!state->If_type) return -1;
6312
16
    state->With_type = make_type(state, "With", state->stmt_type, With_fields,
6313
16
                                 3,
6314
16
        "With(withitem* items, stmt* body, string? type_comment)");
6315
16
    if (!state->With_type) return -1;
6316
16
    if (PyObject_SetAttr(state->With_type, state->type_comment, Py_None) == -1)
6317
0
        return -1;
6318
16
    state->AsyncWith_type = make_type(state, "AsyncWith", state->stmt_type,
6319
16
                                      AsyncWith_fields, 3,
6320
16
        "AsyncWith(withitem* items, stmt* body, string? type_comment)");
6321
16
    if (!state->AsyncWith_type) return -1;
6322
16
    if (PyObject_SetAttr(state->AsyncWith_type, state->type_comment, Py_None)
6323
16
        == -1)
6324
0
        return -1;
6325
16
    state->Match_type = make_type(state, "Match", state->stmt_type,
6326
16
                                  Match_fields, 2,
6327
16
        "Match(expr subject, match_case* cases)");
6328
16
    if (!state->Match_type) return -1;
6329
16
    state->Raise_type = make_type(state, "Raise", state->stmt_type,
6330
16
                                  Raise_fields, 2,
6331
16
        "Raise(expr? exc, expr? cause)");
6332
16
    if (!state->Raise_type) return -1;
6333
16
    if (PyObject_SetAttr(state->Raise_type, state->exc, Py_None) == -1)
6334
0
        return -1;
6335
16
    if (PyObject_SetAttr(state->Raise_type, state->cause, Py_None) == -1)
6336
0
        return -1;
6337
16
    state->Try_type = make_type(state, "Try", state->stmt_type, Try_fields, 4,
6338
16
        "Try(stmt* body, excepthandler* handlers, stmt* orelse, stmt* finalbody)");
6339
16
    if (!state->Try_type) return -1;
6340
16
    state->TryStar_type = make_type(state, "TryStar", state->stmt_type,
6341
16
                                    TryStar_fields, 4,
6342
16
        "TryStar(stmt* body, excepthandler* handlers, stmt* orelse, stmt* finalbody)");
6343
16
    if (!state->TryStar_type) return -1;
6344
16
    state->Assert_type = make_type(state, "Assert", state->stmt_type,
6345
16
                                   Assert_fields, 2,
6346
16
        "Assert(expr test, expr? msg)");
6347
16
    if (!state->Assert_type) return -1;
6348
16
    if (PyObject_SetAttr(state->Assert_type, state->msg, Py_None) == -1)
6349
0
        return -1;
6350
16
    state->Import_type = make_type(state, "Import", state->stmt_type,
6351
16
                                   Import_fields, 1,
6352
16
        "Import(alias* names)");
6353
16
    if (!state->Import_type) return -1;
6354
16
    state->ImportFrom_type = make_type(state, "ImportFrom", state->stmt_type,
6355
16
                                       ImportFrom_fields, 3,
6356
16
        "ImportFrom(identifier? module, alias* names, int? level)");
6357
16
    if (!state->ImportFrom_type) return -1;
6358
16
    if (PyObject_SetAttr(state->ImportFrom_type, state->module, Py_None) == -1)
6359
0
        return -1;
6360
16
    if (PyObject_SetAttr(state->ImportFrom_type, state->level, Py_None) == -1)
6361
0
        return -1;
6362
16
    state->Global_type = make_type(state, "Global", state->stmt_type,
6363
16
                                   Global_fields, 1,
6364
16
        "Global(identifier* names)");
6365
16
    if (!state->Global_type) return -1;
6366
16
    state->Nonlocal_type = make_type(state, "Nonlocal", state->stmt_type,
6367
16
                                     Nonlocal_fields, 1,
6368
16
        "Nonlocal(identifier* names)");
6369
16
    if (!state->Nonlocal_type) return -1;
6370
16
    state->Expr_type = make_type(state, "Expr", state->stmt_type, Expr_fields,
6371
16
                                 1,
6372
16
        "Expr(expr value)");
6373
16
    if (!state->Expr_type) return -1;
6374
16
    state->Pass_type = make_type(state, "Pass", state->stmt_type, NULL, 0,
6375
16
        "Pass");
6376
16
    if (!state->Pass_type) return -1;
6377
16
    state->Break_type = make_type(state, "Break", state->stmt_type, NULL, 0,
6378
16
        "Break");
6379
16
    if (!state->Break_type) return -1;
6380
16
    state->Continue_type = make_type(state, "Continue", state->stmt_type, NULL,
6381
16
                                     0,
6382
16
        "Continue");
6383
16
    if (!state->Continue_type) return -1;
6384
16
    state->expr_type = make_type(state, "expr", state->AST_type, NULL, 0,
6385
16
        "expr = BoolOp(boolop op, expr* values)\n"
6386
16
        "     | NamedExpr(expr target, expr value)\n"
6387
16
        "     | BinOp(expr left, operator op, expr right)\n"
6388
16
        "     | UnaryOp(unaryop op, expr operand)\n"
6389
16
        "     | Lambda(arguments args, expr body)\n"
6390
16
        "     | IfExp(expr test, expr body, expr orelse)\n"
6391
16
        "     | Dict(expr?* keys, expr* values)\n"
6392
16
        "     | Set(expr* elts)\n"
6393
16
        "     | ListComp(expr elt, comprehension* generators)\n"
6394
16
        "     | SetComp(expr elt, comprehension* generators)\n"
6395
16
        "     | DictComp(expr key, expr value, comprehension* generators)\n"
6396
16
        "     | GeneratorExp(expr elt, comprehension* generators)\n"
6397
16
        "     | Await(expr value)\n"
6398
16
        "     | Yield(expr? value)\n"
6399
16
        "     | YieldFrom(expr value)\n"
6400
16
        "     | Compare(expr left, cmpop* ops, expr* comparators)\n"
6401
16
        "     | Call(expr func, expr* args, keyword* keywords)\n"
6402
16
        "     | FormattedValue(expr value, int conversion, expr? format_spec)\n"
6403
16
        "     | Interpolation(expr value, constant str, int conversion, expr? format_spec)\n"
6404
16
        "     | JoinedStr(expr* values)\n"
6405
16
        "     | TemplateStr(expr* values)\n"
6406
16
        "     | Constant(constant value, string? kind)\n"
6407
16
        "     | Attribute(expr value, identifier attr, expr_context ctx)\n"
6408
16
        "     | Subscript(expr value, expr slice, expr_context ctx)\n"
6409
16
        "     | Starred(expr value, expr_context ctx)\n"
6410
16
        "     | Name(identifier id, expr_context ctx)\n"
6411
16
        "     | List(expr* elts, expr_context ctx)\n"
6412
16
        "     | Tuple(expr* elts, expr_context ctx)\n"
6413
16
        "     | Slice(expr? lower, expr? upper, expr? step)");
6414
16
    if (!state->expr_type) return -1;
6415
16
    if (add_attributes(state, state->expr_type, expr_attributes, 4) < 0) return
6416
0
        -1;
6417
16
    if (PyObject_SetAttr(state->expr_type, state->end_lineno, Py_None) == -1)
6418
0
        return -1;
6419
16
    if (PyObject_SetAttr(state->expr_type, state->end_col_offset, Py_None) ==
6420
16
        -1)
6421
0
        return -1;
6422
16
    state->BoolOp_type = make_type(state, "BoolOp", state->expr_type,
6423
16
                                   BoolOp_fields, 2,
6424
16
        "BoolOp(boolop op, expr* values)");
6425
16
    if (!state->BoolOp_type) return -1;
6426
16
    state->NamedExpr_type = make_type(state, "NamedExpr", state->expr_type,
6427
16
                                      NamedExpr_fields, 2,
6428
16
        "NamedExpr(expr target, expr value)");
6429
16
    if (!state->NamedExpr_type) return -1;
6430
16
    state->BinOp_type = make_type(state, "BinOp", state->expr_type,
6431
16
                                  BinOp_fields, 3,
6432
16
        "BinOp(expr left, operator op, expr right)");
6433
16
    if (!state->BinOp_type) return -1;
6434
16
    state->UnaryOp_type = make_type(state, "UnaryOp", state->expr_type,
6435
16
                                    UnaryOp_fields, 2,
6436
16
        "UnaryOp(unaryop op, expr operand)");
6437
16
    if (!state->UnaryOp_type) return -1;
6438
16
    state->Lambda_type = make_type(state, "Lambda", state->expr_type,
6439
16
                                   Lambda_fields, 2,
6440
16
        "Lambda(arguments args, expr body)");
6441
16
    if (!state->Lambda_type) return -1;
6442
16
    state->IfExp_type = make_type(state, "IfExp", state->expr_type,
6443
16
                                  IfExp_fields, 3,
6444
16
        "IfExp(expr test, expr body, expr orelse)");
6445
16
    if (!state->IfExp_type) return -1;
6446
16
    state->Dict_type = make_type(state, "Dict", state->expr_type, Dict_fields,
6447
16
                                 2,
6448
16
        "Dict(expr?* keys, expr* values)");
6449
16
    if (!state->Dict_type) return -1;
6450
16
    state->Set_type = make_type(state, "Set", state->expr_type, Set_fields, 1,
6451
16
        "Set(expr* elts)");
6452
16
    if (!state->Set_type) return -1;
6453
16
    state->ListComp_type = make_type(state, "ListComp", state->expr_type,
6454
16
                                     ListComp_fields, 2,
6455
16
        "ListComp(expr elt, comprehension* generators)");
6456
16
    if (!state->ListComp_type) return -1;
6457
16
    state->SetComp_type = make_type(state, "SetComp", state->expr_type,
6458
16
                                    SetComp_fields, 2,
6459
16
        "SetComp(expr elt, comprehension* generators)");
6460
16
    if (!state->SetComp_type) return -1;
6461
16
    state->DictComp_type = make_type(state, "DictComp", state->expr_type,
6462
16
                                     DictComp_fields, 3,
6463
16
        "DictComp(expr key, expr value, comprehension* generators)");
6464
16
    if (!state->DictComp_type) return -1;
6465
16
    state->GeneratorExp_type = make_type(state, "GeneratorExp",
6466
16
                                         state->expr_type, GeneratorExp_fields,
6467
16
                                         2,
6468
16
        "GeneratorExp(expr elt, comprehension* generators)");
6469
16
    if (!state->GeneratorExp_type) return -1;
6470
16
    state->Await_type = make_type(state, "Await", state->expr_type,
6471
16
                                  Await_fields, 1,
6472
16
        "Await(expr value)");
6473
16
    if (!state->Await_type) return -1;
6474
16
    state->Yield_type = make_type(state, "Yield", state->expr_type,
6475
16
                                  Yield_fields, 1,
6476
16
        "Yield(expr? value)");
6477
16
    if (!state->Yield_type) return -1;
6478
16
    if (PyObject_SetAttr(state->Yield_type, state->value, Py_None) == -1)
6479
0
        return -1;
6480
16
    state->YieldFrom_type = make_type(state, "YieldFrom", state->expr_type,
6481
16
                                      YieldFrom_fields, 1,
6482
16
        "YieldFrom(expr value)");
6483
16
    if (!state->YieldFrom_type) return -1;
6484
16
    state->Compare_type = make_type(state, "Compare", state->expr_type,
6485
16
                                    Compare_fields, 3,
6486
16
        "Compare(expr left, cmpop* ops, expr* comparators)");
6487
16
    if (!state->Compare_type) return -1;
6488
16
    state->Call_type = make_type(state, "Call", state->expr_type, Call_fields,
6489
16
                                 3,
6490
16
        "Call(expr func, expr* args, keyword* keywords)");
6491
16
    if (!state->Call_type) return -1;
6492
16
    state->FormattedValue_type = make_type(state, "FormattedValue",
6493
16
                                           state->expr_type,
6494
16
                                           FormattedValue_fields, 3,
6495
16
        "FormattedValue(expr value, int conversion, expr? format_spec)");
6496
16
    if (!state->FormattedValue_type) return -1;
6497
16
    if (PyObject_SetAttr(state->FormattedValue_type, state->format_spec,
6498
16
        Py_None) == -1)
6499
0
        return -1;
6500
16
    state->Interpolation_type = make_type(state, "Interpolation",
6501
16
                                          state->expr_type,
6502
16
                                          Interpolation_fields, 4,
6503
16
        "Interpolation(expr value, constant str, int conversion, expr? format_spec)");
6504
16
    if (!state->Interpolation_type) return -1;
6505
16
    if (PyObject_SetAttr(state->Interpolation_type, state->format_spec,
6506
16
        Py_None) == -1)
6507
0
        return -1;
6508
16
    state->JoinedStr_type = make_type(state, "JoinedStr", state->expr_type,
6509
16
                                      JoinedStr_fields, 1,
6510
16
        "JoinedStr(expr* values)");
6511
16
    if (!state->JoinedStr_type) return -1;
6512
16
    state->TemplateStr_type = make_type(state, "TemplateStr", state->expr_type,
6513
16
                                        TemplateStr_fields, 1,
6514
16
        "TemplateStr(expr* values)");
6515
16
    if (!state->TemplateStr_type) return -1;
6516
16
    state->Constant_type = make_type(state, "Constant", state->expr_type,
6517
16
                                     Constant_fields, 2,
6518
16
        "Constant(constant value, string? kind)");
6519
16
    if (!state->Constant_type) return -1;
6520
16
    if (PyObject_SetAttr(state->Constant_type, state->kind, Py_None) == -1)
6521
0
        return -1;
6522
16
    state->Attribute_type = make_type(state, "Attribute", state->expr_type,
6523
16
                                      Attribute_fields, 3,
6524
16
        "Attribute(expr value, identifier attr, expr_context ctx)");
6525
16
    if (!state->Attribute_type) return -1;
6526
16
    state->Subscript_type = make_type(state, "Subscript", state->expr_type,
6527
16
                                      Subscript_fields, 3,
6528
16
        "Subscript(expr value, expr slice, expr_context ctx)");
6529
16
    if (!state->Subscript_type) return -1;
6530
16
    state->Starred_type = make_type(state, "Starred", state->expr_type,
6531
16
                                    Starred_fields, 2,
6532
16
        "Starred(expr value, expr_context ctx)");
6533
16
    if (!state->Starred_type) return -1;
6534
16
    state->Name_type = make_type(state, "Name", state->expr_type, Name_fields,
6535
16
                                 2,
6536
16
        "Name(identifier id, expr_context ctx)");
6537
16
    if (!state->Name_type) return -1;
6538
16
    state->List_type = make_type(state, "List", state->expr_type, List_fields,
6539
16
                                 2,
6540
16
        "List(expr* elts, expr_context ctx)");
6541
16
    if (!state->List_type) return -1;
6542
16
    state->Tuple_type = make_type(state, "Tuple", state->expr_type,
6543
16
                                  Tuple_fields, 2,
6544
16
        "Tuple(expr* elts, expr_context ctx)");
6545
16
    if (!state->Tuple_type) return -1;
6546
16
    state->Slice_type = make_type(state, "Slice", state->expr_type,
6547
16
                                  Slice_fields, 3,
6548
16
        "Slice(expr? lower, expr? upper, expr? step)");
6549
16
    if (!state->Slice_type) return -1;
6550
16
    if (PyObject_SetAttr(state->Slice_type, state->lower, Py_None) == -1)
6551
0
        return -1;
6552
16
    if (PyObject_SetAttr(state->Slice_type, state->upper, Py_None) == -1)
6553
0
        return -1;
6554
16
    if (PyObject_SetAttr(state->Slice_type, state->step, Py_None) == -1)
6555
0
        return -1;
6556
16
    state->expr_context_type = make_type(state, "expr_context",
6557
16
                                         state->AST_type, NULL, 0,
6558
16
        "expr_context = Load | Store | Del");
6559
16
    if (!state->expr_context_type) return -1;
6560
16
    if (add_attributes(state, state->expr_context_type, NULL, 0) < 0) return -1;
6561
16
    state->Load_type = make_type(state, "Load", state->expr_context_type, NULL,
6562
16
                                 0,
6563
16
        "Load");
6564
16
    if (!state->Load_type) return -1;
6565
16
    state->Load_singleton = PyType_GenericNew((PyTypeObject *)state->Load_type,
6566
16
                                              NULL, NULL);
6567
16
    if (!state->Load_singleton) return -1;
6568
16
    state->Store_type = make_type(state, "Store", state->expr_context_type,
6569
16
                                  NULL, 0,
6570
16
        "Store");
6571
16
    if (!state->Store_type) return -1;
6572
16
    state->Store_singleton = PyType_GenericNew((PyTypeObject
6573
16
                                               *)state->Store_type, NULL, NULL);
6574
16
    if (!state->Store_singleton) return -1;
6575
16
    state->Del_type = make_type(state, "Del", state->expr_context_type, NULL, 0,
6576
16
        "Del");
6577
16
    if (!state->Del_type) return -1;
6578
16
    state->Del_singleton = PyType_GenericNew((PyTypeObject *)state->Del_type,
6579
16
                                             NULL, NULL);
6580
16
    if (!state->Del_singleton) return -1;
6581
16
    state->boolop_type = make_type(state, "boolop", state->AST_type, NULL, 0,
6582
16
        "boolop = And | Or");
6583
16
    if (!state->boolop_type) return -1;
6584
16
    if (add_attributes(state, state->boolop_type, NULL, 0) < 0) return -1;
6585
16
    state->And_type = make_type(state, "And", state->boolop_type, NULL, 0,
6586
16
        "And");
6587
16
    if (!state->And_type) return -1;
6588
16
    state->And_singleton = PyType_GenericNew((PyTypeObject *)state->And_type,
6589
16
                                             NULL, NULL);
6590
16
    if (!state->And_singleton) return -1;
6591
16
    state->Or_type = make_type(state, "Or", state->boolop_type, NULL, 0,
6592
16
        "Or");
6593
16
    if (!state->Or_type) return -1;
6594
16
    state->Or_singleton = PyType_GenericNew((PyTypeObject *)state->Or_type,
6595
16
                                            NULL, NULL);
6596
16
    if (!state->Or_singleton) return -1;
6597
16
    state->operator_type = make_type(state, "operator", state->AST_type, NULL,
6598
16
                                     0,
6599
16
        "operator = Add | Sub | Mult | MatMult | Div | Mod | Pow | LShift | RShift | BitOr | BitXor | BitAnd | FloorDiv");
6600
16
    if (!state->operator_type) return -1;
6601
16
    if (add_attributes(state, state->operator_type, NULL, 0) < 0) return -1;
6602
16
    state->Add_type = make_type(state, "Add", state->operator_type, NULL, 0,
6603
16
        "Add");
6604
16
    if (!state->Add_type) return -1;
6605
16
    state->Add_singleton = PyType_GenericNew((PyTypeObject *)state->Add_type,
6606
16
                                             NULL, NULL);
6607
16
    if (!state->Add_singleton) return -1;
6608
16
    state->Sub_type = make_type(state, "Sub", state->operator_type, NULL, 0,
6609
16
        "Sub");
6610
16
    if (!state->Sub_type) return -1;
6611
16
    state->Sub_singleton = PyType_GenericNew((PyTypeObject *)state->Sub_type,
6612
16
                                             NULL, NULL);
6613
16
    if (!state->Sub_singleton) return -1;
6614
16
    state->Mult_type = make_type(state, "Mult", state->operator_type, NULL, 0,
6615
16
        "Mult");
6616
16
    if (!state->Mult_type) return -1;
6617
16
    state->Mult_singleton = PyType_GenericNew((PyTypeObject *)state->Mult_type,
6618
16
                                              NULL, NULL);
6619
16
    if (!state->Mult_singleton) return -1;
6620
16
    state->MatMult_type = make_type(state, "MatMult", state->operator_type,
6621
16
                                    NULL, 0,
6622
16
        "MatMult");
6623
16
    if (!state->MatMult_type) return -1;
6624
16
    state->MatMult_singleton = PyType_GenericNew((PyTypeObject
6625
16
                                                 *)state->MatMult_type, NULL,
6626
16
                                                 NULL);
6627
16
    if (!state->MatMult_singleton) return -1;
6628
16
    state->Div_type = make_type(state, "Div", state->operator_type, NULL, 0,
6629
16
        "Div");
6630
16
    if (!state->Div_type) return -1;
6631
16
    state->Div_singleton = PyType_GenericNew((PyTypeObject *)state->Div_type,
6632
16
                                             NULL, NULL);
6633
16
    if (!state->Div_singleton) return -1;
6634
16
    state->Mod_type = make_type(state, "Mod", state->operator_type, NULL, 0,
6635
16
        "Mod");
6636
16
    if (!state->Mod_type) return -1;
6637
16
    state->Mod_singleton = PyType_GenericNew((PyTypeObject *)state->Mod_type,
6638
16
                                             NULL, NULL);
6639
16
    if (!state->Mod_singleton) return -1;
6640
16
    state->Pow_type = make_type(state, "Pow", state->operator_type, NULL, 0,
6641
16
        "Pow");
6642
16
    if (!state->Pow_type) return -1;
6643
16
    state->Pow_singleton = PyType_GenericNew((PyTypeObject *)state->Pow_type,
6644
16
                                             NULL, NULL);
6645
16
    if (!state->Pow_singleton) return -1;
6646
16
    state->LShift_type = make_type(state, "LShift", state->operator_type, NULL,
6647
16
                                   0,
6648
16
        "LShift");
6649
16
    if (!state->LShift_type) return -1;
6650
16
    state->LShift_singleton = PyType_GenericNew((PyTypeObject
6651
16
                                                *)state->LShift_type, NULL,
6652
16
                                                NULL);
6653
16
    if (!state->LShift_singleton) return -1;
6654
16
    state->RShift_type = make_type(state, "RShift", state->operator_type, NULL,
6655
16
                                   0,
6656
16
        "RShift");
6657
16
    if (!state->RShift_type) return -1;
6658
16
    state->RShift_singleton = PyType_GenericNew((PyTypeObject
6659
16
                                                *)state->RShift_type, NULL,
6660
16
                                                NULL);
6661
16
    if (!state->RShift_singleton) return -1;
6662
16
    state->BitOr_type = make_type(state, "BitOr", state->operator_type, NULL, 0,
6663
16
        "BitOr");
6664
16
    if (!state->BitOr_type) return -1;
6665
16
    state->BitOr_singleton = PyType_GenericNew((PyTypeObject
6666
16
                                               *)state->BitOr_type, NULL, NULL);
6667
16
    if (!state->BitOr_singleton) return -1;
6668
16
    state->BitXor_type = make_type(state, "BitXor", state->operator_type, NULL,
6669
16
                                   0,
6670
16
        "BitXor");
6671
16
    if (!state->BitXor_type) return -1;
6672
16
    state->BitXor_singleton = PyType_GenericNew((PyTypeObject
6673
16
                                                *)state->BitXor_type, NULL,
6674
16
                                                NULL);
6675
16
    if (!state->BitXor_singleton) return -1;
6676
16
    state->BitAnd_type = make_type(state, "BitAnd", state->operator_type, NULL,
6677
16
                                   0,
6678
16
        "BitAnd");
6679
16
    if (!state->BitAnd_type) return -1;
6680
16
    state->BitAnd_singleton = PyType_GenericNew((PyTypeObject
6681
16
                                                *)state->BitAnd_type, NULL,
6682
16
                                                NULL);
6683
16
    if (!state->BitAnd_singleton) return -1;
6684
16
    state->FloorDiv_type = make_type(state, "FloorDiv", state->operator_type,
6685
16
                                     NULL, 0,
6686
16
        "FloorDiv");
6687
16
    if (!state->FloorDiv_type) return -1;
6688
16
    state->FloorDiv_singleton = PyType_GenericNew((PyTypeObject
6689
16
                                                  *)state->FloorDiv_type, NULL,
6690
16
                                                  NULL);
6691
16
    if (!state->FloorDiv_singleton) return -1;
6692
16
    state->unaryop_type = make_type(state, "unaryop", state->AST_type, NULL, 0,
6693
16
        "unaryop = Invert | Not | UAdd | USub");
6694
16
    if (!state->unaryop_type) return -1;
6695
16
    if (add_attributes(state, state->unaryop_type, NULL, 0) < 0) return -1;
6696
16
    state->Invert_type = make_type(state, "Invert", state->unaryop_type, NULL,
6697
16
                                   0,
6698
16
        "Invert");
6699
16
    if (!state->Invert_type) return -1;
6700
16
    state->Invert_singleton = PyType_GenericNew((PyTypeObject
6701
16
                                                *)state->Invert_type, NULL,
6702
16
                                                NULL);
6703
16
    if (!state->Invert_singleton) return -1;
6704
16
    state->Not_type = make_type(state, "Not", state->unaryop_type, NULL, 0,
6705
16
        "Not");
6706
16
    if (!state->Not_type) return -1;
6707
16
    state->Not_singleton = PyType_GenericNew((PyTypeObject *)state->Not_type,
6708
16
                                             NULL, NULL);
6709
16
    if (!state->Not_singleton) return -1;
6710
16
    state->UAdd_type = make_type(state, "UAdd", state->unaryop_type, NULL, 0,
6711
16
        "UAdd");
6712
16
    if (!state->UAdd_type) return -1;
6713
16
    state->UAdd_singleton = PyType_GenericNew((PyTypeObject *)state->UAdd_type,
6714
16
                                              NULL, NULL);
6715
16
    if (!state->UAdd_singleton) return -1;
6716
16
    state->USub_type = make_type(state, "USub", state->unaryop_type, NULL, 0,
6717
16
        "USub");
6718
16
    if (!state->USub_type) return -1;
6719
16
    state->USub_singleton = PyType_GenericNew((PyTypeObject *)state->USub_type,
6720
16
                                              NULL, NULL);
6721
16
    if (!state->USub_singleton) return -1;
6722
16
    state->cmpop_type = make_type(state, "cmpop", state->AST_type, NULL, 0,
6723
16
        "cmpop = Eq | NotEq | Lt | LtE | Gt | GtE | Is | IsNot | In | NotIn");
6724
16
    if (!state->cmpop_type) return -1;
6725
16
    if (add_attributes(state, state->cmpop_type, NULL, 0) < 0) return -1;
6726
16
    state->Eq_type = make_type(state, "Eq", state->cmpop_type, NULL, 0,
6727
16
        "Eq");
6728
16
    if (!state->Eq_type) return -1;
6729
16
    state->Eq_singleton = PyType_GenericNew((PyTypeObject *)state->Eq_type,
6730
16
                                            NULL, NULL);
6731
16
    if (!state->Eq_singleton) return -1;
6732
16
    state->NotEq_type = make_type(state, "NotEq", state->cmpop_type, NULL, 0,
6733
16
        "NotEq");
6734
16
    if (!state->NotEq_type) return -1;
6735
16
    state->NotEq_singleton = PyType_GenericNew((PyTypeObject
6736
16
                                               *)state->NotEq_type, NULL, NULL);
6737
16
    if (!state->NotEq_singleton) return -1;
6738
16
    state->Lt_type = make_type(state, "Lt", state->cmpop_type, NULL, 0,
6739
16
        "Lt");
6740
16
    if (!state->Lt_type) return -1;
6741
16
    state->Lt_singleton = PyType_GenericNew((PyTypeObject *)state->Lt_type,
6742
16
                                            NULL, NULL);
6743
16
    if (!state->Lt_singleton) return -1;
6744
16
    state->LtE_type = make_type(state, "LtE", state->cmpop_type, NULL, 0,
6745
16
        "LtE");
6746
16
    if (!state->LtE_type) return -1;
6747
16
    state->LtE_singleton = PyType_GenericNew((PyTypeObject *)state->LtE_type,
6748
16
                                             NULL, NULL);
6749
16
    if (!state->LtE_singleton) return -1;
6750
16
    state->Gt_type = make_type(state, "Gt", state->cmpop_type, NULL, 0,
6751
16
        "Gt");
6752
16
    if (!state->Gt_type) return -1;
6753
16
    state->Gt_singleton = PyType_GenericNew((PyTypeObject *)state->Gt_type,
6754
16
                                            NULL, NULL);
6755
16
    if (!state->Gt_singleton) return -1;
6756
16
    state->GtE_type = make_type(state, "GtE", state->cmpop_type, NULL, 0,
6757
16
        "GtE");
6758
16
    if (!state->GtE_type) return -1;
6759
16
    state->GtE_singleton = PyType_GenericNew((PyTypeObject *)state->GtE_type,
6760
16
                                             NULL, NULL);
6761
16
    if (!state->GtE_singleton) return -1;
6762
16
    state->Is_type = make_type(state, "Is", state->cmpop_type, NULL, 0,
6763
16
        "Is");
6764
16
    if (!state->Is_type) return -1;
6765
16
    state->Is_singleton = PyType_GenericNew((PyTypeObject *)state->Is_type,
6766
16
                                            NULL, NULL);
6767
16
    if (!state->Is_singleton) return -1;
6768
16
    state->IsNot_type = make_type(state, "IsNot", state->cmpop_type, NULL, 0,
6769
16
        "IsNot");
6770
16
    if (!state->IsNot_type) return -1;
6771
16
    state->IsNot_singleton = PyType_GenericNew((PyTypeObject
6772
16
                                               *)state->IsNot_type, NULL, NULL);
6773
16
    if (!state->IsNot_singleton) return -1;
6774
16
    state->In_type = make_type(state, "In", state->cmpop_type, NULL, 0,
6775
16
        "In");
6776
16
    if (!state->In_type) return -1;
6777
16
    state->In_singleton = PyType_GenericNew((PyTypeObject *)state->In_type,
6778
16
                                            NULL, NULL);
6779
16
    if (!state->In_singleton) return -1;
6780
16
    state->NotIn_type = make_type(state, "NotIn", state->cmpop_type, NULL, 0,
6781
16
        "NotIn");
6782
16
    if (!state->NotIn_type) return -1;
6783
16
    state->NotIn_singleton = PyType_GenericNew((PyTypeObject
6784
16
                                               *)state->NotIn_type, NULL, NULL);
6785
16
    if (!state->NotIn_singleton) return -1;
6786
16
    state->comprehension_type = make_type(state, "comprehension",
6787
16
                                          state->AST_type,
6788
16
                                          comprehension_fields, 4,
6789
16
        "comprehension(expr target, expr iter, expr* ifs, int is_async)");
6790
16
    if (!state->comprehension_type) return -1;
6791
16
    if (add_attributes(state, state->comprehension_type, NULL, 0) < 0) return
6792
0
        -1;
6793
16
    state->excepthandler_type = make_type(state, "excepthandler",
6794
16
                                          state->AST_type, NULL, 0,
6795
16
        "excepthandler = ExceptHandler(expr? type, identifier? name, stmt* body)");
6796
16
    if (!state->excepthandler_type) return -1;
6797
16
    if (add_attributes(state, state->excepthandler_type,
6798
16
        excepthandler_attributes, 4) < 0) return -1;
6799
16
    if (PyObject_SetAttr(state->excepthandler_type, state->end_lineno, Py_None)
6800
16
        == -1)
6801
0
        return -1;
6802
16
    if (PyObject_SetAttr(state->excepthandler_type, state->end_col_offset,
6803
16
        Py_None) == -1)
6804
0
        return -1;
6805
16
    state->ExceptHandler_type = make_type(state, "ExceptHandler",
6806
16
                                          state->excepthandler_type,
6807
16
                                          ExceptHandler_fields, 3,
6808
16
        "ExceptHandler(expr? type, identifier? name, stmt* body)");
6809
16
    if (!state->ExceptHandler_type) return -1;
6810
16
    if (PyObject_SetAttr(state->ExceptHandler_type, state->type, Py_None) == -1)
6811
0
        return -1;
6812
16
    if (PyObject_SetAttr(state->ExceptHandler_type, state->name, Py_None) == -1)
6813
0
        return -1;
6814
16
    state->arguments_type = make_type(state, "arguments", state->AST_type,
6815
16
                                      arguments_fields, 7,
6816
16
        "arguments(arg* posonlyargs, arg* args, arg? vararg, arg* kwonlyargs, expr* kw_defaults, arg? kwarg, expr* defaults)");
6817
16
    if (!state->arguments_type) return -1;
6818
16
    if (add_attributes(state, state->arguments_type, NULL, 0) < 0) return -1;
6819
16
    if (PyObject_SetAttr(state->arguments_type, state->vararg, Py_None) == -1)
6820
0
        return -1;
6821
16
    if (PyObject_SetAttr(state->arguments_type, state->kwarg, Py_None) == -1)
6822
0
        return -1;
6823
16
    state->arg_type = make_type(state, "arg", state->AST_type, arg_fields, 3,
6824
16
        "arg(identifier arg, expr? annotation, string? type_comment)");
6825
16
    if (!state->arg_type) return -1;
6826
16
    if (add_attributes(state, state->arg_type, arg_attributes, 4) < 0) return
6827
0
        -1;
6828
16
    if (PyObject_SetAttr(state->arg_type, state->annotation, Py_None) == -1)
6829
0
        return -1;
6830
16
    if (PyObject_SetAttr(state->arg_type, state->type_comment, Py_None) == -1)
6831
0
        return -1;
6832
16
    if (PyObject_SetAttr(state->arg_type, state->end_lineno, Py_None) == -1)
6833
0
        return -1;
6834
16
    if (PyObject_SetAttr(state->arg_type, state->end_col_offset, Py_None) == -1)
6835
0
        return -1;
6836
16
    state->keyword_type = make_type(state, "keyword", state->AST_type,
6837
16
                                    keyword_fields, 2,
6838
16
        "keyword(identifier? arg, expr value)");
6839
16
    if (!state->keyword_type) return -1;
6840
16
    if (add_attributes(state, state->keyword_type, keyword_attributes, 4) < 0)
6841
0
        return -1;
6842
16
    if (PyObject_SetAttr(state->keyword_type, state->arg, Py_None) == -1)
6843
0
        return -1;
6844
16
    if (PyObject_SetAttr(state->keyword_type, state->end_lineno, Py_None) == -1)
6845
0
        return -1;
6846
16
    if (PyObject_SetAttr(state->keyword_type, state->end_col_offset, Py_None)
6847
16
        == -1)
6848
0
        return -1;
6849
16
    state->alias_type = make_type(state, "alias", state->AST_type,
6850
16
                                  alias_fields, 2,
6851
16
        "alias(identifier name, identifier? asname)");
6852
16
    if (!state->alias_type) return -1;
6853
16
    if (add_attributes(state, state->alias_type, alias_attributes, 4) < 0)
6854
0
        return -1;
6855
16
    if (PyObject_SetAttr(state->alias_type, state->asname, Py_None) == -1)
6856
0
        return -1;
6857
16
    if (PyObject_SetAttr(state->alias_type, state->end_lineno, Py_None) == -1)
6858
0
        return -1;
6859
16
    if (PyObject_SetAttr(state->alias_type, state->end_col_offset, Py_None) ==
6860
16
        -1)
6861
0
        return -1;
6862
16
    state->withitem_type = make_type(state, "withitem", state->AST_type,
6863
16
                                     withitem_fields, 2,
6864
16
        "withitem(expr context_expr, expr? optional_vars)");
6865
16
    if (!state->withitem_type) return -1;
6866
16
    if (add_attributes(state, state->withitem_type, NULL, 0) < 0) return -1;
6867
16
    if (PyObject_SetAttr(state->withitem_type, state->optional_vars, Py_None)
6868
16
        == -1)
6869
0
        return -1;
6870
16
    state->match_case_type = make_type(state, "match_case", state->AST_type,
6871
16
                                       match_case_fields, 3,
6872
16
        "match_case(pattern pattern, expr? guard, stmt* body)");
6873
16
    if (!state->match_case_type) return -1;
6874
16
    if (add_attributes(state, state->match_case_type, NULL, 0) < 0) return -1;
6875
16
    if (PyObject_SetAttr(state->match_case_type, state->guard, Py_None) == -1)
6876
0
        return -1;
6877
16
    state->pattern_type = make_type(state, "pattern", state->AST_type, NULL, 0,
6878
16
        "pattern = MatchValue(expr value)\n"
6879
16
        "        | MatchSingleton(constant value)\n"
6880
16
        "        | MatchSequence(pattern* patterns)\n"
6881
16
        "        | MatchMapping(expr* keys, pattern* patterns, identifier? rest)\n"
6882
16
        "        | MatchClass(expr cls, pattern* patterns, identifier* kwd_attrs, pattern* kwd_patterns)\n"
6883
16
        "        | MatchStar(identifier? name)\n"
6884
16
        "        | MatchAs(pattern? pattern, identifier? name)\n"
6885
16
        "        | MatchOr(pattern* patterns)");
6886
16
    if (!state->pattern_type) return -1;
6887
16
    if (add_attributes(state, state->pattern_type, pattern_attributes, 4) < 0)
6888
0
        return -1;
6889
16
    state->MatchValue_type = make_type(state, "MatchValue",
6890
16
                                       state->pattern_type, MatchValue_fields,
6891
16
                                       1,
6892
16
        "MatchValue(expr value)");
6893
16
    if (!state->MatchValue_type) return -1;
6894
16
    state->MatchSingleton_type = make_type(state, "MatchSingleton",
6895
16
                                           state->pattern_type,
6896
16
                                           MatchSingleton_fields, 1,
6897
16
        "MatchSingleton(constant value)");
6898
16
    if (!state->MatchSingleton_type) return -1;
6899
16
    state->MatchSequence_type = make_type(state, "MatchSequence",
6900
16
                                          state->pattern_type,
6901
16
                                          MatchSequence_fields, 1,
6902
16
        "MatchSequence(pattern* patterns)");
6903
16
    if (!state->MatchSequence_type) return -1;
6904
16
    state->MatchMapping_type = make_type(state, "MatchMapping",
6905
16
                                         state->pattern_type,
6906
16
                                         MatchMapping_fields, 3,
6907
16
        "MatchMapping(expr* keys, pattern* patterns, identifier? rest)");
6908
16
    if (!state->MatchMapping_type) return -1;
6909
16
    if (PyObject_SetAttr(state->MatchMapping_type, state->rest, Py_None) == -1)
6910
0
        return -1;
6911
16
    state->MatchClass_type = make_type(state, "MatchClass",
6912
16
                                       state->pattern_type, MatchClass_fields,
6913
16
                                       4,
6914
16
        "MatchClass(expr cls, pattern* patterns, identifier* kwd_attrs, pattern* kwd_patterns)");
6915
16
    if (!state->MatchClass_type) return -1;
6916
16
    state->MatchStar_type = make_type(state, "MatchStar", state->pattern_type,
6917
16
                                      MatchStar_fields, 1,
6918
16
        "MatchStar(identifier? name)");
6919
16
    if (!state->MatchStar_type) return -1;
6920
16
    if (PyObject_SetAttr(state->MatchStar_type, state->name, Py_None) == -1)
6921
0
        return -1;
6922
16
    state->MatchAs_type = make_type(state, "MatchAs", state->pattern_type,
6923
16
                                    MatchAs_fields, 2,
6924
16
        "MatchAs(pattern? pattern, identifier? name)");
6925
16
    if (!state->MatchAs_type) return -1;
6926
16
    if (PyObject_SetAttr(state->MatchAs_type, state->pattern, Py_None) == -1)
6927
0
        return -1;
6928
16
    if (PyObject_SetAttr(state->MatchAs_type, state->name, Py_None) == -1)
6929
0
        return -1;
6930
16
    state->MatchOr_type = make_type(state, "MatchOr", state->pattern_type,
6931
16
                                    MatchOr_fields, 1,
6932
16
        "MatchOr(pattern* patterns)");
6933
16
    if (!state->MatchOr_type) return -1;
6934
16
    state->type_ignore_type = make_type(state, "type_ignore", state->AST_type,
6935
16
                                        NULL, 0,
6936
16
        "type_ignore = TypeIgnore(int lineno, string tag)");
6937
16
    if (!state->type_ignore_type) return -1;
6938
16
    if (add_attributes(state, state->type_ignore_type, NULL, 0) < 0) return -1;
6939
16
    state->TypeIgnore_type = make_type(state, "TypeIgnore",
6940
16
                                       state->type_ignore_type,
6941
16
                                       TypeIgnore_fields, 2,
6942
16
        "TypeIgnore(int lineno, string tag)");
6943
16
    if (!state->TypeIgnore_type) return -1;
6944
16
    state->type_param_type = make_type(state, "type_param", state->AST_type,
6945
16
                                       NULL, 0,
6946
16
        "type_param = TypeVar(identifier name, expr? bound, expr? default_value)\n"
6947
16
        "           | ParamSpec(identifier name, expr? default_value)\n"
6948
16
        "           | TypeVarTuple(identifier name, expr? default_value)");
6949
16
    if (!state->type_param_type) return -1;
6950
16
    if (add_attributes(state, state->type_param_type, type_param_attributes, 4)
6951
16
        < 0) return -1;
6952
16
    state->TypeVar_type = make_type(state, "TypeVar", state->type_param_type,
6953
16
                                    TypeVar_fields, 3,
6954
16
        "TypeVar(identifier name, expr? bound, expr? default_value)");
6955
16
    if (!state->TypeVar_type) return -1;
6956
16
    if (PyObject_SetAttr(state->TypeVar_type, state->bound, Py_None) == -1)
6957
0
        return -1;
6958
16
    if (PyObject_SetAttr(state->TypeVar_type, state->default_value, Py_None) ==
6959
16
        -1)
6960
0
        return -1;
6961
16
    state->ParamSpec_type = make_type(state, "ParamSpec",
6962
16
                                      state->type_param_type, ParamSpec_fields,
6963
16
                                      2,
6964
16
        "ParamSpec(identifier name, expr? default_value)");
6965
16
    if (!state->ParamSpec_type) return -1;
6966
16
    if (PyObject_SetAttr(state->ParamSpec_type, state->default_value, Py_None)
6967
16
        == -1)
6968
0
        return -1;
6969
16
    state->TypeVarTuple_type = make_type(state, "TypeVarTuple",
6970
16
                                         state->type_param_type,
6971
16
                                         TypeVarTuple_fields, 2,
6972
16
        "TypeVarTuple(identifier name, expr? default_value)");
6973
16
    if (!state->TypeVarTuple_type) return -1;
6974
16
    if (PyObject_SetAttr(state->TypeVarTuple_type, state->default_value,
6975
16
        Py_None) == -1)
6976
0
        return -1;
6977
6978
16
    if (!add_ast_annotations(state)) {
6979
0
        return -1;
6980
0
    }
6981
16
    return 0;
6982
16
}
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
6.57k
{
7027
6.57k
    mod_ty p;
7028
6.57k
    p = (mod_ty)_PyArena_Malloc(arena, sizeof(*p));
7029
6.57k
    if (!p)
7030
0
        return NULL;
7031
6.57k
    p->kind = Module_kind;
7032
6.57k
    p->v.Module.body = body;
7033
6.57k
    p->v.Module.type_ignores = type_ignores;
7034
6.57k
    return p;
7035
6.57k
}
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
75
{
7052
75
    mod_ty p;
7053
75
    if (!body) {
7054
0
        PyErr_SetString(PyExc_ValueError,
7055
0
                        "field 'body' is required for Expression");
7056
0
        return NULL;
7057
0
    }
7058
75
    p = (mod_ty)_PyArena_Malloc(arena, sizeof(*p));
7059
75
    if (!p)
7060
0
        return NULL;
7061
75
    p->kind = Expression_kind;
7062
75
    p->v.Expression.body = body;
7063
75
    return p;
7064
75
}
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
10.2k
{
7091
10.2k
    stmt_ty p;
7092
10.2k
    if (!name) {
7093
0
        PyErr_SetString(PyExc_ValueError,
7094
0
                        "field 'name' is required for FunctionDef");
7095
0
        return NULL;
7096
0
    }
7097
10.2k
    if (!args) {
7098
0
        PyErr_SetString(PyExc_ValueError,
7099
0
                        "field 'args' is required for FunctionDef");
7100
0
        return NULL;
7101
0
    }
7102
10.2k
    p = (stmt_ty)_PyArena_Malloc(arena, sizeof(*p));
7103
10.2k
    if (!p)
7104
0
        return NULL;
7105
10.2k
    p->kind = FunctionDef_kind;
7106
10.2k
    p->v.FunctionDef.name = name;
7107
10.2k
    p->v.FunctionDef.args = args;
7108
10.2k
    p->v.FunctionDef.body = body;
7109
10.2k
    p->v.FunctionDef.decorator_list = decorator_list;
7110
10.2k
    p->v.FunctionDef.returns = returns;
7111
10.2k
    p->v.FunctionDef.type_comment = type_comment;
7112
10.2k
    p->v.FunctionDef.type_params = type_params;
7113
10.2k
    p->lineno = lineno;
7114
10.2k
    p->col_offset = col_offset;
7115
10.2k
    p->end_lineno = end_lineno;
7116
10.2k
    p->end_col_offset = end_col_offset;
7117
10.2k
    return p;
7118
10.2k
}
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
604
{
7127
604
    stmt_ty p;
7128
604
    if (!name) {
7129
0
        PyErr_SetString(PyExc_ValueError,
7130
0
                        "field 'name' is required for AsyncFunctionDef");
7131
0
        return NULL;
7132
0
    }
7133
604
    if (!args) {
7134
0
        PyErr_SetString(PyExc_ValueError,
7135
0
                        "field 'args' is required for AsyncFunctionDef");
7136
0
        return NULL;
7137
0
    }
7138
604
    p = (stmt_ty)_PyArena_Malloc(arena, sizeof(*p));
7139
604
    if (!p)
7140
0
        return NULL;
7141
604
    p->kind = AsyncFunctionDef_kind;
7142
604
    p->v.AsyncFunctionDef.name = name;
7143
604
    p->v.AsyncFunctionDef.args = args;
7144
604
    p->v.AsyncFunctionDef.body = body;
7145
604
    p->v.AsyncFunctionDef.decorator_list = decorator_list;
7146
604
    p->v.AsyncFunctionDef.returns = returns;
7147
604
    p->v.AsyncFunctionDef.type_comment = type_comment;
7148
604
    p->v.AsyncFunctionDef.type_params = type_params;
7149
604
    p->lineno = lineno;
7150
604
    p->col_offset = col_offset;
7151
604
    p->end_lineno = end_lineno;
7152
604
    p->end_col_offset = end_col_offset;
7153
604
    return p;
7154
604
}
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
3.83k
{
7162
3.83k
    stmt_ty p;
7163
3.83k
    if (!name) {
7164
0
        PyErr_SetString(PyExc_ValueError,
7165
0
                        "field 'name' is required for ClassDef");
7166
0
        return NULL;
7167
0
    }
7168
3.83k
    p = (stmt_ty)_PyArena_Malloc(arena, sizeof(*p));
7169
3.83k
    if (!p)
7170
0
        return NULL;
7171
3.83k
    p->kind = ClassDef_kind;
7172
3.83k
    p->v.ClassDef.name = name;
7173
3.83k
    p->v.ClassDef.bases = bases;
7174
3.83k
    p->v.ClassDef.keywords = keywords;
7175
3.83k
    p->v.ClassDef.body = body;
7176
3.83k
    p->v.ClassDef.decorator_list = decorator_list;
7177
3.83k
    p->v.ClassDef.type_params = type_params;
7178
3.83k
    p->lineno = lineno;
7179
3.83k
    p->col_offset = col_offset;
7180
3.83k
    p->end_lineno = end_lineno;
7181
3.83k
    p->end_col_offset = end_col_offset;
7182
3.83k
    return p;
7183
3.83k
}
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
6.95k
{
7189
6.95k
    stmt_ty p;
7190
6.95k
    p = (stmt_ty)_PyArena_Malloc(arena, sizeof(*p));
7191
6.95k
    if (!p)
7192
0
        return NULL;
7193
6.95k
    p->kind = Return_kind;
7194
6.95k
    p->v.Return.value = value;
7195
6.95k
    p->lineno = lineno;
7196
6.95k
    p->col_offset = col_offset;
7197
6.95k
    p->end_lineno = end_lineno;
7198
6.95k
    p->end_col_offset = end_col_offset;
7199
6.95k
    return p;
7200
6.95k
}
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.02k
{
7206
1.02k
    stmt_ty p;
7207
1.02k
    p = (stmt_ty)_PyArena_Malloc(arena, sizeof(*p));
7208
1.02k
    if (!p)
7209
0
        return NULL;
7210
1.02k
    p->kind = Delete_kind;
7211
1.02k
    p->v.Delete.targets = targets;
7212
1.02k
    p->lineno = lineno;
7213
1.02k
    p->col_offset = col_offset;
7214
1.02k
    p->end_lineno = end_lineno;
7215
1.02k
    p->end_col_offset = end_col_offset;
7216
1.02k
    return p;
7217
1.02k
}
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
18.1k
{
7224
18.1k
    stmt_ty p;
7225
18.1k
    if (!value) {
7226
0
        PyErr_SetString(PyExc_ValueError,
7227
0
                        "field 'value' is required for Assign");
7228
0
        return NULL;
7229
0
    }
7230
18.1k
    p = (stmt_ty)_PyArena_Malloc(arena, sizeof(*p));
7231
18.1k
    if (!p)
7232
0
        return NULL;
7233
18.1k
    p->kind = Assign_kind;
7234
18.1k
    p->v.Assign.targets = targets;
7235
18.1k
    p->v.Assign.value = value;
7236
18.1k
    p->v.Assign.type_comment = type_comment;
7237
18.1k
    p->lineno = lineno;
7238
18.1k
    p->col_offset = col_offset;
7239
18.1k
    p->end_lineno = end_lineno;
7240
18.1k
    p->end_col_offset = end_col_offset;
7241
18.1k
    return p;
7242
18.1k
}
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
264
{
7249
264
    stmt_ty p;
7250
264
    if (!name) {
7251
0
        PyErr_SetString(PyExc_ValueError,
7252
0
                        "field 'name' is required for TypeAlias");
7253
0
        return NULL;
7254
0
    }
7255
264
    if (!value) {
7256
0
        PyErr_SetString(PyExc_ValueError,
7257
0
                        "field 'value' is required for TypeAlias");
7258
0
        return NULL;
7259
0
    }
7260
264
    p = (stmt_ty)_PyArena_Malloc(arena, sizeof(*p));
7261
264
    if (!p)
7262
0
        return NULL;
7263
264
    p->kind = TypeAlias_kind;
7264
264
    p->v.TypeAlias.name = name;
7265
264
    p->v.TypeAlias.type_params = type_params;
7266
264
    p->v.TypeAlias.value = value;
7267
264
    p->lineno = lineno;
7268
264
    p->col_offset = col_offset;
7269
264
    p->end_lineno = end_lineno;
7270
264
    p->end_col_offset = end_col_offset;
7271
264
    return p;
7272
264
}
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.76k
{
7278
2.76k
    stmt_ty p;
7279
2.76k
    if (!target) {
7280
0
        PyErr_SetString(PyExc_ValueError,
7281
0
                        "field 'target' is required for AugAssign");
7282
0
        return NULL;
7283
0
    }
7284
2.76k
    if (!op) {
7285
0
        PyErr_SetString(PyExc_ValueError,
7286
0
                        "field 'op' is required for AugAssign");
7287
0
        return NULL;
7288
0
    }
7289
2.76k
    if (!value) {
7290
0
        PyErr_SetString(PyExc_ValueError,
7291
0
                        "field 'value' is required for AugAssign");
7292
0
        return NULL;
7293
0
    }
7294
2.76k
    p = (stmt_ty)_PyArena_Malloc(arena, sizeof(*p));
7295
2.76k
    if (!p)
7296
0
        return NULL;
7297
2.76k
    p->kind = AugAssign_kind;
7298
2.76k
    p->v.AugAssign.target = target;
7299
2.76k
    p->v.AugAssign.op = op;
7300
2.76k
    p->v.AugAssign.value = value;
7301
2.76k
    p->lineno = lineno;
7302
2.76k
    p->col_offset = col_offset;
7303
2.76k
    p->end_lineno = end_lineno;
7304
2.76k
    p->end_col_offset = end_col_offset;
7305
2.76k
    return p;
7306
2.76k
}
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.15k
{
7313
3.15k
    stmt_ty p;
7314
3.15k
    if (!target) {
7315
0
        PyErr_SetString(PyExc_ValueError,
7316
0
                        "field 'target' is required for AnnAssign");
7317
0
        return NULL;
7318
0
    }
7319
3.15k
    if (!annotation) {
7320
0
        PyErr_SetString(PyExc_ValueError,
7321
0
                        "field 'annotation' is required for AnnAssign");
7322
0
        return NULL;
7323
0
    }
7324
3.15k
    p = (stmt_ty)_PyArena_Malloc(arena, sizeof(*p));
7325
3.15k
    if (!p)
7326
0
        return NULL;
7327
3.15k
    p->kind = AnnAssign_kind;
7328
3.15k
    p->v.AnnAssign.target = target;
7329
3.15k
    p->v.AnnAssign.annotation = annotation;
7330
3.15k
    p->v.AnnAssign.value = value;
7331
3.15k
    p->v.AnnAssign.simple = simple;
7332
3.15k
    p->lineno = lineno;
7333
3.15k
    p->col_offset = col_offset;
7334
3.15k
    p->end_lineno = end_lineno;
7335
3.15k
    p->end_col_offset = end_col_offset;
7336
3.15k
    return p;
7337
3.15k
}
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
2.00k
{
7344
2.00k
    stmt_ty p;
7345
2.00k
    if (!target) {
7346
0
        PyErr_SetString(PyExc_ValueError,
7347
0
                        "field 'target' is required for For");
7348
0
        return NULL;
7349
0
    }
7350
2.00k
    if (!iter) {
7351
0
        PyErr_SetString(PyExc_ValueError,
7352
0
                        "field 'iter' is required for For");
7353
0
        return NULL;
7354
0
    }
7355
2.00k
    p = (stmt_ty)_PyArena_Malloc(arena, sizeof(*p));
7356
2.00k
    if (!p)
7357
0
        return NULL;
7358
2.00k
    p->kind = For_kind;
7359
2.00k
    p->v.For.target = target;
7360
2.00k
    p->v.For.iter = iter;
7361
2.00k
    p->v.For.body = body;
7362
2.00k
    p->v.For.orelse = orelse;
7363
2.00k
    p->v.For.type_comment = type_comment;
7364
2.00k
    p->lineno = lineno;
7365
2.00k
    p->col_offset = col_offset;
7366
2.00k
    p->end_lineno = end_lineno;
7367
2.00k
    p->end_col_offset = end_col_offset;
7368
2.00k
    return p;
7369
2.00k
}
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.47k
{
7408
1.47k
    stmt_ty p;
7409
1.47k
    if (!test) {
7410
0
        PyErr_SetString(PyExc_ValueError,
7411
0
                        "field 'test' is required for While");
7412
0
        return NULL;
7413
0
    }
7414
1.47k
    p = (stmt_ty)_PyArena_Malloc(arena, sizeof(*p));
7415
1.47k
    if (!p)
7416
0
        return NULL;
7417
1.47k
    p->kind = While_kind;
7418
1.47k
    p->v.While.test = test;
7419
1.47k
    p->v.While.body = body;
7420
1.47k
    p->v.While.orelse = orelse;
7421
1.47k
    p->lineno = lineno;
7422
1.47k
    p->col_offset = col_offset;
7423
1.47k
    p->end_lineno = end_lineno;
7424
1.47k
    p->end_col_offset = end_col_offset;
7425
1.47k
    return p;
7426
1.47k
}
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
12.1k
{
7433
12.1k
    stmt_ty p;
7434
12.1k
    if (!test) {
7435
0
        PyErr_SetString(PyExc_ValueError,
7436
0
                        "field 'test' is required for If");
7437
0
        return NULL;
7438
0
    }
7439
12.1k
    p = (stmt_ty)_PyArena_Malloc(arena, sizeof(*p));
7440
12.1k
    if (!p)
7441
0
        return NULL;
7442
12.1k
    p->kind = If_kind;
7443
12.1k
    p->v.If.test = test;
7444
12.1k
    p->v.If.body = body;
7445
12.1k
    p->v.If.orelse = orelse;
7446
12.1k
    p->lineno = lineno;
7447
12.1k
    p->col_offset = col_offset;
7448
12.1k
    p->end_lineno = end_lineno;
7449
12.1k
    p->end_col_offset = end_col_offset;
7450
12.1k
    return p;
7451
12.1k
}
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
2.18k
{
7458
2.18k
    stmt_ty p;
7459
2.18k
    p = (stmt_ty)_PyArena_Malloc(arena, sizeof(*p));
7460
2.18k
    if (!p)
7461
0
        return NULL;
7462
2.18k
    p->kind = With_kind;
7463
2.18k
    p->v.With.items = items;
7464
2.18k
    p->v.With.body = body;
7465
2.18k
    p->v.With.type_comment = type_comment;
7466
2.18k
    p->lineno = lineno;
7467
2.18k
    p->col_offset = col_offset;
7468
2.18k
    p->end_lineno = end_lineno;
7469
2.18k
    p->end_col_offset = end_col_offset;
7470
2.18k
    return p;
7471
2.18k
}
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.02k
{
7478
1.02k
    stmt_ty p;
7479
1.02k
    p = (stmt_ty)_PyArena_Malloc(arena, sizeof(*p));
7480
1.02k
    if (!p)
7481
0
        return NULL;
7482
1.02k
    p->kind = AsyncWith_kind;
7483
1.02k
    p->v.AsyncWith.items = items;
7484
1.02k
    p->v.AsyncWith.body = body;
7485
1.02k
    p->v.AsyncWith.type_comment = type_comment;
7486
1.02k
    p->lineno = lineno;
7487
1.02k
    p->col_offset = col_offset;
7488
1.02k
    p->end_lineno = end_lineno;
7489
1.02k
    p->end_col_offset = end_col_offset;
7490
1.02k
    return p;
7491
1.02k
}
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
654
{
7497
654
    stmt_ty p;
7498
654
    if (!subject) {
7499
0
        PyErr_SetString(PyExc_ValueError,
7500
0
                        "field 'subject' is required for Match");
7501
0
        return NULL;
7502
0
    }
7503
654
    p = (stmt_ty)_PyArena_Malloc(arena, sizeof(*p));
7504
654
    if (!p)
7505
0
        return NULL;
7506
654
    p->kind = Match_kind;
7507
654
    p->v.Match.subject = subject;
7508
654
    p->v.Match.cases = cases;
7509
654
    p->lineno = lineno;
7510
654
    p->col_offset = col_offset;
7511
654
    p->end_lineno = end_lineno;
7512
654
    p->end_col_offset = end_col_offset;
7513
654
    return p;
7514
654
}
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
4.34k
{
7520
4.34k
    stmt_ty p;
7521
4.34k
    p = (stmt_ty)_PyArena_Malloc(arena, sizeof(*p));
7522
4.34k
    if (!p)
7523
0
        return NULL;
7524
4.34k
    p->kind = Raise_kind;
7525
4.34k
    p->v.Raise.exc = exc;
7526
4.34k
    p->v.Raise.cause = cause;
7527
4.34k
    p->lineno = lineno;
7528
4.34k
    p->col_offset = col_offset;
7529
4.34k
    p->end_lineno = end_lineno;
7530
4.34k
    p->end_col_offset = end_col_offset;
7531
4.34k
    return p;
7532
4.34k
}
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
4.07k
{
7539
4.07k
    stmt_ty p;
7540
4.07k
    p = (stmt_ty)_PyArena_Malloc(arena, sizeof(*p));
7541
4.07k
    if (!p)
7542
0
        return NULL;
7543
4.07k
    p->kind = Try_kind;
7544
4.07k
    p->v.Try.body = body;
7545
4.07k
    p->v.Try.handlers = handlers;
7546
4.07k
    p->v.Try.orelse = orelse;
7547
4.07k
    p->v.Try.finalbody = finalbody;
7548
4.07k
    p->lineno = lineno;
7549
4.07k
    p->col_offset = col_offset;
7550
4.07k
    p->end_lineno = end_lineno;
7551
4.07k
    p->end_col_offset = end_col_offset;
7552
4.07k
    return p;
7553
4.07k
}
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.63k
{
7561
1.63k
    stmt_ty p;
7562
1.63k
    p = (stmt_ty)_PyArena_Malloc(arena, sizeof(*p));
7563
1.63k
    if (!p)
7564
0
        return NULL;
7565
1.63k
    p->kind = TryStar_kind;
7566
1.63k
    p->v.TryStar.body = body;
7567
1.63k
    p->v.TryStar.handlers = handlers;
7568
1.63k
    p->v.TryStar.orelse = orelse;
7569
1.63k
    p->v.TryStar.finalbody = finalbody;
7570
1.63k
    p->lineno = lineno;
7571
1.63k
    p->col_offset = col_offset;
7572
1.63k
    p->end_lineno = end_lineno;
7573
1.63k
    p->end_col_offset = end_col_offset;
7574
1.63k
    return p;
7575
1.63k
}
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.00k
{
7581
1.00k
    stmt_ty p;
7582
1.00k
    if (!test) {
7583
0
        PyErr_SetString(PyExc_ValueError,
7584
0
                        "field 'test' is required for Assert");
7585
0
        return NULL;
7586
0
    }
7587
1.00k
    p = (stmt_ty)_PyArena_Malloc(arena, sizeof(*p));
7588
1.00k
    if (!p)
7589
0
        return NULL;
7590
1.00k
    p->kind = Assert_kind;
7591
1.00k
    p->v.Assert.test = test;
7592
1.00k
    p->v.Assert.msg = msg;
7593
1.00k
    p->lineno = lineno;
7594
1.00k
    p->col_offset = col_offset;
7595
1.00k
    p->end_lineno = end_lineno;
7596
1.00k
    p->end_col_offset = end_col_offset;
7597
1.00k
    return p;
7598
1.00k
}
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.93k
{
7604
2.93k
    stmt_ty p;
7605
2.93k
    p = (stmt_ty)_PyArena_Malloc(arena, sizeof(*p));
7606
2.93k
    if (!p)
7607
0
        return NULL;
7608
2.93k
    p->kind = Import_kind;
7609
2.93k
    p->v.Import.names = names;
7610
2.93k
    p->lineno = lineno;
7611
2.93k
    p->col_offset = col_offset;
7612
2.93k
    p->end_lineno = end_lineno;
7613
2.93k
    p->end_col_offset = end_col_offset;
7614
2.93k
    return p;
7615
2.93k
}
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.12k
{
7622
3.12k
    stmt_ty p;
7623
3.12k
    p = (stmt_ty)_PyArena_Malloc(arena, sizeof(*p));
7624
3.12k
    if (!p)
7625
0
        return NULL;
7626
3.12k
    p->kind = ImportFrom_kind;
7627
3.12k
    p->v.ImportFrom.module = module;
7628
3.12k
    p->v.ImportFrom.names = names;
7629
3.12k
    p->v.ImportFrom.level = level;
7630
3.12k
    p->lineno = lineno;
7631
3.12k
    p->col_offset = col_offset;
7632
3.12k
    p->end_lineno = end_lineno;
7633
3.12k
    p->end_col_offset = end_col_offset;
7634
3.12k
    return p;
7635
3.12k
}
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
858
{
7641
858
    stmt_ty p;
7642
858
    p = (stmt_ty)_PyArena_Malloc(arena, sizeof(*p));
7643
858
    if (!p)
7644
0
        return NULL;
7645
858
    p->kind = Global_kind;
7646
858
    p->v.Global.names = names;
7647
858
    p->lineno = lineno;
7648
858
    p->col_offset = col_offset;
7649
858
    p->end_lineno = end_lineno;
7650
858
    p->end_col_offset = end_col_offset;
7651
858
    return p;
7652
858
}
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
473
{
7658
473
    stmt_ty p;
7659
473
    p = (stmt_ty)_PyArena_Malloc(arena, sizeof(*p));
7660
473
    if (!p)
7661
0
        return NULL;
7662
473
    p->kind = Nonlocal_kind;
7663
473
    p->v.Nonlocal.names = names;
7664
473
    p->lineno = lineno;
7665
473
    p->col_offset = col_offset;
7666
473
    p->end_lineno = end_lineno;
7667
473
    p->end_col_offset = end_col_offset;
7668
473
    return p;
7669
473
}
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
95.9k
{
7675
95.9k
    stmt_ty p;
7676
95.9k
    if (!value) {
7677
0
        PyErr_SetString(PyExc_ValueError,
7678
0
                        "field 'value' is required for Expr");
7679
0
        return NULL;
7680
0
    }
7681
95.9k
    p = (stmt_ty)_PyArena_Malloc(arena, sizeof(*p));
7682
95.9k
    if (!p)
7683
0
        return NULL;
7684
95.9k
    p->kind = Expr_kind;
7685
95.9k
    p->v.Expr.value = value;
7686
95.9k
    p->lineno = lineno;
7687
95.9k
    p->col_offset = col_offset;
7688
95.9k
    p->end_lineno = end_lineno;
7689
95.9k
    p->end_col_offset = end_col_offset;
7690
95.9k
    return p;
7691
95.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.36k
{
7697
1.36k
    stmt_ty p;
7698
1.36k
    p = (stmt_ty)_PyArena_Malloc(arena, sizeof(*p));
7699
1.36k
    if (!p)
7700
0
        return NULL;
7701
1.36k
    p->kind = Pass_kind;
7702
1.36k
    p->lineno = lineno;
7703
1.36k
    p->col_offset = col_offset;
7704
1.36k
    p->end_lineno = end_lineno;
7705
1.36k
    p->end_col_offset = end_col_offset;
7706
1.36k
    return p;
7707
1.36k
}
7708
7709
stmt_ty
7710
_PyAST_Break(int lineno, int col_offset, int end_lineno, int end_col_offset,
7711
             PyArena *arena)
7712
2.03k
{
7713
2.03k
    stmt_ty p;
7714
2.03k
    p = (stmt_ty)_PyArena_Malloc(arena, sizeof(*p));
7715
2.03k
    if (!p)
7716
0
        return NULL;
7717
2.03k
    p->kind = Break_kind;
7718
2.03k
    p->lineno = lineno;
7719
2.03k
    p->col_offset = col_offset;
7720
2.03k
    p->end_lineno = end_lineno;
7721
2.03k
    p->end_col_offset = end_col_offset;
7722
2.03k
    return p;
7723
2.03k
}
7724
7725
stmt_ty
7726
_PyAST_Continue(int lineno, int col_offset, int end_lineno, int end_col_offset,
7727
                PyArena *arena)
7728
2.60k
{
7729
2.60k
    stmt_ty p;
7730
2.60k
    p = (stmt_ty)_PyArena_Malloc(arena, sizeof(*p));
7731
2.60k
    if (!p)
7732
0
        return NULL;
7733
2.60k
    p->kind = Continue_kind;
7734
2.60k
    p->lineno = lineno;
7735
2.60k
    p->col_offset = col_offset;
7736
2.60k
    p->end_lineno = end_lineno;
7737
2.60k
    p->end_col_offset = end_col_offset;
7738
2.60k
    return p;
7739
2.60k
}
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.60k
{
7745
3.60k
    expr_ty p;
7746
3.60k
    if (!op) {
7747
0
        PyErr_SetString(PyExc_ValueError,
7748
0
                        "field 'op' is required for BoolOp");
7749
0
        return NULL;
7750
0
    }
7751
3.60k
    p = (expr_ty)_PyArena_Malloc(arena, sizeof(*p));
7752
3.60k
    if (!p)
7753
0
        return NULL;
7754
3.60k
    p->kind = BoolOp_kind;
7755
3.60k
    p->v.BoolOp.op = op;
7756
3.60k
    p->v.BoolOp.values = values;
7757
3.60k
    p->lineno = lineno;
7758
3.60k
    p->col_offset = col_offset;
7759
3.60k
    p->end_lineno = end_lineno;
7760
3.60k
    p->end_col_offset = end_col_offset;
7761
3.60k
    return p;
7762
3.60k
}
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
1.50k
{
7768
1.50k
    expr_ty p;
7769
1.50k
    if (!target) {
7770
0
        PyErr_SetString(PyExc_ValueError,
7771
0
                        "field 'target' is required for NamedExpr");
7772
0
        return NULL;
7773
0
    }
7774
1.50k
    if (!value) {
7775
0
        PyErr_SetString(PyExc_ValueError,
7776
0
                        "field 'value' is required for NamedExpr");
7777
0
        return NULL;
7778
0
    }
7779
1.50k
    p = (expr_ty)_PyArena_Malloc(arena, sizeof(*p));
7780
1.50k
    if (!p)
7781
0
        return NULL;
7782
1.50k
    p->kind = NamedExpr_kind;
7783
1.50k
    p->v.NamedExpr.target = target;
7784
1.50k
    p->v.NamedExpr.value = value;
7785
1.50k
    p->lineno = lineno;
7786
1.50k
    p->col_offset = col_offset;
7787
1.50k
    p->end_lineno = end_lineno;
7788
1.50k
    p->end_col_offset = end_col_offset;
7789
1.50k
    return p;
7790
1.50k
}
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
47.5k
{
7796
47.5k
    expr_ty p;
7797
47.5k
    if (!left) {
7798
0
        PyErr_SetString(PyExc_ValueError,
7799
0
                        "field 'left' is required for BinOp");
7800
0
        return NULL;
7801
0
    }
7802
47.5k
    if (!op) {
7803
0
        PyErr_SetString(PyExc_ValueError,
7804
0
                        "field 'op' is required for BinOp");
7805
0
        return NULL;
7806
0
    }
7807
47.5k
    if (!right) {
7808
0
        PyErr_SetString(PyExc_ValueError,
7809
0
                        "field 'right' is required for BinOp");
7810
0
        return NULL;
7811
0
    }
7812
47.5k
    p = (expr_ty)_PyArena_Malloc(arena, sizeof(*p));
7813
47.5k
    if (!p)
7814
0
        return NULL;
7815
47.5k
    p->kind = BinOp_kind;
7816
47.5k
    p->v.BinOp.left = left;
7817
47.5k
    p->v.BinOp.op = op;
7818
47.5k
    p->v.BinOp.right = right;
7819
47.5k
    p->lineno = lineno;
7820
47.5k
    p->col_offset = col_offset;
7821
47.5k
    p->end_lineno = end_lineno;
7822
47.5k
    p->end_col_offset = end_col_offset;
7823
47.5k
    return p;
7824
47.5k
}
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
91.5k
{
7830
91.5k
    expr_ty p;
7831
91.5k
    if (!op) {
7832
0
        PyErr_SetString(PyExc_ValueError,
7833
0
                        "field 'op' is required for UnaryOp");
7834
0
        return NULL;
7835
0
    }
7836
91.5k
    if (!operand) {
7837
0
        PyErr_SetString(PyExc_ValueError,
7838
0
                        "field 'operand' is required for UnaryOp");
7839
0
        return NULL;
7840
0
    }
7841
91.5k
    p = (expr_ty)_PyArena_Malloc(arena, sizeof(*p));
7842
91.5k
    if (!p)
7843
0
        return NULL;
7844
91.5k
    p->kind = UnaryOp_kind;
7845
91.5k
    p->v.UnaryOp.op = op;
7846
91.5k
    p->v.UnaryOp.operand = operand;
7847
91.5k
    p->lineno = lineno;
7848
91.5k
    p->col_offset = col_offset;
7849
91.5k
    p->end_lineno = end_lineno;
7850
91.5k
    p->end_col_offset = end_col_offset;
7851
91.5k
    return p;
7852
91.5k
}
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.73k
{
7858
2.73k
    expr_ty p;
7859
2.73k
    if (!args) {
7860
0
        PyErr_SetString(PyExc_ValueError,
7861
0
                        "field 'args' is required for Lambda");
7862
0
        return NULL;
7863
0
    }
7864
2.73k
    if (!body) {
7865
0
        PyErr_SetString(PyExc_ValueError,
7866
0
                        "field 'body' is required for Lambda");
7867
0
        return NULL;
7868
0
    }
7869
2.73k
    p = (expr_ty)_PyArena_Malloc(arena, sizeof(*p));
7870
2.73k
    if (!p)
7871
0
        return NULL;
7872
2.73k
    p->kind = Lambda_kind;
7873
2.73k
    p->v.Lambda.args = args;
7874
2.73k
    p->v.Lambda.body = body;
7875
2.73k
    p->lineno = lineno;
7876
2.73k
    p->col_offset = col_offset;
7877
2.73k
    p->end_lineno = end_lineno;
7878
2.73k
    p->end_col_offset = end_col_offset;
7879
2.73k
    return p;
7880
2.73k
}
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.29k
{
7886
1.29k
    expr_ty p;
7887
1.29k
    if (!test) {
7888
0
        PyErr_SetString(PyExc_ValueError,
7889
0
                        "field 'test' is required for IfExp");
7890
0
        return NULL;
7891
0
    }
7892
1.29k
    if (!body) {
7893
0
        PyErr_SetString(PyExc_ValueError,
7894
0
                        "field 'body' is required for IfExp");
7895
0
        return NULL;
7896
0
    }
7897
1.29k
    if (!orelse) {
7898
0
        PyErr_SetString(PyExc_ValueError,
7899
0
                        "field 'orelse' is required for IfExp");
7900
0
        return NULL;
7901
0
    }
7902
1.29k
    p = (expr_ty)_PyArena_Malloc(arena, sizeof(*p));
7903
1.29k
    if (!p)
7904
0
        return NULL;
7905
1.29k
    p->kind = IfExp_kind;
7906
1.29k
    p->v.IfExp.test = test;
7907
1.29k
    p->v.IfExp.body = body;
7908
1.29k
    p->v.IfExp.orelse = orelse;
7909
1.29k
    p->lineno = lineno;
7910
1.29k
    p->col_offset = col_offset;
7911
1.29k
    p->end_lineno = end_lineno;
7912
1.29k
    p->end_col_offset = end_col_offset;
7913
1.29k
    return p;
7914
1.29k
}
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.33k
{
7920
4.33k
    expr_ty p;
7921
4.33k
    p = (expr_ty)_PyArena_Malloc(arena, sizeof(*p));
7922
4.33k
    if (!p)
7923
0
        return NULL;
7924
4.33k
    p->kind = Dict_kind;
7925
4.33k
    p->v.Dict.keys = keys;
7926
4.33k
    p->v.Dict.values = values;
7927
4.33k
    p->lineno = lineno;
7928
4.33k
    p->col_offset = col_offset;
7929
4.33k
    p->end_lineno = end_lineno;
7930
4.33k
    p->end_col_offset = end_col_offset;
7931
4.33k
    return p;
7932
4.33k
}
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.48k
{
7938
1.48k
    expr_ty p;
7939
1.48k
    p = (expr_ty)_PyArena_Malloc(arena, sizeof(*p));
7940
1.48k
    if (!p)
7941
0
        return NULL;
7942
1.48k
    p->kind = Set_kind;
7943
1.48k
    p->v.Set.elts = elts;
7944
1.48k
    p->lineno = lineno;
7945
1.48k
    p->col_offset = col_offset;
7946
1.48k
    p->end_lineno = end_lineno;
7947
1.48k
    p->end_col_offset = end_col_offset;
7948
1.48k
    return p;
7949
1.48k
}
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.53k
{
7956
1.53k
    expr_ty p;
7957
1.53k
    if (!elt) {
7958
0
        PyErr_SetString(PyExc_ValueError,
7959
0
                        "field 'elt' is required for ListComp");
7960
0
        return NULL;
7961
0
    }
7962
1.53k
    p = (expr_ty)_PyArena_Malloc(arena, sizeof(*p));
7963
1.53k
    if (!p)
7964
0
        return NULL;
7965
1.53k
    p->kind = ListComp_kind;
7966
1.53k
    p->v.ListComp.elt = elt;
7967
1.53k
    p->v.ListComp.generators = generators;
7968
1.53k
    p->lineno = lineno;
7969
1.53k
    p->col_offset = col_offset;
7970
1.53k
    p->end_lineno = end_lineno;
7971
1.53k
    p->end_col_offset = end_col_offset;
7972
1.53k
    return p;
7973
1.53k
}
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
560
{
7980
560
    expr_ty p;
7981
560
    if (!elt) {
7982
0
        PyErr_SetString(PyExc_ValueError,
7983
0
                        "field 'elt' is required for SetComp");
7984
0
        return NULL;
7985
0
    }
7986
560
    p = (expr_ty)_PyArena_Malloc(arena, sizeof(*p));
7987
560
    if (!p)
7988
0
        return NULL;
7989
560
    p->kind = SetComp_kind;
7990
560
    p->v.SetComp.elt = elt;
7991
560
    p->v.SetComp.generators = generators;
7992
560
    p->lineno = lineno;
7993
560
    p->col_offset = col_offset;
7994
560
    p->end_lineno = end_lineno;
7995
560
    p->end_col_offset = end_col_offset;
7996
560
    return p;
7997
560
}
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.44k
{
8004
1.44k
    expr_ty p;
8005
1.44k
    if (!key) {
8006
0
        PyErr_SetString(PyExc_ValueError,
8007
0
                        "field 'key' is required for DictComp");
8008
0
        return NULL;
8009
0
    }
8010
1.44k
    if (!value) {
8011
0
        PyErr_SetString(PyExc_ValueError,
8012
0
                        "field 'value' is required for DictComp");
8013
0
        return NULL;
8014
0
    }
8015
1.44k
    p = (expr_ty)_PyArena_Malloc(arena, sizeof(*p));
8016
1.44k
    if (!p)
8017
0
        return NULL;
8018
1.44k
    p->kind = DictComp_kind;
8019
1.44k
    p->v.DictComp.key = key;
8020
1.44k
    p->v.DictComp.value = value;
8021
1.44k
    p->v.DictComp.generators = generators;
8022
1.44k
    p->lineno = lineno;
8023
1.44k
    p->col_offset = col_offset;
8024
1.44k
    p->end_lineno = end_lineno;
8025
1.44k
    p->end_col_offset = end_col_offset;
8026
1.44k
    return p;
8027
1.44k
}
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.77k
{
8034
4.77k
    expr_ty p;
8035
4.77k
    if (!elt) {
8036
0
        PyErr_SetString(PyExc_ValueError,
8037
0
                        "field 'elt' is required for GeneratorExp");
8038
0
        return NULL;
8039
0
    }
8040
4.77k
    p = (expr_ty)_PyArena_Malloc(arena, sizeof(*p));
8041
4.77k
    if (!p)
8042
0
        return NULL;
8043
4.77k
    p->kind = GeneratorExp_kind;
8044
4.77k
    p->v.GeneratorExp.elt = elt;
8045
4.77k
    p->v.GeneratorExp.generators = generators;
8046
4.77k
    p->lineno = lineno;
8047
4.77k
    p->col_offset = col_offset;
8048
4.77k
    p->end_lineno = end_lineno;
8049
4.77k
    p->end_col_offset = end_col_offset;
8050
4.77k
    return p;
8051
4.77k
}
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
404
{
8057
404
    expr_ty p;
8058
404
    if (!value) {
8059
0
        PyErr_SetString(PyExc_ValueError,
8060
0
                        "field 'value' is required for Await");
8061
0
        return NULL;
8062
0
    }
8063
404
    p = (expr_ty)_PyArena_Malloc(arena, sizeof(*p));
8064
404
    if (!p)
8065
0
        return NULL;
8066
404
    p->kind = Await_kind;
8067
404
    p->v.Await.value = value;
8068
404
    p->lineno = lineno;
8069
404
    p->col_offset = col_offset;
8070
404
    p->end_lineno = end_lineno;
8071
404
    p->end_col_offset = end_col_offset;
8072
404
    return p;
8073
404
}
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.68k
{
8079
2.68k
    expr_ty p;
8080
2.68k
    p = (expr_ty)_PyArena_Malloc(arena, sizeof(*p));
8081
2.68k
    if (!p)
8082
0
        return NULL;
8083
2.68k
    p->kind = Yield_kind;
8084
2.68k
    p->v.Yield.value = value;
8085
2.68k
    p->lineno = lineno;
8086
2.68k
    p->col_offset = col_offset;
8087
2.68k
    p->end_lineno = end_lineno;
8088
2.68k
    p->end_col_offset = end_col_offset;
8089
2.68k
    return p;
8090
2.68k
}
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
311
{
8096
311
    expr_ty p;
8097
311
    if (!value) {
8098
0
        PyErr_SetString(PyExc_ValueError,
8099
0
                        "field 'value' is required for YieldFrom");
8100
0
        return NULL;
8101
0
    }
8102
311
    p = (expr_ty)_PyArena_Malloc(arena, sizeof(*p));
8103
311
    if (!p)
8104
0
        return NULL;
8105
311
    p->kind = YieldFrom_kind;
8106
311
    p->v.YieldFrom.value = value;
8107
311
    p->lineno = lineno;
8108
311
    p->col_offset = col_offset;
8109
311
    p->end_lineno = end_lineno;
8110
311
    p->end_col_offset = end_col_offset;
8111
311
    return p;
8112
311
}
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.1k
{
8119
11.1k
    expr_ty p;
8120
11.1k
    if (!left) {
8121
0
        PyErr_SetString(PyExc_ValueError,
8122
0
                        "field 'left' is required for Compare");
8123
0
        return NULL;
8124
0
    }
8125
11.1k
    p = (expr_ty)_PyArena_Malloc(arena, sizeof(*p));
8126
11.1k
    if (!p)
8127
0
        return NULL;
8128
11.1k
    p->kind = Compare_kind;
8129
11.1k
    p->v.Compare.left = left;
8130
11.1k
    p->v.Compare.ops = ops;
8131
11.1k
    p->v.Compare.comparators = comparators;
8132
11.1k
    p->lineno = lineno;
8133
11.1k
    p->col_offset = col_offset;
8134
11.1k
    p->end_lineno = end_lineno;
8135
11.1k
    p->end_col_offset = end_col_offset;
8136
11.1k
    return p;
8137
11.1k
}
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
85.3k
{
8144
85.3k
    expr_ty p;
8145
85.3k
    if (!func) {
8146
0
        PyErr_SetString(PyExc_ValueError,
8147
0
                        "field 'func' is required for Call");
8148
0
        return NULL;
8149
0
    }
8150
85.3k
    p = (expr_ty)_PyArena_Malloc(arena, sizeof(*p));
8151
85.3k
    if (!p)
8152
0
        return NULL;
8153
85.3k
    p->kind = Call_kind;
8154
85.3k
    p->v.Call.func = func;
8155
85.3k
    p->v.Call.args = args;
8156
85.3k
    p->v.Call.keywords = keywords;
8157
85.3k
    p->lineno = lineno;
8158
85.3k
    p->col_offset = col_offset;
8159
85.3k
    p->end_lineno = end_lineno;
8160
85.3k
    p->end_col_offset = end_col_offset;
8161
85.3k
    return p;
8162
85.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
20.7k
{
8169
20.7k
    expr_ty p;
8170
20.7k
    if (!value) {
8171
0
        PyErr_SetString(PyExc_ValueError,
8172
0
                        "field 'value' is required for FormattedValue");
8173
0
        return NULL;
8174
0
    }
8175
20.7k
    p = (expr_ty)_PyArena_Malloc(arena, sizeof(*p));
8176
20.7k
    if (!p)
8177
0
        return NULL;
8178
20.7k
    p->kind = FormattedValue_kind;
8179
20.7k
    p->v.FormattedValue.value = value;
8180
20.7k
    p->v.FormattedValue.conversion = conversion;
8181
20.7k
    p->v.FormattedValue.format_spec = format_spec;
8182
20.7k
    p->lineno = lineno;
8183
20.7k
    p->col_offset = col_offset;
8184
20.7k
    p->end_lineno = end_lineno;
8185
20.7k
    p->end_col_offset = end_col_offset;
8186
20.7k
    return p;
8187
20.7k
}
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
6.34k
{
8194
6.34k
    expr_ty p;
8195
6.34k
    if (!value) {
8196
0
        PyErr_SetString(PyExc_ValueError,
8197
0
                        "field 'value' is required for Interpolation");
8198
0
        return NULL;
8199
0
    }
8200
6.34k
    if (!str) {
8201
0
        PyErr_SetString(PyExc_ValueError,
8202
0
                        "field 'str' is required for Interpolation");
8203
0
        return NULL;
8204
0
    }
8205
6.34k
    p = (expr_ty)_PyArena_Malloc(arena, sizeof(*p));
8206
6.34k
    if (!p)
8207
0
        return NULL;
8208
6.34k
    p->kind = Interpolation_kind;
8209
6.34k
    p->v.Interpolation.value = value;
8210
6.34k
    p->v.Interpolation.str = str;
8211
6.34k
    p->v.Interpolation.conversion = conversion;
8212
6.34k
    p->v.Interpolation.format_spec = format_spec;
8213
6.34k
    p->lineno = lineno;
8214
6.34k
    p->col_offset = col_offset;
8215
6.34k
    p->end_lineno = end_lineno;
8216
6.34k
    p->end_col_offset = end_col_offset;
8217
6.34k
    return p;
8218
6.34k
}
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
33.5k
{
8224
33.5k
    expr_ty p;
8225
33.5k
    p = (expr_ty)_PyArena_Malloc(arena, sizeof(*p));
8226
33.5k
    if (!p)
8227
0
        return NULL;
8228
33.5k
    p->kind = JoinedStr_kind;
8229
33.5k
    p->v.JoinedStr.values = values;
8230
33.5k
    p->lineno = lineno;
8231
33.5k
    p->col_offset = col_offset;
8232
33.5k
    p->end_lineno = end_lineno;
8233
33.5k
    p->end_col_offset = end_col_offset;
8234
33.5k
    return p;
8235
33.5k
}
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
7.18k
{
8241
7.18k
    expr_ty p;
8242
7.18k
    p = (expr_ty)_PyArena_Malloc(arena, sizeof(*p));
8243
7.18k
    if (!p)
8244
0
        return NULL;
8245
7.18k
    p->kind = TemplateStr_kind;
8246
7.18k
    p->v.TemplateStr.values = values;
8247
7.18k
    p->lineno = lineno;
8248
7.18k
    p->col_offset = col_offset;
8249
7.18k
    p->end_lineno = end_lineno;
8250
7.18k
    p->end_col_offset = end_col_offset;
8251
7.18k
    return p;
8252
7.18k
}
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
408k
{
8258
408k
    expr_ty p;
8259
408k
    if (!value) {
8260
2
        PyErr_SetString(PyExc_ValueError,
8261
2
                        "field 'value' is required for Constant");
8262
2
        return NULL;
8263
2
    }
8264
408k
    p = (expr_ty)_PyArena_Malloc(arena, sizeof(*p));
8265
408k
    if (!p)
8266
0
        return NULL;
8267
408k
    p->kind = Constant_kind;
8268
408k
    p->v.Constant.value = value;
8269
408k
    p->v.Constant.kind = kind;
8270
408k
    p->lineno = lineno;
8271
408k
    p->col_offset = col_offset;
8272
408k
    p->end_lineno = end_lineno;
8273
408k
    p->end_col_offset = end_col_offset;
8274
408k
    return p;
8275
408k
}
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
51.9k
{
8282
51.9k
    expr_ty p;
8283
51.9k
    if (!value) {
8284
0
        PyErr_SetString(PyExc_ValueError,
8285
0
                        "field 'value' is required for Attribute");
8286
0
        return NULL;
8287
0
    }
8288
51.9k
    if (!attr) {
8289
0
        PyErr_SetString(PyExc_ValueError,
8290
0
                        "field 'attr' is required for Attribute");
8291
0
        return NULL;
8292
0
    }
8293
51.9k
    if (!ctx) {
8294
0
        PyErr_SetString(PyExc_ValueError,
8295
0
                        "field 'ctx' is required for Attribute");
8296
0
        return NULL;
8297
0
    }
8298
51.9k
    p = (expr_ty)_PyArena_Malloc(arena, sizeof(*p));
8299
51.9k
    if (!p)
8300
0
        return NULL;
8301
51.9k
    p->kind = Attribute_kind;
8302
51.9k
    p->v.Attribute.value = value;
8303
51.9k
    p->v.Attribute.attr = attr;
8304
51.9k
    p->v.Attribute.ctx = ctx;
8305
51.9k
    p->lineno = lineno;
8306
51.9k
    p->col_offset = col_offset;
8307
51.9k
    p->end_lineno = end_lineno;
8308
51.9k
    p->end_col_offset = end_col_offset;
8309
51.9k
    return p;
8310
51.9k
}
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
10.4k
{
8317
10.4k
    expr_ty p;
8318
10.4k
    if (!value) {
8319
0
        PyErr_SetString(PyExc_ValueError,
8320
0
                        "field 'value' is required for Subscript");
8321
0
        return NULL;
8322
0
    }
8323
10.4k
    if (!slice) {
8324
0
        PyErr_SetString(PyExc_ValueError,
8325
0
                        "field 'slice' is required for Subscript");
8326
0
        return NULL;
8327
0
    }
8328
10.4k
    if (!ctx) {
8329
0
        PyErr_SetString(PyExc_ValueError,
8330
0
                        "field 'ctx' is required for Subscript");
8331
0
        return NULL;
8332
0
    }
8333
10.4k
    p = (expr_ty)_PyArena_Malloc(arena, sizeof(*p));
8334
10.4k
    if (!p)
8335
0
        return NULL;
8336
10.4k
    p->kind = Subscript_kind;
8337
10.4k
    p->v.Subscript.value = value;
8338
10.4k
    p->v.Subscript.slice = slice;
8339
10.4k
    p->v.Subscript.ctx = ctx;
8340
10.4k
    p->lineno = lineno;
8341
10.4k
    p->col_offset = col_offset;
8342
10.4k
    p->end_lineno = end_lineno;
8343
10.4k
    p->end_col_offset = end_col_offset;
8344
10.4k
    return p;
8345
10.4k
}
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
20.8k
{
8351
20.8k
    expr_ty p;
8352
20.8k
    if (!value) {
8353
0
        PyErr_SetString(PyExc_ValueError,
8354
0
                        "field 'value' is required for Starred");
8355
0
        return NULL;
8356
0
    }
8357
20.8k
    if (!ctx) {
8358
0
        PyErr_SetString(PyExc_ValueError,
8359
0
                        "field 'ctx' is required for Starred");
8360
0
        return NULL;
8361
0
    }
8362
20.8k
    p = (expr_ty)_PyArena_Malloc(arena, sizeof(*p));
8363
20.8k
    if (!p)
8364
0
        return NULL;
8365
20.8k
    p->kind = Starred_kind;
8366
20.8k
    p->v.Starred.value = value;
8367
20.8k
    p->v.Starred.ctx = ctx;
8368
20.8k
    p->lineno = lineno;
8369
20.8k
    p->col_offset = col_offset;
8370
20.8k
    p->end_lineno = end_lineno;
8371
20.8k
    p->end_col_offset = end_col_offset;
8372
20.8k
    return p;
8373
20.8k
}
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.49M
{
8379
2.49M
    expr_ty p;
8380
2.49M
    if (!id) {
8381
0
        PyErr_SetString(PyExc_ValueError,
8382
0
                        "field 'id' is required for Name");
8383
0
        return NULL;
8384
0
    }
8385
2.49M
    if (!ctx) {
8386
0
        PyErr_SetString(PyExc_ValueError,
8387
0
                        "field 'ctx' is required for Name");
8388
0
        return NULL;
8389
0
    }
8390
2.49M
    p = (expr_ty)_PyArena_Malloc(arena, sizeof(*p));
8391
2.49M
    if (!p)
8392
0
        return NULL;
8393
2.49M
    p->kind = Name_kind;
8394
2.49M
    p->v.Name.id = id;
8395
2.49M
    p->v.Name.ctx = ctx;
8396
2.49M
    p->lineno = lineno;
8397
2.49M
    p->col_offset = col_offset;
8398
2.49M
    p->end_lineno = end_lineno;
8399
2.49M
    p->end_col_offset = end_col_offset;
8400
2.49M
    return p;
8401
2.49M
}
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.4k
{
8407
21.4k
    expr_ty p;
8408
21.4k
    if (!ctx) {
8409
0
        PyErr_SetString(PyExc_ValueError,
8410
0
                        "field 'ctx' is required for List");
8411
0
        return NULL;
8412
0
    }
8413
21.4k
    p = (expr_ty)_PyArena_Malloc(arena, sizeof(*p));
8414
21.4k
    if (!p)
8415
0
        return NULL;
8416
21.4k
    p->kind = List_kind;
8417
21.4k
    p->v.List.elts = elts;
8418
21.4k
    p->v.List.ctx = ctx;
8419
21.4k
    p->lineno = lineno;
8420
21.4k
    p->col_offset = col_offset;
8421
21.4k
    p->end_lineno = end_lineno;
8422
21.4k
    p->end_col_offset = end_col_offset;
8423
21.4k
    return p;
8424
21.4k
}
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
84.1k
{
8430
84.1k
    expr_ty p;
8431
84.1k
    if (!ctx) {
8432
0
        PyErr_SetString(PyExc_ValueError,
8433
0
                        "field 'ctx' is required for Tuple");
8434
0
        return NULL;
8435
0
    }
8436
84.1k
    p = (expr_ty)_PyArena_Malloc(arena, sizeof(*p));
8437
84.1k
    if (!p)
8438
0
        return NULL;
8439
84.1k
    p->kind = Tuple_kind;
8440
84.1k
    p->v.Tuple.elts = elts;
8441
84.1k
    p->v.Tuple.ctx = ctx;
8442
84.1k
    p->lineno = lineno;
8443
84.1k
    p->col_offset = col_offset;
8444
84.1k
    p->end_lineno = end_lineno;
8445
84.1k
    p->end_col_offset = end_col_offset;
8446
84.1k
    return p;
8447
84.1k
}
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
13.4k
{
8453
13.4k
    expr_ty p;
8454
13.4k
    p = (expr_ty)_PyArena_Malloc(arena, sizeof(*p));
8455
13.4k
    if (!p)
8456
0
        return NULL;
8457
13.4k
    p->kind = Slice_kind;
8458
13.4k
    p->v.Slice.lower = lower;
8459
13.4k
    p->v.Slice.upper = upper;
8460
13.4k
    p->v.Slice.step = step;
8461
13.4k
    p->lineno = lineno;
8462
13.4k
    p->col_offset = col_offset;
8463
13.4k
    p->end_lineno = end_lineno;
8464
13.4k
    p->end_col_offset = end_col_offset;
8465
13.4k
    return p;
8466
13.4k
}
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.4k
{
8472
11.4k
    comprehension_ty p;
8473
11.4k
    if (!target) {
8474
0
        PyErr_SetString(PyExc_ValueError,
8475
0
                        "field 'target' is required for comprehension");
8476
0
        return NULL;
8477
0
    }
8478
11.4k
    if (!iter) {
8479
0
        PyErr_SetString(PyExc_ValueError,
8480
0
                        "field 'iter' is required for comprehension");
8481
0
        return NULL;
8482
0
    }
8483
11.4k
    p = (comprehension_ty)_PyArena_Malloc(arena, sizeof(*p));
8484
11.4k
    if (!p)
8485
0
        return NULL;
8486
11.4k
    p->target = target;
8487
11.4k
    p->iter = iter;
8488
11.4k
    p->ifs = ifs;
8489
11.4k
    p->is_async = is_async;
8490
11.4k
    return p;
8491
11.4k
}
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.4k
{
8498
10.4k
    excepthandler_ty p;
8499
10.4k
    p = (excepthandler_ty)_PyArena_Malloc(arena, sizeof(*p));
8500
10.4k
    if (!p)
8501
0
        return NULL;
8502
10.4k
    p->kind = ExceptHandler_kind;
8503
10.4k
    p->v.ExceptHandler.type = type;
8504
10.4k
    p->v.ExceptHandler.name = name;
8505
10.4k
    p->v.ExceptHandler.body = body;
8506
10.4k
    p->lineno = lineno;
8507
10.4k
    p->col_offset = col_offset;
8508
10.4k
    p->end_lineno = end_lineno;
8509
10.4k
    p->end_col_offset = end_col_offset;
8510
10.4k
    return p;
8511
10.4k
}
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
20.8k
{
8519
20.8k
    arguments_ty p;
8520
20.8k
    p = (arguments_ty)_PyArena_Malloc(arena, sizeof(*p));
8521
20.8k
    if (!p)
8522
0
        return NULL;
8523
20.8k
    p->posonlyargs = posonlyargs;
8524
20.8k
    p->args = args;
8525
20.8k
    p->vararg = vararg;
8526
20.8k
    p->kwonlyargs = kwonlyargs;
8527
20.8k
    p->kw_defaults = kw_defaults;
8528
20.8k
    p->kwarg = kwarg;
8529
20.8k
    p->defaults = defaults;
8530
20.8k
    return p;
8531
20.8k
}
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
515k
{
8537
515k
    arg_ty p;
8538
515k
    if (!arg) {
8539
0
        PyErr_SetString(PyExc_ValueError,
8540
0
                        "field 'arg' is required for arg");
8541
0
        return NULL;
8542
0
    }
8543
515k
    p = (arg_ty)_PyArena_Malloc(arena, sizeof(*p));
8544
515k
    if (!p)
8545
0
        return NULL;
8546
515k
    p->arg = arg;
8547
515k
    p->annotation = annotation;
8548
515k
    p->type_comment = type_comment;
8549
515k
    p->lineno = lineno;
8550
515k
    p->col_offset = col_offset;
8551
515k
    p->end_lineno = end_lineno;
8552
515k
    p->end_col_offset = end_col_offset;
8553
515k
    return p;
8554
515k
}
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
33.8k
{
8560
33.8k
    keyword_ty p;
8561
33.8k
    if (!value) {
8562
0
        PyErr_SetString(PyExc_ValueError,
8563
0
                        "field 'value' is required for keyword");
8564
0
        return NULL;
8565
0
    }
8566
33.8k
    p = (keyword_ty)_PyArena_Malloc(arena, sizeof(*p));
8567
33.8k
    if (!p)
8568
0
        return NULL;
8569
33.8k
    p->arg = arg;
8570
33.8k
    p->value = value;
8571
33.8k
    p->lineno = lineno;
8572
33.8k
    p->col_offset = col_offset;
8573
33.8k
    p->end_lineno = end_lineno;
8574
33.8k
    p->end_col_offset = end_col_offset;
8575
33.8k
    return p;
8576
33.8k
}
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
16.0k
{
8582
16.0k
    alias_ty p;
8583
16.0k
    if (!name) {
8584
0
        PyErr_SetString(PyExc_ValueError,
8585
0
                        "field 'name' is required for alias");
8586
0
        return NULL;
8587
0
    }
8588
16.0k
    p = (alias_ty)_PyArena_Malloc(arena, sizeof(*p));
8589
16.0k
    if (!p)
8590
0
        return NULL;
8591
16.0k
    p->name = name;
8592
16.0k
    p->asname = asname;
8593
16.0k
    p->lineno = lineno;
8594
16.0k
    p->col_offset = col_offset;
8595
16.0k
    p->end_lineno = end_lineno;
8596
16.0k
    p->end_col_offset = end_col_offset;
8597
16.0k
    return p;
8598
16.0k
}
8599
8600
withitem_ty
8601
_PyAST_withitem(expr_ty context_expr, expr_ty optional_vars, PyArena *arena)
8602
8.48k
{
8603
8.48k
    withitem_ty p;
8604
8.48k
    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
8.48k
    p = (withitem_ty)_PyArena_Malloc(arena, sizeof(*p));
8610
8.48k
    if (!p)
8611
0
        return NULL;
8612
8.48k
    p->context_expr = context_expr;
8613
8.48k
    p->optional_vars = optional_vars;
8614
8.48k
    return p;
8615
8.48k
}
8616
8617
match_case_ty
8618
_PyAST_match_case(pattern_ty pattern, expr_ty guard, asdl_stmt_seq * body,
8619
                  PyArena *arena)
8620
3.22k
{
8621
3.22k
    match_case_ty p;
8622
3.22k
    if (!pattern) {
8623
0
        PyErr_SetString(PyExc_ValueError,
8624
0
                        "field 'pattern' is required for match_case");
8625
0
        return NULL;
8626
0
    }
8627
3.22k
    p = (match_case_ty)_PyArena_Malloc(arena, sizeof(*p));
8628
3.22k
    if (!p)
8629
0
        return NULL;
8630
3.22k
    p->pattern = pattern;
8631
3.22k
    p->guard = guard;
8632
3.22k
    p->body = body;
8633
3.22k
    return p;
8634
3.22k
}
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
2.80k
{
8640
2.80k
    pattern_ty p;
8641
2.80k
    if (!value) {
8642
0
        PyErr_SetString(PyExc_ValueError,
8643
0
                        "field 'value' is required for MatchValue");
8644
0
        return NULL;
8645
0
    }
8646
2.80k
    p = (pattern_ty)_PyArena_Malloc(arena, sizeof(*p));
8647
2.80k
    if (!p)
8648
0
        return NULL;
8649
2.80k
    p->kind = MatchValue_kind;
8650
2.80k
    p->v.MatchValue.value = value;
8651
2.80k
    p->lineno = lineno;
8652
2.80k
    p->col_offset = col_offset;
8653
2.80k
    p->end_lineno = end_lineno;
8654
2.80k
    p->end_col_offset = end_col_offset;
8655
2.80k
    return p;
8656
2.80k
}
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
775
{
8662
775
    pattern_ty p;
8663
775
    if (!value) {
8664
0
        PyErr_SetString(PyExc_ValueError,
8665
0
                        "field 'value' is required for MatchSingleton");
8666
0
        return NULL;
8667
0
    }
8668
775
    p = (pattern_ty)_PyArena_Malloc(arena, sizeof(*p));
8669
775
    if (!p)
8670
0
        return NULL;
8671
775
    p->kind = MatchSingleton_kind;
8672
775
    p->v.MatchSingleton.value = value;
8673
775
    p->lineno = lineno;
8674
775
    p->col_offset = col_offset;
8675
775
    p->end_lineno = end_lineno;
8676
775
    p->end_col_offset = end_col_offset;
8677
775
    return p;
8678
775
}
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.56k
{
8684
3.56k
    pattern_ty p;
8685
3.56k
    p = (pattern_ty)_PyArena_Malloc(arena, sizeof(*p));
8686
3.56k
    if (!p)
8687
0
        return NULL;
8688
3.56k
    p->kind = MatchSequence_kind;
8689
3.56k
    p->v.MatchSequence.patterns = patterns;
8690
3.56k
    p->lineno = lineno;
8691
3.56k
    p->col_offset = col_offset;
8692
3.56k
    p->end_lineno = end_lineno;
8693
3.56k
    p->end_col_offset = end_col_offset;
8694
3.56k
    return p;
8695
3.56k
}
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
1.51k
{
8702
1.51k
    pattern_ty p;
8703
1.51k
    p = (pattern_ty)_PyArena_Malloc(arena, sizeof(*p));
8704
1.51k
    if (!p)
8705
0
        return NULL;
8706
1.51k
    p->kind = MatchMapping_kind;
8707
1.51k
    p->v.MatchMapping.keys = keys;
8708
1.51k
    p->v.MatchMapping.patterns = patterns;
8709
1.51k
    p->v.MatchMapping.rest = rest;
8710
1.51k
    p->lineno = lineno;
8711
1.51k
    p->col_offset = col_offset;
8712
1.51k
    p->end_lineno = end_lineno;
8713
1.51k
    p->end_col_offset = end_col_offset;
8714
1.51k
    return p;
8715
1.51k
}
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.43k
{
8723
2.43k
    pattern_ty p;
8724
2.43k
    if (!cls) {
8725
0
        PyErr_SetString(PyExc_ValueError,
8726
0
                        "field 'cls' is required for MatchClass");
8727
0
        return NULL;
8728
0
    }
8729
2.43k
    p = (pattern_ty)_PyArena_Malloc(arena, sizeof(*p));
8730
2.43k
    if (!p)
8731
0
        return NULL;
8732
2.43k
    p->kind = MatchClass_kind;
8733
2.43k
    p->v.MatchClass.cls = cls;
8734
2.43k
    p->v.MatchClass.patterns = patterns;
8735
2.43k
    p->v.MatchClass.kwd_attrs = kwd_attrs;
8736
2.43k
    p->v.MatchClass.kwd_patterns = kwd_patterns;
8737
2.43k
    p->lineno = lineno;
8738
2.43k
    p->col_offset = col_offset;
8739
2.43k
    p->end_lineno = end_lineno;
8740
2.43k
    p->end_col_offset = end_col_offset;
8741
2.43k
    return p;
8742
2.43k
}
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.42k
{
8748
1.42k
    pattern_ty p;
8749
1.42k
    p = (pattern_ty)_PyArena_Malloc(arena, sizeof(*p));
8750
1.42k
    if (!p)
8751
0
        return NULL;
8752
1.42k
    p->kind = MatchStar_kind;
8753
1.42k
    p->v.MatchStar.name = name;
8754
1.42k
    p->lineno = lineno;
8755
1.42k
    p->col_offset = col_offset;
8756
1.42k
    p->end_lineno = end_lineno;
8757
1.42k
    p->end_col_offset = end_col_offset;
8758
1.42k
    return p;
8759
1.42k
}
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
20.9k
{
8765
20.9k
    pattern_ty p;
8766
20.9k
    p = (pattern_ty)_PyArena_Malloc(arena, sizeof(*p));
8767
20.9k
    if (!p)
8768
0
        return NULL;
8769
20.9k
    p->kind = MatchAs_kind;
8770
20.9k
    p->v.MatchAs.pattern = pattern;
8771
20.9k
    p->v.MatchAs.name = name;
8772
20.9k
    p->lineno = lineno;
8773
20.9k
    p->col_offset = col_offset;
8774
20.9k
    p->end_lineno = end_lineno;
8775
20.9k
    p->end_col_offset = end_col_offset;
8776
20.9k
    return p;
8777
20.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
7.06k
{
8783
7.06k
    pattern_ty p;
8784
7.06k
    p = (pattern_ty)_PyArena_Malloc(arena, sizeof(*p));
8785
7.06k
    if (!p)
8786
0
        return NULL;
8787
7.06k
    p->kind = MatchOr_kind;
8788
7.06k
    p->v.MatchOr.patterns = patterns;
8789
7.06k
    p->lineno = lineno;
8790
7.06k
    p->col_offset = col_offset;
8791
7.06k
    p->end_lineno = end_lineno;
8792
7.06k
    p->end_col_offset = end_col_offset;
8793
7.06k
    return p;
8794
7.06k
}
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.53k
{
8819
6.53k
    type_param_ty p;
8820
6.53k
    if (!name) {
8821
0
        PyErr_SetString(PyExc_ValueError,
8822
0
                        "field 'name' is required for TypeVar");
8823
0
        return NULL;
8824
0
    }
8825
6.53k
    p = (type_param_ty)_PyArena_Malloc(arena, sizeof(*p));
8826
6.53k
    if (!p)
8827
0
        return NULL;
8828
6.53k
    p->kind = TypeVar_kind;
8829
6.53k
    p->v.TypeVar.name = name;
8830
6.53k
    p->v.TypeVar.bound = bound;
8831
6.53k
    p->v.TypeVar.default_value = default_value;
8832
6.53k
    p->lineno = lineno;
8833
6.53k
    p->col_offset = col_offset;
8834
6.53k
    p->end_lineno = end_lineno;
8835
6.53k
    p->end_col_offset = end_col_offset;
8836
6.53k
    return p;
8837
6.53k
}
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.48k
{
8867
1.48k
    type_param_ty p;
8868
1.48k
    if (!name) {
8869
0
        PyErr_SetString(PyExc_ValueError,
8870
0
                        "field 'name' is required for TypeVarTuple");
8871
0
        return NULL;
8872
0
    }
8873
1.48k
    p = (type_param_ty)_PyArena_Malloc(arena, sizeof(*p));
8874
1.48k
    if (!p)
8875
0
        return NULL;
8876
1.48k
    p->kind = TypeVarTuple_kind;
8877
1.48k
    p->v.TypeVarTuple.name = name;
8878
1.48k
    p->v.TypeVarTuple.default_value = default_value;
8879
1.48k
    p->lineno = lineno;
8880
1.48k
    p->col_offset = col_offset;
8881
1.48k
    p->end_lineno = end_lineno;
8882
1.48k
    p->end_col_offset = end_col_offset;
8883
1.48k
    return p;
8884
1.48k
}
8885
8886
8887
PyObject*
8888
ast2obj_mod(struct ast_state *state, void* _o)
8889
6.22k
{
8890
6.22k
    mod_ty o = (mod_ty)_o;
8891
6.22k
    PyObject *result = NULL, *value = NULL;
8892
6.22k
    PyTypeObject *tp;
8893
6.22k
    if (!o) {
8894
0
        Py_RETURN_NONE;
8895
0
    }
8896
6.22k
    if (Py_EnterRecursiveCall("during  ast construction")) {
8897
0
        return NULL;
8898
0
    }
8899
6.22k
    switch (o->kind) {
8900
6.22k
    case Module_kind:
8901
6.22k
        tp = (PyTypeObject *)state->Module_type;
8902
6.22k
        result = PyType_GenericNew(tp, NULL, NULL);
8903
6.22k
        if (!result) goto failed;
8904
6.22k
        value = ast2obj_list(state, (asdl_seq*)o->v.Module.body, ast2obj_stmt);
8905
6.22k
        if (!value) goto failed;
8906
6.22k
        if (PyObject_SetAttr(result, state->body, value) == -1)
8907
0
            goto failed;
8908
6.22k
        Py_DECREF(value);
8909
6.22k
        value = ast2obj_list(state, (asdl_seq*)o->v.Module.type_ignores,
8910
6.22k
                             ast2obj_type_ignore);
8911
6.22k
        if (!value) goto failed;
8912
6.22k
        if (PyObject_SetAttr(result, state->type_ignores, value) == -1)
8913
0
            goto failed;
8914
6.22k
        Py_DECREF(value);
8915
6.22k
        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.22k
    }
8954
6.22k
    Py_LeaveRecursiveCall();
8955
6.22k
    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.22k
}
8962
8963
PyObject*
8964
ast2obj_stmt(struct ast_state *state, void* _o)
8965
45.4k
{
8966
45.4k
    stmt_ty o = (stmt_ty)_o;
8967
45.4k
    PyObject *result = NULL, *value = NULL;
8968
45.4k
    PyTypeObject *tp;
8969
45.4k
    if (!o) {
8970
0
        Py_RETURN_NONE;
8971
0
    }
8972
45.4k
    if (Py_EnterRecursiveCall("during  ast construction")) {
8973
0
        return NULL;
8974
0
    }
8975
45.4k
    switch (o->kind) {
8976
1.62k
    case FunctionDef_kind:
8977
1.62k
        tp = (PyTypeObject *)state->FunctionDef_type;
8978
1.62k
        result = PyType_GenericNew(tp, NULL, NULL);
8979
1.62k
        if (!result) goto failed;
8980
1.62k
        value = ast2obj_identifier(state, o->v.FunctionDef.name);
8981
1.62k
        if (!value) goto failed;
8982
1.62k
        if (PyObject_SetAttr(result, state->name, value) == -1)
8983
0
            goto failed;
8984
1.62k
        Py_DECREF(value);
8985
1.62k
        value = ast2obj_arguments(state, o->v.FunctionDef.args);
8986
1.62k
        if (!value) goto failed;
8987
1.62k
        if (PyObject_SetAttr(result, state->args, value) == -1)
8988
0
            goto failed;
8989
1.62k
        Py_DECREF(value);
8990
1.62k
        value = ast2obj_list(state, (asdl_seq*)o->v.FunctionDef.body,
8991
1.62k
                             ast2obj_stmt);
8992
1.62k
        if (!value) goto failed;
8993
1.62k
        if (PyObject_SetAttr(result, state->body, value) == -1)
8994
0
            goto failed;
8995
1.62k
        Py_DECREF(value);
8996
1.62k
        value = ast2obj_list(state, (asdl_seq*)o->v.FunctionDef.decorator_list,
8997
1.62k
                             ast2obj_expr);
8998
1.62k
        if (!value) goto failed;
8999
1.62k
        if (PyObject_SetAttr(result, state->decorator_list, value) == -1)
9000
0
            goto failed;
9001
1.62k
        Py_DECREF(value);
9002
1.62k
        value = ast2obj_expr(state, o->v.FunctionDef.returns);
9003
1.62k
        if (!value) goto failed;
9004
1.62k
        if (PyObject_SetAttr(result, state->returns, value) == -1)
9005
0
            goto failed;
9006
1.62k
        Py_DECREF(value);
9007
1.62k
        value = ast2obj_string(state, o->v.FunctionDef.type_comment);
9008
1.62k
        if (!value) goto failed;
9009
1.62k
        if (PyObject_SetAttr(result, state->type_comment, value) == -1)
9010
0
            goto failed;
9011
1.62k
        Py_DECREF(value);
9012
1.62k
        value = ast2obj_list(state, (asdl_seq*)o->v.FunctionDef.type_params,
9013
1.62k
                             ast2obj_type_param);
9014
1.62k
        if (!value) goto failed;
9015
1.62k
        if (PyObject_SetAttr(result, state->type_params, value) == -1)
9016
0
            goto failed;
9017
1.62k
        Py_DECREF(value);
9018
1.62k
        break;
9019
177
    case AsyncFunctionDef_kind:
9020
177
        tp = (PyTypeObject *)state->AsyncFunctionDef_type;
9021
177
        result = PyType_GenericNew(tp, NULL, NULL);
9022
177
        if (!result) goto failed;
9023
177
        value = ast2obj_identifier(state, o->v.AsyncFunctionDef.name);
9024
177
        if (!value) goto failed;
9025
177
        if (PyObject_SetAttr(result, state->name, value) == -1)
9026
0
            goto failed;
9027
177
        Py_DECREF(value);
9028
177
        value = ast2obj_arguments(state, o->v.AsyncFunctionDef.args);
9029
177
        if (!value) goto failed;
9030
177
        if (PyObject_SetAttr(result, state->args, value) == -1)
9031
0
            goto failed;
9032
177
        Py_DECREF(value);
9033
177
        value = ast2obj_list(state, (asdl_seq*)o->v.AsyncFunctionDef.body,
9034
177
                             ast2obj_stmt);
9035
177
        if (!value) goto failed;
9036
177
        if (PyObject_SetAttr(result, state->body, value) == -1)
9037
0
            goto failed;
9038
177
        Py_DECREF(value);
9039
177
        value = ast2obj_list(state,
9040
177
                             (asdl_seq*)o->v.AsyncFunctionDef.decorator_list,
9041
177
                             ast2obj_expr);
9042
177
        if (!value) goto failed;
9043
177
        if (PyObject_SetAttr(result, state->decorator_list, value) == -1)
9044
0
            goto failed;
9045
177
        Py_DECREF(value);
9046
177
        value = ast2obj_expr(state, o->v.AsyncFunctionDef.returns);
9047
177
        if (!value) goto failed;
9048
177
        if (PyObject_SetAttr(result, state->returns, value) == -1)
9049
0
            goto failed;
9050
177
        Py_DECREF(value);
9051
177
        value = ast2obj_string(state, o->v.AsyncFunctionDef.type_comment);
9052
177
        if (!value) goto failed;
9053
177
        if (PyObject_SetAttr(result, state->type_comment, value) == -1)
9054
0
            goto failed;
9055
177
        Py_DECREF(value);
9056
177
        value = ast2obj_list(state,
9057
177
                             (asdl_seq*)o->v.AsyncFunctionDef.type_params,
9058
177
                             ast2obj_type_param);
9059
177
        if (!value) goto failed;
9060
177
        if (PyObject_SetAttr(result, state->type_params, value) == -1)
9061
0
            goto failed;
9062
177
        Py_DECREF(value);
9063
177
        break;
9064
554
    case ClassDef_kind:
9065
554
        tp = (PyTypeObject *)state->ClassDef_type;
9066
554
        result = PyType_GenericNew(tp, NULL, NULL);
9067
554
        if (!result) goto failed;
9068
554
        value = ast2obj_identifier(state, o->v.ClassDef.name);
9069
554
        if (!value) goto failed;
9070
554
        if (PyObject_SetAttr(result, state->name, value) == -1)
9071
0
            goto failed;
9072
554
        Py_DECREF(value);
9073
554
        value = ast2obj_list(state, (asdl_seq*)o->v.ClassDef.bases,
9074
554
                             ast2obj_expr);
9075
554
        if (!value) goto failed;
9076
554
        if (PyObject_SetAttr(result, state->bases, value) == -1)
9077
0
            goto failed;
9078
554
        Py_DECREF(value);
9079
554
        value = ast2obj_list(state, (asdl_seq*)o->v.ClassDef.keywords,
9080
554
                             ast2obj_keyword);
9081
554
        if (!value) goto failed;
9082
554
        if (PyObject_SetAttr(result, state->keywords, value) == -1)
9083
0
            goto failed;
9084
554
        Py_DECREF(value);
9085
554
        value = ast2obj_list(state, (asdl_seq*)o->v.ClassDef.body,
9086
554
                             ast2obj_stmt);
9087
554
        if (!value) goto failed;
9088
554
        if (PyObject_SetAttr(result, state->body, value) == -1)
9089
0
            goto failed;
9090
554
        Py_DECREF(value);
9091
554
        value = ast2obj_list(state, (asdl_seq*)o->v.ClassDef.decorator_list,
9092
554
                             ast2obj_expr);
9093
554
        if (!value) goto failed;
9094
554
        if (PyObject_SetAttr(result, state->decorator_list, value) == -1)
9095
0
            goto failed;
9096
554
        Py_DECREF(value);
9097
554
        value = ast2obj_list(state, (asdl_seq*)o->v.ClassDef.type_params,
9098
554
                             ast2obj_type_param);
9099
554
        if (!value) goto failed;
9100
554
        if (PyObject_SetAttr(result, state->type_params, value) == -1)
9101
0
            goto failed;
9102
554
        Py_DECREF(value);
9103
554
        break;
9104
476
    case Return_kind:
9105
476
        tp = (PyTypeObject *)state->Return_type;
9106
476
        result = PyType_GenericNew(tp, NULL, NULL);
9107
476
        if (!result) goto failed;
9108
476
        value = ast2obj_expr(state, o->v.Return.value);
9109
476
        if (!value) goto failed;
9110
476
        if (PyObject_SetAttr(result, state->value, value) == -1)
9111
0
            goto failed;
9112
476
        Py_DECREF(value);
9113
476
        break;
9114
455
    case Delete_kind:
9115
455
        tp = (PyTypeObject *)state->Delete_type;
9116
455
        result = PyType_GenericNew(tp, NULL, NULL);
9117
455
        if (!result) goto failed;
9118
455
        value = ast2obj_list(state, (asdl_seq*)o->v.Delete.targets,
9119
455
                             ast2obj_expr);
9120
455
        if (!value) goto failed;
9121
455
        if (PyObject_SetAttr(result, state->targets, value) == -1)
9122
0
            goto failed;
9123
455
        Py_DECREF(value);
9124
455
        break;
9125
527
    case Assign_kind:
9126
527
        tp = (PyTypeObject *)state->Assign_type;
9127
527
        result = PyType_GenericNew(tp, NULL, NULL);
9128
527
        if (!result) goto failed;
9129
527
        value = ast2obj_list(state, (asdl_seq*)o->v.Assign.targets,
9130
527
                             ast2obj_expr);
9131
527
        if (!value) goto failed;
9132
527
        if (PyObject_SetAttr(result, state->targets, value) == -1)
9133
0
            goto failed;
9134
527
        Py_DECREF(value);
9135
527
        value = ast2obj_expr(state, o->v.Assign.value);
9136
527
        if (!value) goto failed;
9137
527
        if (PyObject_SetAttr(result, state->value, value) == -1)
9138
0
            goto failed;
9139
527
        Py_DECREF(value);
9140
527
        value = ast2obj_string(state, o->v.Assign.type_comment);
9141
527
        if (!value) goto failed;
9142
527
        if (PyObject_SetAttr(result, state->type_comment, value) == -1)
9143
0
            goto failed;
9144
527
        Py_DECREF(value);
9145
527
        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
234
    case AugAssign_kind:
9168
234
        tp = (PyTypeObject *)state->AugAssign_type;
9169
234
        result = PyType_GenericNew(tp, NULL, NULL);
9170
234
        if (!result) goto failed;
9171
234
        value = ast2obj_expr(state, o->v.AugAssign.target);
9172
234
        if (!value) goto failed;
9173
234
        if (PyObject_SetAttr(result, state->target, value) == -1)
9174
0
            goto failed;
9175
234
        Py_DECREF(value);
9176
234
        value = ast2obj_operator(state, o->v.AugAssign.op);
9177
234
        if (!value) goto failed;
9178
234
        if (PyObject_SetAttr(result, state->op, value) == -1)
9179
0
            goto failed;
9180
234
        Py_DECREF(value);
9181
234
        value = ast2obj_expr(state, o->v.AugAssign.value);
9182
234
        if (!value) goto failed;
9183
234
        if (PyObject_SetAttr(result, state->value, value) == -1)
9184
0
            goto failed;
9185
234
        Py_DECREF(value);
9186
234
        break;
9187
1.05k
    case AnnAssign_kind:
9188
1.05k
        tp = (PyTypeObject *)state->AnnAssign_type;
9189
1.05k
        result = PyType_GenericNew(tp, NULL, NULL);
9190
1.05k
        if (!result) goto failed;
9191
1.05k
        value = ast2obj_expr(state, o->v.AnnAssign.target);
9192
1.05k
        if (!value) goto failed;
9193
1.05k
        if (PyObject_SetAttr(result, state->target, value) == -1)
9194
0
            goto failed;
9195
1.05k
        Py_DECREF(value);
9196
1.05k
        value = ast2obj_expr(state, o->v.AnnAssign.annotation);
9197
1.05k
        if (!value) goto failed;
9198
1.05k
        if (PyObject_SetAttr(result, state->annotation, value) == -1)
9199
0
            goto failed;
9200
1.05k
        Py_DECREF(value);
9201
1.05k
        value = ast2obj_expr(state, o->v.AnnAssign.value);
9202
1.05k
        if (!value) goto failed;
9203
1.05k
        if (PyObject_SetAttr(result, state->value, value) == -1)
9204
0
            goto failed;
9205
1.05k
        Py_DECREF(value);
9206
1.05k
        value = ast2obj_int(state, o->v.AnnAssign.simple);
9207
1.05k
        if (!value) goto failed;
9208
1.05k
        if (PyObject_SetAttr(result, state->simple, value) == -1)
9209
0
            goto failed;
9210
1.05k
        Py_DECREF(value);
9211
1.05k
        break;
9212
277
    case For_kind:
9213
277
        tp = (PyTypeObject *)state->For_type;
9214
277
        result = PyType_GenericNew(tp, NULL, NULL);
9215
277
        if (!result) goto failed;
9216
277
        value = ast2obj_expr(state, o->v.For.target);
9217
277
        if (!value) goto failed;
9218
277
        if (PyObject_SetAttr(result, state->target, value) == -1)
9219
0
            goto failed;
9220
277
        Py_DECREF(value);
9221
277
        value = ast2obj_expr(state, o->v.For.iter);
9222
277
        if (!value) goto failed;
9223
277
        if (PyObject_SetAttr(result, state->iter, value) == -1)
9224
0
            goto failed;
9225
277
        Py_DECREF(value);
9226
277
        value = ast2obj_list(state, (asdl_seq*)o->v.For.body, ast2obj_stmt);
9227
277
        if (!value) goto failed;
9228
277
        if (PyObject_SetAttr(result, state->body, value) == -1)
9229
0
            goto failed;
9230
277
        Py_DECREF(value);
9231
277
        value = ast2obj_list(state, (asdl_seq*)o->v.For.orelse, ast2obj_stmt);
9232
277
        if (!value) goto failed;
9233
277
        if (PyObject_SetAttr(result, state->orelse, value) == -1)
9234
0
            goto failed;
9235
277
        Py_DECREF(value);
9236
277
        value = ast2obj_string(state, o->v.For.type_comment);
9237
277
        if (!value) goto failed;
9238
277
        if (PyObject_SetAttr(result, state->type_comment, value) == -1)
9239
0
            goto failed;
9240
277
        Py_DECREF(value);
9241
277
        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
297
    case While_kind:
9275
297
        tp = (PyTypeObject *)state->While_type;
9276
297
        result = PyType_GenericNew(tp, NULL, NULL);
9277
297
        if (!result) goto failed;
9278
297
        value = ast2obj_expr(state, o->v.While.test);
9279
297
        if (!value) goto failed;
9280
297
        if (PyObject_SetAttr(result, state->test, value) == -1)
9281
0
            goto failed;
9282
297
        Py_DECREF(value);
9283
297
        value = ast2obj_list(state, (asdl_seq*)o->v.While.body, ast2obj_stmt);
9284
297
        if (!value) goto failed;
9285
297
        if (PyObject_SetAttr(result, state->body, value) == -1)
9286
0
            goto failed;
9287
297
        Py_DECREF(value);
9288
297
        value = ast2obj_list(state, (asdl_seq*)o->v.While.orelse, ast2obj_stmt);
9289
297
        if (!value) goto failed;
9290
297
        if (PyObject_SetAttr(result, state->orelse, value) == -1)
9291
0
            goto failed;
9292
297
        Py_DECREF(value);
9293
297
        break;
9294
297
    case If_kind:
9295
297
        tp = (PyTypeObject *)state->If_type;
9296
297
        result = PyType_GenericNew(tp, NULL, NULL);
9297
297
        if (!result) goto failed;
9298
297
        value = ast2obj_expr(state, o->v.If.test);
9299
297
        if (!value) goto failed;
9300
297
        if (PyObject_SetAttr(result, state->test, value) == -1)
9301
0
            goto failed;
9302
297
        Py_DECREF(value);
9303
297
        value = ast2obj_list(state, (asdl_seq*)o->v.If.body, ast2obj_stmt);
9304
297
        if (!value) goto failed;
9305
297
        if (PyObject_SetAttr(result, state->body, value) == -1)
9306
0
            goto failed;
9307
297
        Py_DECREF(value);
9308
297
        value = ast2obj_list(state, (asdl_seq*)o->v.If.orelse, ast2obj_stmt);
9309
297
        if (!value) goto failed;
9310
297
        if (PyObject_SetAttr(result, state->orelse, value) == -1)
9311
0
            goto failed;
9312
297
        Py_DECREF(value);
9313
297
        break;
9314
189
    case With_kind:
9315
189
        tp = (PyTypeObject *)state->With_type;
9316
189
        result = PyType_GenericNew(tp, NULL, NULL);
9317
189
        if (!result) goto failed;
9318
189
        value = ast2obj_list(state, (asdl_seq*)o->v.With.items,
9319
189
                             ast2obj_withitem);
9320
189
        if (!value) goto failed;
9321
189
        if (PyObject_SetAttr(result, state->items, value) == -1)
9322
0
            goto failed;
9323
189
        Py_DECREF(value);
9324
189
        value = ast2obj_list(state, (asdl_seq*)o->v.With.body, ast2obj_stmt);
9325
189
        if (!value) goto failed;
9326
189
        if (PyObject_SetAttr(result, state->body, value) == -1)
9327
0
            goto failed;
9328
189
        Py_DECREF(value);
9329
189
        value = ast2obj_string(state, o->v.With.type_comment);
9330
189
        if (!value) goto failed;
9331
189
        if (PyObject_SetAttr(result, state->type_comment, value) == -1)
9332
0
            goto failed;
9333
189
        Py_DECREF(value);
9334
189
        break;
9335
221
    case AsyncWith_kind:
9336
221
        tp = (PyTypeObject *)state->AsyncWith_type;
9337
221
        result = PyType_GenericNew(tp, NULL, NULL);
9338
221
        if (!result) goto failed;
9339
221
        value = ast2obj_list(state, (asdl_seq*)o->v.AsyncWith.items,
9340
221
                             ast2obj_withitem);
9341
221
        if (!value) goto failed;
9342
221
        if (PyObject_SetAttr(result, state->items, value) == -1)
9343
0
            goto failed;
9344
221
        Py_DECREF(value);
9345
221
        value = ast2obj_list(state, (asdl_seq*)o->v.AsyncWith.body,
9346
221
                             ast2obj_stmt);
9347
221
        if (!value) goto failed;
9348
221
        if (PyObject_SetAttr(result, state->body, value) == -1)
9349
0
            goto failed;
9350
221
        Py_DECREF(value);
9351
221
        value = ast2obj_string(state, o->v.AsyncWith.type_comment);
9352
221
        if (!value) goto failed;
9353
221
        if (PyObject_SetAttr(result, state->type_comment, value) == -1)
9354
0
            goto failed;
9355
221
        Py_DECREF(value);
9356
221
        break;
9357
261
    case Match_kind:
9358
261
        tp = (PyTypeObject *)state->Match_type;
9359
261
        result = PyType_GenericNew(tp, NULL, NULL);
9360
261
        if (!result) goto failed;
9361
261
        value = ast2obj_expr(state, o->v.Match.subject);
9362
261
        if (!value) goto failed;
9363
261
        if (PyObject_SetAttr(result, state->subject, value) == -1)
9364
0
            goto failed;
9365
261
        Py_DECREF(value);
9366
261
        value = ast2obj_list(state, (asdl_seq*)o->v.Match.cases,
9367
261
                             ast2obj_match_case);
9368
261
        if (!value) goto failed;
9369
261
        if (PyObject_SetAttr(result, state->cases, value) == -1)
9370
0
            goto failed;
9371
261
        Py_DECREF(value);
9372
261
        break;
9373
735
    case Raise_kind:
9374
735
        tp = (PyTypeObject *)state->Raise_type;
9375
735
        result = PyType_GenericNew(tp, NULL, NULL);
9376
735
        if (!result) goto failed;
9377
735
        value = ast2obj_expr(state, o->v.Raise.exc);
9378
735
        if (!value) goto failed;
9379
735
        if (PyObject_SetAttr(result, state->exc, value) == -1)
9380
0
            goto failed;
9381
735
        Py_DECREF(value);
9382
735
        value = ast2obj_expr(state, o->v.Raise.cause);
9383
735
        if (!value) goto failed;
9384
735
        if (PyObject_SetAttr(result, state->cause, value) == -1)
9385
0
            goto failed;
9386
735
        Py_DECREF(value);
9387
735
        break;
9388
663
    case Try_kind:
9389
663
        tp = (PyTypeObject *)state->Try_type;
9390
663
        result = PyType_GenericNew(tp, NULL, NULL);
9391
663
        if (!result) goto failed;
9392
663
        value = ast2obj_list(state, (asdl_seq*)o->v.Try.body, ast2obj_stmt);
9393
663
        if (!value) goto failed;
9394
663
        if (PyObject_SetAttr(result, state->body, value) == -1)
9395
0
            goto failed;
9396
663
        Py_DECREF(value);
9397
663
        value = ast2obj_list(state, (asdl_seq*)o->v.Try.handlers,
9398
663
                             ast2obj_excepthandler);
9399
663
        if (!value) goto failed;
9400
663
        if (PyObject_SetAttr(result, state->handlers, value) == -1)
9401
0
            goto failed;
9402
663
        Py_DECREF(value);
9403
663
        value = ast2obj_list(state, (asdl_seq*)o->v.Try.orelse, ast2obj_stmt);
9404
663
        if (!value) goto failed;
9405
663
        if (PyObject_SetAttr(result, state->orelse, value) == -1)
9406
0
            goto failed;
9407
663
        Py_DECREF(value);
9408
663
        value = ast2obj_list(state, (asdl_seq*)o->v.Try.finalbody,
9409
663
                             ast2obj_stmt);
9410
663
        if (!value) goto failed;
9411
663
        if (PyObject_SetAttr(result, state->finalbody, value) == -1)
9412
0
            goto failed;
9413
663
        Py_DECREF(value);
9414
663
        break;
9415
431
    case TryStar_kind:
9416
431
        tp = (PyTypeObject *)state->TryStar_type;
9417
431
        result = PyType_GenericNew(tp, NULL, NULL);
9418
431
        if (!result) goto failed;
9419
431
        value = ast2obj_list(state, (asdl_seq*)o->v.TryStar.body, ast2obj_stmt);
9420
431
        if (!value) goto failed;
9421
431
        if (PyObject_SetAttr(result, state->body, value) == -1)
9422
0
            goto failed;
9423
431
        Py_DECREF(value);
9424
431
        value = ast2obj_list(state, (asdl_seq*)o->v.TryStar.handlers,
9425
431
                             ast2obj_excepthandler);
9426
431
        if (!value) goto failed;
9427
431
        if (PyObject_SetAttr(result, state->handlers, value) == -1)
9428
0
            goto failed;
9429
431
        Py_DECREF(value);
9430
431
        value = ast2obj_list(state, (asdl_seq*)o->v.TryStar.orelse,
9431
431
                             ast2obj_stmt);
9432
431
        if (!value) goto failed;
9433
431
        if (PyObject_SetAttr(result, state->orelse, value) == -1)
9434
0
            goto failed;
9435
431
        Py_DECREF(value);
9436
431
        value = ast2obj_list(state, (asdl_seq*)o->v.TryStar.finalbody,
9437
431
                             ast2obj_stmt);
9438
431
        if (!value) goto failed;
9439
431
        if (PyObject_SetAttr(result, state->finalbody, value) == -1)
9440
0
            goto failed;
9441
431
        Py_DECREF(value);
9442
431
        break;
9443
290
    case Assert_kind:
9444
290
        tp = (PyTypeObject *)state->Assert_type;
9445
290
        result = PyType_GenericNew(tp, NULL, NULL);
9446
290
        if (!result) goto failed;
9447
290
        value = ast2obj_expr(state, o->v.Assert.test);
9448
290
        if (!value) goto failed;
9449
290
        if (PyObject_SetAttr(result, state->test, value) == -1)
9450
0
            goto failed;
9451
290
        Py_DECREF(value);
9452
290
        value = ast2obj_expr(state, o->v.Assert.msg);
9453
290
        if (!value) goto failed;
9454
290
        if (PyObject_SetAttr(result, state->msg, value) == -1)
9455
0
            goto failed;
9456
290
        Py_DECREF(value);
9457
290
        break;
9458
786
    case Import_kind:
9459
786
        tp = (PyTypeObject *)state->Import_type;
9460
786
        result = PyType_GenericNew(tp, NULL, NULL);
9461
786
        if (!result) goto failed;
9462
786
        value = ast2obj_list(state, (asdl_seq*)o->v.Import.names,
9463
786
                             ast2obj_alias);
9464
786
        if (!value) goto failed;
9465
786
        if (PyObject_SetAttr(result, state->names, value) == -1)
9466
0
            goto failed;
9467
786
        Py_DECREF(value);
9468
786
        break;
9469
960
    case ImportFrom_kind:
9470
960
        tp = (PyTypeObject *)state->ImportFrom_type;
9471
960
        result = PyType_GenericNew(tp, NULL, NULL);
9472
960
        if (!result) goto failed;
9473
960
        value = ast2obj_identifier(state, o->v.ImportFrom.module);
9474
960
        if (!value) goto failed;
9475
960
        if (PyObject_SetAttr(result, state->module, value) == -1)
9476
0
            goto failed;
9477
960
        Py_DECREF(value);
9478
960
        value = ast2obj_list(state, (asdl_seq*)o->v.ImportFrom.names,
9479
960
                             ast2obj_alias);
9480
960
        if (!value) goto failed;
9481
960
        if (PyObject_SetAttr(result, state->names, value) == -1)
9482
0
            goto failed;
9483
960
        Py_DECREF(value);
9484
960
        value = ast2obj_int(state, o->v.ImportFrom.level);
9485
960
        if (!value) goto failed;
9486
960
        if (PyObject_SetAttr(result, state->level, value) == -1)
9487
0
            goto failed;
9488
960
        Py_DECREF(value);
9489
960
        break;
9490
328
    case Global_kind:
9491
328
        tp = (PyTypeObject *)state->Global_type;
9492
328
        result = PyType_GenericNew(tp, NULL, NULL);
9493
328
        if (!result) goto failed;
9494
328
        value = ast2obj_list(state, (asdl_seq*)o->v.Global.names,
9495
328
                             ast2obj_identifier);
9496
328
        if (!value) goto failed;
9497
328
        if (PyObject_SetAttr(result, state->names, value) == -1)
9498
0
            goto failed;
9499
328
        Py_DECREF(value);
9500
328
        break;
9501
194
    case Nonlocal_kind:
9502
194
        tp = (PyTypeObject *)state->Nonlocal_type;
9503
194
        result = PyType_GenericNew(tp, NULL, NULL);
9504
194
        if (!result) goto failed;
9505
194
        value = ast2obj_list(state, (asdl_seq*)o->v.Nonlocal.names,
9506
194
                             ast2obj_identifier);
9507
194
        if (!value) goto failed;
9508
194
        if (PyObject_SetAttr(result, state->names, value) == -1)
9509
0
            goto failed;
9510
194
        Py_DECREF(value);
9511
194
        break;
9512
33.6k
    case Expr_kind:
9513
33.6k
        tp = (PyTypeObject *)state->Expr_type;
9514
33.6k
        result = PyType_GenericNew(tp, NULL, NULL);
9515
33.6k
        if (!result) goto failed;
9516
33.6k
        value = ast2obj_expr(state, o->v.Expr.value);
9517
33.6k
        if (!value) goto failed;
9518
33.6k
        if (PyObject_SetAttr(result, state->value, value) == -1)
9519
0
            goto failed;
9520
33.6k
        Py_DECREF(value);
9521
33.6k
        break;
9522
92
    case Pass_kind:
9523
92
        tp = (PyTypeObject *)state->Pass_type;
9524
92
        result = PyType_GenericNew(tp, NULL, NULL);
9525
92
        if (!result) goto failed;
9526
92
        break;
9527
299
    case Break_kind:
9528
299
        tp = (PyTypeObject *)state->Break_type;
9529
299
        result = PyType_GenericNew(tp, NULL, NULL);
9530
299
        if (!result) goto failed;
9531
299
        break;
9532
299
    case Continue_kind:
9533
199
        tp = (PyTypeObject *)state->Continue_type;
9534
199
        result = PyType_GenericNew(tp, NULL, NULL);
9535
199
        if (!result) goto failed;
9536
199
        break;
9537
45.4k
    }
9538
45.4k
    value = ast2obj_int(state, o->lineno);
9539
45.4k
    if (!value) goto failed;
9540
45.4k
    if (PyObject_SetAttr(result, state->lineno, value) < 0)
9541
0
        goto failed;
9542
45.4k
    Py_DECREF(value);
9543
45.4k
    value = ast2obj_int(state, o->col_offset);
9544
45.4k
    if (!value) goto failed;
9545
45.4k
    if (PyObject_SetAttr(result, state->col_offset, value) < 0)
9546
0
        goto failed;
9547
45.4k
    Py_DECREF(value);
9548
45.4k
    value = ast2obj_int(state, o->end_lineno);
9549
45.4k
    if (!value) goto failed;
9550
45.4k
    if (PyObject_SetAttr(result, state->end_lineno, value) < 0)
9551
0
        goto failed;
9552
45.4k
    Py_DECREF(value);
9553
45.4k
    value = ast2obj_int(state, o->end_col_offset);
9554
45.4k
    if (!value) goto failed;
9555
45.4k
    if (PyObject_SetAttr(result, state->end_col_offset, value) < 0)
9556
0
        goto failed;
9557
45.4k
    Py_DECREF(value);
9558
45.4k
    Py_LeaveRecursiveCall();
9559
45.4k
    return result;
9560
0
failed:
9561
0
    Py_LeaveRecursiveCall();
9562
0
    Py_XDECREF(value);
9563
0
    Py_XDECREF(result);
9564
0
    return NULL;
9565
45.4k
}
9566
9567
PyObject*
9568
ast2obj_expr(struct ast_state *state, void* _o)
9569
315k
{
9570
315k
    expr_ty o = (expr_ty)_o;
9571
315k
    PyObject *result = NULL, *value = NULL;
9572
315k
    PyTypeObject *tp;
9573
315k
    if (!o) {
9574
42.5k
        Py_RETURN_NONE;
9575
42.5k
    }
9576
273k
    if (Py_EnterRecursiveCall("during  ast construction")) {
9577
0
        return NULL;
9578
0
    }
9579
273k
    switch (o->kind) {
9580
757
    case BoolOp_kind:
9581
757
        tp = (PyTypeObject *)state->BoolOp_type;
9582
757
        result = PyType_GenericNew(tp, NULL, NULL);
9583
757
        if (!result) goto failed;
9584
757
        value = ast2obj_boolop(state, o->v.BoolOp.op);
9585
757
        if (!value) goto failed;
9586
757
        if (PyObject_SetAttr(result, state->op, value) == -1)
9587
0
            goto failed;
9588
757
        Py_DECREF(value);
9589
757
        value = ast2obj_list(state, (asdl_seq*)o->v.BoolOp.values,
9590
757
                             ast2obj_expr);
9591
757
        if (!value) goto failed;
9592
757
        if (PyObject_SetAttr(result, state->values, value) == -1)
9593
0
            goto failed;
9594
757
        Py_DECREF(value);
9595
757
        break;
9596
275
    case NamedExpr_kind:
9597
275
        tp = (PyTypeObject *)state->NamedExpr_type;
9598
275
        result = PyType_GenericNew(tp, NULL, NULL);
9599
275
        if (!result) goto failed;
9600
275
        value = ast2obj_expr(state, o->v.NamedExpr.target);
9601
275
        if (!value) goto failed;
9602
275
        if (PyObject_SetAttr(result, state->target, value) == -1)
9603
0
            goto failed;
9604
275
        Py_DECREF(value);
9605
275
        value = ast2obj_expr(state, o->v.NamedExpr.value);
9606
275
        if (!value) goto failed;
9607
275
        if (PyObject_SetAttr(result, state->value, value) == -1)
9608
0
            goto failed;
9609
275
        Py_DECREF(value);
9610
275
        break;
9611
22.9k
    case BinOp_kind:
9612
22.9k
        tp = (PyTypeObject *)state->BinOp_type;
9613
22.9k
        result = PyType_GenericNew(tp, NULL, NULL);
9614
22.9k
        if (!result) goto failed;
9615
22.9k
        value = ast2obj_expr(state, o->v.BinOp.left);
9616
22.9k
        if (!value) goto failed;
9617
22.9k
        if (PyObject_SetAttr(result, state->left, value) == -1)
9618
0
            goto failed;
9619
22.9k
        Py_DECREF(value);
9620
22.9k
        value = ast2obj_operator(state, o->v.BinOp.op);
9621
22.9k
        if (!value) goto failed;
9622
22.9k
        if (PyObject_SetAttr(result, state->op, value) == -1)
9623
0
            goto failed;
9624
22.9k
        Py_DECREF(value);
9625
22.9k
        value = ast2obj_expr(state, o->v.BinOp.right);
9626
22.9k
        if (!value) goto failed;
9627
22.9k
        if (PyObject_SetAttr(result, state->right, value) == -1)
9628
0
            goto failed;
9629
22.9k
        Py_DECREF(value);
9630
22.9k
        break;
9631
76.4k
    case UnaryOp_kind:
9632
76.4k
        tp = (PyTypeObject *)state->UnaryOp_type;
9633
76.4k
        result = PyType_GenericNew(tp, NULL, NULL);
9634
76.4k
        if (!result) goto failed;
9635
76.4k
        value = ast2obj_unaryop(state, o->v.UnaryOp.op);
9636
76.4k
        if (!value) goto failed;
9637
76.4k
        if (PyObject_SetAttr(result, state->op, value) == -1)
9638
0
            goto failed;
9639
76.4k
        Py_DECREF(value);
9640
76.4k
        value = ast2obj_expr(state, o->v.UnaryOp.operand);
9641
76.4k
        if (!value) goto failed;
9642
76.4k
        if (PyObject_SetAttr(result, state->operand, value) == -1)
9643
0
            goto failed;
9644
76.4k
        Py_DECREF(value);
9645
76.4k
        break;
9646
924
    case Lambda_kind:
9647
924
        tp = (PyTypeObject *)state->Lambda_type;
9648
924
        result = PyType_GenericNew(tp, NULL, NULL);
9649
924
        if (!result) goto failed;
9650
924
        value = ast2obj_arguments(state, o->v.Lambda.args);
9651
924
        if (!value) goto failed;
9652
924
        if (PyObject_SetAttr(result, state->args, value) == -1)
9653
0
            goto failed;
9654
924
        Py_DECREF(value);
9655
924
        value = ast2obj_expr(state, o->v.Lambda.body);
9656
924
        if (!value) goto failed;
9657
924
        if (PyObject_SetAttr(result, state->body, value) == -1)
9658
0
            goto failed;
9659
924
        Py_DECREF(value);
9660
924
        break;
9661
200
    case IfExp_kind:
9662
200
        tp = (PyTypeObject *)state->IfExp_type;
9663
200
        result = PyType_GenericNew(tp, NULL, NULL);
9664
200
        if (!result) goto failed;
9665
200
        value = ast2obj_expr(state, o->v.IfExp.test);
9666
200
        if (!value) goto failed;
9667
200
        if (PyObject_SetAttr(result, state->test, value) == -1)
9668
0
            goto failed;
9669
200
        Py_DECREF(value);
9670
200
        value = ast2obj_expr(state, o->v.IfExp.body);
9671
200
        if (!value) goto failed;
9672
200
        if (PyObject_SetAttr(result, state->body, value) == -1)
9673
0
            goto failed;
9674
200
        Py_DECREF(value);
9675
200
        value = ast2obj_expr(state, o->v.IfExp.orelse);
9676
200
        if (!value) goto failed;
9677
200
        if (PyObject_SetAttr(result, state->orelse, value) == -1)
9678
0
            goto failed;
9679
200
        Py_DECREF(value);
9680
200
        break;
9681
1.22k
    case Dict_kind:
9682
1.22k
        tp = (PyTypeObject *)state->Dict_type;
9683
1.22k
        result = PyType_GenericNew(tp, NULL, NULL);
9684
1.22k
        if (!result) goto failed;
9685
1.22k
        value = ast2obj_list(state, (asdl_seq*)o->v.Dict.keys, ast2obj_expr);
9686
1.22k
        if (!value) goto failed;
9687
1.22k
        if (PyObject_SetAttr(result, state->keys, value) == -1)
9688
0
            goto failed;
9689
1.22k
        Py_DECREF(value);
9690
1.22k
        value = ast2obj_list(state, (asdl_seq*)o->v.Dict.values, ast2obj_expr);
9691
1.22k
        if (!value) goto failed;
9692
1.22k
        if (PyObject_SetAttr(result, state->values, value) == -1)
9693
0
            goto failed;
9694
1.22k
        Py_DECREF(value);
9695
1.22k
        break;
9696
371
    case Set_kind:
9697
371
        tp = (PyTypeObject *)state->Set_type;
9698
371
        result = PyType_GenericNew(tp, NULL, NULL);
9699
371
        if (!result) goto failed;
9700
371
        value = ast2obj_list(state, (asdl_seq*)o->v.Set.elts, ast2obj_expr);
9701
371
        if (!value) goto failed;
9702
371
        if (PyObject_SetAttr(result, state->elts, value) == -1)
9703
0
            goto failed;
9704
371
        Py_DECREF(value);
9705
371
        break;
9706
346
    case ListComp_kind:
9707
346
        tp = (PyTypeObject *)state->ListComp_type;
9708
346
        result = PyType_GenericNew(tp, NULL, NULL);
9709
346
        if (!result) goto failed;
9710
346
        value = ast2obj_expr(state, o->v.ListComp.elt);
9711
346
        if (!value) goto failed;
9712
346
        if (PyObject_SetAttr(result, state->elt, value) == -1)
9713
0
            goto failed;
9714
346
        Py_DECREF(value);
9715
346
        value = ast2obj_list(state, (asdl_seq*)o->v.ListComp.generators,
9716
346
                             ast2obj_comprehension);
9717
346
        if (!value) goto failed;
9718
346
        if (PyObject_SetAttr(result, state->generators, value) == -1)
9719
0
            goto failed;
9720
346
        Py_DECREF(value);
9721
346
        break;
9722
175
    case SetComp_kind:
9723
175
        tp = (PyTypeObject *)state->SetComp_type;
9724
175
        result = PyType_GenericNew(tp, NULL, NULL);
9725
175
        if (!result) goto failed;
9726
175
        value = ast2obj_expr(state, o->v.SetComp.elt);
9727
175
        if (!value) goto failed;
9728
175
        if (PyObject_SetAttr(result, state->elt, value) == -1)
9729
0
            goto failed;
9730
175
        Py_DECREF(value);
9731
175
        value = ast2obj_list(state, (asdl_seq*)o->v.SetComp.generators,
9732
175
                             ast2obj_comprehension);
9733
175
        if (!value) goto failed;
9734
175
        if (PyObject_SetAttr(result, state->generators, value) == -1)
9735
0
            goto failed;
9736
175
        Py_DECREF(value);
9737
175
        break;
9738
575
    case DictComp_kind:
9739
575
        tp = (PyTypeObject *)state->DictComp_type;
9740
575
        result = PyType_GenericNew(tp, NULL, NULL);
9741
575
        if (!result) goto failed;
9742
575
        value = ast2obj_expr(state, o->v.DictComp.key);
9743
575
        if (!value) goto failed;
9744
575
        if (PyObject_SetAttr(result, state->key, value) == -1)
9745
0
            goto failed;
9746
575
        Py_DECREF(value);
9747
575
        value = ast2obj_expr(state, o->v.DictComp.value);
9748
575
        if (!value) goto failed;
9749
575
        if (PyObject_SetAttr(result, state->value, value) == -1)
9750
0
            goto failed;
9751
575
        Py_DECREF(value);
9752
575
        value = ast2obj_list(state, (asdl_seq*)o->v.DictComp.generators,
9753
575
                             ast2obj_comprehension);
9754
575
        if (!value) goto failed;
9755
575
        if (PyObject_SetAttr(result, state->generators, value) == -1)
9756
0
            goto failed;
9757
575
        Py_DECREF(value);
9758
575
        break;
9759
476
    case GeneratorExp_kind:
9760
476
        tp = (PyTypeObject *)state->GeneratorExp_type;
9761
476
        result = PyType_GenericNew(tp, NULL, NULL);
9762
476
        if (!result) goto failed;
9763
476
        value = ast2obj_expr(state, o->v.GeneratorExp.elt);
9764
476
        if (!value) goto failed;
9765
476
        if (PyObject_SetAttr(result, state->elt, value) == -1)
9766
0
            goto failed;
9767
476
        Py_DECREF(value);
9768
476
        value = ast2obj_list(state, (asdl_seq*)o->v.GeneratorExp.generators,
9769
476
                             ast2obj_comprehension);
9770
476
        if (!value) goto failed;
9771
476
        if (PyObject_SetAttr(result, state->generators, value) == -1)
9772
0
            goto failed;
9773
476
        Py_DECREF(value);
9774
476
        break;
9775
208
    case Await_kind:
9776
208
        tp = (PyTypeObject *)state->Await_type;
9777
208
        result = PyType_GenericNew(tp, NULL, NULL);
9778
208
        if (!result) goto failed;
9779
208
        value = ast2obj_expr(state, o->v.Await.value);
9780
208
        if (!value) goto failed;
9781
208
        if (PyObject_SetAttr(result, state->value, value) == -1)
9782
0
            goto failed;
9783
208
        Py_DECREF(value);
9784
208
        break;
9785
597
    case Yield_kind:
9786
597
        tp = (PyTypeObject *)state->Yield_type;
9787
597
        result = PyType_GenericNew(tp, NULL, NULL);
9788
597
        if (!result) goto failed;
9789
597
        value = ast2obj_expr(state, o->v.Yield.value);
9790
597
        if (!value) goto failed;
9791
597
        if (PyObject_SetAttr(result, state->value, value) == -1)
9792
0
            goto failed;
9793
597
        Py_DECREF(value);
9794
597
        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
2.13k
    case Compare_kind:
9806
2.13k
        tp = (PyTypeObject *)state->Compare_type;
9807
2.13k
        result = PyType_GenericNew(tp, NULL, NULL);
9808
2.13k
        if (!result) goto failed;
9809
2.13k
        value = ast2obj_expr(state, o->v.Compare.left);
9810
2.13k
        if (!value) goto failed;
9811
2.13k
        if (PyObject_SetAttr(result, state->left, value) == -1)
9812
0
            goto failed;
9813
2.13k
        Py_DECREF(value);
9814
2.13k
        {
9815
2.13k
            Py_ssize_t i, n = asdl_seq_LEN(o->v.Compare.ops);
9816
2.13k
            value = PyList_New(n);
9817
2.13k
            if (!value) goto failed;
9818
10.2k
            for(i = 0; i < n; i++)
9819
8.14k
                PyList_SET_ITEM(value, i, ast2obj_cmpop(state, (cmpop_ty)asdl_seq_GET(o->v.Compare.ops, i)));
9820
2.13k
        }
9821
2.13k
        if (!value) goto failed;
9822
2.13k
        if (PyObject_SetAttr(result, state->ops, value) == -1)
9823
0
            goto failed;
9824
2.13k
        Py_DECREF(value);
9825
2.13k
        value = ast2obj_list(state, (asdl_seq*)o->v.Compare.comparators,
9826
2.13k
                             ast2obj_expr);
9827
2.13k
        if (!value) goto failed;
9828
2.13k
        if (PyObject_SetAttr(result, state->comparators, value) == -1)
9829
0
            goto failed;
9830
2.13k
        Py_DECREF(value);
9831
2.13k
        break;
9832
6.10k
    case Call_kind:
9833
6.10k
        tp = (PyTypeObject *)state->Call_type;
9834
6.10k
        result = PyType_GenericNew(tp, NULL, NULL);
9835
6.10k
        if (!result) goto failed;
9836
6.10k
        value = ast2obj_expr(state, o->v.Call.func);
9837
6.10k
        if (!value) goto failed;
9838
6.10k
        if (PyObject_SetAttr(result, state->func, value) == -1)
9839
0
            goto failed;
9840
6.10k
        Py_DECREF(value);
9841
6.10k
        value = ast2obj_list(state, (asdl_seq*)o->v.Call.args, ast2obj_expr);
9842
6.10k
        if (!value) goto failed;
9843
6.10k
        if (PyObject_SetAttr(result, state->args, value) == -1)
9844
0
            goto failed;
9845
6.10k
        Py_DECREF(value);
9846
6.10k
        value = ast2obj_list(state, (asdl_seq*)o->v.Call.keywords,
9847
6.10k
                             ast2obj_keyword);
9848
6.10k
        if (!value) goto failed;
9849
6.10k
        if (PyObject_SetAttr(result, state->keywords, value) == -1)
9850
0
            goto failed;
9851
6.10k
        Py_DECREF(value);
9852
6.10k
        break;
9853
11.8k
    case FormattedValue_kind:
9854
11.8k
        tp = (PyTypeObject *)state->FormattedValue_type;
9855
11.8k
        result = PyType_GenericNew(tp, NULL, NULL);
9856
11.8k
        if (!result) goto failed;
9857
11.8k
        value = ast2obj_expr(state, o->v.FormattedValue.value);
9858
11.8k
        if (!value) goto failed;
9859
11.8k
        if (PyObject_SetAttr(result, state->value, value) == -1)
9860
0
            goto failed;
9861
11.8k
        Py_DECREF(value);
9862
11.8k
        value = ast2obj_int(state, o->v.FormattedValue.conversion);
9863
11.8k
        if (!value) goto failed;
9864
11.8k
        if (PyObject_SetAttr(result, state->conversion, value) == -1)
9865
0
            goto failed;
9866
11.8k
        Py_DECREF(value);
9867
11.8k
        value = ast2obj_expr(state, o->v.FormattedValue.format_spec);
9868
11.8k
        if (!value) goto failed;
9869
11.8k
        if (PyObject_SetAttr(result, state->format_spec, value) == -1)
9870
0
            goto failed;
9871
11.8k
        Py_DECREF(value);
9872
11.8k
        break;
9873
1.52k
    case Interpolation_kind:
9874
1.52k
        tp = (PyTypeObject *)state->Interpolation_type;
9875
1.52k
        result = PyType_GenericNew(tp, NULL, NULL);
9876
1.52k
        if (!result) goto failed;
9877
1.52k
        value = ast2obj_expr(state, o->v.Interpolation.value);
9878
1.52k
        if (!value) goto failed;
9879
1.52k
        if (PyObject_SetAttr(result, state->value, value) == -1)
9880
0
            goto failed;
9881
1.52k
        Py_DECREF(value);
9882
1.52k
        value = ast2obj_constant(state, o->v.Interpolation.str);
9883
1.52k
        if (!value) goto failed;
9884
1.52k
        if (PyObject_SetAttr(result, state->str, value) == -1)
9885
0
            goto failed;
9886
1.52k
        Py_DECREF(value);
9887
1.52k
        value = ast2obj_int(state, o->v.Interpolation.conversion);
9888
1.52k
        if (!value) goto failed;
9889
1.52k
        if (PyObject_SetAttr(result, state->conversion, value) == -1)
9890
0
            goto failed;
9891
1.52k
        Py_DECREF(value);
9892
1.52k
        value = ast2obj_expr(state, o->v.Interpolation.format_spec);
9893
1.52k
        if (!value) goto failed;
9894
1.52k
        if (PyObject_SetAttr(result, state->format_spec, value) == -1)
9895
0
            goto failed;
9896
1.52k
        Py_DECREF(value);
9897
1.52k
        break;
9898
6.61k
    case JoinedStr_kind:
9899
6.61k
        tp = (PyTypeObject *)state->JoinedStr_type;
9900
6.61k
        result = PyType_GenericNew(tp, NULL, NULL);
9901
6.61k
        if (!result) goto failed;
9902
6.61k
        value = ast2obj_list(state, (asdl_seq*)o->v.JoinedStr.values,
9903
6.61k
                             ast2obj_expr);
9904
6.61k
        if (!value) goto failed;
9905
6.61k
        if (PyObject_SetAttr(result, state->values, value) == -1)
9906
0
            goto failed;
9907
6.61k
        Py_DECREF(value);
9908
6.61k
        break;
9909
294
    case TemplateStr_kind:
9910
294
        tp = (PyTypeObject *)state->TemplateStr_type;
9911
294
        result = PyType_GenericNew(tp, NULL, NULL);
9912
294
        if (!result) goto failed;
9913
294
        value = ast2obj_list(state, (asdl_seq*)o->v.TemplateStr.values,
9914
294
                             ast2obj_expr);
9915
294
        if (!value) goto failed;
9916
294
        if (PyObject_SetAttr(result, state->values, value) == -1)
9917
0
            goto failed;
9918
294
        Py_DECREF(value);
9919
294
        break;
9920
61.4k
    case Constant_kind:
9921
61.4k
        tp = (PyTypeObject *)state->Constant_type;
9922
61.4k
        result = PyType_GenericNew(tp, NULL, NULL);
9923
61.4k
        if (!result) goto failed;
9924
61.4k
        value = ast2obj_constant(state, o->v.Constant.value);
9925
61.4k
        if (!value) goto failed;
9926
61.4k
        if (PyObject_SetAttr(result, state->value, value) == -1)
9927
0
            goto failed;
9928
61.4k
        Py_DECREF(value);
9929
61.4k
        value = ast2obj_string(state, o->v.Constant.kind);
9930
61.4k
        if (!value) goto failed;
9931
61.4k
        if (PyObject_SetAttr(result, state->kind, value) == -1)
9932
0
            goto failed;
9933
61.4k
        Py_DECREF(value);
9934
61.4k
        break;
9935
1.42k
    case Attribute_kind:
9936
1.42k
        tp = (PyTypeObject *)state->Attribute_type;
9937
1.42k
        result = PyType_GenericNew(tp, NULL, NULL);
9938
1.42k
        if (!result) goto failed;
9939
1.42k
        value = ast2obj_expr(state, o->v.Attribute.value);
9940
1.42k
        if (!value) goto failed;
9941
1.42k
        if (PyObject_SetAttr(result, state->value, value) == -1)
9942
0
            goto failed;
9943
1.42k
        Py_DECREF(value);
9944
1.42k
        value = ast2obj_identifier(state, o->v.Attribute.attr);
9945
1.42k
        if (!value) goto failed;
9946
1.42k
        if (PyObject_SetAttr(result, state->attr, value) == -1)
9947
0
            goto failed;
9948
1.42k
        Py_DECREF(value);
9949
1.42k
        value = ast2obj_expr_context(state, o->v.Attribute.ctx);
9950
1.42k
        if (!value) goto failed;
9951
1.42k
        if (PyObject_SetAttr(result, state->ctx, value) == -1)
9952
0
            goto failed;
9953
1.42k
        Py_DECREF(value);
9954
1.42k
        break;
9955
461
    case Subscript_kind:
9956
461
        tp = (PyTypeObject *)state->Subscript_type;
9957
461
        result = PyType_GenericNew(tp, NULL, NULL);
9958
461
        if (!result) goto failed;
9959
461
        value = ast2obj_expr(state, o->v.Subscript.value);
9960
461
        if (!value) goto failed;
9961
461
        if (PyObject_SetAttr(result, state->value, value) == -1)
9962
0
            goto failed;
9963
461
        Py_DECREF(value);
9964
461
        value = ast2obj_expr(state, o->v.Subscript.slice);
9965
461
        if (!value) goto failed;
9966
461
        if (PyObject_SetAttr(result, state->slice, value) == -1)
9967
0
            goto failed;
9968
461
        Py_DECREF(value);
9969
461
        value = ast2obj_expr_context(state, o->v.Subscript.ctx);
9970
461
        if (!value) goto failed;
9971
461
        if (PyObject_SetAttr(result, state->ctx, value) == -1)
9972
0
            goto failed;
9973
461
        Py_DECREF(value);
9974
461
        break;
9975
675
    case Starred_kind:
9976
675
        tp = (PyTypeObject *)state->Starred_type;
9977
675
        result = PyType_GenericNew(tp, NULL, NULL);
9978
675
        if (!result) goto failed;
9979
675
        value = ast2obj_expr(state, o->v.Starred.value);
9980
675
        if (!value) goto failed;
9981
675
        if (PyObject_SetAttr(result, state->value, value) == -1)
9982
0
            goto failed;
9983
675
        Py_DECREF(value);
9984
675
        value = ast2obj_expr_context(state, o->v.Starred.ctx);
9985
675
        if (!value) goto failed;
9986
675
        if (PyObject_SetAttr(result, state->ctx, value) == -1)
9987
0
            goto failed;
9988
675
        Py_DECREF(value);
9989
675
        break;
9990
63.4k
    case Name_kind:
9991
63.4k
        tp = (PyTypeObject *)state->Name_type;
9992
63.4k
        result = PyType_GenericNew(tp, NULL, NULL);
9993
63.4k
        if (!result) goto failed;
9994
63.4k
        value = ast2obj_identifier(state, o->v.Name.id);
9995
63.4k
        if (!value) goto failed;
9996
63.4k
        if (PyObject_SetAttr(result, state->id, value) == -1)
9997
0
            goto failed;
9998
63.4k
        Py_DECREF(value);
9999
63.4k
        value = ast2obj_expr_context(state, o->v.Name.ctx);
10000
63.4k
        if (!value) goto failed;
10001
63.4k
        if (PyObject_SetAttr(result, state->ctx, value) == -1)
10002
0
            goto failed;
10003
63.4k
        Py_DECREF(value);
10004
63.4k
        break;
10005
1.84k
    case List_kind:
10006
1.84k
        tp = (PyTypeObject *)state->List_type;
10007
1.84k
        result = PyType_GenericNew(tp, NULL, NULL);
10008
1.84k
        if (!result) goto failed;
10009
1.84k
        value = ast2obj_list(state, (asdl_seq*)o->v.List.elts, ast2obj_expr);
10010
1.84k
        if (!value) goto failed;
10011
1.84k
        if (PyObject_SetAttr(result, state->elts, value) == -1)
10012
0
            goto failed;
10013
1.84k
        Py_DECREF(value);
10014
1.84k
        value = ast2obj_expr_context(state, o->v.List.ctx);
10015
1.84k
        if (!value) goto failed;
10016
1.84k
        if (PyObject_SetAttr(result, state->ctx, value) == -1)
10017
0
            goto failed;
10018
1.84k
        Py_DECREF(value);
10019
1.84k
        break;
10020
7.59k
    case Tuple_kind:
10021
7.59k
        tp = (PyTypeObject *)state->Tuple_type;
10022
7.59k
        result = PyType_GenericNew(tp, NULL, NULL);
10023
7.59k
        if (!result) goto failed;
10024
7.59k
        value = ast2obj_list(state, (asdl_seq*)o->v.Tuple.elts, ast2obj_expr);
10025
7.59k
        if (!value) goto failed;
10026
7.59k
        if (PyObject_SetAttr(result, state->elts, value) == -1)
10027
0
            goto failed;
10028
7.59k
        Py_DECREF(value);
10029
7.59k
        value = ast2obj_expr_context(state, o->v.Tuple.ctx);
10030
7.59k
        if (!value) goto failed;
10031
7.59k
        if (PyObject_SetAttr(result, state->ctx, value) == -1)
10032
0
            goto failed;
10033
7.59k
        Py_DECREF(value);
10034
7.59k
        break;
10035
2.21k
    case Slice_kind:
10036
2.21k
        tp = (PyTypeObject *)state->Slice_type;
10037
2.21k
        result = PyType_GenericNew(tp, NULL, NULL);
10038
2.21k
        if (!result) goto failed;
10039
2.21k
        value = ast2obj_expr(state, o->v.Slice.lower);
10040
2.21k
        if (!value) goto failed;
10041
2.21k
        if (PyObject_SetAttr(result, state->lower, value) == -1)
10042
0
            goto failed;
10043
2.21k
        Py_DECREF(value);
10044
2.21k
        value = ast2obj_expr(state, o->v.Slice.upper);
10045
2.21k
        if (!value) goto failed;
10046
2.21k
        if (PyObject_SetAttr(result, state->upper, value) == -1)
10047
0
            goto failed;
10048
2.21k
        Py_DECREF(value);
10049
2.21k
        value = ast2obj_expr(state, o->v.Slice.step);
10050
2.21k
        if (!value) goto failed;
10051
2.21k
        if (PyObject_SetAttr(result, state->step, value) == -1)
10052
0
            goto failed;
10053
2.21k
        Py_DECREF(value);
10054
2.21k
        break;
10055
273k
    }
10056
273k
    value = ast2obj_int(state, o->lineno);
10057
273k
    if (!value) goto failed;
10058
273k
    if (PyObject_SetAttr(result, state->lineno, value) < 0)
10059
0
        goto failed;
10060
273k
    Py_DECREF(value);
10061
273k
    value = ast2obj_int(state, o->col_offset);
10062
273k
    if (!value) goto failed;
10063
273k
    if (PyObject_SetAttr(result, state->col_offset, value) < 0)
10064
0
        goto failed;
10065
273k
    Py_DECREF(value);
10066
273k
    value = ast2obj_int(state, o->end_lineno);
10067
273k
    if (!value) goto failed;
10068
273k
    if (PyObject_SetAttr(result, state->end_lineno, value) < 0)
10069
0
        goto failed;
10070
273k
    Py_DECREF(value);
10071
273k
    value = ast2obj_int(state, o->end_col_offset);
10072
273k
    if (!value) goto failed;
10073
273k
    if (PyObject_SetAttr(result, state->end_col_offset, value) < 0)
10074
0
        goto failed;
10075
273k
    Py_DECREF(value);
10076
273k
    Py_LeaveRecursiveCall();
10077
273k
    return result;
10078
0
failed:
10079
0
    Py_LeaveRecursiveCall();
10080
0
    Py_XDECREF(value);
10081
0
    Py_XDECREF(result);
10082
0
    return NULL;
10083
273k
}
10084
10085
PyObject* ast2obj_expr_context(struct ast_state *state, expr_context_ty o)
10086
75.4k
{
10087
75.4k
    switch(o) {
10088
69.4k
        case Load:
10089
69.4k
            return Py_NewRef(state->Load_singleton);
10090
5.23k
        case Store:
10091
5.23k
            return Py_NewRef(state->Store_singleton);
10092
812
        case Del:
10093
812
            return Py_NewRef(state->Del_singleton);
10094
75.4k
    }
10095
75.4k
    Py_UNREACHABLE();
10096
75.4k
}
10097
PyObject* ast2obj_boolop(struct ast_state *state, boolop_ty o)
10098
757
{
10099
757
    switch(o) {
10100
109
        case And:
10101
109
            return Py_NewRef(state->And_singleton);
10102
648
        case Or:
10103
648
            return Py_NewRef(state->Or_singleton);
10104
757
    }
10105
757
    Py_UNREACHABLE();
10106
757
}
10107
PyObject* ast2obj_operator(struct ast_state *state, operator_ty o)
10108
23.1k
{
10109
23.1k
    switch(o) {
10110
4.62k
        case Add:
10111
4.62k
            return Py_NewRef(state->Add_singleton);
10112
7.74k
        case Sub:
10113
7.74k
            return Py_NewRef(state->Sub_singleton);
10114
2.66k
        case Mult:
10115
2.66k
            return Py_NewRef(state->Mult_singleton);
10116
1.64k
        case MatMult:
10117
1.64k
            return Py_NewRef(state->MatMult_singleton);
10118
1.34k
        case Div:
10119
1.34k
            return Py_NewRef(state->Div_singleton);
10120
1.61k
        case Mod:
10121
1.61k
            return Py_NewRef(state->Mod_singleton);
10122
710
        case Pow:
10123
710
            return Py_NewRef(state->Pow_singleton);
10124
373
        case LShift:
10125
373
            return Py_NewRef(state->LShift_singleton);
10126
317
        case RShift:
10127
317
            return Py_NewRef(state->RShift_singleton);
10128
658
        case BitOr:
10129
658
            return Py_NewRef(state->BitOr_singleton);
10130
395
        case BitXor:
10131
395
            return Py_NewRef(state->BitXor_singleton);
10132
809
        case BitAnd:
10133
809
            return Py_NewRef(state->BitAnd_singleton);
10134
293
        case FloorDiv:
10135
293
            return Py_NewRef(state->FloorDiv_singleton);
10136
23.1k
    }
10137
23.1k
    Py_UNREACHABLE();
10138
23.1k
}
10139
PyObject* ast2obj_unaryop(struct ast_state *state, unaryop_ty o)
10140
76.4k
{
10141
76.4k
    switch(o) {
10142
12.7k
        case Invert:
10143
12.7k
            return Py_NewRef(state->Invert_singleton);
10144
79
        case Not:
10145
79
            return Py_NewRef(state->Not_singleton);
10146
30.4k
        case UAdd:
10147
30.4k
            return Py_NewRef(state->UAdd_singleton);
10148
33.1k
        case USub:
10149
33.1k
            return Py_NewRef(state->USub_singleton);
10150
76.4k
    }
10151
76.4k
    Py_UNREACHABLE();
10152
76.4k
}
10153
PyObject* ast2obj_cmpop(struct ast_state *state, cmpop_ty o)
10154
8.14k
{
10155
8.14k
    switch(o) {
10156
89
        case Eq:
10157
89
            return Py_NewRef(state->Eq_singleton);
10158
79
        case NotEq:
10159
79
            return Py_NewRef(state->NotEq_singleton);
10160
1.36k
        case Lt:
10161
1.36k
            return Py_NewRef(state->Lt_singleton);
10162
209
        case LtE:
10163
209
            return Py_NewRef(state->LtE_singleton);
10164
5.64k
        case Gt:
10165
5.64k
            return Py_NewRef(state->Gt_singleton);
10166
219
        case GtE:
10167
219
            return Py_NewRef(state->GtE_singleton);
10168
99
        case Is:
10169
99
            return Py_NewRef(state->Is_singleton);
10170
80
        case IsNot:
10171
80
            return Py_NewRef(state->IsNot_singleton);
10172
298
        case In:
10173
298
            return Py_NewRef(state->In_singleton);
10174
67
        case NotIn:
10175
67
            return Py_NewRef(state->NotIn_singleton);
10176
8.14k
    }
10177
8.14k
    Py_UNREACHABLE();
10178
8.14k
}
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.27k
{
10226
1.27k
    excepthandler_ty o = (excepthandler_ty)_o;
10227
1.27k
    PyObject *result = NULL, *value = NULL;
10228
1.27k
    PyTypeObject *tp;
10229
1.27k
    if (!o) {
10230
0
        Py_RETURN_NONE;
10231
0
    }
10232
1.27k
    if (Py_EnterRecursiveCall("during  ast construction")) {
10233
0
        return NULL;
10234
0
    }
10235
1.27k
    switch (o->kind) {
10236
1.27k
    case ExceptHandler_kind:
10237
1.27k
        tp = (PyTypeObject *)state->ExceptHandler_type;
10238
1.27k
        result = PyType_GenericNew(tp, NULL, NULL);
10239
1.27k
        if (!result) goto failed;
10240
1.27k
        value = ast2obj_expr(state, o->v.ExceptHandler.type);
10241
1.27k
        if (!value) goto failed;
10242
1.27k
        if (PyObject_SetAttr(result, state->type, value) == -1)
10243
0
            goto failed;
10244
1.27k
        Py_DECREF(value);
10245
1.27k
        value = ast2obj_identifier(state, o->v.ExceptHandler.name);
10246
1.27k
        if (!value) goto failed;
10247
1.27k
        if (PyObject_SetAttr(result, state->name, value) == -1)
10248
0
            goto failed;
10249
1.27k
        Py_DECREF(value);
10250
1.27k
        value = ast2obj_list(state, (asdl_seq*)o->v.ExceptHandler.body,
10251
1.27k
                             ast2obj_stmt);
10252
1.27k
        if (!value) goto failed;
10253
1.27k
        if (PyObject_SetAttr(result, state->body, value) == -1)
10254
0
            goto failed;
10255
1.27k
        Py_DECREF(value);
10256
1.27k
        break;
10257
1.27k
    }
10258
1.27k
    value = ast2obj_int(state, o->lineno);
10259
1.27k
    if (!value) goto failed;
10260
1.27k
    if (PyObject_SetAttr(result, state->lineno, value) < 0)
10261
0
        goto failed;
10262
1.27k
    Py_DECREF(value);
10263
1.27k
    value = ast2obj_int(state, o->col_offset);
10264
1.27k
    if (!value) goto failed;
10265
1.27k
    if (PyObject_SetAttr(result, state->col_offset, value) < 0)
10266
0
        goto failed;
10267
1.27k
    Py_DECREF(value);
10268
1.27k
    value = ast2obj_int(state, o->end_lineno);
10269
1.27k
    if (!value) goto failed;
10270
1.27k
    if (PyObject_SetAttr(result, state->end_lineno, value) < 0)
10271
0
        goto failed;
10272
1.27k
    Py_DECREF(value);
10273
1.27k
    value = ast2obj_int(state, o->end_col_offset);
10274
1.27k
    if (!value) goto failed;
10275
1.27k
    if (PyObject_SetAttr(result, state->end_col_offset, value) < 0)
10276
0
        goto failed;
10277
1.27k
    Py_DECREF(value);
10278
1.27k
    Py_LeaveRecursiveCall();
10279
1.27k
    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.27k
}
10286
10287
PyObject*
10288
ast2obj_arguments(struct ast_state *state, void* _o)
10289
2.72k
{
10290
2.72k
    arguments_ty o = (arguments_ty)_o;
10291
2.72k
    PyObject *result = NULL, *value = NULL;
10292
2.72k
    PyTypeObject *tp;
10293
2.72k
    if (!o) {
10294
0
        Py_RETURN_NONE;
10295
0
    }
10296
2.72k
    if (Py_EnterRecursiveCall("during  ast construction")) {
10297
0
        return NULL;
10298
0
    }
10299
2.72k
    tp = (PyTypeObject *)state->arguments_type;
10300
2.72k
    result = PyType_GenericNew(tp, NULL, NULL);
10301
2.72k
    if (!result) return NULL;
10302
2.72k
    value = ast2obj_list(state, (asdl_seq*)o->posonlyargs, ast2obj_arg);
10303
2.72k
    if (!value) goto failed;
10304
2.72k
    if (PyObject_SetAttr(result, state->posonlyargs, value) == -1)
10305
0
        goto failed;
10306
2.72k
    Py_DECREF(value);
10307
2.72k
    value = ast2obj_list(state, (asdl_seq*)o->args, ast2obj_arg);
10308
2.72k
    if (!value) goto failed;
10309
2.72k
    if (PyObject_SetAttr(result, state->args, value) == -1)
10310
0
        goto failed;
10311
2.72k
    Py_DECREF(value);
10312
2.72k
    value = ast2obj_arg(state, o->vararg);
10313
2.72k
    if (!value) goto failed;
10314
2.72k
    if (PyObject_SetAttr(result, state->vararg, value) == -1)
10315
0
        goto failed;
10316
2.72k
    Py_DECREF(value);
10317
2.72k
    value = ast2obj_list(state, (asdl_seq*)o->kwonlyargs, ast2obj_arg);
10318
2.72k
    if (!value) goto failed;
10319
2.72k
    if (PyObject_SetAttr(result, state->kwonlyargs, value) == -1)
10320
0
        goto failed;
10321
2.72k
    Py_DECREF(value);
10322
2.72k
    value = ast2obj_list(state, (asdl_seq*)o->kw_defaults, ast2obj_expr);
10323
2.72k
    if (!value) goto failed;
10324
2.72k
    if (PyObject_SetAttr(result, state->kw_defaults, value) == -1)
10325
0
        goto failed;
10326
2.72k
    Py_DECREF(value);
10327
2.72k
    value = ast2obj_arg(state, o->kwarg);
10328
2.72k
    if (!value) goto failed;
10329
2.72k
    if (PyObject_SetAttr(result, state->kwarg, value) == -1)
10330
0
        goto failed;
10331
2.72k
    Py_DECREF(value);
10332
2.72k
    value = ast2obj_list(state, (asdl_seq*)o->defaults, ast2obj_expr);
10333
2.72k
    if (!value) goto failed;
10334
2.72k
    if (PyObject_SetAttr(result, state->defaults, value) == -1)
10335
0
        goto failed;
10336
2.72k
    Py_DECREF(value);
10337
2.72k
    Py_LeaveRecursiveCall();
10338
2.72k
    return result;
10339
0
failed:
10340
0
    Py_LeaveRecursiveCall();
10341
0
    Py_XDECREF(value);
10342
0
    Py_XDECREF(result);
10343
0
    return NULL;
10344
2.72k
}
10345
10346
PyObject*
10347
ast2obj_arg(struct ast_state *state, void* _o)
10348
14.2k
{
10349
14.2k
    arg_ty o = (arg_ty)_o;
10350
14.2k
    PyObject *result = NULL, *value = NULL;
10351
14.2k
    PyTypeObject *tp;
10352
14.2k
    if (!o) {
10353
4.76k
        Py_RETURN_NONE;
10354
4.76k
    }
10355
9.52k
    if (Py_EnterRecursiveCall("during  ast construction")) {
10356
0
        return NULL;
10357
0
    }
10358
9.52k
    tp = (PyTypeObject *)state->arg_type;
10359
9.52k
    result = PyType_GenericNew(tp, NULL, NULL);
10360
9.52k
    if (!result) return NULL;
10361
9.52k
    value = ast2obj_identifier(state, o->arg);
10362
9.52k
    if (!value) goto failed;
10363
9.52k
    if (PyObject_SetAttr(result, state->arg, value) == -1)
10364
0
        goto failed;
10365
9.52k
    Py_DECREF(value);
10366
9.52k
    value = ast2obj_expr(state, o->annotation);
10367
9.52k
    if (!value) goto failed;
10368
9.52k
    if (PyObject_SetAttr(result, state->annotation, value) == -1)
10369
0
        goto failed;
10370
9.52k
    Py_DECREF(value);
10371
9.52k
    value = ast2obj_string(state, o->type_comment);
10372
9.52k
    if (!value) goto failed;
10373
9.52k
    if (PyObject_SetAttr(result, state->type_comment, value) == -1)
10374
0
        goto failed;
10375
9.52k
    Py_DECREF(value);
10376
9.52k
    value = ast2obj_int(state, o->lineno);
10377
9.52k
    if (!value) goto failed;
10378
9.52k
    if (PyObject_SetAttr(result, state->lineno, value) < 0)
10379
0
        goto failed;
10380
9.52k
    Py_DECREF(value);
10381
9.52k
    value = ast2obj_int(state, o->col_offset);
10382
9.52k
    if (!value) goto failed;
10383
9.52k
    if (PyObject_SetAttr(result, state->col_offset, value) < 0)
10384
0
        goto failed;
10385
9.52k
    Py_DECREF(value);
10386
9.52k
    value = ast2obj_int(state, o->end_lineno);
10387
9.52k
    if (!value) goto failed;
10388
9.52k
    if (PyObject_SetAttr(result, state->end_lineno, value) < 0)
10389
0
        goto failed;
10390
9.52k
    Py_DECREF(value);
10391
9.52k
    value = ast2obj_int(state, o->end_col_offset);
10392
9.52k
    if (!value) goto failed;
10393
9.52k
    if (PyObject_SetAttr(result, state->end_col_offset, value) < 0)
10394
0
        goto failed;
10395
9.52k
    Py_DECREF(value);
10396
9.52k
    Py_LeaveRecursiveCall();
10397
9.52k
    return result;
10398
0
failed:
10399
0
    Py_LeaveRecursiveCall();
10400
0
    Py_XDECREF(value);
10401
0
    Py_XDECREF(result);
10402
0
    return NULL;
10403
9.52k
}
10404
10405
PyObject*
10406
ast2obj_keyword(struct ast_state *state, void* _o)
10407
2.77k
{
10408
2.77k
    keyword_ty o = (keyword_ty)_o;
10409
2.77k
    PyObject *result = NULL, *value = NULL;
10410
2.77k
    PyTypeObject *tp;
10411
2.77k
    if (!o) {
10412
0
        Py_RETURN_NONE;
10413
0
    }
10414
2.77k
    if (Py_EnterRecursiveCall("during  ast construction")) {
10415
0
        return NULL;
10416
0
    }
10417
2.77k
    tp = (PyTypeObject *)state->keyword_type;
10418
2.77k
    result = PyType_GenericNew(tp, NULL, NULL);
10419
2.77k
    if (!result) return NULL;
10420
2.77k
    value = ast2obj_identifier(state, o->arg);
10421
2.77k
    if (!value) goto failed;
10422
2.77k
    if (PyObject_SetAttr(result, state->arg, value) == -1)
10423
0
        goto failed;
10424
2.77k
    Py_DECREF(value);
10425
2.77k
    value = ast2obj_expr(state, o->value);
10426
2.77k
    if (!value) goto failed;
10427
2.77k
    if (PyObject_SetAttr(result, state->value, value) == -1)
10428
0
        goto failed;
10429
2.77k
    Py_DECREF(value);
10430
2.77k
    value = ast2obj_int(state, o->lineno);
10431
2.77k
    if (!value) goto failed;
10432
2.77k
    if (PyObject_SetAttr(result, state->lineno, value) < 0)
10433
0
        goto failed;
10434
2.77k
    Py_DECREF(value);
10435
2.77k
    value = ast2obj_int(state, o->col_offset);
10436
2.77k
    if (!value) goto failed;
10437
2.77k
    if (PyObject_SetAttr(result, state->col_offset, value) < 0)
10438
0
        goto failed;
10439
2.77k
    Py_DECREF(value);
10440
2.77k
    value = ast2obj_int(state, o->end_lineno);
10441
2.77k
    if (!value) goto failed;
10442
2.77k
    if (PyObject_SetAttr(result, state->end_lineno, value) < 0)
10443
0
        goto failed;
10444
2.77k
    Py_DECREF(value);
10445
2.77k
    value = ast2obj_int(state, o->end_col_offset);
10446
2.77k
    if (!value) goto failed;
10447
2.77k
    if (PyObject_SetAttr(result, state->end_col_offset, value) < 0)
10448
0
        goto failed;
10449
2.77k
    Py_DECREF(value);
10450
2.77k
    Py_LeaveRecursiveCall();
10451
2.77k
    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.77k
}
10458
10459
PyObject*
10460
ast2obj_alias(struct ast_state *state, void* _o)
10461
4.75k
{
10462
4.75k
    alias_ty o = (alias_ty)_o;
10463
4.75k
    PyObject *result = NULL, *value = NULL;
10464
4.75k
    PyTypeObject *tp;
10465
4.75k
    if (!o) {
10466
0
        Py_RETURN_NONE;
10467
0
    }
10468
4.75k
    if (Py_EnterRecursiveCall("during  ast construction")) {
10469
0
        return NULL;
10470
0
    }
10471
4.75k
    tp = (PyTypeObject *)state->alias_type;
10472
4.75k
    result = PyType_GenericNew(tp, NULL, NULL);
10473
4.75k
    if (!result) return NULL;
10474
4.75k
    value = ast2obj_identifier(state, o->name);
10475
4.75k
    if (!value) goto failed;
10476
4.75k
    if (PyObject_SetAttr(result, state->name, value) == -1)
10477
0
        goto failed;
10478
4.75k
    Py_DECREF(value);
10479
4.75k
    value = ast2obj_identifier(state, o->asname);
10480
4.75k
    if (!value) goto failed;
10481
4.75k
    if (PyObject_SetAttr(result, state->asname, value) == -1)
10482
0
        goto failed;
10483
4.75k
    Py_DECREF(value);
10484
4.75k
    value = ast2obj_int(state, o->lineno);
10485
4.75k
    if (!value) goto failed;
10486
4.75k
    if (PyObject_SetAttr(result, state->lineno, value) < 0)
10487
0
        goto failed;
10488
4.75k
    Py_DECREF(value);
10489
4.75k
    value = ast2obj_int(state, o->col_offset);
10490
4.75k
    if (!value) goto failed;
10491
4.75k
    if (PyObject_SetAttr(result, state->col_offset, value) < 0)
10492
0
        goto failed;
10493
4.75k
    Py_DECREF(value);
10494
4.75k
    value = ast2obj_int(state, o->end_lineno);
10495
4.75k
    if (!value) goto failed;
10496
4.75k
    if (PyObject_SetAttr(result, state->end_lineno, value) < 0)
10497
0
        goto failed;
10498
4.75k
    Py_DECREF(value);
10499
4.75k
    value = ast2obj_int(state, o->end_col_offset);
10500
4.75k
    if (!value) goto failed;
10501
4.75k
    if (PyObject_SetAttr(result, state->end_col_offset, value) < 0)
10502
0
        goto failed;
10503
4.75k
    Py_DECREF(value);
10504
4.75k
    Py_LeaveRecursiveCall();
10505
4.75k
    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.75k
}
10512
10513
PyObject*
10514
ast2obj_withitem(struct ast_state *state, void* _o)
10515
1.67k
{
10516
1.67k
    withitem_ty o = (withitem_ty)_o;
10517
1.67k
    PyObject *result = NULL, *value = NULL;
10518
1.67k
    PyTypeObject *tp;
10519
1.67k
    if (!o) {
10520
0
        Py_RETURN_NONE;
10521
0
    }
10522
1.67k
    if (Py_EnterRecursiveCall("during  ast construction")) {
10523
0
        return NULL;
10524
0
    }
10525
1.67k
    tp = (PyTypeObject *)state->withitem_type;
10526
1.67k
    result = PyType_GenericNew(tp, NULL, NULL);
10527
1.67k
    if (!result) return NULL;
10528
1.67k
    value = ast2obj_expr(state, o->context_expr);
10529
1.67k
    if (!value) goto failed;
10530
1.67k
    if (PyObject_SetAttr(result, state->context_expr, value) == -1)
10531
0
        goto failed;
10532
1.67k
    Py_DECREF(value);
10533
1.67k
    value = ast2obj_expr(state, o->optional_vars);
10534
1.67k
    if (!value) goto failed;
10535
1.67k
    if (PyObject_SetAttr(result, state->optional_vars, value) == -1)
10536
0
        goto failed;
10537
1.67k
    Py_DECREF(value);
10538
1.67k
    Py_LeaveRecursiveCall();
10539
1.67k
    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.67k
}
10546
10547
PyObject*
10548
ast2obj_match_case(struct ast_state *state, void* _o)
10549
740
{
10550
740
    match_case_ty o = (match_case_ty)_o;
10551
740
    PyObject *result = NULL, *value = NULL;
10552
740
    PyTypeObject *tp;
10553
740
    if (!o) {
10554
0
        Py_RETURN_NONE;
10555
0
    }
10556
740
    if (Py_EnterRecursiveCall("during  ast construction")) {
10557
0
        return NULL;
10558
0
    }
10559
740
    tp = (PyTypeObject *)state->match_case_type;
10560
740
    result = PyType_GenericNew(tp, NULL, NULL);
10561
740
    if (!result) return NULL;
10562
740
    value = ast2obj_pattern(state, o->pattern);
10563
740
    if (!value) goto failed;
10564
740
    if (PyObject_SetAttr(result, state->pattern, value) == -1)
10565
0
        goto failed;
10566
740
    Py_DECREF(value);
10567
740
    value = ast2obj_expr(state, o->guard);
10568
740
    if (!value) goto failed;
10569
740
    if (PyObject_SetAttr(result, state->guard, value) == -1)
10570
0
        goto failed;
10571
740
    Py_DECREF(value);
10572
740
    value = ast2obj_list(state, (asdl_seq*)o->body, ast2obj_stmt);
10573
740
    if (!value) goto failed;
10574
740
    if (PyObject_SetAttr(result, state->body, value) == -1)
10575
0
        goto failed;
10576
740
    Py_DECREF(value);
10577
740
    Py_LeaveRecursiveCall();
10578
740
    return result;
10579
0
failed:
10580
0
    Py_LeaveRecursiveCall();
10581
0
    Py_XDECREF(value);
10582
0
    Py_XDECREF(result);
10583
0
    return NULL;
10584
740
}
10585
10586
PyObject*
10587
ast2obj_pattern(struct ast_state *state, void* _o)
10588
22.5k
{
10589
22.5k
    pattern_ty o = (pattern_ty)_o;
10590
22.5k
    PyObject *result = NULL, *value = NULL;
10591
22.5k
    PyTypeObject *tp;
10592
22.5k
    if (!o) {
10593
8.36k
        Py_RETURN_NONE;
10594
8.36k
    }
10595
14.2k
    if (Py_EnterRecursiveCall("during  ast construction")) {
10596
0
        return NULL;
10597
0
    }
10598
14.2k
    switch (o->kind) {
10599
507
    case MatchValue_kind:
10600
507
        tp = (PyTypeObject *)state->MatchValue_type;
10601
507
        result = PyType_GenericNew(tp, NULL, NULL);
10602
507
        if (!result) goto failed;
10603
507
        value = ast2obj_expr(state, o->v.MatchValue.value);
10604
507
        if (!value) goto failed;
10605
507
        if (PyObject_SetAttr(result, state->value, value) == -1)
10606
0
            goto failed;
10607
507
        Py_DECREF(value);
10608
507
        break;
10609
305
    case MatchSingleton_kind:
10610
305
        tp = (PyTypeObject *)state->MatchSingleton_type;
10611
305
        result = PyType_GenericNew(tp, NULL, NULL);
10612
305
        if (!result) goto failed;
10613
305
        value = ast2obj_constant(state, o->v.MatchSingleton.value);
10614
305
        if (!value) goto failed;
10615
305
        if (PyObject_SetAttr(result, state->value, value) == -1)
10616
0
            goto failed;
10617
305
        Py_DECREF(value);
10618
305
        break;
10619
495
    case MatchSequence_kind:
10620
495
        tp = (PyTypeObject *)state->MatchSequence_type;
10621
495
        result = PyType_GenericNew(tp, NULL, NULL);
10622
495
        if (!result) goto failed;
10623
495
        value = ast2obj_list(state, (asdl_seq*)o->v.MatchSequence.patterns,
10624
495
                             ast2obj_pattern);
10625
495
        if (!value) goto failed;
10626
495
        if (PyObject_SetAttr(result, state->patterns, value) == -1)
10627
0
            goto failed;
10628
495
        Py_DECREF(value);
10629
495
        break;
10630
403
    case MatchMapping_kind:
10631
403
        tp = (PyTypeObject *)state->MatchMapping_type;
10632
403
        result = PyType_GenericNew(tp, NULL, NULL);
10633
403
        if (!result) goto failed;
10634
403
        value = ast2obj_list(state, (asdl_seq*)o->v.MatchMapping.keys,
10635
403
                             ast2obj_expr);
10636
403
        if (!value) goto failed;
10637
403
        if (PyObject_SetAttr(result, state->keys, value) == -1)
10638
0
            goto failed;
10639
403
        Py_DECREF(value);
10640
403
        value = ast2obj_list(state, (asdl_seq*)o->v.MatchMapping.patterns,
10641
403
                             ast2obj_pattern);
10642
403
        if (!value) goto failed;
10643
403
        if (PyObject_SetAttr(result, state->patterns, value) == -1)
10644
0
            goto failed;
10645
403
        Py_DECREF(value);
10646
403
        value = ast2obj_identifier(state, o->v.MatchMapping.rest);
10647
403
        if (!value) goto failed;
10648
403
        if (PyObject_SetAttr(result, state->rest, value) == -1)
10649
0
            goto failed;
10650
403
        Py_DECREF(value);
10651
403
        break;
10652
1.18k
    case MatchClass_kind:
10653
1.18k
        tp = (PyTypeObject *)state->MatchClass_type;
10654
1.18k
        result = PyType_GenericNew(tp, NULL, NULL);
10655
1.18k
        if (!result) goto failed;
10656
1.18k
        value = ast2obj_expr(state, o->v.MatchClass.cls);
10657
1.18k
        if (!value) goto failed;
10658
1.18k
        if (PyObject_SetAttr(result, state->cls, value) == -1)
10659
0
            goto failed;
10660
1.18k
        Py_DECREF(value);
10661
1.18k
        value = ast2obj_list(state, (asdl_seq*)o->v.MatchClass.patterns,
10662
1.18k
                             ast2obj_pattern);
10663
1.18k
        if (!value) goto failed;
10664
1.18k
        if (PyObject_SetAttr(result, state->patterns, value) == -1)
10665
0
            goto failed;
10666
1.18k
        Py_DECREF(value);
10667
1.18k
        value = ast2obj_list(state, (asdl_seq*)o->v.MatchClass.kwd_attrs,
10668
1.18k
                             ast2obj_identifier);
10669
1.18k
        if (!value) goto failed;
10670
1.18k
        if (PyObject_SetAttr(result, state->kwd_attrs, value) == -1)
10671
0
            goto failed;
10672
1.18k
        Py_DECREF(value);
10673
1.18k
        value = ast2obj_list(state, (asdl_seq*)o->v.MatchClass.kwd_patterns,
10674
1.18k
                             ast2obj_pattern);
10675
1.18k
        if (!value) goto failed;
10676
1.18k
        if (PyObject_SetAttr(result, state->kwd_patterns, value) == -1)
10677
0
            goto failed;
10678
1.18k
        Py_DECREF(value);
10679
1.18k
        break;
10680
291
    case MatchStar_kind:
10681
291
        tp = (PyTypeObject *)state->MatchStar_type;
10682
291
        result = PyType_GenericNew(tp, NULL, NULL);
10683
291
        if (!result) goto failed;
10684
291
        value = ast2obj_identifier(state, o->v.MatchStar.name);
10685
291
        if (!value) goto failed;
10686
291
        if (PyObject_SetAttr(result, state->name, value) == -1)
10687
0
            goto failed;
10688
291
        Py_DECREF(value);
10689
291
        break;
10690
8.44k
    case MatchAs_kind:
10691
8.44k
        tp = (PyTypeObject *)state->MatchAs_type;
10692
8.44k
        result = PyType_GenericNew(tp, NULL, NULL);
10693
8.44k
        if (!result) goto failed;
10694
8.44k
        value = ast2obj_pattern(state, o->v.MatchAs.pattern);
10695
8.44k
        if (!value) goto failed;
10696
8.44k
        if (PyObject_SetAttr(result, state->pattern, value) == -1)
10697
0
            goto failed;
10698
8.44k
        Py_DECREF(value);
10699
8.44k
        value = ast2obj_identifier(state, o->v.MatchAs.name);
10700
8.44k
        if (!value) goto failed;
10701
8.44k
        if (PyObject_SetAttr(result, state->name, value) == -1)
10702
0
            goto failed;
10703
8.44k
        Py_DECREF(value);
10704
8.44k
        break;
10705
2.57k
    case MatchOr_kind:
10706
2.57k
        tp = (PyTypeObject *)state->MatchOr_type;
10707
2.57k
        result = PyType_GenericNew(tp, NULL, NULL);
10708
2.57k
        if (!result) goto failed;
10709
2.57k
        value = ast2obj_list(state, (asdl_seq*)o->v.MatchOr.patterns,
10710
2.57k
                             ast2obj_pattern);
10711
2.57k
        if (!value) goto failed;
10712
2.57k
        if (PyObject_SetAttr(result, state->patterns, value) == -1)
10713
0
            goto failed;
10714
2.57k
        Py_DECREF(value);
10715
2.57k
        break;
10716
14.2k
    }
10717
14.2k
    value = ast2obj_int(state, o->lineno);
10718
14.2k
    if (!value) goto failed;
10719
14.2k
    if (PyObject_SetAttr(result, state->lineno, value) < 0)
10720
0
        goto failed;
10721
14.2k
    Py_DECREF(value);
10722
14.2k
    value = ast2obj_int(state, o->col_offset);
10723
14.2k
    if (!value) goto failed;
10724
14.2k
    if (PyObject_SetAttr(result, state->col_offset, value) < 0)
10725
0
        goto failed;
10726
14.2k
    Py_DECREF(value);
10727
14.2k
    value = ast2obj_int(state, o->end_lineno);
10728
14.2k
    if (!value) goto failed;
10729
14.2k
    if (PyObject_SetAttr(result, state->end_lineno, value) < 0)
10730
0
        goto failed;
10731
14.2k
    Py_DECREF(value);
10732
14.2k
    value = ast2obj_int(state, o->end_col_offset);
10733
14.2k
    if (!value) goto failed;
10734
14.2k
    if (PyObject_SetAttr(result, state->end_col_offset, value) < 0)
10735
0
        goto failed;
10736
14.2k
    Py_DECREF(value);
10737
14.2k
    Py_LeaveRecursiveCall();
10738
14.2k
    return result;
10739
0
failed:
10740
0
    Py_LeaveRecursiveCall();
10741
0
    Py_XDECREF(value);
10742
0
    Py_XDECREF(result);
10743
0
    return NULL;
10744
14.2k
}
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
5.90k
{
10787
5.90k
    type_param_ty o = (type_param_ty)_o;
10788
5.90k
    PyObject *result = NULL, *value = NULL;
10789
5.90k
    PyTypeObject *tp;
10790
5.90k
    if (!o) {
10791
0
        Py_RETURN_NONE;
10792
0
    }
10793
5.90k
    if (Py_EnterRecursiveCall("during  ast construction")) {
10794
0
        return NULL;
10795
0
    }
10796
5.90k
    switch (o->kind) {
10797
4.80k
    case TypeVar_kind:
10798
4.80k
        tp = (PyTypeObject *)state->TypeVar_type;
10799
4.80k
        result = PyType_GenericNew(tp, NULL, NULL);
10800
4.80k
        if (!result) goto failed;
10801
4.80k
        value = ast2obj_identifier(state, o->v.TypeVar.name);
10802
4.80k
        if (!value) goto failed;
10803
4.80k
        if (PyObject_SetAttr(result, state->name, value) == -1)
10804
0
            goto failed;
10805
4.80k
        Py_DECREF(value);
10806
4.80k
        value = ast2obj_expr(state, o->v.TypeVar.bound);
10807
4.80k
        if (!value) goto failed;
10808
4.80k
        if (PyObject_SetAttr(result, state->bound, value) == -1)
10809
0
            goto failed;
10810
4.80k
        Py_DECREF(value);
10811
4.80k
        value = ast2obj_expr(state, o->v.TypeVar.default_value);
10812
4.80k
        if (!value) goto failed;
10813
4.80k
        if (PyObject_SetAttr(result, state->default_value, value) == -1)
10814
0
            goto failed;
10815
4.80k
        Py_DECREF(value);
10816
4.80k
        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
670
    case TypeVarTuple_kind:
10833
670
        tp = (PyTypeObject *)state->TypeVarTuple_type;
10834
670
        result = PyType_GenericNew(tp, NULL, NULL);
10835
670
        if (!result) goto failed;
10836
670
        value = ast2obj_identifier(state, o->v.TypeVarTuple.name);
10837
670
        if (!value) goto failed;
10838
670
        if (PyObject_SetAttr(result, state->name, value) == -1)
10839
0
            goto failed;
10840
670
        Py_DECREF(value);
10841
670
        value = ast2obj_expr(state, o->v.TypeVarTuple.default_value);
10842
670
        if (!value) goto failed;
10843
670
        if (PyObject_SetAttr(result, state->default_value, value) == -1)
10844
0
            goto failed;
10845
670
        Py_DECREF(value);
10846
670
        break;
10847
5.90k
    }
10848
5.90k
    value = ast2obj_int(state, o->lineno);
10849
5.90k
    if (!value) goto failed;
10850
5.90k
    if (PyObject_SetAttr(result, state->lineno, value) < 0)
10851
0
        goto failed;
10852
5.90k
    Py_DECREF(value);
10853
5.90k
    value = ast2obj_int(state, o->col_offset);
10854
5.90k
    if (!value) goto failed;
10855
5.90k
    if (PyObject_SetAttr(result, state->col_offset, value) < 0)
10856
0
        goto failed;
10857
5.90k
    Py_DECREF(value);
10858
5.90k
    value = ast2obj_int(state, o->end_lineno);
10859
5.90k
    if (!value) goto failed;
10860
5.90k
    if (PyObject_SetAttr(result, state->end_lineno, value) < 0)
10861
0
        goto failed;
10862
5.90k
    Py_DECREF(value);
10863
5.90k
    value = ast2obj_int(state, o->end_col_offset);
10864
5.90k
    if (!value) goto failed;
10865
5.90k
    if (PyObject_SetAttr(result, state->end_col_offset, value) < 0)
10866
0
        goto failed;
10867
5.90k
    Py_DECREF(value);
10868
5.90k
    Py_LeaveRecursiveCall();
10869
5.90k
    return result;
10870
0
failed:
10871
0
    Py_LeaveRecursiveCall();
10872
0
    Py_XDECREF(value);
10873
0
    Py_XDECREF(result);
10874
0
    return NULL;
10875
5.90k
}
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.22k
{
18417
6.22k
    struct ast_state *state = get_ast_state();
18418
6.22k
    if (state == NULL) {
18419
0
        return NULL;
18420
0
    }
18421
6.22k
    PyObject *result = ast2obj_mod(state, t);
18422
18423
6.22k
    return result;
18424
6.22k
}
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.4k
{
18478
21.4k
    struct ast_state *state = get_ast_state();
18479
21.4k
    if (state == NULL) {
18480
0
        return -1;
18481
0
    }
18482
21.4k
    return PyObject_IsInstance(obj, state->AST_type);
18483
21.4k
}
18484
18485