Coverage Report

Created: 2026-03-19 06:23

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/cpython3/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
1.67k
{
23
1.67k
    PyInterpreterState *interp = _PyInterpreterState_GET();
24
1.67k
    struct ast_state *state = &interp->ast;
25
1.67k
    assert(!state->finalized);
26
1.67k
    if (_PyOnceFlag_CallOnce(&state->once, (_Py_once_fn_t *)&init_types, state) < 0) {
27
0
        return NULL;
28
0
    }
29
1.67k
    return state;
30
1.67k
}
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->is_lazy);
226
0
    Py_CLEAR(state->items);
227
0
    Py_CLEAR(state->iter);
228
0
    Py_CLEAR(state->key);
229
0
    Py_CLEAR(state->keys);
230
0
    Py_CLEAR(state->keyword_type);
231
0
    Py_CLEAR(state->keywords);
232
0
    Py_CLEAR(state->kind);
233
0
    Py_CLEAR(state->kw_defaults);
234
0
    Py_CLEAR(state->kwarg);
235
0
    Py_CLEAR(state->kwd_attrs);
236
0
    Py_CLEAR(state->kwd_patterns);
237
0
    Py_CLEAR(state->kwonlyargs);
238
0
    Py_CLEAR(state->left);
239
0
    Py_CLEAR(state->level);
240
0
    Py_CLEAR(state->lineno);
241
0
    Py_CLEAR(state->lower);
242
0
    Py_CLEAR(state->match_case_type);
243
0
    Py_CLEAR(state->mod_type);
244
0
    Py_CLEAR(state->module);
245
0
    Py_CLEAR(state->msg);
246
0
    Py_CLEAR(state->name);
247
0
    Py_CLEAR(state->names);
248
0
    Py_CLEAR(state->op);
249
0
    Py_CLEAR(state->operand);
250
0
    Py_CLEAR(state->operator_type);
251
0
    Py_CLEAR(state->ops);
252
0
    Py_CLEAR(state->optional_vars);
253
0
    Py_CLEAR(state->orelse);
254
0
    Py_CLEAR(state->pattern);
255
0
    Py_CLEAR(state->pattern_type);
256
0
    Py_CLEAR(state->patterns);
257
0
    Py_CLEAR(state->posonlyargs);
258
0
    Py_CLEAR(state->rest);
259
0
    Py_CLEAR(state->returns);
260
0
    Py_CLEAR(state->right);
261
0
    Py_CLEAR(state->simple);
262
0
    Py_CLEAR(state->slice);
263
0
    Py_CLEAR(state->step);
264
0
    Py_CLEAR(state->stmt_type);
265
0
    Py_CLEAR(state->str);
266
0
    Py_CLEAR(state->subject);
267
0
    Py_CLEAR(state->tag);
268
0
    Py_CLEAR(state->target);
269
0
    Py_CLEAR(state->targets);
270
0
    Py_CLEAR(state->test);
271
0
    Py_CLEAR(state->type);
272
0
    Py_CLEAR(state->type_comment);
273
0
    Py_CLEAR(state->type_ignore_type);
274
0
    Py_CLEAR(state->type_ignores);
275
0
    Py_CLEAR(state->type_param_type);
276
0
    Py_CLEAR(state->type_params);
277
0
    Py_CLEAR(state->unaryop_type);
278
0
    Py_CLEAR(state->upper);
279
0
    Py_CLEAR(state->value);
280
0
    Py_CLEAR(state->values);
281
0
    Py_CLEAR(state->vararg);
282
0
    Py_CLEAR(state->withitem_type);
283
284
0
    state->finalized = 1;
285
0
    state->once = (_PyOnceFlag){0};
286
0
}
287
288
static int init_identifiers(struct ast_state *state)
289
2
{
290
2
    if ((state->__dict__ = PyUnicode_InternFromString("__dict__")) == NULL) return -1;
291
2
    if ((state->__doc__ = PyUnicode_InternFromString("__doc__")) == NULL) return -1;
292
2
    if ((state->__match_args__ = PyUnicode_InternFromString("__match_args__")) == NULL) return -1;
293
2
    if ((state->__module__ = PyUnicode_InternFromString("__module__")) == NULL) return -1;
294
2
    if ((state->_attributes = PyUnicode_InternFromString("_attributes")) == NULL) return -1;
295
2
    if ((state->_fields = PyUnicode_InternFromString("_fields")) == NULL) return -1;
296
2
    if ((state->annotation = PyUnicode_InternFromString("annotation")) == NULL) return -1;
297
2
    if ((state->arg = PyUnicode_InternFromString("arg")) == NULL) return -1;
298
2
    if ((state->args = PyUnicode_InternFromString("args")) == NULL) return -1;
299
2
    if ((state->argtypes = PyUnicode_InternFromString("argtypes")) == NULL) return -1;
300
2
    if ((state->asname = PyUnicode_InternFromString("asname")) == NULL) return -1;
301
2
    if ((state->ast = PyUnicode_InternFromString("ast")) == NULL) return -1;
302
2
    if ((state->attr = PyUnicode_InternFromString("attr")) == NULL) return -1;
303
2
    if ((state->bases = PyUnicode_InternFromString("bases")) == NULL) return -1;
304
2
    if ((state->body = PyUnicode_InternFromString("body")) == NULL) return -1;
305
2
    if ((state->bound = PyUnicode_InternFromString("bound")) == NULL) return -1;
306
2
    if ((state->cases = PyUnicode_InternFromString("cases")) == NULL) return -1;
307
2
    if ((state->cause = PyUnicode_InternFromString("cause")) == NULL) return -1;
308
2
    if ((state->cls = PyUnicode_InternFromString("cls")) == NULL) return -1;
309
2
    if ((state->col_offset = PyUnicode_InternFromString("col_offset")) == NULL) return -1;
310
2
    if ((state->comparators = PyUnicode_InternFromString("comparators")) == NULL) return -1;
311
2
    if ((state->context_expr = PyUnicode_InternFromString("context_expr")) == NULL) return -1;
312
2
    if ((state->conversion = PyUnicode_InternFromString("conversion")) == NULL) return -1;
313
2
    if ((state->ctx = PyUnicode_InternFromString("ctx")) == NULL) return -1;
314
2
    if ((state->decorator_list = PyUnicode_InternFromString("decorator_list")) == NULL) return -1;
315
2
    if ((state->default_value = PyUnicode_InternFromString("default_value")) == NULL) return -1;
316
2
    if ((state->defaults = PyUnicode_InternFromString("defaults")) == NULL) return -1;
317
2
    if ((state->elt = PyUnicode_InternFromString("elt")) == NULL) return -1;
318
2
    if ((state->elts = PyUnicode_InternFromString("elts")) == NULL) return -1;
319
2
    if ((state->end_col_offset = PyUnicode_InternFromString("end_col_offset")) == NULL) return -1;
320
2
    if ((state->end_lineno = PyUnicode_InternFromString("end_lineno")) == NULL) return -1;
321
2
    if ((state->exc = PyUnicode_InternFromString("exc")) == NULL) return -1;
322
2
    if ((state->finalbody = PyUnicode_InternFromString("finalbody")) == NULL) return -1;
323
2
    if ((state->format_spec = PyUnicode_InternFromString("format_spec")) == NULL) return -1;
324
2
    if ((state->func = PyUnicode_InternFromString("func")) == NULL) return -1;
325
2
    if ((state->generators = PyUnicode_InternFromString("generators")) == NULL) return -1;
326
2
    if ((state->guard = PyUnicode_InternFromString("guard")) == NULL) return -1;
327
2
    if ((state->handlers = PyUnicode_InternFromString("handlers")) == NULL) return -1;
328
2
    if ((state->id = PyUnicode_InternFromString("id")) == NULL) return -1;
329
2
    if ((state->ifs = PyUnicode_InternFromString("ifs")) == NULL) return -1;
330
2
    if ((state->is_async = PyUnicode_InternFromString("is_async")) == NULL) return -1;
331
2
    if ((state->is_lazy = PyUnicode_InternFromString("is_lazy")) == NULL) return -1;
332
2
    if ((state->items = PyUnicode_InternFromString("items")) == NULL) return -1;
333
2
    if ((state->iter = PyUnicode_InternFromString("iter")) == NULL) return -1;
334
2
    if ((state->key = PyUnicode_InternFromString("key")) == NULL) return -1;
335
2
    if ((state->keys = PyUnicode_InternFromString("keys")) == NULL) return -1;
336
2
    if ((state->keywords = PyUnicode_InternFromString("keywords")) == NULL) return -1;
337
2
    if ((state->kind = PyUnicode_InternFromString("kind")) == NULL) return -1;
338
2
    if ((state->kw_defaults = PyUnicode_InternFromString("kw_defaults")) == NULL) return -1;
339
2
    if ((state->kwarg = PyUnicode_InternFromString("kwarg")) == NULL) return -1;
340
2
    if ((state->kwd_attrs = PyUnicode_InternFromString("kwd_attrs")) == NULL) return -1;
341
2
    if ((state->kwd_patterns = PyUnicode_InternFromString("kwd_patterns")) == NULL) return -1;
342
2
    if ((state->kwonlyargs = PyUnicode_InternFromString("kwonlyargs")) == NULL) return -1;
343
2
    if ((state->left = PyUnicode_InternFromString("left")) == NULL) return -1;
344
2
    if ((state->level = PyUnicode_InternFromString("level")) == NULL) return -1;
345
2
    if ((state->lineno = PyUnicode_InternFromString("lineno")) == NULL) return -1;
346
2
    if ((state->lower = PyUnicode_InternFromString("lower")) == NULL) return -1;
347
2
    if ((state->module = PyUnicode_InternFromString("module")) == NULL) return -1;
348
2
    if ((state->msg = PyUnicode_InternFromString("msg")) == NULL) return -1;
349
2
    if ((state->name = PyUnicode_InternFromString("name")) == NULL) return -1;
350
2
    if ((state->names = PyUnicode_InternFromString("names")) == NULL) return -1;
351
2
    if ((state->op = PyUnicode_InternFromString("op")) == NULL) return -1;
352
2
    if ((state->operand = PyUnicode_InternFromString("operand")) == NULL) return -1;
353
2
    if ((state->ops = PyUnicode_InternFromString("ops")) == NULL) return -1;
354
2
    if ((state->optional_vars = PyUnicode_InternFromString("optional_vars")) == NULL) return -1;
355
2
    if ((state->orelse = PyUnicode_InternFromString("orelse")) == NULL) return -1;
356
2
    if ((state->pattern = PyUnicode_InternFromString("pattern")) == NULL) return -1;
357
2
    if ((state->patterns = PyUnicode_InternFromString("patterns")) == NULL) return -1;
358
2
    if ((state->posonlyargs = PyUnicode_InternFromString("posonlyargs")) == NULL) return -1;
359
2
    if ((state->rest = PyUnicode_InternFromString("rest")) == NULL) return -1;
360
2
    if ((state->returns = PyUnicode_InternFromString("returns")) == NULL) return -1;
361
2
    if ((state->right = PyUnicode_InternFromString("right")) == NULL) return -1;
362
2
    if ((state->simple = PyUnicode_InternFromString("simple")) == NULL) return -1;
363
2
    if ((state->slice = PyUnicode_InternFromString("slice")) == NULL) return -1;
364
2
    if ((state->step = PyUnicode_InternFromString("step")) == NULL) return -1;
365
2
    if ((state->str = PyUnicode_InternFromString("str")) == NULL) return -1;
366
2
    if ((state->subject = PyUnicode_InternFromString("subject")) == NULL) return -1;
367
2
    if ((state->tag = PyUnicode_InternFromString("tag")) == NULL) return -1;
368
2
    if ((state->target = PyUnicode_InternFromString("target")) == NULL) return -1;
369
2
    if ((state->targets = PyUnicode_InternFromString("targets")) == NULL) return -1;
370
2
    if ((state->test = PyUnicode_InternFromString("test")) == NULL) return -1;
371
2
    if ((state->type = PyUnicode_InternFromString("type")) == NULL) return -1;
372
2
    if ((state->type_comment = PyUnicode_InternFromString("type_comment")) == NULL) return -1;
373
2
    if ((state->type_ignores = PyUnicode_InternFromString("type_ignores")) == NULL) return -1;
374
2
    if ((state->type_params = PyUnicode_InternFromString("type_params")) == NULL) return -1;
375
2
    if ((state->upper = PyUnicode_InternFromString("upper")) == NULL) return -1;
376
2
    if ((state->value = PyUnicode_InternFromString("value")) == NULL) return -1;
377
2
    if ((state->values = PyUnicode_InternFromString("values")) == NULL) return -1;
378
2
    if ((state->vararg = PyUnicode_InternFromString("vararg")) == NULL) return -1;
379
2
    return 0;
380
2
};
381
382
0
GENERATE_ASDL_SEQ_CONSTRUCTOR(mod, mod_ty)
383
0
GENERATE_ASDL_SEQ_CONSTRUCTOR(stmt, stmt_ty)
384
97.0k
GENERATE_ASDL_SEQ_CONSTRUCTOR(expr, expr_ty)
385
0
GENERATE_ASDL_SEQ_CONSTRUCTOR(comprehension, comprehension_ty)
386
0
GENERATE_ASDL_SEQ_CONSTRUCTOR(excepthandler, excepthandler_ty)
387
0
GENERATE_ASDL_SEQ_CONSTRUCTOR(arguments, arguments_ty)
388
50.6k
GENERATE_ASDL_SEQ_CONSTRUCTOR(arg, arg_ty)
389
8.02k
GENERATE_ASDL_SEQ_CONSTRUCTOR(keyword, keyword_ty)
390
0
GENERATE_ASDL_SEQ_CONSTRUCTOR(alias, alias_ty)
391
0
GENERATE_ASDL_SEQ_CONSTRUCTOR(withitem, withitem_ty)
392
0
GENERATE_ASDL_SEQ_CONSTRUCTOR(match_case, match_case_ty)
393
5
GENERATE_ASDL_SEQ_CONSTRUCTOR(pattern, pattern_ty)
394
0
GENERATE_ASDL_SEQ_CONSTRUCTOR(type_ignore, type_ignore_ty)
395
0
GENERATE_ASDL_SEQ_CONSTRUCTOR(type_param, type_param_ty)
396
397
static PyObject* ast2obj_mod(struct ast_state *state, void*);
398
static const char * const Module_fields[]={
399
    "body",
400
    "type_ignores",
401
};
402
static const char * const Interactive_fields[]={
403
    "body",
404
};
405
static const char * const Expression_fields[]={
406
    "body",
407
};
408
static const char * const FunctionType_fields[]={
409
    "argtypes",
410
    "returns",
411
};
412
static const char * const stmt_attributes[] = {
413
    "lineno",
414
    "col_offset",
415
    "end_lineno",
416
    "end_col_offset",
417
};
418
static PyObject* ast2obj_stmt(struct ast_state *state, void*);
419
static const char * const FunctionDef_fields[]={
420
    "name",
421
    "args",
422
    "body",
423
    "decorator_list",
424
    "returns",
425
    "type_comment",
426
    "type_params",
427
};
428
static const char * const AsyncFunctionDef_fields[]={
429
    "name",
430
    "args",
431
    "body",
432
    "decorator_list",
433
    "returns",
434
    "type_comment",
435
    "type_params",
436
};
437
static const char * const ClassDef_fields[]={
438
    "name",
439
    "bases",
440
    "keywords",
441
    "body",
442
    "decorator_list",
443
    "type_params",
444
};
445
static const char * const Return_fields[]={
446
    "value",
447
};
448
static const char * const Delete_fields[]={
449
    "targets",
450
};
451
static const char * const Assign_fields[]={
452
    "targets",
453
    "value",
454
    "type_comment",
455
};
456
static const char * const TypeAlias_fields[]={
457
    "name",
458
    "type_params",
459
    "value",
460
};
461
static const char * const AugAssign_fields[]={
462
    "target",
463
    "op",
464
    "value",
465
};
466
static const char * const AnnAssign_fields[]={
467
    "target",
468
    "annotation",
469
    "value",
470
    "simple",
471
};
472
static const char * const For_fields[]={
473
    "target",
474
    "iter",
475
    "body",
476
    "orelse",
477
    "type_comment",
478
};
479
static const char * const AsyncFor_fields[]={
480
    "target",
481
    "iter",
482
    "body",
483
    "orelse",
484
    "type_comment",
485
};
486
static const char * const While_fields[]={
487
    "test",
488
    "body",
489
    "orelse",
490
};
491
static const char * const If_fields[]={
492
    "test",
493
    "body",
494
    "orelse",
495
};
496
static const char * const With_fields[]={
497
    "items",
498
    "body",
499
    "type_comment",
500
};
501
static const char * const AsyncWith_fields[]={
502
    "items",
503
    "body",
504
    "type_comment",
505
};
506
static const char * const Match_fields[]={
507
    "subject",
508
    "cases",
509
};
510
static const char * const Raise_fields[]={
511
    "exc",
512
    "cause",
513
};
514
static const char * const Try_fields[]={
515
    "body",
516
    "handlers",
517
    "orelse",
518
    "finalbody",
519
};
520
static const char * const TryStar_fields[]={
521
    "body",
522
    "handlers",
523
    "orelse",
524
    "finalbody",
525
};
526
static const char * const Assert_fields[]={
527
    "test",
528
    "msg",
529
};
530
static const char * const Import_fields[]={
531
    "names",
532
    "is_lazy",
533
};
534
static const char * const ImportFrom_fields[]={
535
    "module",
536
    "names",
537
    "level",
538
    "is_lazy",
539
};
540
static const char * const Global_fields[]={
541
    "names",
542
};
543
static const char * const Nonlocal_fields[]={
544
    "names",
545
};
546
static const char * const Expr_fields[]={
547
    "value",
548
};
549
static const char * const expr_attributes[] = {
550
    "lineno",
551
    "col_offset",
552
    "end_lineno",
553
    "end_col_offset",
554
};
555
static PyObject* ast2obj_expr(struct ast_state *state, void*);
556
static const char * const BoolOp_fields[]={
557
    "op",
558
    "values",
559
};
560
static const char * const NamedExpr_fields[]={
561
    "target",
562
    "value",
563
};
564
static const char * const BinOp_fields[]={
565
    "left",
566
    "op",
567
    "right",
568
};
569
static const char * const UnaryOp_fields[]={
570
    "op",
571
    "operand",
572
};
573
static const char * const Lambda_fields[]={
574
    "args",
575
    "body",
576
};
577
static const char * const IfExp_fields[]={
578
    "test",
579
    "body",
580
    "orelse",
581
};
582
static const char * const Dict_fields[]={
583
    "keys",
584
    "values",
585
};
586
static const char * const Set_fields[]={
587
    "elts",
588
};
589
static const char * const ListComp_fields[]={
590
    "elt",
591
    "generators",
592
};
593
static const char * const SetComp_fields[]={
594
    "elt",
595
    "generators",
596
};
597
static const char * const DictComp_fields[]={
598
    "key",
599
    "value",
600
    "generators",
601
};
602
static const char * const GeneratorExp_fields[]={
603
    "elt",
604
    "generators",
605
};
606
static const char * const Await_fields[]={
607
    "value",
608
};
609
static const char * const Yield_fields[]={
610
    "value",
611
};
612
static const char * const YieldFrom_fields[]={
613
    "value",
614
};
615
static const char * const Compare_fields[]={
616
    "left",
617
    "ops",
618
    "comparators",
619
};
620
static const char * const Call_fields[]={
621
    "func",
622
    "args",
623
    "keywords",
624
};
625
static const char * const FormattedValue_fields[]={
626
    "value",
627
    "conversion",
628
    "format_spec",
629
};
630
static const char * const Interpolation_fields[]={
631
    "value",
632
    "str",
633
    "conversion",
634
    "format_spec",
635
};
636
static const char * const JoinedStr_fields[]={
637
    "values",
638
};
639
static const char * const TemplateStr_fields[]={
640
    "values",
641
};
642
static const char * const Constant_fields[]={
643
    "value",
644
    "kind",
645
};
646
static const char * const Attribute_fields[]={
647
    "value",
648
    "attr",
649
    "ctx",
650
};
651
static const char * const Subscript_fields[]={
652
    "value",
653
    "slice",
654
    "ctx",
655
};
656
static const char * const Starred_fields[]={
657
    "value",
658
    "ctx",
659
};
660
static const char * const Name_fields[]={
661
    "id",
662
    "ctx",
663
};
664
static const char * const List_fields[]={
665
    "elts",
666
    "ctx",
667
};
668
static const char * const Tuple_fields[]={
669
    "elts",
670
    "ctx",
671
};
672
static const char * const Slice_fields[]={
673
    "lower",
674
    "upper",
675
    "step",
676
};
677
static PyObject* ast2obj_expr_context(struct ast_state *state, expr_context_ty);
678
static PyObject* ast2obj_boolop(struct ast_state *state, boolop_ty);
679
static PyObject* ast2obj_operator(struct ast_state *state, operator_ty);
680
static PyObject* ast2obj_unaryop(struct ast_state *state, unaryop_ty);
681
static PyObject* ast2obj_cmpop(struct ast_state *state, cmpop_ty);
682
static PyObject* ast2obj_comprehension(struct ast_state *state, void*);
683
static const char * const comprehension_fields[]={
684
    "target",
685
    "iter",
686
    "ifs",
687
    "is_async",
688
};
689
static const char * const excepthandler_attributes[] = {
690
    "lineno",
691
    "col_offset",
692
    "end_lineno",
693
    "end_col_offset",
694
};
695
static PyObject* ast2obj_excepthandler(struct ast_state *state, void*);
696
static const char * const ExceptHandler_fields[]={
697
    "type",
698
    "name",
699
    "body",
700
};
701
static PyObject* ast2obj_arguments(struct ast_state *state, void*);
702
static const char * const arguments_fields[]={
703
    "posonlyargs",
704
    "args",
705
    "vararg",
706
    "kwonlyargs",
707
    "kw_defaults",
708
    "kwarg",
709
    "defaults",
710
};
711
static PyObject* ast2obj_arg(struct ast_state *state, void*);
712
static const char * const arg_attributes[] = {
713
    "lineno",
714
    "col_offset",
715
    "end_lineno",
716
    "end_col_offset",
717
};
718
static const char * const arg_fields[]={
719
    "arg",
720
    "annotation",
721
    "type_comment",
722
};
723
static PyObject* ast2obj_keyword(struct ast_state *state, void*);
724
static const char * const keyword_attributes[] = {
725
    "lineno",
726
    "col_offset",
727
    "end_lineno",
728
    "end_col_offset",
729
};
730
static const char * const keyword_fields[]={
731
    "arg",
732
    "value",
733
};
734
static PyObject* ast2obj_alias(struct ast_state *state, void*);
735
static const char * const alias_attributes[] = {
736
    "lineno",
737
    "col_offset",
738
    "end_lineno",
739
    "end_col_offset",
740
};
741
static const char * const alias_fields[]={
742
    "name",
743
    "asname",
744
};
745
static PyObject* ast2obj_withitem(struct ast_state *state, void*);
746
static const char * const withitem_fields[]={
747
    "context_expr",
748
    "optional_vars",
749
};
750
static PyObject* ast2obj_match_case(struct ast_state *state, void*);
751
static const char * const match_case_fields[]={
752
    "pattern",
753
    "guard",
754
    "body",
755
};
756
static const char * const pattern_attributes[] = {
757
    "lineno",
758
    "col_offset",
759
    "end_lineno",
760
    "end_col_offset",
761
};
762
static PyObject* ast2obj_pattern(struct ast_state *state, void*);
763
static const char * const MatchValue_fields[]={
764
    "value",
765
};
766
static const char * const MatchSingleton_fields[]={
767
    "value",
768
};
769
static const char * const MatchSequence_fields[]={
770
    "patterns",
771
};
772
static const char * const MatchMapping_fields[]={
773
    "keys",
774
    "patterns",
775
    "rest",
776
};
777
static const char * const MatchClass_fields[]={
778
    "cls",
779
    "patterns",
780
    "kwd_attrs",
781
    "kwd_patterns",
782
};
783
static const char * const MatchStar_fields[]={
784
    "name",
785
};
786
static const char * const MatchAs_fields[]={
787
    "pattern",
788
    "name",
789
};
790
static const char * const MatchOr_fields[]={
791
    "patterns",
792
};
793
static PyObject* ast2obj_type_ignore(struct ast_state *state, void*);
794
static const char * const TypeIgnore_fields[]={
795
    "lineno",
796
    "tag",
797
};
798
static const char * const type_param_attributes[] = {
799
    "lineno",
800
    "col_offset",
801
    "end_lineno",
802
    "end_col_offset",
803
};
804
static PyObject* ast2obj_type_param(struct ast_state *state, void*);
805
static const char * const TypeVar_fields[]={
806
    "name",
807
    "bound",
808
    "default_value",
809
};
810
static const char * const ParamSpec_fields[]={
811
    "name",
812
    "default_value",
813
};
814
static const char * const TypeVarTuple_fields[]={
815
    "name",
816
    "default_value",
817
};
818
819
820
static int
821
add_ast_annotations(struct ast_state *state)
822
2
{
823
2
    bool cond;
824
2
    PyObject *Module_annotations = PyDict_New();
825
2
    if (!Module_annotations) return 0;
826
2
    {
827
2
        PyObject *type = state->stmt_type;
828
2
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
829
2
        cond = type != NULL;
830
2
        if (!cond) {
831
0
            Py_DECREF(Module_annotations);
832
0
            return 0;
833
0
        }
834
2
        cond = PyDict_SetItemString(Module_annotations, "body", type) == 0;
835
2
        Py_DECREF(type);
836
2
        if (!cond) {
837
0
            Py_DECREF(Module_annotations);
838
0
            return 0;
839
0
        }
840
2
    }
841
2
    {
842
2
        PyObject *type = state->type_ignore_type;
843
2
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
844
2
        cond = type != NULL;
845
2
        if (!cond) {
846
0
            Py_DECREF(Module_annotations);
847
0
            return 0;
848
0
        }
849
2
        cond = PyDict_SetItemString(Module_annotations, "type_ignores", type)
850
2
                                    == 0;
851
2
        Py_DECREF(type);
852
2
        if (!cond) {
853
0
            Py_DECREF(Module_annotations);
854
0
            return 0;
855
0
        }
856
2
    }
857
2
    cond = PyObject_SetAttrString(state->Module_type, "_field_types",
858
2
                                  Module_annotations) == 0;
859
2
    if (!cond) {
860
0
        Py_DECREF(Module_annotations);
861
0
        return 0;
862
0
    }
863
2
    cond = PyObject_SetAttrString(state->Module_type, "__annotations__",
864
2
                                  Module_annotations) == 0;
865
2
    if (!cond) {
866
0
        Py_DECREF(Module_annotations);
867
0
        return 0;
868
0
    }
869
2
    Py_DECREF(Module_annotations);
870
2
    PyObject *Interactive_annotations = PyDict_New();
871
2
    if (!Interactive_annotations) return 0;
872
2
    {
873
2
        PyObject *type = state->stmt_type;
874
2
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
875
2
        cond = type != NULL;
876
2
        if (!cond) {
877
0
            Py_DECREF(Interactive_annotations);
878
0
            return 0;
879
0
        }
880
2
        cond = PyDict_SetItemString(Interactive_annotations, "body", type) == 0;
881
2
        Py_DECREF(type);
882
2
        if (!cond) {
883
0
            Py_DECREF(Interactive_annotations);
884
0
            return 0;
885
0
        }
886
2
    }
887
2
    cond = PyObject_SetAttrString(state->Interactive_type, "_field_types",
888
2
                                  Interactive_annotations) == 0;
889
2
    if (!cond) {
890
0
        Py_DECREF(Interactive_annotations);
891
0
        return 0;
892
0
    }
893
2
    cond = PyObject_SetAttrString(state->Interactive_type, "__annotations__",
894
2
                                  Interactive_annotations) == 0;
895
2
    if (!cond) {
896
0
        Py_DECREF(Interactive_annotations);
897
0
        return 0;
898
0
    }
899
2
    Py_DECREF(Interactive_annotations);
900
2
    PyObject *Expression_annotations = PyDict_New();
901
2
    if (!Expression_annotations) return 0;
902
2
    {
903
2
        PyObject *type = state->expr_type;
904
2
        Py_INCREF(type);
905
2
        cond = PyDict_SetItemString(Expression_annotations, "body", type) == 0;
906
2
        Py_DECREF(type);
907
2
        if (!cond) {
908
0
            Py_DECREF(Expression_annotations);
909
0
            return 0;
910
0
        }
911
2
    }
912
2
    cond = PyObject_SetAttrString(state->Expression_type, "_field_types",
913
2
                                  Expression_annotations) == 0;
914
2
    if (!cond) {
915
0
        Py_DECREF(Expression_annotations);
916
0
        return 0;
917
0
    }
918
2
    cond = PyObject_SetAttrString(state->Expression_type, "__annotations__",
919
2
                                  Expression_annotations) == 0;
920
2
    if (!cond) {
921
0
        Py_DECREF(Expression_annotations);
922
0
        return 0;
923
0
    }
924
2
    Py_DECREF(Expression_annotations);
925
2
    PyObject *FunctionType_annotations = PyDict_New();
926
2
    if (!FunctionType_annotations) return 0;
927
2
    {
928
2
        PyObject *type = state->expr_type;
929
2
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
930
2
        cond = type != NULL;
931
2
        if (!cond) {
932
0
            Py_DECREF(FunctionType_annotations);
933
0
            return 0;
934
0
        }
935
2
        cond = PyDict_SetItemString(FunctionType_annotations, "argtypes", type)
936
2
                                    == 0;
937
2
        Py_DECREF(type);
938
2
        if (!cond) {
939
0
            Py_DECREF(FunctionType_annotations);
940
0
            return 0;
941
0
        }
942
2
    }
943
2
    {
944
2
        PyObject *type = state->expr_type;
945
2
        Py_INCREF(type);
946
2
        cond = PyDict_SetItemString(FunctionType_annotations, "returns", type)
947
2
                                    == 0;
948
2
        Py_DECREF(type);
949
2
        if (!cond) {
950
0
            Py_DECREF(FunctionType_annotations);
951
0
            return 0;
952
0
        }
953
2
    }
954
2
    cond = PyObject_SetAttrString(state->FunctionType_type, "_field_types",
955
2
                                  FunctionType_annotations) == 0;
956
2
    if (!cond) {
957
0
        Py_DECREF(FunctionType_annotations);
958
0
        return 0;
959
0
    }
960
2
    cond = PyObject_SetAttrString(state->FunctionType_type, "__annotations__",
961
2
                                  FunctionType_annotations) == 0;
962
2
    if (!cond) {
963
0
        Py_DECREF(FunctionType_annotations);
964
0
        return 0;
965
0
    }
966
2
    Py_DECREF(FunctionType_annotations);
967
2
    PyObject *FunctionDef_annotations = PyDict_New();
968
2
    if (!FunctionDef_annotations) return 0;
969
2
    {
970
2
        PyObject *type = (PyObject *)&PyUnicode_Type;
971
2
        Py_INCREF(type);
972
2
        cond = PyDict_SetItemString(FunctionDef_annotations, "name", type) == 0;
973
2
        Py_DECREF(type);
974
2
        if (!cond) {
975
0
            Py_DECREF(FunctionDef_annotations);
976
0
            return 0;
977
0
        }
978
2
    }
979
2
    {
980
2
        PyObject *type = state->arguments_type;
981
2
        Py_INCREF(type);
982
2
        cond = PyDict_SetItemString(FunctionDef_annotations, "args", type) == 0;
983
2
        Py_DECREF(type);
984
2
        if (!cond) {
985
0
            Py_DECREF(FunctionDef_annotations);
986
0
            return 0;
987
0
        }
988
2
    }
989
2
    {
990
2
        PyObject *type = state->stmt_type;
991
2
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
992
2
        cond = type != NULL;
993
2
        if (!cond) {
994
0
            Py_DECREF(FunctionDef_annotations);
995
0
            return 0;
996
0
        }
997
2
        cond = PyDict_SetItemString(FunctionDef_annotations, "body", type) == 0;
998
2
        Py_DECREF(type);
999
2
        if (!cond) {
1000
0
            Py_DECREF(FunctionDef_annotations);
1001
0
            return 0;
1002
0
        }
1003
2
    }
1004
2
    {
1005
2
        PyObject *type = state->expr_type;
1006
2
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
1007
2
        cond = type != NULL;
1008
2
        if (!cond) {
1009
0
            Py_DECREF(FunctionDef_annotations);
1010
0
            return 0;
1011
0
        }
1012
2
        cond = PyDict_SetItemString(FunctionDef_annotations, "decorator_list",
1013
2
                                    type) == 0;
1014
2
        Py_DECREF(type);
1015
2
        if (!cond) {
1016
0
            Py_DECREF(FunctionDef_annotations);
1017
0
            return 0;
1018
0
        }
1019
2
    }
1020
2
    {
1021
2
        PyObject *type = state->expr_type;
1022
2
        type = _Py_union_type_or(type, Py_None);
1023
2
        cond = type != NULL;
1024
2
        if (!cond) {
1025
0
            Py_DECREF(FunctionDef_annotations);
1026
0
            return 0;
1027
0
        }
1028
2
        cond = PyDict_SetItemString(FunctionDef_annotations, "returns", type)
1029
2
                                    == 0;
1030
2
        Py_DECREF(type);
1031
2
        if (!cond) {
1032
0
            Py_DECREF(FunctionDef_annotations);
1033
0
            return 0;
1034
0
        }
1035
2
    }
1036
2
    {
1037
2
        PyObject *type = (PyObject *)&PyUnicode_Type;
1038
2
        type = _Py_union_type_or(type, Py_None);
1039
2
        cond = type != NULL;
1040
2
        if (!cond) {
1041
0
            Py_DECREF(FunctionDef_annotations);
1042
0
            return 0;
1043
0
        }
1044
2
        cond = PyDict_SetItemString(FunctionDef_annotations, "type_comment",
1045
2
                                    type) == 0;
1046
2
        Py_DECREF(type);
1047
2
        if (!cond) {
1048
0
            Py_DECREF(FunctionDef_annotations);
1049
0
            return 0;
1050
0
        }
1051
2
    }
1052
2
    {
1053
2
        PyObject *type = state->type_param_type;
1054
2
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
1055
2
        cond = type != NULL;
1056
2
        if (!cond) {
1057
0
            Py_DECREF(FunctionDef_annotations);
1058
0
            return 0;
1059
0
        }
1060
2
        cond = PyDict_SetItemString(FunctionDef_annotations, "type_params",
1061
2
                                    type) == 0;
1062
2
        Py_DECREF(type);
1063
2
        if (!cond) {
1064
0
            Py_DECREF(FunctionDef_annotations);
1065
0
            return 0;
1066
0
        }
1067
2
    }
1068
2
    cond = PyObject_SetAttrString(state->FunctionDef_type, "_field_types",
1069
2
                                  FunctionDef_annotations) == 0;
1070
2
    if (!cond) {
1071
0
        Py_DECREF(FunctionDef_annotations);
1072
0
        return 0;
1073
0
    }
1074
2
    cond = PyObject_SetAttrString(state->FunctionDef_type, "__annotations__",
1075
2
                                  FunctionDef_annotations) == 0;
1076
2
    if (!cond) {
1077
0
        Py_DECREF(FunctionDef_annotations);
1078
0
        return 0;
1079
0
    }
1080
2
    Py_DECREF(FunctionDef_annotations);
1081
2
    PyObject *AsyncFunctionDef_annotations = PyDict_New();
1082
2
    if (!AsyncFunctionDef_annotations) return 0;
1083
2
    {
1084
2
        PyObject *type = (PyObject *)&PyUnicode_Type;
1085
2
        Py_INCREF(type);
1086
2
        cond = PyDict_SetItemString(AsyncFunctionDef_annotations, "name", type)
1087
2
                                    == 0;
1088
2
        Py_DECREF(type);
1089
2
        if (!cond) {
1090
0
            Py_DECREF(AsyncFunctionDef_annotations);
1091
0
            return 0;
1092
0
        }
1093
2
    }
1094
2
    {
1095
2
        PyObject *type = state->arguments_type;
1096
2
        Py_INCREF(type);
1097
2
        cond = PyDict_SetItemString(AsyncFunctionDef_annotations, "args", type)
1098
2
                                    == 0;
1099
2
        Py_DECREF(type);
1100
2
        if (!cond) {
1101
0
            Py_DECREF(AsyncFunctionDef_annotations);
1102
0
            return 0;
1103
0
        }
1104
2
    }
1105
2
    {
1106
2
        PyObject *type = state->stmt_type;
1107
2
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
1108
2
        cond = type != NULL;
1109
2
        if (!cond) {
1110
0
            Py_DECREF(AsyncFunctionDef_annotations);
1111
0
            return 0;
1112
0
        }
1113
2
        cond = PyDict_SetItemString(AsyncFunctionDef_annotations, "body", type)
1114
2
                                    == 0;
1115
2
        Py_DECREF(type);
1116
2
        if (!cond) {
1117
0
            Py_DECREF(AsyncFunctionDef_annotations);
1118
0
            return 0;
1119
0
        }
1120
2
    }
1121
2
    {
1122
2
        PyObject *type = state->expr_type;
1123
2
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
1124
2
        cond = type != NULL;
1125
2
        if (!cond) {
1126
0
            Py_DECREF(AsyncFunctionDef_annotations);
1127
0
            return 0;
1128
0
        }
1129
2
        cond = PyDict_SetItemString(AsyncFunctionDef_annotations,
1130
2
                                    "decorator_list", type) == 0;
1131
2
        Py_DECREF(type);
1132
2
        if (!cond) {
1133
0
            Py_DECREF(AsyncFunctionDef_annotations);
1134
0
            return 0;
1135
0
        }
1136
2
    }
1137
2
    {
1138
2
        PyObject *type = state->expr_type;
1139
2
        type = _Py_union_type_or(type, Py_None);
1140
2
        cond = type != NULL;
1141
2
        if (!cond) {
1142
0
            Py_DECREF(AsyncFunctionDef_annotations);
1143
0
            return 0;
1144
0
        }
1145
2
        cond = PyDict_SetItemString(AsyncFunctionDef_annotations, "returns",
1146
2
                                    type) == 0;
1147
2
        Py_DECREF(type);
1148
2
        if (!cond) {
1149
0
            Py_DECREF(AsyncFunctionDef_annotations);
1150
0
            return 0;
1151
0
        }
1152
2
    }
1153
2
    {
1154
2
        PyObject *type = (PyObject *)&PyUnicode_Type;
1155
2
        type = _Py_union_type_or(type, Py_None);
1156
2
        cond = type != NULL;
1157
2
        if (!cond) {
1158
0
            Py_DECREF(AsyncFunctionDef_annotations);
1159
0
            return 0;
1160
0
        }
1161
2
        cond = PyDict_SetItemString(AsyncFunctionDef_annotations,
1162
2
                                    "type_comment", type) == 0;
1163
2
        Py_DECREF(type);
1164
2
        if (!cond) {
1165
0
            Py_DECREF(AsyncFunctionDef_annotations);
1166
0
            return 0;
1167
0
        }
1168
2
    }
1169
2
    {
1170
2
        PyObject *type = state->type_param_type;
1171
2
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
1172
2
        cond = type != NULL;
1173
2
        if (!cond) {
1174
0
            Py_DECREF(AsyncFunctionDef_annotations);
1175
0
            return 0;
1176
0
        }
1177
2
        cond = PyDict_SetItemString(AsyncFunctionDef_annotations,
1178
2
                                    "type_params", type) == 0;
1179
2
        Py_DECREF(type);
1180
2
        if (!cond) {
1181
0
            Py_DECREF(AsyncFunctionDef_annotations);
1182
0
            return 0;
1183
0
        }
1184
2
    }
1185
2
    cond = PyObject_SetAttrString(state->AsyncFunctionDef_type, "_field_types",
1186
2
                                  AsyncFunctionDef_annotations) == 0;
1187
2
    if (!cond) {
1188
0
        Py_DECREF(AsyncFunctionDef_annotations);
1189
0
        return 0;
1190
0
    }
1191
2
    cond = PyObject_SetAttrString(state->AsyncFunctionDef_type,
1192
2
                                  "__annotations__",
1193
2
                                  AsyncFunctionDef_annotations) == 0;
1194
2
    if (!cond) {
1195
0
        Py_DECREF(AsyncFunctionDef_annotations);
1196
0
        return 0;
1197
0
    }
1198
2
    Py_DECREF(AsyncFunctionDef_annotations);
1199
2
    PyObject *ClassDef_annotations = PyDict_New();
1200
2
    if (!ClassDef_annotations) return 0;
1201
2
    {
1202
2
        PyObject *type = (PyObject *)&PyUnicode_Type;
1203
2
        Py_INCREF(type);
1204
2
        cond = PyDict_SetItemString(ClassDef_annotations, "name", type) == 0;
1205
2
        Py_DECREF(type);
1206
2
        if (!cond) {
1207
0
            Py_DECREF(ClassDef_annotations);
1208
0
            return 0;
1209
0
        }
1210
2
    }
1211
2
    {
1212
2
        PyObject *type = state->expr_type;
1213
2
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
1214
2
        cond = type != NULL;
1215
2
        if (!cond) {
1216
0
            Py_DECREF(ClassDef_annotations);
1217
0
            return 0;
1218
0
        }
1219
2
        cond = PyDict_SetItemString(ClassDef_annotations, "bases", type) == 0;
1220
2
        Py_DECREF(type);
1221
2
        if (!cond) {
1222
0
            Py_DECREF(ClassDef_annotations);
1223
0
            return 0;
1224
0
        }
1225
2
    }
1226
2
    {
1227
2
        PyObject *type = state->keyword_type;
1228
2
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
1229
2
        cond = type != NULL;
1230
2
        if (!cond) {
1231
0
            Py_DECREF(ClassDef_annotations);
1232
0
            return 0;
1233
0
        }
1234
2
        cond = PyDict_SetItemString(ClassDef_annotations, "keywords", type) ==
1235
2
                                    0;
1236
2
        Py_DECREF(type);
1237
2
        if (!cond) {
1238
0
            Py_DECREF(ClassDef_annotations);
1239
0
            return 0;
1240
0
        }
1241
2
    }
1242
2
    {
1243
2
        PyObject *type = state->stmt_type;
1244
2
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
1245
2
        cond = type != NULL;
1246
2
        if (!cond) {
1247
0
            Py_DECREF(ClassDef_annotations);
1248
0
            return 0;
1249
0
        }
1250
2
        cond = PyDict_SetItemString(ClassDef_annotations, "body", type) == 0;
1251
2
        Py_DECREF(type);
1252
2
        if (!cond) {
1253
0
            Py_DECREF(ClassDef_annotations);
1254
0
            return 0;
1255
0
        }
1256
2
    }
1257
2
    {
1258
2
        PyObject *type = state->expr_type;
1259
2
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
1260
2
        cond = type != NULL;
1261
2
        if (!cond) {
1262
0
            Py_DECREF(ClassDef_annotations);
1263
0
            return 0;
1264
0
        }
1265
2
        cond = PyDict_SetItemString(ClassDef_annotations, "decorator_list",
1266
2
                                    type) == 0;
1267
2
        Py_DECREF(type);
1268
2
        if (!cond) {
1269
0
            Py_DECREF(ClassDef_annotations);
1270
0
            return 0;
1271
0
        }
1272
2
    }
1273
2
    {
1274
2
        PyObject *type = state->type_param_type;
1275
2
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
1276
2
        cond = type != NULL;
1277
2
        if (!cond) {
1278
0
            Py_DECREF(ClassDef_annotations);
1279
0
            return 0;
1280
0
        }
1281
2
        cond = PyDict_SetItemString(ClassDef_annotations, "type_params", type)
1282
2
                                    == 0;
1283
2
        Py_DECREF(type);
1284
2
        if (!cond) {
1285
0
            Py_DECREF(ClassDef_annotations);
1286
0
            return 0;
1287
0
        }
1288
2
    }
1289
2
    cond = PyObject_SetAttrString(state->ClassDef_type, "_field_types",
1290
2
                                  ClassDef_annotations) == 0;
1291
2
    if (!cond) {
1292
0
        Py_DECREF(ClassDef_annotations);
1293
0
        return 0;
1294
0
    }
1295
2
    cond = PyObject_SetAttrString(state->ClassDef_type, "__annotations__",
1296
2
                                  ClassDef_annotations) == 0;
1297
2
    if (!cond) {
1298
0
        Py_DECREF(ClassDef_annotations);
1299
0
        return 0;
1300
0
    }
1301
2
    Py_DECREF(ClassDef_annotations);
1302
2
    PyObject *Return_annotations = PyDict_New();
1303
2
    if (!Return_annotations) return 0;
1304
2
    {
1305
2
        PyObject *type = state->expr_type;
1306
2
        type = _Py_union_type_or(type, Py_None);
1307
2
        cond = type != NULL;
1308
2
        if (!cond) {
1309
0
            Py_DECREF(Return_annotations);
1310
0
            return 0;
1311
0
        }
1312
2
        cond = PyDict_SetItemString(Return_annotations, "value", type) == 0;
1313
2
        Py_DECREF(type);
1314
2
        if (!cond) {
1315
0
            Py_DECREF(Return_annotations);
1316
0
            return 0;
1317
0
        }
1318
2
    }
1319
2
    cond = PyObject_SetAttrString(state->Return_type, "_field_types",
1320
2
                                  Return_annotations) == 0;
1321
2
    if (!cond) {
1322
0
        Py_DECREF(Return_annotations);
1323
0
        return 0;
1324
0
    }
1325
2
    cond = PyObject_SetAttrString(state->Return_type, "__annotations__",
1326
2
                                  Return_annotations) == 0;
1327
2
    if (!cond) {
1328
0
        Py_DECREF(Return_annotations);
1329
0
        return 0;
1330
0
    }
1331
2
    Py_DECREF(Return_annotations);
1332
2
    PyObject *Delete_annotations = PyDict_New();
1333
2
    if (!Delete_annotations) return 0;
1334
2
    {
1335
2
        PyObject *type = state->expr_type;
1336
2
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
1337
2
        cond = type != NULL;
1338
2
        if (!cond) {
1339
0
            Py_DECREF(Delete_annotations);
1340
0
            return 0;
1341
0
        }
1342
2
        cond = PyDict_SetItemString(Delete_annotations, "targets", type) == 0;
1343
2
        Py_DECREF(type);
1344
2
        if (!cond) {
1345
0
            Py_DECREF(Delete_annotations);
1346
0
            return 0;
1347
0
        }
1348
2
    }
1349
2
    cond = PyObject_SetAttrString(state->Delete_type, "_field_types",
1350
2
                                  Delete_annotations) == 0;
1351
2
    if (!cond) {
1352
0
        Py_DECREF(Delete_annotations);
1353
0
        return 0;
1354
0
    }
1355
2
    cond = PyObject_SetAttrString(state->Delete_type, "__annotations__",
1356
2
                                  Delete_annotations) == 0;
1357
2
    if (!cond) {
1358
0
        Py_DECREF(Delete_annotations);
1359
0
        return 0;
1360
0
    }
1361
2
    Py_DECREF(Delete_annotations);
1362
2
    PyObject *Assign_annotations = PyDict_New();
1363
2
    if (!Assign_annotations) return 0;
1364
2
    {
1365
2
        PyObject *type = state->expr_type;
1366
2
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
1367
2
        cond = type != NULL;
1368
2
        if (!cond) {
1369
0
            Py_DECREF(Assign_annotations);
1370
0
            return 0;
1371
0
        }
1372
2
        cond = PyDict_SetItemString(Assign_annotations, "targets", type) == 0;
1373
2
        Py_DECREF(type);
1374
2
        if (!cond) {
1375
0
            Py_DECREF(Assign_annotations);
1376
0
            return 0;
1377
0
        }
1378
2
    }
1379
2
    {
1380
2
        PyObject *type = state->expr_type;
1381
2
        Py_INCREF(type);
1382
2
        cond = PyDict_SetItemString(Assign_annotations, "value", type) == 0;
1383
2
        Py_DECREF(type);
1384
2
        if (!cond) {
1385
0
            Py_DECREF(Assign_annotations);
1386
0
            return 0;
1387
0
        }
1388
2
    }
1389
2
    {
1390
2
        PyObject *type = (PyObject *)&PyUnicode_Type;
1391
2
        type = _Py_union_type_or(type, Py_None);
1392
2
        cond = type != NULL;
1393
2
        if (!cond) {
1394
0
            Py_DECREF(Assign_annotations);
1395
0
            return 0;
1396
0
        }
1397
2
        cond = PyDict_SetItemString(Assign_annotations, "type_comment", type)
1398
2
                                    == 0;
1399
2
        Py_DECREF(type);
1400
2
        if (!cond) {
1401
0
            Py_DECREF(Assign_annotations);
1402
0
            return 0;
1403
0
        }
1404
2
    }
1405
2
    cond = PyObject_SetAttrString(state->Assign_type, "_field_types",
1406
2
                                  Assign_annotations) == 0;
1407
2
    if (!cond) {
1408
0
        Py_DECREF(Assign_annotations);
1409
0
        return 0;
1410
0
    }
1411
2
    cond = PyObject_SetAttrString(state->Assign_type, "__annotations__",
1412
2
                                  Assign_annotations) == 0;
1413
2
    if (!cond) {
1414
0
        Py_DECREF(Assign_annotations);
1415
0
        return 0;
1416
0
    }
1417
2
    Py_DECREF(Assign_annotations);
1418
2
    PyObject *TypeAlias_annotations = PyDict_New();
1419
2
    if (!TypeAlias_annotations) return 0;
1420
2
    {
1421
2
        PyObject *type = state->expr_type;
1422
2
        Py_INCREF(type);
1423
2
        cond = PyDict_SetItemString(TypeAlias_annotations, "name", type) == 0;
1424
2
        Py_DECREF(type);
1425
2
        if (!cond) {
1426
0
            Py_DECREF(TypeAlias_annotations);
1427
0
            return 0;
1428
0
        }
1429
2
    }
1430
2
    {
1431
2
        PyObject *type = state->type_param_type;
1432
2
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
1433
2
        cond = type != NULL;
1434
2
        if (!cond) {
1435
0
            Py_DECREF(TypeAlias_annotations);
1436
0
            return 0;
1437
0
        }
1438
2
        cond = PyDict_SetItemString(TypeAlias_annotations, "type_params", type)
1439
2
                                    == 0;
1440
2
        Py_DECREF(type);
1441
2
        if (!cond) {
1442
0
            Py_DECREF(TypeAlias_annotations);
1443
0
            return 0;
1444
0
        }
1445
2
    }
1446
2
    {
1447
2
        PyObject *type = state->expr_type;
1448
2
        Py_INCREF(type);
1449
2
        cond = PyDict_SetItemString(TypeAlias_annotations, "value", type) == 0;
1450
2
        Py_DECREF(type);
1451
2
        if (!cond) {
1452
0
            Py_DECREF(TypeAlias_annotations);
1453
0
            return 0;
1454
0
        }
1455
2
    }
1456
2
    cond = PyObject_SetAttrString(state->TypeAlias_type, "_field_types",
1457
2
                                  TypeAlias_annotations) == 0;
1458
2
    if (!cond) {
1459
0
        Py_DECREF(TypeAlias_annotations);
1460
0
        return 0;
1461
0
    }
1462
2
    cond = PyObject_SetAttrString(state->TypeAlias_type, "__annotations__",
1463
2
                                  TypeAlias_annotations) == 0;
1464
2
    if (!cond) {
1465
0
        Py_DECREF(TypeAlias_annotations);
1466
0
        return 0;
1467
0
    }
1468
2
    Py_DECREF(TypeAlias_annotations);
1469
2
    PyObject *AugAssign_annotations = PyDict_New();
1470
2
    if (!AugAssign_annotations) return 0;
1471
2
    {
1472
2
        PyObject *type = state->expr_type;
1473
2
        Py_INCREF(type);
1474
2
        cond = PyDict_SetItemString(AugAssign_annotations, "target", type) == 0;
1475
2
        Py_DECREF(type);
1476
2
        if (!cond) {
1477
0
            Py_DECREF(AugAssign_annotations);
1478
0
            return 0;
1479
0
        }
1480
2
    }
1481
2
    {
1482
2
        PyObject *type = state->operator_type;
1483
2
        Py_INCREF(type);
1484
2
        cond = PyDict_SetItemString(AugAssign_annotations, "op", type) == 0;
1485
2
        Py_DECREF(type);
1486
2
        if (!cond) {
1487
0
            Py_DECREF(AugAssign_annotations);
1488
0
            return 0;
1489
0
        }
1490
2
    }
1491
2
    {
1492
2
        PyObject *type = state->expr_type;
1493
2
        Py_INCREF(type);
1494
2
        cond = PyDict_SetItemString(AugAssign_annotations, "value", type) == 0;
1495
2
        Py_DECREF(type);
1496
2
        if (!cond) {
1497
0
            Py_DECREF(AugAssign_annotations);
1498
0
            return 0;
1499
0
        }
1500
2
    }
1501
2
    cond = PyObject_SetAttrString(state->AugAssign_type, "_field_types",
1502
2
                                  AugAssign_annotations) == 0;
1503
2
    if (!cond) {
1504
0
        Py_DECREF(AugAssign_annotations);
1505
0
        return 0;
1506
0
    }
1507
2
    cond = PyObject_SetAttrString(state->AugAssign_type, "__annotations__",
1508
2
                                  AugAssign_annotations) == 0;
1509
2
    if (!cond) {
1510
0
        Py_DECREF(AugAssign_annotations);
1511
0
        return 0;
1512
0
    }
1513
2
    Py_DECREF(AugAssign_annotations);
1514
2
    PyObject *AnnAssign_annotations = PyDict_New();
1515
2
    if (!AnnAssign_annotations) return 0;
1516
2
    {
1517
2
        PyObject *type = state->expr_type;
1518
2
        Py_INCREF(type);
1519
2
        cond = PyDict_SetItemString(AnnAssign_annotations, "target", type) == 0;
1520
2
        Py_DECREF(type);
1521
2
        if (!cond) {
1522
0
            Py_DECREF(AnnAssign_annotations);
1523
0
            return 0;
1524
0
        }
1525
2
    }
1526
2
    {
1527
2
        PyObject *type = state->expr_type;
1528
2
        Py_INCREF(type);
1529
2
        cond = PyDict_SetItemString(AnnAssign_annotations, "annotation", type)
1530
2
                                    == 0;
1531
2
        Py_DECREF(type);
1532
2
        if (!cond) {
1533
0
            Py_DECREF(AnnAssign_annotations);
1534
0
            return 0;
1535
0
        }
1536
2
    }
1537
2
    {
1538
2
        PyObject *type = state->expr_type;
1539
2
        type = _Py_union_type_or(type, Py_None);
1540
2
        cond = type != NULL;
1541
2
        if (!cond) {
1542
0
            Py_DECREF(AnnAssign_annotations);
1543
0
            return 0;
1544
0
        }
1545
2
        cond = PyDict_SetItemString(AnnAssign_annotations, "value", type) == 0;
1546
2
        Py_DECREF(type);
1547
2
        if (!cond) {
1548
0
            Py_DECREF(AnnAssign_annotations);
1549
0
            return 0;
1550
0
        }
1551
2
    }
1552
2
    {
1553
2
        PyObject *type = (PyObject *)&PyLong_Type;
1554
2
        Py_INCREF(type);
1555
2
        cond = PyDict_SetItemString(AnnAssign_annotations, "simple", type) == 0;
1556
2
        Py_DECREF(type);
1557
2
        if (!cond) {
1558
0
            Py_DECREF(AnnAssign_annotations);
1559
0
            return 0;
1560
0
        }
1561
2
    }
1562
2
    cond = PyObject_SetAttrString(state->AnnAssign_type, "_field_types",
1563
2
                                  AnnAssign_annotations) == 0;
1564
2
    if (!cond) {
1565
0
        Py_DECREF(AnnAssign_annotations);
1566
0
        return 0;
1567
0
    }
1568
2
    cond = PyObject_SetAttrString(state->AnnAssign_type, "__annotations__",
1569
2
                                  AnnAssign_annotations) == 0;
1570
2
    if (!cond) {
1571
0
        Py_DECREF(AnnAssign_annotations);
1572
0
        return 0;
1573
0
    }
1574
2
    Py_DECREF(AnnAssign_annotations);
1575
2
    PyObject *For_annotations = PyDict_New();
1576
2
    if (!For_annotations) return 0;
1577
2
    {
1578
2
        PyObject *type = state->expr_type;
1579
2
        Py_INCREF(type);
1580
2
        cond = PyDict_SetItemString(For_annotations, "target", type) == 0;
1581
2
        Py_DECREF(type);
1582
2
        if (!cond) {
1583
0
            Py_DECREF(For_annotations);
1584
0
            return 0;
1585
0
        }
1586
2
    }
1587
2
    {
1588
2
        PyObject *type = state->expr_type;
1589
2
        Py_INCREF(type);
1590
2
        cond = PyDict_SetItemString(For_annotations, "iter", type) == 0;
1591
2
        Py_DECREF(type);
1592
2
        if (!cond) {
1593
0
            Py_DECREF(For_annotations);
1594
0
            return 0;
1595
0
        }
1596
2
    }
1597
2
    {
1598
2
        PyObject *type = state->stmt_type;
1599
2
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
1600
2
        cond = type != NULL;
1601
2
        if (!cond) {
1602
0
            Py_DECREF(For_annotations);
1603
0
            return 0;
1604
0
        }
1605
2
        cond = PyDict_SetItemString(For_annotations, "body", type) == 0;
1606
2
        Py_DECREF(type);
1607
2
        if (!cond) {
1608
0
            Py_DECREF(For_annotations);
1609
0
            return 0;
1610
0
        }
1611
2
    }
1612
2
    {
1613
2
        PyObject *type = state->stmt_type;
1614
2
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
1615
2
        cond = type != NULL;
1616
2
        if (!cond) {
1617
0
            Py_DECREF(For_annotations);
1618
0
            return 0;
1619
0
        }
1620
2
        cond = PyDict_SetItemString(For_annotations, "orelse", type) == 0;
1621
2
        Py_DECREF(type);
1622
2
        if (!cond) {
1623
0
            Py_DECREF(For_annotations);
1624
0
            return 0;
1625
0
        }
1626
2
    }
1627
2
    {
1628
2
        PyObject *type = (PyObject *)&PyUnicode_Type;
1629
2
        type = _Py_union_type_or(type, Py_None);
1630
2
        cond = type != NULL;
1631
2
        if (!cond) {
1632
0
            Py_DECREF(For_annotations);
1633
0
            return 0;
1634
0
        }
1635
2
        cond = PyDict_SetItemString(For_annotations, "type_comment", type) == 0;
1636
2
        Py_DECREF(type);
1637
2
        if (!cond) {
1638
0
            Py_DECREF(For_annotations);
1639
0
            return 0;
1640
0
        }
1641
2
    }
1642
2
    cond = PyObject_SetAttrString(state->For_type, "_field_types",
1643
2
                                  For_annotations) == 0;
1644
2
    if (!cond) {
1645
0
        Py_DECREF(For_annotations);
1646
0
        return 0;
1647
0
    }
1648
2
    cond = PyObject_SetAttrString(state->For_type, "__annotations__",
1649
2
                                  For_annotations) == 0;
1650
2
    if (!cond) {
1651
0
        Py_DECREF(For_annotations);
1652
0
        return 0;
1653
0
    }
1654
2
    Py_DECREF(For_annotations);
1655
2
    PyObject *AsyncFor_annotations = PyDict_New();
1656
2
    if (!AsyncFor_annotations) return 0;
1657
2
    {
1658
2
        PyObject *type = state->expr_type;
1659
2
        Py_INCREF(type);
1660
2
        cond = PyDict_SetItemString(AsyncFor_annotations, "target", type) == 0;
1661
2
        Py_DECREF(type);
1662
2
        if (!cond) {
1663
0
            Py_DECREF(AsyncFor_annotations);
1664
0
            return 0;
1665
0
        }
1666
2
    }
1667
2
    {
1668
2
        PyObject *type = state->expr_type;
1669
2
        Py_INCREF(type);
1670
2
        cond = PyDict_SetItemString(AsyncFor_annotations, "iter", type) == 0;
1671
2
        Py_DECREF(type);
1672
2
        if (!cond) {
1673
0
            Py_DECREF(AsyncFor_annotations);
1674
0
            return 0;
1675
0
        }
1676
2
    }
1677
2
    {
1678
2
        PyObject *type = state->stmt_type;
1679
2
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
1680
2
        cond = type != NULL;
1681
2
        if (!cond) {
1682
0
            Py_DECREF(AsyncFor_annotations);
1683
0
            return 0;
1684
0
        }
1685
2
        cond = PyDict_SetItemString(AsyncFor_annotations, "body", type) == 0;
1686
2
        Py_DECREF(type);
1687
2
        if (!cond) {
1688
0
            Py_DECREF(AsyncFor_annotations);
1689
0
            return 0;
1690
0
        }
1691
2
    }
1692
2
    {
1693
2
        PyObject *type = state->stmt_type;
1694
2
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
1695
2
        cond = type != NULL;
1696
2
        if (!cond) {
1697
0
            Py_DECREF(AsyncFor_annotations);
1698
0
            return 0;
1699
0
        }
1700
2
        cond = PyDict_SetItemString(AsyncFor_annotations, "orelse", type) == 0;
1701
2
        Py_DECREF(type);
1702
2
        if (!cond) {
1703
0
            Py_DECREF(AsyncFor_annotations);
1704
0
            return 0;
1705
0
        }
1706
2
    }
1707
2
    {
1708
2
        PyObject *type = (PyObject *)&PyUnicode_Type;
1709
2
        type = _Py_union_type_or(type, Py_None);
1710
2
        cond = type != NULL;
1711
2
        if (!cond) {
1712
0
            Py_DECREF(AsyncFor_annotations);
1713
0
            return 0;
1714
0
        }
1715
2
        cond = PyDict_SetItemString(AsyncFor_annotations, "type_comment", type)
1716
2
                                    == 0;
1717
2
        Py_DECREF(type);
1718
2
        if (!cond) {
1719
0
            Py_DECREF(AsyncFor_annotations);
1720
0
            return 0;
1721
0
        }
1722
2
    }
1723
2
    cond = PyObject_SetAttrString(state->AsyncFor_type, "_field_types",
1724
2
                                  AsyncFor_annotations) == 0;
1725
2
    if (!cond) {
1726
0
        Py_DECREF(AsyncFor_annotations);
1727
0
        return 0;
1728
0
    }
1729
2
    cond = PyObject_SetAttrString(state->AsyncFor_type, "__annotations__",
1730
2
                                  AsyncFor_annotations) == 0;
1731
2
    if (!cond) {
1732
0
        Py_DECREF(AsyncFor_annotations);
1733
0
        return 0;
1734
0
    }
1735
2
    Py_DECREF(AsyncFor_annotations);
1736
2
    PyObject *While_annotations = PyDict_New();
1737
2
    if (!While_annotations) return 0;
1738
2
    {
1739
2
        PyObject *type = state->expr_type;
1740
2
        Py_INCREF(type);
1741
2
        cond = PyDict_SetItemString(While_annotations, "test", type) == 0;
1742
2
        Py_DECREF(type);
1743
2
        if (!cond) {
1744
0
            Py_DECREF(While_annotations);
1745
0
            return 0;
1746
0
        }
1747
2
    }
1748
2
    {
1749
2
        PyObject *type = state->stmt_type;
1750
2
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
1751
2
        cond = type != NULL;
1752
2
        if (!cond) {
1753
0
            Py_DECREF(While_annotations);
1754
0
            return 0;
1755
0
        }
1756
2
        cond = PyDict_SetItemString(While_annotations, "body", type) == 0;
1757
2
        Py_DECREF(type);
1758
2
        if (!cond) {
1759
0
            Py_DECREF(While_annotations);
1760
0
            return 0;
1761
0
        }
1762
2
    }
1763
2
    {
1764
2
        PyObject *type = state->stmt_type;
1765
2
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
1766
2
        cond = type != NULL;
1767
2
        if (!cond) {
1768
0
            Py_DECREF(While_annotations);
1769
0
            return 0;
1770
0
        }
1771
2
        cond = PyDict_SetItemString(While_annotations, "orelse", type) == 0;
1772
2
        Py_DECREF(type);
1773
2
        if (!cond) {
1774
0
            Py_DECREF(While_annotations);
1775
0
            return 0;
1776
0
        }
1777
2
    }
1778
2
    cond = PyObject_SetAttrString(state->While_type, "_field_types",
1779
2
                                  While_annotations) == 0;
1780
2
    if (!cond) {
1781
0
        Py_DECREF(While_annotations);
1782
0
        return 0;
1783
0
    }
1784
2
    cond = PyObject_SetAttrString(state->While_type, "__annotations__",
1785
2
                                  While_annotations) == 0;
1786
2
    if (!cond) {
1787
0
        Py_DECREF(While_annotations);
1788
0
        return 0;
1789
0
    }
1790
2
    Py_DECREF(While_annotations);
1791
2
    PyObject *If_annotations = PyDict_New();
1792
2
    if (!If_annotations) return 0;
1793
2
    {
1794
2
        PyObject *type = state->expr_type;
1795
2
        Py_INCREF(type);
1796
2
        cond = PyDict_SetItemString(If_annotations, "test", type) == 0;
1797
2
        Py_DECREF(type);
1798
2
        if (!cond) {
1799
0
            Py_DECREF(If_annotations);
1800
0
            return 0;
1801
0
        }
1802
2
    }
1803
2
    {
1804
2
        PyObject *type = state->stmt_type;
1805
2
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
1806
2
        cond = type != NULL;
1807
2
        if (!cond) {
1808
0
            Py_DECREF(If_annotations);
1809
0
            return 0;
1810
0
        }
1811
2
        cond = PyDict_SetItemString(If_annotations, "body", type) == 0;
1812
2
        Py_DECREF(type);
1813
2
        if (!cond) {
1814
0
            Py_DECREF(If_annotations);
1815
0
            return 0;
1816
0
        }
1817
2
    }
1818
2
    {
1819
2
        PyObject *type = state->stmt_type;
1820
2
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
1821
2
        cond = type != NULL;
1822
2
        if (!cond) {
1823
0
            Py_DECREF(If_annotations);
1824
0
            return 0;
1825
0
        }
1826
2
        cond = PyDict_SetItemString(If_annotations, "orelse", type) == 0;
1827
2
        Py_DECREF(type);
1828
2
        if (!cond) {
1829
0
            Py_DECREF(If_annotations);
1830
0
            return 0;
1831
0
        }
1832
2
    }
1833
2
    cond = PyObject_SetAttrString(state->If_type, "_field_types",
1834
2
                                  If_annotations) == 0;
1835
2
    if (!cond) {
1836
0
        Py_DECREF(If_annotations);
1837
0
        return 0;
1838
0
    }
1839
2
    cond = PyObject_SetAttrString(state->If_type, "__annotations__",
1840
2
                                  If_annotations) == 0;
1841
2
    if (!cond) {
1842
0
        Py_DECREF(If_annotations);
1843
0
        return 0;
1844
0
    }
1845
2
    Py_DECREF(If_annotations);
1846
2
    PyObject *With_annotations = PyDict_New();
1847
2
    if (!With_annotations) return 0;
1848
2
    {
1849
2
        PyObject *type = state->withitem_type;
1850
2
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
1851
2
        cond = type != NULL;
1852
2
        if (!cond) {
1853
0
            Py_DECREF(With_annotations);
1854
0
            return 0;
1855
0
        }
1856
2
        cond = PyDict_SetItemString(With_annotations, "items", type) == 0;
1857
2
        Py_DECREF(type);
1858
2
        if (!cond) {
1859
0
            Py_DECREF(With_annotations);
1860
0
            return 0;
1861
0
        }
1862
2
    }
1863
2
    {
1864
2
        PyObject *type = state->stmt_type;
1865
2
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
1866
2
        cond = type != NULL;
1867
2
        if (!cond) {
1868
0
            Py_DECREF(With_annotations);
1869
0
            return 0;
1870
0
        }
1871
2
        cond = PyDict_SetItemString(With_annotations, "body", type) == 0;
1872
2
        Py_DECREF(type);
1873
2
        if (!cond) {
1874
0
            Py_DECREF(With_annotations);
1875
0
            return 0;
1876
0
        }
1877
2
    }
1878
2
    {
1879
2
        PyObject *type = (PyObject *)&PyUnicode_Type;
1880
2
        type = _Py_union_type_or(type, Py_None);
1881
2
        cond = type != NULL;
1882
2
        if (!cond) {
1883
0
            Py_DECREF(With_annotations);
1884
0
            return 0;
1885
0
        }
1886
2
        cond = PyDict_SetItemString(With_annotations, "type_comment", type) ==
1887
2
                                    0;
1888
2
        Py_DECREF(type);
1889
2
        if (!cond) {
1890
0
            Py_DECREF(With_annotations);
1891
0
            return 0;
1892
0
        }
1893
2
    }
1894
2
    cond = PyObject_SetAttrString(state->With_type, "_field_types",
1895
2
                                  With_annotations) == 0;
1896
2
    if (!cond) {
1897
0
        Py_DECREF(With_annotations);
1898
0
        return 0;
1899
0
    }
1900
2
    cond = PyObject_SetAttrString(state->With_type, "__annotations__",
1901
2
                                  With_annotations) == 0;
1902
2
    if (!cond) {
1903
0
        Py_DECREF(With_annotations);
1904
0
        return 0;
1905
0
    }
1906
2
    Py_DECREF(With_annotations);
1907
2
    PyObject *AsyncWith_annotations = PyDict_New();
1908
2
    if (!AsyncWith_annotations) return 0;
1909
2
    {
1910
2
        PyObject *type = state->withitem_type;
1911
2
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
1912
2
        cond = type != NULL;
1913
2
        if (!cond) {
1914
0
            Py_DECREF(AsyncWith_annotations);
1915
0
            return 0;
1916
0
        }
1917
2
        cond = PyDict_SetItemString(AsyncWith_annotations, "items", type) == 0;
1918
2
        Py_DECREF(type);
1919
2
        if (!cond) {
1920
0
            Py_DECREF(AsyncWith_annotations);
1921
0
            return 0;
1922
0
        }
1923
2
    }
1924
2
    {
1925
2
        PyObject *type = state->stmt_type;
1926
2
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
1927
2
        cond = type != NULL;
1928
2
        if (!cond) {
1929
0
            Py_DECREF(AsyncWith_annotations);
1930
0
            return 0;
1931
0
        }
1932
2
        cond = PyDict_SetItemString(AsyncWith_annotations, "body", type) == 0;
1933
2
        Py_DECREF(type);
1934
2
        if (!cond) {
1935
0
            Py_DECREF(AsyncWith_annotations);
1936
0
            return 0;
1937
0
        }
1938
2
    }
1939
2
    {
1940
2
        PyObject *type = (PyObject *)&PyUnicode_Type;
1941
2
        type = _Py_union_type_or(type, Py_None);
1942
2
        cond = type != NULL;
1943
2
        if (!cond) {
1944
0
            Py_DECREF(AsyncWith_annotations);
1945
0
            return 0;
1946
0
        }
1947
2
        cond = PyDict_SetItemString(AsyncWith_annotations, "type_comment",
1948
2
                                    type) == 0;
1949
2
        Py_DECREF(type);
1950
2
        if (!cond) {
1951
0
            Py_DECREF(AsyncWith_annotations);
1952
0
            return 0;
1953
0
        }
1954
2
    }
1955
2
    cond = PyObject_SetAttrString(state->AsyncWith_type, "_field_types",
1956
2
                                  AsyncWith_annotations) == 0;
1957
2
    if (!cond) {
1958
0
        Py_DECREF(AsyncWith_annotations);
1959
0
        return 0;
1960
0
    }
1961
2
    cond = PyObject_SetAttrString(state->AsyncWith_type, "__annotations__",
1962
2
                                  AsyncWith_annotations) == 0;
1963
2
    if (!cond) {
1964
0
        Py_DECREF(AsyncWith_annotations);
1965
0
        return 0;
1966
0
    }
1967
2
    Py_DECREF(AsyncWith_annotations);
1968
2
    PyObject *Match_annotations = PyDict_New();
1969
2
    if (!Match_annotations) return 0;
1970
2
    {
1971
2
        PyObject *type = state->expr_type;
1972
2
        Py_INCREF(type);
1973
2
        cond = PyDict_SetItemString(Match_annotations, "subject", type) == 0;
1974
2
        Py_DECREF(type);
1975
2
        if (!cond) {
1976
0
            Py_DECREF(Match_annotations);
1977
0
            return 0;
1978
0
        }
1979
2
    }
1980
2
    {
1981
2
        PyObject *type = state->match_case_type;
1982
2
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
1983
2
        cond = type != NULL;
1984
2
        if (!cond) {
1985
0
            Py_DECREF(Match_annotations);
1986
0
            return 0;
1987
0
        }
1988
2
        cond = PyDict_SetItemString(Match_annotations, "cases", type) == 0;
1989
2
        Py_DECREF(type);
1990
2
        if (!cond) {
1991
0
            Py_DECREF(Match_annotations);
1992
0
            return 0;
1993
0
        }
1994
2
    }
1995
2
    cond = PyObject_SetAttrString(state->Match_type, "_field_types",
1996
2
                                  Match_annotations) == 0;
1997
2
    if (!cond) {
1998
0
        Py_DECREF(Match_annotations);
1999
0
        return 0;
2000
0
    }
2001
2
    cond = PyObject_SetAttrString(state->Match_type, "__annotations__",
2002
2
                                  Match_annotations) == 0;
2003
2
    if (!cond) {
2004
0
        Py_DECREF(Match_annotations);
2005
0
        return 0;
2006
0
    }
2007
2
    Py_DECREF(Match_annotations);
2008
2
    PyObject *Raise_annotations = PyDict_New();
2009
2
    if (!Raise_annotations) return 0;
2010
2
    {
2011
2
        PyObject *type = state->expr_type;
2012
2
        type = _Py_union_type_or(type, Py_None);
2013
2
        cond = type != NULL;
2014
2
        if (!cond) {
2015
0
            Py_DECREF(Raise_annotations);
2016
0
            return 0;
2017
0
        }
2018
2
        cond = PyDict_SetItemString(Raise_annotations, "exc", type) == 0;
2019
2
        Py_DECREF(type);
2020
2
        if (!cond) {
2021
0
            Py_DECREF(Raise_annotations);
2022
0
            return 0;
2023
0
        }
2024
2
    }
2025
2
    {
2026
2
        PyObject *type = state->expr_type;
2027
2
        type = _Py_union_type_or(type, Py_None);
2028
2
        cond = type != NULL;
2029
2
        if (!cond) {
2030
0
            Py_DECREF(Raise_annotations);
2031
0
            return 0;
2032
0
        }
2033
2
        cond = PyDict_SetItemString(Raise_annotations, "cause", type) == 0;
2034
2
        Py_DECREF(type);
2035
2
        if (!cond) {
2036
0
            Py_DECREF(Raise_annotations);
2037
0
            return 0;
2038
0
        }
2039
2
    }
2040
2
    cond = PyObject_SetAttrString(state->Raise_type, "_field_types",
2041
2
                                  Raise_annotations) == 0;
2042
2
    if (!cond) {
2043
0
        Py_DECREF(Raise_annotations);
2044
0
        return 0;
2045
0
    }
2046
2
    cond = PyObject_SetAttrString(state->Raise_type, "__annotations__",
2047
2
                                  Raise_annotations) == 0;
2048
2
    if (!cond) {
2049
0
        Py_DECREF(Raise_annotations);
2050
0
        return 0;
2051
0
    }
2052
2
    Py_DECREF(Raise_annotations);
2053
2
    PyObject *Try_annotations = PyDict_New();
2054
2
    if (!Try_annotations) return 0;
2055
2
    {
2056
2
        PyObject *type = state->stmt_type;
2057
2
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
2058
2
        cond = type != NULL;
2059
2
        if (!cond) {
2060
0
            Py_DECREF(Try_annotations);
2061
0
            return 0;
2062
0
        }
2063
2
        cond = PyDict_SetItemString(Try_annotations, "body", type) == 0;
2064
2
        Py_DECREF(type);
2065
2
        if (!cond) {
2066
0
            Py_DECREF(Try_annotations);
2067
0
            return 0;
2068
0
        }
2069
2
    }
2070
2
    {
2071
2
        PyObject *type = state->excepthandler_type;
2072
2
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
2073
2
        cond = type != NULL;
2074
2
        if (!cond) {
2075
0
            Py_DECREF(Try_annotations);
2076
0
            return 0;
2077
0
        }
2078
2
        cond = PyDict_SetItemString(Try_annotations, "handlers", type) == 0;
2079
2
        Py_DECREF(type);
2080
2
        if (!cond) {
2081
0
            Py_DECREF(Try_annotations);
2082
0
            return 0;
2083
0
        }
2084
2
    }
2085
2
    {
2086
2
        PyObject *type = state->stmt_type;
2087
2
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
2088
2
        cond = type != NULL;
2089
2
        if (!cond) {
2090
0
            Py_DECREF(Try_annotations);
2091
0
            return 0;
2092
0
        }
2093
2
        cond = PyDict_SetItemString(Try_annotations, "orelse", type) == 0;
2094
2
        Py_DECREF(type);
2095
2
        if (!cond) {
2096
0
            Py_DECREF(Try_annotations);
2097
0
            return 0;
2098
0
        }
2099
2
    }
2100
2
    {
2101
2
        PyObject *type = state->stmt_type;
2102
2
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
2103
2
        cond = type != NULL;
2104
2
        if (!cond) {
2105
0
            Py_DECREF(Try_annotations);
2106
0
            return 0;
2107
0
        }
2108
2
        cond = PyDict_SetItemString(Try_annotations, "finalbody", type) == 0;
2109
2
        Py_DECREF(type);
2110
2
        if (!cond) {
2111
0
            Py_DECREF(Try_annotations);
2112
0
            return 0;
2113
0
        }
2114
2
    }
2115
2
    cond = PyObject_SetAttrString(state->Try_type, "_field_types",
2116
2
                                  Try_annotations) == 0;
2117
2
    if (!cond) {
2118
0
        Py_DECREF(Try_annotations);
2119
0
        return 0;
2120
0
    }
2121
2
    cond = PyObject_SetAttrString(state->Try_type, "__annotations__",
2122
2
                                  Try_annotations) == 0;
2123
2
    if (!cond) {
2124
0
        Py_DECREF(Try_annotations);
2125
0
        return 0;
2126
0
    }
2127
2
    Py_DECREF(Try_annotations);
2128
2
    PyObject *TryStar_annotations = PyDict_New();
2129
2
    if (!TryStar_annotations) return 0;
2130
2
    {
2131
2
        PyObject *type = state->stmt_type;
2132
2
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
2133
2
        cond = type != NULL;
2134
2
        if (!cond) {
2135
0
            Py_DECREF(TryStar_annotations);
2136
0
            return 0;
2137
0
        }
2138
2
        cond = PyDict_SetItemString(TryStar_annotations, "body", type) == 0;
2139
2
        Py_DECREF(type);
2140
2
        if (!cond) {
2141
0
            Py_DECREF(TryStar_annotations);
2142
0
            return 0;
2143
0
        }
2144
2
    }
2145
2
    {
2146
2
        PyObject *type = state->excepthandler_type;
2147
2
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
2148
2
        cond = type != NULL;
2149
2
        if (!cond) {
2150
0
            Py_DECREF(TryStar_annotations);
2151
0
            return 0;
2152
0
        }
2153
2
        cond = PyDict_SetItemString(TryStar_annotations, "handlers", type) == 0;
2154
2
        Py_DECREF(type);
2155
2
        if (!cond) {
2156
0
            Py_DECREF(TryStar_annotations);
2157
0
            return 0;
2158
0
        }
2159
2
    }
2160
2
    {
2161
2
        PyObject *type = state->stmt_type;
2162
2
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
2163
2
        cond = type != NULL;
2164
2
        if (!cond) {
2165
0
            Py_DECREF(TryStar_annotations);
2166
0
            return 0;
2167
0
        }
2168
2
        cond = PyDict_SetItemString(TryStar_annotations, "orelse", type) == 0;
2169
2
        Py_DECREF(type);
2170
2
        if (!cond) {
2171
0
            Py_DECREF(TryStar_annotations);
2172
0
            return 0;
2173
0
        }
2174
2
    }
2175
2
    {
2176
2
        PyObject *type = state->stmt_type;
2177
2
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
2178
2
        cond = type != NULL;
2179
2
        if (!cond) {
2180
0
            Py_DECREF(TryStar_annotations);
2181
0
            return 0;
2182
0
        }
2183
2
        cond = PyDict_SetItemString(TryStar_annotations, "finalbody", type) ==
2184
2
                                    0;
2185
2
        Py_DECREF(type);
2186
2
        if (!cond) {
2187
0
            Py_DECREF(TryStar_annotations);
2188
0
            return 0;
2189
0
        }
2190
2
    }
2191
2
    cond = PyObject_SetAttrString(state->TryStar_type, "_field_types",
2192
2
                                  TryStar_annotations) == 0;
2193
2
    if (!cond) {
2194
0
        Py_DECREF(TryStar_annotations);
2195
0
        return 0;
2196
0
    }
2197
2
    cond = PyObject_SetAttrString(state->TryStar_type, "__annotations__",
2198
2
                                  TryStar_annotations) == 0;
2199
2
    if (!cond) {
2200
0
        Py_DECREF(TryStar_annotations);
2201
0
        return 0;
2202
0
    }
2203
2
    Py_DECREF(TryStar_annotations);
2204
2
    PyObject *Assert_annotations = PyDict_New();
2205
2
    if (!Assert_annotations) return 0;
2206
2
    {
2207
2
        PyObject *type = state->expr_type;
2208
2
        Py_INCREF(type);
2209
2
        cond = PyDict_SetItemString(Assert_annotations, "test", type) == 0;
2210
2
        Py_DECREF(type);
2211
2
        if (!cond) {
2212
0
            Py_DECREF(Assert_annotations);
2213
0
            return 0;
2214
0
        }
2215
2
    }
2216
2
    {
2217
2
        PyObject *type = state->expr_type;
2218
2
        type = _Py_union_type_or(type, Py_None);
2219
2
        cond = type != NULL;
2220
2
        if (!cond) {
2221
0
            Py_DECREF(Assert_annotations);
2222
0
            return 0;
2223
0
        }
2224
2
        cond = PyDict_SetItemString(Assert_annotations, "msg", type) == 0;
2225
2
        Py_DECREF(type);
2226
2
        if (!cond) {
2227
0
            Py_DECREF(Assert_annotations);
2228
0
            return 0;
2229
0
        }
2230
2
    }
2231
2
    cond = PyObject_SetAttrString(state->Assert_type, "_field_types",
2232
2
                                  Assert_annotations) == 0;
2233
2
    if (!cond) {
2234
0
        Py_DECREF(Assert_annotations);
2235
0
        return 0;
2236
0
    }
2237
2
    cond = PyObject_SetAttrString(state->Assert_type, "__annotations__",
2238
2
                                  Assert_annotations) == 0;
2239
2
    if (!cond) {
2240
0
        Py_DECREF(Assert_annotations);
2241
0
        return 0;
2242
0
    }
2243
2
    Py_DECREF(Assert_annotations);
2244
2
    PyObject *Import_annotations = PyDict_New();
2245
2
    if (!Import_annotations) return 0;
2246
2
    {
2247
2
        PyObject *type = state->alias_type;
2248
2
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
2249
2
        cond = type != NULL;
2250
2
        if (!cond) {
2251
0
            Py_DECREF(Import_annotations);
2252
0
            return 0;
2253
0
        }
2254
2
        cond = PyDict_SetItemString(Import_annotations, "names", type) == 0;
2255
2
        Py_DECREF(type);
2256
2
        if (!cond) {
2257
0
            Py_DECREF(Import_annotations);
2258
0
            return 0;
2259
0
        }
2260
2
    }
2261
2
    {
2262
2
        PyObject *type = (PyObject *)&PyLong_Type;
2263
2
        type = _Py_union_type_or(type, Py_None);
2264
2
        cond = type != NULL;
2265
2
        if (!cond) {
2266
0
            Py_DECREF(Import_annotations);
2267
0
            return 0;
2268
0
        }
2269
2
        cond = PyDict_SetItemString(Import_annotations, "is_lazy", type) == 0;
2270
2
        Py_DECREF(type);
2271
2
        if (!cond) {
2272
0
            Py_DECREF(Import_annotations);
2273
0
            return 0;
2274
0
        }
2275
2
    }
2276
2
    cond = PyObject_SetAttrString(state->Import_type, "_field_types",
2277
2
                                  Import_annotations) == 0;
2278
2
    if (!cond) {
2279
0
        Py_DECREF(Import_annotations);
2280
0
        return 0;
2281
0
    }
2282
2
    cond = PyObject_SetAttrString(state->Import_type, "__annotations__",
2283
2
                                  Import_annotations) == 0;
2284
2
    if (!cond) {
2285
0
        Py_DECREF(Import_annotations);
2286
0
        return 0;
2287
0
    }
2288
2
    Py_DECREF(Import_annotations);
2289
2
    PyObject *ImportFrom_annotations = PyDict_New();
2290
2
    if (!ImportFrom_annotations) return 0;
2291
2
    {
2292
2
        PyObject *type = (PyObject *)&PyUnicode_Type;
2293
2
        type = _Py_union_type_or(type, Py_None);
2294
2
        cond = type != NULL;
2295
2
        if (!cond) {
2296
0
            Py_DECREF(ImportFrom_annotations);
2297
0
            return 0;
2298
0
        }
2299
2
        cond = PyDict_SetItemString(ImportFrom_annotations, "module", type) ==
2300
2
                                    0;
2301
2
        Py_DECREF(type);
2302
2
        if (!cond) {
2303
0
            Py_DECREF(ImportFrom_annotations);
2304
0
            return 0;
2305
0
        }
2306
2
    }
2307
2
    {
2308
2
        PyObject *type = state->alias_type;
2309
2
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
2310
2
        cond = type != NULL;
2311
2
        if (!cond) {
2312
0
            Py_DECREF(ImportFrom_annotations);
2313
0
            return 0;
2314
0
        }
2315
2
        cond = PyDict_SetItemString(ImportFrom_annotations, "names", type) == 0;
2316
2
        Py_DECREF(type);
2317
2
        if (!cond) {
2318
0
            Py_DECREF(ImportFrom_annotations);
2319
0
            return 0;
2320
0
        }
2321
2
    }
2322
2
    {
2323
2
        PyObject *type = (PyObject *)&PyLong_Type;
2324
2
        type = _Py_union_type_or(type, Py_None);
2325
2
        cond = type != NULL;
2326
2
        if (!cond) {
2327
0
            Py_DECREF(ImportFrom_annotations);
2328
0
            return 0;
2329
0
        }
2330
2
        cond = PyDict_SetItemString(ImportFrom_annotations, "level", type) == 0;
2331
2
        Py_DECREF(type);
2332
2
        if (!cond) {
2333
0
            Py_DECREF(ImportFrom_annotations);
2334
0
            return 0;
2335
0
        }
2336
2
    }
2337
2
    {
2338
2
        PyObject *type = (PyObject *)&PyLong_Type;
2339
2
        type = _Py_union_type_or(type, Py_None);
2340
2
        cond = type != NULL;
2341
2
        if (!cond) {
2342
0
            Py_DECREF(ImportFrom_annotations);
2343
0
            return 0;
2344
0
        }
2345
2
        cond = PyDict_SetItemString(ImportFrom_annotations, "is_lazy", type) ==
2346
2
                                    0;
2347
2
        Py_DECREF(type);
2348
2
        if (!cond) {
2349
0
            Py_DECREF(ImportFrom_annotations);
2350
0
            return 0;
2351
0
        }
2352
2
    }
2353
2
    cond = PyObject_SetAttrString(state->ImportFrom_type, "_field_types",
2354
2
                                  ImportFrom_annotations) == 0;
2355
2
    if (!cond) {
2356
0
        Py_DECREF(ImportFrom_annotations);
2357
0
        return 0;
2358
0
    }
2359
2
    cond = PyObject_SetAttrString(state->ImportFrom_type, "__annotations__",
2360
2
                                  ImportFrom_annotations) == 0;
2361
2
    if (!cond) {
2362
0
        Py_DECREF(ImportFrom_annotations);
2363
0
        return 0;
2364
0
    }
2365
2
    Py_DECREF(ImportFrom_annotations);
2366
2
    PyObject *Global_annotations = PyDict_New();
2367
2
    if (!Global_annotations) return 0;
2368
2
    {
2369
2
        PyObject *type = (PyObject *)&PyUnicode_Type;
2370
2
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
2371
2
        cond = type != NULL;
2372
2
        if (!cond) {
2373
0
            Py_DECREF(Global_annotations);
2374
0
            return 0;
2375
0
        }
2376
2
        cond = PyDict_SetItemString(Global_annotations, "names", type) == 0;
2377
2
        Py_DECREF(type);
2378
2
        if (!cond) {
2379
0
            Py_DECREF(Global_annotations);
2380
0
            return 0;
2381
0
        }
2382
2
    }
2383
2
    cond = PyObject_SetAttrString(state->Global_type, "_field_types",
2384
2
                                  Global_annotations) == 0;
2385
2
    if (!cond) {
2386
0
        Py_DECREF(Global_annotations);
2387
0
        return 0;
2388
0
    }
2389
2
    cond = PyObject_SetAttrString(state->Global_type, "__annotations__",
2390
2
                                  Global_annotations) == 0;
2391
2
    if (!cond) {
2392
0
        Py_DECREF(Global_annotations);
2393
0
        return 0;
2394
0
    }
2395
2
    Py_DECREF(Global_annotations);
2396
2
    PyObject *Nonlocal_annotations = PyDict_New();
2397
2
    if (!Nonlocal_annotations) return 0;
2398
2
    {
2399
2
        PyObject *type = (PyObject *)&PyUnicode_Type;
2400
2
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
2401
2
        cond = type != NULL;
2402
2
        if (!cond) {
2403
0
            Py_DECREF(Nonlocal_annotations);
2404
0
            return 0;
2405
0
        }
2406
2
        cond = PyDict_SetItemString(Nonlocal_annotations, "names", type) == 0;
2407
2
        Py_DECREF(type);
2408
2
        if (!cond) {
2409
0
            Py_DECREF(Nonlocal_annotations);
2410
0
            return 0;
2411
0
        }
2412
2
    }
2413
2
    cond = PyObject_SetAttrString(state->Nonlocal_type, "_field_types",
2414
2
                                  Nonlocal_annotations) == 0;
2415
2
    if (!cond) {
2416
0
        Py_DECREF(Nonlocal_annotations);
2417
0
        return 0;
2418
0
    }
2419
2
    cond = PyObject_SetAttrString(state->Nonlocal_type, "__annotations__",
2420
2
                                  Nonlocal_annotations) == 0;
2421
2
    if (!cond) {
2422
0
        Py_DECREF(Nonlocal_annotations);
2423
0
        return 0;
2424
0
    }
2425
2
    Py_DECREF(Nonlocal_annotations);
2426
2
    PyObject *Expr_annotations = PyDict_New();
2427
2
    if (!Expr_annotations) return 0;
2428
2
    {
2429
2
        PyObject *type = state->expr_type;
2430
2
        Py_INCREF(type);
2431
2
        cond = PyDict_SetItemString(Expr_annotations, "value", type) == 0;
2432
2
        Py_DECREF(type);
2433
2
        if (!cond) {
2434
0
            Py_DECREF(Expr_annotations);
2435
0
            return 0;
2436
0
        }
2437
2
    }
2438
2
    cond = PyObject_SetAttrString(state->Expr_type, "_field_types",
2439
2
                                  Expr_annotations) == 0;
2440
2
    if (!cond) {
2441
0
        Py_DECREF(Expr_annotations);
2442
0
        return 0;
2443
0
    }
2444
2
    cond = PyObject_SetAttrString(state->Expr_type, "__annotations__",
2445
2
                                  Expr_annotations) == 0;
2446
2
    if (!cond) {
2447
0
        Py_DECREF(Expr_annotations);
2448
0
        return 0;
2449
0
    }
2450
2
    Py_DECREF(Expr_annotations);
2451
2
    PyObject *Pass_annotations = PyDict_New();
2452
2
    if (!Pass_annotations) return 0;
2453
2
    cond = PyObject_SetAttrString(state->Pass_type, "_field_types",
2454
2
                                  Pass_annotations) == 0;
2455
2
    if (!cond) {
2456
0
        Py_DECREF(Pass_annotations);
2457
0
        return 0;
2458
0
    }
2459
2
    cond = PyObject_SetAttrString(state->Pass_type, "__annotations__",
2460
2
                                  Pass_annotations) == 0;
2461
2
    if (!cond) {
2462
0
        Py_DECREF(Pass_annotations);
2463
0
        return 0;
2464
0
    }
2465
2
    Py_DECREF(Pass_annotations);
2466
2
    PyObject *Break_annotations = PyDict_New();
2467
2
    if (!Break_annotations) return 0;
2468
2
    cond = PyObject_SetAttrString(state->Break_type, "_field_types",
2469
2
                                  Break_annotations) == 0;
2470
2
    if (!cond) {
2471
0
        Py_DECREF(Break_annotations);
2472
0
        return 0;
2473
0
    }
2474
2
    cond = PyObject_SetAttrString(state->Break_type, "__annotations__",
2475
2
                                  Break_annotations) == 0;
2476
2
    if (!cond) {
2477
0
        Py_DECREF(Break_annotations);
2478
0
        return 0;
2479
0
    }
2480
2
    Py_DECREF(Break_annotations);
2481
2
    PyObject *Continue_annotations = PyDict_New();
2482
2
    if (!Continue_annotations) return 0;
2483
2
    cond = PyObject_SetAttrString(state->Continue_type, "_field_types",
2484
2
                                  Continue_annotations) == 0;
2485
2
    if (!cond) {
2486
0
        Py_DECREF(Continue_annotations);
2487
0
        return 0;
2488
0
    }
2489
2
    cond = PyObject_SetAttrString(state->Continue_type, "__annotations__",
2490
2
                                  Continue_annotations) == 0;
2491
2
    if (!cond) {
2492
0
        Py_DECREF(Continue_annotations);
2493
0
        return 0;
2494
0
    }
2495
2
    Py_DECREF(Continue_annotations);
2496
2
    PyObject *BoolOp_annotations = PyDict_New();
2497
2
    if (!BoolOp_annotations) return 0;
2498
2
    {
2499
2
        PyObject *type = state->boolop_type;
2500
2
        Py_INCREF(type);
2501
2
        cond = PyDict_SetItemString(BoolOp_annotations, "op", type) == 0;
2502
2
        Py_DECREF(type);
2503
2
        if (!cond) {
2504
0
            Py_DECREF(BoolOp_annotations);
2505
0
            return 0;
2506
0
        }
2507
2
    }
2508
2
    {
2509
2
        PyObject *type = state->expr_type;
2510
2
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
2511
2
        cond = type != NULL;
2512
2
        if (!cond) {
2513
0
            Py_DECREF(BoolOp_annotations);
2514
0
            return 0;
2515
0
        }
2516
2
        cond = PyDict_SetItemString(BoolOp_annotations, "values", type) == 0;
2517
2
        Py_DECREF(type);
2518
2
        if (!cond) {
2519
0
            Py_DECREF(BoolOp_annotations);
2520
0
            return 0;
2521
0
        }
2522
2
    }
2523
2
    cond = PyObject_SetAttrString(state->BoolOp_type, "_field_types",
2524
2
                                  BoolOp_annotations) == 0;
2525
2
    if (!cond) {
2526
0
        Py_DECREF(BoolOp_annotations);
2527
0
        return 0;
2528
0
    }
2529
2
    cond = PyObject_SetAttrString(state->BoolOp_type, "__annotations__",
2530
2
                                  BoolOp_annotations) == 0;
2531
2
    if (!cond) {
2532
0
        Py_DECREF(BoolOp_annotations);
2533
0
        return 0;
2534
0
    }
2535
2
    Py_DECREF(BoolOp_annotations);
2536
2
    PyObject *NamedExpr_annotations = PyDict_New();
2537
2
    if (!NamedExpr_annotations) return 0;
2538
2
    {
2539
2
        PyObject *type = state->expr_type;
2540
2
        Py_INCREF(type);
2541
2
        cond = PyDict_SetItemString(NamedExpr_annotations, "target", type) == 0;
2542
2
        Py_DECREF(type);
2543
2
        if (!cond) {
2544
0
            Py_DECREF(NamedExpr_annotations);
2545
0
            return 0;
2546
0
        }
2547
2
    }
2548
2
    {
2549
2
        PyObject *type = state->expr_type;
2550
2
        Py_INCREF(type);
2551
2
        cond = PyDict_SetItemString(NamedExpr_annotations, "value", type) == 0;
2552
2
        Py_DECREF(type);
2553
2
        if (!cond) {
2554
0
            Py_DECREF(NamedExpr_annotations);
2555
0
            return 0;
2556
0
        }
2557
2
    }
2558
2
    cond = PyObject_SetAttrString(state->NamedExpr_type, "_field_types",
2559
2
                                  NamedExpr_annotations) == 0;
2560
2
    if (!cond) {
2561
0
        Py_DECREF(NamedExpr_annotations);
2562
0
        return 0;
2563
0
    }
2564
2
    cond = PyObject_SetAttrString(state->NamedExpr_type, "__annotations__",
2565
2
                                  NamedExpr_annotations) == 0;
2566
2
    if (!cond) {
2567
0
        Py_DECREF(NamedExpr_annotations);
2568
0
        return 0;
2569
0
    }
2570
2
    Py_DECREF(NamedExpr_annotations);
2571
2
    PyObject *BinOp_annotations = PyDict_New();
2572
2
    if (!BinOp_annotations) return 0;
2573
2
    {
2574
2
        PyObject *type = state->expr_type;
2575
2
        Py_INCREF(type);
2576
2
        cond = PyDict_SetItemString(BinOp_annotations, "left", type) == 0;
2577
2
        Py_DECREF(type);
2578
2
        if (!cond) {
2579
0
            Py_DECREF(BinOp_annotations);
2580
0
            return 0;
2581
0
        }
2582
2
    }
2583
2
    {
2584
2
        PyObject *type = state->operator_type;
2585
2
        Py_INCREF(type);
2586
2
        cond = PyDict_SetItemString(BinOp_annotations, "op", type) == 0;
2587
2
        Py_DECREF(type);
2588
2
        if (!cond) {
2589
0
            Py_DECREF(BinOp_annotations);
2590
0
            return 0;
2591
0
        }
2592
2
    }
2593
2
    {
2594
2
        PyObject *type = state->expr_type;
2595
2
        Py_INCREF(type);
2596
2
        cond = PyDict_SetItemString(BinOp_annotations, "right", type) == 0;
2597
2
        Py_DECREF(type);
2598
2
        if (!cond) {
2599
0
            Py_DECREF(BinOp_annotations);
2600
0
            return 0;
2601
0
        }
2602
2
    }
2603
2
    cond = PyObject_SetAttrString(state->BinOp_type, "_field_types",
2604
2
                                  BinOp_annotations) == 0;
2605
2
    if (!cond) {
2606
0
        Py_DECREF(BinOp_annotations);
2607
0
        return 0;
2608
0
    }
2609
2
    cond = PyObject_SetAttrString(state->BinOp_type, "__annotations__",
2610
2
                                  BinOp_annotations) == 0;
2611
2
    if (!cond) {
2612
0
        Py_DECREF(BinOp_annotations);
2613
0
        return 0;
2614
0
    }
2615
2
    Py_DECREF(BinOp_annotations);
2616
2
    PyObject *UnaryOp_annotations = PyDict_New();
2617
2
    if (!UnaryOp_annotations) return 0;
2618
2
    {
2619
2
        PyObject *type = state->unaryop_type;
2620
2
        Py_INCREF(type);
2621
2
        cond = PyDict_SetItemString(UnaryOp_annotations, "op", type) == 0;
2622
2
        Py_DECREF(type);
2623
2
        if (!cond) {
2624
0
            Py_DECREF(UnaryOp_annotations);
2625
0
            return 0;
2626
0
        }
2627
2
    }
2628
2
    {
2629
2
        PyObject *type = state->expr_type;
2630
2
        Py_INCREF(type);
2631
2
        cond = PyDict_SetItemString(UnaryOp_annotations, "operand", type) == 0;
2632
2
        Py_DECREF(type);
2633
2
        if (!cond) {
2634
0
            Py_DECREF(UnaryOp_annotations);
2635
0
            return 0;
2636
0
        }
2637
2
    }
2638
2
    cond = PyObject_SetAttrString(state->UnaryOp_type, "_field_types",
2639
2
                                  UnaryOp_annotations) == 0;
2640
2
    if (!cond) {
2641
0
        Py_DECREF(UnaryOp_annotations);
2642
0
        return 0;
2643
0
    }
2644
2
    cond = PyObject_SetAttrString(state->UnaryOp_type, "__annotations__",
2645
2
                                  UnaryOp_annotations) == 0;
2646
2
    if (!cond) {
2647
0
        Py_DECREF(UnaryOp_annotations);
2648
0
        return 0;
2649
0
    }
2650
2
    Py_DECREF(UnaryOp_annotations);
2651
2
    PyObject *Lambda_annotations = PyDict_New();
2652
2
    if (!Lambda_annotations) return 0;
2653
2
    {
2654
2
        PyObject *type = state->arguments_type;
2655
2
        Py_INCREF(type);
2656
2
        cond = PyDict_SetItemString(Lambda_annotations, "args", type) == 0;
2657
2
        Py_DECREF(type);
2658
2
        if (!cond) {
2659
0
            Py_DECREF(Lambda_annotations);
2660
0
            return 0;
2661
0
        }
2662
2
    }
2663
2
    {
2664
2
        PyObject *type = state->expr_type;
2665
2
        Py_INCREF(type);
2666
2
        cond = PyDict_SetItemString(Lambda_annotations, "body", type) == 0;
2667
2
        Py_DECREF(type);
2668
2
        if (!cond) {
2669
0
            Py_DECREF(Lambda_annotations);
2670
0
            return 0;
2671
0
        }
2672
2
    }
2673
2
    cond = PyObject_SetAttrString(state->Lambda_type, "_field_types",
2674
2
                                  Lambda_annotations) == 0;
2675
2
    if (!cond) {
2676
0
        Py_DECREF(Lambda_annotations);
2677
0
        return 0;
2678
0
    }
2679
2
    cond = PyObject_SetAttrString(state->Lambda_type, "__annotations__",
2680
2
                                  Lambda_annotations) == 0;
2681
2
    if (!cond) {
2682
0
        Py_DECREF(Lambda_annotations);
2683
0
        return 0;
2684
0
    }
2685
2
    Py_DECREF(Lambda_annotations);
2686
2
    PyObject *IfExp_annotations = PyDict_New();
2687
2
    if (!IfExp_annotations) return 0;
2688
2
    {
2689
2
        PyObject *type = state->expr_type;
2690
2
        Py_INCREF(type);
2691
2
        cond = PyDict_SetItemString(IfExp_annotations, "test", type) == 0;
2692
2
        Py_DECREF(type);
2693
2
        if (!cond) {
2694
0
            Py_DECREF(IfExp_annotations);
2695
0
            return 0;
2696
0
        }
2697
2
    }
2698
2
    {
2699
2
        PyObject *type = state->expr_type;
2700
2
        Py_INCREF(type);
2701
2
        cond = PyDict_SetItemString(IfExp_annotations, "body", type) == 0;
2702
2
        Py_DECREF(type);
2703
2
        if (!cond) {
2704
0
            Py_DECREF(IfExp_annotations);
2705
0
            return 0;
2706
0
        }
2707
2
    }
2708
2
    {
2709
2
        PyObject *type = state->expr_type;
2710
2
        Py_INCREF(type);
2711
2
        cond = PyDict_SetItemString(IfExp_annotations, "orelse", type) == 0;
2712
2
        Py_DECREF(type);
2713
2
        if (!cond) {
2714
0
            Py_DECREF(IfExp_annotations);
2715
0
            return 0;
2716
0
        }
2717
2
    }
2718
2
    cond = PyObject_SetAttrString(state->IfExp_type, "_field_types",
2719
2
                                  IfExp_annotations) == 0;
2720
2
    if (!cond) {
2721
0
        Py_DECREF(IfExp_annotations);
2722
0
        return 0;
2723
0
    }
2724
2
    cond = PyObject_SetAttrString(state->IfExp_type, "__annotations__",
2725
2
                                  IfExp_annotations) == 0;
2726
2
    if (!cond) {
2727
0
        Py_DECREF(IfExp_annotations);
2728
0
        return 0;
2729
0
    }
2730
2
    Py_DECREF(IfExp_annotations);
2731
2
    PyObject *Dict_annotations = PyDict_New();
2732
2
    if (!Dict_annotations) return 0;
2733
2
    {
2734
2
        PyObject *type = state->expr_type;
2735
2
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
2736
2
        cond = type != NULL;
2737
2
        if (!cond) {
2738
0
            Py_DECREF(Dict_annotations);
2739
0
            return 0;
2740
0
        }
2741
2
        cond = PyDict_SetItemString(Dict_annotations, "keys", type) == 0;
2742
2
        Py_DECREF(type);
2743
2
        if (!cond) {
2744
0
            Py_DECREF(Dict_annotations);
2745
0
            return 0;
2746
0
        }
2747
2
    }
2748
2
    {
2749
2
        PyObject *type = state->expr_type;
2750
2
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
2751
2
        cond = type != NULL;
2752
2
        if (!cond) {
2753
0
            Py_DECREF(Dict_annotations);
2754
0
            return 0;
2755
0
        }
2756
2
        cond = PyDict_SetItemString(Dict_annotations, "values", type) == 0;
2757
2
        Py_DECREF(type);
2758
2
        if (!cond) {
2759
0
            Py_DECREF(Dict_annotations);
2760
0
            return 0;
2761
0
        }
2762
2
    }
2763
2
    cond = PyObject_SetAttrString(state->Dict_type, "_field_types",
2764
2
                                  Dict_annotations) == 0;
2765
2
    if (!cond) {
2766
0
        Py_DECREF(Dict_annotations);
2767
0
        return 0;
2768
0
    }
2769
2
    cond = PyObject_SetAttrString(state->Dict_type, "__annotations__",
2770
2
                                  Dict_annotations) == 0;
2771
2
    if (!cond) {
2772
0
        Py_DECREF(Dict_annotations);
2773
0
        return 0;
2774
0
    }
2775
2
    Py_DECREF(Dict_annotations);
2776
2
    PyObject *Set_annotations = PyDict_New();
2777
2
    if (!Set_annotations) return 0;
2778
2
    {
2779
2
        PyObject *type = state->expr_type;
2780
2
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
2781
2
        cond = type != NULL;
2782
2
        if (!cond) {
2783
0
            Py_DECREF(Set_annotations);
2784
0
            return 0;
2785
0
        }
2786
2
        cond = PyDict_SetItemString(Set_annotations, "elts", type) == 0;
2787
2
        Py_DECREF(type);
2788
2
        if (!cond) {
2789
0
            Py_DECREF(Set_annotations);
2790
0
            return 0;
2791
0
        }
2792
2
    }
2793
2
    cond = PyObject_SetAttrString(state->Set_type, "_field_types",
2794
2
                                  Set_annotations) == 0;
2795
2
    if (!cond) {
2796
0
        Py_DECREF(Set_annotations);
2797
0
        return 0;
2798
0
    }
2799
2
    cond = PyObject_SetAttrString(state->Set_type, "__annotations__",
2800
2
                                  Set_annotations) == 0;
2801
2
    if (!cond) {
2802
0
        Py_DECREF(Set_annotations);
2803
0
        return 0;
2804
0
    }
2805
2
    Py_DECREF(Set_annotations);
2806
2
    PyObject *ListComp_annotations = PyDict_New();
2807
2
    if (!ListComp_annotations) return 0;
2808
2
    {
2809
2
        PyObject *type = state->expr_type;
2810
2
        Py_INCREF(type);
2811
2
        cond = PyDict_SetItemString(ListComp_annotations, "elt", type) == 0;
2812
2
        Py_DECREF(type);
2813
2
        if (!cond) {
2814
0
            Py_DECREF(ListComp_annotations);
2815
0
            return 0;
2816
0
        }
2817
2
    }
2818
2
    {
2819
2
        PyObject *type = state->comprehension_type;
2820
2
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
2821
2
        cond = type != NULL;
2822
2
        if (!cond) {
2823
0
            Py_DECREF(ListComp_annotations);
2824
0
            return 0;
2825
0
        }
2826
2
        cond = PyDict_SetItemString(ListComp_annotations, "generators", type)
2827
2
                                    == 0;
2828
2
        Py_DECREF(type);
2829
2
        if (!cond) {
2830
0
            Py_DECREF(ListComp_annotations);
2831
0
            return 0;
2832
0
        }
2833
2
    }
2834
2
    cond = PyObject_SetAttrString(state->ListComp_type, "_field_types",
2835
2
                                  ListComp_annotations) == 0;
2836
2
    if (!cond) {
2837
0
        Py_DECREF(ListComp_annotations);
2838
0
        return 0;
2839
0
    }
2840
2
    cond = PyObject_SetAttrString(state->ListComp_type, "__annotations__",
2841
2
                                  ListComp_annotations) == 0;
2842
2
    if (!cond) {
2843
0
        Py_DECREF(ListComp_annotations);
2844
0
        return 0;
2845
0
    }
2846
2
    Py_DECREF(ListComp_annotations);
2847
2
    PyObject *SetComp_annotations = PyDict_New();
2848
2
    if (!SetComp_annotations) return 0;
2849
2
    {
2850
2
        PyObject *type = state->expr_type;
2851
2
        Py_INCREF(type);
2852
2
        cond = PyDict_SetItemString(SetComp_annotations, "elt", type) == 0;
2853
2
        Py_DECREF(type);
2854
2
        if (!cond) {
2855
0
            Py_DECREF(SetComp_annotations);
2856
0
            return 0;
2857
0
        }
2858
2
    }
2859
2
    {
2860
2
        PyObject *type = state->comprehension_type;
2861
2
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
2862
2
        cond = type != NULL;
2863
2
        if (!cond) {
2864
0
            Py_DECREF(SetComp_annotations);
2865
0
            return 0;
2866
0
        }
2867
2
        cond = PyDict_SetItemString(SetComp_annotations, "generators", type) ==
2868
2
                                    0;
2869
2
        Py_DECREF(type);
2870
2
        if (!cond) {
2871
0
            Py_DECREF(SetComp_annotations);
2872
0
            return 0;
2873
0
        }
2874
2
    }
2875
2
    cond = PyObject_SetAttrString(state->SetComp_type, "_field_types",
2876
2
                                  SetComp_annotations) == 0;
2877
2
    if (!cond) {
2878
0
        Py_DECREF(SetComp_annotations);
2879
0
        return 0;
2880
0
    }
2881
2
    cond = PyObject_SetAttrString(state->SetComp_type, "__annotations__",
2882
2
                                  SetComp_annotations) == 0;
2883
2
    if (!cond) {
2884
0
        Py_DECREF(SetComp_annotations);
2885
0
        return 0;
2886
0
    }
2887
2
    Py_DECREF(SetComp_annotations);
2888
2
    PyObject *DictComp_annotations = PyDict_New();
2889
2
    if (!DictComp_annotations) return 0;
2890
2
    {
2891
2
        PyObject *type = state->expr_type;
2892
2
        Py_INCREF(type);
2893
2
        cond = PyDict_SetItemString(DictComp_annotations, "key", type) == 0;
2894
2
        Py_DECREF(type);
2895
2
        if (!cond) {
2896
0
            Py_DECREF(DictComp_annotations);
2897
0
            return 0;
2898
0
        }
2899
2
    }
2900
2
    {
2901
2
        PyObject *type = state->expr_type;
2902
2
        type = _Py_union_type_or(type, Py_None);
2903
2
        cond = type != NULL;
2904
2
        if (!cond) {
2905
0
            Py_DECREF(DictComp_annotations);
2906
0
            return 0;
2907
0
        }
2908
2
        cond = PyDict_SetItemString(DictComp_annotations, "value", type) == 0;
2909
2
        Py_DECREF(type);
2910
2
        if (!cond) {
2911
0
            Py_DECREF(DictComp_annotations);
2912
0
            return 0;
2913
0
        }
2914
2
    }
2915
2
    {
2916
2
        PyObject *type = state->comprehension_type;
2917
2
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
2918
2
        cond = type != NULL;
2919
2
        if (!cond) {
2920
0
            Py_DECREF(DictComp_annotations);
2921
0
            return 0;
2922
0
        }
2923
2
        cond = PyDict_SetItemString(DictComp_annotations, "generators", type)
2924
2
                                    == 0;
2925
2
        Py_DECREF(type);
2926
2
        if (!cond) {
2927
0
            Py_DECREF(DictComp_annotations);
2928
0
            return 0;
2929
0
        }
2930
2
    }
2931
2
    cond = PyObject_SetAttrString(state->DictComp_type, "_field_types",
2932
2
                                  DictComp_annotations) == 0;
2933
2
    if (!cond) {
2934
0
        Py_DECREF(DictComp_annotations);
2935
0
        return 0;
2936
0
    }
2937
2
    cond = PyObject_SetAttrString(state->DictComp_type, "__annotations__",
2938
2
                                  DictComp_annotations) == 0;
2939
2
    if (!cond) {
2940
0
        Py_DECREF(DictComp_annotations);
2941
0
        return 0;
2942
0
    }
2943
2
    Py_DECREF(DictComp_annotations);
2944
2
    PyObject *GeneratorExp_annotations = PyDict_New();
2945
2
    if (!GeneratorExp_annotations) return 0;
2946
2
    {
2947
2
        PyObject *type = state->expr_type;
2948
2
        Py_INCREF(type);
2949
2
        cond = PyDict_SetItemString(GeneratorExp_annotations, "elt", type) == 0;
2950
2
        Py_DECREF(type);
2951
2
        if (!cond) {
2952
0
            Py_DECREF(GeneratorExp_annotations);
2953
0
            return 0;
2954
0
        }
2955
2
    }
2956
2
    {
2957
2
        PyObject *type = state->comprehension_type;
2958
2
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
2959
2
        cond = type != NULL;
2960
2
        if (!cond) {
2961
0
            Py_DECREF(GeneratorExp_annotations);
2962
0
            return 0;
2963
0
        }
2964
2
        cond = PyDict_SetItemString(GeneratorExp_annotations, "generators",
2965
2
                                    type) == 0;
2966
2
        Py_DECREF(type);
2967
2
        if (!cond) {
2968
0
            Py_DECREF(GeneratorExp_annotations);
2969
0
            return 0;
2970
0
        }
2971
2
    }
2972
2
    cond = PyObject_SetAttrString(state->GeneratorExp_type, "_field_types",
2973
2
                                  GeneratorExp_annotations) == 0;
2974
2
    if (!cond) {
2975
0
        Py_DECREF(GeneratorExp_annotations);
2976
0
        return 0;
2977
0
    }
2978
2
    cond = PyObject_SetAttrString(state->GeneratorExp_type, "__annotations__",
2979
2
                                  GeneratorExp_annotations) == 0;
2980
2
    if (!cond) {
2981
0
        Py_DECREF(GeneratorExp_annotations);
2982
0
        return 0;
2983
0
    }
2984
2
    Py_DECREF(GeneratorExp_annotations);
2985
2
    PyObject *Await_annotations = PyDict_New();
2986
2
    if (!Await_annotations) return 0;
2987
2
    {
2988
2
        PyObject *type = state->expr_type;
2989
2
        Py_INCREF(type);
2990
2
        cond = PyDict_SetItemString(Await_annotations, "value", type) == 0;
2991
2
        Py_DECREF(type);
2992
2
        if (!cond) {
2993
0
            Py_DECREF(Await_annotations);
2994
0
            return 0;
2995
0
        }
2996
2
    }
2997
2
    cond = PyObject_SetAttrString(state->Await_type, "_field_types",
2998
2
                                  Await_annotations) == 0;
2999
2
    if (!cond) {
3000
0
        Py_DECREF(Await_annotations);
3001
0
        return 0;
3002
0
    }
3003
2
    cond = PyObject_SetAttrString(state->Await_type, "__annotations__",
3004
2
                                  Await_annotations) == 0;
3005
2
    if (!cond) {
3006
0
        Py_DECREF(Await_annotations);
3007
0
        return 0;
3008
0
    }
3009
2
    Py_DECREF(Await_annotations);
3010
2
    PyObject *Yield_annotations = PyDict_New();
3011
2
    if (!Yield_annotations) return 0;
3012
2
    {
3013
2
        PyObject *type = state->expr_type;
3014
2
        type = _Py_union_type_or(type, Py_None);
3015
2
        cond = type != NULL;
3016
2
        if (!cond) {
3017
0
            Py_DECREF(Yield_annotations);
3018
0
            return 0;
3019
0
        }
3020
2
        cond = PyDict_SetItemString(Yield_annotations, "value", type) == 0;
3021
2
        Py_DECREF(type);
3022
2
        if (!cond) {
3023
0
            Py_DECREF(Yield_annotations);
3024
0
            return 0;
3025
0
        }
3026
2
    }
3027
2
    cond = PyObject_SetAttrString(state->Yield_type, "_field_types",
3028
2
                                  Yield_annotations) == 0;
3029
2
    if (!cond) {
3030
0
        Py_DECREF(Yield_annotations);
3031
0
        return 0;
3032
0
    }
3033
2
    cond = PyObject_SetAttrString(state->Yield_type, "__annotations__",
3034
2
                                  Yield_annotations) == 0;
3035
2
    if (!cond) {
3036
0
        Py_DECREF(Yield_annotations);
3037
0
        return 0;
3038
0
    }
3039
2
    Py_DECREF(Yield_annotations);
3040
2
    PyObject *YieldFrom_annotations = PyDict_New();
3041
2
    if (!YieldFrom_annotations) return 0;
3042
2
    {
3043
2
        PyObject *type = state->expr_type;
3044
2
        Py_INCREF(type);
3045
2
        cond = PyDict_SetItemString(YieldFrom_annotations, "value", type) == 0;
3046
2
        Py_DECREF(type);
3047
2
        if (!cond) {
3048
0
            Py_DECREF(YieldFrom_annotations);
3049
0
            return 0;
3050
0
        }
3051
2
    }
3052
2
    cond = PyObject_SetAttrString(state->YieldFrom_type, "_field_types",
3053
2
                                  YieldFrom_annotations) == 0;
3054
2
    if (!cond) {
3055
0
        Py_DECREF(YieldFrom_annotations);
3056
0
        return 0;
3057
0
    }
3058
2
    cond = PyObject_SetAttrString(state->YieldFrom_type, "__annotations__",
3059
2
                                  YieldFrom_annotations) == 0;
3060
2
    if (!cond) {
3061
0
        Py_DECREF(YieldFrom_annotations);
3062
0
        return 0;
3063
0
    }
3064
2
    Py_DECREF(YieldFrom_annotations);
3065
2
    PyObject *Compare_annotations = PyDict_New();
3066
2
    if (!Compare_annotations) return 0;
3067
2
    {
3068
2
        PyObject *type = state->expr_type;
3069
2
        Py_INCREF(type);
3070
2
        cond = PyDict_SetItemString(Compare_annotations, "left", type) == 0;
3071
2
        Py_DECREF(type);
3072
2
        if (!cond) {
3073
0
            Py_DECREF(Compare_annotations);
3074
0
            return 0;
3075
0
        }
3076
2
    }
3077
2
    {
3078
2
        PyObject *type = state->cmpop_type;
3079
2
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
3080
2
        cond = type != NULL;
3081
2
        if (!cond) {
3082
0
            Py_DECREF(Compare_annotations);
3083
0
            return 0;
3084
0
        }
3085
2
        cond = PyDict_SetItemString(Compare_annotations, "ops", type) == 0;
3086
2
        Py_DECREF(type);
3087
2
        if (!cond) {
3088
0
            Py_DECREF(Compare_annotations);
3089
0
            return 0;
3090
0
        }
3091
2
    }
3092
2
    {
3093
2
        PyObject *type = state->expr_type;
3094
2
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
3095
2
        cond = type != NULL;
3096
2
        if (!cond) {
3097
0
            Py_DECREF(Compare_annotations);
3098
0
            return 0;
3099
0
        }
3100
2
        cond = PyDict_SetItemString(Compare_annotations, "comparators", type)
3101
2
                                    == 0;
3102
2
        Py_DECREF(type);
3103
2
        if (!cond) {
3104
0
            Py_DECREF(Compare_annotations);
3105
0
            return 0;
3106
0
        }
3107
2
    }
3108
2
    cond = PyObject_SetAttrString(state->Compare_type, "_field_types",
3109
2
                                  Compare_annotations) == 0;
3110
2
    if (!cond) {
3111
0
        Py_DECREF(Compare_annotations);
3112
0
        return 0;
3113
0
    }
3114
2
    cond = PyObject_SetAttrString(state->Compare_type, "__annotations__",
3115
2
                                  Compare_annotations) == 0;
3116
2
    if (!cond) {
3117
0
        Py_DECREF(Compare_annotations);
3118
0
        return 0;
3119
0
    }
3120
2
    Py_DECREF(Compare_annotations);
3121
2
    PyObject *Call_annotations = PyDict_New();
3122
2
    if (!Call_annotations) return 0;
3123
2
    {
3124
2
        PyObject *type = state->expr_type;
3125
2
        Py_INCREF(type);
3126
2
        cond = PyDict_SetItemString(Call_annotations, "func", type) == 0;
3127
2
        Py_DECREF(type);
3128
2
        if (!cond) {
3129
0
            Py_DECREF(Call_annotations);
3130
0
            return 0;
3131
0
        }
3132
2
    }
3133
2
    {
3134
2
        PyObject *type = state->expr_type;
3135
2
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
3136
2
        cond = type != NULL;
3137
2
        if (!cond) {
3138
0
            Py_DECREF(Call_annotations);
3139
0
            return 0;
3140
0
        }
3141
2
        cond = PyDict_SetItemString(Call_annotations, "args", type) == 0;
3142
2
        Py_DECREF(type);
3143
2
        if (!cond) {
3144
0
            Py_DECREF(Call_annotations);
3145
0
            return 0;
3146
0
        }
3147
2
    }
3148
2
    {
3149
2
        PyObject *type = state->keyword_type;
3150
2
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
3151
2
        cond = type != NULL;
3152
2
        if (!cond) {
3153
0
            Py_DECREF(Call_annotations);
3154
0
            return 0;
3155
0
        }
3156
2
        cond = PyDict_SetItemString(Call_annotations, "keywords", type) == 0;
3157
2
        Py_DECREF(type);
3158
2
        if (!cond) {
3159
0
            Py_DECREF(Call_annotations);
3160
0
            return 0;
3161
0
        }
3162
2
    }
3163
2
    cond = PyObject_SetAttrString(state->Call_type, "_field_types",
3164
2
                                  Call_annotations) == 0;
3165
2
    if (!cond) {
3166
0
        Py_DECREF(Call_annotations);
3167
0
        return 0;
3168
0
    }
3169
2
    cond = PyObject_SetAttrString(state->Call_type, "__annotations__",
3170
2
                                  Call_annotations) == 0;
3171
2
    if (!cond) {
3172
0
        Py_DECREF(Call_annotations);
3173
0
        return 0;
3174
0
    }
3175
2
    Py_DECREF(Call_annotations);
3176
2
    PyObject *FormattedValue_annotations = PyDict_New();
3177
2
    if (!FormattedValue_annotations) return 0;
3178
2
    {
3179
2
        PyObject *type = state->expr_type;
3180
2
        Py_INCREF(type);
3181
2
        cond = PyDict_SetItemString(FormattedValue_annotations, "value", type)
3182
2
                                    == 0;
3183
2
        Py_DECREF(type);
3184
2
        if (!cond) {
3185
0
            Py_DECREF(FormattedValue_annotations);
3186
0
            return 0;
3187
0
        }
3188
2
    }
3189
2
    {
3190
2
        PyObject *type = (PyObject *)&PyLong_Type;
3191
2
        Py_INCREF(type);
3192
2
        cond = PyDict_SetItemString(FormattedValue_annotations, "conversion",
3193
2
                                    type) == 0;
3194
2
        Py_DECREF(type);
3195
2
        if (!cond) {
3196
0
            Py_DECREF(FormattedValue_annotations);
3197
0
            return 0;
3198
0
        }
3199
2
    }
3200
2
    {
3201
2
        PyObject *type = state->expr_type;
3202
2
        type = _Py_union_type_or(type, Py_None);
3203
2
        cond = type != NULL;
3204
2
        if (!cond) {
3205
0
            Py_DECREF(FormattedValue_annotations);
3206
0
            return 0;
3207
0
        }
3208
2
        cond = PyDict_SetItemString(FormattedValue_annotations, "format_spec",
3209
2
                                    type) == 0;
3210
2
        Py_DECREF(type);
3211
2
        if (!cond) {
3212
0
            Py_DECREF(FormattedValue_annotations);
3213
0
            return 0;
3214
0
        }
3215
2
    }
3216
2
    cond = PyObject_SetAttrString(state->FormattedValue_type, "_field_types",
3217
2
                                  FormattedValue_annotations) == 0;
3218
2
    if (!cond) {
3219
0
        Py_DECREF(FormattedValue_annotations);
3220
0
        return 0;
3221
0
    }
3222
2
    cond = PyObject_SetAttrString(state->FormattedValue_type,
3223
2
                                  "__annotations__",
3224
2
                                  FormattedValue_annotations) == 0;
3225
2
    if (!cond) {
3226
0
        Py_DECREF(FormattedValue_annotations);
3227
0
        return 0;
3228
0
    }
3229
2
    Py_DECREF(FormattedValue_annotations);
3230
2
    PyObject *Interpolation_annotations = PyDict_New();
3231
2
    if (!Interpolation_annotations) return 0;
3232
2
    {
3233
2
        PyObject *type = state->expr_type;
3234
2
        Py_INCREF(type);
3235
2
        cond = PyDict_SetItemString(Interpolation_annotations, "value", type)
3236
2
                                    == 0;
3237
2
        Py_DECREF(type);
3238
2
        if (!cond) {
3239
0
            Py_DECREF(Interpolation_annotations);
3240
0
            return 0;
3241
0
        }
3242
2
    }
3243
2
    {
3244
2
        PyObject *type = (PyObject *)&PyBaseObject_Type;
3245
2
        Py_INCREF(type);
3246
2
        cond = PyDict_SetItemString(Interpolation_annotations, "str", type) ==
3247
2
                                    0;
3248
2
        Py_DECREF(type);
3249
2
        if (!cond) {
3250
0
            Py_DECREF(Interpolation_annotations);
3251
0
            return 0;
3252
0
        }
3253
2
    }
3254
2
    {
3255
2
        PyObject *type = (PyObject *)&PyLong_Type;
3256
2
        Py_INCREF(type);
3257
2
        cond = PyDict_SetItemString(Interpolation_annotations, "conversion",
3258
2
                                    type) == 0;
3259
2
        Py_DECREF(type);
3260
2
        if (!cond) {
3261
0
            Py_DECREF(Interpolation_annotations);
3262
0
            return 0;
3263
0
        }
3264
2
    }
3265
2
    {
3266
2
        PyObject *type = state->expr_type;
3267
2
        type = _Py_union_type_or(type, Py_None);
3268
2
        cond = type != NULL;
3269
2
        if (!cond) {
3270
0
            Py_DECREF(Interpolation_annotations);
3271
0
            return 0;
3272
0
        }
3273
2
        cond = PyDict_SetItemString(Interpolation_annotations, "format_spec",
3274
2
                                    type) == 0;
3275
2
        Py_DECREF(type);
3276
2
        if (!cond) {
3277
0
            Py_DECREF(Interpolation_annotations);
3278
0
            return 0;
3279
0
        }
3280
2
    }
3281
2
    cond = PyObject_SetAttrString(state->Interpolation_type, "_field_types",
3282
2
                                  Interpolation_annotations) == 0;
3283
2
    if (!cond) {
3284
0
        Py_DECREF(Interpolation_annotations);
3285
0
        return 0;
3286
0
    }
3287
2
    cond = PyObject_SetAttrString(state->Interpolation_type, "__annotations__",
3288
2
                                  Interpolation_annotations) == 0;
3289
2
    if (!cond) {
3290
0
        Py_DECREF(Interpolation_annotations);
3291
0
        return 0;
3292
0
    }
3293
2
    Py_DECREF(Interpolation_annotations);
3294
2
    PyObject *JoinedStr_annotations = PyDict_New();
3295
2
    if (!JoinedStr_annotations) return 0;
3296
2
    {
3297
2
        PyObject *type = state->expr_type;
3298
2
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
3299
2
        cond = type != NULL;
3300
2
        if (!cond) {
3301
0
            Py_DECREF(JoinedStr_annotations);
3302
0
            return 0;
3303
0
        }
3304
2
        cond = PyDict_SetItemString(JoinedStr_annotations, "values", type) == 0;
3305
2
        Py_DECREF(type);
3306
2
        if (!cond) {
3307
0
            Py_DECREF(JoinedStr_annotations);
3308
0
            return 0;
3309
0
        }
3310
2
    }
3311
2
    cond = PyObject_SetAttrString(state->JoinedStr_type, "_field_types",
3312
2
                                  JoinedStr_annotations) == 0;
3313
2
    if (!cond) {
3314
0
        Py_DECREF(JoinedStr_annotations);
3315
0
        return 0;
3316
0
    }
3317
2
    cond = PyObject_SetAttrString(state->JoinedStr_type, "__annotations__",
3318
2
                                  JoinedStr_annotations) == 0;
3319
2
    if (!cond) {
3320
0
        Py_DECREF(JoinedStr_annotations);
3321
0
        return 0;
3322
0
    }
3323
2
    Py_DECREF(JoinedStr_annotations);
3324
2
    PyObject *TemplateStr_annotations = PyDict_New();
3325
2
    if (!TemplateStr_annotations) return 0;
3326
2
    {
3327
2
        PyObject *type = state->expr_type;
3328
2
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
3329
2
        cond = type != NULL;
3330
2
        if (!cond) {
3331
0
            Py_DECREF(TemplateStr_annotations);
3332
0
            return 0;
3333
0
        }
3334
2
        cond = PyDict_SetItemString(TemplateStr_annotations, "values", type) ==
3335
2
                                    0;
3336
2
        Py_DECREF(type);
3337
2
        if (!cond) {
3338
0
            Py_DECREF(TemplateStr_annotations);
3339
0
            return 0;
3340
0
        }
3341
2
    }
3342
2
    cond = PyObject_SetAttrString(state->TemplateStr_type, "_field_types",
3343
2
                                  TemplateStr_annotations) == 0;
3344
2
    if (!cond) {
3345
0
        Py_DECREF(TemplateStr_annotations);
3346
0
        return 0;
3347
0
    }
3348
2
    cond = PyObject_SetAttrString(state->TemplateStr_type, "__annotations__",
3349
2
                                  TemplateStr_annotations) == 0;
3350
2
    if (!cond) {
3351
0
        Py_DECREF(TemplateStr_annotations);
3352
0
        return 0;
3353
0
    }
3354
2
    Py_DECREF(TemplateStr_annotations);
3355
2
    PyObject *Constant_annotations = PyDict_New();
3356
2
    if (!Constant_annotations) return 0;
3357
2
    {
3358
2
        PyObject *type = (PyObject *)&PyBaseObject_Type;
3359
2
        Py_INCREF(type);
3360
2
        cond = PyDict_SetItemString(Constant_annotations, "value", type) == 0;
3361
2
        Py_DECREF(type);
3362
2
        if (!cond) {
3363
0
            Py_DECREF(Constant_annotations);
3364
0
            return 0;
3365
0
        }
3366
2
    }
3367
2
    {
3368
2
        PyObject *type = (PyObject *)&PyUnicode_Type;
3369
2
        type = _Py_union_type_or(type, Py_None);
3370
2
        cond = type != NULL;
3371
2
        if (!cond) {
3372
0
            Py_DECREF(Constant_annotations);
3373
0
            return 0;
3374
0
        }
3375
2
        cond = PyDict_SetItemString(Constant_annotations, "kind", type) == 0;
3376
2
        Py_DECREF(type);
3377
2
        if (!cond) {
3378
0
            Py_DECREF(Constant_annotations);
3379
0
            return 0;
3380
0
        }
3381
2
    }
3382
2
    cond = PyObject_SetAttrString(state->Constant_type, "_field_types",
3383
2
                                  Constant_annotations) == 0;
3384
2
    if (!cond) {
3385
0
        Py_DECREF(Constant_annotations);
3386
0
        return 0;
3387
0
    }
3388
2
    cond = PyObject_SetAttrString(state->Constant_type, "__annotations__",
3389
2
                                  Constant_annotations) == 0;
3390
2
    if (!cond) {
3391
0
        Py_DECREF(Constant_annotations);
3392
0
        return 0;
3393
0
    }
3394
2
    Py_DECREF(Constant_annotations);
3395
2
    PyObject *Attribute_annotations = PyDict_New();
3396
2
    if (!Attribute_annotations) return 0;
3397
2
    {
3398
2
        PyObject *type = state->expr_type;
3399
2
        Py_INCREF(type);
3400
2
        cond = PyDict_SetItemString(Attribute_annotations, "value", type) == 0;
3401
2
        Py_DECREF(type);
3402
2
        if (!cond) {
3403
0
            Py_DECREF(Attribute_annotations);
3404
0
            return 0;
3405
0
        }
3406
2
    }
3407
2
    {
3408
2
        PyObject *type = (PyObject *)&PyUnicode_Type;
3409
2
        Py_INCREF(type);
3410
2
        cond = PyDict_SetItemString(Attribute_annotations, "attr", type) == 0;
3411
2
        Py_DECREF(type);
3412
2
        if (!cond) {
3413
0
            Py_DECREF(Attribute_annotations);
3414
0
            return 0;
3415
0
        }
3416
2
    }
3417
2
    {
3418
2
        PyObject *type = state->expr_context_type;
3419
2
        Py_INCREF(type);
3420
2
        cond = PyDict_SetItemString(Attribute_annotations, "ctx", type) == 0;
3421
2
        Py_DECREF(type);
3422
2
        if (!cond) {
3423
0
            Py_DECREF(Attribute_annotations);
3424
0
            return 0;
3425
0
        }
3426
2
    }
3427
2
    cond = PyObject_SetAttrString(state->Attribute_type, "_field_types",
3428
2
                                  Attribute_annotations) == 0;
3429
2
    if (!cond) {
3430
0
        Py_DECREF(Attribute_annotations);
3431
0
        return 0;
3432
0
    }
3433
2
    cond = PyObject_SetAttrString(state->Attribute_type, "__annotations__",
3434
2
                                  Attribute_annotations) == 0;
3435
2
    if (!cond) {
3436
0
        Py_DECREF(Attribute_annotations);
3437
0
        return 0;
3438
0
    }
3439
2
    Py_DECREF(Attribute_annotations);
3440
2
    PyObject *Subscript_annotations = PyDict_New();
3441
2
    if (!Subscript_annotations) return 0;
3442
2
    {
3443
2
        PyObject *type = state->expr_type;
3444
2
        Py_INCREF(type);
3445
2
        cond = PyDict_SetItemString(Subscript_annotations, "value", type) == 0;
3446
2
        Py_DECREF(type);
3447
2
        if (!cond) {
3448
0
            Py_DECREF(Subscript_annotations);
3449
0
            return 0;
3450
0
        }
3451
2
    }
3452
2
    {
3453
2
        PyObject *type = state->expr_type;
3454
2
        Py_INCREF(type);
3455
2
        cond = PyDict_SetItemString(Subscript_annotations, "slice", type) == 0;
3456
2
        Py_DECREF(type);
3457
2
        if (!cond) {
3458
0
            Py_DECREF(Subscript_annotations);
3459
0
            return 0;
3460
0
        }
3461
2
    }
3462
2
    {
3463
2
        PyObject *type = state->expr_context_type;
3464
2
        Py_INCREF(type);
3465
2
        cond = PyDict_SetItemString(Subscript_annotations, "ctx", type) == 0;
3466
2
        Py_DECREF(type);
3467
2
        if (!cond) {
3468
0
            Py_DECREF(Subscript_annotations);
3469
0
            return 0;
3470
0
        }
3471
2
    }
3472
2
    cond = PyObject_SetAttrString(state->Subscript_type, "_field_types",
3473
2
                                  Subscript_annotations) == 0;
3474
2
    if (!cond) {
3475
0
        Py_DECREF(Subscript_annotations);
3476
0
        return 0;
3477
0
    }
3478
2
    cond = PyObject_SetAttrString(state->Subscript_type, "__annotations__",
3479
2
                                  Subscript_annotations) == 0;
3480
2
    if (!cond) {
3481
0
        Py_DECREF(Subscript_annotations);
3482
0
        return 0;
3483
0
    }
3484
2
    Py_DECREF(Subscript_annotations);
3485
2
    PyObject *Starred_annotations = PyDict_New();
3486
2
    if (!Starred_annotations) return 0;
3487
2
    {
3488
2
        PyObject *type = state->expr_type;
3489
2
        Py_INCREF(type);
3490
2
        cond = PyDict_SetItemString(Starred_annotations, "value", type) == 0;
3491
2
        Py_DECREF(type);
3492
2
        if (!cond) {
3493
0
            Py_DECREF(Starred_annotations);
3494
0
            return 0;
3495
0
        }
3496
2
    }
3497
2
    {
3498
2
        PyObject *type = state->expr_context_type;
3499
2
        Py_INCREF(type);
3500
2
        cond = PyDict_SetItemString(Starred_annotations, "ctx", type) == 0;
3501
2
        Py_DECREF(type);
3502
2
        if (!cond) {
3503
0
            Py_DECREF(Starred_annotations);
3504
0
            return 0;
3505
0
        }
3506
2
    }
3507
2
    cond = PyObject_SetAttrString(state->Starred_type, "_field_types",
3508
2
                                  Starred_annotations) == 0;
3509
2
    if (!cond) {
3510
0
        Py_DECREF(Starred_annotations);
3511
0
        return 0;
3512
0
    }
3513
2
    cond = PyObject_SetAttrString(state->Starred_type, "__annotations__",
3514
2
                                  Starred_annotations) == 0;
3515
2
    if (!cond) {
3516
0
        Py_DECREF(Starred_annotations);
3517
0
        return 0;
3518
0
    }
3519
2
    Py_DECREF(Starred_annotations);
3520
2
    PyObject *Name_annotations = PyDict_New();
3521
2
    if (!Name_annotations) return 0;
3522
2
    {
3523
2
        PyObject *type = (PyObject *)&PyUnicode_Type;
3524
2
        Py_INCREF(type);
3525
2
        cond = PyDict_SetItemString(Name_annotations, "id", type) == 0;
3526
2
        Py_DECREF(type);
3527
2
        if (!cond) {
3528
0
            Py_DECREF(Name_annotations);
3529
0
            return 0;
3530
0
        }
3531
2
    }
3532
2
    {
3533
2
        PyObject *type = state->expr_context_type;
3534
2
        Py_INCREF(type);
3535
2
        cond = PyDict_SetItemString(Name_annotations, "ctx", type) == 0;
3536
2
        Py_DECREF(type);
3537
2
        if (!cond) {
3538
0
            Py_DECREF(Name_annotations);
3539
0
            return 0;
3540
0
        }
3541
2
    }
3542
2
    cond = PyObject_SetAttrString(state->Name_type, "_field_types",
3543
2
                                  Name_annotations) == 0;
3544
2
    if (!cond) {
3545
0
        Py_DECREF(Name_annotations);
3546
0
        return 0;
3547
0
    }
3548
2
    cond = PyObject_SetAttrString(state->Name_type, "__annotations__",
3549
2
                                  Name_annotations) == 0;
3550
2
    if (!cond) {
3551
0
        Py_DECREF(Name_annotations);
3552
0
        return 0;
3553
0
    }
3554
2
    Py_DECREF(Name_annotations);
3555
2
    PyObject *List_annotations = PyDict_New();
3556
2
    if (!List_annotations) return 0;
3557
2
    {
3558
2
        PyObject *type = state->expr_type;
3559
2
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
3560
2
        cond = type != NULL;
3561
2
        if (!cond) {
3562
0
            Py_DECREF(List_annotations);
3563
0
            return 0;
3564
0
        }
3565
2
        cond = PyDict_SetItemString(List_annotations, "elts", type) == 0;
3566
2
        Py_DECREF(type);
3567
2
        if (!cond) {
3568
0
            Py_DECREF(List_annotations);
3569
0
            return 0;
3570
0
        }
3571
2
    }
3572
2
    {
3573
2
        PyObject *type = state->expr_context_type;
3574
2
        Py_INCREF(type);
3575
2
        cond = PyDict_SetItemString(List_annotations, "ctx", type) == 0;
3576
2
        Py_DECREF(type);
3577
2
        if (!cond) {
3578
0
            Py_DECREF(List_annotations);
3579
0
            return 0;
3580
0
        }
3581
2
    }
3582
2
    cond = PyObject_SetAttrString(state->List_type, "_field_types",
3583
2
                                  List_annotations) == 0;
3584
2
    if (!cond) {
3585
0
        Py_DECREF(List_annotations);
3586
0
        return 0;
3587
0
    }
3588
2
    cond = PyObject_SetAttrString(state->List_type, "__annotations__",
3589
2
                                  List_annotations) == 0;
3590
2
    if (!cond) {
3591
0
        Py_DECREF(List_annotations);
3592
0
        return 0;
3593
0
    }
3594
2
    Py_DECREF(List_annotations);
3595
2
    PyObject *Tuple_annotations = PyDict_New();
3596
2
    if (!Tuple_annotations) return 0;
3597
2
    {
3598
2
        PyObject *type = state->expr_type;
3599
2
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
3600
2
        cond = type != NULL;
3601
2
        if (!cond) {
3602
0
            Py_DECREF(Tuple_annotations);
3603
0
            return 0;
3604
0
        }
3605
2
        cond = PyDict_SetItemString(Tuple_annotations, "elts", type) == 0;
3606
2
        Py_DECREF(type);
3607
2
        if (!cond) {
3608
0
            Py_DECREF(Tuple_annotations);
3609
0
            return 0;
3610
0
        }
3611
2
    }
3612
2
    {
3613
2
        PyObject *type = state->expr_context_type;
3614
2
        Py_INCREF(type);
3615
2
        cond = PyDict_SetItemString(Tuple_annotations, "ctx", type) == 0;
3616
2
        Py_DECREF(type);
3617
2
        if (!cond) {
3618
0
            Py_DECREF(Tuple_annotations);
3619
0
            return 0;
3620
0
        }
3621
2
    }
3622
2
    cond = PyObject_SetAttrString(state->Tuple_type, "_field_types",
3623
2
                                  Tuple_annotations) == 0;
3624
2
    if (!cond) {
3625
0
        Py_DECREF(Tuple_annotations);
3626
0
        return 0;
3627
0
    }
3628
2
    cond = PyObject_SetAttrString(state->Tuple_type, "__annotations__",
3629
2
                                  Tuple_annotations) == 0;
3630
2
    if (!cond) {
3631
0
        Py_DECREF(Tuple_annotations);
3632
0
        return 0;
3633
0
    }
3634
2
    Py_DECREF(Tuple_annotations);
3635
2
    PyObject *Slice_annotations = PyDict_New();
3636
2
    if (!Slice_annotations) return 0;
3637
2
    {
3638
2
        PyObject *type = state->expr_type;
3639
2
        type = _Py_union_type_or(type, Py_None);
3640
2
        cond = type != NULL;
3641
2
        if (!cond) {
3642
0
            Py_DECREF(Slice_annotations);
3643
0
            return 0;
3644
0
        }
3645
2
        cond = PyDict_SetItemString(Slice_annotations, "lower", type) == 0;
3646
2
        Py_DECREF(type);
3647
2
        if (!cond) {
3648
0
            Py_DECREF(Slice_annotations);
3649
0
            return 0;
3650
0
        }
3651
2
    }
3652
2
    {
3653
2
        PyObject *type = state->expr_type;
3654
2
        type = _Py_union_type_or(type, Py_None);
3655
2
        cond = type != NULL;
3656
2
        if (!cond) {
3657
0
            Py_DECREF(Slice_annotations);
3658
0
            return 0;
3659
0
        }
3660
2
        cond = PyDict_SetItemString(Slice_annotations, "upper", type) == 0;
3661
2
        Py_DECREF(type);
3662
2
        if (!cond) {
3663
0
            Py_DECREF(Slice_annotations);
3664
0
            return 0;
3665
0
        }
3666
2
    }
3667
2
    {
3668
2
        PyObject *type = state->expr_type;
3669
2
        type = _Py_union_type_or(type, Py_None);
3670
2
        cond = type != NULL;
3671
2
        if (!cond) {
3672
0
            Py_DECREF(Slice_annotations);
3673
0
            return 0;
3674
0
        }
3675
2
        cond = PyDict_SetItemString(Slice_annotations, "step", type) == 0;
3676
2
        Py_DECREF(type);
3677
2
        if (!cond) {
3678
0
            Py_DECREF(Slice_annotations);
3679
0
            return 0;
3680
0
        }
3681
2
    }
3682
2
    cond = PyObject_SetAttrString(state->Slice_type, "_field_types",
3683
2
                                  Slice_annotations) == 0;
3684
2
    if (!cond) {
3685
0
        Py_DECREF(Slice_annotations);
3686
0
        return 0;
3687
0
    }
3688
2
    cond = PyObject_SetAttrString(state->Slice_type, "__annotations__",
3689
2
                                  Slice_annotations) == 0;
3690
2
    if (!cond) {
3691
0
        Py_DECREF(Slice_annotations);
3692
0
        return 0;
3693
0
    }
3694
2
    Py_DECREF(Slice_annotations);
3695
2
    PyObject *Load_annotations = PyDict_New();
3696
2
    if (!Load_annotations) return 0;
3697
2
    cond = PyObject_SetAttrString(state->Load_type, "_field_types",
3698
2
                                  Load_annotations) == 0;
3699
2
    if (!cond) {
3700
0
        Py_DECREF(Load_annotations);
3701
0
        return 0;
3702
0
    }
3703
2
    cond = PyObject_SetAttrString(state->Load_type, "__annotations__",
3704
2
                                  Load_annotations) == 0;
3705
2
    if (!cond) {
3706
0
        Py_DECREF(Load_annotations);
3707
0
        return 0;
3708
0
    }
3709
2
    Py_DECREF(Load_annotations);
3710
2
    PyObject *Store_annotations = PyDict_New();
3711
2
    if (!Store_annotations) return 0;
3712
2
    cond = PyObject_SetAttrString(state->Store_type, "_field_types",
3713
2
                                  Store_annotations) == 0;
3714
2
    if (!cond) {
3715
0
        Py_DECREF(Store_annotations);
3716
0
        return 0;
3717
0
    }
3718
2
    cond = PyObject_SetAttrString(state->Store_type, "__annotations__",
3719
2
                                  Store_annotations) == 0;
3720
2
    if (!cond) {
3721
0
        Py_DECREF(Store_annotations);
3722
0
        return 0;
3723
0
    }
3724
2
    Py_DECREF(Store_annotations);
3725
2
    PyObject *Del_annotations = PyDict_New();
3726
2
    if (!Del_annotations) return 0;
3727
2
    cond = PyObject_SetAttrString(state->Del_type, "_field_types",
3728
2
                                  Del_annotations) == 0;
3729
2
    if (!cond) {
3730
0
        Py_DECREF(Del_annotations);
3731
0
        return 0;
3732
0
    }
3733
2
    cond = PyObject_SetAttrString(state->Del_type, "__annotations__",
3734
2
                                  Del_annotations) == 0;
3735
2
    if (!cond) {
3736
0
        Py_DECREF(Del_annotations);
3737
0
        return 0;
3738
0
    }
3739
2
    Py_DECREF(Del_annotations);
3740
2
    PyObject *And_annotations = PyDict_New();
3741
2
    if (!And_annotations) return 0;
3742
2
    cond = PyObject_SetAttrString(state->And_type, "_field_types",
3743
2
                                  And_annotations) == 0;
3744
2
    if (!cond) {
3745
0
        Py_DECREF(And_annotations);
3746
0
        return 0;
3747
0
    }
3748
2
    cond = PyObject_SetAttrString(state->And_type, "__annotations__",
3749
2
                                  And_annotations) == 0;
3750
2
    if (!cond) {
3751
0
        Py_DECREF(And_annotations);
3752
0
        return 0;
3753
0
    }
3754
2
    Py_DECREF(And_annotations);
3755
2
    PyObject *Or_annotations = PyDict_New();
3756
2
    if (!Or_annotations) return 0;
3757
2
    cond = PyObject_SetAttrString(state->Or_type, "_field_types",
3758
2
                                  Or_annotations) == 0;
3759
2
    if (!cond) {
3760
0
        Py_DECREF(Or_annotations);
3761
0
        return 0;
3762
0
    }
3763
2
    cond = PyObject_SetAttrString(state->Or_type, "__annotations__",
3764
2
                                  Or_annotations) == 0;
3765
2
    if (!cond) {
3766
0
        Py_DECREF(Or_annotations);
3767
0
        return 0;
3768
0
    }
3769
2
    Py_DECREF(Or_annotations);
3770
2
    PyObject *Add_annotations = PyDict_New();
3771
2
    if (!Add_annotations) return 0;
3772
2
    cond = PyObject_SetAttrString(state->Add_type, "_field_types",
3773
2
                                  Add_annotations) == 0;
3774
2
    if (!cond) {
3775
0
        Py_DECREF(Add_annotations);
3776
0
        return 0;
3777
0
    }
3778
2
    cond = PyObject_SetAttrString(state->Add_type, "__annotations__",
3779
2
                                  Add_annotations) == 0;
3780
2
    if (!cond) {
3781
0
        Py_DECREF(Add_annotations);
3782
0
        return 0;
3783
0
    }
3784
2
    Py_DECREF(Add_annotations);
3785
2
    PyObject *Sub_annotations = PyDict_New();
3786
2
    if (!Sub_annotations) return 0;
3787
2
    cond = PyObject_SetAttrString(state->Sub_type, "_field_types",
3788
2
                                  Sub_annotations) == 0;
3789
2
    if (!cond) {
3790
0
        Py_DECREF(Sub_annotations);
3791
0
        return 0;
3792
0
    }
3793
2
    cond = PyObject_SetAttrString(state->Sub_type, "__annotations__",
3794
2
                                  Sub_annotations) == 0;
3795
2
    if (!cond) {
3796
0
        Py_DECREF(Sub_annotations);
3797
0
        return 0;
3798
0
    }
3799
2
    Py_DECREF(Sub_annotations);
3800
2
    PyObject *Mult_annotations = PyDict_New();
3801
2
    if (!Mult_annotations) return 0;
3802
2
    cond = PyObject_SetAttrString(state->Mult_type, "_field_types",
3803
2
                                  Mult_annotations) == 0;
3804
2
    if (!cond) {
3805
0
        Py_DECREF(Mult_annotations);
3806
0
        return 0;
3807
0
    }
3808
2
    cond = PyObject_SetAttrString(state->Mult_type, "__annotations__",
3809
2
                                  Mult_annotations) == 0;
3810
2
    if (!cond) {
3811
0
        Py_DECREF(Mult_annotations);
3812
0
        return 0;
3813
0
    }
3814
2
    Py_DECREF(Mult_annotations);
3815
2
    PyObject *MatMult_annotations = PyDict_New();
3816
2
    if (!MatMult_annotations) return 0;
3817
2
    cond = PyObject_SetAttrString(state->MatMult_type, "_field_types",
3818
2
                                  MatMult_annotations) == 0;
3819
2
    if (!cond) {
3820
0
        Py_DECREF(MatMult_annotations);
3821
0
        return 0;
3822
0
    }
3823
2
    cond = PyObject_SetAttrString(state->MatMult_type, "__annotations__",
3824
2
                                  MatMult_annotations) == 0;
3825
2
    if (!cond) {
3826
0
        Py_DECREF(MatMult_annotations);
3827
0
        return 0;
3828
0
    }
3829
2
    Py_DECREF(MatMult_annotations);
3830
2
    PyObject *Div_annotations = PyDict_New();
3831
2
    if (!Div_annotations) return 0;
3832
2
    cond = PyObject_SetAttrString(state->Div_type, "_field_types",
3833
2
                                  Div_annotations) == 0;
3834
2
    if (!cond) {
3835
0
        Py_DECREF(Div_annotations);
3836
0
        return 0;
3837
0
    }
3838
2
    cond = PyObject_SetAttrString(state->Div_type, "__annotations__",
3839
2
                                  Div_annotations) == 0;
3840
2
    if (!cond) {
3841
0
        Py_DECREF(Div_annotations);
3842
0
        return 0;
3843
0
    }
3844
2
    Py_DECREF(Div_annotations);
3845
2
    PyObject *Mod_annotations = PyDict_New();
3846
2
    if (!Mod_annotations) return 0;
3847
2
    cond = PyObject_SetAttrString(state->Mod_type, "_field_types",
3848
2
                                  Mod_annotations) == 0;
3849
2
    if (!cond) {
3850
0
        Py_DECREF(Mod_annotations);
3851
0
        return 0;
3852
0
    }
3853
2
    cond = PyObject_SetAttrString(state->Mod_type, "__annotations__",
3854
2
                                  Mod_annotations) == 0;
3855
2
    if (!cond) {
3856
0
        Py_DECREF(Mod_annotations);
3857
0
        return 0;
3858
0
    }
3859
2
    Py_DECREF(Mod_annotations);
3860
2
    PyObject *Pow_annotations = PyDict_New();
3861
2
    if (!Pow_annotations) return 0;
3862
2
    cond = PyObject_SetAttrString(state->Pow_type, "_field_types",
3863
2
                                  Pow_annotations) == 0;
3864
2
    if (!cond) {
3865
0
        Py_DECREF(Pow_annotations);
3866
0
        return 0;
3867
0
    }
3868
2
    cond = PyObject_SetAttrString(state->Pow_type, "__annotations__",
3869
2
                                  Pow_annotations) == 0;
3870
2
    if (!cond) {
3871
0
        Py_DECREF(Pow_annotations);
3872
0
        return 0;
3873
0
    }
3874
2
    Py_DECREF(Pow_annotations);
3875
2
    PyObject *LShift_annotations = PyDict_New();
3876
2
    if (!LShift_annotations) return 0;
3877
2
    cond = PyObject_SetAttrString(state->LShift_type, "_field_types",
3878
2
                                  LShift_annotations) == 0;
3879
2
    if (!cond) {
3880
0
        Py_DECREF(LShift_annotations);
3881
0
        return 0;
3882
0
    }
3883
2
    cond = PyObject_SetAttrString(state->LShift_type, "__annotations__",
3884
2
                                  LShift_annotations) == 0;
3885
2
    if (!cond) {
3886
0
        Py_DECREF(LShift_annotations);
3887
0
        return 0;
3888
0
    }
3889
2
    Py_DECREF(LShift_annotations);
3890
2
    PyObject *RShift_annotations = PyDict_New();
3891
2
    if (!RShift_annotations) return 0;
3892
2
    cond = PyObject_SetAttrString(state->RShift_type, "_field_types",
3893
2
                                  RShift_annotations) == 0;
3894
2
    if (!cond) {
3895
0
        Py_DECREF(RShift_annotations);
3896
0
        return 0;
3897
0
    }
3898
2
    cond = PyObject_SetAttrString(state->RShift_type, "__annotations__",
3899
2
                                  RShift_annotations) == 0;
3900
2
    if (!cond) {
3901
0
        Py_DECREF(RShift_annotations);
3902
0
        return 0;
3903
0
    }
3904
2
    Py_DECREF(RShift_annotations);
3905
2
    PyObject *BitOr_annotations = PyDict_New();
3906
2
    if (!BitOr_annotations) return 0;
3907
2
    cond = PyObject_SetAttrString(state->BitOr_type, "_field_types",
3908
2
                                  BitOr_annotations) == 0;
3909
2
    if (!cond) {
3910
0
        Py_DECREF(BitOr_annotations);
3911
0
        return 0;
3912
0
    }
3913
2
    cond = PyObject_SetAttrString(state->BitOr_type, "__annotations__",
3914
2
                                  BitOr_annotations) == 0;
3915
2
    if (!cond) {
3916
0
        Py_DECREF(BitOr_annotations);
3917
0
        return 0;
3918
0
    }
3919
2
    Py_DECREF(BitOr_annotations);
3920
2
    PyObject *BitXor_annotations = PyDict_New();
3921
2
    if (!BitXor_annotations) return 0;
3922
2
    cond = PyObject_SetAttrString(state->BitXor_type, "_field_types",
3923
2
                                  BitXor_annotations) == 0;
3924
2
    if (!cond) {
3925
0
        Py_DECREF(BitXor_annotations);
3926
0
        return 0;
3927
0
    }
3928
2
    cond = PyObject_SetAttrString(state->BitXor_type, "__annotations__",
3929
2
                                  BitXor_annotations) == 0;
3930
2
    if (!cond) {
3931
0
        Py_DECREF(BitXor_annotations);
3932
0
        return 0;
3933
0
    }
3934
2
    Py_DECREF(BitXor_annotations);
3935
2
    PyObject *BitAnd_annotations = PyDict_New();
3936
2
    if (!BitAnd_annotations) return 0;
3937
2
    cond = PyObject_SetAttrString(state->BitAnd_type, "_field_types",
3938
2
                                  BitAnd_annotations) == 0;
3939
2
    if (!cond) {
3940
0
        Py_DECREF(BitAnd_annotations);
3941
0
        return 0;
3942
0
    }
3943
2
    cond = PyObject_SetAttrString(state->BitAnd_type, "__annotations__",
3944
2
                                  BitAnd_annotations) == 0;
3945
2
    if (!cond) {
3946
0
        Py_DECREF(BitAnd_annotations);
3947
0
        return 0;
3948
0
    }
3949
2
    Py_DECREF(BitAnd_annotations);
3950
2
    PyObject *FloorDiv_annotations = PyDict_New();
3951
2
    if (!FloorDiv_annotations) return 0;
3952
2
    cond = PyObject_SetAttrString(state->FloorDiv_type, "_field_types",
3953
2
                                  FloorDiv_annotations) == 0;
3954
2
    if (!cond) {
3955
0
        Py_DECREF(FloorDiv_annotations);
3956
0
        return 0;
3957
0
    }
3958
2
    cond = PyObject_SetAttrString(state->FloorDiv_type, "__annotations__",
3959
2
                                  FloorDiv_annotations) == 0;
3960
2
    if (!cond) {
3961
0
        Py_DECREF(FloorDiv_annotations);
3962
0
        return 0;
3963
0
    }
3964
2
    Py_DECREF(FloorDiv_annotations);
3965
2
    PyObject *Invert_annotations = PyDict_New();
3966
2
    if (!Invert_annotations) return 0;
3967
2
    cond = PyObject_SetAttrString(state->Invert_type, "_field_types",
3968
2
                                  Invert_annotations) == 0;
3969
2
    if (!cond) {
3970
0
        Py_DECREF(Invert_annotations);
3971
0
        return 0;
3972
0
    }
3973
2
    cond = PyObject_SetAttrString(state->Invert_type, "__annotations__",
3974
2
                                  Invert_annotations) == 0;
3975
2
    if (!cond) {
3976
0
        Py_DECREF(Invert_annotations);
3977
0
        return 0;
3978
0
    }
3979
2
    Py_DECREF(Invert_annotations);
3980
2
    PyObject *Not_annotations = PyDict_New();
3981
2
    if (!Not_annotations) return 0;
3982
2
    cond = PyObject_SetAttrString(state->Not_type, "_field_types",
3983
2
                                  Not_annotations) == 0;
3984
2
    if (!cond) {
3985
0
        Py_DECREF(Not_annotations);
3986
0
        return 0;
3987
0
    }
3988
2
    cond = PyObject_SetAttrString(state->Not_type, "__annotations__",
3989
2
                                  Not_annotations) == 0;
3990
2
    if (!cond) {
3991
0
        Py_DECREF(Not_annotations);
3992
0
        return 0;
3993
0
    }
3994
2
    Py_DECREF(Not_annotations);
3995
2
    PyObject *UAdd_annotations = PyDict_New();
3996
2
    if (!UAdd_annotations) return 0;
3997
2
    cond = PyObject_SetAttrString(state->UAdd_type, "_field_types",
3998
2
                                  UAdd_annotations) == 0;
3999
2
    if (!cond) {
4000
0
        Py_DECREF(UAdd_annotations);
4001
0
        return 0;
4002
0
    }
4003
2
    cond = PyObject_SetAttrString(state->UAdd_type, "__annotations__",
4004
2
                                  UAdd_annotations) == 0;
4005
2
    if (!cond) {
4006
0
        Py_DECREF(UAdd_annotations);
4007
0
        return 0;
4008
0
    }
4009
2
    Py_DECREF(UAdd_annotations);
4010
2
    PyObject *USub_annotations = PyDict_New();
4011
2
    if (!USub_annotations) return 0;
4012
2
    cond = PyObject_SetAttrString(state->USub_type, "_field_types",
4013
2
                                  USub_annotations) == 0;
4014
2
    if (!cond) {
4015
0
        Py_DECREF(USub_annotations);
4016
0
        return 0;
4017
0
    }
4018
2
    cond = PyObject_SetAttrString(state->USub_type, "__annotations__",
4019
2
                                  USub_annotations) == 0;
4020
2
    if (!cond) {
4021
0
        Py_DECREF(USub_annotations);
4022
0
        return 0;
4023
0
    }
4024
2
    Py_DECREF(USub_annotations);
4025
2
    PyObject *Eq_annotations = PyDict_New();
4026
2
    if (!Eq_annotations) return 0;
4027
2
    cond = PyObject_SetAttrString(state->Eq_type, "_field_types",
4028
2
                                  Eq_annotations) == 0;
4029
2
    if (!cond) {
4030
0
        Py_DECREF(Eq_annotations);
4031
0
        return 0;
4032
0
    }
4033
2
    cond = PyObject_SetAttrString(state->Eq_type, "__annotations__",
4034
2
                                  Eq_annotations) == 0;
4035
2
    if (!cond) {
4036
0
        Py_DECREF(Eq_annotations);
4037
0
        return 0;
4038
0
    }
4039
2
    Py_DECREF(Eq_annotations);
4040
2
    PyObject *NotEq_annotations = PyDict_New();
4041
2
    if (!NotEq_annotations) return 0;
4042
2
    cond = PyObject_SetAttrString(state->NotEq_type, "_field_types",
4043
2
                                  NotEq_annotations) == 0;
4044
2
    if (!cond) {
4045
0
        Py_DECREF(NotEq_annotations);
4046
0
        return 0;
4047
0
    }
4048
2
    cond = PyObject_SetAttrString(state->NotEq_type, "__annotations__",
4049
2
                                  NotEq_annotations) == 0;
4050
2
    if (!cond) {
4051
0
        Py_DECREF(NotEq_annotations);
4052
0
        return 0;
4053
0
    }
4054
2
    Py_DECREF(NotEq_annotations);
4055
2
    PyObject *Lt_annotations = PyDict_New();
4056
2
    if (!Lt_annotations) return 0;
4057
2
    cond = PyObject_SetAttrString(state->Lt_type, "_field_types",
4058
2
                                  Lt_annotations) == 0;
4059
2
    if (!cond) {
4060
0
        Py_DECREF(Lt_annotations);
4061
0
        return 0;
4062
0
    }
4063
2
    cond = PyObject_SetAttrString(state->Lt_type, "__annotations__",
4064
2
                                  Lt_annotations) == 0;
4065
2
    if (!cond) {
4066
0
        Py_DECREF(Lt_annotations);
4067
0
        return 0;
4068
0
    }
4069
2
    Py_DECREF(Lt_annotations);
4070
2
    PyObject *LtE_annotations = PyDict_New();
4071
2
    if (!LtE_annotations) return 0;
4072
2
    cond = PyObject_SetAttrString(state->LtE_type, "_field_types",
4073
2
                                  LtE_annotations) == 0;
4074
2
    if (!cond) {
4075
0
        Py_DECREF(LtE_annotations);
4076
0
        return 0;
4077
0
    }
4078
2
    cond = PyObject_SetAttrString(state->LtE_type, "__annotations__",
4079
2
                                  LtE_annotations) == 0;
4080
2
    if (!cond) {
4081
0
        Py_DECREF(LtE_annotations);
4082
0
        return 0;
4083
0
    }
4084
2
    Py_DECREF(LtE_annotations);
4085
2
    PyObject *Gt_annotations = PyDict_New();
4086
2
    if (!Gt_annotations) return 0;
4087
2
    cond = PyObject_SetAttrString(state->Gt_type, "_field_types",
4088
2
                                  Gt_annotations) == 0;
4089
2
    if (!cond) {
4090
0
        Py_DECREF(Gt_annotations);
4091
0
        return 0;
4092
0
    }
4093
2
    cond = PyObject_SetAttrString(state->Gt_type, "__annotations__",
4094
2
                                  Gt_annotations) == 0;
4095
2
    if (!cond) {
4096
0
        Py_DECREF(Gt_annotations);
4097
0
        return 0;
4098
0
    }
4099
2
    Py_DECREF(Gt_annotations);
4100
2
    PyObject *GtE_annotations = PyDict_New();
4101
2
    if (!GtE_annotations) return 0;
4102
2
    cond = PyObject_SetAttrString(state->GtE_type, "_field_types",
4103
2
                                  GtE_annotations) == 0;
4104
2
    if (!cond) {
4105
0
        Py_DECREF(GtE_annotations);
4106
0
        return 0;
4107
0
    }
4108
2
    cond = PyObject_SetAttrString(state->GtE_type, "__annotations__",
4109
2
                                  GtE_annotations) == 0;
4110
2
    if (!cond) {
4111
0
        Py_DECREF(GtE_annotations);
4112
0
        return 0;
4113
0
    }
4114
2
    Py_DECREF(GtE_annotations);
4115
2
    PyObject *Is_annotations = PyDict_New();
4116
2
    if (!Is_annotations) return 0;
4117
2
    cond = PyObject_SetAttrString(state->Is_type, "_field_types",
4118
2
                                  Is_annotations) == 0;
4119
2
    if (!cond) {
4120
0
        Py_DECREF(Is_annotations);
4121
0
        return 0;
4122
0
    }
4123
2
    cond = PyObject_SetAttrString(state->Is_type, "__annotations__",
4124
2
                                  Is_annotations) == 0;
4125
2
    if (!cond) {
4126
0
        Py_DECREF(Is_annotations);
4127
0
        return 0;
4128
0
    }
4129
2
    Py_DECREF(Is_annotations);
4130
2
    PyObject *IsNot_annotations = PyDict_New();
4131
2
    if (!IsNot_annotations) return 0;
4132
2
    cond = PyObject_SetAttrString(state->IsNot_type, "_field_types",
4133
2
                                  IsNot_annotations) == 0;
4134
2
    if (!cond) {
4135
0
        Py_DECREF(IsNot_annotations);
4136
0
        return 0;
4137
0
    }
4138
2
    cond = PyObject_SetAttrString(state->IsNot_type, "__annotations__",
4139
2
                                  IsNot_annotations) == 0;
4140
2
    if (!cond) {
4141
0
        Py_DECREF(IsNot_annotations);
4142
0
        return 0;
4143
0
    }
4144
2
    Py_DECREF(IsNot_annotations);
4145
2
    PyObject *In_annotations = PyDict_New();
4146
2
    if (!In_annotations) return 0;
4147
2
    cond = PyObject_SetAttrString(state->In_type, "_field_types",
4148
2
                                  In_annotations) == 0;
4149
2
    if (!cond) {
4150
0
        Py_DECREF(In_annotations);
4151
0
        return 0;
4152
0
    }
4153
2
    cond = PyObject_SetAttrString(state->In_type, "__annotations__",
4154
2
                                  In_annotations) == 0;
4155
2
    if (!cond) {
4156
0
        Py_DECREF(In_annotations);
4157
0
        return 0;
4158
0
    }
4159
2
    Py_DECREF(In_annotations);
4160
2
    PyObject *NotIn_annotations = PyDict_New();
4161
2
    if (!NotIn_annotations) return 0;
4162
2
    cond = PyObject_SetAttrString(state->NotIn_type, "_field_types",
4163
2
                                  NotIn_annotations) == 0;
4164
2
    if (!cond) {
4165
0
        Py_DECREF(NotIn_annotations);
4166
0
        return 0;
4167
0
    }
4168
2
    cond = PyObject_SetAttrString(state->NotIn_type, "__annotations__",
4169
2
                                  NotIn_annotations) == 0;
4170
2
    if (!cond) {
4171
0
        Py_DECREF(NotIn_annotations);
4172
0
        return 0;
4173
0
    }
4174
2
    Py_DECREF(NotIn_annotations);
4175
2
    PyObject *comprehension_annotations = PyDict_New();
4176
2
    if (!comprehension_annotations) return 0;
4177
2
    {
4178
2
        PyObject *type = state->expr_type;
4179
2
        Py_INCREF(type);
4180
2
        cond = PyDict_SetItemString(comprehension_annotations, "target", type)
4181
2
                                    == 0;
4182
2
        Py_DECREF(type);
4183
2
        if (!cond) {
4184
0
            Py_DECREF(comprehension_annotations);
4185
0
            return 0;
4186
0
        }
4187
2
    }
4188
2
    {
4189
2
        PyObject *type = state->expr_type;
4190
2
        Py_INCREF(type);
4191
2
        cond = PyDict_SetItemString(comprehension_annotations, "iter", type) ==
4192
2
                                    0;
4193
2
        Py_DECREF(type);
4194
2
        if (!cond) {
4195
0
            Py_DECREF(comprehension_annotations);
4196
0
            return 0;
4197
0
        }
4198
2
    }
4199
2
    {
4200
2
        PyObject *type = state->expr_type;
4201
2
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
4202
2
        cond = type != NULL;
4203
2
        if (!cond) {
4204
0
            Py_DECREF(comprehension_annotations);
4205
0
            return 0;
4206
0
        }
4207
2
        cond = PyDict_SetItemString(comprehension_annotations, "ifs", type) ==
4208
2
                                    0;
4209
2
        Py_DECREF(type);
4210
2
        if (!cond) {
4211
0
            Py_DECREF(comprehension_annotations);
4212
0
            return 0;
4213
0
        }
4214
2
    }
4215
2
    {
4216
2
        PyObject *type = (PyObject *)&PyLong_Type;
4217
2
        Py_INCREF(type);
4218
2
        cond = PyDict_SetItemString(comprehension_annotations, "is_async",
4219
2
                                    type) == 0;
4220
2
        Py_DECREF(type);
4221
2
        if (!cond) {
4222
0
            Py_DECREF(comprehension_annotations);
4223
0
            return 0;
4224
0
        }
4225
2
    }
4226
2
    cond = PyObject_SetAttrString(state->comprehension_type, "_field_types",
4227
2
                                  comprehension_annotations) == 0;
4228
2
    if (!cond) {
4229
0
        Py_DECREF(comprehension_annotations);
4230
0
        return 0;
4231
0
    }
4232
2
    cond = PyObject_SetAttrString(state->comprehension_type, "__annotations__",
4233
2
                                  comprehension_annotations) == 0;
4234
2
    if (!cond) {
4235
0
        Py_DECREF(comprehension_annotations);
4236
0
        return 0;
4237
0
    }
4238
2
    Py_DECREF(comprehension_annotations);
4239
2
    PyObject *ExceptHandler_annotations = PyDict_New();
4240
2
    if (!ExceptHandler_annotations) return 0;
4241
2
    {
4242
2
        PyObject *type = state->expr_type;
4243
2
        type = _Py_union_type_or(type, Py_None);
4244
2
        cond = type != NULL;
4245
2
        if (!cond) {
4246
0
            Py_DECREF(ExceptHandler_annotations);
4247
0
            return 0;
4248
0
        }
4249
2
        cond = PyDict_SetItemString(ExceptHandler_annotations, "type", type) ==
4250
2
                                    0;
4251
2
        Py_DECREF(type);
4252
2
        if (!cond) {
4253
0
            Py_DECREF(ExceptHandler_annotations);
4254
0
            return 0;
4255
0
        }
4256
2
    }
4257
2
    {
4258
2
        PyObject *type = (PyObject *)&PyUnicode_Type;
4259
2
        type = _Py_union_type_or(type, Py_None);
4260
2
        cond = type != NULL;
4261
2
        if (!cond) {
4262
0
            Py_DECREF(ExceptHandler_annotations);
4263
0
            return 0;
4264
0
        }
4265
2
        cond = PyDict_SetItemString(ExceptHandler_annotations, "name", type) ==
4266
2
                                    0;
4267
2
        Py_DECREF(type);
4268
2
        if (!cond) {
4269
0
            Py_DECREF(ExceptHandler_annotations);
4270
0
            return 0;
4271
0
        }
4272
2
    }
4273
2
    {
4274
2
        PyObject *type = state->stmt_type;
4275
2
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
4276
2
        cond = type != NULL;
4277
2
        if (!cond) {
4278
0
            Py_DECREF(ExceptHandler_annotations);
4279
0
            return 0;
4280
0
        }
4281
2
        cond = PyDict_SetItemString(ExceptHandler_annotations, "body", type) ==
4282
2
                                    0;
4283
2
        Py_DECREF(type);
4284
2
        if (!cond) {
4285
0
            Py_DECREF(ExceptHandler_annotations);
4286
0
            return 0;
4287
0
        }
4288
2
    }
4289
2
    cond = PyObject_SetAttrString(state->ExceptHandler_type, "_field_types",
4290
2
                                  ExceptHandler_annotations) == 0;
4291
2
    if (!cond) {
4292
0
        Py_DECREF(ExceptHandler_annotations);
4293
0
        return 0;
4294
0
    }
4295
2
    cond = PyObject_SetAttrString(state->ExceptHandler_type, "__annotations__",
4296
2
                                  ExceptHandler_annotations) == 0;
4297
2
    if (!cond) {
4298
0
        Py_DECREF(ExceptHandler_annotations);
4299
0
        return 0;
4300
0
    }
4301
2
    Py_DECREF(ExceptHandler_annotations);
4302
2
    PyObject *arguments_annotations = PyDict_New();
4303
2
    if (!arguments_annotations) return 0;
4304
2
    {
4305
2
        PyObject *type = state->arg_type;
4306
2
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
4307
2
        cond = type != NULL;
4308
2
        if (!cond) {
4309
0
            Py_DECREF(arguments_annotations);
4310
0
            return 0;
4311
0
        }
4312
2
        cond = PyDict_SetItemString(arguments_annotations, "posonlyargs", type)
4313
2
                                    == 0;
4314
2
        Py_DECREF(type);
4315
2
        if (!cond) {
4316
0
            Py_DECREF(arguments_annotations);
4317
0
            return 0;
4318
0
        }
4319
2
    }
4320
2
    {
4321
2
        PyObject *type = state->arg_type;
4322
2
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
4323
2
        cond = type != NULL;
4324
2
        if (!cond) {
4325
0
            Py_DECREF(arguments_annotations);
4326
0
            return 0;
4327
0
        }
4328
2
        cond = PyDict_SetItemString(arguments_annotations, "args", type) == 0;
4329
2
        Py_DECREF(type);
4330
2
        if (!cond) {
4331
0
            Py_DECREF(arguments_annotations);
4332
0
            return 0;
4333
0
        }
4334
2
    }
4335
2
    {
4336
2
        PyObject *type = state->arg_type;
4337
2
        type = _Py_union_type_or(type, Py_None);
4338
2
        cond = type != NULL;
4339
2
        if (!cond) {
4340
0
            Py_DECREF(arguments_annotations);
4341
0
            return 0;
4342
0
        }
4343
2
        cond = PyDict_SetItemString(arguments_annotations, "vararg", type) == 0;
4344
2
        Py_DECREF(type);
4345
2
        if (!cond) {
4346
0
            Py_DECREF(arguments_annotations);
4347
0
            return 0;
4348
0
        }
4349
2
    }
4350
2
    {
4351
2
        PyObject *type = state->arg_type;
4352
2
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
4353
2
        cond = type != NULL;
4354
2
        if (!cond) {
4355
0
            Py_DECREF(arguments_annotations);
4356
0
            return 0;
4357
0
        }
4358
2
        cond = PyDict_SetItemString(arguments_annotations, "kwonlyargs", type)
4359
2
                                    == 0;
4360
2
        Py_DECREF(type);
4361
2
        if (!cond) {
4362
0
            Py_DECREF(arguments_annotations);
4363
0
            return 0;
4364
0
        }
4365
2
    }
4366
2
    {
4367
2
        PyObject *type = state->expr_type;
4368
2
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
4369
2
        cond = type != NULL;
4370
2
        if (!cond) {
4371
0
            Py_DECREF(arguments_annotations);
4372
0
            return 0;
4373
0
        }
4374
2
        cond = PyDict_SetItemString(arguments_annotations, "kw_defaults", type)
4375
2
                                    == 0;
4376
2
        Py_DECREF(type);
4377
2
        if (!cond) {
4378
0
            Py_DECREF(arguments_annotations);
4379
0
            return 0;
4380
0
        }
4381
2
    }
4382
2
    {
4383
2
        PyObject *type = state->arg_type;
4384
2
        type = _Py_union_type_or(type, Py_None);
4385
2
        cond = type != NULL;
4386
2
        if (!cond) {
4387
0
            Py_DECREF(arguments_annotations);
4388
0
            return 0;
4389
0
        }
4390
2
        cond = PyDict_SetItemString(arguments_annotations, "kwarg", type) == 0;
4391
2
        Py_DECREF(type);
4392
2
        if (!cond) {
4393
0
            Py_DECREF(arguments_annotations);
4394
0
            return 0;
4395
0
        }
4396
2
    }
4397
2
    {
4398
2
        PyObject *type = state->expr_type;
4399
2
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
4400
2
        cond = type != NULL;
4401
2
        if (!cond) {
4402
0
            Py_DECREF(arguments_annotations);
4403
0
            return 0;
4404
0
        }
4405
2
        cond = PyDict_SetItemString(arguments_annotations, "defaults", type) ==
4406
2
                                    0;
4407
2
        Py_DECREF(type);
4408
2
        if (!cond) {
4409
0
            Py_DECREF(arguments_annotations);
4410
0
            return 0;
4411
0
        }
4412
2
    }
4413
2
    cond = PyObject_SetAttrString(state->arguments_type, "_field_types",
4414
2
                                  arguments_annotations) == 0;
4415
2
    if (!cond) {
4416
0
        Py_DECREF(arguments_annotations);
4417
0
        return 0;
4418
0
    }
4419
2
    cond = PyObject_SetAttrString(state->arguments_type, "__annotations__",
4420
2
                                  arguments_annotations) == 0;
4421
2
    if (!cond) {
4422
0
        Py_DECREF(arguments_annotations);
4423
0
        return 0;
4424
0
    }
4425
2
    Py_DECREF(arguments_annotations);
4426
2
    PyObject *arg_annotations = PyDict_New();
4427
2
    if (!arg_annotations) return 0;
4428
2
    {
4429
2
        PyObject *type = (PyObject *)&PyUnicode_Type;
4430
2
        Py_INCREF(type);
4431
2
        cond = PyDict_SetItemString(arg_annotations, "arg", type) == 0;
4432
2
        Py_DECREF(type);
4433
2
        if (!cond) {
4434
0
            Py_DECREF(arg_annotations);
4435
0
            return 0;
4436
0
        }
4437
2
    }
4438
2
    {
4439
2
        PyObject *type = state->expr_type;
4440
2
        type = _Py_union_type_or(type, Py_None);
4441
2
        cond = type != NULL;
4442
2
        if (!cond) {
4443
0
            Py_DECREF(arg_annotations);
4444
0
            return 0;
4445
0
        }
4446
2
        cond = PyDict_SetItemString(arg_annotations, "annotation", type) == 0;
4447
2
        Py_DECREF(type);
4448
2
        if (!cond) {
4449
0
            Py_DECREF(arg_annotations);
4450
0
            return 0;
4451
0
        }
4452
2
    }
4453
2
    {
4454
2
        PyObject *type = (PyObject *)&PyUnicode_Type;
4455
2
        type = _Py_union_type_or(type, Py_None);
4456
2
        cond = type != NULL;
4457
2
        if (!cond) {
4458
0
            Py_DECREF(arg_annotations);
4459
0
            return 0;
4460
0
        }
4461
2
        cond = PyDict_SetItemString(arg_annotations, "type_comment", type) == 0;
4462
2
        Py_DECREF(type);
4463
2
        if (!cond) {
4464
0
            Py_DECREF(arg_annotations);
4465
0
            return 0;
4466
0
        }
4467
2
    }
4468
2
    cond = PyObject_SetAttrString(state->arg_type, "_field_types",
4469
2
                                  arg_annotations) == 0;
4470
2
    if (!cond) {
4471
0
        Py_DECREF(arg_annotations);
4472
0
        return 0;
4473
0
    }
4474
2
    cond = PyObject_SetAttrString(state->arg_type, "__annotations__",
4475
2
                                  arg_annotations) == 0;
4476
2
    if (!cond) {
4477
0
        Py_DECREF(arg_annotations);
4478
0
        return 0;
4479
0
    }
4480
2
    Py_DECREF(arg_annotations);
4481
2
    PyObject *keyword_annotations = PyDict_New();
4482
2
    if (!keyword_annotations) return 0;
4483
2
    {
4484
2
        PyObject *type = (PyObject *)&PyUnicode_Type;
4485
2
        type = _Py_union_type_or(type, Py_None);
4486
2
        cond = type != NULL;
4487
2
        if (!cond) {
4488
0
            Py_DECREF(keyword_annotations);
4489
0
            return 0;
4490
0
        }
4491
2
        cond = PyDict_SetItemString(keyword_annotations, "arg", type) == 0;
4492
2
        Py_DECREF(type);
4493
2
        if (!cond) {
4494
0
            Py_DECREF(keyword_annotations);
4495
0
            return 0;
4496
0
        }
4497
2
    }
4498
2
    {
4499
2
        PyObject *type = state->expr_type;
4500
2
        Py_INCREF(type);
4501
2
        cond = PyDict_SetItemString(keyword_annotations, "value", type) == 0;
4502
2
        Py_DECREF(type);
4503
2
        if (!cond) {
4504
0
            Py_DECREF(keyword_annotations);
4505
0
            return 0;
4506
0
        }
4507
2
    }
4508
2
    cond = PyObject_SetAttrString(state->keyword_type, "_field_types",
4509
2
                                  keyword_annotations) == 0;
4510
2
    if (!cond) {
4511
0
        Py_DECREF(keyword_annotations);
4512
0
        return 0;
4513
0
    }
4514
2
    cond = PyObject_SetAttrString(state->keyword_type, "__annotations__",
4515
2
                                  keyword_annotations) == 0;
4516
2
    if (!cond) {
4517
0
        Py_DECREF(keyword_annotations);
4518
0
        return 0;
4519
0
    }
4520
2
    Py_DECREF(keyword_annotations);
4521
2
    PyObject *alias_annotations = PyDict_New();
4522
2
    if (!alias_annotations) return 0;
4523
2
    {
4524
2
        PyObject *type = (PyObject *)&PyUnicode_Type;
4525
2
        Py_INCREF(type);
4526
2
        cond = PyDict_SetItemString(alias_annotations, "name", type) == 0;
4527
2
        Py_DECREF(type);
4528
2
        if (!cond) {
4529
0
            Py_DECREF(alias_annotations);
4530
0
            return 0;
4531
0
        }
4532
2
    }
4533
2
    {
4534
2
        PyObject *type = (PyObject *)&PyUnicode_Type;
4535
2
        type = _Py_union_type_or(type, Py_None);
4536
2
        cond = type != NULL;
4537
2
        if (!cond) {
4538
0
            Py_DECREF(alias_annotations);
4539
0
            return 0;
4540
0
        }
4541
2
        cond = PyDict_SetItemString(alias_annotations, "asname", type) == 0;
4542
2
        Py_DECREF(type);
4543
2
        if (!cond) {
4544
0
            Py_DECREF(alias_annotations);
4545
0
            return 0;
4546
0
        }
4547
2
    }
4548
2
    cond = PyObject_SetAttrString(state->alias_type, "_field_types",
4549
2
                                  alias_annotations) == 0;
4550
2
    if (!cond) {
4551
0
        Py_DECREF(alias_annotations);
4552
0
        return 0;
4553
0
    }
4554
2
    cond = PyObject_SetAttrString(state->alias_type, "__annotations__",
4555
2
                                  alias_annotations) == 0;
4556
2
    if (!cond) {
4557
0
        Py_DECREF(alias_annotations);
4558
0
        return 0;
4559
0
    }
4560
2
    Py_DECREF(alias_annotations);
4561
2
    PyObject *withitem_annotations = PyDict_New();
4562
2
    if (!withitem_annotations) return 0;
4563
2
    {
4564
2
        PyObject *type = state->expr_type;
4565
2
        Py_INCREF(type);
4566
2
        cond = PyDict_SetItemString(withitem_annotations, "context_expr", type)
4567
2
                                    == 0;
4568
2
        Py_DECREF(type);
4569
2
        if (!cond) {
4570
0
            Py_DECREF(withitem_annotations);
4571
0
            return 0;
4572
0
        }
4573
2
    }
4574
2
    {
4575
2
        PyObject *type = state->expr_type;
4576
2
        type = _Py_union_type_or(type, Py_None);
4577
2
        cond = type != NULL;
4578
2
        if (!cond) {
4579
0
            Py_DECREF(withitem_annotations);
4580
0
            return 0;
4581
0
        }
4582
2
        cond = PyDict_SetItemString(withitem_annotations, "optional_vars",
4583
2
                                    type) == 0;
4584
2
        Py_DECREF(type);
4585
2
        if (!cond) {
4586
0
            Py_DECREF(withitem_annotations);
4587
0
            return 0;
4588
0
        }
4589
2
    }
4590
2
    cond = PyObject_SetAttrString(state->withitem_type, "_field_types",
4591
2
                                  withitem_annotations) == 0;
4592
2
    if (!cond) {
4593
0
        Py_DECREF(withitem_annotations);
4594
0
        return 0;
4595
0
    }
4596
2
    cond = PyObject_SetAttrString(state->withitem_type, "__annotations__",
4597
2
                                  withitem_annotations) == 0;
4598
2
    if (!cond) {
4599
0
        Py_DECREF(withitem_annotations);
4600
0
        return 0;
4601
0
    }
4602
2
    Py_DECREF(withitem_annotations);
4603
2
    PyObject *match_case_annotations = PyDict_New();
4604
2
    if (!match_case_annotations) return 0;
4605
2
    {
4606
2
        PyObject *type = state->pattern_type;
4607
2
        Py_INCREF(type);
4608
2
        cond = PyDict_SetItemString(match_case_annotations, "pattern", type) ==
4609
2
                                    0;
4610
2
        Py_DECREF(type);
4611
2
        if (!cond) {
4612
0
            Py_DECREF(match_case_annotations);
4613
0
            return 0;
4614
0
        }
4615
2
    }
4616
2
    {
4617
2
        PyObject *type = state->expr_type;
4618
2
        type = _Py_union_type_or(type, Py_None);
4619
2
        cond = type != NULL;
4620
2
        if (!cond) {
4621
0
            Py_DECREF(match_case_annotations);
4622
0
            return 0;
4623
0
        }
4624
2
        cond = PyDict_SetItemString(match_case_annotations, "guard", type) == 0;
4625
2
        Py_DECREF(type);
4626
2
        if (!cond) {
4627
0
            Py_DECREF(match_case_annotations);
4628
0
            return 0;
4629
0
        }
4630
2
    }
4631
2
    {
4632
2
        PyObject *type = state->stmt_type;
4633
2
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
4634
2
        cond = type != NULL;
4635
2
        if (!cond) {
4636
0
            Py_DECREF(match_case_annotations);
4637
0
            return 0;
4638
0
        }
4639
2
        cond = PyDict_SetItemString(match_case_annotations, "body", type) == 0;
4640
2
        Py_DECREF(type);
4641
2
        if (!cond) {
4642
0
            Py_DECREF(match_case_annotations);
4643
0
            return 0;
4644
0
        }
4645
2
    }
4646
2
    cond = PyObject_SetAttrString(state->match_case_type, "_field_types",
4647
2
                                  match_case_annotations) == 0;
4648
2
    if (!cond) {
4649
0
        Py_DECREF(match_case_annotations);
4650
0
        return 0;
4651
0
    }
4652
2
    cond = PyObject_SetAttrString(state->match_case_type, "__annotations__",
4653
2
                                  match_case_annotations) == 0;
4654
2
    if (!cond) {
4655
0
        Py_DECREF(match_case_annotations);
4656
0
        return 0;
4657
0
    }
4658
2
    Py_DECREF(match_case_annotations);
4659
2
    PyObject *MatchValue_annotations = PyDict_New();
4660
2
    if (!MatchValue_annotations) return 0;
4661
2
    {
4662
2
        PyObject *type = state->expr_type;
4663
2
        Py_INCREF(type);
4664
2
        cond = PyDict_SetItemString(MatchValue_annotations, "value", type) == 0;
4665
2
        Py_DECREF(type);
4666
2
        if (!cond) {
4667
0
            Py_DECREF(MatchValue_annotations);
4668
0
            return 0;
4669
0
        }
4670
2
    }
4671
2
    cond = PyObject_SetAttrString(state->MatchValue_type, "_field_types",
4672
2
                                  MatchValue_annotations) == 0;
4673
2
    if (!cond) {
4674
0
        Py_DECREF(MatchValue_annotations);
4675
0
        return 0;
4676
0
    }
4677
2
    cond = PyObject_SetAttrString(state->MatchValue_type, "__annotations__",
4678
2
                                  MatchValue_annotations) == 0;
4679
2
    if (!cond) {
4680
0
        Py_DECREF(MatchValue_annotations);
4681
0
        return 0;
4682
0
    }
4683
2
    Py_DECREF(MatchValue_annotations);
4684
2
    PyObject *MatchSingleton_annotations = PyDict_New();
4685
2
    if (!MatchSingleton_annotations) return 0;
4686
2
    {
4687
2
        PyObject *type = (PyObject *)&PyBaseObject_Type;
4688
2
        Py_INCREF(type);
4689
2
        cond = PyDict_SetItemString(MatchSingleton_annotations, "value", type)
4690
2
                                    == 0;
4691
2
        Py_DECREF(type);
4692
2
        if (!cond) {
4693
0
            Py_DECREF(MatchSingleton_annotations);
4694
0
            return 0;
4695
0
        }
4696
2
    }
4697
2
    cond = PyObject_SetAttrString(state->MatchSingleton_type, "_field_types",
4698
2
                                  MatchSingleton_annotations) == 0;
4699
2
    if (!cond) {
4700
0
        Py_DECREF(MatchSingleton_annotations);
4701
0
        return 0;
4702
0
    }
4703
2
    cond = PyObject_SetAttrString(state->MatchSingleton_type,
4704
2
                                  "__annotations__",
4705
2
                                  MatchSingleton_annotations) == 0;
4706
2
    if (!cond) {
4707
0
        Py_DECREF(MatchSingleton_annotations);
4708
0
        return 0;
4709
0
    }
4710
2
    Py_DECREF(MatchSingleton_annotations);
4711
2
    PyObject *MatchSequence_annotations = PyDict_New();
4712
2
    if (!MatchSequence_annotations) return 0;
4713
2
    {
4714
2
        PyObject *type = state->pattern_type;
4715
2
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
4716
2
        cond = type != NULL;
4717
2
        if (!cond) {
4718
0
            Py_DECREF(MatchSequence_annotations);
4719
0
            return 0;
4720
0
        }
4721
2
        cond = PyDict_SetItemString(MatchSequence_annotations, "patterns",
4722
2
                                    type) == 0;
4723
2
        Py_DECREF(type);
4724
2
        if (!cond) {
4725
0
            Py_DECREF(MatchSequence_annotations);
4726
0
            return 0;
4727
0
        }
4728
2
    }
4729
2
    cond = PyObject_SetAttrString(state->MatchSequence_type, "_field_types",
4730
2
                                  MatchSequence_annotations) == 0;
4731
2
    if (!cond) {
4732
0
        Py_DECREF(MatchSequence_annotations);
4733
0
        return 0;
4734
0
    }
4735
2
    cond = PyObject_SetAttrString(state->MatchSequence_type, "__annotations__",
4736
2
                                  MatchSequence_annotations) == 0;
4737
2
    if (!cond) {
4738
0
        Py_DECREF(MatchSequence_annotations);
4739
0
        return 0;
4740
0
    }
4741
2
    Py_DECREF(MatchSequence_annotations);
4742
2
    PyObject *MatchMapping_annotations = PyDict_New();
4743
2
    if (!MatchMapping_annotations) return 0;
4744
2
    {
4745
2
        PyObject *type = state->expr_type;
4746
2
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
4747
2
        cond = type != NULL;
4748
2
        if (!cond) {
4749
0
            Py_DECREF(MatchMapping_annotations);
4750
0
            return 0;
4751
0
        }
4752
2
        cond = PyDict_SetItemString(MatchMapping_annotations, "keys", type) ==
4753
2
                                    0;
4754
2
        Py_DECREF(type);
4755
2
        if (!cond) {
4756
0
            Py_DECREF(MatchMapping_annotations);
4757
0
            return 0;
4758
0
        }
4759
2
    }
4760
2
    {
4761
2
        PyObject *type = state->pattern_type;
4762
2
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
4763
2
        cond = type != NULL;
4764
2
        if (!cond) {
4765
0
            Py_DECREF(MatchMapping_annotations);
4766
0
            return 0;
4767
0
        }
4768
2
        cond = PyDict_SetItemString(MatchMapping_annotations, "patterns", type)
4769
2
                                    == 0;
4770
2
        Py_DECREF(type);
4771
2
        if (!cond) {
4772
0
            Py_DECREF(MatchMapping_annotations);
4773
0
            return 0;
4774
0
        }
4775
2
    }
4776
2
    {
4777
2
        PyObject *type = (PyObject *)&PyUnicode_Type;
4778
2
        type = _Py_union_type_or(type, Py_None);
4779
2
        cond = type != NULL;
4780
2
        if (!cond) {
4781
0
            Py_DECREF(MatchMapping_annotations);
4782
0
            return 0;
4783
0
        }
4784
2
        cond = PyDict_SetItemString(MatchMapping_annotations, "rest", type) ==
4785
2
                                    0;
4786
2
        Py_DECREF(type);
4787
2
        if (!cond) {
4788
0
            Py_DECREF(MatchMapping_annotations);
4789
0
            return 0;
4790
0
        }
4791
2
    }
4792
2
    cond = PyObject_SetAttrString(state->MatchMapping_type, "_field_types",
4793
2
                                  MatchMapping_annotations) == 0;
4794
2
    if (!cond) {
4795
0
        Py_DECREF(MatchMapping_annotations);
4796
0
        return 0;
4797
0
    }
4798
2
    cond = PyObject_SetAttrString(state->MatchMapping_type, "__annotations__",
4799
2
                                  MatchMapping_annotations) == 0;
4800
2
    if (!cond) {
4801
0
        Py_DECREF(MatchMapping_annotations);
4802
0
        return 0;
4803
0
    }
4804
2
    Py_DECREF(MatchMapping_annotations);
4805
2
    PyObject *MatchClass_annotations = PyDict_New();
4806
2
    if (!MatchClass_annotations) return 0;
4807
2
    {
4808
2
        PyObject *type = state->expr_type;
4809
2
        Py_INCREF(type);
4810
2
        cond = PyDict_SetItemString(MatchClass_annotations, "cls", type) == 0;
4811
2
        Py_DECREF(type);
4812
2
        if (!cond) {
4813
0
            Py_DECREF(MatchClass_annotations);
4814
0
            return 0;
4815
0
        }
4816
2
    }
4817
2
    {
4818
2
        PyObject *type = state->pattern_type;
4819
2
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
4820
2
        cond = type != NULL;
4821
2
        if (!cond) {
4822
0
            Py_DECREF(MatchClass_annotations);
4823
0
            return 0;
4824
0
        }
4825
2
        cond = PyDict_SetItemString(MatchClass_annotations, "patterns", type)
4826
2
                                    == 0;
4827
2
        Py_DECREF(type);
4828
2
        if (!cond) {
4829
0
            Py_DECREF(MatchClass_annotations);
4830
0
            return 0;
4831
0
        }
4832
2
    }
4833
2
    {
4834
2
        PyObject *type = (PyObject *)&PyUnicode_Type;
4835
2
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
4836
2
        cond = type != NULL;
4837
2
        if (!cond) {
4838
0
            Py_DECREF(MatchClass_annotations);
4839
0
            return 0;
4840
0
        }
4841
2
        cond = PyDict_SetItemString(MatchClass_annotations, "kwd_attrs", type)
4842
2
                                    == 0;
4843
2
        Py_DECREF(type);
4844
2
        if (!cond) {
4845
0
            Py_DECREF(MatchClass_annotations);
4846
0
            return 0;
4847
0
        }
4848
2
    }
4849
2
    {
4850
2
        PyObject *type = state->pattern_type;
4851
2
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
4852
2
        cond = type != NULL;
4853
2
        if (!cond) {
4854
0
            Py_DECREF(MatchClass_annotations);
4855
0
            return 0;
4856
0
        }
4857
2
        cond = PyDict_SetItemString(MatchClass_annotations, "kwd_patterns",
4858
2
                                    type) == 0;
4859
2
        Py_DECREF(type);
4860
2
        if (!cond) {
4861
0
            Py_DECREF(MatchClass_annotations);
4862
0
            return 0;
4863
0
        }
4864
2
    }
4865
2
    cond = PyObject_SetAttrString(state->MatchClass_type, "_field_types",
4866
2
                                  MatchClass_annotations) == 0;
4867
2
    if (!cond) {
4868
0
        Py_DECREF(MatchClass_annotations);
4869
0
        return 0;
4870
0
    }
4871
2
    cond = PyObject_SetAttrString(state->MatchClass_type, "__annotations__",
4872
2
                                  MatchClass_annotations) == 0;
4873
2
    if (!cond) {
4874
0
        Py_DECREF(MatchClass_annotations);
4875
0
        return 0;
4876
0
    }
4877
2
    Py_DECREF(MatchClass_annotations);
4878
2
    PyObject *MatchStar_annotations = PyDict_New();
4879
2
    if (!MatchStar_annotations) return 0;
4880
2
    {
4881
2
        PyObject *type = (PyObject *)&PyUnicode_Type;
4882
2
        type = _Py_union_type_or(type, Py_None);
4883
2
        cond = type != NULL;
4884
2
        if (!cond) {
4885
0
            Py_DECREF(MatchStar_annotations);
4886
0
            return 0;
4887
0
        }
4888
2
        cond = PyDict_SetItemString(MatchStar_annotations, "name", type) == 0;
4889
2
        Py_DECREF(type);
4890
2
        if (!cond) {
4891
0
            Py_DECREF(MatchStar_annotations);
4892
0
            return 0;
4893
0
        }
4894
2
    }
4895
2
    cond = PyObject_SetAttrString(state->MatchStar_type, "_field_types",
4896
2
                                  MatchStar_annotations) == 0;
4897
2
    if (!cond) {
4898
0
        Py_DECREF(MatchStar_annotations);
4899
0
        return 0;
4900
0
    }
4901
2
    cond = PyObject_SetAttrString(state->MatchStar_type, "__annotations__",
4902
2
                                  MatchStar_annotations) == 0;
4903
2
    if (!cond) {
4904
0
        Py_DECREF(MatchStar_annotations);
4905
0
        return 0;
4906
0
    }
4907
2
    Py_DECREF(MatchStar_annotations);
4908
2
    PyObject *MatchAs_annotations = PyDict_New();
4909
2
    if (!MatchAs_annotations) return 0;
4910
2
    {
4911
2
        PyObject *type = state->pattern_type;
4912
2
        type = _Py_union_type_or(type, Py_None);
4913
2
        cond = type != NULL;
4914
2
        if (!cond) {
4915
0
            Py_DECREF(MatchAs_annotations);
4916
0
            return 0;
4917
0
        }
4918
2
        cond = PyDict_SetItemString(MatchAs_annotations, "pattern", type) == 0;
4919
2
        Py_DECREF(type);
4920
2
        if (!cond) {
4921
0
            Py_DECREF(MatchAs_annotations);
4922
0
            return 0;
4923
0
        }
4924
2
    }
4925
2
    {
4926
2
        PyObject *type = (PyObject *)&PyUnicode_Type;
4927
2
        type = _Py_union_type_or(type, Py_None);
4928
2
        cond = type != NULL;
4929
2
        if (!cond) {
4930
0
            Py_DECREF(MatchAs_annotations);
4931
0
            return 0;
4932
0
        }
4933
2
        cond = PyDict_SetItemString(MatchAs_annotations, "name", type) == 0;
4934
2
        Py_DECREF(type);
4935
2
        if (!cond) {
4936
0
            Py_DECREF(MatchAs_annotations);
4937
0
            return 0;
4938
0
        }
4939
2
    }
4940
2
    cond = PyObject_SetAttrString(state->MatchAs_type, "_field_types",
4941
2
                                  MatchAs_annotations) == 0;
4942
2
    if (!cond) {
4943
0
        Py_DECREF(MatchAs_annotations);
4944
0
        return 0;
4945
0
    }
4946
2
    cond = PyObject_SetAttrString(state->MatchAs_type, "__annotations__",
4947
2
                                  MatchAs_annotations) == 0;
4948
2
    if (!cond) {
4949
0
        Py_DECREF(MatchAs_annotations);
4950
0
        return 0;
4951
0
    }
4952
2
    Py_DECREF(MatchAs_annotations);
4953
2
    PyObject *MatchOr_annotations = PyDict_New();
4954
2
    if (!MatchOr_annotations) return 0;
4955
2
    {
4956
2
        PyObject *type = state->pattern_type;
4957
2
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
4958
2
        cond = type != NULL;
4959
2
        if (!cond) {
4960
0
            Py_DECREF(MatchOr_annotations);
4961
0
            return 0;
4962
0
        }
4963
2
        cond = PyDict_SetItemString(MatchOr_annotations, "patterns", type) == 0;
4964
2
        Py_DECREF(type);
4965
2
        if (!cond) {
4966
0
            Py_DECREF(MatchOr_annotations);
4967
0
            return 0;
4968
0
        }
4969
2
    }
4970
2
    cond = PyObject_SetAttrString(state->MatchOr_type, "_field_types",
4971
2
                                  MatchOr_annotations) == 0;
4972
2
    if (!cond) {
4973
0
        Py_DECREF(MatchOr_annotations);
4974
0
        return 0;
4975
0
    }
4976
2
    cond = PyObject_SetAttrString(state->MatchOr_type, "__annotations__",
4977
2
                                  MatchOr_annotations) == 0;
4978
2
    if (!cond) {
4979
0
        Py_DECREF(MatchOr_annotations);
4980
0
        return 0;
4981
0
    }
4982
2
    Py_DECREF(MatchOr_annotations);
4983
2
    PyObject *TypeIgnore_annotations = PyDict_New();
4984
2
    if (!TypeIgnore_annotations) return 0;
4985
2
    {
4986
2
        PyObject *type = (PyObject *)&PyLong_Type;
4987
2
        Py_INCREF(type);
4988
2
        cond = PyDict_SetItemString(TypeIgnore_annotations, "lineno", type) ==
4989
2
                                    0;
4990
2
        Py_DECREF(type);
4991
2
        if (!cond) {
4992
0
            Py_DECREF(TypeIgnore_annotations);
4993
0
            return 0;
4994
0
        }
4995
2
    }
4996
2
    {
4997
2
        PyObject *type = (PyObject *)&PyUnicode_Type;
4998
2
        Py_INCREF(type);
4999
2
        cond = PyDict_SetItemString(TypeIgnore_annotations, "tag", type) == 0;
5000
2
        Py_DECREF(type);
5001
2
        if (!cond) {
5002
0
            Py_DECREF(TypeIgnore_annotations);
5003
0
            return 0;
5004
0
        }
5005
2
    }
5006
2
    cond = PyObject_SetAttrString(state->TypeIgnore_type, "_field_types",
5007
2
                                  TypeIgnore_annotations) == 0;
5008
2
    if (!cond) {
5009
0
        Py_DECREF(TypeIgnore_annotations);
5010
0
        return 0;
5011
0
    }
5012
2
    cond = PyObject_SetAttrString(state->TypeIgnore_type, "__annotations__",
5013
2
                                  TypeIgnore_annotations) == 0;
5014
2
    if (!cond) {
5015
0
        Py_DECREF(TypeIgnore_annotations);
5016
0
        return 0;
5017
0
    }
5018
2
    Py_DECREF(TypeIgnore_annotations);
5019
2
    PyObject *TypeVar_annotations = PyDict_New();
5020
2
    if (!TypeVar_annotations) return 0;
5021
2
    {
5022
2
        PyObject *type = (PyObject *)&PyUnicode_Type;
5023
2
        Py_INCREF(type);
5024
2
        cond = PyDict_SetItemString(TypeVar_annotations, "name", type) == 0;
5025
2
        Py_DECREF(type);
5026
2
        if (!cond) {
5027
0
            Py_DECREF(TypeVar_annotations);
5028
0
            return 0;
5029
0
        }
5030
2
    }
5031
2
    {
5032
2
        PyObject *type = state->expr_type;
5033
2
        type = _Py_union_type_or(type, Py_None);
5034
2
        cond = type != NULL;
5035
2
        if (!cond) {
5036
0
            Py_DECREF(TypeVar_annotations);
5037
0
            return 0;
5038
0
        }
5039
2
        cond = PyDict_SetItemString(TypeVar_annotations, "bound", type) == 0;
5040
2
        Py_DECREF(type);
5041
2
        if (!cond) {
5042
0
            Py_DECREF(TypeVar_annotations);
5043
0
            return 0;
5044
0
        }
5045
2
    }
5046
2
    {
5047
2
        PyObject *type = state->expr_type;
5048
2
        type = _Py_union_type_or(type, Py_None);
5049
2
        cond = type != NULL;
5050
2
        if (!cond) {
5051
0
            Py_DECREF(TypeVar_annotations);
5052
0
            return 0;
5053
0
        }
5054
2
        cond = PyDict_SetItemString(TypeVar_annotations, "default_value", type)
5055
2
                                    == 0;
5056
2
        Py_DECREF(type);
5057
2
        if (!cond) {
5058
0
            Py_DECREF(TypeVar_annotations);
5059
0
            return 0;
5060
0
        }
5061
2
    }
5062
2
    cond = PyObject_SetAttrString(state->TypeVar_type, "_field_types",
5063
2
                                  TypeVar_annotations) == 0;
5064
2
    if (!cond) {
5065
0
        Py_DECREF(TypeVar_annotations);
5066
0
        return 0;
5067
0
    }
5068
2
    cond = PyObject_SetAttrString(state->TypeVar_type, "__annotations__",
5069
2
                                  TypeVar_annotations) == 0;
5070
2
    if (!cond) {
5071
0
        Py_DECREF(TypeVar_annotations);
5072
0
        return 0;
5073
0
    }
5074
2
    Py_DECREF(TypeVar_annotations);
5075
2
    PyObject *ParamSpec_annotations = PyDict_New();
5076
2
    if (!ParamSpec_annotations) return 0;
5077
2
    {
5078
2
        PyObject *type = (PyObject *)&PyUnicode_Type;
5079
2
        Py_INCREF(type);
5080
2
        cond = PyDict_SetItemString(ParamSpec_annotations, "name", type) == 0;
5081
2
        Py_DECREF(type);
5082
2
        if (!cond) {
5083
0
            Py_DECREF(ParamSpec_annotations);
5084
0
            return 0;
5085
0
        }
5086
2
    }
5087
2
    {
5088
2
        PyObject *type = state->expr_type;
5089
2
        type = _Py_union_type_or(type, Py_None);
5090
2
        cond = type != NULL;
5091
2
        if (!cond) {
5092
0
            Py_DECREF(ParamSpec_annotations);
5093
0
            return 0;
5094
0
        }
5095
2
        cond = PyDict_SetItemString(ParamSpec_annotations, "default_value",
5096
2
                                    type) == 0;
5097
2
        Py_DECREF(type);
5098
2
        if (!cond) {
5099
0
            Py_DECREF(ParamSpec_annotations);
5100
0
            return 0;
5101
0
        }
5102
2
    }
5103
2
    cond = PyObject_SetAttrString(state->ParamSpec_type, "_field_types",
5104
2
                                  ParamSpec_annotations) == 0;
5105
2
    if (!cond) {
5106
0
        Py_DECREF(ParamSpec_annotations);
5107
0
        return 0;
5108
0
    }
5109
2
    cond = PyObject_SetAttrString(state->ParamSpec_type, "__annotations__",
5110
2
                                  ParamSpec_annotations) == 0;
5111
2
    if (!cond) {
5112
0
        Py_DECREF(ParamSpec_annotations);
5113
0
        return 0;
5114
0
    }
5115
2
    Py_DECREF(ParamSpec_annotations);
5116
2
    PyObject *TypeVarTuple_annotations = PyDict_New();
5117
2
    if (!TypeVarTuple_annotations) return 0;
5118
2
    {
5119
2
        PyObject *type = (PyObject *)&PyUnicode_Type;
5120
2
        Py_INCREF(type);
5121
2
        cond = PyDict_SetItemString(TypeVarTuple_annotations, "name", type) ==
5122
2
                                    0;
5123
2
        Py_DECREF(type);
5124
2
        if (!cond) {
5125
0
            Py_DECREF(TypeVarTuple_annotations);
5126
0
            return 0;
5127
0
        }
5128
2
    }
5129
2
    {
5130
2
        PyObject *type = state->expr_type;
5131
2
        type = _Py_union_type_or(type, Py_None);
5132
2
        cond = type != NULL;
5133
2
        if (!cond) {
5134
0
            Py_DECREF(TypeVarTuple_annotations);
5135
0
            return 0;
5136
0
        }
5137
2
        cond = PyDict_SetItemString(TypeVarTuple_annotations, "default_value",
5138
2
                                    type) == 0;
5139
2
        Py_DECREF(type);
5140
2
        if (!cond) {
5141
0
            Py_DECREF(TypeVarTuple_annotations);
5142
0
            return 0;
5143
0
        }
5144
2
    }
5145
2
    cond = PyObject_SetAttrString(state->TypeVarTuple_type, "_field_types",
5146
2
                                  TypeVarTuple_annotations) == 0;
5147
2
    if (!cond) {
5148
0
        Py_DECREF(TypeVarTuple_annotations);
5149
0
        return 0;
5150
0
    }
5151
2
    cond = PyObject_SetAttrString(state->TypeVarTuple_type, "__annotations__",
5152
2
                                  TypeVarTuple_annotations) == 0;
5153
2
    if (!cond) {
5154
0
        Py_DECREF(TypeVarTuple_annotations);
5155
0
        return 0;
5156
0
    }
5157
2
    Py_DECREF(TypeVarTuple_annotations);
5158
5159
2
    return 1;
5160
2
}
5161
5162
5163
5164
typedef struct {
5165
    PyObject_HEAD
5166
    PyObject *dict;
5167
} AST_object;
5168
5169
static void
5170
ast_dealloc(PyObject *op)
5171
271k
{
5172
271k
    AST_object *self = (AST_object*)op;
5173
    /* bpo-31095: UnTrack is needed before calling any callbacks */
5174
271k
    PyTypeObject *tp = Py_TYPE(self);
5175
271k
    PyObject_GC_UnTrack(self);
5176
271k
    Py_CLEAR(self->dict);
5177
271k
    freefunc free_func = PyType_GetSlot(tp, Py_tp_free);
5178
271k
    assert(free_func != NULL);
5179
271k
    free_func(self);
5180
271k
    Py_DECREF(tp);
5181
271k
}
5182
5183
static int
5184
ast_traverse(PyObject *op, visitproc visit, void *arg)
5185
544
{
5186
544
    AST_object *self = (AST_object*)op;
5187
544
    Py_VISIT(Py_TYPE(self));
5188
544
    Py_VISIT(self->dict);
5189
544
    return 0;
5190
544
}
5191
5192
static int
5193
ast_clear(PyObject *op)
5194
0
{
5195
0
    AST_object *self = (AST_object*)op;
5196
0
    Py_CLEAR(self->dict);
5197
0
    return 0;
5198
0
}
5199
5200
static int
5201
ast_type_init(PyObject *self, PyObject *args, PyObject *kw)
5202
0
{
5203
0
    struct ast_state *state = get_ast_state();
5204
0
    if (state == NULL) {
5205
0
        return -1;
5206
0
    }
5207
5208
0
    Py_ssize_t i, numfields = 0;
5209
0
    int res = -1;
5210
0
    PyObject *key, *value, *fields, *attributes = NULL, *remaining_fields = NULL;
5211
5212
0
    fields = PyObject_GetAttr((PyObject*)Py_TYPE(self), state->_fields);
5213
0
    if (fields == NULL) {
5214
0
        goto cleanup;
5215
0
    }
5216
5217
0
    numfields = PySequence_Size(fields);
5218
0
    if (numfields == -1) {
5219
0
        goto cleanup;
5220
0
    }
5221
0
    remaining_fields = PySet_New(fields);
5222
0
    if (remaining_fields == NULL) {
5223
0
        goto cleanup;
5224
0
    }
5225
5226
0
    res = 0; /* if no error occurs, this stays 0 to the end */
5227
0
    if (numfields < PyTuple_GET_SIZE(args)) {
5228
0
        PyErr_Format(PyExc_TypeError, "%.400s constructor takes at most "
5229
0
                     "%zd positional argument%s",
5230
0
                     _PyType_Name(Py_TYPE(self)),
5231
0
                     numfields, numfields == 1 ? "" : "s");
5232
0
        res = -1;
5233
0
        goto cleanup;
5234
0
    }
5235
0
    for (i = 0; i < PyTuple_GET_SIZE(args); i++) {
5236
        /* cannot be reached when fields is NULL */
5237
0
        PyObject *name = PySequence_GetItem(fields, i);
5238
0
        if (!name) {
5239
0
            res = -1;
5240
0
            goto cleanup;
5241
0
        }
5242
0
        res = PyObject_SetAttr(self, name, PyTuple_GET_ITEM(args, i));
5243
0
        if (PySet_Discard(remaining_fields, name) < 0) {
5244
0
            res = -1;
5245
0
            Py_DECREF(name);
5246
0
            goto cleanup;
5247
0
        }
5248
0
        Py_DECREF(name);
5249
0
        if (res < 0) {
5250
0
            goto cleanup;
5251
0
        }
5252
0
    }
5253
0
    if (kw) {
5254
0
        i = 0;  /* needed by PyDict_Next */
5255
0
        while (PyDict_Next(kw, &i, &key, &value)) {
5256
0
            int contains = PySequence_Contains(fields, key);
5257
0
            if (contains == -1) {
5258
0
                res = -1;
5259
0
                goto cleanup;
5260
0
            }
5261
0
            else if (contains == 1) {
5262
0
                int p = PySet_Discard(remaining_fields, key);
5263
0
                if (p == -1) {
5264
0
                    res = -1;
5265
0
                    goto cleanup;
5266
0
                }
5267
0
                if (p == 0) {
5268
0
                    PyErr_Format(PyExc_TypeError,
5269
0
                        "%.400s got multiple values for argument %R",
5270
0
                        Py_TYPE(self)->tp_name, key);
5271
0
                    res = -1;
5272
0
                    goto cleanup;
5273
0
                }
5274
0
            }
5275
0
            else {
5276
                // Lazily initialize "attributes"
5277
0
                if (attributes == NULL) {
5278
0
                    attributes = PyObject_GetAttr((PyObject*)Py_TYPE(self), state->_attributes);
5279
0
                    if (attributes == NULL) {
5280
0
                        res = -1;
5281
0
                        goto cleanup;
5282
0
                    }
5283
0
                }
5284
0
                int contains = PySequence_Contains(attributes, key);
5285
0
                if (contains == -1) {
5286
0
                    res = -1;
5287
0
                    goto cleanup;
5288
0
                }
5289
0
                else if (contains == 0) {
5290
0
                    if (PyErr_WarnFormat(
5291
0
                        PyExc_DeprecationWarning, 1,
5292
0
                        "%.400s.__init__ got an unexpected keyword argument %R. "
5293
0
                        "Support for arbitrary keyword arguments is deprecated "
5294
0
                        "and will be removed in Python 3.15.",
5295
0
                        Py_TYPE(self)->tp_name, key
5296
0
                    ) < 0) {
5297
0
                        res = -1;
5298
0
                        goto cleanup;
5299
0
                    }
5300
0
                }
5301
0
            }
5302
0
            res = PyObject_SetAttr(self, key, value);
5303
0
            if (res < 0) {
5304
0
                goto cleanup;
5305
0
            }
5306
0
        }
5307
0
    }
5308
0
    Py_ssize_t size = PySet_Size(remaining_fields);
5309
0
    PyObject *field_types = NULL, *remaining_list = NULL;
5310
0
    if (size > 0) {
5311
0
        if (PyObject_GetOptionalAttr((PyObject*)Py_TYPE(self), &_Py_ID(_field_types),
5312
0
                                     &field_types) < 0) {
5313
0
            res = -1;
5314
0
            goto cleanup;
5315
0
        }
5316
0
        if (field_types == NULL) {
5317
            // Probably a user-defined subclass of AST that lacks _field_types.
5318
            // This will continue to work as it did before 3.13; i.e., attributes
5319
            // that are not passed in simply do not exist on the instance.
5320
0
            goto cleanup;
5321
0
        }
5322
0
        remaining_list = PySequence_List(remaining_fields);
5323
0
        if (!remaining_list) {
5324
0
            goto set_remaining_cleanup;
5325
0
        }
5326
0
        for (Py_ssize_t i = 0; i < size; i++) {
5327
0
            PyObject *name = PyList_GET_ITEM(remaining_list, i);
5328
0
            PyObject *type = PyDict_GetItemWithError(field_types, name);
5329
0
            if (!type) {
5330
0
                if (PyErr_Occurred()) {
5331
0
                    goto set_remaining_cleanup;
5332
0
                }
5333
0
                else {
5334
0
                    if (PyErr_WarnFormat(
5335
0
                        PyExc_DeprecationWarning, 1,
5336
0
                        "Field %R is missing from %.400s._field_types. "
5337
0
                        "This will become an error in Python 3.15.",
5338
0
                        name, Py_TYPE(self)->tp_name
5339
0
                    ) < 0) {
5340
0
                        goto set_remaining_cleanup;
5341
0
                    }
5342
0
                }
5343
0
            }
5344
0
            else if (_PyUnion_Check(type)) {
5345
                // optional field
5346
                // do nothing, we'll have set a None default on the class
5347
0
            }
5348
0
            else if (Py_IS_TYPE(type, &Py_GenericAliasType)) {
5349
                // list field
5350
0
                PyObject *empty = PyList_New(0);
5351
0
                if (!empty) {
5352
0
                    goto set_remaining_cleanup;
5353
0
                }
5354
0
                res = PyObject_SetAttr(self, name, empty);
5355
0
                Py_DECREF(empty);
5356
0
                if (res < 0) {
5357
0
                    goto set_remaining_cleanup;
5358
0
                }
5359
0
            }
5360
0
            else if (type == state->expr_context_type) {
5361
                // special case for expr_context: default to Load()
5362
0
                res = PyObject_SetAttr(self, name, state->Load_singleton);
5363
0
                if (res < 0) {
5364
0
                    goto set_remaining_cleanup;
5365
0
                }
5366
0
            }
5367
0
            else {
5368
                // simple field (e.g., identifier)
5369
0
                if (PyErr_WarnFormat(
5370
0
                    PyExc_DeprecationWarning, 1,
5371
0
                    "%.400s.__init__ missing 1 required positional argument: %R. "
5372
0
                    "This will become an error in Python 3.15.",
5373
0
                    Py_TYPE(self)->tp_name, name
5374
0
                ) < 0) {
5375
0
                    goto set_remaining_cleanup;
5376
0
                }
5377
0
            }
5378
0
        }
5379
0
        Py_DECREF(remaining_list);
5380
0
        Py_DECREF(field_types);
5381
0
    }
5382
0
  cleanup:
5383
0
    Py_XDECREF(attributes);
5384
0
    Py_XDECREF(fields);
5385
0
    Py_XDECREF(remaining_fields);
5386
0
    return res;
5387
0
  set_remaining_cleanup:
5388
0
    Py_XDECREF(remaining_list);
5389
0
    Py_XDECREF(field_types);
5390
0
    res = -1;
5391
0
    goto cleanup;
5392
0
}
5393
5394
/* Pickling support */
5395
static PyObject *
5396
ast_type_reduce(PyObject *self, PyObject *unused)
5397
0
{
5398
0
    struct ast_state *state = get_ast_state();
5399
0
    if (state == NULL) {
5400
0
        return NULL;
5401
0
    }
5402
5403
0
    PyObject *dict = NULL, *fields = NULL, *positional_args = NULL;
5404
0
    if (PyObject_GetOptionalAttr(self, state->__dict__, &dict) < 0) {
5405
0
        return NULL;
5406
0
    }
5407
0
    PyObject *result = NULL;
5408
0
    if (dict) {
5409
        // Unpickling (or copying) works as follows:
5410
        // - Construct the object with only positional arguments
5411
        // - Set the fields from the dict
5412
        // We have two constraints:
5413
        // - We must set all the required fields in the initial constructor call,
5414
        //   or the unpickling or deepcopying of the object will trigger DeprecationWarnings.
5415
        // - We must not include child nodes in the positional args, because
5416
        //   that may trigger runaway recursion during copying (gh-120108).
5417
        // To satisfy both constraints, we set all the fields to None in the
5418
        // initial list of positional args, and then set the fields from the dict.
5419
0
        if (PyObject_GetOptionalAttr((PyObject*)Py_TYPE(self), state->_fields, &fields) < 0) {
5420
0
            goto cleanup;
5421
0
        }
5422
0
        if (fields) {
5423
0
            Py_ssize_t numfields = PySequence_Size(fields);
5424
0
            if (numfields == -1) {
5425
0
                Py_DECREF(dict);
5426
0
                goto cleanup;
5427
0
            }
5428
0
            positional_args = PyList_New(0);
5429
0
            if (!positional_args) {
5430
0
                goto cleanup;
5431
0
            }
5432
0
            for (Py_ssize_t i = 0; i < numfields; i++) {
5433
0
                PyObject *name = PySequence_GetItem(fields, i);
5434
0
                if (!name) {
5435
0
                    goto cleanup;
5436
0
                }
5437
0
                PyObject *value;
5438
0
                int rc = PyDict_GetItemRef(dict, name, &value);
5439
0
                Py_DECREF(name);
5440
0
                if (rc < 0) {
5441
0
                    goto cleanup;
5442
0
                }
5443
0
                if (!value) {
5444
0
                    break;
5445
0
                }
5446
0
                rc = PyList_Append(positional_args, Py_None);
5447
0
                Py_DECREF(value);
5448
0
                if (rc < 0) {
5449
0
                    goto cleanup;
5450
0
                }
5451
0
            }
5452
0
            PyObject *args_tuple = PyList_AsTuple(positional_args);
5453
0
            if (!args_tuple) {
5454
0
                goto cleanup;
5455
0
            }
5456
0
            result = Py_BuildValue("ONN", Py_TYPE(self), args_tuple, dict);
5457
0
        }
5458
0
        else {
5459
0
            result = Py_BuildValue("O()N", Py_TYPE(self), dict);
5460
0
        }
5461
0
    }
5462
0
    else {
5463
0
        result = Py_BuildValue("O()", Py_TYPE(self));
5464
0
    }
5465
0
cleanup:
5466
0
    Py_XDECREF(fields);
5467
0
    Py_XDECREF(positional_args);
5468
0
    return result;
5469
0
}
5470
5471
/*
5472
 * Perform the following validations:
5473
 *
5474
 *   - All keyword arguments are known 'fields' or 'attributes'.
5475
 *   - No field or attribute would be left unfilled after copy.replace().
5476
 *
5477
 * On success, this returns 1. Otherwise, set a TypeError
5478
 * exception and returns -1 (no exception is set if some
5479
 * other internal errors occur).
5480
 *
5481
 * Parameters
5482
 *
5483
 *      self          The AST node instance.
5484
 *      dict          The AST node instance dictionary (self.__dict__).
5485
 *      fields        The list of fields (self._fields).
5486
 *      attributes    The list of attributes (self._attributes).
5487
 *      kwargs        Keyword arguments passed to ast_type_replace().
5488
 *
5489
 * The 'dict', 'fields', 'attributes' and 'kwargs' arguments can be NULL.
5490
 *
5491
 * Note: this function can be removed in 3.15 since the verification
5492
 *       will be done inside the constructor.
5493
 */
5494
static inline int
5495
ast_type_replace_check(PyObject *self,
5496
                       PyObject *dict,
5497
                       PyObject *fields,
5498
                       PyObject *attributes,
5499
                       PyObject *kwargs)
5500
0
{
5501
    // While it is possible to make some fast paths that would avoid
5502
    // allocating objects on the stack, this would cost us readability.
5503
    // For instance, if 'fields' and 'attributes' are both empty, and
5504
    // 'kwargs' is not empty, we could raise a TypeError immediately.
5505
0
    PyObject *expecting = PySet_New(fields);
5506
0
    if (expecting == NULL) {
5507
0
        return -1;
5508
0
    }
5509
0
    if (attributes) {
5510
0
        if (_PySet_Update(expecting, attributes) < 0) {
5511
0
            Py_DECREF(expecting);
5512
0
            return -1;
5513
0
        }
5514
0
    }
5515
    // Any keyword argument that is neither a field nor attribute is rejected.
5516
    // We first need to check whether a keyword argument is accepted or not.
5517
    // If all keyword arguments are accepted, we compute the required fields
5518
    // and attributes. A field or attribute is not needed if:
5519
    //
5520
    //  1) it is given in 'kwargs', or
5521
    //  2) it already exists on 'self'.
5522
0
    if (kwargs) {
5523
0
        Py_ssize_t pos = 0;
5524
0
        PyObject *key, *value;
5525
0
        while (PyDict_Next(kwargs, &pos, &key, &value)) {
5526
0
            int rc = PySet_Discard(expecting, key);
5527
0
            if (rc < 0) {
5528
0
                Py_DECREF(expecting);
5529
0
                return -1;
5530
0
            }
5531
0
            if (rc == 0) {
5532
0
                PyErr_Format(PyExc_TypeError,
5533
0
                             "%.400s.__replace__ got an unexpected keyword "
5534
0
                             "argument %R.", Py_TYPE(self)->tp_name, key);
5535
0
                Py_DECREF(expecting);
5536
0
                return -1;
5537
0
            }
5538
0
        }
5539
0
    }
5540
    // check that the remaining fields or attributes would be filled
5541
0
    if (dict) {
5542
0
        Py_ssize_t pos = 0;
5543
0
        PyObject *key, *value;
5544
0
        while (PyDict_Next(dict, &pos, &key, &value)) {
5545
            // Mark fields or attributes that are found on the instance
5546
            // as non-mandatory. If they are not given in 'kwargs', they
5547
            // will be shallow-coied; otherwise, they would be replaced
5548
            // (not in this function).
5549
0
            if (PySet_Discard(expecting, key) < 0) {
5550
0
                Py_DECREF(expecting);
5551
0
                return -1;
5552
0
            }
5553
0
        }
5554
0
        if (attributes) {
5555
            // Some attributes may or may not be present at runtime.
5556
            // In particular, now that we checked whether 'kwargs'
5557
            // is correct or not, we allow any attribute to be missing.
5558
            //
5559
            // Note that fields must still be entirely determined when
5560
            // calling the constructor later.
5561
0
            PyObject *unused = PyObject_CallMethodOneArg(expecting,
5562
0
                                                         &_Py_ID(difference_update),
5563
0
                                                         attributes);
5564
0
            if (unused == NULL) {
5565
0
                Py_DECREF(expecting);
5566
0
                return -1;
5567
0
            }
5568
0
            Py_DECREF(unused);
5569
0
        }
5570
0
    }
5571
5572
    // Discard fields from 'expecting' that default to None
5573
0
    PyObject *field_types = NULL;
5574
0
    if (PyObject_GetOptionalAttr((PyObject*)Py_TYPE(self),
5575
0
                                 &_Py_ID(_field_types),
5576
0
                                 &field_types) < 0)
5577
0
    {
5578
0
        Py_DECREF(expecting);
5579
0
        return -1;
5580
0
    }
5581
0
    if (field_types != NULL) {
5582
0
        Py_ssize_t pos = 0;
5583
0
        PyObject *field_name, *field_type;
5584
0
        while (PyDict_Next(field_types, &pos, &field_name, &field_type)) {
5585
0
            if (_PyUnion_Check(field_type)) {
5586
                // optional field
5587
0
                if (PySet_Discard(expecting, field_name) < 0) {
5588
0
                    Py_DECREF(expecting);
5589
0
                    Py_DECREF(field_types);
5590
0
                    return -1;
5591
0
                }
5592
0
            }
5593
0
        }
5594
0
        Py_DECREF(field_types);
5595
0
    }
5596
5597
    // Now 'expecting' contains the fields or attributes
5598
    // that would not be filled inside ast_type_replace().
5599
0
    Py_ssize_t m = PySet_GET_SIZE(expecting);
5600
0
    if (m > 0) {
5601
0
        PyObject *names = PyList_New(m);
5602
0
        if (names == NULL) {
5603
0
            Py_DECREF(expecting);
5604
0
            return -1;
5605
0
        }
5606
0
        Py_ssize_t i = 0, pos = 0;
5607
0
        PyObject *item;
5608
0
        Py_hash_t hash;
5609
0
        while (_PySet_NextEntry(expecting, &pos, &item, &hash)) {
5610
0
            PyObject *name = PyObject_Repr(item);
5611
0
            if (name == NULL) {
5612
0
                Py_DECREF(expecting);
5613
0
                Py_DECREF(names);
5614
0
                return -1;
5615
0
            }
5616
            // steal the reference 'name'
5617
0
            PyList_SET_ITEM(names, i++, name);
5618
0
        }
5619
0
        Py_DECREF(expecting);
5620
0
        if (PyList_Sort(names) < 0) {
5621
0
            Py_DECREF(names);
5622
0
            return -1;
5623
0
        }
5624
0
        PyObject *sep = PyUnicode_FromString(", ");
5625
0
        if (sep == NULL) {
5626
0
            Py_DECREF(names);
5627
0
            return -1;
5628
0
        }
5629
0
        PyObject *str_names = PyUnicode_Join(sep, names);
5630
0
        Py_DECREF(sep);
5631
0
        Py_DECREF(names);
5632
0
        if (str_names == NULL) {
5633
0
            return -1;
5634
0
        }
5635
0
        PyErr_Format(PyExc_TypeError,
5636
0
                     "%.400s.__replace__ missing %ld keyword argument%s: %U.",
5637
0
                     Py_TYPE(self)->tp_name, m, m == 1 ? "" : "s", str_names);
5638
0
        Py_DECREF(str_names);
5639
0
        return -1;
5640
0
    }
5641
0
    else {
5642
0
        Py_DECREF(expecting);
5643
0
        return 1;
5644
0
    }
5645
0
}
5646
5647
/*
5648
 * Python equivalent:
5649
 *
5650
 *   for key in keys:
5651
 *       if hasattr(self, key):
5652
 *           payload[key] = getattr(self, key)
5653
 *
5654
 * The 'keys' argument is a sequence corresponding to
5655
 * the '_fields' or the '_attributes' of an AST node.
5656
 *
5657
 * This returns -1 if an error occurs and 0 otherwise.
5658
 *
5659
 * Parameters
5660
 *
5661
 *      payload   A dictionary to fill.
5662
 *      keys      A sequence of keys or NULL for an empty sequence.
5663
 *      dict      The AST node instance dictionary (must not be NULL).
5664
 */
5665
static inline int
5666
ast_type_replace_update_payload(PyObject *payload,
5667
                                PyObject *keys,
5668
                                PyObject *dict)
5669
0
{
5670
0
    assert(dict != NULL);
5671
0
    if (keys == NULL) {
5672
0
        return 0;
5673
0
    }
5674
0
    Py_ssize_t n = PySequence_Size(keys);
5675
0
    if (n == -1) {
5676
0
        return -1;
5677
0
    }
5678
0
    for (Py_ssize_t i = 0; i < n; i++) {
5679
0
        PyObject *key = PySequence_GetItem(keys, i);
5680
0
        if (key == NULL) {
5681
0
            return -1;
5682
0
        }
5683
0
        PyObject *value;
5684
0
        if (PyDict_GetItemRef(dict, key, &value) < 0) {
5685
0
            Py_DECREF(key);
5686
0
            return -1;
5687
0
        }
5688
0
        if (value == NULL) {
5689
0
            Py_DECREF(key);
5690
            // If a field or attribute is not present at runtime, it should
5691
            // be explicitly given in 'kwargs'. If not, the constructor will
5692
            // issue a warning (which becomes an error in 3.15).
5693
0
            continue;
5694
0
        }
5695
0
        int rc = PyDict_SetItem(payload, key, value);
5696
0
        Py_DECREF(key);
5697
0
        Py_DECREF(value);
5698
0
        if (rc < 0) {
5699
0
            return -1;
5700
0
        }
5701
0
    }
5702
0
    return 0;
5703
0
}
5704
5705
/* copy.replace() support (shallow copy) */
5706
static PyObject *
5707
ast_type_replace(PyObject *self, PyObject *args, PyObject *kwargs)
5708
0
{
5709
0
    if (!_PyArg_NoPositional("__replace__", args)) {
5710
0
        return NULL;
5711
0
    }
5712
5713
0
    struct ast_state *state = get_ast_state();
5714
0
    if (state == NULL) {
5715
0
        return NULL;
5716
0
    }
5717
5718
0
    PyObject *result = NULL;
5719
    // known AST class fields and attributes
5720
0
    PyObject *fields = NULL, *attributes = NULL;
5721
    // current instance dictionary
5722
0
    PyObject *dict = NULL;
5723
    // constructor positional and keyword arguments
5724
0
    PyObject *empty_tuple = NULL, *payload = NULL;
5725
5726
0
    PyObject *type = (PyObject *)Py_TYPE(self);
5727
0
    if (PyObject_GetOptionalAttr(type, state->_fields, &fields) < 0) {
5728
0
        goto cleanup;
5729
0
    }
5730
0
    if (PyObject_GetOptionalAttr(type, state->_attributes, &attributes) < 0) {
5731
0
        goto cleanup;
5732
0
    }
5733
0
    if (PyObject_GetOptionalAttr(self, state->__dict__, &dict) < 0) {
5734
0
        goto cleanup;
5735
0
    }
5736
0
    if (ast_type_replace_check(self, dict, fields, attributes, kwargs) < 0) {
5737
0
        goto cleanup;
5738
0
    }
5739
0
    empty_tuple = PyTuple_New(0);
5740
0
    if (empty_tuple == NULL) {
5741
0
        goto cleanup;
5742
0
    }
5743
0
    payload = PyDict_New();
5744
0
    if (payload == NULL) {
5745
0
        goto cleanup;
5746
0
    }
5747
0
    if (dict) { // in case __dict__ is missing (for some obscure reason)
5748
        // copy the instance's fields (possibly NULL)
5749
0
        if (ast_type_replace_update_payload(payload, fields, dict) < 0) {
5750
0
            goto cleanup;
5751
0
        }
5752
        // copy the instance's attributes (possibly NULL)
5753
0
        if (ast_type_replace_update_payload(payload, attributes, dict) < 0) {
5754
0
            goto cleanup;
5755
0
        }
5756
0
    }
5757
0
    if (kwargs && PyDict_Update(payload, kwargs) < 0) {
5758
0
        goto cleanup;
5759
0
    }
5760
0
    result = PyObject_Call(type, empty_tuple, payload);
5761
0
cleanup:
5762
0
    Py_XDECREF(payload);
5763
0
    Py_XDECREF(empty_tuple);
5764
0
    Py_XDECREF(dict);
5765
0
    Py_XDECREF(attributes);
5766
0
    Py_XDECREF(fields);
5767
0
    return result;
5768
0
}
5769
5770
static PyMemberDef ast_type_members[] = {
5771
    {"__dictoffset__", Py_T_PYSSIZET, offsetof(AST_object, dict), Py_READONLY},
5772
    {NULL}  /* Sentinel */
5773
};
5774
5775
static PyMethodDef ast_type_methods[] = {
5776
    {"__reduce__", ast_type_reduce, METH_NOARGS, NULL},
5777
    {"__replace__", _PyCFunction_CAST(ast_type_replace), METH_VARARGS | METH_KEYWORDS,
5778
     PyDoc_STR("__replace__($self, /, **fields)\n--\n\n"
5779
               "Return a copy of the AST node with new values "
5780
               "for the specified fields.")},
5781
    {NULL}
5782
};
5783
5784
static PyGetSetDef ast_type_getsets[] = {
5785
    {"__dict__", PyObject_GenericGetDict, PyObject_GenericSetDict},
5786
    {NULL}
5787
};
5788
5789
static PyObject *
5790
ast_repr_max_depth(AST_object *self, int depth);
5791
5792
/* Format list and tuple properties of AST nodes.
5793
   Note that, only the first and last elements are shown.
5794
   Anything in between is represented with an ellipsis ('...').
5795
   For example, the list [1, 2, 3] is formatted as
5796
   'List(elts=[Constant(1), ..., Constant(3)])'. */
5797
static PyObject *
5798
ast_repr_list(PyObject *list, int depth)
5799
0
{
5800
0
    assert(PyList_Check(list) || PyTuple_Check(list));
5801
5802
0
    struct ast_state *state = get_ast_state();
5803
0
    if (state == NULL) {
5804
0
        return NULL;
5805
0
    }
5806
5807
0
    Py_ssize_t length = PySequence_Size(list);
5808
0
    if (length < 0) {
5809
0
        return NULL;
5810
0
    }
5811
0
    else if (length == 0) {
5812
0
        return PyObject_Repr(list);
5813
0
    }
5814
5815
0
    PyObject *items[2] = {NULL, NULL};
5816
0
    PyUnicodeWriter *writer = PyUnicodeWriter_Create(0);
5817
0
    if (writer == NULL) {
5818
0
        goto error;
5819
0
    }
5820
5821
0
    items[0] = PySequence_GetItem(list, 0);
5822
0
    if (!items[0]) {
5823
0
        goto error;
5824
0
    }
5825
0
    if (length > 1) {
5826
0
        items[1] = PySequence_GetItem(list, length - 1);
5827
0
        if (!items[1]) {
5828
0
            goto error;
5829
0
        }
5830
0
    }
5831
5832
0
    bool is_list = PyList_Check(list);
5833
0
    if (PyUnicodeWriter_WriteChar(writer, is_list ? '[' : '(') < 0) {
5834
0
        goto error;
5835
0
    }
5836
5837
0
    for (Py_ssize_t i = 0; i < Py_MIN(length, 2); i++) {
5838
0
        if (i > 0) {
5839
0
            if (PyUnicodeWriter_WriteASCII(writer, ", ", 2) < 0) {
5840
0
                goto error;
5841
0
            }
5842
0
        }
5843
5844
0
        PyObject *item = items[i];
5845
0
        if (PyType_IsSubtype(Py_TYPE(item), (PyTypeObject *)state->AST_type)) {
5846
0
            PyObject *item_repr;
5847
0
            item_repr = ast_repr_max_depth((AST_object*)item, depth - 1);
5848
0
            if (!item_repr) {
5849
0
                goto error;
5850
0
            }
5851
0
            if (PyUnicodeWriter_WriteStr(writer, item_repr) < 0) {
5852
0
                Py_DECREF(item_repr);
5853
0
                goto error;
5854
0
            }
5855
0
            Py_DECREF(item_repr);
5856
0
        } else {
5857
0
            if (PyUnicodeWriter_WriteRepr(writer, item) < 0) {
5858
0
                goto error;
5859
0
            }
5860
0
        }
5861
5862
0
        if (i == 0 && length > 2) {
5863
0
            if (PyUnicodeWriter_WriteASCII(writer, ", ...", 5) < 0) {
5864
0
                goto error;
5865
0
            }
5866
0
        }
5867
0
    }
5868
5869
0
    if (PyUnicodeWriter_WriteChar(writer, is_list ? ']' : ')') < 0) {
5870
0
        goto error;
5871
0
    }
5872
5873
0
    Py_XDECREF(items[0]);
5874
0
    Py_XDECREF(items[1]);
5875
0
    return PyUnicodeWriter_Finish(writer);
5876
5877
0
error:
5878
0
    Py_XDECREF(items[0]);
5879
0
    Py_XDECREF(items[1]);
5880
0
    PyUnicodeWriter_Discard(writer);
5881
0
    return NULL;
5882
0
}
5883
5884
static PyObject *
5885
ast_repr_max_depth(AST_object *self, int depth)
5886
20
{
5887
20
    struct ast_state *state = get_ast_state();
5888
20
    if (state == NULL) {
5889
0
        return NULL;
5890
0
    }
5891
5892
20
    if (depth <= 0) {
5893
0
        return PyUnicode_FromFormat("%s(...)", Py_TYPE(self)->tp_name);
5894
0
    }
5895
5896
20
    int status = Py_ReprEnter((PyObject *)self);
5897
20
    if (status != 0) {
5898
0
        if (status < 0) {
5899
0
            return NULL;
5900
0
        }
5901
0
        return PyUnicode_FromFormat("%s(...)", Py_TYPE(self)->tp_name);
5902
0
    }
5903
5904
20
    PyObject *fields;
5905
20
    if (PyObject_GetOptionalAttr((PyObject *)Py_TYPE(self), state->_fields, &fields) < 0) {
5906
0
        Py_ReprLeave((PyObject *)self);
5907
0
        return NULL;
5908
0
    }
5909
5910
20
    Py_ssize_t numfields = PySequence_Size(fields);
5911
20
    if (numfields < 0) {
5912
0
        Py_ReprLeave((PyObject *)self);
5913
0
        Py_DECREF(fields);
5914
0
        return NULL;
5915
0
    }
5916
5917
20
    if (numfields == 0) {
5918
9
        Py_ReprLeave((PyObject *)self);
5919
9
        Py_DECREF(fields);
5920
9
        return PyUnicode_FromFormat("%s()", Py_TYPE(self)->tp_name);
5921
9
    }
5922
5923
11
    const char* tp_name = Py_TYPE(self)->tp_name;
5924
11
    PyUnicodeWriter *writer = PyUnicodeWriter_Create(0);
5925
11
    if (writer == NULL) {
5926
0
        goto error;
5927
0
    }
5928
5929
11
    if (PyUnicodeWriter_WriteUTF8(writer, tp_name, -1) < 0) {
5930
0
        goto error;
5931
0
    }
5932
11
    if (PyUnicodeWriter_WriteChar(writer, '(') < 0) {
5933
0
        goto error;
5934
0
    }
5935
5936
35
    for (Py_ssize_t i = 0; i < numfields; i++) {
5937
24
        PyObject *name = PySequence_GetItem(fields, i);
5938
24
        if (!name) {
5939
0
            goto error;
5940
0
        }
5941
5942
24
        PyObject *value = PyObject_GetAttr((PyObject *)self, name);
5943
24
        if (!value) {
5944
0
            Py_DECREF(name);
5945
0
            goto error;
5946
0
        }
5947
5948
24
        PyObject *value_repr;
5949
24
        if (PyList_Check(value) || PyTuple_Check(value)) {
5950
0
            value_repr = ast_repr_list(value, depth);
5951
0
        }
5952
24
        else if (PyType_IsSubtype(Py_TYPE(value), (PyTypeObject *)state->AST_type)) {
5953
13
            value_repr = ast_repr_max_depth((AST_object*)value, depth - 1);
5954
13
        }
5955
11
        else {
5956
11
            value_repr = PyObject_Repr(value);
5957
11
        }
5958
5959
24
        Py_DECREF(value);
5960
5961
24
        if (!value_repr) {
5962
0
            Py_DECREF(name);
5963
0
            goto error;
5964
0
        }
5965
5966
24
        if (i > 0) {
5967
13
            if (PyUnicodeWriter_WriteASCII(writer, ", ", 2) < 0) {
5968
0
                Py_DECREF(name);
5969
0
                Py_DECREF(value_repr);
5970
0
                goto error;
5971
0
            }
5972
13
        }
5973
24
        if (PyUnicodeWriter_WriteStr(writer, name) < 0) {
5974
0
            Py_DECREF(name);
5975
0
            Py_DECREF(value_repr);
5976
0
            goto error;
5977
0
        }
5978
5979
24
        Py_DECREF(name);
5980
5981
24
        if (PyUnicodeWriter_WriteChar(writer, '=') < 0) {
5982
0
            Py_DECREF(value_repr);
5983
0
            goto error;
5984
0
        }
5985
24
        if (PyUnicodeWriter_WriteStr(writer, value_repr) < 0) {
5986
0
            Py_DECREF(value_repr);
5987
0
            goto error;
5988
0
        }
5989
5990
24
        Py_DECREF(value_repr);
5991
24
    }
5992
5993
11
    if (PyUnicodeWriter_WriteChar(writer, ')') < 0) {
5994
0
        goto error;
5995
0
    }
5996
11
    Py_ReprLeave((PyObject *)self);
5997
11
    Py_DECREF(fields);
5998
11
    return PyUnicodeWriter_Finish(writer);
5999
6000
0
error:
6001
0
    Py_ReprLeave((PyObject *)self);
6002
0
    Py_DECREF(fields);
6003
0
    PyUnicodeWriter_Discard(writer);
6004
0
    return NULL;
6005
11
}
6006
6007
static PyObject *
6008
ast_repr(PyObject *self)
6009
7
{
6010
7
    return ast_repr_max_depth((AST_object*)self, 3);
6011
7
}
6012
6013
static PyType_Slot AST_type_slots[] = {
6014
    {Py_tp_dealloc, ast_dealloc},
6015
    {Py_tp_repr, ast_repr},
6016
    {Py_tp_getattro, PyObject_GenericGetAttr},
6017
    {Py_tp_setattro, PyObject_GenericSetAttr},
6018
    {Py_tp_traverse, ast_traverse},
6019
    {Py_tp_clear, ast_clear},
6020
    {Py_tp_members, ast_type_members},
6021
    {Py_tp_methods, ast_type_methods},
6022
    {Py_tp_getset, ast_type_getsets},
6023
    {Py_tp_init, ast_type_init},
6024
    {Py_tp_alloc, PyType_GenericAlloc},
6025
    {Py_tp_new, PyType_GenericNew},
6026
    {Py_tp_free, PyObject_GC_Del},
6027
    {0, 0},
6028
};
6029
6030
static PyType_Spec AST_type_spec = {
6031
    "ast.AST",
6032
    sizeof(AST_object),
6033
    0,
6034
    Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_HAVE_GC,
6035
    AST_type_slots
6036
};
6037
6038
static PyObject *
6039
make_type(struct ast_state *state, const char *type, PyObject* base,
6040
          const char* const* fields, int num_fields, const char *doc)
6041
250
{
6042
250
    PyObject *fnames, *result;
6043
250
    int i;
6044
250
    fnames = PyTuple_New(num_fields);
6045
250
    if (!fnames) return NULL;
6046
646
    for (i = 0; i < num_fields; i++) {
6047
396
        PyObject *field = PyUnicode_InternFromString(fields[i]);
6048
396
        if (!field) {
6049
0
            Py_DECREF(fnames);
6050
0
            return NULL;
6051
0
        }
6052
396
        PyTuple_SET_ITEM(fnames, i, field);
6053
396
    }
6054
250
    result = PyObject_CallFunction((PyObject*)&PyType_Type, "s(O){OOOOOOOs}",
6055
250
                    type, base,
6056
250
                    state->_fields, fnames,
6057
250
                    state->__match_args__, fnames,
6058
250
                    state->__module__,
6059
250
                    state->ast,
6060
250
                    state->__doc__, doc);
6061
250
    Py_DECREF(fnames);
6062
250
    return result;
6063
250
}
6064
6065
static int
6066
add_attributes(struct ast_state *state, PyObject *type, const char * const *attrs, int num_fields)
6067
38
{
6068
38
    int i, result;
6069
38
    PyObject *s, *l = PyTuple_New(num_fields);
6070
38
    if (!l)
6071
0
        return -1;
6072
102
    for (i = 0; i < num_fields; i++) {
6073
64
        s = PyUnicode_InternFromString(attrs[i]);
6074
64
        if (!s) {
6075
0
            Py_DECREF(l);
6076
0
            return -1;
6077
0
        }
6078
64
        PyTuple_SET_ITEM(l, i, s);
6079
64
    }
6080
38
    result = PyObject_SetAttr(type, state->_attributes, l);
6081
38
    Py_DECREF(l);
6082
38
    return result;
6083
38
}
6084
6085
/* Conversion AST -> Python */
6086
6087
static PyObject* ast2obj_list(struct ast_state *state, asdl_seq *seq,
6088
                              PyObject* (*func)(struct ast_state *state, void*))
6089
56.8k
{
6090
56.8k
    Py_ssize_t i, n = asdl_seq_LEN(seq);
6091
56.8k
    PyObject *result = PyList_New(n);
6092
56.8k
    PyObject *value;
6093
56.8k
    if (!result)
6094
0
        return NULL;
6095
129k
    for (i = 0; i < n; i++) {
6096
72.2k
        value = func(state, asdl_seq_GET_UNTYPED(seq, i));
6097
72.2k
        if (!value) {
6098
0
            Py_DECREF(result);
6099
0
            return NULL;
6100
0
        }
6101
72.2k
        PyList_SET_ITEM(result, i, value);
6102
72.2k
    }
6103
56.8k
    return result;
6104
56.8k
}
6105
6106
static PyObject* ast2obj_object(struct ast_state *Py_UNUSED(state), void *o)
6107
206k
{
6108
206k
    PyObject *op = (PyObject*)o;
6109
206k
    if (!op) {
6110
73.0k
        op = Py_None;
6111
73.0k
    }
6112
206k
    return Py_NewRef(op);
6113
206k
}
6114
64.3k
#define ast2obj_constant ast2obj_object
6115
72.8k
#define ast2obj_identifier ast2obj_object
6116
68.7k
#define ast2obj_string ast2obj_object
6117
6118
static PyObject* ast2obj_int(struct ast_state *Py_UNUSED(state), long b)
6119
1.05M
{
6120
1.05M
    return PyLong_FromLong(b);
6121
1.05M
}
6122
6123
/* Conversion Python -> AST */
6124
6125
static int obj2ast_object(struct ast_state *Py_UNUSED(state), PyObject* obj, PyObject** out, PyArena* arena)
6126
0
{
6127
0
    if (obj == Py_None)
6128
0
        obj = NULL;
6129
0
    if (obj) {
6130
0
        if (_PyArena_AddPyObject(arena, obj) < 0) {
6131
0
            *out = NULL;
6132
0
            return -1;
6133
0
        }
6134
0
        *out = Py_NewRef(obj);
6135
0
    }
6136
0
    else {
6137
0
        *out = NULL;
6138
0
    }
6139
0
    return 0;
6140
0
}
6141
6142
static int obj2ast_constant(struct ast_state *Py_UNUSED(state), PyObject* obj, PyObject** out, PyArena* arena)
6143
0
{
6144
0
    if (_PyArena_AddPyObject(arena, obj) < 0) {
6145
0
        *out = NULL;
6146
0
        return -1;
6147
0
    }
6148
0
    *out = Py_NewRef(obj);
6149
0
    return 0;
6150
0
}
6151
6152
static int obj2ast_identifier(struct ast_state *state, PyObject* obj, PyObject** out, PyArena* arena)
6153
0
{
6154
0
    if (!PyUnicode_CheckExact(obj) && obj != Py_None) {
6155
0
        PyErr_SetString(PyExc_TypeError, "AST identifier must be of type str");
6156
0
        return -1;
6157
0
    }
6158
0
    return obj2ast_object(state, obj, out, arena);
6159
0
}
6160
6161
static int obj2ast_string(struct ast_state *state, PyObject* obj, PyObject** out, PyArena* arena)
6162
0
{
6163
0
    if (!PyUnicode_CheckExact(obj) && !PyBytes_CheckExact(obj)) {
6164
0
        PyErr_SetString(PyExc_TypeError, "AST string must be of type str");
6165
0
        return -1;
6166
0
    }
6167
0
    return obj2ast_object(state, obj, out, arena);
6168
0
}
6169
6170
static int obj2ast_int(struct ast_state* Py_UNUSED(state), PyObject* obj, int* out, PyArena* arena)
6171
0
{
6172
0
    int i;
6173
0
    if (!PyLong_Check(obj)) {
6174
0
        PyErr_Format(PyExc_ValueError, "invalid integer value: %R", obj);
6175
0
        return -1;
6176
0
    }
6177
6178
0
    i = PyLong_AsInt(obj);
6179
0
    if (i == -1 && PyErr_Occurred())
6180
0
        return -1;
6181
0
    *out = i;
6182
0
    return 0;
6183
0
}
6184
6185
static int add_ast_fields(struct ast_state *state)
6186
2
{
6187
2
    PyObject *empty_tuple;
6188
2
    empty_tuple = PyTuple_New(0);
6189
2
    if (!empty_tuple ||
6190
2
        PyObject_SetAttrString(state->AST_type, "_fields", empty_tuple) < 0 ||
6191
2
        PyObject_SetAttrString(state->AST_type, "__match_args__", empty_tuple) < 0 ||
6192
2
        PyObject_SetAttrString(state->AST_type, "_attributes", empty_tuple) < 0) {
6193
0
        Py_XDECREF(empty_tuple);
6194
0
        return -1;
6195
0
    }
6196
2
    Py_DECREF(empty_tuple);
6197
2
    return 0;
6198
2
}
6199
6200
6201
6202
static int
6203
init_types(void *arg)
6204
2
{
6205
2
    struct ast_state *state = arg;
6206
2
    if (init_identifiers(state) < 0) {
6207
0
        return -1;
6208
0
    }
6209
2
    state->AST_type = PyType_FromSpec(&AST_type_spec);
6210
2
    if (!state->AST_type) {
6211
0
        return -1;
6212
0
    }
6213
2
    if (add_ast_fields(state) < 0) {
6214
0
        return -1;
6215
0
    }
6216
2
    state->mod_type = make_type(state, "mod", state->AST_type, NULL, 0,
6217
2
        "mod = Module(stmt* body, type_ignore* type_ignores)\n"
6218
2
        "    | Interactive(stmt* body)\n"
6219
2
        "    | Expression(expr body)\n"
6220
2
        "    | FunctionType(expr* argtypes, expr returns)");
6221
2
    if (!state->mod_type) return -1;
6222
2
    if (add_attributes(state, state->mod_type, NULL, 0) < 0) return -1;
6223
2
    state->Module_type = make_type(state, "Module", state->mod_type,
6224
2
                                   Module_fields, 2,
6225
2
        "Module(stmt* body, type_ignore* type_ignores)");
6226
2
    if (!state->Module_type) return -1;
6227
2
    state->Interactive_type = make_type(state, "Interactive", state->mod_type,
6228
2
                                        Interactive_fields, 1,
6229
2
        "Interactive(stmt* body)");
6230
2
    if (!state->Interactive_type) return -1;
6231
2
    state->Expression_type = make_type(state, "Expression", state->mod_type,
6232
2
                                       Expression_fields, 1,
6233
2
        "Expression(expr body)");
6234
2
    if (!state->Expression_type) return -1;
6235
2
    state->FunctionType_type = make_type(state, "FunctionType",
6236
2
                                         state->mod_type, FunctionType_fields,
6237
2
                                         2,
6238
2
        "FunctionType(expr* argtypes, expr returns)");
6239
2
    if (!state->FunctionType_type) return -1;
6240
2
    state->stmt_type = make_type(state, "stmt", state->AST_type, NULL, 0,
6241
2
        "stmt = FunctionDef(identifier name, arguments args, stmt* body, expr* decorator_list, expr? returns, string? type_comment, type_param* type_params)\n"
6242
2
        "     | AsyncFunctionDef(identifier name, arguments args, stmt* body, expr* decorator_list, expr? returns, string? type_comment, type_param* type_params)\n"
6243
2
        "     | ClassDef(identifier name, expr* bases, keyword* keywords, stmt* body, expr* decorator_list, type_param* type_params)\n"
6244
2
        "     | Return(expr? value)\n"
6245
2
        "     | Delete(expr* targets)\n"
6246
2
        "     | Assign(expr* targets, expr value, string? type_comment)\n"
6247
2
        "     | TypeAlias(expr name, type_param* type_params, expr value)\n"
6248
2
        "     | AugAssign(expr target, operator op, expr value)\n"
6249
2
        "     | AnnAssign(expr target, expr annotation, expr? value, int simple)\n"
6250
2
        "     | For(expr target, expr iter, stmt* body, stmt* orelse, string? type_comment)\n"
6251
2
        "     | AsyncFor(expr target, expr iter, stmt* body, stmt* orelse, string? type_comment)\n"
6252
2
        "     | While(expr test, stmt* body, stmt* orelse)\n"
6253
2
        "     | If(expr test, stmt* body, stmt* orelse)\n"
6254
2
        "     | With(withitem* items, stmt* body, string? type_comment)\n"
6255
2
        "     | AsyncWith(withitem* items, stmt* body, string? type_comment)\n"
6256
2
        "     | Match(expr subject, match_case* cases)\n"
6257
2
        "     | Raise(expr? exc, expr? cause)\n"
6258
2
        "     | Try(stmt* body, excepthandler* handlers, stmt* orelse, stmt* finalbody)\n"
6259
2
        "     | TryStar(stmt* body, excepthandler* handlers, stmt* orelse, stmt* finalbody)\n"
6260
2
        "     | Assert(expr test, expr? msg)\n"
6261
2
        "     | Import(alias* names, int? is_lazy)\n"
6262
2
        "     | ImportFrom(identifier? module, alias* names, int? level, int? is_lazy)\n"
6263
2
        "     | Global(identifier* names)\n"
6264
2
        "     | Nonlocal(identifier* names)\n"
6265
2
        "     | Expr(expr value)\n"
6266
2
        "     | Pass\n"
6267
2
        "     | Break\n"
6268
2
        "     | Continue");
6269
2
    if (!state->stmt_type) return -1;
6270
2
    if (add_attributes(state, state->stmt_type, stmt_attributes, 4) < 0) return
6271
0
        -1;
6272
2
    if (PyObject_SetAttr(state->stmt_type, state->end_lineno, Py_None) == -1)
6273
0
        return -1;
6274
2
    if (PyObject_SetAttr(state->stmt_type, state->end_col_offset, Py_None) ==
6275
2
        -1)
6276
0
        return -1;
6277
2
    state->FunctionDef_type = make_type(state, "FunctionDef", state->stmt_type,
6278
2
                                        FunctionDef_fields, 7,
6279
2
        "FunctionDef(identifier name, arguments args, stmt* body, expr* decorator_list, expr? returns, string? type_comment, type_param* type_params)");
6280
2
    if (!state->FunctionDef_type) return -1;
6281
2
    if (PyObject_SetAttr(state->FunctionDef_type, state->returns, Py_None) ==
6282
2
        -1)
6283
0
        return -1;
6284
2
    if (PyObject_SetAttr(state->FunctionDef_type, state->type_comment, Py_None)
6285
2
        == -1)
6286
0
        return -1;
6287
2
    state->AsyncFunctionDef_type = make_type(state, "AsyncFunctionDef",
6288
2
                                             state->stmt_type,
6289
2
                                             AsyncFunctionDef_fields, 7,
6290
2
        "AsyncFunctionDef(identifier name, arguments args, stmt* body, expr* decorator_list, expr? returns, string? type_comment, type_param* type_params)");
6291
2
    if (!state->AsyncFunctionDef_type) return -1;
6292
2
    if (PyObject_SetAttr(state->AsyncFunctionDef_type, state->returns, Py_None)
6293
2
        == -1)
6294
0
        return -1;
6295
2
    if (PyObject_SetAttr(state->AsyncFunctionDef_type, state->type_comment,
6296
2
        Py_None) == -1)
6297
0
        return -1;
6298
2
    state->ClassDef_type = make_type(state, "ClassDef", state->stmt_type,
6299
2
                                     ClassDef_fields, 6,
6300
2
        "ClassDef(identifier name, expr* bases, keyword* keywords, stmt* body, expr* decorator_list, type_param* type_params)");
6301
2
    if (!state->ClassDef_type) return -1;
6302
2
    state->Return_type = make_type(state, "Return", state->stmt_type,
6303
2
                                   Return_fields, 1,
6304
2
        "Return(expr? value)");
6305
2
    if (!state->Return_type) return -1;
6306
2
    if (PyObject_SetAttr(state->Return_type, state->value, Py_None) == -1)
6307
0
        return -1;
6308
2
    state->Delete_type = make_type(state, "Delete", state->stmt_type,
6309
2
                                   Delete_fields, 1,
6310
2
        "Delete(expr* targets)");
6311
2
    if (!state->Delete_type) return -1;
6312
2
    state->Assign_type = make_type(state, "Assign", state->stmt_type,
6313
2
                                   Assign_fields, 3,
6314
2
        "Assign(expr* targets, expr value, string? type_comment)");
6315
2
    if (!state->Assign_type) return -1;
6316
2
    if (PyObject_SetAttr(state->Assign_type, state->type_comment, Py_None) ==
6317
2
        -1)
6318
0
        return -1;
6319
2
    state->TypeAlias_type = make_type(state, "TypeAlias", state->stmt_type,
6320
2
                                      TypeAlias_fields, 3,
6321
2
        "TypeAlias(expr name, type_param* type_params, expr value)");
6322
2
    if (!state->TypeAlias_type) return -1;
6323
2
    state->AugAssign_type = make_type(state, "AugAssign", state->stmt_type,
6324
2
                                      AugAssign_fields, 3,
6325
2
        "AugAssign(expr target, operator op, expr value)");
6326
2
    if (!state->AugAssign_type) return -1;
6327
2
    state->AnnAssign_type = make_type(state, "AnnAssign", state->stmt_type,
6328
2
                                      AnnAssign_fields, 4,
6329
2
        "AnnAssign(expr target, expr annotation, expr? value, int simple)");
6330
2
    if (!state->AnnAssign_type) return -1;
6331
2
    if (PyObject_SetAttr(state->AnnAssign_type, state->value, Py_None) == -1)
6332
0
        return -1;
6333
2
    state->For_type = make_type(state, "For", state->stmt_type, For_fields, 5,
6334
2
        "For(expr target, expr iter, stmt* body, stmt* orelse, string? type_comment)");
6335
2
    if (!state->For_type) return -1;
6336
2
    if (PyObject_SetAttr(state->For_type, state->type_comment, Py_None) == -1)
6337
0
        return -1;
6338
2
    state->AsyncFor_type = make_type(state, "AsyncFor", state->stmt_type,
6339
2
                                     AsyncFor_fields, 5,
6340
2
        "AsyncFor(expr target, expr iter, stmt* body, stmt* orelse, string? type_comment)");
6341
2
    if (!state->AsyncFor_type) return -1;
6342
2
    if (PyObject_SetAttr(state->AsyncFor_type, state->type_comment, Py_None) ==
6343
2
        -1)
6344
0
        return -1;
6345
2
    state->While_type = make_type(state, "While", state->stmt_type,
6346
2
                                  While_fields, 3,
6347
2
        "While(expr test, stmt* body, stmt* orelse)");
6348
2
    if (!state->While_type) return -1;
6349
2
    state->If_type = make_type(state, "If", state->stmt_type, If_fields, 3,
6350
2
        "If(expr test, stmt* body, stmt* orelse)");
6351
2
    if (!state->If_type) return -1;
6352
2
    state->With_type = make_type(state, "With", state->stmt_type, With_fields,
6353
2
                                 3,
6354
2
        "With(withitem* items, stmt* body, string? type_comment)");
6355
2
    if (!state->With_type) return -1;
6356
2
    if (PyObject_SetAttr(state->With_type, state->type_comment, Py_None) == -1)
6357
0
        return -1;
6358
2
    state->AsyncWith_type = make_type(state, "AsyncWith", state->stmt_type,
6359
2
                                      AsyncWith_fields, 3,
6360
2
        "AsyncWith(withitem* items, stmt* body, string? type_comment)");
6361
2
    if (!state->AsyncWith_type) return -1;
6362
2
    if (PyObject_SetAttr(state->AsyncWith_type, state->type_comment, Py_None)
6363
2
        == -1)
6364
0
        return -1;
6365
2
    state->Match_type = make_type(state, "Match", state->stmt_type,
6366
2
                                  Match_fields, 2,
6367
2
        "Match(expr subject, match_case* cases)");
6368
2
    if (!state->Match_type) return -1;
6369
2
    state->Raise_type = make_type(state, "Raise", state->stmt_type,
6370
2
                                  Raise_fields, 2,
6371
2
        "Raise(expr? exc, expr? cause)");
6372
2
    if (!state->Raise_type) return -1;
6373
2
    if (PyObject_SetAttr(state->Raise_type, state->exc, Py_None) == -1)
6374
0
        return -1;
6375
2
    if (PyObject_SetAttr(state->Raise_type, state->cause, Py_None) == -1)
6376
0
        return -1;
6377
2
    state->Try_type = make_type(state, "Try", state->stmt_type, Try_fields, 4,
6378
2
        "Try(stmt* body, excepthandler* handlers, stmt* orelse, stmt* finalbody)");
6379
2
    if (!state->Try_type) return -1;
6380
2
    state->TryStar_type = make_type(state, "TryStar", state->stmt_type,
6381
2
                                    TryStar_fields, 4,
6382
2
        "TryStar(stmt* body, excepthandler* handlers, stmt* orelse, stmt* finalbody)");
6383
2
    if (!state->TryStar_type) return -1;
6384
2
    state->Assert_type = make_type(state, "Assert", state->stmt_type,
6385
2
                                   Assert_fields, 2,
6386
2
        "Assert(expr test, expr? msg)");
6387
2
    if (!state->Assert_type) return -1;
6388
2
    if (PyObject_SetAttr(state->Assert_type, state->msg, Py_None) == -1)
6389
0
        return -1;
6390
2
    state->Import_type = make_type(state, "Import", state->stmt_type,
6391
2
                                   Import_fields, 2,
6392
2
        "Import(alias* names, int? is_lazy)");
6393
2
    if (!state->Import_type) return -1;
6394
2
    if (PyObject_SetAttr(state->Import_type, state->is_lazy, Py_None) == -1)
6395
0
        return -1;
6396
2
    state->ImportFrom_type = make_type(state, "ImportFrom", state->stmt_type,
6397
2
                                       ImportFrom_fields, 4,
6398
2
        "ImportFrom(identifier? module, alias* names, int? level, int? is_lazy)");
6399
2
    if (!state->ImportFrom_type) return -1;
6400
2
    if (PyObject_SetAttr(state->ImportFrom_type, state->module, Py_None) == -1)
6401
0
        return -1;
6402
2
    if (PyObject_SetAttr(state->ImportFrom_type, state->level, Py_None) == -1)
6403
0
        return -1;
6404
2
    if (PyObject_SetAttr(state->ImportFrom_type, state->is_lazy, Py_None) == -1)
6405
0
        return -1;
6406
2
    state->Global_type = make_type(state, "Global", state->stmt_type,
6407
2
                                   Global_fields, 1,
6408
2
        "Global(identifier* names)");
6409
2
    if (!state->Global_type) return -1;
6410
2
    state->Nonlocal_type = make_type(state, "Nonlocal", state->stmt_type,
6411
2
                                     Nonlocal_fields, 1,
6412
2
        "Nonlocal(identifier* names)");
6413
2
    if (!state->Nonlocal_type) return -1;
6414
2
    state->Expr_type = make_type(state, "Expr", state->stmt_type, Expr_fields,
6415
2
                                 1,
6416
2
        "Expr(expr value)");
6417
2
    if (!state->Expr_type) return -1;
6418
2
    state->Pass_type = make_type(state, "Pass", state->stmt_type, NULL, 0,
6419
2
        "Pass");
6420
2
    if (!state->Pass_type) return -1;
6421
2
    state->Break_type = make_type(state, "Break", state->stmt_type, NULL, 0,
6422
2
        "Break");
6423
2
    if (!state->Break_type) return -1;
6424
2
    state->Continue_type = make_type(state, "Continue", state->stmt_type, NULL,
6425
2
                                     0,
6426
2
        "Continue");
6427
2
    if (!state->Continue_type) return -1;
6428
2
    state->expr_type = make_type(state, "expr", state->AST_type, NULL, 0,
6429
2
        "expr = BoolOp(boolop op, expr* values)\n"
6430
2
        "     | NamedExpr(expr target, expr value)\n"
6431
2
        "     | BinOp(expr left, operator op, expr right)\n"
6432
2
        "     | UnaryOp(unaryop op, expr operand)\n"
6433
2
        "     | Lambda(arguments args, expr body)\n"
6434
2
        "     | IfExp(expr test, expr body, expr orelse)\n"
6435
2
        "     | Dict(expr?* keys, expr* values)\n"
6436
2
        "     | Set(expr* elts)\n"
6437
2
        "     | ListComp(expr elt, comprehension* generators)\n"
6438
2
        "     | SetComp(expr elt, comprehension* generators)\n"
6439
2
        "     | DictComp(expr key, expr? value, comprehension* generators)\n"
6440
2
        "     | GeneratorExp(expr elt, comprehension* generators)\n"
6441
2
        "     | Await(expr value)\n"
6442
2
        "     | Yield(expr? value)\n"
6443
2
        "     | YieldFrom(expr value)\n"
6444
2
        "     | Compare(expr left, cmpop* ops, expr* comparators)\n"
6445
2
        "     | Call(expr func, expr* args, keyword* keywords)\n"
6446
2
        "     | FormattedValue(expr value, int conversion, expr? format_spec)\n"
6447
2
        "     | Interpolation(expr value, constant str, int conversion, expr? format_spec)\n"
6448
2
        "     | JoinedStr(expr* values)\n"
6449
2
        "     | TemplateStr(expr* values)\n"
6450
2
        "     | Constant(constant value, string? kind)\n"
6451
2
        "     | Attribute(expr value, identifier attr, expr_context ctx)\n"
6452
2
        "     | Subscript(expr value, expr slice, expr_context ctx)\n"
6453
2
        "     | Starred(expr value, expr_context ctx)\n"
6454
2
        "     | Name(identifier id, expr_context ctx)\n"
6455
2
        "     | List(expr* elts, expr_context ctx)\n"
6456
2
        "     | Tuple(expr* elts, expr_context ctx)\n"
6457
2
        "     | Slice(expr? lower, expr? upper, expr? step)");
6458
2
    if (!state->expr_type) return -1;
6459
2
    if (add_attributes(state, state->expr_type, expr_attributes, 4) < 0) return
6460
0
        -1;
6461
2
    if (PyObject_SetAttr(state->expr_type, state->end_lineno, Py_None) == -1)
6462
0
        return -1;
6463
2
    if (PyObject_SetAttr(state->expr_type, state->end_col_offset, Py_None) ==
6464
2
        -1)
6465
0
        return -1;
6466
2
    state->BoolOp_type = make_type(state, "BoolOp", state->expr_type,
6467
2
                                   BoolOp_fields, 2,
6468
2
        "BoolOp(boolop op, expr* values)");
6469
2
    if (!state->BoolOp_type) return -1;
6470
2
    state->NamedExpr_type = make_type(state, "NamedExpr", state->expr_type,
6471
2
                                      NamedExpr_fields, 2,
6472
2
        "NamedExpr(expr target, expr value)");
6473
2
    if (!state->NamedExpr_type) return -1;
6474
2
    state->BinOp_type = make_type(state, "BinOp", state->expr_type,
6475
2
                                  BinOp_fields, 3,
6476
2
        "BinOp(expr left, operator op, expr right)");
6477
2
    if (!state->BinOp_type) return -1;
6478
2
    state->UnaryOp_type = make_type(state, "UnaryOp", state->expr_type,
6479
2
                                    UnaryOp_fields, 2,
6480
2
        "UnaryOp(unaryop op, expr operand)");
6481
2
    if (!state->UnaryOp_type) return -1;
6482
2
    state->Lambda_type = make_type(state, "Lambda", state->expr_type,
6483
2
                                   Lambda_fields, 2,
6484
2
        "Lambda(arguments args, expr body)");
6485
2
    if (!state->Lambda_type) return -1;
6486
2
    state->IfExp_type = make_type(state, "IfExp", state->expr_type,
6487
2
                                  IfExp_fields, 3,
6488
2
        "IfExp(expr test, expr body, expr orelse)");
6489
2
    if (!state->IfExp_type) return -1;
6490
2
    state->Dict_type = make_type(state, "Dict", state->expr_type, Dict_fields,
6491
2
                                 2,
6492
2
        "Dict(expr?* keys, expr* values)");
6493
2
    if (!state->Dict_type) return -1;
6494
2
    state->Set_type = make_type(state, "Set", state->expr_type, Set_fields, 1,
6495
2
        "Set(expr* elts)");
6496
2
    if (!state->Set_type) return -1;
6497
2
    state->ListComp_type = make_type(state, "ListComp", state->expr_type,
6498
2
                                     ListComp_fields, 2,
6499
2
        "ListComp(expr elt, comprehension* generators)");
6500
2
    if (!state->ListComp_type) return -1;
6501
2
    state->SetComp_type = make_type(state, "SetComp", state->expr_type,
6502
2
                                    SetComp_fields, 2,
6503
2
        "SetComp(expr elt, comprehension* generators)");
6504
2
    if (!state->SetComp_type) return -1;
6505
2
    state->DictComp_type = make_type(state, "DictComp", state->expr_type,
6506
2
                                     DictComp_fields, 3,
6507
2
        "DictComp(expr key, expr? value, comprehension* generators)");
6508
2
    if (!state->DictComp_type) return -1;
6509
2
    if (PyObject_SetAttr(state->DictComp_type, state->value, Py_None) == -1)
6510
0
        return -1;
6511
2
    state->GeneratorExp_type = make_type(state, "GeneratorExp",
6512
2
                                         state->expr_type, GeneratorExp_fields,
6513
2
                                         2,
6514
2
        "GeneratorExp(expr elt, comprehension* generators)");
6515
2
    if (!state->GeneratorExp_type) return -1;
6516
2
    state->Await_type = make_type(state, "Await", state->expr_type,
6517
2
                                  Await_fields, 1,
6518
2
        "Await(expr value)");
6519
2
    if (!state->Await_type) return -1;
6520
2
    state->Yield_type = make_type(state, "Yield", state->expr_type,
6521
2
                                  Yield_fields, 1,
6522
2
        "Yield(expr? value)");
6523
2
    if (!state->Yield_type) return -1;
6524
2
    if (PyObject_SetAttr(state->Yield_type, state->value, Py_None) == -1)
6525
0
        return -1;
6526
2
    state->YieldFrom_type = make_type(state, "YieldFrom", state->expr_type,
6527
2
                                      YieldFrom_fields, 1,
6528
2
        "YieldFrom(expr value)");
6529
2
    if (!state->YieldFrom_type) return -1;
6530
2
    state->Compare_type = make_type(state, "Compare", state->expr_type,
6531
2
                                    Compare_fields, 3,
6532
2
        "Compare(expr left, cmpop* ops, expr* comparators)");
6533
2
    if (!state->Compare_type) return -1;
6534
2
    state->Call_type = make_type(state, "Call", state->expr_type, Call_fields,
6535
2
                                 3,
6536
2
        "Call(expr func, expr* args, keyword* keywords)");
6537
2
    if (!state->Call_type) return -1;
6538
2
    state->FormattedValue_type = make_type(state, "FormattedValue",
6539
2
                                           state->expr_type,
6540
2
                                           FormattedValue_fields, 3,
6541
2
        "FormattedValue(expr value, int conversion, expr? format_spec)");
6542
2
    if (!state->FormattedValue_type) return -1;
6543
2
    if (PyObject_SetAttr(state->FormattedValue_type, state->format_spec,
6544
2
        Py_None) == -1)
6545
0
        return -1;
6546
2
    state->Interpolation_type = make_type(state, "Interpolation",
6547
2
                                          state->expr_type,
6548
2
                                          Interpolation_fields, 4,
6549
2
        "Interpolation(expr value, constant str, int conversion, expr? format_spec)");
6550
2
    if (!state->Interpolation_type) return -1;
6551
2
    if (PyObject_SetAttr(state->Interpolation_type, state->format_spec,
6552
2
        Py_None) == -1)
6553
0
        return -1;
6554
2
    state->JoinedStr_type = make_type(state, "JoinedStr", state->expr_type,
6555
2
                                      JoinedStr_fields, 1,
6556
2
        "JoinedStr(expr* values)");
6557
2
    if (!state->JoinedStr_type) return -1;
6558
2
    state->TemplateStr_type = make_type(state, "TemplateStr", state->expr_type,
6559
2
                                        TemplateStr_fields, 1,
6560
2
        "TemplateStr(expr* values)");
6561
2
    if (!state->TemplateStr_type) return -1;
6562
2
    state->Constant_type = make_type(state, "Constant", state->expr_type,
6563
2
                                     Constant_fields, 2,
6564
2
        "Constant(constant value, string? kind)");
6565
2
    if (!state->Constant_type) return -1;
6566
2
    if (PyObject_SetAttr(state->Constant_type, state->kind, Py_None) == -1)
6567
0
        return -1;
6568
2
    state->Attribute_type = make_type(state, "Attribute", state->expr_type,
6569
2
                                      Attribute_fields, 3,
6570
2
        "Attribute(expr value, identifier attr, expr_context ctx)");
6571
2
    if (!state->Attribute_type) return -1;
6572
2
    state->Subscript_type = make_type(state, "Subscript", state->expr_type,
6573
2
                                      Subscript_fields, 3,
6574
2
        "Subscript(expr value, expr slice, expr_context ctx)");
6575
2
    if (!state->Subscript_type) return -1;
6576
2
    state->Starred_type = make_type(state, "Starred", state->expr_type,
6577
2
                                    Starred_fields, 2,
6578
2
        "Starred(expr value, expr_context ctx)");
6579
2
    if (!state->Starred_type) return -1;
6580
2
    state->Name_type = make_type(state, "Name", state->expr_type, Name_fields,
6581
2
                                 2,
6582
2
        "Name(identifier id, expr_context ctx)");
6583
2
    if (!state->Name_type) return -1;
6584
2
    state->List_type = make_type(state, "List", state->expr_type, List_fields,
6585
2
                                 2,
6586
2
        "List(expr* elts, expr_context ctx)");
6587
2
    if (!state->List_type) return -1;
6588
2
    state->Tuple_type = make_type(state, "Tuple", state->expr_type,
6589
2
                                  Tuple_fields, 2,
6590
2
        "Tuple(expr* elts, expr_context ctx)");
6591
2
    if (!state->Tuple_type) return -1;
6592
2
    state->Slice_type = make_type(state, "Slice", state->expr_type,
6593
2
                                  Slice_fields, 3,
6594
2
        "Slice(expr? lower, expr? upper, expr? step)");
6595
2
    if (!state->Slice_type) return -1;
6596
2
    if (PyObject_SetAttr(state->Slice_type, state->lower, Py_None) == -1)
6597
0
        return -1;
6598
2
    if (PyObject_SetAttr(state->Slice_type, state->upper, Py_None) == -1)
6599
0
        return -1;
6600
2
    if (PyObject_SetAttr(state->Slice_type, state->step, Py_None) == -1)
6601
0
        return -1;
6602
2
    state->expr_context_type = make_type(state, "expr_context",
6603
2
                                         state->AST_type, NULL, 0,
6604
2
        "expr_context = Load | Store | Del");
6605
2
    if (!state->expr_context_type) return -1;
6606
2
    if (add_attributes(state, state->expr_context_type, NULL, 0) < 0) return -1;
6607
2
    state->Load_type = make_type(state, "Load", state->expr_context_type, NULL,
6608
2
                                 0,
6609
2
        "Load");
6610
2
    if (!state->Load_type) return -1;
6611
2
    state->Load_singleton = PyType_GenericNew((PyTypeObject *)state->Load_type,
6612
2
                                              NULL, NULL);
6613
2
    if (!state->Load_singleton) return -1;
6614
2
    state->Store_type = make_type(state, "Store", state->expr_context_type,
6615
2
                                  NULL, 0,
6616
2
        "Store");
6617
2
    if (!state->Store_type) return -1;
6618
2
    state->Store_singleton = PyType_GenericNew((PyTypeObject
6619
2
                                               *)state->Store_type, NULL, NULL);
6620
2
    if (!state->Store_singleton) return -1;
6621
2
    state->Del_type = make_type(state, "Del", state->expr_context_type, NULL, 0,
6622
2
        "Del");
6623
2
    if (!state->Del_type) return -1;
6624
2
    state->Del_singleton = PyType_GenericNew((PyTypeObject *)state->Del_type,
6625
2
                                             NULL, NULL);
6626
2
    if (!state->Del_singleton) return -1;
6627
2
    state->boolop_type = make_type(state, "boolop", state->AST_type, NULL, 0,
6628
2
        "boolop = And | Or");
6629
2
    if (!state->boolop_type) return -1;
6630
2
    if (add_attributes(state, state->boolop_type, NULL, 0) < 0) return -1;
6631
2
    state->And_type = make_type(state, "And", state->boolop_type, NULL, 0,
6632
2
        "And");
6633
2
    if (!state->And_type) return -1;
6634
2
    state->And_singleton = PyType_GenericNew((PyTypeObject *)state->And_type,
6635
2
                                             NULL, NULL);
6636
2
    if (!state->And_singleton) return -1;
6637
2
    state->Or_type = make_type(state, "Or", state->boolop_type, NULL, 0,
6638
2
        "Or");
6639
2
    if (!state->Or_type) return -1;
6640
2
    state->Or_singleton = PyType_GenericNew((PyTypeObject *)state->Or_type,
6641
2
                                            NULL, NULL);
6642
2
    if (!state->Or_singleton) return -1;
6643
2
    state->operator_type = make_type(state, "operator", state->AST_type, NULL,
6644
2
                                     0,
6645
2
        "operator = Add | Sub | Mult | MatMult | Div | Mod | Pow | LShift | RShift | BitOr | BitXor | BitAnd | FloorDiv");
6646
2
    if (!state->operator_type) return -1;
6647
2
    if (add_attributes(state, state->operator_type, NULL, 0) < 0) return -1;
6648
2
    state->Add_type = make_type(state, "Add", state->operator_type, NULL, 0,
6649
2
        "Add");
6650
2
    if (!state->Add_type) return -1;
6651
2
    state->Add_singleton = PyType_GenericNew((PyTypeObject *)state->Add_type,
6652
2
                                             NULL, NULL);
6653
2
    if (!state->Add_singleton) return -1;
6654
2
    state->Sub_type = make_type(state, "Sub", state->operator_type, NULL, 0,
6655
2
        "Sub");
6656
2
    if (!state->Sub_type) return -1;
6657
2
    state->Sub_singleton = PyType_GenericNew((PyTypeObject *)state->Sub_type,
6658
2
                                             NULL, NULL);
6659
2
    if (!state->Sub_singleton) return -1;
6660
2
    state->Mult_type = make_type(state, "Mult", state->operator_type, NULL, 0,
6661
2
        "Mult");
6662
2
    if (!state->Mult_type) return -1;
6663
2
    state->Mult_singleton = PyType_GenericNew((PyTypeObject *)state->Mult_type,
6664
2
                                              NULL, NULL);
6665
2
    if (!state->Mult_singleton) return -1;
6666
2
    state->MatMult_type = make_type(state, "MatMult", state->operator_type,
6667
2
                                    NULL, 0,
6668
2
        "MatMult");
6669
2
    if (!state->MatMult_type) return -1;
6670
2
    state->MatMult_singleton = PyType_GenericNew((PyTypeObject
6671
2
                                                 *)state->MatMult_type, NULL,
6672
2
                                                 NULL);
6673
2
    if (!state->MatMult_singleton) return -1;
6674
2
    state->Div_type = make_type(state, "Div", state->operator_type, NULL, 0,
6675
2
        "Div");
6676
2
    if (!state->Div_type) return -1;
6677
2
    state->Div_singleton = PyType_GenericNew((PyTypeObject *)state->Div_type,
6678
2
                                             NULL, NULL);
6679
2
    if (!state->Div_singleton) return -1;
6680
2
    state->Mod_type = make_type(state, "Mod", state->operator_type, NULL, 0,
6681
2
        "Mod");
6682
2
    if (!state->Mod_type) return -1;
6683
2
    state->Mod_singleton = PyType_GenericNew((PyTypeObject *)state->Mod_type,
6684
2
                                             NULL, NULL);
6685
2
    if (!state->Mod_singleton) return -1;
6686
2
    state->Pow_type = make_type(state, "Pow", state->operator_type, NULL, 0,
6687
2
        "Pow");
6688
2
    if (!state->Pow_type) return -1;
6689
2
    state->Pow_singleton = PyType_GenericNew((PyTypeObject *)state->Pow_type,
6690
2
                                             NULL, NULL);
6691
2
    if (!state->Pow_singleton) return -1;
6692
2
    state->LShift_type = make_type(state, "LShift", state->operator_type, NULL,
6693
2
                                   0,
6694
2
        "LShift");
6695
2
    if (!state->LShift_type) return -1;
6696
2
    state->LShift_singleton = PyType_GenericNew((PyTypeObject
6697
2
                                                *)state->LShift_type, NULL,
6698
2
                                                NULL);
6699
2
    if (!state->LShift_singleton) return -1;
6700
2
    state->RShift_type = make_type(state, "RShift", state->operator_type, NULL,
6701
2
                                   0,
6702
2
        "RShift");
6703
2
    if (!state->RShift_type) return -1;
6704
2
    state->RShift_singleton = PyType_GenericNew((PyTypeObject
6705
2
                                                *)state->RShift_type, NULL,
6706
2
                                                NULL);
6707
2
    if (!state->RShift_singleton) return -1;
6708
2
    state->BitOr_type = make_type(state, "BitOr", state->operator_type, NULL, 0,
6709
2
        "BitOr");
6710
2
    if (!state->BitOr_type) return -1;
6711
2
    state->BitOr_singleton = PyType_GenericNew((PyTypeObject
6712
2
                                               *)state->BitOr_type, NULL, NULL);
6713
2
    if (!state->BitOr_singleton) return -1;
6714
2
    state->BitXor_type = make_type(state, "BitXor", state->operator_type, NULL,
6715
2
                                   0,
6716
2
        "BitXor");
6717
2
    if (!state->BitXor_type) return -1;
6718
2
    state->BitXor_singleton = PyType_GenericNew((PyTypeObject
6719
2
                                                *)state->BitXor_type, NULL,
6720
2
                                                NULL);
6721
2
    if (!state->BitXor_singleton) return -1;
6722
2
    state->BitAnd_type = make_type(state, "BitAnd", state->operator_type, NULL,
6723
2
                                   0,
6724
2
        "BitAnd");
6725
2
    if (!state->BitAnd_type) return -1;
6726
2
    state->BitAnd_singleton = PyType_GenericNew((PyTypeObject
6727
2
                                                *)state->BitAnd_type, NULL,
6728
2
                                                NULL);
6729
2
    if (!state->BitAnd_singleton) return -1;
6730
2
    state->FloorDiv_type = make_type(state, "FloorDiv", state->operator_type,
6731
2
                                     NULL, 0,
6732
2
        "FloorDiv");
6733
2
    if (!state->FloorDiv_type) return -1;
6734
2
    state->FloorDiv_singleton = PyType_GenericNew((PyTypeObject
6735
2
                                                  *)state->FloorDiv_type, NULL,
6736
2
                                                  NULL);
6737
2
    if (!state->FloorDiv_singleton) return -1;
6738
2
    state->unaryop_type = make_type(state, "unaryop", state->AST_type, NULL, 0,
6739
2
        "unaryop = Invert | Not | UAdd | USub");
6740
2
    if (!state->unaryop_type) return -1;
6741
2
    if (add_attributes(state, state->unaryop_type, NULL, 0) < 0) return -1;
6742
2
    state->Invert_type = make_type(state, "Invert", state->unaryop_type, NULL,
6743
2
                                   0,
6744
2
        "Invert");
6745
2
    if (!state->Invert_type) return -1;
6746
2
    state->Invert_singleton = PyType_GenericNew((PyTypeObject
6747
2
                                                *)state->Invert_type, NULL,
6748
2
                                                NULL);
6749
2
    if (!state->Invert_singleton) return -1;
6750
2
    state->Not_type = make_type(state, "Not", state->unaryop_type, NULL, 0,
6751
2
        "Not");
6752
2
    if (!state->Not_type) return -1;
6753
2
    state->Not_singleton = PyType_GenericNew((PyTypeObject *)state->Not_type,
6754
2
                                             NULL, NULL);
6755
2
    if (!state->Not_singleton) return -1;
6756
2
    state->UAdd_type = make_type(state, "UAdd", state->unaryop_type, NULL, 0,
6757
2
        "UAdd");
6758
2
    if (!state->UAdd_type) return -1;
6759
2
    state->UAdd_singleton = PyType_GenericNew((PyTypeObject *)state->UAdd_type,
6760
2
                                              NULL, NULL);
6761
2
    if (!state->UAdd_singleton) return -1;
6762
2
    state->USub_type = make_type(state, "USub", state->unaryop_type, NULL, 0,
6763
2
        "USub");
6764
2
    if (!state->USub_type) return -1;
6765
2
    state->USub_singleton = PyType_GenericNew((PyTypeObject *)state->USub_type,
6766
2
                                              NULL, NULL);
6767
2
    if (!state->USub_singleton) return -1;
6768
2
    state->cmpop_type = make_type(state, "cmpop", state->AST_type, NULL, 0,
6769
2
        "cmpop = Eq | NotEq | Lt | LtE | Gt | GtE | Is | IsNot | In | NotIn");
6770
2
    if (!state->cmpop_type) return -1;
6771
2
    if (add_attributes(state, state->cmpop_type, NULL, 0) < 0) return -1;
6772
2
    state->Eq_type = make_type(state, "Eq", state->cmpop_type, NULL, 0,
6773
2
        "Eq");
6774
2
    if (!state->Eq_type) return -1;
6775
2
    state->Eq_singleton = PyType_GenericNew((PyTypeObject *)state->Eq_type,
6776
2
                                            NULL, NULL);
6777
2
    if (!state->Eq_singleton) return -1;
6778
2
    state->NotEq_type = make_type(state, "NotEq", state->cmpop_type, NULL, 0,
6779
2
        "NotEq");
6780
2
    if (!state->NotEq_type) return -1;
6781
2
    state->NotEq_singleton = PyType_GenericNew((PyTypeObject
6782
2
                                               *)state->NotEq_type, NULL, NULL);
6783
2
    if (!state->NotEq_singleton) return -1;
6784
2
    state->Lt_type = make_type(state, "Lt", state->cmpop_type, NULL, 0,
6785
2
        "Lt");
6786
2
    if (!state->Lt_type) return -1;
6787
2
    state->Lt_singleton = PyType_GenericNew((PyTypeObject *)state->Lt_type,
6788
2
                                            NULL, NULL);
6789
2
    if (!state->Lt_singleton) return -1;
6790
2
    state->LtE_type = make_type(state, "LtE", state->cmpop_type, NULL, 0,
6791
2
        "LtE");
6792
2
    if (!state->LtE_type) return -1;
6793
2
    state->LtE_singleton = PyType_GenericNew((PyTypeObject *)state->LtE_type,
6794
2
                                             NULL, NULL);
6795
2
    if (!state->LtE_singleton) return -1;
6796
2
    state->Gt_type = make_type(state, "Gt", state->cmpop_type, NULL, 0,
6797
2
        "Gt");
6798
2
    if (!state->Gt_type) return -1;
6799
2
    state->Gt_singleton = PyType_GenericNew((PyTypeObject *)state->Gt_type,
6800
2
                                            NULL, NULL);
6801
2
    if (!state->Gt_singleton) return -1;
6802
2
    state->GtE_type = make_type(state, "GtE", state->cmpop_type, NULL, 0,
6803
2
        "GtE");
6804
2
    if (!state->GtE_type) return -1;
6805
2
    state->GtE_singleton = PyType_GenericNew((PyTypeObject *)state->GtE_type,
6806
2
                                             NULL, NULL);
6807
2
    if (!state->GtE_singleton) return -1;
6808
2
    state->Is_type = make_type(state, "Is", state->cmpop_type, NULL, 0,
6809
2
        "Is");
6810
2
    if (!state->Is_type) return -1;
6811
2
    state->Is_singleton = PyType_GenericNew((PyTypeObject *)state->Is_type,
6812
2
                                            NULL, NULL);
6813
2
    if (!state->Is_singleton) return -1;
6814
2
    state->IsNot_type = make_type(state, "IsNot", state->cmpop_type, NULL, 0,
6815
2
        "IsNot");
6816
2
    if (!state->IsNot_type) return -1;
6817
2
    state->IsNot_singleton = PyType_GenericNew((PyTypeObject
6818
2
                                               *)state->IsNot_type, NULL, NULL);
6819
2
    if (!state->IsNot_singleton) return -1;
6820
2
    state->In_type = make_type(state, "In", state->cmpop_type, NULL, 0,
6821
2
        "In");
6822
2
    if (!state->In_type) return -1;
6823
2
    state->In_singleton = PyType_GenericNew((PyTypeObject *)state->In_type,
6824
2
                                            NULL, NULL);
6825
2
    if (!state->In_singleton) return -1;
6826
2
    state->NotIn_type = make_type(state, "NotIn", state->cmpop_type, NULL, 0,
6827
2
        "NotIn");
6828
2
    if (!state->NotIn_type) return -1;
6829
2
    state->NotIn_singleton = PyType_GenericNew((PyTypeObject
6830
2
                                               *)state->NotIn_type, NULL, NULL);
6831
2
    if (!state->NotIn_singleton) return -1;
6832
2
    state->comprehension_type = make_type(state, "comprehension",
6833
2
                                          state->AST_type,
6834
2
                                          comprehension_fields, 4,
6835
2
        "comprehension(expr target, expr iter, expr* ifs, int is_async)");
6836
2
    if (!state->comprehension_type) return -1;
6837
2
    if (add_attributes(state, state->comprehension_type, NULL, 0) < 0) return
6838
0
        -1;
6839
2
    state->excepthandler_type = make_type(state, "excepthandler",
6840
2
                                          state->AST_type, NULL, 0,
6841
2
        "excepthandler = ExceptHandler(expr? type, identifier? name, stmt* body)");
6842
2
    if (!state->excepthandler_type) return -1;
6843
2
    if (add_attributes(state, state->excepthandler_type,
6844
2
        excepthandler_attributes, 4) < 0) return -1;
6845
2
    if (PyObject_SetAttr(state->excepthandler_type, state->end_lineno, Py_None)
6846
2
        == -1)
6847
0
        return -1;
6848
2
    if (PyObject_SetAttr(state->excepthandler_type, state->end_col_offset,
6849
2
        Py_None) == -1)
6850
0
        return -1;
6851
2
    state->ExceptHandler_type = make_type(state, "ExceptHandler",
6852
2
                                          state->excepthandler_type,
6853
2
                                          ExceptHandler_fields, 3,
6854
2
        "ExceptHandler(expr? type, identifier? name, stmt* body)");
6855
2
    if (!state->ExceptHandler_type) return -1;
6856
2
    if (PyObject_SetAttr(state->ExceptHandler_type, state->type, Py_None) == -1)
6857
0
        return -1;
6858
2
    if (PyObject_SetAttr(state->ExceptHandler_type, state->name, Py_None) == -1)
6859
0
        return -1;
6860
2
    state->arguments_type = make_type(state, "arguments", state->AST_type,
6861
2
                                      arguments_fields, 7,
6862
2
        "arguments(arg* posonlyargs, arg* args, arg? vararg, arg* kwonlyargs, expr?* kw_defaults, arg? kwarg, expr* defaults)");
6863
2
    if (!state->arguments_type) return -1;
6864
2
    if (add_attributes(state, state->arguments_type, NULL, 0) < 0) return -1;
6865
2
    if (PyObject_SetAttr(state->arguments_type, state->vararg, Py_None) == -1)
6866
0
        return -1;
6867
2
    if (PyObject_SetAttr(state->arguments_type, state->kwarg, Py_None) == -1)
6868
0
        return -1;
6869
2
    state->arg_type = make_type(state, "arg", state->AST_type, arg_fields, 3,
6870
2
        "arg(identifier arg, expr? annotation, string? type_comment)");
6871
2
    if (!state->arg_type) return -1;
6872
2
    if (add_attributes(state, state->arg_type, arg_attributes, 4) < 0) return
6873
0
        -1;
6874
2
    if (PyObject_SetAttr(state->arg_type, state->annotation, Py_None) == -1)
6875
0
        return -1;
6876
2
    if (PyObject_SetAttr(state->arg_type, state->type_comment, Py_None) == -1)
6877
0
        return -1;
6878
2
    if (PyObject_SetAttr(state->arg_type, state->end_lineno, Py_None) == -1)
6879
0
        return -1;
6880
2
    if (PyObject_SetAttr(state->arg_type, state->end_col_offset, Py_None) == -1)
6881
0
        return -1;
6882
2
    state->keyword_type = make_type(state, "keyword", state->AST_type,
6883
2
                                    keyword_fields, 2,
6884
2
        "keyword(identifier? arg, expr value)");
6885
2
    if (!state->keyword_type) return -1;
6886
2
    if (add_attributes(state, state->keyword_type, keyword_attributes, 4) < 0)
6887
0
        return -1;
6888
2
    if (PyObject_SetAttr(state->keyword_type, state->arg, Py_None) == -1)
6889
0
        return -1;
6890
2
    if (PyObject_SetAttr(state->keyword_type, state->end_lineno, Py_None) == -1)
6891
0
        return -1;
6892
2
    if (PyObject_SetAttr(state->keyword_type, state->end_col_offset, Py_None)
6893
2
        == -1)
6894
0
        return -1;
6895
2
    state->alias_type = make_type(state, "alias", state->AST_type,
6896
2
                                  alias_fields, 2,
6897
2
        "alias(identifier name, identifier? asname)");
6898
2
    if (!state->alias_type) return -1;
6899
2
    if (add_attributes(state, state->alias_type, alias_attributes, 4) < 0)
6900
0
        return -1;
6901
2
    if (PyObject_SetAttr(state->alias_type, state->asname, Py_None) == -1)
6902
0
        return -1;
6903
2
    if (PyObject_SetAttr(state->alias_type, state->end_lineno, Py_None) == -1)
6904
0
        return -1;
6905
2
    if (PyObject_SetAttr(state->alias_type, state->end_col_offset, Py_None) ==
6906
2
        -1)
6907
0
        return -1;
6908
2
    state->withitem_type = make_type(state, "withitem", state->AST_type,
6909
2
                                     withitem_fields, 2,
6910
2
        "withitem(expr context_expr, expr? optional_vars)");
6911
2
    if (!state->withitem_type) return -1;
6912
2
    if (add_attributes(state, state->withitem_type, NULL, 0) < 0) return -1;
6913
2
    if (PyObject_SetAttr(state->withitem_type, state->optional_vars, Py_None)
6914
2
        == -1)
6915
0
        return -1;
6916
2
    state->match_case_type = make_type(state, "match_case", state->AST_type,
6917
2
                                       match_case_fields, 3,
6918
2
        "match_case(pattern pattern, expr? guard, stmt* body)");
6919
2
    if (!state->match_case_type) return -1;
6920
2
    if (add_attributes(state, state->match_case_type, NULL, 0) < 0) return -1;
6921
2
    if (PyObject_SetAttr(state->match_case_type, state->guard, Py_None) == -1)
6922
0
        return -1;
6923
2
    state->pattern_type = make_type(state, "pattern", state->AST_type, NULL, 0,
6924
2
        "pattern = MatchValue(expr value)\n"
6925
2
        "        | MatchSingleton(constant value)\n"
6926
2
        "        | MatchSequence(pattern* patterns)\n"
6927
2
        "        | MatchMapping(expr* keys, pattern* patterns, identifier? rest)\n"
6928
2
        "        | MatchClass(expr cls, pattern* patterns, identifier* kwd_attrs, pattern* kwd_patterns)\n"
6929
2
        "        | MatchStar(identifier? name)\n"
6930
2
        "        | MatchAs(pattern? pattern, identifier? name)\n"
6931
2
        "        | MatchOr(pattern* patterns)");
6932
2
    if (!state->pattern_type) return -1;
6933
2
    if (add_attributes(state, state->pattern_type, pattern_attributes, 4) < 0)
6934
0
        return -1;
6935
2
    state->MatchValue_type = make_type(state, "MatchValue",
6936
2
                                       state->pattern_type, MatchValue_fields,
6937
2
                                       1,
6938
2
        "MatchValue(expr value)");
6939
2
    if (!state->MatchValue_type) return -1;
6940
2
    state->MatchSingleton_type = make_type(state, "MatchSingleton",
6941
2
                                           state->pattern_type,
6942
2
                                           MatchSingleton_fields, 1,
6943
2
        "MatchSingleton(constant value)");
6944
2
    if (!state->MatchSingleton_type) return -1;
6945
2
    state->MatchSequence_type = make_type(state, "MatchSequence",
6946
2
                                          state->pattern_type,
6947
2
                                          MatchSequence_fields, 1,
6948
2
        "MatchSequence(pattern* patterns)");
6949
2
    if (!state->MatchSequence_type) return -1;
6950
2
    state->MatchMapping_type = make_type(state, "MatchMapping",
6951
2
                                         state->pattern_type,
6952
2
                                         MatchMapping_fields, 3,
6953
2
        "MatchMapping(expr* keys, pattern* patterns, identifier? rest)");
6954
2
    if (!state->MatchMapping_type) return -1;
6955
2
    if (PyObject_SetAttr(state->MatchMapping_type, state->rest, Py_None) == -1)
6956
0
        return -1;
6957
2
    state->MatchClass_type = make_type(state, "MatchClass",
6958
2
                                       state->pattern_type, MatchClass_fields,
6959
2
                                       4,
6960
2
        "MatchClass(expr cls, pattern* patterns, identifier* kwd_attrs, pattern* kwd_patterns)");
6961
2
    if (!state->MatchClass_type) return -1;
6962
2
    state->MatchStar_type = make_type(state, "MatchStar", state->pattern_type,
6963
2
                                      MatchStar_fields, 1,
6964
2
        "MatchStar(identifier? name)");
6965
2
    if (!state->MatchStar_type) return -1;
6966
2
    if (PyObject_SetAttr(state->MatchStar_type, state->name, Py_None) == -1)
6967
0
        return -1;
6968
2
    state->MatchAs_type = make_type(state, "MatchAs", state->pattern_type,
6969
2
                                    MatchAs_fields, 2,
6970
2
        "MatchAs(pattern? pattern, identifier? name)");
6971
2
    if (!state->MatchAs_type) return -1;
6972
2
    if (PyObject_SetAttr(state->MatchAs_type, state->pattern, Py_None) == -1)
6973
0
        return -1;
6974
2
    if (PyObject_SetAttr(state->MatchAs_type, state->name, Py_None) == -1)
6975
0
        return -1;
6976
2
    state->MatchOr_type = make_type(state, "MatchOr", state->pattern_type,
6977
2
                                    MatchOr_fields, 1,
6978
2
        "MatchOr(pattern* patterns)");
6979
2
    if (!state->MatchOr_type) return -1;
6980
2
    state->type_ignore_type = make_type(state, "type_ignore", state->AST_type,
6981
2
                                        NULL, 0,
6982
2
        "type_ignore = TypeIgnore(int lineno, string tag)");
6983
2
    if (!state->type_ignore_type) return -1;
6984
2
    if (add_attributes(state, state->type_ignore_type, NULL, 0) < 0) return -1;
6985
2
    state->TypeIgnore_type = make_type(state, "TypeIgnore",
6986
2
                                       state->type_ignore_type,
6987
2
                                       TypeIgnore_fields, 2,
6988
2
        "TypeIgnore(int lineno, string tag)");
6989
2
    if (!state->TypeIgnore_type) return -1;
6990
2
    state->type_param_type = make_type(state, "type_param", state->AST_type,
6991
2
                                       NULL, 0,
6992
2
        "type_param = TypeVar(identifier name, expr? bound, expr? default_value)\n"
6993
2
        "           | ParamSpec(identifier name, expr? default_value)\n"
6994
2
        "           | TypeVarTuple(identifier name, expr? default_value)");
6995
2
    if (!state->type_param_type) return -1;
6996
2
    if (add_attributes(state, state->type_param_type, type_param_attributes, 4)
6997
2
        < 0) return -1;
6998
2
    state->TypeVar_type = make_type(state, "TypeVar", state->type_param_type,
6999
2
                                    TypeVar_fields, 3,
7000
2
        "TypeVar(identifier name, expr? bound, expr? default_value)");
7001
2
    if (!state->TypeVar_type) return -1;
7002
2
    if (PyObject_SetAttr(state->TypeVar_type, state->bound, Py_None) == -1)
7003
0
        return -1;
7004
2
    if (PyObject_SetAttr(state->TypeVar_type, state->default_value, Py_None) ==
7005
2
        -1)
7006
0
        return -1;
7007
2
    state->ParamSpec_type = make_type(state, "ParamSpec",
7008
2
                                      state->type_param_type, ParamSpec_fields,
7009
2
                                      2,
7010
2
        "ParamSpec(identifier name, expr? default_value)");
7011
2
    if (!state->ParamSpec_type) return -1;
7012
2
    if (PyObject_SetAttr(state->ParamSpec_type, state->default_value, Py_None)
7013
2
        == -1)
7014
0
        return -1;
7015
2
    state->TypeVarTuple_type = make_type(state, "TypeVarTuple",
7016
2
                                         state->type_param_type,
7017
2
                                         TypeVarTuple_fields, 2,
7018
2
        "TypeVarTuple(identifier name, expr? default_value)");
7019
2
    if (!state->TypeVarTuple_type) return -1;
7020
2
    if (PyObject_SetAttr(state->TypeVarTuple_type, state->default_value,
7021
2
        Py_None) == -1)
7022
0
        return -1;
7023
7024
2
    if (!add_ast_annotations(state)) {
7025
0
        return -1;
7026
0
    }
7027
2
    return 0;
7028
2
}
7029
7030
static int obj2ast_mod(struct ast_state *state, PyObject* obj, mod_ty* out,
7031
                       PyArena* arena);
7032
static int obj2ast_stmt(struct ast_state *state, PyObject* obj, stmt_ty* out,
7033
                        PyArena* arena);
7034
static int obj2ast_expr(struct ast_state *state, PyObject* obj, expr_ty* out,
7035
                        PyArena* arena);
7036
static int obj2ast_expr_context(struct ast_state *state, PyObject* obj,
7037
                                expr_context_ty* out, PyArena* arena);
7038
static int obj2ast_boolop(struct ast_state *state, PyObject* obj, boolop_ty*
7039
                          out, PyArena* arena);
7040
static int obj2ast_operator(struct ast_state *state, PyObject* obj,
7041
                            operator_ty* out, PyArena* arena);
7042
static int obj2ast_unaryop(struct ast_state *state, PyObject* obj, unaryop_ty*
7043
                           out, PyArena* arena);
7044
static int obj2ast_cmpop(struct ast_state *state, PyObject* obj, cmpop_ty* out,
7045
                         PyArena* arena);
7046
static int obj2ast_comprehension(struct ast_state *state, PyObject* obj,
7047
                                 comprehension_ty* out, PyArena* arena);
7048
static int obj2ast_excepthandler(struct ast_state *state, PyObject* obj,
7049
                                 excepthandler_ty* out, PyArena* arena);
7050
static int obj2ast_arguments(struct ast_state *state, PyObject* obj,
7051
                             arguments_ty* out, PyArena* arena);
7052
static int obj2ast_arg(struct ast_state *state, PyObject* obj, arg_ty* out,
7053
                       PyArena* arena);
7054
static int obj2ast_keyword(struct ast_state *state, PyObject* obj, keyword_ty*
7055
                           out, PyArena* arena);
7056
static int obj2ast_alias(struct ast_state *state, PyObject* obj, alias_ty* out,
7057
                         PyArena* arena);
7058
static int obj2ast_withitem(struct ast_state *state, PyObject* obj,
7059
                            withitem_ty* out, PyArena* arena);
7060
static int obj2ast_match_case(struct ast_state *state, PyObject* obj,
7061
                              match_case_ty* out, PyArena* arena);
7062
static int obj2ast_pattern(struct ast_state *state, PyObject* obj, pattern_ty*
7063
                           out, PyArena* arena);
7064
static int obj2ast_type_ignore(struct ast_state *state, PyObject* obj,
7065
                               type_ignore_ty* out, PyArena* arena);
7066
static int obj2ast_type_param(struct ast_state *state, PyObject* obj,
7067
                              type_param_ty* out, PyArena* arena);
7068
7069
mod_ty
7070
_PyAST_Module(asdl_stmt_seq * body, asdl_type_ignore_seq * type_ignores,
7071
              PyArena *arena)
7072
3.89k
{
7073
3.89k
    mod_ty p;
7074
3.89k
    p = (mod_ty)_PyArena_Malloc(arena, sizeof(*p));
7075
3.89k
    if (!p)
7076
0
        return NULL;
7077
3.89k
    p->kind = Module_kind;
7078
3.89k
    p->v.Module.body = body;
7079
3.89k
    p->v.Module.type_ignores = type_ignores;
7080
3.89k
    return p;
7081
3.89k
}
7082
7083
mod_ty
7084
_PyAST_Interactive(asdl_stmt_seq * body, PyArena *arena)
7085
1.31k
{
7086
1.31k
    mod_ty p;
7087
1.31k
    p = (mod_ty)_PyArena_Malloc(arena, sizeof(*p));
7088
1.31k
    if (!p)
7089
0
        return NULL;
7090
1.31k
    p->kind = Interactive_kind;
7091
1.31k
    p->v.Interactive.body = body;
7092
1.31k
    return p;
7093
1.31k
}
7094
7095
mod_ty
7096
_PyAST_Expression(expr_ty body, PyArena *arena)
7097
1.17k
{
7098
1.17k
    mod_ty p;
7099
1.17k
    if (!body) {
7100
0
        PyErr_SetString(PyExc_ValueError,
7101
0
                        "field 'body' is required for Expression");
7102
0
        return NULL;
7103
0
    }
7104
1.17k
    p = (mod_ty)_PyArena_Malloc(arena, sizeof(*p));
7105
1.17k
    if (!p)
7106
0
        return NULL;
7107
1.17k
    p->kind = Expression_kind;
7108
1.17k
    p->v.Expression.body = body;
7109
1.17k
    return p;
7110
1.17k
}
7111
7112
mod_ty
7113
_PyAST_FunctionType(asdl_expr_seq * argtypes, expr_ty returns, PyArena *arena)
7114
0
{
7115
0
    mod_ty p;
7116
0
    if (!returns) {
7117
0
        PyErr_SetString(PyExc_ValueError,
7118
0
                        "field 'returns' is required for FunctionType");
7119
0
        return NULL;
7120
0
    }
7121
0
    p = (mod_ty)_PyArena_Malloc(arena, sizeof(*p));
7122
0
    if (!p)
7123
0
        return NULL;
7124
0
    p->kind = FunctionType_kind;
7125
0
    p->v.FunctionType.argtypes = argtypes;
7126
0
    p->v.FunctionType.returns = returns;
7127
0
    return p;
7128
0
}
7129
7130
stmt_ty
7131
_PyAST_FunctionDef(identifier name, arguments_ty args, asdl_stmt_seq * body,
7132
                   asdl_expr_seq * decorator_list, expr_ty returns, string
7133
                   type_comment, asdl_type_param_seq * type_params, int lineno,
7134
                   int col_offset, int end_lineno, int end_col_offset, PyArena
7135
                   *arena)
7136
5.20k
{
7137
5.20k
    stmt_ty p;
7138
5.20k
    if (!name) {
7139
0
        PyErr_SetString(PyExc_ValueError,
7140
0
                        "field 'name' is required for FunctionDef");
7141
0
        return NULL;
7142
0
    }
7143
5.20k
    if (!args) {
7144
0
        PyErr_SetString(PyExc_ValueError,
7145
0
                        "field 'args' is required for FunctionDef");
7146
0
        return NULL;
7147
0
    }
7148
5.20k
    p = (stmt_ty)_PyArena_Malloc(arena, sizeof(*p));
7149
5.20k
    if (!p)
7150
0
        return NULL;
7151
5.20k
    p->kind = FunctionDef_kind;
7152
5.20k
    p->v.FunctionDef.name = name;
7153
5.20k
    p->v.FunctionDef.args = args;
7154
5.20k
    p->v.FunctionDef.body = body;
7155
5.20k
    p->v.FunctionDef.decorator_list = decorator_list;
7156
5.20k
    p->v.FunctionDef.returns = returns;
7157
5.20k
    p->v.FunctionDef.type_comment = type_comment;
7158
5.20k
    p->v.FunctionDef.type_params = type_params;
7159
5.20k
    p->lineno = lineno;
7160
5.20k
    p->col_offset = col_offset;
7161
5.20k
    p->end_lineno = end_lineno;
7162
5.20k
    p->end_col_offset = end_col_offset;
7163
5.20k
    return p;
7164
5.20k
}
7165
7166
stmt_ty
7167
_PyAST_AsyncFunctionDef(identifier name, arguments_ty args, asdl_stmt_seq *
7168
                        body, asdl_expr_seq * decorator_list, expr_ty returns,
7169
                        string type_comment, asdl_type_param_seq * type_params,
7170
                        int lineno, int col_offset, int end_lineno, int
7171
                        end_col_offset, PyArena *arena)
7172
1.57k
{
7173
1.57k
    stmt_ty p;
7174
1.57k
    if (!name) {
7175
0
        PyErr_SetString(PyExc_ValueError,
7176
0
                        "field 'name' is required for AsyncFunctionDef");
7177
0
        return NULL;
7178
0
    }
7179
1.57k
    if (!args) {
7180
0
        PyErr_SetString(PyExc_ValueError,
7181
0
                        "field 'args' is required for AsyncFunctionDef");
7182
0
        return NULL;
7183
0
    }
7184
1.57k
    p = (stmt_ty)_PyArena_Malloc(arena, sizeof(*p));
7185
1.57k
    if (!p)
7186
0
        return NULL;
7187
1.57k
    p->kind = AsyncFunctionDef_kind;
7188
1.57k
    p->v.AsyncFunctionDef.name = name;
7189
1.57k
    p->v.AsyncFunctionDef.args = args;
7190
1.57k
    p->v.AsyncFunctionDef.body = body;
7191
1.57k
    p->v.AsyncFunctionDef.decorator_list = decorator_list;
7192
1.57k
    p->v.AsyncFunctionDef.returns = returns;
7193
1.57k
    p->v.AsyncFunctionDef.type_comment = type_comment;
7194
1.57k
    p->v.AsyncFunctionDef.type_params = type_params;
7195
1.57k
    p->lineno = lineno;
7196
1.57k
    p->col_offset = col_offset;
7197
1.57k
    p->end_lineno = end_lineno;
7198
1.57k
    p->end_col_offset = end_col_offset;
7199
1.57k
    return p;
7200
1.57k
}
7201
7202
stmt_ty
7203
_PyAST_ClassDef(identifier name, asdl_expr_seq * bases, asdl_keyword_seq *
7204
                keywords, asdl_stmt_seq * body, asdl_expr_seq * decorator_list,
7205
                asdl_type_param_seq * type_params, int lineno, int col_offset,
7206
                int end_lineno, int end_col_offset, PyArena *arena)
7207
9.11k
{
7208
9.11k
    stmt_ty p;
7209
9.11k
    if (!name) {
7210
0
        PyErr_SetString(PyExc_ValueError,
7211
0
                        "field 'name' is required for ClassDef");
7212
0
        return NULL;
7213
0
    }
7214
9.11k
    p = (stmt_ty)_PyArena_Malloc(arena, sizeof(*p));
7215
9.11k
    if (!p)
7216
0
        return NULL;
7217
9.11k
    p->kind = ClassDef_kind;
7218
9.11k
    p->v.ClassDef.name = name;
7219
9.11k
    p->v.ClassDef.bases = bases;
7220
9.11k
    p->v.ClassDef.keywords = keywords;
7221
9.11k
    p->v.ClassDef.body = body;
7222
9.11k
    p->v.ClassDef.decorator_list = decorator_list;
7223
9.11k
    p->v.ClassDef.type_params = type_params;
7224
9.11k
    p->lineno = lineno;
7225
9.11k
    p->col_offset = col_offset;
7226
9.11k
    p->end_lineno = end_lineno;
7227
9.11k
    p->end_col_offset = end_col_offset;
7228
9.11k
    return p;
7229
9.11k
}
7230
7231
stmt_ty
7232
_PyAST_Return(expr_ty value, int lineno, int col_offset, int end_lineno, int
7233
              end_col_offset, PyArena *arena)
7234
572
{
7235
572
    stmt_ty p;
7236
572
    p = (stmt_ty)_PyArena_Malloc(arena, sizeof(*p));
7237
572
    if (!p)
7238
0
        return NULL;
7239
572
    p->kind = Return_kind;
7240
572
    p->v.Return.value = value;
7241
572
    p->lineno = lineno;
7242
572
    p->col_offset = col_offset;
7243
572
    p->end_lineno = end_lineno;
7244
572
    p->end_col_offset = end_col_offset;
7245
572
    return p;
7246
572
}
7247
7248
stmt_ty
7249
_PyAST_Delete(asdl_expr_seq * targets, int lineno, int col_offset, int
7250
              end_lineno, int end_col_offset, PyArena *arena)
7251
414
{
7252
414
    stmt_ty p;
7253
414
    p = (stmt_ty)_PyArena_Malloc(arena, sizeof(*p));
7254
414
    if (!p)
7255
0
        return NULL;
7256
414
    p->kind = Delete_kind;
7257
414
    p->v.Delete.targets = targets;
7258
414
    p->lineno = lineno;
7259
414
    p->col_offset = col_offset;
7260
414
    p->end_lineno = end_lineno;
7261
414
    p->end_col_offset = end_col_offset;
7262
414
    return p;
7263
414
}
7264
7265
stmt_ty
7266
_PyAST_Assign(asdl_expr_seq * targets, expr_ty value, string type_comment, int
7267
              lineno, int col_offset, int end_lineno, int end_col_offset,
7268
              PyArena *arena)
7269
2.80k
{
7270
2.80k
    stmt_ty p;
7271
2.80k
    if (!value) {
7272
0
        PyErr_SetString(PyExc_ValueError,
7273
0
                        "field 'value' is required for Assign");
7274
0
        return NULL;
7275
0
    }
7276
2.80k
    p = (stmt_ty)_PyArena_Malloc(arena, sizeof(*p));
7277
2.80k
    if (!p)
7278
0
        return NULL;
7279
2.80k
    p->kind = Assign_kind;
7280
2.80k
    p->v.Assign.targets = targets;
7281
2.80k
    p->v.Assign.value = value;
7282
2.80k
    p->v.Assign.type_comment = type_comment;
7283
2.80k
    p->lineno = lineno;
7284
2.80k
    p->col_offset = col_offset;
7285
2.80k
    p->end_lineno = end_lineno;
7286
2.80k
    p->end_col_offset = end_col_offset;
7287
2.80k
    return p;
7288
2.80k
}
7289
7290
stmt_ty
7291
_PyAST_TypeAlias(expr_ty name, asdl_type_param_seq * type_params, expr_ty
7292
                 value, int lineno, int col_offset, int end_lineno, int
7293
                 end_col_offset, PyArena *arena)
7294
335
{
7295
335
    stmt_ty p;
7296
335
    if (!name) {
7297
0
        PyErr_SetString(PyExc_ValueError,
7298
0
                        "field 'name' is required for TypeAlias");
7299
0
        return NULL;
7300
0
    }
7301
335
    if (!value) {
7302
0
        PyErr_SetString(PyExc_ValueError,
7303
0
                        "field 'value' is required for TypeAlias");
7304
0
        return NULL;
7305
0
    }
7306
335
    p = (stmt_ty)_PyArena_Malloc(arena, sizeof(*p));
7307
335
    if (!p)
7308
0
        return NULL;
7309
335
    p->kind = TypeAlias_kind;
7310
335
    p->v.TypeAlias.name = name;
7311
335
    p->v.TypeAlias.type_params = type_params;
7312
335
    p->v.TypeAlias.value = value;
7313
335
    p->lineno = lineno;
7314
335
    p->col_offset = col_offset;
7315
335
    p->end_lineno = end_lineno;
7316
335
    p->end_col_offset = end_col_offset;
7317
335
    return p;
7318
335
}
7319
7320
stmt_ty
7321
_PyAST_AugAssign(expr_ty target, operator_ty op, expr_ty value, int lineno, int
7322
                 col_offset, int end_lineno, int end_col_offset, PyArena *arena)
7323
4.60k
{
7324
4.60k
    stmt_ty p;
7325
4.60k
    if (!target) {
7326
0
        PyErr_SetString(PyExc_ValueError,
7327
0
                        "field 'target' is required for AugAssign");
7328
0
        return NULL;
7329
0
    }
7330
4.60k
    if (!op) {
7331
0
        PyErr_SetString(PyExc_ValueError,
7332
0
                        "field 'op' is required for AugAssign");
7333
0
        return NULL;
7334
0
    }
7335
4.60k
    if (!value) {
7336
0
        PyErr_SetString(PyExc_ValueError,
7337
0
                        "field 'value' is required for AugAssign");
7338
0
        return NULL;
7339
0
    }
7340
4.60k
    p = (stmt_ty)_PyArena_Malloc(arena, sizeof(*p));
7341
4.60k
    if (!p)
7342
0
        return NULL;
7343
4.60k
    p->kind = AugAssign_kind;
7344
4.60k
    p->v.AugAssign.target = target;
7345
4.60k
    p->v.AugAssign.op = op;
7346
4.60k
    p->v.AugAssign.value = value;
7347
4.60k
    p->lineno = lineno;
7348
4.60k
    p->col_offset = col_offset;
7349
4.60k
    p->end_lineno = end_lineno;
7350
4.60k
    p->end_col_offset = end_col_offset;
7351
4.60k
    return p;
7352
4.60k
}
7353
7354
stmt_ty
7355
_PyAST_AnnAssign(expr_ty target, expr_ty annotation, expr_ty value, int simple,
7356
                 int lineno, int col_offset, int end_lineno, int
7357
                 end_col_offset, PyArena *arena)
7358
16.7k
{
7359
16.7k
    stmt_ty p;
7360
16.7k
    if (!target) {
7361
0
        PyErr_SetString(PyExc_ValueError,
7362
0
                        "field 'target' is required for AnnAssign");
7363
0
        return NULL;
7364
0
    }
7365
16.7k
    if (!annotation) {
7366
0
        PyErr_SetString(PyExc_ValueError,
7367
0
                        "field 'annotation' is required for AnnAssign");
7368
0
        return NULL;
7369
0
    }
7370
16.7k
    p = (stmt_ty)_PyArena_Malloc(arena, sizeof(*p));
7371
16.7k
    if (!p)
7372
0
        return NULL;
7373
16.7k
    p->kind = AnnAssign_kind;
7374
16.7k
    p->v.AnnAssign.target = target;
7375
16.7k
    p->v.AnnAssign.annotation = annotation;
7376
16.7k
    p->v.AnnAssign.value = value;
7377
16.7k
    p->v.AnnAssign.simple = simple;
7378
16.7k
    p->lineno = lineno;
7379
16.7k
    p->col_offset = col_offset;
7380
16.7k
    p->end_lineno = end_lineno;
7381
16.7k
    p->end_col_offset = end_col_offset;
7382
16.7k
    return p;
7383
16.7k
}
7384
7385
stmt_ty
7386
_PyAST_For(expr_ty target, expr_ty iter, asdl_stmt_seq * body, asdl_stmt_seq *
7387
           orelse, string type_comment, int lineno, int col_offset, int
7388
           end_lineno, int end_col_offset, PyArena *arena)
7389
873
{
7390
873
    stmt_ty p;
7391
873
    if (!target) {
7392
0
        PyErr_SetString(PyExc_ValueError,
7393
0
                        "field 'target' is required for For");
7394
0
        return NULL;
7395
0
    }
7396
873
    if (!iter) {
7397
0
        PyErr_SetString(PyExc_ValueError,
7398
0
                        "field 'iter' is required for For");
7399
0
        return NULL;
7400
0
    }
7401
873
    p = (stmt_ty)_PyArena_Malloc(arena, sizeof(*p));
7402
873
    if (!p)
7403
0
        return NULL;
7404
873
    p->kind = For_kind;
7405
873
    p->v.For.target = target;
7406
873
    p->v.For.iter = iter;
7407
873
    p->v.For.body = body;
7408
873
    p->v.For.orelse = orelse;
7409
873
    p->v.For.type_comment = type_comment;
7410
873
    p->lineno = lineno;
7411
873
    p->col_offset = col_offset;
7412
873
    p->end_lineno = end_lineno;
7413
873
    p->end_col_offset = end_col_offset;
7414
873
    return p;
7415
873
}
7416
7417
stmt_ty
7418
_PyAST_AsyncFor(expr_ty target, expr_ty iter, asdl_stmt_seq * body,
7419
                asdl_stmt_seq * orelse, string type_comment, int lineno, int
7420
                col_offset, int end_lineno, int end_col_offset, PyArena *arena)
7421
267
{
7422
267
    stmt_ty p;
7423
267
    if (!target) {
7424
0
        PyErr_SetString(PyExc_ValueError,
7425
0
                        "field 'target' is required for AsyncFor");
7426
0
        return NULL;
7427
0
    }
7428
267
    if (!iter) {
7429
0
        PyErr_SetString(PyExc_ValueError,
7430
0
                        "field 'iter' is required for AsyncFor");
7431
0
        return NULL;
7432
0
    }
7433
267
    p = (stmt_ty)_PyArena_Malloc(arena, sizeof(*p));
7434
267
    if (!p)
7435
0
        return NULL;
7436
267
    p->kind = AsyncFor_kind;
7437
267
    p->v.AsyncFor.target = target;
7438
267
    p->v.AsyncFor.iter = iter;
7439
267
    p->v.AsyncFor.body = body;
7440
267
    p->v.AsyncFor.orelse = orelse;
7441
267
    p->v.AsyncFor.type_comment = type_comment;
7442
267
    p->lineno = lineno;
7443
267
    p->col_offset = col_offset;
7444
267
    p->end_lineno = end_lineno;
7445
267
    p->end_col_offset = end_col_offset;
7446
267
    return p;
7447
267
}
7448
7449
stmt_ty
7450
_PyAST_While(expr_ty test, asdl_stmt_seq * body, asdl_stmt_seq * orelse, int
7451
             lineno, int col_offset, int end_lineno, int end_col_offset,
7452
             PyArena *arena)
7453
1.62k
{
7454
1.62k
    stmt_ty p;
7455
1.62k
    if (!test) {
7456
0
        PyErr_SetString(PyExc_ValueError,
7457
0
                        "field 'test' is required for While");
7458
0
        return NULL;
7459
0
    }
7460
1.62k
    p = (stmt_ty)_PyArena_Malloc(arena, sizeof(*p));
7461
1.62k
    if (!p)
7462
0
        return NULL;
7463
1.62k
    p->kind = While_kind;
7464
1.62k
    p->v.While.test = test;
7465
1.62k
    p->v.While.body = body;
7466
1.62k
    p->v.While.orelse = orelse;
7467
1.62k
    p->lineno = lineno;
7468
1.62k
    p->col_offset = col_offset;
7469
1.62k
    p->end_lineno = end_lineno;
7470
1.62k
    p->end_col_offset = end_col_offset;
7471
1.62k
    return p;
7472
1.62k
}
7473
7474
stmt_ty
7475
_PyAST_If(expr_ty test, asdl_stmt_seq * body, asdl_stmt_seq * orelse, int
7476
          lineno, int col_offset, int end_lineno, int end_col_offset, PyArena
7477
          *arena)
7478
988
{
7479
988
    stmt_ty p;
7480
988
    if (!test) {
7481
0
        PyErr_SetString(PyExc_ValueError,
7482
0
                        "field 'test' is required for If");
7483
0
        return NULL;
7484
0
    }
7485
988
    p = (stmt_ty)_PyArena_Malloc(arena, sizeof(*p));
7486
988
    if (!p)
7487
0
        return NULL;
7488
988
    p->kind = If_kind;
7489
988
    p->v.If.test = test;
7490
988
    p->v.If.body = body;
7491
988
    p->v.If.orelse = orelse;
7492
988
    p->lineno = lineno;
7493
988
    p->col_offset = col_offset;
7494
988
    p->end_lineno = end_lineno;
7495
988
    p->end_col_offset = end_col_offset;
7496
988
    return p;
7497
988
}
7498
7499
stmt_ty
7500
_PyAST_With(asdl_withitem_seq * items, asdl_stmt_seq * body, string
7501
            type_comment, int lineno, int col_offset, int end_lineno, int
7502
            end_col_offset, PyArena *arena)
7503
76
{
7504
76
    stmt_ty p;
7505
76
    p = (stmt_ty)_PyArena_Malloc(arena, sizeof(*p));
7506
76
    if (!p)
7507
0
        return NULL;
7508
76
    p->kind = With_kind;
7509
76
    p->v.With.items = items;
7510
76
    p->v.With.body = body;
7511
76
    p->v.With.type_comment = type_comment;
7512
76
    p->lineno = lineno;
7513
76
    p->col_offset = col_offset;
7514
76
    p->end_lineno = end_lineno;
7515
76
    p->end_col_offset = end_col_offset;
7516
76
    return p;
7517
76
}
7518
7519
stmt_ty
7520
_PyAST_AsyncWith(asdl_withitem_seq * items, asdl_stmt_seq * body, string
7521
                 type_comment, int lineno, int col_offset, int end_lineno, int
7522
                 end_col_offset, PyArena *arena)
7523
1.88k
{
7524
1.88k
    stmt_ty p;
7525
1.88k
    p = (stmt_ty)_PyArena_Malloc(arena, sizeof(*p));
7526
1.88k
    if (!p)
7527
0
        return NULL;
7528
1.88k
    p->kind = AsyncWith_kind;
7529
1.88k
    p->v.AsyncWith.items = items;
7530
1.88k
    p->v.AsyncWith.body = body;
7531
1.88k
    p->v.AsyncWith.type_comment = type_comment;
7532
1.88k
    p->lineno = lineno;
7533
1.88k
    p->col_offset = col_offset;
7534
1.88k
    p->end_lineno = end_lineno;
7535
1.88k
    p->end_col_offset = end_col_offset;
7536
1.88k
    return p;
7537
1.88k
}
7538
7539
stmt_ty
7540
_PyAST_Match(expr_ty subject, asdl_match_case_seq * cases, int lineno, int
7541
             col_offset, int end_lineno, int end_col_offset, PyArena *arena)
7542
63
{
7543
63
    stmt_ty p;
7544
63
    if (!subject) {
7545
0
        PyErr_SetString(PyExc_ValueError,
7546
0
                        "field 'subject' is required for Match");
7547
0
        return NULL;
7548
0
    }
7549
63
    p = (stmt_ty)_PyArena_Malloc(arena, sizeof(*p));
7550
63
    if (!p)
7551
0
        return NULL;
7552
63
    p->kind = Match_kind;
7553
63
    p->v.Match.subject = subject;
7554
63
    p->v.Match.cases = cases;
7555
63
    p->lineno = lineno;
7556
63
    p->col_offset = col_offset;
7557
63
    p->end_lineno = end_lineno;
7558
63
    p->end_col_offset = end_col_offset;
7559
63
    return p;
7560
63
}
7561
7562
stmt_ty
7563
_PyAST_Raise(expr_ty exc, expr_ty cause, int lineno, int col_offset, int
7564
             end_lineno, int end_col_offset, PyArena *arena)
7565
444
{
7566
444
    stmt_ty p;
7567
444
    p = (stmt_ty)_PyArena_Malloc(arena, sizeof(*p));
7568
444
    if (!p)
7569
0
        return NULL;
7570
444
    p->kind = Raise_kind;
7571
444
    p->v.Raise.exc = exc;
7572
444
    p->v.Raise.cause = cause;
7573
444
    p->lineno = lineno;
7574
444
    p->col_offset = col_offset;
7575
444
    p->end_lineno = end_lineno;
7576
444
    p->end_col_offset = end_col_offset;
7577
444
    return p;
7578
444
}
7579
7580
stmt_ty
7581
_PyAST_Try(asdl_stmt_seq * body, asdl_excepthandler_seq * handlers,
7582
           asdl_stmt_seq * orelse, asdl_stmt_seq * finalbody, int lineno, int
7583
           col_offset, int end_lineno, int end_col_offset, PyArena *arena)
7584
1.27k
{
7585
1.27k
    stmt_ty p;
7586
1.27k
    p = (stmt_ty)_PyArena_Malloc(arena, sizeof(*p));
7587
1.27k
    if (!p)
7588
0
        return NULL;
7589
1.27k
    p->kind = Try_kind;
7590
1.27k
    p->v.Try.body = body;
7591
1.27k
    p->v.Try.handlers = handlers;
7592
1.27k
    p->v.Try.orelse = orelse;
7593
1.27k
    p->v.Try.finalbody = finalbody;
7594
1.27k
    p->lineno = lineno;
7595
1.27k
    p->col_offset = col_offset;
7596
1.27k
    p->end_lineno = end_lineno;
7597
1.27k
    p->end_col_offset = end_col_offset;
7598
1.27k
    return p;
7599
1.27k
}
7600
7601
stmt_ty
7602
_PyAST_TryStar(asdl_stmt_seq * body, asdl_excepthandler_seq * handlers,
7603
               asdl_stmt_seq * orelse, asdl_stmt_seq * finalbody, int lineno,
7604
               int col_offset, int end_lineno, int end_col_offset, PyArena
7605
               *arena)
7606
1.90k
{
7607
1.90k
    stmt_ty p;
7608
1.90k
    p = (stmt_ty)_PyArena_Malloc(arena, sizeof(*p));
7609
1.90k
    if (!p)
7610
0
        return NULL;
7611
1.90k
    p->kind = TryStar_kind;
7612
1.90k
    p->v.TryStar.body = body;
7613
1.90k
    p->v.TryStar.handlers = handlers;
7614
1.90k
    p->v.TryStar.orelse = orelse;
7615
1.90k
    p->v.TryStar.finalbody = finalbody;
7616
1.90k
    p->lineno = lineno;
7617
1.90k
    p->col_offset = col_offset;
7618
1.90k
    p->end_lineno = end_lineno;
7619
1.90k
    p->end_col_offset = end_col_offset;
7620
1.90k
    return p;
7621
1.90k
}
7622
7623
stmt_ty
7624
_PyAST_Assert(expr_ty test, expr_ty msg, int lineno, int col_offset, int
7625
              end_lineno, int end_col_offset, PyArena *arena)
7626
1.90k
{
7627
1.90k
    stmt_ty p;
7628
1.90k
    if (!test) {
7629
0
        PyErr_SetString(PyExc_ValueError,
7630
0
                        "field 'test' is required for Assert");
7631
0
        return NULL;
7632
0
    }
7633
1.90k
    p = (stmt_ty)_PyArena_Malloc(arena, sizeof(*p));
7634
1.90k
    if (!p)
7635
0
        return NULL;
7636
1.90k
    p->kind = Assert_kind;
7637
1.90k
    p->v.Assert.test = test;
7638
1.90k
    p->v.Assert.msg = msg;
7639
1.90k
    p->lineno = lineno;
7640
1.90k
    p->col_offset = col_offset;
7641
1.90k
    p->end_lineno = end_lineno;
7642
1.90k
    p->end_col_offset = end_col_offset;
7643
1.90k
    return p;
7644
1.90k
}
7645
7646
stmt_ty
7647
_PyAST_Import(asdl_alias_seq * names, int is_lazy, int lineno, int col_offset,
7648
              int end_lineno, int end_col_offset, PyArena *arena)
7649
2.52k
{
7650
2.52k
    stmt_ty p;
7651
2.52k
    p = (stmt_ty)_PyArena_Malloc(arena, sizeof(*p));
7652
2.52k
    if (!p)
7653
0
        return NULL;
7654
2.52k
    p->kind = Import_kind;
7655
2.52k
    p->v.Import.names = names;
7656
2.52k
    p->v.Import.is_lazy = is_lazy;
7657
2.52k
    p->lineno = lineno;
7658
2.52k
    p->col_offset = col_offset;
7659
2.52k
    p->end_lineno = end_lineno;
7660
2.52k
    p->end_col_offset = end_col_offset;
7661
2.52k
    return p;
7662
2.52k
}
7663
7664
stmt_ty
7665
_PyAST_ImportFrom(identifier module, asdl_alias_seq * names, int level, int
7666
                  is_lazy, int lineno, int col_offset, int end_lineno, int
7667
                  end_col_offset, PyArena *arena)
7668
3.02k
{
7669
3.02k
    stmt_ty p;
7670
3.02k
    p = (stmt_ty)_PyArena_Malloc(arena, sizeof(*p));
7671
3.02k
    if (!p)
7672
0
        return NULL;
7673
3.02k
    p->kind = ImportFrom_kind;
7674
3.02k
    p->v.ImportFrom.module = module;
7675
3.02k
    p->v.ImportFrom.names = names;
7676
3.02k
    p->v.ImportFrom.level = level;
7677
3.02k
    p->v.ImportFrom.is_lazy = is_lazy;
7678
3.02k
    p->lineno = lineno;
7679
3.02k
    p->col_offset = col_offset;
7680
3.02k
    p->end_lineno = end_lineno;
7681
3.02k
    p->end_col_offset = end_col_offset;
7682
3.02k
    return p;
7683
3.02k
}
7684
7685
stmt_ty
7686
_PyAST_Global(asdl_identifier_seq * names, int lineno, int col_offset, int
7687
              end_lineno, int end_col_offset, PyArena *arena)
7688
535
{
7689
535
    stmt_ty p;
7690
535
    p = (stmt_ty)_PyArena_Malloc(arena, sizeof(*p));
7691
535
    if (!p)
7692
0
        return NULL;
7693
535
    p->kind = Global_kind;
7694
535
    p->v.Global.names = names;
7695
535
    p->lineno = lineno;
7696
535
    p->col_offset = col_offset;
7697
535
    p->end_lineno = end_lineno;
7698
535
    p->end_col_offset = end_col_offset;
7699
535
    return p;
7700
535
}
7701
7702
stmt_ty
7703
_PyAST_Nonlocal(asdl_identifier_seq * names, int lineno, int col_offset, int
7704
                end_lineno, int end_col_offset, PyArena *arena)
7705
504
{
7706
504
    stmt_ty p;
7707
504
    p = (stmt_ty)_PyArena_Malloc(arena, sizeof(*p));
7708
504
    if (!p)
7709
0
        return NULL;
7710
504
    p->kind = Nonlocal_kind;
7711
504
    p->v.Nonlocal.names = names;
7712
504
    p->lineno = lineno;
7713
504
    p->col_offset = col_offset;
7714
504
    p->end_lineno = end_lineno;
7715
504
    p->end_col_offset = end_col_offset;
7716
504
    return p;
7717
504
}
7718
7719
stmt_ty
7720
_PyAST_Expr(expr_ty value, int lineno, int col_offset, int end_lineno, int
7721
            end_col_offset, PyArena *arena)
7722
80.4k
{
7723
80.4k
    stmt_ty p;
7724
80.4k
    if (!value) {
7725
0
        PyErr_SetString(PyExc_ValueError,
7726
0
                        "field 'value' is required for Expr");
7727
0
        return NULL;
7728
0
    }
7729
80.4k
    p = (stmt_ty)_PyArena_Malloc(arena, sizeof(*p));
7730
80.4k
    if (!p)
7731
0
        return NULL;
7732
80.4k
    p->kind = Expr_kind;
7733
80.4k
    p->v.Expr.value = value;
7734
80.4k
    p->lineno = lineno;
7735
80.4k
    p->col_offset = col_offset;
7736
80.4k
    p->end_lineno = end_lineno;
7737
80.4k
    p->end_col_offset = end_col_offset;
7738
80.4k
    return p;
7739
80.4k
}
7740
7741
stmt_ty
7742
_PyAST_Pass(int lineno, int col_offset, int end_lineno, int end_col_offset,
7743
            PyArena *arena)
7744
1.69k
{
7745
1.69k
    stmt_ty p;
7746
1.69k
    p = (stmt_ty)_PyArena_Malloc(arena, sizeof(*p));
7747
1.69k
    if (!p)
7748
0
        return NULL;
7749
1.69k
    p->kind = Pass_kind;
7750
1.69k
    p->lineno = lineno;
7751
1.69k
    p->col_offset = col_offset;
7752
1.69k
    p->end_lineno = end_lineno;
7753
1.69k
    p->end_col_offset = end_col_offset;
7754
1.69k
    return p;
7755
1.69k
}
7756
7757
stmt_ty
7758
_PyAST_Break(int lineno, int col_offset, int end_lineno, int end_col_offset,
7759
             PyArena *arena)
7760
71
{
7761
71
    stmt_ty p;
7762
71
    p = (stmt_ty)_PyArena_Malloc(arena, sizeof(*p));
7763
71
    if (!p)
7764
0
        return NULL;
7765
71
    p->kind = Break_kind;
7766
71
    p->lineno = lineno;
7767
71
    p->col_offset = col_offset;
7768
71
    p->end_lineno = end_lineno;
7769
71
    p->end_col_offset = end_col_offset;
7770
71
    return p;
7771
71
}
7772
7773
stmt_ty
7774
_PyAST_Continue(int lineno, int col_offset, int end_lineno, int end_col_offset,
7775
                PyArena *arena)
7776
1.43k
{
7777
1.43k
    stmt_ty p;
7778
1.43k
    p = (stmt_ty)_PyArena_Malloc(arena, sizeof(*p));
7779
1.43k
    if (!p)
7780
0
        return NULL;
7781
1.43k
    p->kind = Continue_kind;
7782
1.43k
    p->lineno = lineno;
7783
1.43k
    p->col_offset = col_offset;
7784
1.43k
    p->end_lineno = end_lineno;
7785
1.43k
    p->end_col_offset = end_col_offset;
7786
1.43k
    return p;
7787
1.43k
}
7788
7789
expr_ty
7790
_PyAST_BoolOp(boolop_ty op, asdl_expr_seq * values, int lineno, int col_offset,
7791
              int end_lineno, int end_col_offset, PyArena *arena)
7792
3.72k
{
7793
3.72k
    expr_ty p;
7794
3.72k
    if (!op) {
7795
0
        PyErr_SetString(PyExc_ValueError,
7796
0
                        "field 'op' is required for BoolOp");
7797
0
        return NULL;
7798
0
    }
7799
3.72k
    p = (expr_ty)_PyArena_Malloc(arena, sizeof(*p));
7800
3.72k
    if (!p)
7801
0
        return NULL;
7802
3.72k
    p->kind = BoolOp_kind;
7803
3.72k
    p->v.BoolOp.op = op;
7804
3.72k
    p->v.BoolOp.values = values;
7805
3.72k
    p->lineno = lineno;
7806
3.72k
    p->col_offset = col_offset;
7807
3.72k
    p->end_lineno = end_lineno;
7808
3.72k
    p->end_col_offset = end_col_offset;
7809
3.72k
    return p;
7810
3.72k
}
7811
7812
expr_ty
7813
_PyAST_NamedExpr(expr_ty target, expr_ty value, int lineno, int col_offset, int
7814
                 end_lineno, int end_col_offset, PyArena *arena)
7815
4.09k
{
7816
4.09k
    expr_ty p;
7817
4.09k
    if (!target) {
7818
0
        PyErr_SetString(PyExc_ValueError,
7819
0
                        "field 'target' is required for NamedExpr");
7820
0
        return NULL;
7821
0
    }
7822
4.09k
    if (!value) {
7823
0
        PyErr_SetString(PyExc_ValueError,
7824
0
                        "field 'value' is required for NamedExpr");
7825
0
        return NULL;
7826
0
    }
7827
4.09k
    p = (expr_ty)_PyArena_Malloc(arena, sizeof(*p));
7828
4.09k
    if (!p)
7829
0
        return NULL;
7830
4.09k
    p->kind = NamedExpr_kind;
7831
4.09k
    p->v.NamedExpr.target = target;
7832
4.09k
    p->v.NamedExpr.value = value;
7833
4.09k
    p->lineno = lineno;
7834
4.09k
    p->col_offset = col_offset;
7835
4.09k
    p->end_lineno = end_lineno;
7836
4.09k
    p->end_col_offset = end_col_offset;
7837
4.09k
    return p;
7838
4.09k
}
7839
7840
expr_ty
7841
_PyAST_BinOp(expr_ty left, operator_ty op, expr_ty right, int lineno, int
7842
             col_offset, int end_lineno, int end_col_offset, PyArena *arena)
7843
374k
{
7844
374k
    expr_ty p;
7845
374k
    if (!left) {
7846
0
        PyErr_SetString(PyExc_ValueError,
7847
0
                        "field 'left' is required for BinOp");
7848
0
        return NULL;
7849
0
    }
7850
374k
    if (!op) {
7851
0
        PyErr_SetString(PyExc_ValueError,
7852
0
                        "field 'op' is required for BinOp");
7853
0
        return NULL;
7854
0
    }
7855
374k
    if (!right) {
7856
0
        PyErr_SetString(PyExc_ValueError,
7857
0
                        "field 'right' is required for BinOp");
7858
0
        return NULL;
7859
0
    }
7860
374k
    p = (expr_ty)_PyArena_Malloc(arena, sizeof(*p));
7861
374k
    if (!p)
7862
0
        return NULL;
7863
374k
    p->kind = BinOp_kind;
7864
374k
    p->v.BinOp.left = left;
7865
374k
    p->v.BinOp.op = op;
7866
374k
    p->v.BinOp.right = right;
7867
374k
    p->lineno = lineno;
7868
374k
    p->col_offset = col_offset;
7869
374k
    p->end_lineno = end_lineno;
7870
374k
    p->end_col_offset = end_col_offset;
7871
374k
    return p;
7872
374k
}
7873
7874
expr_ty
7875
_PyAST_UnaryOp(unaryop_ty op, expr_ty operand, int lineno, int col_offset, int
7876
               end_lineno, int end_col_offset, PyArena *arena)
7877
137k
{
7878
137k
    expr_ty p;
7879
137k
    if (!op) {
7880
0
        PyErr_SetString(PyExc_ValueError,
7881
0
                        "field 'op' is required for UnaryOp");
7882
0
        return NULL;
7883
0
    }
7884
137k
    if (!operand) {
7885
0
        PyErr_SetString(PyExc_ValueError,
7886
0
                        "field 'operand' is required for UnaryOp");
7887
0
        return NULL;
7888
0
    }
7889
137k
    p = (expr_ty)_PyArena_Malloc(arena, sizeof(*p));
7890
137k
    if (!p)
7891
0
        return NULL;
7892
137k
    p->kind = UnaryOp_kind;
7893
137k
    p->v.UnaryOp.op = op;
7894
137k
    p->v.UnaryOp.operand = operand;
7895
137k
    p->lineno = lineno;
7896
137k
    p->col_offset = col_offset;
7897
137k
    p->end_lineno = end_lineno;
7898
137k
    p->end_col_offset = end_col_offset;
7899
137k
    return p;
7900
137k
}
7901
7902
expr_ty
7903
_PyAST_Lambda(arguments_ty args, expr_ty body, int lineno, int col_offset, int
7904
              end_lineno, int end_col_offset, PyArena *arena)
7905
3.52k
{
7906
3.52k
    expr_ty p;
7907
3.52k
    if (!args) {
7908
0
        PyErr_SetString(PyExc_ValueError,
7909
0
                        "field 'args' is required for Lambda");
7910
0
        return NULL;
7911
0
    }
7912
3.52k
    if (!body) {
7913
0
        PyErr_SetString(PyExc_ValueError,
7914
0
                        "field 'body' is required for Lambda");
7915
0
        return NULL;
7916
0
    }
7917
3.52k
    p = (expr_ty)_PyArena_Malloc(arena, sizeof(*p));
7918
3.52k
    if (!p)
7919
0
        return NULL;
7920
3.52k
    p->kind = Lambda_kind;
7921
3.52k
    p->v.Lambda.args = args;
7922
3.52k
    p->v.Lambda.body = body;
7923
3.52k
    p->lineno = lineno;
7924
3.52k
    p->col_offset = col_offset;
7925
3.52k
    p->end_lineno = end_lineno;
7926
3.52k
    p->end_col_offset = end_col_offset;
7927
3.52k
    return p;
7928
3.52k
}
7929
7930
expr_ty
7931
_PyAST_IfExp(expr_ty test, expr_ty body, expr_ty orelse, int lineno, int
7932
             col_offset, int end_lineno, int end_col_offset, PyArena *arena)
7933
2.51k
{
7934
2.51k
    expr_ty p;
7935
2.51k
    if (!test) {
7936
0
        PyErr_SetString(PyExc_ValueError,
7937
0
                        "field 'test' is required for IfExp");
7938
0
        return NULL;
7939
0
    }
7940
2.51k
    if (!body) {
7941
0
        PyErr_SetString(PyExc_ValueError,
7942
0
                        "field 'body' is required for IfExp");
7943
0
        return NULL;
7944
0
    }
7945
2.51k
    if (!orelse) {
7946
0
        PyErr_SetString(PyExc_ValueError,
7947
0
                        "field 'orelse' is required for IfExp");
7948
0
        return NULL;
7949
0
    }
7950
2.51k
    p = (expr_ty)_PyArena_Malloc(arena, sizeof(*p));
7951
2.51k
    if (!p)
7952
0
        return NULL;
7953
2.51k
    p->kind = IfExp_kind;
7954
2.51k
    p->v.IfExp.test = test;
7955
2.51k
    p->v.IfExp.body = body;
7956
2.51k
    p->v.IfExp.orelse = orelse;
7957
2.51k
    p->lineno = lineno;
7958
2.51k
    p->col_offset = col_offset;
7959
2.51k
    p->end_lineno = end_lineno;
7960
2.51k
    p->end_col_offset = end_col_offset;
7961
2.51k
    return p;
7962
2.51k
}
7963
7964
expr_ty
7965
_PyAST_Dict(asdl_expr_seq * keys, asdl_expr_seq * values, int lineno, int
7966
            col_offset, int end_lineno, int end_col_offset, PyArena *arena)
7967
475
{
7968
475
    expr_ty p;
7969
475
    p = (expr_ty)_PyArena_Malloc(arena, sizeof(*p));
7970
475
    if (!p)
7971
0
        return NULL;
7972
475
    p->kind = Dict_kind;
7973
475
    p->v.Dict.keys = keys;
7974
475
    p->v.Dict.values = values;
7975
475
    p->lineno = lineno;
7976
475
    p->col_offset = col_offset;
7977
475
    p->end_lineno = end_lineno;
7978
475
    p->end_col_offset = end_col_offset;
7979
475
    return p;
7980
475
}
7981
7982
expr_ty
7983
_PyAST_Set(asdl_expr_seq * elts, int lineno, int col_offset, int end_lineno,
7984
           int end_col_offset, PyArena *arena)
7985
3.68k
{
7986
3.68k
    expr_ty p;
7987
3.68k
    p = (expr_ty)_PyArena_Malloc(arena, sizeof(*p));
7988
3.68k
    if (!p)
7989
0
        return NULL;
7990
3.68k
    p->kind = Set_kind;
7991
3.68k
    p->v.Set.elts = elts;
7992
3.68k
    p->lineno = lineno;
7993
3.68k
    p->col_offset = col_offset;
7994
3.68k
    p->end_lineno = end_lineno;
7995
3.68k
    p->end_col_offset = end_col_offset;
7996
3.68k
    return p;
7997
3.68k
}
7998
7999
expr_ty
8000
_PyAST_ListComp(expr_ty elt, asdl_comprehension_seq * generators, int lineno,
8001
                int col_offset, int end_lineno, int end_col_offset, PyArena
8002
                *arena)
8003
110
{
8004
110
    expr_ty p;
8005
110
    if (!elt) {
8006
0
        PyErr_SetString(PyExc_ValueError,
8007
0
                        "field 'elt' is required for ListComp");
8008
0
        return NULL;
8009
0
    }
8010
110
    p = (expr_ty)_PyArena_Malloc(arena, sizeof(*p));
8011
110
    if (!p)
8012
0
        return NULL;
8013
110
    p->kind = ListComp_kind;
8014
110
    p->v.ListComp.elt = elt;
8015
110
    p->v.ListComp.generators = generators;
8016
110
    p->lineno = lineno;
8017
110
    p->col_offset = col_offset;
8018
110
    p->end_lineno = end_lineno;
8019
110
    p->end_col_offset = end_col_offset;
8020
110
    return p;
8021
110
}
8022
8023
expr_ty
8024
_PyAST_SetComp(expr_ty elt, asdl_comprehension_seq * generators, int lineno,
8025
               int col_offset, int end_lineno, int end_col_offset, PyArena
8026
               *arena)
8027
4.26k
{
8028
4.26k
    expr_ty p;
8029
4.26k
    if (!elt) {
8030
0
        PyErr_SetString(PyExc_ValueError,
8031
0
                        "field 'elt' is required for SetComp");
8032
0
        return NULL;
8033
0
    }
8034
4.26k
    p = (expr_ty)_PyArena_Malloc(arena, sizeof(*p));
8035
4.26k
    if (!p)
8036
0
        return NULL;
8037
4.26k
    p->kind = SetComp_kind;
8038
4.26k
    p->v.SetComp.elt = elt;
8039
4.26k
    p->v.SetComp.generators = generators;
8040
4.26k
    p->lineno = lineno;
8041
4.26k
    p->col_offset = col_offset;
8042
4.26k
    p->end_lineno = end_lineno;
8043
4.26k
    p->end_col_offset = end_col_offset;
8044
4.26k
    return p;
8045
4.26k
}
8046
8047
expr_ty
8048
_PyAST_DictComp(expr_ty key, expr_ty value, asdl_comprehension_seq *
8049
                generators, int lineno, int col_offset, int end_lineno, int
8050
                end_col_offset, PyArena *arena)
8051
1.14k
{
8052
1.14k
    expr_ty p;
8053
1.14k
    if (!key) {
8054
0
        PyErr_SetString(PyExc_ValueError,
8055
0
                        "field 'key' is required for DictComp");
8056
0
        return NULL;
8057
0
    }
8058
1.14k
    p = (expr_ty)_PyArena_Malloc(arena, sizeof(*p));
8059
1.14k
    if (!p)
8060
0
        return NULL;
8061
1.14k
    p->kind = DictComp_kind;
8062
1.14k
    p->v.DictComp.key = key;
8063
1.14k
    p->v.DictComp.value = value;
8064
1.14k
    p->v.DictComp.generators = generators;
8065
1.14k
    p->lineno = lineno;
8066
1.14k
    p->col_offset = col_offset;
8067
1.14k
    p->end_lineno = end_lineno;
8068
1.14k
    p->end_col_offset = end_col_offset;
8069
1.14k
    return p;
8070
1.14k
}
8071
8072
expr_ty
8073
_PyAST_GeneratorExp(expr_ty elt, asdl_comprehension_seq * generators, int
8074
                    lineno, int col_offset, int end_lineno, int end_col_offset,
8075
                    PyArena *arena)
8076
7.11k
{
8077
7.11k
    expr_ty p;
8078
7.11k
    if (!elt) {
8079
0
        PyErr_SetString(PyExc_ValueError,
8080
0
                        "field 'elt' is required for GeneratorExp");
8081
0
        return NULL;
8082
0
    }
8083
7.11k
    p = (expr_ty)_PyArena_Malloc(arena, sizeof(*p));
8084
7.11k
    if (!p)
8085
0
        return NULL;
8086
7.11k
    p->kind = GeneratorExp_kind;
8087
7.11k
    p->v.GeneratorExp.elt = elt;
8088
7.11k
    p->v.GeneratorExp.generators = generators;
8089
7.11k
    p->lineno = lineno;
8090
7.11k
    p->col_offset = col_offset;
8091
7.11k
    p->end_lineno = end_lineno;
8092
7.11k
    p->end_col_offset = end_col_offset;
8093
7.11k
    return p;
8094
7.11k
}
8095
8096
expr_ty
8097
_PyAST_Await(expr_ty value, int lineno, int col_offset, int end_lineno, int
8098
             end_col_offset, PyArena *arena)
8099
196
{
8100
196
    expr_ty p;
8101
196
    if (!value) {
8102
0
        PyErr_SetString(PyExc_ValueError,
8103
0
                        "field 'value' is required for Await");
8104
0
        return NULL;
8105
0
    }
8106
196
    p = (expr_ty)_PyArena_Malloc(arena, sizeof(*p));
8107
196
    if (!p)
8108
0
        return NULL;
8109
196
    p->kind = Await_kind;
8110
196
    p->v.Await.value = value;
8111
196
    p->lineno = lineno;
8112
196
    p->col_offset = col_offset;
8113
196
    p->end_lineno = end_lineno;
8114
196
    p->end_col_offset = end_col_offset;
8115
196
    return p;
8116
196
}
8117
8118
expr_ty
8119
_PyAST_Yield(expr_ty value, int lineno, int col_offset, int end_lineno, int
8120
             end_col_offset, PyArena *arena)
8121
1.80k
{
8122
1.80k
    expr_ty p;
8123
1.80k
    p = (expr_ty)_PyArena_Malloc(arena, sizeof(*p));
8124
1.80k
    if (!p)
8125
0
        return NULL;
8126
1.80k
    p->kind = Yield_kind;
8127
1.80k
    p->v.Yield.value = value;
8128
1.80k
    p->lineno = lineno;
8129
1.80k
    p->col_offset = col_offset;
8130
1.80k
    p->end_lineno = end_lineno;
8131
1.80k
    p->end_col_offset = end_col_offset;
8132
1.80k
    return p;
8133
1.80k
}
8134
8135
expr_ty
8136
_PyAST_YieldFrom(expr_ty value, int lineno, int col_offset, int end_lineno, int
8137
                 end_col_offset, PyArena *arena)
8138
41
{
8139
41
    expr_ty p;
8140
41
    if (!value) {
8141
0
        PyErr_SetString(PyExc_ValueError,
8142
0
                        "field 'value' is required for YieldFrom");
8143
0
        return NULL;
8144
0
    }
8145
41
    p = (expr_ty)_PyArena_Malloc(arena, sizeof(*p));
8146
41
    if (!p)
8147
0
        return NULL;
8148
41
    p->kind = YieldFrom_kind;
8149
41
    p->v.YieldFrom.value = value;
8150
41
    p->lineno = lineno;
8151
41
    p->col_offset = col_offset;
8152
41
    p->end_lineno = end_lineno;
8153
41
    p->end_col_offset = end_col_offset;
8154
41
    return p;
8155
41
}
8156
8157
expr_ty
8158
_PyAST_Compare(expr_ty left, asdl_int_seq * ops, asdl_expr_seq * comparators,
8159
               int lineno, int col_offset, int end_lineno, int end_col_offset,
8160
               PyArena *arena)
8161
14.0k
{
8162
14.0k
    expr_ty p;
8163
14.0k
    if (!left) {
8164
0
        PyErr_SetString(PyExc_ValueError,
8165
0
                        "field 'left' is required for Compare");
8166
0
        return NULL;
8167
0
    }
8168
14.0k
    p = (expr_ty)_PyArena_Malloc(arena, sizeof(*p));
8169
14.0k
    if (!p)
8170
0
        return NULL;
8171
14.0k
    p->kind = Compare_kind;
8172
14.0k
    p->v.Compare.left = left;
8173
14.0k
    p->v.Compare.ops = ops;
8174
14.0k
    p->v.Compare.comparators = comparators;
8175
14.0k
    p->lineno = lineno;
8176
14.0k
    p->col_offset = col_offset;
8177
14.0k
    p->end_lineno = end_lineno;
8178
14.0k
    p->end_col_offset = end_col_offset;
8179
14.0k
    return p;
8180
14.0k
}
8181
8182
expr_ty
8183
_PyAST_Call(expr_ty func, asdl_expr_seq * args, asdl_keyword_seq * keywords,
8184
            int lineno, int col_offset, int end_lineno, int end_col_offset,
8185
            PyArena *arena)
8186
41.3k
{
8187
41.3k
    expr_ty p;
8188
41.3k
    if (!func) {
8189
0
        PyErr_SetString(PyExc_ValueError,
8190
0
                        "field 'func' is required for Call");
8191
0
        return NULL;
8192
0
    }
8193
41.3k
    p = (expr_ty)_PyArena_Malloc(arena, sizeof(*p));
8194
41.3k
    if (!p)
8195
0
        return NULL;
8196
41.3k
    p->kind = Call_kind;
8197
41.3k
    p->v.Call.func = func;
8198
41.3k
    p->v.Call.args = args;
8199
41.3k
    p->v.Call.keywords = keywords;
8200
41.3k
    p->lineno = lineno;
8201
41.3k
    p->col_offset = col_offset;
8202
41.3k
    p->end_lineno = end_lineno;
8203
41.3k
    p->end_col_offset = end_col_offset;
8204
41.3k
    return p;
8205
41.3k
}
8206
8207
expr_ty
8208
_PyAST_FormattedValue(expr_ty value, int conversion, expr_ty format_spec, int
8209
                      lineno, int col_offset, int end_lineno, int
8210
                      end_col_offset, PyArena *arena)
8211
4.64k
{
8212
4.64k
    expr_ty p;
8213
4.64k
    if (!value) {
8214
0
        PyErr_SetString(PyExc_ValueError,
8215
0
                        "field 'value' is required for FormattedValue");
8216
0
        return NULL;
8217
0
    }
8218
4.64k
    p = (expr_ty)_PyArena_Malloc(arena, sizeof(*p));
8219
4.64k
    if (!p)
8220
0
        return NULL;
8221
4.64k
    p->kind = FormattedValue_kind;
8222
4.64k
    p->v.FormattedValue.value = value;
8223
4.64k
    p->v.FormattedValue.conversion = conversion;
8224
4.64k
    p->v.FormattedValue.format_spec = format_spec;
8225
4.64k
    p->lineno = lineno;
8226
4.64k
    p->col_offset = col_offset;
8227
4.64k
    p->end_lineno = end_lineno;
8228
4.64k
    p->end_col_offset = end_col_offset;
8229
4.64k
    return p;
8230
4.64k
}
8231
8232
expr_ty
8233
_PyAST_Interpolation(expr_ty value, constant str, int conversion, expr_ty
8234
                     format_spec, int lineno, int col_offset, int end_lineno,
8235
                     int end_col_offset, PyArena *arena)
8236
1.93k
{
8237
1.93k
    expr_ty p;
8238
1.93k
    if (!value) {
8239
0
        PyErr_SetString(PyExc_ValueError,
8240
0
                        "field 'value' is required for Interpolation");
8241
0
        return NULL;
8242
0
    }
8243
1.93k
    if (!str) {
8244
0
        PyErr_SetString(PyExc_ValueError,
8245
0
                        "field 'str' is required for Interpolation");
8246
0
        return NULL;
8247
0
    }
8248
1.93k
    p = (expr_ty)_PyArena_Malloc(arena, sizeof(*p));
8249
1.93k
    if (!p)
8250
0
        return NULL;
8251
1.93k
    p->kind = Interpolation_kind;
8252
1.93k
    p->v.Interpolation.value = value;
8253
1.93k
    p->v.Interpolation.str = str;
8254
1.93k
    p->v.Interpolation.conversion = conversion;
8255
1.93k
    p->v.Interpolation.format_spec = format_spec;
8256
1.93k
    p->lineno = lineno;
8257
1.93k
    p->col_offset = col_offset;
8258
1.93k
    p->end_lineno = end_lineno;
8259
1.93k
    p->end_col_offset = end_col_offset;
8260
1.93k
    return p;
8261
1.93k
}
8262
8263
expr_ty
8264
_PyAST_JoinedStr(asdl_expr_seq * values, int lineno, int col_offset, int
8265
                 end_lineno, int end_col_offset, PyArena *arena)
8266
24.6k
{
8267
24.6k
    expr_ty p;
8268
24.6k
    p = (expr_ty)_PyArena_Malloc(arena, sizeof(*p));
8269
24.6k
    if (!p)
8270
0
        return NULL;
8271
24.6k
    p->kind = JoinedStr_kind;
8272
24.6k
    p->v.JoinedStr.values = values;
8273
24.6k
    p->lineno = lineno;
8274
24.6k
    p->col_offset = col_offset;
8275
24.6k
    p->end_lineno = end_lineno;
8276
24.6k
    p->end_col_offset = end_col_offset;
8277
24.6k
    return p;
8278
24.6k
}
8279
8280
expr_ty
8281
_PyAST_TemplateStr(asdl_expr_seq * values, int lineno, int col_offset, int
8282
                   end_lineno, int end_col_offset, PyArena *arena)
8283
4.64k
{
8284
4.64k
    expr_ty p;
8285
4.64k
    p = (expr_ty)_PyArena_Malloc(arena, sizeof(*p));
8286
4.64k
    if (!p)
8287
0
        return NULL;
8288
4.64k
    p->kind = TemplateStr_kind;
8289
4.64k
    p->v.TemplateStr.values = values;
8290
4.64k
    p->lineno = lineno;
8291
4.64k
    p->col_offset = col_offset;
8292
4.64k
    p->end_lineno = end_lineno;
8293
4.64k
    p->end_col_offset = end_col_offset;
8294
4.64k
    return p;
8295
4.64k
}
8296
8297
expr_ty
8298
_PyAST_Constant(constant value, string kind, int lineno, int col_offset, int
8299
                end_lineno, int end_col_offset, PyArena *arena)
8300
973k
{
8301
973k
    expr_ty p;
8302
973k
    if (!value) {
8303
1
        PyErr_SetString(PyExc_ValueError,
8304
1
                        "field 'value' is required for Constant");
8305
1
        return NULL;
8306
1
    }
8307
973k
    p = (expr_ty)_PyArena_Malloc(arena, sizeof(*p));
8308
973k
    if (!p)
8309
0
        return NULL;
8310
973k
    p->kind = Constant_kind;
8311
973k
    p->v.Constant.value = value;
8312
973k
    p->v.Constant.kind = kind;
8313
973k
    p->lineno = lineno;
8314
973k
    p->col_offset = col_offset;
8315
973k
    p->end_lineno = end_lineno;
8316
973k
    p->end_col_offset = end_col_offset;
8317
973k
    return p;
8318
973k
}
8319
8320
expr_ty
8321
_PyAST_Attribute(expr_ty value, identifier attr, expr_context_ty ctx, int
8322
                 lineno, int col_offset, int end_lineno, int end_col_offset,
8323
                 PyArena *arena)
8324
26.1k
{
8325
26.1k
    expr_ty p;
8326
26.1k
    if (!value) {
8327
0
        PyErr_SetString(PyExc_ValueError,
8328
0
                        "field 'value' is required for Attribute");
8329
0
        return NULL;
8330
0
    }
8331
26.1k
    if (!attr) {
8332
0
        PyErr_SetString(PyExc_ValueError,
8333
0
                        "field 'attr' is required for Attribute");
8334
0
        return NULL;
8335
0
    }
8336
26.1k
    if (!ctx) {
8337
0
        PyErr_SetString(PyExc_ValueError,
8338
0
                        "field 'ctx' is required for Attribute");
8339
0
        return NULL;
8340
0
    }
8341
26.1k
    p = (expr_ty)_PyArena_Malloc(arena, sizeof(*p));
8342
26.1k
    if (!p)
8343
0
        return NULL;
8344
26.1k
    p->kind = Attribute_kind;
8345
26.1k
    p->v.Attribute.value = value;
8346
26.1k
    p->v.Attribute.attr = attr;
8347
26.1k
    p->v.Attribute.ctx = ctx;
8348
26.1k
    p->lineno = lineno;
8349
26.1k
    p->col_offset = col_offset;
8350
26.1k
    p->end_lineno = end_lineno;
8351
26.1k
    p->end_col_offset = end_col_offset;
8352
26.1k
    return p;
8353
26.1k
}
8354
8355
expr_ty
8356
_PyAST_Subscript(expr_ty value, expr_ty slice, expr_context_ty ctx, int lineno,
8357
                 int col_offset, int end_lineno, int end_col_offset, PyArena
8358
                 *arena)
8359
11.4k
{
8360
11.4k
    expr_ty p;
8361
11.4k
    if (!value) {
8362
0
        PyErr_SetString(PyExc_ValueError,
8363
0
                        "field 'value' is required for Subscript");
8364
0
        return NULL;
8365
0
    }
8366
11.4k
    if (!slice) {
8367
0
        PyErr_SetString(PyExc_ValueError,
8368
0
                        "field 'slice' is required for Subscript");
8369
0
        return NULL;
8370
0
    }
8371
11.4k
    if (!ctx) {
8372
0
        PyErr_SetString(PyExc_ValueError,
8373
0
                        "field 'ctx' is required for Subscript");
8374
0
        return NULL;
8375
0
    }
8376
11.4k
    p = (expr_ty)_PyArena_Malloc(arena, sizeof(*p));
8377
11.4k
    if (!p)
8378
0
        return NULL;
8379
11.4k
    p->kind = Subscript_kind;
8380
11.4k
    p->v.Subscript.value = value;
8381
11.4k
    p->v.Subscript.slice = slice;
8382
11.4k
    p->v.Subscript.ctx = ctx;
8383
11.4k
    p->lineno = lineno;
8384
11.4k
    p->col_offset = col_offset;
8385
11.4k
    p->end_lineno = end_lineno;
8386
11.4k
    p->end_col_offset = end_col_offset;
8387
11.4k
    return p;
8388
11.4k
}
8389
8390
expr_ty
8391
_PyAST_Starred(expr_ty value, expr_context_ty ctx, int lineno, int col_offset,
8392
               int end_lineno, int end_col_offset, PyArena *arena)
8393
33.0k
{
8394
33.0k
    expr_ty p;
8395
33.0k
    if (!value) {
8396
0
        PyErr_SetString(PyExc_ValueError,
8397
0
                        "field 'value' is required for Starred");
8398
0
        return NULL;
8399
0
    }
8400
33.0k
    if (!ctx) {
8401
0
        PyErr_SetString(PyExc_ValueError,
8402
0
                        "field 'ctx' is required for Starred");
8403
0
        return NULL;
8404
0
    }
8405
33.0k
    p = (expr_ty)_PyArena_Malloc(arena, sizeof(*p));
8406
33.0k
    if (!p)
8407
0
        return NULL;
8408
33.0k
    p->kind = Starred_kind;
8409
33.0k
    p->v.Starred.value = value;
8410
33.0k
    p->v.Starred.ctx = ctx;
8411
33.0k
    p->lineno = lineno;
8412
33.0k
    p->col_offset = col_offset;
8413
33.0k
    p->end_lineno = end_lineno;
8414
33.0k
    p->end_col_offset = end_col_offset;
8415
33.0k
    return p;
8416
33.0k
}
8417
8418
expr_ty
8419
_PyAST_Name(identifier id, expr_context_ty ctx, int lineno, int col_offset, int
8420
            end_lineno, int end_col_offset, PyArena *arena)
8421
1.96M
{
8422
1.96M
    expr_ty p;
8423
1.96M
    if (!id) {
8424
0
        PyErr_SetString(PyExc_ValueError,
8425
0
                        "field 'id' is required for Name");
8426
0
        return NULL;
8427
0
    }
8428
1.96M
    if (!ctx) {
8429
0
        PyErr_SetString(PyExc_ValueError,
8430
0
                        "field 'ctx' is required for Name");
8431
0
        return NULL;
8432
0
    }
8433
1.96M
    p = (expr_ty)_PyArena_Malloc(arena, sizeof(*p));
8434
1.96M
    if (!p)
8435
0
        return NULL;
8436
1.96M
    p->kind = Name_kind;
8437
1.96M
    p->v.Name.id = id;
8438
1.96M
    p->v.Name.ctx = ctx;
8439
1.96M
    p->lineno = lineno;
8440
1.96M
    p->col_offset = col_offset;
8441
1.96M
    p->end_lineno = end_lineno;
8442
1.96M
    p->end_col_offset = end_col_offset;
8443
1.96M
    return p;
8444
1.96M
}
8445
8446
expr_ty
8447
_PyAST_List(asdl_expr_seq * elts, expr_context_ty ctx, int lineno, int
8448
            col_offset, int end_lineno, int end_col_offset, PyArena *arena)
8449
17.6k
{
8450
17.6k
    expr_ty p;
8451
17.6k
    if (!ctx) {
8452
0
        PyErr_SetString(PyExc_ValueError,
8453
0
                        "field 'ctx' is required for List");
8454
0
        return NULL;
8455
0
    }
8456
17.6k
    p = (expr_ty)_PyArena_Malloc(arena, sizeof(*p));
8457
17.6k
    if (!p)
8458
0
        return NULL;
8459
17.6k
    p->kind = List_kind;
8460
17.6k
    p->v.List.elts = elts;
8461
17.6k
    p->v.List.ctx = ctx;
8462
17.6k
    p->lineno = lineno;
8463
17.6k
    p->col_offset = col_offset;
8464
17.6k
    p->end_lineno = end_lineno;
8465
17.6k
    p->end_col_offset = end_col_offset;
8466
17.6k
    return p;
8467
17.6k
}
8468
8469
expr_ty
8470
_PyAST_Tuple(asdl_expr_seq * elts, expr_context_ty ctx, int lineno, int
8471
             col_offset, int end_lineno, int end_col_offset, PyArena *arena)
8472
59.4k
{
8473
59.4k
    expr_ty p;
8474
59.4k
    if (!ctx) {
8475
0
        PyErr_SetString(PyExc_ValueError,
8476
0
                        "field 'ctx' is required for Tuple");
8477
0
        return NULL;
8478
0
    }
8479
59.4k
    p = (expr_ty)_PyArena_Malloc(arena, sizeof(*p));
8480
59.4k
    if (!p)
8481
0
        return NULL;
8482
59.4k
    p->kind = Tuple_kind;
8483
59.4k
    p->v.Tuple.elts = elts;
8484
59.4k
    p->v.Tuple.ctx = ctx;
8485
59.4k
    p->lineno = lineno;
8486
59.4k
    p->col_offset = col_offset;
8487
59.4k
    p->end_lineno = end_lineno;
8488
59.4k
    p->end_col_offset = end_col_offset;
8489
59.4k
    return p;
8490
59.4k
}
8491
8492
expr_ty
8493
_PyAST_Slice(expr_ty lower, expr_ty upper, expr_ty step, int lineno, int
8494
             col_offset, int end_lineno, int end_col_offset, PyArena *arena)
8495
13.4k
{
8496
13.4k
    expr_ty p;
8497
13.4k
    p = (expr_ty)_PyArena_Malloc(arena, sizeof(*p));
8498
13.4k
    if (!p)
8499
0
        return NULL;
8500
13.4k
    p->kind = Slice_kind;
8501
13.4k
    p->v.Slice.lower = lower;
8502
13.4k
    p->v.Slice.upper = upper;
8503
13.4k
    p->v.Slice.step = step;
8504
13.4k
    p->lineno = lineno;
8505
13.4k
    p->col_offset = col_offset;
8506
13.4k
    p->end_lineno = end_lineno;
8507
13.4k
    p->end_col_offset = end_col_offset;
8508
13.4k
    return p;
8509
13.4k
}
8510
8511
comprehension_ty
8512
_PyAST_comprehension(expr_ty target, expr_ty iter, asdl_expr_seq * ifs, int
8513
                     is_async, PyArena *arena)
8514
15.8k
{
8515
15.8k
    comprehension_ty p;
8516
15.8k
    if (!target) {
8517
0
        PyErr_SetString(PyExc_ValueError,
8518
0
                        "field 'target' is required for comprehension");
8519
0
        return NULL;
8520
0
    }
8521
15.8k
    if (!iter) {
8522
0
        PyErr_SetString(PyExc_ValueError,
8523
0
                        "field 'iter' is required for comprehension");
8524
0
        return NULL;
8525
0
    }
8526
15.8k
    p = (comprehension_ty)_PyArena_Malloc(arena, sizeof(*p));
8527
15.8k
    if (!p)
8528
0
        return NULL;
8529
15.8k
    p->target = target;
8530
15.8k
    p->iter = iter;
8531
15.8k
    p->ifs = ifs;
8532
15.8k
    p->is_async = is_async;
8533
15.8k
    return p;
8534
15.8k
}
8535
8536
excepthandler_ty
8537
_PyAST_ExceptHandler(expr_ty type, identifier name, asdl_stmt_seq * body, int
8538
                     lineno, int col_offset, int end_lineno, int
8539
                     end_col_offset, PyArena *arena)
8540
5.37k
{
8541
5.37k
    excepthandler_ty p;
8542
5.37k
    p = (excepthandler_ty)_PyArena_Malloc(arena, sizeof(*p));
8543
5.37k
    if (!p)
8544
0
        return NULL;
8545
5.37k
    p->kind = ExceptHandler_kind;
8546
5.37k
    p->v.ExceptHandler.type = type;
8547
5.37k
    p->v.ExceptHandler.name = name;
8548
5.37k
    p->v.ExceptHandler.body = body;
8549
5.37k
    p->lineno = lineno;
8550
5.37k
    p->col_offset = col_offset;
8551
5.37k
    p->end_lineno = end_lineno;
8552
5.37k
    p->end_col_offset = end_col_offset;
8553
5.37k
    return p;
8554
5.37k
}
8555
8556
arguments_ty
8557
_PyAST_arguments(asdl_arg_seq * posonlyargs, asdl_arg_seq * args, arg_ty
8558
                 vararg, asdl_arg_seq * kwonlyargs, asdl_expr_seq *
8559
                 kw_defaults, arg_ty kwarg, asdl_expr_seq * defaults, PyArena
8560
                 *arena)
8561
17.0k
{
8562
17.0k
    arguments_ty p;
8563
17.0k
    p = (arguments_ty)_PyArena_Malloc(arena, sizeof(*p));
8564
17.0k
    if (!p)
8565
0
        return NULL;
8566
17.0k
    p->posonlyargs = posonlyargs;
8567
17.0k
    p->args = args;
8568
17.0k
    p->vararg = vararg;
8569
17.0k
    p->kwonlyargs = kwonlyargs;
8570
17.0k
    p->kw_defaults = kw_defaults;
8571
17.0k
    p->kwarg = kwarg;
8572
17.0k
    p->defaults = defaults;
8573
17.0k
    return p;
8574
17.0k
}
8575
8576
arg_ty
8577
_PyAST_arg(identifier arg, expr_ty annotation, string type_comment, int lineno,
8578
           int col_offset, int end_lineno, int end_col_offset, PyArena *arena)
8579
261k
{
8580
261k
    arg_ty p;
8581
261k
    if (!arg) {
8582
0
        PyErr_SetString(PyExc_ValueError,
8583
0
                        "field 'arg' is required for arg");
8584
0
        return NULL;
8585
0
    }
8586
261k
    p = (arg_ty)_PyArena_Malloc(arena, sizeof(*p));
8587
261k
    if (!p)
8588
0
        return NULL;
8589
261k
    p->arg = arg;
8590
261k
    p->annotation = annotation;
8591
261k
    p->type_comment = type_comment;
8592
261k
    p->lineno = lineno;
8593
261k
    p->col_offset = col_offset;
8594
261k
    p->end_lineno = end_lineno;
8595
261k
    p->end_col_offset = end_col_offset;
8596
261k
    return p;
8597
261k
}
8598
8599
keyword_ty
8600
_PyAST_keyword(identifier arg, expr_ty value, int lineno, int col_offset, int
8601
               end_lineno, int end_col_offset, PyArena *arena)
8602
21.4k
{
8603
21.4k
    keyword_ty p;
8604
21.4k
    if (!value) {
8605
0
        PyErr_SetString(PyExc_ValueError,
8606
0
                        "field 'value' is required for keyword");
8607
0
        return NULL;
8608
0
    }
8609
21.4k
    p = (keyword_ty)_PyArena_Malloc(arena, sizeof(*p));
8610
21.4k
    if (!p)
8611
0
        return NULL;
8612
21.4k
    p->arg = arg;
8613
21.4k
    p->value = value;
8614
21.4k
    p->lineno = lineno;
8615
21.4k
    p->col_offset = col_offset;
8616
21.4k
    p->end_lineno = end_lineno;
8617
21.4k
    p->end_col_offset = end_col_offset;
8618
21.4k
    return p;
8619
21.4k
}
8620
8621
alias_ty
8622
_PyAST_alias(identifier name, identifier asname, int lineno, int col_offset,
8623
             int end_lineno, int end_col_offset, PyArena *arena)
8624
19.6k
{
8625
19.6k
    alias_ty p;
8626
19.6k
    if (!name) {
8627
0
        PyErr_SetString(PyExc_ValueError,
8628
0
                        "field 'name' is required for alias");
8629
0
        return NULL;
8630
0
    }
8631
19.6k
    p = (alias_ty)_PyArena_Malloc(arena, sizeof(*p));
8632
19.6k
    if (!p)
8633
0
        return NULL;
8634
19.6k
    p->name = name;
8635
19.6k
    p->asname = asname;
8636
19.6k
    p->lineno = lineno;
8637
19.6k
    p->col_offset = col_offset;
8638
19.6k
    p->end_lineno = end_lineno;
8639
19.6k
    p->end_col_offset = end_col_offset;
8640
19.6k
    return p;
8641
19.6k
}
8642
8643
withitem_ty
8644
_PyAST_withitem(expr_ty context_expr, expr_ty optional_vars, PyArena *arena)
8645
9.84k
{
8646
9.84k
    withitem_ty p;
8647
9.84k
    if (!context_expr) {
8648
0
        PyErr_SetString(PyExc_ValueError,
8649
0
                        "field 'context_expr' is required for withitem");
8650
0
        return NULL;
8651
0
    }
8652
9.84k
    p = (withitem_ty)_PyArena_Malloc(arena, sizeof(*p));
8653
9.84k
    if (!p)
8654
0
        return NULL;
8655
9.84k
    p->context_expr = context_expr;
8656
9.84k
    p->optional_vars = optional_vars;
8657
9.84k
    return p;
8658
9.84k
}
8659
8660
match_case_ty
8661
_PyAST_match_case(pattern_ty pattern, expr_ty guard, asdl_stmt_seq * body,
8662
                  PyArena *arena)
8663
723
{
8664
723
    match_case_ty p;
8665
723
    if (!pattern) {
8666
0
        PyErr_SetString(PyExc_ValueError,
8667
0
                        "field 'pattern' is required for match_case");
8668
0
        return NULL;
8669
0
    }
8670
723
    p = (match_case_ty)_PyArena_Malloc(arena, sizeof(*p));
8671
723
    if (!p)
8672
0
        return NULL;
8673
723
    p->pattern = pattern;
8674
723
    p->guard = guard;
8675
723
    p->body = body;
8676
723
    return p;
8677
723
}
8678
8679
pattern_ty
8680
_PyAST_MatchValue(expr_ty value, int lineno, int col_offset, int end_lineno,
8681
                  int end_col_offset, PyArena *arena)
8682
362
{
8683
362
    pattern_ty p;
8684
362
    if (!value) {
8685
0
        PyErr_SetString(PyExc_ValueError,
8686
0
                        "field 'value' is required for MatchValue");
8687
0
        return NULL;
8688
0
    }
8689
362
    p = (pattern_ty)_PyArena_Malloc(arena, sizeof(*p));
8690
362
    if (!p)
8691
0
        return NULL;
8692
362
    p->kind = MatchValue_kind;
8693
362
    p->v.MatchValue.value = value;
8694
362
    p->lineno = lineno;
8695
362
    p->col_offset = col_offset;
8696
362
    p->end_lineno = end_lineno;
8697
362
    p->end_col_offset = end_col_offset;
8698
362
    return p;
8699
362
}
8700
8701
pattern_ty
8702
_PyAST_MatchSingleton(constant value, int lineno, int col_offset, int
8703
                      end_lineno, int end_col_offset, PyArena *arena)
8704
42
{
8705
42
    pattern_ty p;
8706
42
    if (!value) {
8707
0
        PyErr_SetString(PyExc_ValueError,
8708
0
                        "field 'value' is required for MatchSingleton");
8709
0
        return NULL;
8710
0
    }
8711
42
    p = (pattern_ty)_PyArena_Malloc(arena, sizeof(*p));
8712
42
    if (!p)
8713
0
        return NULL;
8714
42
    p->kind = MatchSingleton_kind;
8715
42
    p->v.MatchSingleton.value = value;
8716
42
    p->lineno = lineno;
8717
42
    p->col_offset = col_offset;
8718
42
    p->end_lineno = end_lineno;
8719
42
    p->end_col_offset = end_col_offset;
8720
42
    return p;
8721
42
}
8722
8723
pattern_ty
8724
_PyAST_MatchSequence(asdl_pattern_seq * patterns, int lineno, int col_offset,
8725
                     int end_lineno, int end_col_offset, PyArena *arena)
8726
351
{
8727
351
    pattern_ty p;
8728
351
    p = (pattern_ty)_PyArena_Malloc(arena, sizeof(*p));
8729
351
    if (!p)
8730
0
        return NULL;
8731
351
    p->kind = MatchSequence_kind;
8732
351
    p->v.MatchSequence.patterns = patterns;
8733
351
    p->lineno = lineno;
8734
351
    p->col_offset = col_offset;
8735
351
    p->end_lineno = end_lineno;
8736
351
    p->end_col_offset = end_col_offset;
8737
351
    return p;
8738
351
}
8739
8740
pattern_ty
8741
_PyAST_MatchMapping(asdl_expr_seq * keys, asdl_pattern_seq * patterns,
8742
                    identifier rest, int lineno, int col_offset, int
8743
                    end_lineno, int end_col_offset, PyArena *arena)
8744
4
{
8745
4
    pattern_ty p;
8746
4
    p = (pattern_ty)_PyArena_Malloc(arena, sizeof(*p));
8747
4
    if (!p)
8748
0
        return NULL;
8749
4
    p->kind = MatchMapping_kind;
8750
4
    p->v.MatchMapping.keys = keys;
8751
4
    p->v.MatchMapping.patterns = patterns;
8752
4
    p->v.MatchMapping.rest = rest;
8753
4
    p->lineno = lineno;
8754
4
    p->col_offset = col_offset;
8755
4
    p->end_lineno = end_lineno;
8756
4
    p->end_col_offset = end_col_offset;
8757
4
    return p;
8758
4
}
8759
8760
pattern_ty
8761
_PyAST_MatchClass(expr_ty cls, asdl_pattern_seq * patterns, asdl_identifier_seq
8762
                  * kwd_attrs, asdl_pattern_seq * kwd_patterns, int lineno, int
8763
                  col_offset, int end_lineno, int end_col_offset, PyArena
8764
                  *arena)
8765
24
{
8766
24
    pattern_ty p;
8767
24
    if (!cls) {
8768
0
        PyErr_SetString(PyExc_ValueError,
8769
0
                        "field 'cls' is required for MatchClass");
8770
0
        return NULL;
8771
0
    }
8772
24
    p = (pattern_ty)_PyArena_Malloc(arena, sizeof(*p));
8773
24
    if (!p)
8774
0
        return NULL;
8775
24
    p->kind = MatchClass_kind;
8776
24
    p->v.MatchClass.cls = cls;
8777
24
    p->v.MatchClass.patterns = patterns;
8778
24
    p->v.MatchClass.kwd_attrs = kwd_attrs;
8779
24
    p->v.MatchClass.kwd_patterns = kwd_patterns;
8780
24
    p->lineno = lineno;
8781
24
    p->col_offset = col_offset;
8782
24
    p->end_lineno = end_lineno;
8783
24
    p->end_col_offset = end_col_offset;
8784
24
    return p;
8785
24
}
8786
8787
pattern_ty
8788
_PyAST_MatchStar(identifier name, int lineno, int col_offset, int end_lineno,
8789
                 int end_col_offset, PyArena *arena)
8790
29
{
8791
29
    pattern_ty p;
8792
29
    p = (pattern_ty)_PyArena_Malloc(arena, sizeof(*p));
8793
29
    if (!p)
8794
0
        return NULL;
8795
29
    p->kind = MatchStar_kind;
8796
29
    p->v.MatchStar.name = name;
8797
29
    p->lineno = lineno;
8798
29
    p->col_offset = col_offset;
8799
29
    p->end_lineno = end_lineno;
8800
29
    p->end_col_offset = end_col_offset;
8801
29
    return p;
8802
29
}
8803
8804
pattern_ty
8805
_PyAST_MatchAs(pattern_ty pattern, identifier name, int lineno, int col_offset,
8806
               int end_lineno, int end_col_offset, PyArena *arena)
8807
1.95k
{
8808
1.95k
    pattern_ty p;
8809
1.95k
    p = (pattern_ty)_PyArena_Malloc(arena, sizeof(*p));
8810
1.95k
    if (!p)
8811
0
        return NULL;
8812
1.95k
    p->kind = MatchAs_kind;
8813
1.95k
    p->v.MatchAs.pattern = pattern;
8814
1.95k
    p->v.MatchAs.name = name;
8815
1.95k
    p->lineno = lineno;
8816
1.95k
    p->col_offset = col_offset;
8817
1.95k
    p->end_lineno = end_lineno;
8818
1.95k
    p->end_col_offset = end_col_offset;
8819
1.95k
    return p;
8820
1.95k
}
8821
8822
pattern_ty
8823
_PyAST_MatchOr(asdl_pattern_seq * patterns, int lineno, int col_offset, int
8824
               end_lineno, int end_col_offset, PyArena *arena)
8825
119
{
8826
119
    pattern_ty p;
8827
119
    p = (pattern_ty)_PyArena_Malloc(arena, sizeof(*p));
8828
119
    if (!p)
8829
0
        return NULL;
8830
119
    p->kind = MatchOr_kind;
8831
119
    p->v.MatchOr.patterns = patterns;
8832
119
    p->lineno = lineno;
8833
119
    p->col_offset = col_offset;
8834
119
    p->end_lineno = end_lineno;
8835
119
    p->end_col_offset = end_col_offset;
8836
119
    return p;
8837
119
}
8838
8839
type_ignore_ty
8840
_PyAST_TypeIgnore(int lineno, string tag, PyArena *arena)
8841
0
{
8842
0
    type_ignore_ty p;
8843
0
    if (!tag) {
8844
0
        PyErr_SetString(PyExc_ValueError,
8845
0
                        "field 'tag' is required for TypeIgnore");
8846
0
        return NULL;
8847
0
    }
8848
0
    p = (type_ignore_ty)_PyArena_Malloc(arena, sizeof(*p));
8849
0
    if (!p)
8850
0
        return NULL;
8851
0
    p->kind = TypeIgnore_kind;
8852
0
    p->v.TypeIgnore.lineno = lineno;
8853
0
    p->v.TypeIgnore.tag = tag;
8854
0
    return p;
8855
0
}
8856
8857
type_param_ty
8858
_PyAST_TypeVar(identifier name, expr_ty bound, expr_ty default_value, int
8859
               lineno, int col_offset, int end_lineno, int end_col_offset,
8860
               PyArena *arena)
8861
7.11k
{
8862
7.11k
    type_param_ty p;
8863
7.11k
    if (!name) {
8864
0
        PyErr_SetString(PyExc_ValueError,
8865
0
                        "field 'name' is required for TypeVar");
8866
0
        return NULL;
8867
0
    }
8868
7.11k
    p = (type_param_ty)_PyArena_Malloc(arena, sizeof(*p));
8869
7.11k
    if (!p)
8870
0
        return NULL;
8871
7.11k
    p->kind = TypeVar_kind;
8872
7.11k
    p->v.TypeVar.name = name;
8873
7.11k
    p->v.TypeVar.bound = bound;
8874
7.11k
    p->v.TypeVar.default_value = default_value;
8875
7.11k
    p->lineno = lineno;
8876
7.11k
    p->col_offset = col_offset;
8877
7.11k
    p->end_lineno = end_lineno;
8878
7.11k
    p->end_col_offset = end_col_offset;
8879
7.11k
    return p;
8880
7.11k
}
8881
8882
type_param_ty
8883
_PyAST_ParamSpec(identifier name, expr_ty default_value, int lineno, int
8884
                 col_offset, int end_lineno, int end_col_offset, PyArena *arena)
8885
5
{
8886
5
    type_param_ty p;
8887
5
    if (!name) {
8888
0
        PyErr_SetString(PyExc_ValueError,
8889
0
                        "field 'name' is required for ParamSpec");
8890
0
        return NULL;
8891
0
    }
8892
5
    p = (type_param_ty)_PyArena_Malloc(arena, sizeof(*p));
8893
5
    if (!p)
8894
0
        return NULL;
8895
5
    p->kind = ParamSpec_kind;
8896
5
    p->v.ParamSpec.name = name;
8897
5
    p->v.ParamSpec.default_value = default_value;
8898
5
    p->lineno = lineno;
8899
5
    p->col_offset = col_offset;
8900
5
    p->end_lineno = end_lineno;
8901
5
    p->end_col_offset = end_col_offset;
8902
5
    return p;
8903
5
}
8904
8905
type_param_ty
8906
_PyAST_TypeVarTuple(identifier name, expr_ty default_value, int lineno, int
8907
                    col_offset, int end_lineno, int end_col_offset, PyArena
8908
                    *arena)
8909
122
{
8910
122
    type_param_ty p;
8911
122
    if (!name) {
8912
0
        PyErr_SetString(PyExc_ValueError,
8913
0
                        "field 'name' is required for TypeVarTuple");
8914
0
        return NULL;
8915
0
    }
8916
122
    p = (type_param_ty)_PyArena_Malloc(arena, sizeof(*p));
8917
122
    if (!p)
8918
0
        return NULL;
8919
122
    p->kind = TypeVarTuple_kind;
8920
122
    p->v.TypeVarTuple.name = name;
8921
122
    p->v.TypeVarTuple.default_value = default_value;
8922
122
    p->lineno = lineno;
8923
122
    p->col_offset = col_offset;
8924
122
    p->end_lineno = end_lineno;
8925
122
    p->end_col_offset = end_col_offset;
8926
122
    return p;
8927
122
}
8928
8929
8930
PyObject*
8931
ast2obj_mod(struct ast_state *state, void* _o)
8932
1.64k
{
8933
1.64k
    mod_ty o = (mod_ty)_o;
8934
1.64k
    PyObject *result = NULL, *value = NULL;
8935
1.64k
    PyTypeObject *tp;
8936
1.64k
    if (!o) {
8937
0
        Py_RETURN_NONE;
8938
0
    }
8939
1.64k
    if (Py_EnterRecursiveCall("during  ast construction")) {
8940
0
        return NULL;
8941
0
    }
8942
1.64k
    switch (o->kind) {
8943
1.02k
    case Module_kind:
8944
1.02k
        tp = (PyTypeObject *)state->Module_type;
8945
1.02k
        result = PyType_GenericNew(tp, NULL, NULL);
8946
1.02k
        if (!result) goto failed;
8947
1.02k
        value = ast2obj_list(state, (asdl_seq*)o->v.Module.body, ast2obj_stmt);
8948
1.02k
        if (!value) goto failed;
8949
1.02k
        if (PyObject_SetAttr(result, state->body, value) == -1)
8950
0
            goto failed;
8951
1.02k
        Py_DECREF(value);
8952
1.02k
        value = ast2obj_list(state, (asdl_seq*)o->v.Module.type_ignores,
8953
1.02k
                             ast2obj_type_ignore);
8954
1.02k
        if (!value) goto failed;
8955
1.02k
        if (PyObject_SetAttr(result, state->type_ignores, value) == -1)
8956
0
            goto failed;
8957
1.02k
        Py_DECREF(value);
8958
1.02k
        break;
8959
381
    case Interactive_kind:
8960
381
        tp = (PyTypeObject *)state->Interactive_type;
8961
381
        result = PyType_GenericNew(tp, NULL, NULL);
8962
381
        if (!result) goto failed;
8963
381
        value = ast2obj_list(state, (asdl_seq*)o->v.Interactive.body,
8964
381
                             ast2obj_stmt);
8965
381
        if (!value) goto failed;
8966
381
        if (PyObject_SetAttr(result, state->body, value) == -1)
8967
0
            goto failed;
8968
381
        Py_DECREF(value);
8969
381
        break;
8970
232
    case Expression_kind:
8971
232
        tp = (PyTypeObject *)state->Expression_type;
8972
232
        result = PyType_GenericNew(tp, NULL, NULL);
8973
232
        if (!result) goto failed;
8974
232
        value = ast2obj_expr(state, o->v.Expression.body);
8975
232
        if (!value) goto failed;
8976
232
        if (PyObject_SetAttr(result, state->body, value) == -1)
8977
0
            goto failed;
8978
232
        Py_DECREF(value);
8979
232
        break;
8980
0
    case FunctionType_kind:
8981
0
        tp = (PyTypeObject *)state->FunctionType_type;
8982
0
        result = PyType_GenericNew(tp, NULL, NULL);
8983
0
        if (!result) goto failed;
8984
0
        value = ast2obj_list(state, (asdl_seq*)o->v.FunctionType.argtypes,
8985
0
                             ast2obj_expr);
8986
0
        if (!value) goto failed;
8987
0
        if (PyObject_SetAttr(result, state->argtypes, value) == -1)
8988
0
            goto failed;
8989
0
        Py_DECREF(value);
8990
0
        value = ast2obj_expr(state, o->v.FunctionType.returns);
8991
0
        if (!value) goto failed;
8992
0
        if (PyObject_SetAttr(result, state->returns, value) == -1)
8993
0
            goto failed;
8994
0
        Py_DECREF(value);
8995
0
        break;
8996
1.64k
    }
8997
1.64k
    Py_LeaveRecursiveCall();
8998
1.64k
    return result;
8999
0
failed:
9000
0
    Py_LeaveRecursiveCall();
9001
0
    Py_XDECREF(value);
9002
0
    Py_XDECREF(result);
9003
0
    return NULL;
9004
1.64k
}
9005
9006
PyObject*
9007
ast2obj_stmt(struct ast_state *state, void* _o)
9008
22.9k
{
9009
22.9k
    stmt_ty o = (stmt_ty)_o;
9010
22.9k
    PyObject *result = NULL, *value = NULL;
9011
22.9k
    PyTypeObject *tp;
9012
22.9k
    if (!o) {
9013
0
        Py_RETURN_NONE;
9014
0
    }
9015
22.9k
    if (Py_EnterRecursiveCall("during  ast construction")) {
9016
0
        return NULL;
9017
0
    }
9018
22.9k
    switch (o->kind) {
9019
484
    case FunctionDef_kind:
9020
484
        tp = (PyTypeObject *)state->FunctionDef_type;
9021
484
        result = PyType_GenericNew(tp, NULL, NULL);
9022
484
        if (!result) goto failed;
9023
484
        value = ast2obj_identifier(state, o->v.FunctionDef.name);
9024
484
        if (!value) goto failed;
9025
484
        if (PyObject_SetAttr(result, state->name, value) == -1)
9026
0
            goto failed;
9027
484
        Py_DECREF(value);
9028
484
        value = ast2obj_arguments(state, o->v.FunctionDef.args);
9029
484
        if (!value) goto failed;
9030
484
        if (PyObject_SetAttr(result, state->args, value) == -1)
9031
0
            goto failed;
9032
484
        Py_DECREF(value);
9033
484
        value = ast2obj_list(state, (asdl_seq*)o->v.FunctionDef.body,
9034
484
                             ast2obj_stmt);
9035
484
        if (!value) goto failed;
9036
484
        if (PyObject_SetAttr(result, state->body, value) == -1)
9037
0
            goto failed;
9038
484
        Py_DECREF(value);
9039
484
        value = ast2obj_list(state, (asdl_seq*)o->v.FunctionDef.decorator_list,
9040
484
                             ast2obj_expr);
9041
484
        if (!value) goto failed;
9042
484
        if (PyObject_SetAttr(result, state->decorator_list, value) == -1)
9043
0
            goto failed;
9044
484
        Py_DECREF(value);
9045
484
        value = ast2obj_expr(state, o->v.FunctionDef.returns);
9046
484
        if (!value) goto failed;
9047
484
        if (PyObject_SetAttr(result, state->returns, value) == -1)
9048
0
            goto failed;
9049
484
        Py_DECREF(value);
9050
484
        value = ast2obj_string(state, o->v.FunctionDef.type_comment);
9051
484
        if (!value) goto failed;
9052
484
        if (PyObject_SetAttr(result, state->type_comment, value) == -1)
9053
0
            goto failed;
9054
484
        Py_DECREF(value);
9055
484
        value = ast2obj_list(state, (asdl_seq*)o->v.FunctionDef.type_params,
9056
484
                             ast2obj_type_param);
9057
484
        if (!value) goto failed;
9058
484
        if (PyObject_SetAttr(result, state->type_params, value) == -1)
9059
0
            goto failed;
9060
484
        Py_DECREF(value);
9061
484
        break;
9062
274
    case AsyncFunctionDef_kind:
9063
274
        tp = (PyTypeObject *)state->AsyncFunctionDef_type;
9064
274
        result = PyType_GenericNew(tp, NULL, NULL);
9065
274
        if (!result) goto failed;
9066
274
        value = ast2obj_identifier(state, o->v.AsyncFunctionDef.name);
9067
274
        if (!value) goto failed;
9068
274
        if (PyObject_SetAttr(result, state->name, value) == -1)
9069
0
            goto failed;
9070
274
        Py_DECREF(value);
9071
274
        value = ast2obj_arguments(state, o->v.AsyncFunctionDef.args);
9072
274
        if (!value) goto failed;
9073
274
        if (PyObject_SetAttr(result, state->args, value) == -1)
9074
0
            goto failed;
9075
274
        Py_DECREF(value);
9076
274
        value = ast2obj_list(state, (asdl_seq*)o->v.AsyncFunctionDef.body,
9077
274
                             ast2obj_stmt);
9078
274
        if (!value) goto failed;
9079
274
        if (PyObject_SetAttr(result, state->body, value) == -1)
9080
0
            goto failed;
9081
274
        Py_DECREF(value);
9082
274
        value = ast2obj_list(state,
9083
274
                             (asdl_seq*)o->v.AsyncFunctionDef.decorator_list,
9084
274
                             ast2obj_expr);
9085
274
        if (!value) goto failed;
9086
274
        if (PyObject_SetAttr(result, state->decorator_list, value) == -1)
9087
0
            goto failed;
9088
274
        Py_DECREF(value);
9089
274
        value = ast2obj_expr(state, o->v.AsyncFunctionDef.returns);
9090
274
        if (!value) goto failed;
9091
274
        if (PyObject_SetAttr(result, state->returns, value) == -1)
9092
0
            goto failed;
9093
274
        Py_DECREF(value);
9094
274
        value = ast2obj_string(state, o->v.AsyncFunctionDef.type_comment);
9095
274
        if (!value) goto failed;
9096
274
        if (PyObject_SetAttr(result, state->type_comment, value) == -1)
9097
0
            goto failed;
9098
274
        Py_DECREF(value);
9099
274
        value = ast2obj_list(state,
9100
274
                             (asdl_seq*)o->v.AsyncFunctionDef.type_params,
9101
274
                             ast2obj_type_param);
9102
274
        if (!value) goto failed;
9103
274
        if (PyObject_SetAttr(result, state->type_params, value) == -1)
9104
0
            goto failed;
9105
274
        Py_DECREF(value);
9106
274
        break;
9107
1.34k
    case ClassDef_kind:
9108
1.34k
        tp = (PyTypeObject *)state->ClassDef_type;
9109
1.34k
        result = PyType_GenericNew(tp, NULL, NULL);
9110
1.34k
        if (!result) goto failed;
9111
1.34k
        value = ast2obj_identifier(state, o->v.ClassDef.name);
9112
1.34k
        if (!value) goto failed;
9113
1.34k
        if (PyObject_SetAttr(result, state->name, value) == -1)
9114
0
            goto failed;
9115
1.34k
        Py_DECREF(value);
9116
1.34k
        value = ast2obj_list(state, (asdl_seq*)o->v.ClassDef.bases,
9117
1.34k
                             ast2obj_expr);
9118
1.34k
        if (!value) goto failed;
9119
1.34k
        if (PyObject_SetAttr(result, state->bases, value) == -1)
9120
0
            goto failed;
9121
1.34k
        Py_DECREF(value);
9122
1.34k
        value = ast2obj_list(state, (asdl_seq*)o->v.ClassDef.keywords,
9123
1.34k
                             ast2obj_keyword);
9124
1.34k
        if (!value) goto failed;
9125
1.34k
        if (PyObject_SetAttr(result, state->keywords, value) == -1)
9126
0
            goto failed;
9127
1.34k
        Py_DECREF(value);
9128
1.34k
        value = ast2obj_list(state, (asdl_seq*)o->v.ClassDef.body,
9129
1.34k
                             ast2obj_stmt);
9130
1.34k
        if (!value) goto failed;
9131
1.34k
        if (PyObject_SetAttr(result, state->body, value) == -1)
9132
0
            goto failed;
9133
1.34k
        Py_DECREF(value);
9134
1.34k
        value = ast2obj_list(state, (asdl_seq*)o->v.ClassDef.decorator_list,
9135
1.34k
                             ast2obj_expr);
9136
1.34k
        if (!value) goto failed;
9137
1.34k
        if (PyObject_SetAttr(result, state->decorator_list, value) == -1)
9138
0
            goto failed;
9139
1.34k
        Py_DECREF(value);
9140
1.34k
        value = ast2obj_list(state, (asdl_seq*)o->v.ClassDef.type_params,
9141
1.34k
                             ast2obj_type_param);
9142
1.34k
        if (!value) goto failed;
9143
1.34k
        if (PyObject_SetAttr(result, state->type_params, value) == -1)
9144
0
            goto failed;
9145
1.34k
        Py_DECREF(value);
9146
1.34k
        break;
9147
132
    case Return_kind:
9148
132
        tp = (PyTypeObject *)state->Return_type;
9149
132
        result = PyType_GenericNew(tp, NULL, NULL);
9150
132
        if (!result) goto failed;
9151
132
        value = ast2obj_expr(state, o->v.Return.value);
9152
132
        if (!value) goto failed;
9153
132
        if (PyObject_SetAttr(result, state->value, value) == -1)
9154
0
            goto failed;
9155
132
        Py_DECREF(value);
9156
132
        break;
9157
55
    case Delete_kind:
9158
55
        tp = (PyTypeObject *)state->Delete_type;
9159
55
        result = PyType_GenericNew(tp, NULL, NULL);
9160
55
        if (!result) goto failed;
9161
55
        value = ast2obj_list(state, (asdl_seq*)o->v.Delete.targets,
9162
55
                             ast2obj_expr);
9163
55
        if (!value) goto failed;
9164
55
        if (PyObject_SetAttr(result, state->targets, value) == -1)
9165
0
            goto failed;
9166
55
        Py_DECREF(value);
9167
55
        break;
9168
390
    case Assign_kind:
9169
390
        tp = (PyTypeObject *)state->Assign_type;
9170
390
        result = PyType_GenericNew(tp, NULL, NULL);
9171
390
        if (!result) goto failed;
9172
390
        value = ast2obj_list(state, (asdl_seq*)o->v.Assign.targets,
9173
390
                             ast2obj_expr);
9174
390
        if (!value) goto failed;
9175
390
        if (PyObject_SetAttr(result, state->targets, value) == -1)
9176
0
            goto failed;
9177
390
        Py_DECREF(value);
9178
390
        value = ast2obj_expr(state, o->v.Assign.value);
9179
390
        if (!value) goto failed;
9180
390
        if (PyObject_SetAttr(result, state->value, value) == -1)
9181
0
            goto failed;
9182
390
        Py_DECREF(value);
9183
390
        value = ast2obj_string(state, o->v.Assign.type_comment);
9184
390
        if (!value) goto failed;
9185
390
        if (PyObject_SetAttr(result, state->type_comment, value) == -1)
9186
0
            goto failed;
9187
390
        Py_DECREF(value);
9188
390
        break;
9189
280
    case TypeAlias_kind:
9190
280
        tp = (PyTypeObject *)state->TypeAlias_type;
9191
280
        result = PyType_GenericNew(tp, NULL, NULL);
9192
280
        if (!result) goto failed;
9193
280
        value = ast2obj_expr(state, o->v.TypeAlias.name);
9194
280
        if (!value) goto failed;
9195
280
        if (PyObject_SetAttr(result, state->name, value) == -1)
9196
0
            goto failed;
9197
280
        Py_DECREF(value);
9198
280
        value = ast2obj_list(state, (asdl_seq*)o->v.TypeAlias.type_params,
9199
280
                             ast2obj_type_param);
9200
280
        if (!value) goto failed;
9201
280
        if (PyObject_SetAttr(result, state->type_params, value) == -1)
9202
0
            goto failed;
9203
280
        Py_DECREF(value);
9204
280
        value = ast2obj_expr(state, o->v.TypeAlias.value);
9205
280
        if (!value) goto failed;
9206
280
        if (PyObject_SetAttr(result, state->value, value) == -1)
9207
0
            goto failed;
9208
280
        Py_DECREF(value);
9209
280
        break;
9210
994
    case AugAssign_kind:
9211
994
        tp = (PyTypeObject *)state->AugAssign_type;
9212
994
        result = PyType_GenericNew(tp, NULL, NULL);
9213
994
        if (!result) goto failed;
9214
994
        value = ast2obj_expr(state, o->v.AugAssign.target);
9215
994
        if (!value) goto failed;
9216
994
        if (PyObject_SetAttr(result, state->target, value) == -1)
9217
0
            goto failed;
9218
994
        Py_DECREF(value);
9219
994
        value = ast2obj_operator(state, o->v.AugAssign.op);
9220
994
        if (!value) goto failed;
9221
994
        if (PyObject_SetAttr(result, state->op, value) == -1)
9222
0
            goto failed;
9223
994
        Py_DECREF(value);
9224
994
        value = ast2obj_expr(state, o->v.AugAssign.value);
9225
994
        if (!value) goto failed;
9226
994
        if (PyObject_SetAttr(result, state->value, value) == -1)
9227
0
            goto failed;
9228
994
        Py_DECREF(value);
9229
994
        break;
9230
1.37k
    case AnnAssign_kind:
9231
1.37k
        tp = (PyTypeObject *)state->AnnAssign_type;
9232
1.37k
        result = PyType_GenericNew(tp, NULL, NULL);
9233
1.37k
        if (!result) goto failed;
9234
1.37k
        value = ast2obj_expr(state, o->v.AnnAssign.target);
9235
1.37k
        if (!value) goto failed;
9236
1.37k
        if (PyObject_SetAttr(result, state->target, value) == -1)
9237
0
            goto failed;
9238
1.37k
        Py_DECREF(value);
9239
1.37k
        value = ast2obj_expr(state, o->v.AnnAssign.annotation);
9240
1.37k
        if (!value) goto failed;
9241
1.37k
        if (PyObject_SetAttr(result, state->annotation, value) == -1)
9242
0
            goto failed;
9243
1.37k
        Py_DECREF(value);
9244
1.37k
        value = ast2obj_expr(state, o->v.AnnAssign.value);
9245
1.37k
        if (!value) goto failed;
9246
1.37k
        if (PyObject_SetAttr(result, state->value, value) == -1)
9247
0
            goto failed;
9248
1.37k
        Py_DECREF(value);
9249
1.37k
        value = ast2obj_int(state, o->v.AnnAssign.simple);
9250
1.37k
        if (!value) goto failed;
9251
1.37k
        if (PyObject_SetAttr(result, state->simple, value) == -1)
9252
0
            goto failed;
9253
1.37k
        Py_DECREF(value);
9254
1.37k
        break;
9255
32
    case For_kind:
9256
32
        tp = (PyTypeObject *)state->For_type;
9257
32
        result = PyType_GenericNew(tp, NULL, NULL);
9258
32
        if (!result) goto failed;
9259
32
        value = ast2obj_expr(state, o->v.For.target);
9260
32
        if (!value) goto failed;
9261
32
        if (PyObject_SetAttr(result, state->target, value) == -1)
9262
0
            goto failed;
9263
32
        Py_DECREF(value);
9264
32
        value = ast2obj_expr(state, o->v.For.iter);
9265
32
        if (!value) goto failed;
9266
32
        if (PyObject_SetAttr(result, state->iter, value) == -1)
9267
0
            goto failed;
9268
32
        Py_DECREF(value);
9269
32
        value = ast2obj_list(state, (asdl_seq*)o->v.For.body, ast2obj_stmt);
9270
32
        if (!value) goto failed;
9271
32
        if (PyObject_SetAttr(result, state->body, value) == -1)
9272
0
            goto failed;
9273
32
        Py_DECREF(value);
9274
32
        value = ast2obj_list(state, (asdl_seq*)o->v.For.orelse, ast2obj_stmt);
9275
32
        if (!value) goto failed;
9276
32
        if (PyObject_SetAttr(result, state->orelse, value) == -1)
9277
0
            goto failed;
9278
32
        Py_DECREF(value);
9279
32
        value = ast2obj_string(state, o->v.For.type_comment);
9280
32
        if (!value) goto failed;
9281
32
        if (PyObject_SetAttr(result, state->type_comment, value) == -1)
9282
0
            goto failed;
9283
32
        Py_DECREF(value);
9284
32
        break;
9285
80
    case AsyncFor_kind:
9286
80
        tp = (PyTypeObject *)state->AsyncFor_type;
9287
80
        result = PyType_GenericNew(tp, NULL, NULL);
9288
80
        if (!result) goto failed;
9289
80
        value = ast2obj_expr(state, o->v.AsyncFor.target);
9290
80
        if (!value) goto failed;
9291
80
        if (PyObject_SetAttr(result, state->target, value) == -1)
9292
0
            goto failed;
9293
80
        Py_DECREF(value);
9294
80
        value = ast2obj_expr(state, o->v.AsyncFor.iter);
9295
80
        if (!value) goto failed;
9296
80
        if (PyObject_SetAttr(result, state->iter, value) == -1)
9297
0
            goto failed;
9298
80
        Py_DECREF(value);
9299
80
        value = ast2obj_list(state, (asdl_seq*)o->v.AsyncFor.body,
9300
80
                             ast2obj_stmt);
9301
80
        if (!value) goto failed;
9302
80
        if (PyObject_SetAttr(result, state->body, value) == -1)
9303
0
            goto failed;
9304
80
        Py_DECREF(value);
9305
80
        value = ast2obj_list(state, (asdl_seq*)o->v.AsyncFor.orelse,
9306
80
                             ast2obj_stmt);
9307
80
        if (!value) goto failed;
9308
80
        if (PyObject_SetAttr(result, state->orelse, value) == -1)
9309
0
            goto failed;
9310
80
        Py_DECREF(value);
9311
80
        value = ast2obj_string(state, o->v.AsyncFor.type_comment);
9312
80
        if (!value) goto failed;
9313
80
        if (PyObject_SetAttr(result, state->type_comment, value) == -1)
9314
0
            goto failed;
9315
80
        Py_DECREF(value);
9316
80
        break;
9317
58
    case While_kind:
9318
58
        tp = (PyTypeObject *)state->While_type;
9319
58
        result = PyType_GenericNew(tp, NULL, NULL);
9320
58
        if (!result) goto failed;
9321
58
        value = ast2obj_expr(state, o->v.While.test);
9322
58
        if (!value) goto failed;
9323
58
        if (PyObject_SetAttr(result, state->test, value) == -1)
9324
0
            goto failed;
9325
58
        Py_DECREF(value);
9326
58
        value = ast2obj_list(state, (asdl_seq*)o->v.While.body, ast2obj_stmt);
9327
58
        if (!value) goto failed;
9328
58
        if (PyObject_SetAttr(result, state->body, value) == -1)
9329
0
            goto failed;
9330
58
        Py_DECREF(value);
9331
58
        value = ast2obj_list(state, (asdl_seq*)o->v.While.orelse, ast2obj_stmt);
9332
58
        if (!value) goto failed;
9333
58
        if (PyObject_SetAttr(result, state->orelse, value) == -1)
9334
0
            goto failed;
9335
58
        Py_DECREF(value);
9336
58
        break;
9337
88
    case If_kind:
9338
88
        tp = (PyTypeObject *)state->If_type;
9339
88
        result = PyType_GenericNew(tp, NULL, NULL);
9340
88
        if (!result) goto failed;
9341
88
        value = ast2obj_expr(state, o->v.If.test);
9342
88
        if (!value) goto failed;
9343
88
        if (PyObject_SetAttr(result, state->test, value) == -1)
9344
0
            goto failed;
9345
88
        Py_DECREF(value);
9346
88
        value = ast2obj_list(state, (asdl_seq*)o->v.If.body, ast2obj_stmt);
9347
88
        if (!value) goto failed;
9348
88
        if (PyObject_SetAttr(result, state->body, value) == -1)
9349
0
            goto failed;
9350
88
        Py_DECREF(value);
9351
88
        value = ast2obj_list(state, (asdl_seq*)o->v.If.orelse, ast2obj_stmt);
9352
88
        if (!value) goto failed;
9353
88
        if (PyObject_SetAttr(result, state->orelse, value) == -1)
9354
0
            goto failed;
9355
88
        Py_DECREF(value);
9356
88
        break;
9357
7
    case With_kind:
9358
7
        tp = (PyTypeObject *)state->With_type;
9359
7
        result = PyType_GenericNew(tp, NULL, NULL);
9360
7
        if (!result) goto failed;
9361
7
        value = ast2obj_list(state, (asdl_seq*)o->v.With.items,
9362
7
                             ast2obj_withitem);
9363
7
        if (!value) goto failed;
9364
7
        if (PyObject_SetAttr(result, state->items, value) == -1)
9365
0
            goto failed;
9366
7
        Py_DECREF(value);
9367
7
        value = ast2obj_list(state, (asdl_seq*)o->v.With.body, ast2obj_stmt);
9368
7
        if (!value) goto failed;
9369
7
        if (PyObject_SetAttr(result, state->body, value) == -1)
9370
0
            goto failed;
9371
7
        Py_DECREF(value);
9372
7
        value = ast2obj_string(state, o->v.With.type_comment);
9373
7
        if (!value) goto failed;
9374
7
        if (PyObject_SetAttr(result, state->type_comment, value) == -1)
9375
0
            goto failed;
9376
7
        Py_DECREF(value);
9377
7
        break;
9378
363
    case AsyncWith_kind:
9379
363
        tp = (PyTypeObject *)state->AsyncWith_type;
9380
363
        result = PyType_GenericNew(tp, NULL, NULL);
9381
363
        if (!result) goto failed;
9382
363
        value = ast2obj_list(state, (asdl_seq*)o->v.AsyncWith.items,
9383
363
                             ast2obj_withitem);
9384
363
        if (!value) goto failed;
9385
363
        if (PyObject_SetAttr(result, state->items, value) == -1)
9386
0
            goto failed;
9387
363
        Py_DECREF(value);
9388
363
        value = ast2obj_list(state, (asdl_seq*)o->v.AsyncWith.body,
9389
363
                             ast2obj_stmt);
9390
363
        if (!value) goto failed;
9391
363
        if (PyObject_SetAttr(result, state->body, value) == -1)
9392
0
            goto failed;
9393
363
        Py_DECREF(value);
9394
363
        value = ast2obj_string(state, o->v.AsyncWith.type_comment);
9395
363
        if (!value) goto failed;
9396
363
        if (PyObject_SetAttr(result, state->type_comment, value) == -1)
9397
0
            goto failed;
9398
363
        Py_DECREF(value);
9399
363
        break;
9400
12
    case Match_kind:
9401
12
        tp = (PyTypeObject *)state->Match_type;
9402
12
        result = PyType_GenericNew(tp, NULL, NULL);
9403
12
        if (!result) goto failed;
9404
12
        value = ast2obj_expr(state, o->v.Match.subject);
9405
12
        if (!value) goto failed;
9406
12
        if (PyObject_SetAttr(result, state->subject, value) == -1)
9407
0
            goto failed;
9408
12
        Py_DECREF(value);
9409
12
        value = ast2obj_list(state, (asdl_seq*)o->v.Match.cases,
9410
12
                             ast2obj_match_case);
9411
12
        if (!value) goto failed;
9412
12
        if (PyObject_SetAttr(result, state->cases, value) == -1)
9413
0
            goto failed;
9414
12
        Py_DECREF(value);
9415
12
        break;
9416
73
    case Raise_kind:
9417
73
        tp = (PyTypeObject *)state->Raise_type;
9418
73
        result = PyType_GenericNew(tp, NULL, NULL);
9419
73
        if (!result) goto failed;
9420
73
        value = ast2obj_expr(state, o->v.Raise.exc);
9421
73
        if (!value) goto failed;
9422
73
        if (PyObject_SetAttr(result, state->exc, value) == -1)
9423
0
            goto failed;
9424
73
        Py_DECREF(value);
9425
73
        value = ast2obj_expr(state, o->v.Raise.cause);
9426
73
        if (!value) goto failed;
9427
73
        if (PyObject_SetAttr(result, state->cause, value) == -1)
9428
0
            goto failed;
9429
73
        Py_DECREF(value);
9430
73
        break;
9431
164
    case Try_kind:
9432
164
        tp = (PyTypeObject *)state->Try_type;
9433
164
        result = PyType_GenericNew(tp, NULL, NULL);
9434
164
        if (!result) goto failed;
9435
164
        value = ast2obj_list(state, (asdl_seq*)o->v.Try.body, ast2obj_stmt);
9436
164
        if (!value) goto failed;
9437
164
        if (PyObject_SetAttr(result, state->body, value) == -1)
9438
0
            goto failed;
9439
164
        Py_DECREF(value);
9440
164
        value = ast2obj_list(state, (asdl_seq*)o->v.Try.handlers,
9441
164
                             ast2obj_excepthandler);
9442
164
        if (!value) goto failed;
9443
164
        if (PyObject_SetAttr(result, state->handlers, value) == -1)
9444
0
            goto failed;
9445
164
        Py_DECREF(value);
9446
164
        value = ast2obj_list(state, (asdl_seq*)o->v.Try.orelse, ast2obj_stmt);
9447
164
        if (!value) goto failed;
9448
164
        if (PyObject_SetAttr(result, state->orelse, value) == -1)
9449
0
            goto failed;
9450
164
        Py_DECREF(value);
9451
164
        value = ast2obj_list(state, (asdl_seq*)o->v.Try.finalbody,
9452
164
                             ast2obj_stmt);
9453
164
        if (!value) goto failed;
9454
164
        if (PyObject_SetAttr(result, state->finalbody, value) == -1)
9455
0
            goto failed;
9456
164
        Py_DECREF(value);
9457
164
        break;
9458
503
    case TryStar_kind:
9459
503
        tp = (PyTypeObject *)state->TryStar_type;
9460
503
        result = PyType_GenericNew(tp, NULL, NULL);
9461
503
        if (!result) goto failed;
9462
503
        value = ast2obj_list(state, (asdl_seq*)o->v.TryStar.body, ast2obj_stmt);
9463
503
        if (!value) goto failed;
9464
503
        if (PyObject_SetAttr(result, state->body, value) == -1)
9465
0
            goto failed;
9466
503
        Py_DECREF(value);
9467
503
        value = ast2obj_list(state, (asdl_seq*)o->v.TryStar.handlers,
9468
503
                             ast2obj_excepthandler);
9469
503
        if (!value) goto failed;
9470
503
        if (PyObject_SetAttr(result, state->handlers, value) == -1)
9471
0
            goto failed;
9472
503
        Py_DECREF(value);
9473
503
        value = ast2obj_list(state, (asdl_seq*)o->v.TryStar.orelse,
9474
503
                             ast2obj_stmt);
9475
503
        if (!value) goto failed;
9476
503
        if (PyObject_SetAttr(result, state->orelse, value) == -1)
9477
0
            goto failed;
9478
503
        Py_DECREF(value);
9479
503
        value = ast2obj_list(state, (asdl_seq*)o->v.TryStar.finalbody,
9480
503
                             ast2obj_stmt);
9481
503
        if (!value) goto failed;
9482
503
        if (PyObject_SetAttr(result, state->finalbody, value) == -1)
9483
0
            goto failed;
9484
503
        Py_DECREF(value);
9485
503
        break;
9486
245
    case Assert_kind:
9487
245
        tp = (PyTypeObject *)state->Assert_type;
9488
245
        result = PyType_GenericNew(tp, NULL, NULL);
9489
245
        if (!result) goto failed;
9490
245
        value = ast2obj_expr(state, o->v.Assert.test);
9491
245
        if (!value) goto failed;
9492
245
        if (PyObject_SetAttr(result, state->test, value) == -1)
9493
0
            goto failed;
9494
245
        Py_DECREF(value);
9495
245
        value = ast2obj_expr(state, o->v.Assert.msg);
9496
245
        if (!value) goto failed;
9497
245
        if (PyObject_SetAttr(result, state->msg, value) == -1)
9498
0
            goto failed;
9499
245
        Py_DECREF(value);
9500
245
        break;
9501
292
    case Import_kind:
9502
292
        tp = (PyTypeObject *)state->Import_type;
9503
292
        result = PyType_GenericNew(tp, NULL, NULL);
9504
292
        if (!result) goto failed;
9505
292
        value = ast2obj_list(state, (asdl_seq*)o->v.Import.names,
9506
292
                             ast2obj_alias);
9507
292
        if (!value) goto failed;
9508
292
        if (PyObject_SetAttr(result, state->names, value) == -1)
9509
0
            goto failed;
9510
292
        Py_DECREF(value);
9511
292
        value = ast2obj_int(state, o->v.Import.is_lazy);
9512
292
        if (!value) goto failed;
9513
292
        if (PyObject_SetAttr(result, state->is_lazy, value) == -1)
9514
0
            goto failed;
9515
292
        Py_DECREF(value);
9516
292
        break;
9517
542
    case ImportFrom_kind:
9518
542
        tp = (PyTypeObject *)state->ImportFrom_type;
9519
542
        result = PyType_GenericNew(tp, NULL, NULL);
9520
542
        if (!result) goto failed;
9521
542
        value = ast2obj_identifier(state, o->v.ImportFrom.module);
9522
542
        if (!value) goto failed;
9523
542
        if (PyObject_SetAttr(result, state->module, value) == -1)
9524
0
            goto failed;
9525
542
        Py_DECREF(value);
9526
542
        value = ast2obj_list(state, (asdl_seq*)o->v.ImportFrom.names,
9527
542
                             ast2obj_alias);
9528
542
        if (!value) goto failed;
9529
542
        if (PyObject_SetAttr(result, state->names, value) == -1)
9530
0
            goto failed;
9531
542
        Py_DECREF(value);
9532
542
        value = ast2obj_int(state, o->v.ImportFrom.level);
9533
542
        if (!value) goto failed;
9534
542
        if (PyObject_SetAttr(result, state->level, value) == -1)
9535
0
            goto failed;
9536
542
        Py_DECREF(value);
9537
542
        value = ast2obj_int(state, o->v.ImportFrom.is_lazy);
9538
542
        if (!value) goto failed;
9539
542
        if (PyObject_SetAttr(result, state->is_lazy, value) == -1)
9540
0
            goto failed;
9541
542
        Py_DECREF(value);
9542
542
        break;
9543
126
    case Global_kind:
9544
126
        tp = (PyTypeObject *)state->Global_type;
9545
126
        result = PyType_GenericNew(tp, NULL, NULL);
9546
126
        if (!result) goto failed;
9547
126
        value = ast2obj_list(state, (asdl_seq*)o->v.Global.names,
9548
126
                             ast2obj_identifier);
9549
126
        if (!value) goto failed;
9550
126
        if (PyObject_SetAttr(result, state->names, value) == -1)
9551
0
            goto failed;
9552
126
        Py_DECREF(value);
9553
126
        break;
9554
101
    case Nonlocal_kind:
9555
101
        tp = (PyTypeObject *)state->Nonlocal_type;
9556
101
        result = PyType_GenericNew(tp, NULL, NULL);
9557
101
        if (!result) goto failed;
9558
101
        value = ast2obj_list(state, (asdl_seq*)o->v.Nonlocal.names,
9559
101
                             ast2obj_identifier);
9560
101
        if (!value) goto failed;
9561
101
        if (PyObject_SetAttr(result, state->names, value) == -1)
9562
0
            goto failed;
9563
101
        Py_DECREF(value);
9564
101
        break;
9565
14.8k
    case Expr_kind:
9566
14.8k
        tp = (PyTypeObject *)state->Expr_type;
9567
14.8k
        result = PyType_GenericNew(tp, NULL, NULL);
9568
14.8k
        if (!result) goto failed;
9569
14.8k
        value = ast2obj_expr(state, o->v.Expr.value);
9570
14.8k
        if (!value) goto failed;
9571
14.8k
        if (PyObject_SetAttr(result, state->value, value) == -1)
9572
0
            goto failed;
9573
14.8k
        Py_DECREF(value);
9574
14.8k
        break;
9575
80
    case Pass_kind:
9576
80
        tp = (PyTypeObject *)state->Pass_type;
9577
80
        result = PyType_GenericNew(tp, NULL, NULL);
9578
80
        if (!result) goto failed;
9579
80
        break;
9580
80
    case Break_kind:
9581
11
        tp = (PyTypeObject *)state->Break_type;
9582
11
        result = PyType_GenericNew(tp, NULL, NULL);
9583
11
        if (!result) goto failed;
9584
11
        break;
9585
64
    case Continue_kind:
9586
64
        tp = (PyTypeObject *)state->Continue_type;
9587
64
        result = PyType_GenericNew(tp, NULL, NULL);
9588
64
        if (!result) goto failed;
9589
64
        break;
9590
22.9k
    }
9591
22.9k
    value = ast2obj_int(state, o->lineno);
9592
22.9k
    if (!value) goto failed;
9593
22.9k
    if (PyObject_SetAttr(result, state->lineno, value) < 0)
9594
0
        goto failed;
9595
22.9k
    Py_DECREF(value);
9596
22.9k
    value = ast2obj_int(state, o->col_offset);
9597
22.9k
    if (!value) goto failed;
9598
22.9k
    if (PyObject_SetAttr(result, state->col_offset, value) < 0)
9599
0
        goto failed;
9600
22.9k
    Py_DECREF(value);
9601
22.9k
    value = ast2obj_int(state, o->end_lineno);
9602
22.9k
    if (!value) goto failed;
9603
22.9k
    if (PyObject_SetAttr(result, state->end_lineno, value) < 0)
9604
0
        goto failed;
9605
22.9k
    Py_DECREF(value);
9606
22.9k
    value = ast2obj_int(state, o->end_col_offset);
9607
22.9k
    if (!value) goto failed;
9608
22.9k
    if (PyObject_SetAttr(result, state->end_col_offset, value) < 0)
9609
0
        goto failed;
9610
22.9k
    Py_DECREF(value);
9611
22.9k
    Py_LeaveRecursiveCall();
9612
22.9k
    return result;
9613
0
failed:
9614
0
    Py_LeaveRecursiveCall();
9615
0
    Py_XDECREF(value);
9616
0
    Py_XDECREF(result);
9617
0
    return NULL;
9618
22.9k
}
9619
9620
PyObject*
9621
ast2obj_expr(struct ast_state *state, void* _o)
9622
244k
{
9623
244k
    expr_ty o = (expr_ty)_o;
9624
244k
    PyObject *result = NULL, *value = NULL;
9625
244k
    PyTypeObject *tp;
9626
244k
    if (!o) {
9627
12.9k
        Py_RETURN_NONE;
9628
12.9k
    }
9629
231k
    if (Py_EnterRecursiveCall("during  ast construction")) {
9630
0
        return NULL;
9631
0
    }
9632
231k
    switch (o->kind) {
9633
404
    case BoolOp_kind:
9634
404
        tp = (PyTypeObject *)state->BoolOp_type;
9635
404
        result = PyType_GenericNew(tp, NULL, NULL);
9636
404
        if (!result) goto failed;
9637
404
        value = ast2obj_boolop(state, o->v.BoolOp.op);
9638
404
        if (!value) goto failed;
9639
404
        if (PyObject_SetAttr(result, state->op, value) == -1)
9640
0
            goto failed;
9641
404
        Py_DECREF(value);
9642
404
        value = ast2obj_list(state, (asdl_seq*)o->v.BoolOp.values,
9643
404
                             ast2obj_expr);
9644
404
        if (!value) goto failed;
9645
404
        if (PyObject_SetAttr(result, state->values, value) == -1)
9646
0
            goto failed;
9647
404
        Py_DECREF(value);
9648
404
        break;
9649
153
    case NamedExpr_kind:
9650
153
        tp = (PyTypeObject *)state->NamedExpr_type;
9651
153
        result = PyType_GenericNew(tp, NULL, NULL);
9652
153
        if (!result) goto failed;
9653
153
        value = ast2obj_expr(state, o->v.NamedExpr.target);
9654
153
        if (!value) goto failed;
9655
153
        if (PyObject_SetAttr(result, state->target, value) == -1)
9656
0
            goto failed;
9657
153
        Py_DECREF(value);
9658
153
        value = ast2obj_expr(state, o->v.NamedExpr.value);
9659
153
        if (!value) goto failed;
9660
153
        if (PyObject_SetAttr(result, state->value, value) == -1)
9661
0
            goto failed;
9662
153
        Py_DECREF(value);
9663
153
        break;
9664
58.0k
    case BinOp_kind:
9665
58.0k
        tp = (PyTypeObject *)state->BinOp_type;
9666
58.0k
        result = PyType_GenericNew(tp, NULL, NULL);
9667
58.0k
        if (!result) goto failed;
9668
58.0k
        value = ast2obj_expr(state, o->v.BinOp.left);
9669
58.0k
        if (!value) goto failed;
9670
58.0k
        if (PyObject_SetAttr(result, state->left, value) == -1)
9671
0
            goto failed;
9672
58.0k
        Py_DECREF(value);
9673
58.0k
        value = ast2obj_operator(state, o->v.BinOp.op);
9674
58.0k
        if (!value) goto failed;
9675
58.0k
        if (PyObject_SetAttr(result, state->op, value) == -1)
9676
0
            goto failed;
9677
58.0k
        Py_DECREF(value);
9678
58.0k
        value = ast2obj_expr(state, o->v.BinOp.right);
9679
58.0k
        if (!value) goto failed;
9680
58.0k
        if (PyObject_SetAttr(result, state->right, value) == -1)
9681
0
            goto failed;
9682
58.0k
        Py_DECREF(value);
9683
58.0k
        break;
9684
20.1k
    case UnaryOp_kind:
9685
20.1k
        tp = (PyTypeObject *)state->UnaryOp_type;
9686
20.1k
        result = PyType_GenericNew(tp, NULL, NULL);
9687
20.1k
        if (!result) goto failed;
9688
20.1k
        value = ast2obj_unaryop(state, o->v.UnaryOp.op);
9689
20.1k
        if (!value) goto failed;
9690
20.1k
        if (PyObject_SetAttr(result, state->op, value) == -1)
9691
0
            goto failed;
9692
20.1k
        Py_DECREF(value);
9693
20.1k
        value = ast2obj_expr(state, o->v.UnaryOp.operand);
9694
20.1k
        if (!value) goto failed;
9695
20.1k
        if (PyObject_SetAttr(result, state->operand, value) == -1)
9696
0
            goto failed;
9697
20.1k
        Py_DECREF(value);
9698
20.1k
        break;
9699
1.80k
    case Lambda_kind:
9700
1.80k
        tp = (PyTypeObject *)state->Lambda_type;
9701
1.80k
        result = PyType_GenericNew(tp, NULL, NULL);
9702
1.80k
        if (!result) goto failed;
9703
1.80k
        value = ast2obj_arguments(state, o->v.Lambda.args);
9704
1.80k
        if (!value) goto failed;
9705
1.80k
        if (PyObject_SetAttr(result, state->args, value) == -1)
9706
0
            goto failed;
9707
1.80k
        Py_DECREF(value);
9708
1.80k
        value = ast2obj_expr(state, o->v.Lambda.body);
9709
1.80k
        if (!value) goto failed;
9710
1.80k
        if (PyObject_SetAttr(result, state->body, value) == -1)
9711
0
            goto failed;
9712
1.80k
        Py_DECREF(value);
9713
1.80k
        break;
9714
357
    case IfExp_kind:
9715
357
        tp = (PyTypeObject *)state->IfExp_type;
9716
357
        result = PyType_GenericNew(tp, NULL, NULL);
9717
357
        if (!result) goto failed;
9718
357
        value = ast2obj_expr(state, o->v.IfExp.test);
9719
357
        if (!value) goto failed;
9720
357
        if (PyObject_SetAttr(result, state->test, value) == -1)
9721
0
            goto failed;
9722
357
        Py_DECREF(value);
9723
357
        value = ast2obj_expr(state, o->v.IfExp.body);
9724
357
        if (!value) goto failed;
9725
357
        if (PyObject_SetAttr(result, state->body, value) == -1)
9726
0
            goto failed;
9727
357
        Py_DECREF(value);
9728
357
        value = ast2obj_expr(state, o->v.IfExp.orelse);
9729
357
        if (!value) goto failed;
9730
357
        if (PyObject_SetAttr(result, state->orelse, value) == -1)
9731
0
            goto failed;
9732
357
        Py_DECREF(value);
9733
357
        break;
9734
31
    case Dict_kind:
9735
31
        tp = (PyTypeObject *)state->Dict_type;
9736
31
        result = PyType_GenericNew(tp, NULL, NULL);
9737
31
        if (!result) goto failed;
9738
31
        value = ast2obj_list(state, (asdl_seq*)o->v.Dict.keys, ast2obj_expr);
9739
31
        if (!value) goto failed;
9740
31
        if (PyObject_SetAttr(result, state->keys, value) == -1)
9741
0
            goto failed;
9742
31
        Py_DECREF(value);
9743
31
        value = ast2obj_list(state, (asdl_seq*)o->v.Dict.values, ast2obj_expr);
9744
31
        if (!value) goto failed;
9745
31
        if (PyObject_SetAttr(result, state->values, value) == -1)
9746
0
            goto failed;
9747
31
        Py_DECREF(value);
9748
31
        break;
9749
657
    case Set_kind:
9750
657
        tp = (PyTypeObject *)state->Set_type;
9751
657
        result = PyType_GenericNew(tp, NULL, NULL);
9752
657
        if (!result) goto failed;
9753
657
        value = ast2obj_list(state, (asdl_seq*)o->v.Set.elts, ast2obj_expr);
9754
657
        if (!value) goto failed;
9755
657
        if (PyObject_SetAttr(result, state->elts, value) == -1)
9756
0
            goto failed;
9757
657
        Py_DECREF(value);
9758
657
        break;
9759
51
    case ListComp_kind:
9760
51
        tp = (PyTypeObject *)state->ListComp_type;
9761
51
        result = PyType_GenericNew(tp, NULL, NULL);
9762
51
        if (!result) goto failed;
9763
51
        value = ast2obj_expr(state, o->v.ListComp.elt);
9764
51
        if (!value) goto failed;
9765
51
        if (PyObject_SetAttr(result, state->elt, value) == -1)
9766
0
            goto failed;
9767
51
        Py_DECREF(value);
9768
51
        value = ast2obj_list(state, (asdl_seq*)o->v.ListComp.generators,
9769
51
                             ast2obj_comprehension);
9770
51
        if (!value) goto failed;
9771
51
        if (PyObject_SetAttr(result, state->generators, value) == -1)
9772
0
            goto failed;
9773
51
        Py_DECREF(value);
9774
51
        break;
9775
518
    case SetComp_kind:
9776
518
        tp = (PyTypeObject *)state->SetComp_type;
9777
518
        result = PyType_GenericNew(tp, NULL, NULL);
9778
518
        if (!result) goto failed;
9779
518
        value = ast2obj_expr(state, o->v.SetComp.elt);
9780
518
        if (!value) goto failed;
9781
518
        if (PyObject_SetAttr(result, state->elt, value) == -1)
9782
0
            goto failed;
9783
518
        Py_DECREF(value);
9784
518
        value = ast2obj_list(state, (asdl_seq*)o->v.SetComp.generators,
9785
518
                             ast2obj_comprehension);
9786
518
        if (!value) goto failed;
9787
518
        if (PyObject_SetAttr(result, state->generators, value) == -1)
9788
0
            goto failed;
9789
518
        Py_DECREF(value);
9790
518
        break;
9791
379
    case DictComp_kind:
9792
379
        tp = (PyTypeObject *)state->DictComp_type;
9793
379
        result = PyType_GenericNew(tp, NULL, NULL);
9794
379
        if (!result) goto failed;
9795
379
        value = ast2obj_expr(state, o->v.DictComp.key);
9796
379
        if (!value) goto failed;
9797
379
        if (PyObject_SetAttr(result, state->key, value) == -1)
9798
0
            goto failed;
9799
379
        Py_DECREF(value);
9800
379
        value = ast2obj_expr(state, o->v.DictComp.value);
9801
379
        if (!value) goto failed;
9802
379
        if (PyObject_SetAttr(result, state->value, value) == -1)
9803
0
            goto failed;
9804
379
        Py_DECREF(value);
9805
379
        value = ast2obj_list(state, (asdl_seq*)o->v.DictComp.generators,
9806
379
                             ast2obj_comprehension);
9807
379
        if (!value) goto failed;
9808
379
        if (PyObject_SetAttr(result, state->generators, value) == -1)
9809
0
            goto failed;
9810
379
        Py_DECREF(value);
9811
379
        break;
9812
760
    case GeneratorExp_kind:
9813
760
        tp = (PyTypeObject *)state->GeneratorExp_type;
9814
760
        result = PyType_GenericNew(tp, NULL, NULL);
9815
760
        if (!result) goto failed;
9816
760
        value = ast2obj_expr(state, o->v.GeneratorExp.elt);
9817
760
        if (!value) goto failed;
9818
760
        if (PyObject_SetAttr(result, state->elt, value) == -1)
9819
0
            goto failed;
9820
760
        Py_DECREF(value);
9821
760
        value = ast2obj_list(state, (asdl_seq*)o->v.GeneratorExp.generators,
9822
760
                             ast2obj_comprehension);
9823
760
        if (!value) goto failed;
9824
760
        if (PyObject_SetAttr(result, state->generators, value) == -1)
9825
0
            goto failed;
9826
760
        Py_DECREF(value);
9827
760
        break;
9828
48
    case Await_kind:
9829
48
        tp = (PyTypeObject *)state->Await_type;
9830
48
        result = PyType_GenericNew(tp, NULL, NULL);
9831
48
        if (!result) goto failed;
9832
48
        value = ast2obj_expr(state, o->v.Await.value);
9833
48
        if (!value) goto failed;
9834
48
        if (PyObject_SetAttr(result, state->value, value) == -1)
9835
0
            goto failed;
9836
48
        Py_DECREF(value);
9837
48
        break;
9838
264
    case Yield_kind:
9839
264
        tp = (PyTypeObject *)state->Yield_type;
9840
264
        result = PyType_GenericNew(tp, NULL, NULL);
9841
264
        if (!result) goto failed;
9842
264
        value = ast2obj_expr(state, o->v.Yield.value);
9843
264
        if (!value) goto failed;
9844
264
        if (PyObject_SetAttr(result, state->value, value) == -1)
9845
0
            goto failed;
9846
264
        Py_DECREF(value);
9847
264
        break;
9848
12
    case YieldFrom_kind:
9849
12
        tp = (PyTypeObject *)state->YieldFrom_type;
9850
12
        result = PyType_GenericNew(tp, NULL, NULL);
9851
12
        if (!result) goto failed;
9852
12
        value = ast2obj_expr(state, o->v.YieldFrom.value);
9853
12
        if (!value) goto failed;
9854
12
        if (PyObject_SetAttr(result, state->value, value) == -1)
9855
0
            goto failed;
9856
12
        Py_DECREF(value);
9857
12
        break;
9858
2.71k
    case Compare_kind:
9859
2.71k
        tp = (PyTypeObject *)state->Compare_type;
9860
2.71k
        result = PyType_GenericNew(tp, NULL, NULL);
9861
2.71k
        if (!result) goto failed;
9862
2.71k
        value = ast2obj_expr(state, o->v.Compare.left);
9863
2.71k
        if (!value) goto failed;
9864
2.71k
        if (PyObject_SetAttr(result, state->left, value) == -1)
9865
0
            goto failed;
9866
2.71k
        Py_DECREF(value);
9867
2.71k
        {
9868
2.71k
            Py_ssize_t i, n = asdl_seq_LEN(o->v.Compare.ops);
9869
2.71k
            value = PyList_New(n);
9870
2.71k
            if (!value) goto failed;
9871
7.69k
            for(i = 0; i < n; i++)
9872
4.97k
                PyList_SET_ITEM(value, i, ast2obj_cmpop(state, (cmpop_ty)asdl_seq_GET(o->v.Compare.ops, i)));
9873
2.71k
        }
9874
2.71k
        if (!value) goto failed;
9875
2.71k
        if (PyObject_SetAttr(result, state->ops, value) == -1)
9876
0
            goto failed;
9877
2.71k
        Py_DECREF(value);
9878
2.71k
        value = ast2obj_list(state, (asdl_seq*)o->v.Compare.comparators,
9879
2.71k
                             ast2obj_expr);
9880
2.71k
        if (!value) goto failed;
9881
2.71k
        if (PyObject_SetAttr(result, state->comparators, value) == -1)
9882
0
            goto failed;
9883
2.71k
        Py_DECREF(value);
9884
2.71k
        break;
9885
3.95k
    case Call_kind:
9886
3.95k
        tp = (PyTypeObject *)state->Call_type;
9887
3.95k
        result = PyType_GenericNew(tp, NULL, NULL);
9888
3.95k
        if (!result) goto failed;
9889
3.95k
        value = ast2obj_expr(state, o->v.Call.func);
9890
3.95k
        if (!value) goto failed;
9891
3.95k
        if (PyObject_SetAttr(result, state->func, value) == -1)
9892
0
            goto failed;
9893
3.95k
        Py_DECREF(value);
9894
3.95k
        value = ast2obj_list(state, (asdl_seq*)o->v.Call.args, ast2obj_expr);
9895
3.95k
        if (!value) goto failed;
9896
3.95k
        if (PyObject_SetAttr(result, state->args, value) == -1)
9897
0
            goto failed;
9898
3.95k
        Py_DECREF(value);
9899
3.95k
        value = ast2obj_list(state, (asdl_seq*)o->v.Call.keywords,
9900
3.95k
                             ast2obj_keyword);
9901
3.95k
        if (!value) goto failed;
9902
3.95k
        if (PyObject_SetAttr(result, state->keywords, value) == -1)
9903
0
            goto failed;
9904
3.95k
        Py_DECREF(value);
9905
3.95k
        break;
9906
347
    case FormattedValue_kind:
9907
347
        tp = (PyTypeObject *)state->FormattedValue_type;
9908
347
        result = PyType_GenericNew(tp, NULL, NULL);
9909
347
        if (!result) goto failed;
9910
347
        value = ast2obj_expr(state, o->v.FormattedValue.value);
9911
347
        if (!value) goto failed;
9912
347
        if (PyObject_SetAttr(result, state->value, value) == -1)
9913
0
            goto failed;
9914
347
        Py_DECREF(value);
9915
347
        value = ast2obj_int(state, o->v.FormattedValue.conversion);
9916
347
        if (!value) goto failed;
9917
347
        if (PyObject_SetAttr(result, state->conversion, value) == -1)
9918
0
            goto failed;
9919
347
        Py_DECREF(value);
9920
347
        value = ast2obj_expr(state, o->v.FormattedValue.format_spec);
9921
347
        if (!value) goto failed;
9922
347
        if (PyObject_SetAttr(result, state->format_spec, value) == -1)
9923
0
            goto failed;
9924
347
        Py_DECREF(value);
9925
347
        break;
9926
789
    case Interpolation_kind:
9927
789
        tp = (PyTypeObject *)state->Interpolation_type;
9928
789
        result = PyType_GenericNew(tp, NULL, NULL);
9929
789
        if (!result) goto failed;
9930
789
        value = ast2obj_expr(state, o->v.Interpolation.value);
9931
789
        if (!value) goto failed;
9932
789
        if (PyObject_SetAttr(result, state->value, value) == -1)
9933
0
            goto failed;
9934
789
        Py_DECREF(value);
9935
789
        value = ast2obj_constant(state, o->v.Interpolation.str);
9936
789
        if (!value) goto failed;
9937
789
        if (PyObject_SetAttr(result, state->str, value) == -1)
9938
0
            goto failed;
9939
789
        Py_DECREF(value);
9940
789
        value = ast2obj_int(state, o->v.Interpolation.conversion);
9941
789
        if (!value) goto failed;
9942
789
        if (PyObject_SetAttr(result, state->conversion, value) == -1)
9943
0
            goto failed;
9944
789
        Py_DECREF(value);
9945
789
        value = ast2obj_expr(state, o->v.Interpolation.format_spec);
9946
789
        if (!value) goto failed;
9947
789
        if (PyObject_SetAttr(result, state->format_spec, value) == -1)
9948
0
            goto failed;
9949
789
        Py_DECREF(value);
9950
789
        break;
9951
856
    case JoinedStr_kind:
9952
856
        tp = (PyTypeObject *)state->JoinedStr_type;
9953
856
        result = PyType_GenericNew(tp, NULL, NULL);
9954
856
        if (!result) goto failed;
9955
856
        value = ast2obj_list(state, (asdl_seq*)o->v.JoinedStr.values,
9956
856
                             ast2obj_expr);
9957
856
        if (!value) goto failed;
9958
856
        if (PyObject_SetAttr(result, state->values, value) == -1)
9959
0
            goto failed;
9960
856
        Py_DECREF(value);
9961
856
        break;
9962
573
    case TemplateStr_kind:
9963
573
        tp = (PyTypeObject *)state->TemplateStr_type;
9964
573
        result = PyType_GenericNew(tp, NULL, NULL);
9965
573
        if (!result) goto failed;
9966
573
        value = ast2obj_list(state, (asdl_seq*)o->v.TemplateStr.values,
9967
573
                             ast2obj_expr);
9968
573
        if (!value) goto failed;
9969
573
        if (PyObject_SetAttr(result, state->values, value) == -1)
9970
0
            goto failed;
9971
573
        Py_DECREF(value);
9972
573
        break;
9973
63.5k
    case Constant_kind:
9974
63.5k
        tp = (PyTypeObject *)state->Constant_type;
9975
63.5k
        result = PyType_GenericNew(tp, NULL, NULL);
9976
63.5k
        if (!result) goto failed;
9977
63.5k
        value = ast2obj_constant(state, o->v.Constant.value);
9978
63.5k
        if (!value) goto failed;
9979
63.5k
        if (PyObject_SetAttr(result, state->value, value) == -1)
9980
0
            goto failed;
9981
63.5k
        Py_DECREF(value);
9982
63.5k
        value = ast2obj_string(state, o->v.Constant.kind);
9983
63.5k
        if (!value) goto failed;
9984
63.5k
        if (PyObject_SetAttr(result, state->kind, value) == -1)
9985
0
            goto failed;
9986
63.5k
        Py_DECREF(value);
9987
63.5k
        break;
9988
4.15k
    case Attribute_kind:
9989
4.15k
        tp = (PyTypeObject *)state->Attribute_type;
9990
4.15k
        result = PyType_GenericNew(tp, NULL, NULL);
9991
4.15k
        if (!result) goto failed;
9992
4.15k
        value = ast2obj_expr(state, o->v.Attribute.value);
9993
4.15k
        if (!value) goto failed;
9994
4.15k
        if (PyObject_SetAttr(result, state->value, value) == -1)
9995
0
            goto failed;
9996
4.15k
        Py_DECREF(value);
9997
4.15k
        value = ast2obj_identifier(state, o->v.Attribute.attr);
9998
4.15k
        if (!value) goto failed;
9999
4.15k
        if (PyObject_SetAttr(result, state->attr, value) == -1)
10000
0
            goto failed;
10001
4.15k
        Py_DECREF(value);
10002
4.15k
        value = ast2obj_expr_context(state, o->v.Attribute.ctx);
10003
4.15k
        if (!value) goto failed;
10004
4.15k
        if (PyObject_SetAttr(result, state->ctx, value) == -1)
10005
0
            goto failed;
10006
4.15k
        Py_DECREF(value);
10007
4.15k
        break;
10008
3.05k
    case Subscript_kind:
10009
3.05k
        tp = (PyTypeObject *)state->Subscript_type;
10010
3.05k
        result = PyType_GenericNew(tp, NULL, NULL);
10011
3.05k
        if (!result) goto failed;
10012
3.05k
        value = ast2obj_expr(state, o->v.Subscript.value);
10013
3.05k
        if (!value) goto failed;
10014
3.05k
        if (PyObject_SetAttr(result, state->value, value) == -1)
10015
0
            goto failed;
10016
3.05k
        Py_DECREF(value);
10017
3.05k
        value = ast2obj_expr(state, o->v.Subscript.slice);
10018
3.05k
        if (!value) goto failed;
10019
3.05k
        if (PyObject_SetAttr(result, state->slice, value) == -1)
10020
0
            goto failed;
10021
3.05k
        Py_DECREF(value);
10022
3.05k
        value = ast2obj_expr_context(state, o->v.Subscript.ctx);
10023
3.05k
        if (!value) goto failed;
10024
3.05k
        if (PyObject_SetAttr(result, state->ctx, value) == -1)
10025
0
            goto failed;
10026
3.05k
        Py_DECREF(value);
10027
3.05k
        break;
10028
2.95k
    case Starred_kind:
10029
2.95k
        tp = (PyTypeObject *)state->Starred_type;
10030
2.95k
        result = PyType_GenericNew(tp, NULL, NULL);
10031
2.95k
        if (!result) goto failed;
10032
2.95k
        value = ast2obj_expr(state, o->v.Starred.value);
10033
2.95k
        if (!value) goto failed;
10034
2.95k
        if (PyObject_SetAttr(result, state->value, value) == -1)
10035
0
            goto failed;
10036
2.95k
        Py_DECREF(value);
10037
2.95k
        value = ast2obj_expr_context(state, o->v.Starred.ctx);
10038
2.95k
        if (!value) goto failed;
10039
2.95k
        if (PyObject_SetAttr(result, state->ctx, value) == -1)
10040
0
            goto failed;
10041
2.95k
        Py_DECREF(value);
10042
2.95k
        break;
10043
54.0k
    case Name_kind:
10044
54.0k
        tp = (PyTypeObject *)state->Name_type;
10045
54.0k
        result = PyType_GenericNew(tp, NULL, NULL);
10046
54.0k
        if (!result) goto failed;
10047
54.0k
        value = ast2obj_identifier(state, o->v.Name.id);
10048
54.0k
        if (!value) goto failed;
10049
54.0k
        if (PyObject_SetAttr(result, state->id, value) == -1)
10050
0
            goto failed;
10051
54.0k
        Py_DECREF(value);
10052
54.0k
        value = ast2obj_expr_context(state, o->v.Name.ctx);
10053
54.0k
        if (!value) goto failed;
10054
54.0k
        if (PyObject_SetAttr(result, state->ctx, value) == -1)
10055
0
            goto failed;
10056
54.0k
        Py_DECREF(value);
10057
54.0k
        break;
10058
1.96k
    case List_kind:
10059
1.96k
        tp = (PyTypeObject *)state->List_type;
10060
1.96k
        result = PyType_GenericNew(tp, NULL, NULL);
10061
1.96k
        if (!result) goto failed;
10062
1.96k
        value = ast2obj_list(state, (asdl_seq*)o->v.List.elts, ast2obj_expr);
10063
1.96k
        if (!value) goto failed;
10064
1.96k
        if (PyObject_SetAttr(result, state->elts, value) == -1)
10065
0
            goto failed;
10066
1.96k
        Py_DECREF(value);
10067
1.96k
        value = ast2obj_expr_context(state, o->v.List.ctx);
10068
1.96k
        if (!value) goto failed;
10069
1.96k
        if (PyObject_SetAttr(result, state->ctx, value) == -1)
10070
0
            goto failed;
10071
1.96k
        Py_DECREF(value);
10072
1.96k
        break;
10073
7.10k
    case Tuple_kind:
10074
7.10k
        tp = (PyTypeObject *)state->Tuple_type;
10075
7.10k
        result = PyType_GenericNew(tp, NULL, NULL);
10076
7.10k
        if (!result) goto failed;
10077
7.10k
        value = ast2obj_list(state, (asdl_seq*)o->v.Tuple.elts, ast2obj_expr);
10078
7.10k
        if (!value) goto failed;
10079
7.10k
        if (PyObject_SetAttr(result, state->elts, value) == -1)
10080
0
            goto failed;
10081
7.10k
        Py_DECREF(value);
10082
7.10k
        value = ast2obj_expr_context(state, o->v.Tuple.ctx);
10083
7.10k
        if (!value) goto failed;
10084
7.10k
        if (PyObject_SetAttr(result, state->ctx, value) == -1)
10085
0
            goto failed;
10086
7.10k
        Py_DECREF(value);
10087
7.10k
        break;
10088
1.60k
    case Slice_kind:
10089
1.60k
        tp = (PyTypeObject *)state->Slice_type;
10090
1.60k
        result = PyType_GenericNew(tp, NULL, NULL);
10091
1.60k
        if (!result) goto failed;
10092
1.60k
        value = ast2obj_expr(state, o->v.Slice.lower);
10093
1.60k
        if (!value) goto failed;
10094
1.60k
        if (PyObject_SetAttr(result, state->lower, value) == -1)
10095
0
            goto failed;
10096
1.60k
        Py_DECREF(value);
10097
1.60k
        value = ast2obj_expr(state, o->v.Slice.upper);
10098
1.60k
        if (!value) goto failed;
10099
1.60k
        if (PyObject_SetAttr(result, state->upper, value) == -1)
10100
0
            goto failed;
10101
1.60k
        Py_DECREF(value);
10102
1.60k
        value = ast2obj_expr(state, o->v.Slice.step);
10103
1.60k
        if (!value) goto failed;
10104
1.60k
        if (PyObject_SetAttr(result, state->step, value) == -1)
10105
0
            goto failed;
10106
1.60k
        Py_DECREF(value);
10107
1.60k
        break;
10108
231k
    }
10109
231k
    value = ast2obj_int(state, o->lineno);
10110
231k
    if (!value) goto failed;
10111
231k
    if (PyObject_SetAttr(result, state->lineno, value) < 0)
10112
0
        goto failed;
10113
231k
    Py_DECREF(value);
10114
231k
    value = ast2obj_int(state, o->col_offset);
10115
231k
    if (!value) goto failed;
10116
231k
    if (PyObject_SetAttr(result, state->col_offset, value) < 0)
10117
0
        goto failed;
10118
231k
    Py_DECREF(value);
10119
231k
    value = ast2obj_int(state, o->end_lineno);
10120
231k
    if (!value) goto failed;
10121
231k
    if (PyObject_SetAttr(result, state->end_lineno, value) < 0)
10122
0
        goto failed;
10123
231k
    Py_DECREF(value);
10124
231k
    value = ast2obj_int(state, o->end_col_offset);
10125
231k
    if (!value) goto failed;
10126
231k
    if (PyObject_SetAttr(result, state->end_col_offset, value) < 0)
10127
0
        goto failed;
10128
231k
    Py_DECREF(value);
10129
231k
    Py_LeaveRecursiveCall();
10130
231k
    return result;
10131
0
failed:
10132
0
    Py_LeaveRecursiveCall();
10133
0
    Py_XDECREF(value);
10134
0
    Py_XDECREF(result);
10135
0
    return NULL;
10136
231k
}
10137
10138
PyObject* ast2obj_expr_context(struct ast_state *state, expr_context_ty o)
10139
73.2k
{
10140
73.2k
    switch(o) {
10141
62.0k
        case Load:
10142
62.0k
            return Py_NewRef(state->Load_singleton);
10143
11.1k
        case Store:
10144
11.1k
            return Py_NewRef(state->Store_singleton);
10145
104
        case Del:
10146
104
            return Py_NewRef(state->Del_singleton);
10147
73.2k
    }
10148
73.2k
    Py_UNREACHABLE();
10149
73.2k
}
10150
PyObject* ast2obj_boolop(struct ast_state *state, boolop_ty o)
10151
404
{
10152
404
    switch(o) {
10153
205
        case And:
10154
205
            return Py_NewRef(state->And_singleton);
10155
199
        case Or:
10156
199
            return Py_NewRef(state->Or_singleton);
10157
404
    }
10158
404
    Py_UNREACHABLE();
10159
404
}
10160
PyObject* ast2obj_operator(struct ast_state *state, operator_ty o)
10161
59.0k
{
10162
59.0k
    switch(o) {
10163
20.3k
        case Add:
10164
20.3k
            return Py_NewRef(state->Add_singleton);
10165
13.6k
        case Sub:
10166
13.6k
            return Py_NewRef(state->Sub_singleton);
10167
8.06k
        case Mult:
10168
8.06k
            return Py_NewRef(state->Mult_singleton);
10169
392
        case MatMult:
10170
392
            return Py_NewRef(state->MatMult_singleton);
10171
2.45k
        case Div:
10172
2.45k
            return Py_NewRef(state->Div_singleton);
10173
5.01k
        case Mod:
10174
5.01k
            return Py_NewRef(state->Mod_singleton);
10175
3.79k
        case Pow:
10176
3.79k
            return Py_NewRef(state->Pow_singleton);
10177
116
        case LShift:
10178
116
            return Py_NewRef(state->LShift_singleton);
10179
947
        case RShift:
10180
947
            return Py_NewRef(state->RShift_singleton);
10181
621
        case BitOr:
10182
621
            return Py_NewRef(state->BitOr_singleton);
10183
1.73k
        case BitXor:
10184
1.73k
            return Py_NewRef(state->BitXor_singleton);
10185
1.28k
        case BitAnd:
10186
1.28k
            return Py_NewRef(state->BitAnd_singleton);
10187
625
        case FloorDiv:
10188
625
            return Py_NewRef(state->FloorDiv_singleton);
10189
59.0k
    }
10190
59.0k
    Py_UNREACHABLE();
10191
59.0k
}
10192
PyObject* ast2obj_unaryop(struct ast_state *state, unaryop_ty o)
10193
20.1k
{
10194
20.1k
    switch(o) {
10195
2.54k
        case Invert:
10196
2.54k
            return Py_NewRef(state->Invert_singleton);
10197
782
        case Not:
10198
782
            return Py_NewRef(state->Not_singleton);
10199
8.43k
        case UAdd:
10200
8.43k
            return Py_NewRef(state->UAdd_singleton);
10201
8.36k
        case USub:
10202
8.36k
            return Py_NewRef(state->USub_singleton);
10203
20.1k
    }
10204
20.1k
    Py_UNREACHABLE();
10205
20.1k
}
10206
PyObject* ast2obj_cmpop(struct ast_state *state, cmpop_ty o)
10207
4.97k
{
10208
4.97k
    switch(o) {
10209
628
        case Eq:
10210
628
            return Py_NewRef(state->Eq_singleton);
10211
31
        case NotEq:
10212
31
            return Py_NewRef(state->NotEq_singleton);
10213
767
        case Lt:
10214
767
            return Py_NewRef(state->Lt_singleton);
10215
361
        case LtE:
10216
361
            return Py_NewRef(state->LtE_singleton);
10217
1.53k
        case Gt:
10218
1.53k
            return Py_NewRef(state->Gt_singleton);
10219
202
        case GtE:
10220
202
            return Py_NewRef(state->GtE_singleton);
10221
574
        case Is:
10222
574
            return Py_NewRef(state->Is_singleton);
10223
10
        case IsNot:
10224
10
            return Py_NewRef(state->IsNot_singleton);
10225
826
        case In:
10226
826
            return Py_NewRef(state->In_singleton);
10227
40
        case NotIn:
10228
40
            return Py_NewRef(state->NotIn_singleton);
10229
4.97k
    }
10230
4.97k
    Py_UNREACHABLE();
10231
4.97k
}
10232
PyObject*
10233
ast2obj_comprehension(struct ast_state *state, void* _o)
10234
1.86k
{
10235
1.86k
    comprehension_ty o = (comprehension_ty)_o;
10236
1.86k
    PyObject *result = NULL, *value = NULL;
10237
1.86k
    PyTypeObject *tp;
10238
1.86k
    if (!o) {
10239
0
        Py_RETURN_NONE;
10240
0
    }
10241
1.86k
    if (Py_EnterRecursiveCall("during  ast construction")) {
10242
0
        return NULL;
10243
0
    }
10244
1.86k
    tp = (PyTypeObject *)state->comprehension_type;
10245
1.86k
    result = PyType_GenericNew(tp, NULL, NULL);
10246
1.86k
    if (!result) return NULL;
10247
1.86k
    value = ast2obj_expr(state, o->target);
10248
1.86k
    if (!value) goto failed;
10249
1.86k
    if (PyObject_SetAttr(result, state->target, value) == -1)
10250
0
        goto failed;
10251
1.86k
    Py_DECREF(value);
10252
1.86k
    value = ast2obj_expr(state, o->iter);
10253
1.86k
    if (!value) goto failed;
10254
1.86k
    if (PyObject_SetAttr(result, state->iter, value) == -1)
10255
0
        goto failed;
10256
1.86k
    Py_DECREF(value);
10257
1.86k
    value = ast2obj_list(state, (asdl_seq*)o->ifs, ast2obj_expr);
10258
1.86k
    if (!value) goto failed;
10259
1.86k
    if (PyObject_SetAttr(result, state->ifs, value) == -1)
10260
0
        goto failed;
10261
1.86k
    Py_DECREF(value);
10262
1.86k
    value = ast2obj_int(state, o->is_async);
10263
1.86k
    if (!value) goto failed;
10264
1.86k
    if (PyObject_SetAttr(result, state->is_async, value) == -1)
10265
0
        goto failed;
10266
1.86k
    Py_DECREF(value);
10267
1.86k
    Py_LeaveRecursiveCall();
10268
1.86k
    return result;
10269
0
failed:
10270
0
    Py_LeaveRecursiveCall();
10271
0
    Py_XDECREF(value);
10272
0
    Py_XDECREF(result);
10273
0
    return NULL;
10274
1.86k
}
10275
10276
PyObject*
10277
ast2obj_excepthandler(struct ast_state *state, void* _o)
10278
1.02k
{
10279
1.02k
    excepthandler_ty o = (excepthandler_ty)_o;
10280
1.02k
    PyObject *result = NULL, *value = NULL;
10281
1.02k
    PyTypeObject *tp;
10282
1.02k
    if (!o) {
10283
0
        Py_RETURN_NONE;
10284
0
    }
10285
1.02k
    if (Py_EnterRecursiveCall("during  ast construction")) {
10286
0
        return NULL;
10287
0
    }
10288
1.02k
    switch (o->kind) {
10289
1.02k
    case ExceptHandler_kind:
10290
1.02k
        tp = (PyTypeObject *)state->ExceptHandler_type;
10291
1.02k
        result = PyType_GenericNew(tp, NULL, NULL);
10292
1.02k
        if (!result) goto failed;
10293
1.02k
        value = ast2obj_expr(state, o->v.ExceptHandler.type);
10294
1.02k
        if (!value) goto failed;
10295
1.02k
        if (PyObject_SetAttr(result, state->type, value) == -1)
10296
0
            goto failed;
10297
1.02k
        Py_DECREF(value);
10298
1.02k
        value = ast2obj_identifier(state, o->v.ExceptHandler.name);
10299
1.02k
        if (!value) goto failed;
10300
1.02k
        if (PyObject_SetAttr(result, state->name, value) == -1)
10301
0
            goto failed;
10302
1.02k
        Py_DECREF(value);
10303
1.02k
        value = ast2obj_list(state, (asdl_seq*)o->v.ExceptHandler.body,
10304
1.02k
                             ast2obj_stmt);
10305
1.02k
        if (!value) goto failed;
10306
1.02k
        if (PyObject_SetAttr(result, state->body, value) == -1)
10307
0
            goto failed;
10308
1.02k
        Py_DECREF(value);
10309
1.02k
        break;
10310
1.02k
    }
10311
1.02k
    value = ast2obj_int(state, o->lineno);
10312
1.02k
    if (!value) goto failed;
10313
1.02k
    if (PyObject_SetAttr(result, state->lineno, value) < 0)
10314
0
        goto failed;
10315
1.02k
    Py_DECREF(value);
10316
1.02k
    value = ast2obj_int(state, o->col_offset);
10317
1.02k
    if (!value) goto failed;
10318
1.02k
    if (PyObject_SetAttr(result, state->col_offset, value) < 0)
10319
0
        goto failed;
10320
1.02k
    Py_DECREF(value);
10321
1.02k
    value = ast2obj_int(state, o->end_lineno);
10322
1.02k
    if (!value) goto failed;
10323
1.02k
    if (PyObject_SetAttr(result, state->end_lineno, value) < 0)
10324
0
        goto failed;
10325
1.02k
    Py_DECREF(value);
10326
1.02k
    value = ast2obj_int(state, o->end_col_offset);
10327
1.02k
    if (!value) goto failed;
10328
1.02k
    if (PyObject_SetAttr(result, state->end_col_offset, value) < 0)
10329
0
        goto failed;
10330
1.02k
    Py_DECREF(value);
10331
1.02k
    Py_LeaveRecursiveCall();
10332
1.02k
    return result;
10333
0
failed:
10334
0
    Py_LeaveRecursiveCall();
10335
0
    Py_XDECREF(value);
10336
0
    Py_XDECREF(result);
10337
0
    return NULL;
10338
1.02k
}
10339
10340
PyObject*
10341
ast2obj_arguments(struct ast_state *state, void* _o)
10342
2.56k
{
10343
2.56k
    arguments_ty o = (arguments_ty)_o;
10344
2.56k
    PyObject *result = NULL, *value = NULL;
10345
2.56k
    PyTypeObject *tp;
10346
2.56k
    if (!o) {
10347
0
        Py_RETURN_NONE;
10348
0
    }
10349
2.56k
    if (Py_EnterRecursiveCall("during  ast construction")) {
10350
0
        return NULL;
10351
0
    }
10352
2.56k
    tp = (PyTypeObject *)state->arguments_type;
10353
2.56k
    result = PyType_GenericNew(tp, NULL, NULL);
10354
2.56k
    if (!result) return NULL;
10355
2.56k
    value = ast2obj_list(state, (asdl_seq*)o->posonlyargs, ast2obj_arg);
10356
2.56k
    if (!value) goto failed;
10357
2.56k
    if (PyObject_SetAttr(result, state->posonlyargs, value) == -1)
10358
0
        goto failed;
10359
2.56k
    Py_DECREF(value);
10360
2.56k
    value = ast2obj_list(state, (asdl_seq*)o->args, ast2obj_arg);
10361
2.56k
    if (!value) goto failed;
10362
2.56k
    if (PyObject_SetAttr(result, state->args, value) == -1)
10363
0
        goto failed;
10364
2.56k
    Py_DECREF(value);
10365
2.56k
    value = ast2obj_arg(state, o->vararg);
10366
2.56k
    if (!value) goto failed;
10367
2.56k
    if (PyObject_SetAttr(result, state->vararg, value) == -1)
10368
0
        goto failed;
10369
2.56k
    Py_DECREF(value);
10370
2.56k
    value = ast2obj_list(state, (asdl_seq*)o->kwonlyargs, ast2obj_arg);
10371
2.56k
    if (!value) goto failed;
10372
2.56k
    if (PyObject_SetAttr(result, state->kwonlyargs, value) == -1)
10373
0
        goto failed;
10374
2.56k
    Py_DECREF(value);
10375
2.56k
    value = ast2obj_list(state, (asdl_seq*)o->kw_defaults, ast2obj_expr);
10376
2.56k
    if (!value) goto failed;
10377
2.56k
    if (PyObject_SetAttr(result, state->kw_defaults, value) == -1)
10378
0
        goto failed;
10379
2.56k
    Py_DECREF(value);
10380
2.56k
    value = ast2obj_arg(state, o->kwarg);
10381
2.56k
    if (!value) goto failed;
10382
2.56k
    if (PyObject_SetAttr(result, state->kwarg, value) == -1)
10383
0
        goto failed;
10384
2.56k
    Py_DECREF(value);
10385
2.56k
    value = ast2obj_list(state, (asdl_seq*)o->defaults, ast2obj_expr);
10386
2.56k
    if (!value) goto failed;
10387
2.56k
    if (PyObject_SetAttr(result, state->defaults, value) == -1)
10388
0
        goto failed;
10389
2.56k
    Py_DECREF(value);
10390
2.56k
    Py_LeaveRecursiveCall();
10391
2.56k
    return result;
10392
0
failed:
10393
0
    Py_LeaveRecursiveCall();
10394
0
    Py_XDECREF(value);
10395
0
    Py_XDECREF(result);
10396
0
    return NULL;
10397
2.56k
}
10398
10399
PyObject*
10400
ast2obj_arg(struct ast_state *state, void* _o)
10401
7.70k
{
10402
7.70k
    arg_ty o = (arg_ty)_o;
10403
7.70k
    PyObject *result = NULL, *value = NULL;
10404
7.70k
    PyTypeObject *tp;
10405
7.70k
    if (!o) {
10406
4.12k
        Py_RETURN_NONE;
10407
4.12k
    }
10408
3.58k
    if (Py_EnterRecursiveCall("during  ast construction")) {
10409
0
        return NULL;
10410
0
    }
10411
3.58k
    tp = (PyTypeObject *)state->arg_type;
10412
3.58k
    result = PyType_GenericNew(tp, NULL, NULL);
10413
3.58k
    if (!result) return NULL;
10414
3.58k
    value = ast2obj_identifier(state, o->arg);
10415
3.58k
    if (!value) goto failed;
10416
3.58k
    if (PyObject_SetAttr(result, state->arg, value) == -1)
10417
0
        goto failed;
10418
3.58k
    Py_DECREF(value);
10419
3.58k
    value = ast2obj_expr(state, o->annotation);
10420
3.58k
    if (!value) goto failed;
10421
3.58k
    if (PyObject_SetAttr(result, state->annotation, value) == -1)
10422
0
        goto failed;
10423
3.58k
    Py_DECREF(value);
10424
3.58k
    value = ast2obj_string(state, o->type_comment);
10425
3.58k
    if (!value) goto failed;
10426
3.58k
    if (PyObject_SetAttr(result, state->type_comment, value) == -1)
10427
0
        goto failed;
10428
3.58k
    Py_DECREF(value);
10429
3.58k
    value = ast2obj_int(state, o->lineno);
10430
3.58k
    if (!value) goto failed;
10431
3.58k
    if (PyObject_SetAttr(result, state->lineno, value) < 0)
10432
0
        goto failed;
10433
3.58k
    Py_DECREF(value);
10434
3.58k
    value = ast2obj_int(state, o->col_offset);
10435
3.58k
    if (!value) goto failed;
10436
3.58k
    if (PyObject_SetAttr(result, state->col_offset, value) < 0)
10437
0
        goto failed;
10438
3.58k
    Py_DECREF(value);
10439
3.58k
    value = ast2obj_int(state, o->end_lineno);
10440
3.58k
    if (!value) goto failed;
10441
3.58k
    if (PyObject_SetAttr(result, state->end_lineno, value) < 0)
10442
0
        goto failed;
10443
3.58k
    Py_DECREF(value);
10444
3.58k
    value = ast2obj_int(state, o->end_col_offset);
10445
3.58k
    if (!value) goto failed;
10446
3.58k
    if (PyObject_SetAttr(result, state->end_col_offset, value) < 0)
10447
0
        goto failed;
10448
3.58k
    Py_DECREF(value);
10449
3.58k
    Py_LeaveRecursiveCall();
10450
3.58k
    return result;
10451
0
failed:
10452
0
    Py_LeaveRecursiveCall();
10453
0
    Py_XDECREF(value);
10454
0
    Py_XDECREF(result);
10455
0
    return NULL;
10456
3.58k
}
10457
10458
PyObject*
10459
ast2obj_keyword(struct ast_state *state, void* _o)
10460
830
{
10461
830
    keyword_ty o = (keyword_ty)_o;
10462
830
    PyObject *result = NULL, *value = NULL;
10463
830
    PyTypeObject *tp;
10464
830
    if (!o) {
10465
0
        Py_RETURN_NONE;
10466
0
    }
10467
830
    if (Py_EnterRecursiveCall("during  ast construction")) {
10468
0
        return NULL;
10469
0
    }
10470
830
    tp = (PyTypeObject *)state->keyword_type;
10471
830
    result = PyType_GenericNew(tp, NULL, NULL);
10472
830
    if (!result) return NULL;
10473
830
    value = ast2obj_identifier(state, o->arg);
10474
830
    if (!value) goto failed;
10475
830
    if (PyObject_SetAttr(result, state->arg, value) == -1)
10476
0
        goto failed;
10477
830
    Py_DECREF(value);
10478
830
    value = ast2obj_expr(state, o->value);
10479
830
    if (!value) goto failed;
10480
830
    if (PyObject_SetAttr(result, state->value, value) == -1)
10481
0
        goto failed;
10482
830
    Py_DECREF(value);
10483
830
    value = ast2obj_int(state, o->lineno);
10484
830
    if (!value) goto failed;
10485
830
    if (PyObject_SetAttr(result, state->lineno, value) < 0)
10486
0
        goto failed;
10487
830
    Py_DECREF(value);
10488
830
    value = ast2obj_int(state, o->col_offset);
10489
830
    if (!value) goto failed;
10490
830
    if (PyObject_SetAttr(result, state->col_offset, value) < 0)
10491
0
        goto failed;
10492
830
    Py_DECREF(value);
10493
830
    value = ast2obj_int(state, o->end_lineno);
10494
830
    if (!value) goto failed;
10495
830
    if (PyObject_SetAttr(result, state->end_lineno, value) < 0)
10496
0
        goto failed;
10497
830
    Py_DECREF(value);
10498
830
    value = ast2obj_int(state, o->end_col_offset);
10499
830
    if (!value) goto failed;
10500
830
    if (PyObject_SetAttr(result, state->end_col_offset, value) < 0)
10501
0
        goto failed;
10502
830
    Py_DECREF(value);
10503
830
    Py_LeaveRecursiveCall();
10504
830
    return result;
10505
0
failed:
10506
0
    Py_LeaveRecursiveCall();
10507
0
    Py_XDECREF(value);
10508
0
    Py_XDECREF(result);
10509
0
    return NULL;
10510
830
}
10511
10512
PyObject*
10513
ast2obj_alias(struct ast_state *state, void* _o)
10514
2.73k
{
10515
2.73k
    alias_ty o = (alias_ty)_o;
10516
2.73k
    PyObject *result = NULL, *value = NULL;
10517
2.73k
    PyTypeObject *tp;
10518
2.73k
    if (!o) {
10519
0
        Py_RETURN_NONE;
10520
0
    }
10521
2.73k
    if (Py_EnterRecursiveCall("during  ast construction")) {
10522
0
        return NULL;
10523
0
    }
10524
2.73k
    tp = (PyTypeObject *)state->alias_type;
10525
2.73k
    result = PyType_GenericNew(tp, NULL, NULL);
10526
2.73k
    if (!result) return NULL;
10527
2.73k
    value = ast2obj_identifier(state, o->name);
10528
2.73k
    if (!value) goto failed;
10529
2.73k
    if (PyObject_SetAttr(result, state->name, value) == -1)
10530
0
        goto failed;
10531
2.73k
    Py_DECREF(value);
10532
2.73k
    value = ast2obj_identifier(state, o->asname);
10533
2.73k
    if (!value) goto failed;
10534
2.73k
    if (PyObject_SetAttr(result, state->asname, value) == -1)
10535
0
        goto failed;
10536
2.73k
    Py_DECREF(value);
10537
2.73k
    value = ast2obj_int(state, o->lineno);
10538
2.73k
    if (!value) goto failed;
10539
2.73k
    if (PyObject_SetAttr(result, state->lineno, value) < 0)
10540
0
        goto failed;
10541
2.73k
    Py_DECREF(value);
10542
2.73k
    value = ast2obj_int(state, o->col_offset);
10543
2.73k
    if (!value) goto failed;
10544
2.73k
    if (PyObject_SetAttr(result, state->col_offset, value) < 0)
10545
0
        goto failed;
10546
2.73k
    Py_DECREF(value);
10547
2.73k
    value = ast2obj_int(state, o->end_lineno);
10548
2.73k
    if (!value) goto failed;
10549
2.73k
    if (PyObject_SetAttr(result, state->end_lineno, value) < 0)
10550
0
        goto failed;
10551
2.73k
    Py_DECREF(value);
10552
2.73k
    value = ast2obj_int(state, o->end_col_offset);
10553
2.73k
    if (!value) goto failed;
10554
2.73k
    if (PyObject_SetAttr(result, state->end_col_offset, value) < 0)
10555
0
        goto failed;
10556
2.73k
    Py_DECREF(value);
10557
2.73k
    Py_LeaveRecursiveCall();
10558
2.73k
    return result;
10559
0
failed:
10560
0
    Py_LeaveRecursiveCall();
10561
0
    Py_XDECREF(value);
10562
0
    Py_XDECREF(result);
10563
0
    return NULL;
10564
2.73k
}
10565
10566
PyObject*
10567
ast2obj_withitem(struct ast_state *state, void* _o)
10568
1.84k
{
10569
1.84k
    withitem_ty o = (withitem_ty)_o;
10570
1.84k
    PyObject *result = NULL, *value = NULL;
10571
1.84k
    PyTypeObject *tp;
10572
1.84k
    if (!o) {
10573
0
        Py_RETURN_NONE;
10574
0
    }
10575
1.84k
    if (Py_EnterRecursiveCall("during  ast construction")) {
10576
0
        return NULL;
10577
0
    }
10578
1.84k
    tp = (PyTypeObject *)state->withitem_type;
10579
1.84k
    result = PyType_GenericNew(tp, NULL, NULL);
10580
1.84k
    if (!result) return NULL;
10581
1.84k
    value = ast2obj_expr(state, o->context_expr);
10582
1.84k
    if (!value) goto failed;
10583
1.84k
    if (PyObject_SetAttr(result, state->context_expr, value) == -1)
10584
0
        goto failed;
10585
1.84k
    Py_DECREF(value);
10586
1.84k
    value = ast2obj_expr(state, o->optional_vars);
10587
1.84k
    if (!value) goto failed;
10588
1.84k
    if (PyObject_SetAttr(result, state->optional_vars, value) == -1)
10589
0
        goto failed;
10590
1.84k
    Py_DECREF(value);
10591
1.84k
    Py_LeaveRecursiveCall();
10592
1.84k
    return result;
10593
0
failed:
10594
0
    Py_LeaveRecursiveCall();
10595
0
    Py_XDECREF(value);
10596
0
    Py_XDECREF(result);
10597
0
    return NULL;
10598
1.84k
}
10599
10600
PyObject*
10601
ast2obj_match_case(struct ast_state *state, void* _o)
10602
30
{
10603
30
    match_case_ty o = (match_case_ty)_o;
10604
30
    PyObject *result = NULL, *value = NULL;
10605
30
    PyTypeObject *tp;
10606
30
    if (!o) {
10607
0
        Py_RETURN_NONE;
10608
0
    }
10609
30
    if (Py_EnterRecursiveCall("during  ast construction")) {
10610
0
        return NULL;
10611
0
    }
10612
30
    tp = (PyTypeObject *)state->match_case_type;
10613
30
    result = PyType_GenericNew(tp, NULL, NULL);
10614
30
    if (!result) return NULL;
10615
30
    value = ast2obj_pattern(state, o->pattern);
10616
30
    if (!value) goto failed;
10617
30
    if (PyObject_SetAttr(result, state->pattern, value) == -1)
10618
0
        goto failed;
10619
30
    Py_DECREF(value);
10620
30
    value = ast2obj_expr(state, o->guard);
10621
30
    if (!value) goto failed;
10622
30
    if (PyObject_SetAttr(result, state->guard, value) == -1)
10623
0
        goto failed;
10624
30
    Py_DECREF(value);
10625
30
    value = ast2obj_list(state, (asdl_seq*)o->body, ast2obj_stmt);
10626
30
    if (!value) goto failed;
10627
30
    if (PyObject_SetAttr(result, state->body, value) == -1)
10628
0
        goto failed;
10629
30
    Py_DECREF(value);
10630
30
    Py_LeaveRecursiveCall();
10631
30
    return result;
10632
0
failed:
10633
0
    Py_LeaveRecursiveCall();
10634
0
    Py_XDECREF(value);
10635
0
    Py_XDECREF(result);
10636
0
    return NULL;
10637
30
}
10638
10639
PyObject*
10640
ast2obj_pattern(struct ast_state *state, void* _o)
10641
100
{
10642
100
    pattern_ty o = (pattern_ty)_o;
10643
100
    PyObject *result = NULL, *value = NULL;
10644
100
    PyTypeObject *tp;
10645
100
    if (!o) {
10646
40
        Py_RETURN_NONE;
10647
40
    }
10648
60
    if (Py_EnterRecursiveCall("during  ast construction")) {
10649
0
        return NULL;
10650
0
    }
10651
60
    switch (o->kind) {
10652
6
    case MatchValue_kind:
10653
6
        tp = (PyTypeObject *)state->MatchValue_type;
10654
6
        result = PyType_GenericNew(tp, NULL, NULL);
10655
6
        if (!result) goto failed;
10656
6
        value = ast2obj_expr(state, o->v.MatchValue.value);
10657
6
        if (!value) goto failed;
10658
6
        if (PyObject_SetAttr(result, state->value, value) == -1)
10659
0
            goto failed;
10660
6
        Py_DECREF(value);
10661
6
        break;
10662
0
    case MatchSingleton_kind:
10663
0
        tp = (PyTypeObject *)state->MatchSingleton_type;
10664
0
        result = PyType_GenericNew(tp, NULL, NULL);
10665
0
        if (!result) goto failed;
10666
0
        value = ast2obj_constant(state, o->v.MatchSingleton.value);
10667
0
        if (!value) goto failed;
10668
0
        if (PyObject_SetAttr(result, state->value, value) == -1)
10669
0
            goto failed;
10670
0
        Py_DECREF(value);
10671
0
        break;
10672
8
    case MatchSequence_kind:
10673
8
        tp = (PyTypeObject *)state->MatchSequence_type;
10674
8
        result = PyType_GenericNew(tp, NULL, NULL);
10675
8
        if (!result) goto failed;
10676
8
        value = ast2obj_list(state, (asdl_seq*)o->v.MatchSequence.patterns,
10677
8
                             ast2obj_pattern);
10678
8
        if (!value) goto failed;
10679
8
        if (PyObject_SetAttr(result, state->patterns, value) == -1)
10680
0
            goto failed;
10681
8
        Py_DECREF(value);
10682
8
        break;
10683
0
    case MatchMapping_kind:
10684
0
        tp = (PyTypeObject *)state->MatchMapping_type;
10685
0
        result = PyType_GenericNew(tp, NULL, NULL);
10686
0
        if (!result) goto failed;
10687
0
        value = ast2obj_list(state, (asdl_seq*)o->v.MatchMapping.keys,
10688
0
                             ast2obj_expr);
10689
0
        if (!value) goto failed;
10690
0
        if (PyObject_SetAttr(result, state->keys, value) == -1)
10691
0
            goto failed;
10692
0
        Py_DECREF(value);
10693
0
        value = ast2obj_list(state, (asdl_seq*)o->v.MatchMapping.patterns,
10694
0
                             ast2obj_pattern);
10695
0
        if (!value) goto failed;
10696
0
        if (PyObject_SetAttr(result, state->patterns, value) == -1)
10697
0
            goto failed;
10698
0
        Py_DECREF(value);
10699
0
        value = ast2obj_identifier(state, o->v.MatchMapping.rest);
10700
0
        if (!value) goto failed;
10701
0
        if (PyObject_SetAttr(result, state->rest, value) == -1)
10702
0
            goto failed;
10703
0
        Py_DECREF(value);
10704
0
        break;
10705
3
    case MatchClass_kind:
10706
3
        tp = (PyTypeObject *)state->MatchClass_type;
10707
3
        result = PyType_GenericNew(tp, NULL, NULL);
10708
3
        if (!result) goto failed;
10709
3
        value = ast2obj_expr(state, o->v.MatchClass.cls);
10710
3
        if (!value) goto failed;
10711
3
        if (PyObject_SetAttr(result, state->cls, value) == -1)
10712
0
            goto failed;
10713
3
        Py_DECREF(value);
10714
3
        value = ast2obj_list(state, (asdl_seq*)o->v.MatchClass.patterns,
10715
3
                             ast2obj_pattern);
10716
3
        if (!value) goto failed;
10717
3
        if (PyObject_SetAttr(result, state->patterns, value) == -1)
10718
0
            goto failed;
10719
3
        Py_DECREF(value);
10720
3
        value = ast2obj_list(state, (asdl_seq*)o->v.MatchClass.kwd_attrs,
10721
3
                             ast2obj_identifier);
10722
3
        if (!value) goto failed;
10723
3
        if (PyObject_SetAttr(result, state->kwd_attrs, value) == -1)
10724
0
            goto failed;
10725
3
        Py_DECREF(value);
10726
3
        value = ast2obj_list(state, (asdl_seq*)o->v.MatchClass.kwd_patterns,
10727
3
                             ast2obj_pattern);
10728
3
        if (!value) goto failed;
10729
3
        if (PyObject_SetAttr(result, state->kwd_patterns, value) == -1)
10730
0
            goto failed;
10731
3
        Py_DECREF(value);
10732
3
        break;
10733
1
    case MatchStar_kind:
10734
1
        tp = (PyTypeObject *)state->MatchStar_type;
10735
1
        result = PyType_GenericNew(tp, NULL, NULL);
10736
1
        if (!result) goto failed;
10737
1
        value = ast2obj_identifier(state, o->v.MatchStar.name);
10738
1
        if (!value) goto failed;
10739
1
        if (PyObject_SetAttr(result, state->name, value) == -1)
10740
0
            goto failed;
10741
1
        Py_DECREF(value);
10742
1
        break;
10743
42
    case MatchAs_kind:
10744
42
        tp = (PyTypeObject *)state->MatchAs_type;
10745
42
        result = PyType_GenericNew(tp, NULL, NULL);
10746
42
        if (!result) goto failed;
10747
42
        value = ast2obj_pattern(state, o->v.MatchAs.pattern);
10748
42
        if (!value) goto failed;
10749
42
        if (PyObject_SetAttr(result, state->pattern, value) == -1)
10750
0
            goto failed;
10751
42
        Py_DECREF(value);
10752
42
        value = ast2obj_identifier(state, o->v.MatchAs.name);
10753
42
        if (!value) goto failed;
10754
42
        if (PyObject_SetAttr(result, state->name, value) == -1)
10755
0
            goto failed;
10756
42
        Py_DECREF(value);
10757
42
        break;
10758
0
    case MatchOr_kind:
10759
0
        tp = (PyTypeObject *)state->MatchOr_type;
10760
0
        result = PyType_GenericNew(tp, NULL, NULL);
10761
0
        if (!result) goto failed;
10762
0
        value = ast2obj_list(state, (asdl_seq*)o->v.MatchOr.patterns,
10763
0
                             ast2obj_pattern);
10764
0
        if (!value) goto failed;
10765
0
        if (PyObject_SetAttr(result, state->patterns, value) == -1)
10766
0
            goto failed;
10767
0
        Py_DECREF(value);
10768
0
        break;
10769
60
    }
10770
60
    value = ast2obj_int(state, o->lineno);
10771
60
    if (!value) goto failed;
10772
60
    if (PyObject_SetAttr(result, state->lineno, value) < 0)
10773
0
        goto failed;
10774
60
    Py_DECREF(value);
10775
60
    value = ast2obj_int(state, o->col_offset);
10776
60
    if (!value) goto failed;
10777
60
    if (PyObject_SetAttr(result, state->col_offset, value) < 0)
10778
0
        goto failed;
10779
60
    Py_DECREF(value);
10780
60
    value = ast2obj_int(state, o->end_lineno);
10781
60
    if (!value) goto failed;
10782
60
    if (PyObject_SetAttr(result, state->end_lineno, value) < 0)
10783
0
        goto failed;
10784
60
    Py_DECREF(value);
10785
60
    value = ast2obj_int(state, o->end_col_offset);
10786
60
    if (!value) goto failed;
10787
60
    if (PyObject_SetAttr(result, state->end_col_offset, value) < 0)
10788
0
        goto failed;
10789
60
    Py_DECREF(value);
10790
60
    Py_LeaveRecursiveCall();
10791
60
    return result;
10792
0
failed:
10793
0
    Py_LeaveRecursiveCall();
10794
0
    Py_XDECREF(value);
10795
0
    Py_XDECREF(result);
10796
0
    return NULL;
10797
60
}
10798
10799
PyObject*
10800
ast2obj_type_ignore(struct ast_state *state, void* _o)
10801
0
{
10802
0
    type_ignore_ty o = (type_ignore_ty)_o;
10803
0
    PyObject *result = NULL, *value = NULL;
10804
0
    PyTypeObject *tp;
10805
0
    if (!o) {
10806
0
        Py_RETURN_NONE;
10807
0
    }
10808
0
    if (Py_EnterRecursiveCall("during  ast construction")) {
10809
0
        return NULL;
10810
0
    }
10811
0
    switch (o->kind) {
10812
0
    case TypeIgnore_kind:
10813
0
        tp = (PyTypeObject *)state->TypeIgnore_type;
10814
0
        result = PyType_GenericNew(tp, NULL, NULL);
10815
0
        if (!result) goto failed;
10816
0
        value = ast2obj_int(state, o->v.TypeIgnore.lineno);
10817
0
        if (!value) goto failed;
10818
0
        if (PyObject_SetAttr(result, state->lineno, value) == -1)
10819
0
            goto failed;
10820
0
        Py_DECREF(value);
10821
0
        value = ast2obj_string(state, o->v.TypeIgnore.tag);
10822
0
        if (!value) goto failed;
10823
0
        if (PyObject_SetAttr(result, state->tag, value) == -1)
10824
0
            goto failed;
10825
0
        Py_DECREF(value);
10826
0
        break;
10827
0
    }
10828
0
    Py_LeaveRecursiveCall();
10829
0
    return result;
10830
0
failed:
10831
0
    Py_LeaveRecursiveCall();
10832
0
    Py_XDECREF(value);
10833
0
    Py_XDECREF(result);
10834
0
    return NULL;
10835
0
}
10836
10837
PyObject*
10838
ast2obj_type_param(struct ast_state *state, void* _o)
10839
860
{
10840
860
    type_param_ty o = (type_param_ty)_o;
10841
860
    PyObject *result = NULL, *value = NULL;
10842
860
    PyTypeObject *tp;
10843
860
    if (!o) {
10844
0
        Py_RETURN_NONE;
10845
0
    }
10846
860
    if (Py_EnterRecursiveCall("during  ast construction")) {
10847
0
        return NULL;
10848
0
    }
10849
860
    switch (o->kind) {
10850
815
    case TypeVar_kind:
10851
815
        tp = (PyTypeObject *)state->TypeVar_type;
10852
815
        result = PyType_GenericNew(tp, NULL, NULL);
10853
815
        if (!result) goto failed;
10854
815
        value = ast2obj_identifier(state, o->v.TypeVar.name);
10855
815
        if (!value) goto failed;
10856
815
        if (PyObject_SetAttr(result, state->name, value) == -1)
10857
0
            goto failed;
10858
815
        Py_DECREF(value);
10859
815
        value = ast2obj_expr(state, o->v.TypeVar.bound);
10860
815
        if (!value) goto failed;
10861
815
        if (PyObject_SetAttr(result, state->bound, value) == -1)
10862
0
            goto failed;
10863
815
        Py_DECREF(value);
10864
815
        value = ast2obj_expr(state, o->v.TypeVar.default_value);
10865
815
        if (!value) goto failed;
10866
815
        if (PyObject_SetAttr(result, state->default_value, value) == -1)
10867
0
            goto failed;
10868
815
        Py_DECREF(value);
10869
815
        break;
10870
1
    case ParamSpec_kind:
10871
1
        tp = (PyTypeObject *)state->ParamSpec_type;
10872
1
        result = PyType_GenericNew(tp, NULL, NULL);
10873
1
        if (!result) goto failed;
10874
1
        value = ast2obj_identifier(state, o->v.ParamSpec.name);
10875
1
        if (!value) goto failed;
10876
1
        if (PyObject_SetAttr(result, state->name, value) == -1)
10877
0
            goto failed;
10878
1
        Py_DECREF(value);
10879
1
        value = ast2obj_expr(state, o->v.ParamSpec.default_value);
10880
1
        if (!value) goto failed;
10881
1
        if (PyObject_SetAttr(result, state->default_value, value) == -1)
10882
0
            goto failed;
10883
1
        Py_DECREF(value);
10884
1
        break;
10885
44
    case TypeVarTuple_kind:
10886
44
        tp = (PyTypeObject *)state->TypeVarTuple_type;
10887
44
        result = PyType_GenericNew(tp, NULL, NULL);
10888
44
        if (!result) goto failed;
10889
44
        value = ast2obj_identifier(state, o->v.TypeVarTuple.name);
10890
44
        if (!value) goto failed;
10891
44
        if (PyObject_SetAttr(result, state->name, value) == -1)
10892
0
            goto failed;
10893
44
        Py_DECREF(value);
10894
44
        value = ast2obj_expr(state, o->v.TypeVarTuple.default_value);
10895
44
        if (!value) goto failed;
10896
44
        if (PyObject_SetAttr(result, state->default_value, value) == -1)
10897
0
            goto failed;
10898
44
        Py_DECREF(value);
10899
44
        break;
10900
860
    }
10901
860
    value = ast2obj_int(state, o->lineno);
10902
860
    if (!value) goto failed;
10903
860
    if (PyObject_SetAttr(result, state->lineno, value) < 0)
10904
0
        goto failed;
10905
860
    Py_DECREF(value);
10906
860
    value = ast2obj_int(state, o->col_offset);
10907
860
    if (!value) goto failed;
10908
860
    if (PyObject_SetAttr(result, state->col_offset, value) < 0)
10909
0
        goto failed;
10910
860
    Py_DECREF(value);
10911
860
    value = ast2obj_int(state, o->end_lineno);
10912
860
    if (!value) goto failed;
10913
860
    if (PyObject_SetAttr(result, state->end_lineno, value) < 0)
10914
0
        goto failed;
10915
860
    Py_DECREF(value);
10916
860
    value = ast2obj_int(state, o->end_col_offset);
10917
860
    if (!value) goto failed;
10918
860
    if (PyObject_SetAttr(result, state->end_col_offset, value) < 0)
10919
0
        goto failed;
10920
860
    Py_DECREF(value);
10921
860
    Py_LeaveRecursiveCall();
10922
860
    return result;
10923
0
failed:
10924
0
    Py_LeaveRecursiveCall();
10925
0
    Py_XDECREF(value);
10926
0
    Py_XDECREF(result);
10927
0
    return NULL;
10928
860
}
10929
10930
10931
int
10932
obj2ast_mod(struct ast_state *state, PyObject* obj, mod_ty* out, PyArena* arena)
10933
0
{
10934
0
    int isinstance;
10935
10936
0
    PyObject *tmp = NULL;
10937
0
    PyObject *tp;
10938
10939
0
    if (obj == Py_None) {
10940
0
        *out = NULL;
10941
0
        return 0;
10942
0
    }
10943
0
    tp = state->Module_type;
10944
0
    isinstance = PyObject_IsInstance(obj, tp);
10945
0
    if (isinstance == -1) {
10946
0
        return -1;
10947
0
    }
10948
0
    if (isinstance) {
10949
0
        asdl_stmt_seq* body;
10950
0
        asdl_type_ignore_seq* type_ignores;
10951
10952
0
        if (PyObject_GetOptionalAttr(obj, state->body, &tmp) < 0) {
10953
0
            return -1;
10954
0
        }
10955
0
        if (tmp == NULL) {
10956
0
            tmp = PyList_New(0);
10957
0
            if (tmp == NULL) {
10958
0
                return -1;
10959
0
            }
10960
0
        }
10961
0
        {
10962
0
            int res;
10963
0
            Py_ssize_t len;
10964
0
            Py_ssize_t i;
10965
0
            if (!PyList_Check(tmp)) {
10966
0
                PyErr_Format(PyExc_TypeError, "Module field \"body\" must be a list, not a %.200s", _PyType_Name(Py_TYPE(tmp)));
10967
0
                goto failed;
10968
0
            }
10969
0
            len = PyList_GET_SIZE(tmp);
10970
0
            body = _Py_asdl_stmt_seq_new(len, arena);
10971
0
            if (body == NULL) goto failed;
10972
0
            for (i = 0; i < len; i++) {
10973
0
                stmt_ty val;
10974
0
                PyObject *tmp2 = Py_NewRef(PyList_GET_ITEM(tmp, i));
10975
0
                if (_Py_EnterRecursiveCall(" while traversing 'Module' node")) {
10976
0
                    goto failed;
10977
0
                }
10978
0
                res = obj2ast_stmt(state, tmp2, &val, arena);
10979
0
                _Py_LeaveRecursiveCall();
10980
0
                Py_DECREF(tmp2);
10981
0
                if (res != 0) goto failed;
10982
0
                if (len != PyList_GET_SIZE(tmp)) {
10983
0
                    PyErr_SetString(PyExc_RuntimeError, "Module field \"body\" changed size during iteration");
10984
0
                    goto failed;
10985
0
                }
10986
0
                asdl_seq_SET(body, i, val);
10987
0
            }
10988
0
            Py_CLEAR(tmp);
10989
0
        }
10990
0
        if (PyObject_GetOptionalAttr(obj, state->type_ignores, &tmp) < 0) {
10991
0
            return -1;
10992
0
        }
10993
0
        if (tmp == NULL) {
10994
0
            tmp = PyList_New(0);
10995
0
            if (tmp == NULL) {
10996
0
                return -1;
10997
0
            }
10998
0
        }
10999
0
        {
11000
0
            int res;
11001
0
            Py_ssize_t len;
11002
0
            Py_ssize_t i;
11003
0
            if (!PyList_Check(tmp)) {
11004
0
                PyErr_Format(PyExc_TypeError, "Module field \"type_ignores\" must be a list, not a %.200s", _PyType_Name(Py_TYPE(tmp)));
11005
0
                goto failed;
11006
0
            }
11007
0
            len = PyList_GET_SIZE(tmp);
11008
0
            type_ignores = _Py_asdl_type_ignore_seq_new(len, arena);
11009
0
            if (type_ignores == NULL) goto failed;
11010
0
            for (i = 0; i < len; i++) {
11011
0
                type_ignore_ty val;
11012
0
                PyObject *tmp2 = Py_NewRef(PyList_GET_ITEM(tmp, i));
11013
0
                if (_Py_EnterRecursiveCall(" while traversing 'Module' node")) {
11014
0
                    goto failed;
11015
0
                }
11016
0
                res = obj2ast_type_ignore(state, tmp2, &val, arena);
11017
0
                _Py_LeaveRecursiveCall();
11018
0
                Py_DECREF(tmp2);
11019
0
                if (res != 0) goto failed;
11020
0
                if (len != PyList_GET_SIZE(tmp)) {
11021
0
                    PyErr_SetString(PyExc_RuntimeError, "Module field \"type_ignores\" changed size during iteration");
11022
0
                    goto failed;
11023
0
                }
11024
0
                asdl_seq_SET(type_ignores, i, val);
11025
0
            }
11026
0
            Py_CLEAR(tmp);
11027
0
        }
11028
0
        *out = _PyAST_Module(body, type_ignores, arena);
11029
0
        if (*out == NULL) goto failed;
11030
0
        return 0;
11031
0
    }
11032
0
    tp = state->Interactive_type;
11033
0
    isinstance = PyObject_IsInstance(obj, tp);
11034
0
    if (isinstance == -1) {
11035
0
        return -1;
11036
0
    }
11037
0
    if (isinstance) {
11038
0
        asdl_stmt_seq* body;
11039
11040
0
        if (PyObject_GetOptionalAttr(obj, state->body, &tmp) < 0) {
11041
0
            return -1;
11042
0
        }
11043
0
        if (tmp == NULL) {
11044
0
            tmp = PyList_New(0);
11045
0
            if (tmp == NULL) {
11046
0
                return -1;
11047
0
            }
11048
0
        }
11049
0
        {
11050
0
            int res;
11051
0
            Py_ssize_t len;
11052
0
            Py_ssize_t i;
11053
0
            if (!PyList_Check(tmp)) {
11054
0
                PyErr_Format(PyExc_TypeError, "Interactive field \"body\" must be a list, not a %.200s", _PyType_Name(Py_TYPE(tmp)));
11055
0
                goto failed;
11056
0
            }
11057
0
            len = PyList_GET_SIZE(tmp);
11058
0
            body = _Py_asdl_stmt_seq_new(len, arena);
11059
0
            if (body == NULL) goto failed;
11060
0
            for (i = 0; i < len; i++) {
11061
0
                stmt_ty val;
11062
0
                PyObject *tmp2 = Py_NewRef(PyList_GET_ITEM(tmp, i));
11063
0
                if (_Py_EnterRecursiveCall(" while traversing 'Interactive' node")) {
11064
0
                    goto failed;
11065
0
                }
11066
0
                res = obj2ast_stmt(state, tmp2, &val, arena);
11067
0
                _Py_LeaveRecursiveCall();
11068
0
                Py_DECREF(tmp2);
11069
0
                if (res != 0) goto failed;
11070
0
                if (len != PyList_GET_SIZE(tmp)) {
11071
0
                    PyErr_SetString(PyExc_RuntimeError, "Interactive field \"body\" changed size during iteration");
11072
0
                    goto failed;
11073
0
                }
11074
0
                asdl_seq_SET(body, i, val);
11075
0
            }
11076
0
            Py_CLEAR(tmp);
11077
0
        }
11078
0
        *out = _PyAST_Interactive(body, arena);
11079
0
        if (*out == NULL) goto failed;
11080
0
        return 0;
11081
0
    }
11082
0
    tp = state->Expression_type;
11083
0
    isinstance = PyObject_IsInstance(obj, tp);
11084
0
    if (isinstance == -1) {
11085
0
        return -1;
11086
0
    }
11087
0
    if (isinstance) {
11088
0
        expr_ty body;
11089
11090
0
        if (PyObject_GetOptionalAttr(obj, state->body, &tmp) < 0) {
11091
0
            return -1;
11092
0
        }
11093
0
        if (tmp == NULL) {
11094
0
            PyErr_SetString(PyExc_TypeError, "required field \"body\" missing from Expression");
11095
0
            return -1;
11096
0
        }
11097
0
        else {
11098
0
            int res;
11099
0
            if (_Py_EnterRecursiveCall(" while traversing 'Expression' node")) {
11100
0
                goto failed;
11101
0
            }
11102
0
            res = obj2ast_expr(state, tmp, &body, arena);
11103
0
            _Py_LeaveRecursiveCall();
11104
0
            if (res != 0) goto failed;
11105
0
            Py_CLEAR(tmp);
11106
0
        }
11107
0
        *out = _PyAST_Expression(body, arena);
11108
0
        if (*out == NULL) goto failed;
11109
0
        return 0;
11110
0
    }
11111
0
    tp = state->FunctionType_type;
11112
0
    isinstance = PyObject_IsInstance(obj, tp);
11113
0
    if (isinstance == -1) {
11114
0
        return -1;
11115
0
    }
11116
0
    if (isinstance) {
11117
0
        asdl_expr_seq* argtypes;
11118
0
        expr_ty returns;
11119
11120
0
        if (PyObject_GetOptionalAttr(obj, state->argtypes, &tmp) < 0) {
11121
0
            return -1;
11122
0
        }
11123
0
        if (tmp == NULL) {
11124
0
            tmp = PyList_New(0);
11125
0
            if (tmp == NULL) {
11126
0
                return -1;
11127
0
            }
11128
0
        }
11129
0
        {
11130
0
            int res;
11131
0
            Py_ssize_t len;
11132
0
            Py_ssize_t i;
11133
0
            if (!PyList_Check(tmp)) {
11134
0
                PyErr_Format(PyExc_TypeError, "FunctionType field \"argtypes\" must be a list, not a %.200s", _PyType_Name(Py_TYPE(tmp)));
11135
0
                goto failed;
11136
0
            }
11137
0
            len = PyList_GET_SIZE(tmp);
11138
0
            argtypes = _Py_asdl_expr_seq_new(len, arena);
11139
0
            if (argtypes == NULL) goto failed;
11140
0
            for (i = 0; i < len; i++) {
11141
0
                expr_ty val;
11142
0
                PyObject *tmp2 = Py_NewRef(PyList_GET_ITEM(tmp, i));
11143
0
                if (_Py_EnterRecursiveCall(" while traversing 'FunctionType' node")) {
11144
0
                    goto failed;
11145
0
                }
11146
0
                res = obj2ast_expr(state, tmp2, &val, arena);
11147
0
                _Py_LeaveRecursiveCall();
11148
0
                Py_DECREF(tmp2);
11149
0
                if (res != 0) goto failed;
11150
0
                if (len != PyList_GET_SIZE(tmp)) {
11151
0
                    PyErr_SetString(PyExc_RuntimeError, "FunctionType field \"argtypes\" changed size during iteration");
11152
0
                    goto failed;
11153
0
                }
11154
0
                asdl_seq_SET(argtypes, i, val);
11155
0
            }
11156
0
            Py_CLEAR(tmp);
11157
0
        }
11158
0
        if (PyObject_GetOptionalAttr(obj, state->returns, &tmp) < 0) {
11159
0
            return -1;
11160
0
        }
11161
0
        if (tmp == NULL) {
11162
0
            PyErr_SetString(PyExc_TypeError, "required field \"returns\" missing from FunctionType");
11163
0
            return -1;
11164
0
        }
11165
0
        else {
11166
0
            int res;
11167
0
            if (_Py_EnterRecursiveCall(" while traversing 'FunctionType' node")) {
11168
0
                goto failed;
11169
0
            }
11170
0
            res = obj2ast_expr(state, tmp, &returns, arena);
11171
0
            _Py_LeaveRecursiveCall();
11172
0
            if (res != 0) goto failed;
11173
0
            Py_CLEAR(tmp);
11174
0
        }
11175
0
        *out = _PyAST_FunctionType(argtypes, returns, arena);
11176
0
        if (*out == NULL) goto failed;
11177
0
        return 0;
11178
0
    }
11179
11180
0
    PyErr_Format(PyExc_TypeError, "expected some sort of mod, but got %R", obj);
11181
0
    failed:
11182
0
    Py_XDECREF(tmp);
11183
0
    return -1;
11184
0
}
11185
11186
int
11187
obj2ast_stmt(struct ast_state *state, PyObject* obj, stmt_ty* out, PyArena*
11188
             arena)
11189
0
{
11190
0
    int isinstance;
11191
11192
0
    PyObject *tmp = NULL;
11193
0
    PyObject *tp;
11194
0
    int lineno;
11195
0
    int col_offset;
11196
0
    int end_lineno;
11197
0
    int end_col_offset;
11198
11199
0
    if (obj == Py_None) {
11200
0
        *out = NULL;
11201
0
        return 0;
11202
0
    }
11203
0
    if (PyObject_GetOptionalAttr(obj, state->lineno, &tmp) < 0) {
11204
0
        return -1;
11205
0
    }
11206
0
    if (tmp == NULL) {
11207
0
        PyErr_SetString(PyExc_TypeError, "required field \"lineno\" missing from stmt");
11208
0
        return -1;
11209
0
    }
11210
0
    else {
11211
0
        int res;
11212
0
        if (_Py_EnterRecursiveCall(" while traversing 'stmt' node")) {
11213
0
            goto failed;
11214
0
        }
11215
0
        res = obj2ast_int(state, tmp, &lineno, arena);
11216
0
        _Py_LeaveRecursiveCall();
11217
0
        if (res != 0) goto failed;
11218
0
        Py_CLEAR(tmp);
11219
0
    }
11220
0
    if (PyObject_GetOptionalAttr(obj, state->col_offset, &tmp) < 0) {
11221
0
        return -1;
11222
0
    }
11223
0
    if (tmp == NULL) {
11224
0
        PyErr_SetString(PyExc_TypeError, "required field \"col_offset\" missing from stmt");
11225
0
        return -1;
11226
0
    }
11227
0
    else {
11228
0
        int res;
11229
0
        if (_Py_EnterRecursiveCall(" while traversing 'stmt' node")) {
11230
0
            goto failed;
11231
0
        }
11232
0
        res = obj2ast_int(state, tmp, &col_offset, arena);
11233
0
        _Py_LeaveRecursiveCall();
11234
0
        if (res != 0) goto failed;
11235
0
        Py_CLEAR(tmp);
11236
0
    }
11237
0
    if (PyObject_GetOptionalAttr(obj, state->end_lineno, &tmp) < 0) {
11238
0
        return -1;
11239
0
    }
11240
0
    if (tmp == NULL || tmp == Py_None) {
11241
0
        Py_CLEAR(tmp);
11242
0
        end_lineno = lineno;
11243
0
    }
11244
0
    else {
11245
0
        int res;
11246
0
        if (_Py_EnterRecursiveCall(" while traversing 'stmt' node")) {
11247
0
            goto failed;
11248
0
        }
11249
0
        res = obj2ast_int(state, tmp, &end_lineno, arena);
11250
0
        _Py_LeaveRecursiveCall();
11251
0
        if (res != 0) goto failed;
11252
0
        Py_CLEAR(tmp);
11253
0
    }
11254
0
    if (PyObject_GetOptionalAttr(obj, state->end_col_offset, &tmp) < 0) {
11255
0
        return -1;
11256
0
    }
11257
0
    if (tmp == NULL || tmp == Py_None) {
11258
0
        Py_CLEAR(tmp);
11259
0
        end_col_offset = col_offset;
11260
0
    }
11261
0
    else {
11262
0
        int res;
11263
0
        if (_Py_EnterRecursiveCall(" while traversing 'stmt' node")) {
11264
0
            goto failed;
11265
0
        }
11266
0
        res = obj2ast_int(state, tmp, &end_col_offset, arena);
11267
0
        _Py_LeaveRecursiveCall();
11268
0
        if (res != 0) goto failed;
11269
0
        Py_CLEAR(tmp);
11270
0
    }
11271
0
    tp = state->FunctionDef_type;
11272
0
    isinstance = PyObject_IsInstance(obj, tp);
11273
0
    if (isinstance == -1) {
11274
0
        return -1;
11275
0
    }
11276
0
    if (isinstance) {
11277
0
        identifier name;
11278
0
        arguments_ty args;
11279
0
        asdl_stmt_seq* body;
11280
0
        asdl_expr_seq* decorator_list;
11281
0
        expr_ty returns;
11282
0
        string type_comment;
11283
0
        asdl_type_param_seq* type_params;
11284
11285
0
        if (PyObject_GetOptionalAttr(obj, state->name, &tmp) < 0) {
11286
0
            return -1;
11287
0
        }
11288
0
        if (tmp == NULL) {
11289
0
            PyErr_SetString(PyExc_TypeError, "required field \"name\" missing from FunctionDef");
11290
0
            return -1;
11291
0
        }
11292
0
        else {
11293
0
            int res;
11294
0
            if (_Py_EnterRecursiveCall(" while traversing 'FunctionDef' node")) {
11295
0
                goto failed;
11296
0
            }
11297
0
            res = obj2ast_identifier(state, tmp, &name, arena);
11298
0
            _Py_LeaveRecursiveCall();
11299
0
            if (res != 0) goto failed;
11300
0
            Py_CLEAR(tmp);
11301
0
        }
11302
0
        if (PyObject_GetOptionalAttr(obj, state->args, &tmp) < 0) {
11303
0
            return -1;
11304
0
        }
11305
0
        if (tmp == NULL) {
11306
0
            PyErr_SetString(PyExc_TypeError, "required field \"args\" missing from FunctionDef");
11307
0
            return -1;
11308
0
        }
11309
0
        else {
11310
0
            int res;
11311
0
            if (_Py_EnterRecursiveCall(" while traversing 'FunctionDef' node")) {
11312
0
                goto failed;
11313
0
            }
11314
0
            res = obj2ast_arguments(state, tmp, &args, arena);
11315
0
            _Py_LeaveRecursiveCall();
11316
0
            if (res != 0) goto failed;
11317
0
            Py_CLEAR(tmp);
11318
0
        }
11319
0
        if (PyObject_GetOptionalAttr(obj, state->body, &tmp) < 0) {
11320
0
            return -1;
11321
0
        }
11322
0
        if (tmp == NULL) {
11323
0
            tmp = PyList_New(0);
11324
0
            if (tmp == NULL) {
11325
0
                return -1;
11326
0
            }
11327
0
        }
11328
0
        {
11329
0
            int res;
11330
0
            Py_ssize_t len;
11331
0
            Py_ssize_t i;
11332
0
            if (!PyList_Check(tmp)) {
11333
0
                PyErr_Format(PyExc_TypeError, "FunctionDef field \"body\" must be a list, not a %.200s", _PyType_Name(Py_TYPE(tmp)));
11334
0
                goto failed;
11335
0
            }
11336
0
            len = PyList_GET_SIZE(tmp);
11337
0
            body = _Py_asdl_stmt_seq_new(len, arena);
11338
0
            if (body == NULL) goto failed;
11339
0
            for (i = 0; i < len; i++) {
11340
0
                stmt_ty val;
11341
0
                PyObject *tmp2 = Py_NewRef(PyList_GET_ITEM(tmp, i));
11342
0
                if (_Py_EnterRecursiveCall(" while traversing 'FunctionDef' node")) {
11343
0
                    goto failed;
11344
0
                }
11345
0
                res = obj2ast_stmt(state, tmp2, &val, arena);
11346
0
                _Py_LeaveRecursiveCall();
11347
0
                Py_DECREF(tmp2);
11348
0
                if (res != 0) goto failed;
11349
0
                if (len != PyList_GET_SIZE(tmp)) {
11350
0
                    PyErr_SetString(PyExc_RuntimeError, "FunctionDef field \"body\" changed size during iteration");
11351
0
                    goto failed;
11352
0
                }
11353
0
                asdl_seq_SET(body, i, val);
11354
0
            }
11355
0
            Py_CLEAR(tmp);
11356
0
        }
11357
0
        if (PyObject_GetOptionalAttr(obj, state->decorator_list, &tmp) < 0) {
11358
0
            return -1;
11359
0
        }
11360
0
        if (tmp == NULL) {
11361
0
            tmp = PyList_New(0);
11362
0
            if (tmp == NULL) {
11363
0
                return -1;
11364
0
            }
11365
0
        }
11366
0
        {
11367
0
            int res;
11368
0
            Py_ssize_t len;
11369
0
            Py_ssize_t i;
11370
0
            if (!PyList_Check(tmp)) {
11371
0
                PyErr_Format(PyExc_TypeError, "FunctionDef field \"decorator_list\" must be a list, not a %.200s", _PyType_Name(Py_TYPE(tmp)));
11372
0
                goto failed;
11373
0
            }
11374
0
            len = PyList_GET_SIZE(tmp);
11375
0
            decorator_list = _Py_asdl_expr_seq_new(len, arena);
11376
0
            if (decorator_list == NULL) goto failed;
11377
0
            for (i = 0; i < len; i++) {
11378
0
                expr_ty val;
11379
0
                PyObject *tmp2 = Py_NewRef(PyList_GET_ITEM(tmp, i));
11380
0
                if (_Py_EnterRecursiveCall(" while traversing 'FunctionDef' node")) {
11381
0
                    goto failed;
11382
0
                }
11383
0
                res = obj2ast_expr(state, tmp2, &val, arena);
11384
0
                _Py_LeaveRecursiveCall();
11385
0
                Py_DECREF(tmp2);
11386
0
                if (res != 0) goto failed;
11387
0
                if (len != PyList_GET_SIZE(tmp)) {
11388
0
                    PyErr_SetString(PyExc_RuntimeError, "FunctionDef field \"decorator_list\" changed size during iteration");
11389
0
                    goto failed;
11390
0
                }
11391
0
                asdl_seq_SET(decorator_list, i, val);
11392
0
            }
11393
0
            Py_CLEAR(tmp);
11394
0
        }
11395
0
        if (PyObject_GetOptionalAttr(obj, state->returns, &tmp) < 0) {
11396
0
            return -1;
11397
0
        }
11398
0
        if (tmp == NULL || tmp == Py_None) {
11399
0
            Py_CLEAR(tmp);
11400
0
            returns = NULL;
11401
0
        }
11402
0
        else {
11403
0
            int res;
11404
0
            if (_Py_EnterRecursiveCall(" while traversing 'FunctionDef' node")) {
11405
0
                goto failed;
11406
0
            }
11407
0
            res = obj2ast_expr(state, tmp, &returns, arena);
11408
0
            _Py_LeaveRecursiveCall();
11409
0
            if (res != 0) goto failed;
11410
0
            Py_CLEAR(tmp);
11411
0
        }
11412
0
        if (PyObject_GetOptionalAttr(obj, state->type_comment, &tmp) < 0) {
11413
0
            return -1;
11414
0
        }
11415
0
        if (tmp == NULL || tmp == Py_None) {
11416
0
            Py_CLEAR(tmp);
11417
0
            type_comment = NULL;
11418
0
        }
11419
0
        else {
11420
0
            int res;
11421
0
            if (_Py_EnterRecursiveCall(" while traversing 'FunctionDef' node")) {
11422
0
                goto failed;
11423
0
            }
11424
0
            res = obj2ast_string(state, tmp, &type_comment, arena);
11425
0
            _Py_LeaveRecursiveCall();
11426
0
            if (res != 0) goto failed;
11427
0
            Py_CLEAR(tmp);
11428
0
        }
11429
0
        if (PyObject_GetOptionalAttr(obj, state->type_params, &tmp) < 0) {
11430
0
            return -1;
11431
0
        }
11432
0
        if (tmp == NULL) {
11433
0
            tmp = PyList_New(0);
11434
0
            if (tmp == NULL) {
11435
0
                return -1;
11436
0
            }
11437
0
        }
11438
0
        {
11439
0
            int res;
11440
0
            Py_ssize_t len;
11441
0
            Py_ssize_t i;
11442
0
            if (!PyList_Check(tmp)) {
11443
0
                PyErr_Format(PyExc_TypeError, "FunctionDef field \"type_params\" must be a list, not a %.200s", _PyType_Name(Py_TYPE(tmp)));
11444
0
                goto failed;
11445
0
            }
11446
0
            len = PyList_GET_SIZE(tmp);
11447
0
            type_params = _Py_asdl_type_param_seq_new(len, arena);
11448
0
            if (type_params == NULL) goto failed;
11449
0
            for (i = 0; i < len; i++) {
11450
0
                type_param_ty val;
11451
0
                PyObject *tmp2 = Py_NewRef(PyList_GET_ITEM(tmp, i));
11452
0
                if (_Py_EnterRecursiveCall(" while traversing 'FunctionDef' node")) {
11453
0
                    goto failed;
11454
0
                }
11455
0
                res = obj2ast_type_param(state, tmp2, &val, arena);
11456
0
                _Py_LeaveRecursiveCall();
11457
0
                Py_DECREF(tmp2);
11458
0
                if (res != 0) goto failed;
11459
0
                if (len != PyList_GET_SIZE(tmp)) {
11460
0
                    PyErr_SetString(PyExc_RuntimeError, "FunctionDef field \"type_params\" changed size during iteration");
11461
0
                    goto failed;
11462
0
                }
11463
0
                asdl_seq_SET(type_params, i, val);
11464
0
            }
11465
0
            Py_CLEAR(tmp);
11466
0
        }
11467
0
        *out = _PyAST_FunctionDef(name, args, body, decorator_list, returns,
11468
0
                                  type_comment, type_params, lineno,
11469
0
                                  col_offset, end_lineno, end_col_offset,
11470
0
                                  arena);
11471
0
        if (*out == NULL) goto failed;
11472
0
        return 0;
11473
0
    }
11474
0
    tp = state->AsyncFunctionDef_type;
11475
0
    isinstance = PyObject_IsInstance(obj, tp);
11476
0
    if (isinstance == -1) {
11477
0
        return -1;
11478
0
    }
11479
0
    if (isinstance) {
11480
0
        identifier name;
11481
0
        arguments_ty args;
11482
0
        asdl_stmt_seq* body;
11483
0
        asdl_expr_seq* decorator_list;
11484
0
        expr_ty returns;
11485
0
        string type_comment;
11486
0
        asdl_type_param_seq* type_params;
11487
11488
0
        if (PyObject_GetOptionalAttr(obj, state->name, &tmp) < 0) {
11489
0
            return -1;
11490
0
        }
11491
0
        if (tmp == NULL) {
11492
0
            PyErr_SetString(PyExc_TypeError, "required field \"name\" missing from AsyncFunctionDef");
11493
0
            return -1;
11494
0
        }
11495
0
        else {
11496
0
            int res;
11497
0
            if (_Py_EnterRecursiveCall(" while traversing 'AsyncFunctionDef' node")) {
11498
0
                goto failed;
11499
0
            }
11500
0
            res = obj2ast_identifier(state, tmp, &name, arena);
11501
0
            _Py_LeaveRecursiveCall();
11502
0
            if (res != 0) goto failed;
11503
0
            Py_CLEAR(tmp);
11504
0
        }
11505
0
        if (PyObject_GetOptionalAttr(obj, state->args, &tmp) < 0) {
11506
0
            return -1;
11507
0
        }
11508
0
        if (tmp == NULL) {
11509
0
            PyErr_SetString(PyExc_TypeError, "required field \"args\" missing from AsyncFunctionDef");
11510
0
            return -1;
11511
0
        }
11512
0
        else {
11513
0
            int res;
11514
0
            if (_Py_EnterRecursiveCall(" while traversing 'AsyncFunctionDef' node")) {
11515
0
                goto failed;
11516
0
            }
11517
0
            res = obj2ast_arguments(state, tmp, &args, arena);
11518
0
            _Py_LeaveRecursiveCall();
11519
0
            if (res != 0) goto failed;
11520
0
            Py_CLEAR(tmp);
11521
0
        }
11522
0
        if (PyObject_GetOptionalAttr(obj, state->body, &tmp) < 0) {
11523
0
            return -1;
11524
0
        }
11525
0
        if (tmp == NULL) {
11526
0
            tmp = PyList_New(0);
11527
0
            if (tmp == NULL) {
11528
0
                return -1;
11529
0
            }
11530
0
        }
11531
0
        {
11532
0
            int res;
11533
0
            Py_ssize_t len;
11534
0
            Py_ssize_t i;
11535
0
            if (!PyList_Check(tmp)) {
11536
0
                PyErr_Format(PyExc_TypeError, "AsyncFunctionDef field \"body\" must be a list, not a %.200s", _PyType_Name(Py_TYPE(tmp)));
11537
0
                goto failed;
11538
0
            }
11539
0
            len = PyList_GET_SIZE(tmp);
11540
0
            body = _Py_asdl_stmt_seq_new(len, arena);
11541
0
            if (body == NULL) goto failed;
11542
0
            for (i = 0; i < len; i++) {
11543
0
                stmt_ty val;
11544
0
                PyObject *tmp2 = Py_NewRef(PyList_GET_ITEM(tmp, i));
11545
0
                if (_Py_EnterRecursiveCall(" while traversing 'AsyncFunctionDef' node")) {
11546
0
                    goto failed;
11547
0
                }
11548
0
                res = obj2ast_stmt(state, tmp2, &val, arena);
11549
0
                _Py_LeaveRecursiveCall();
11550
0
                Py_DECREF(tmp2);
11551
0
                if (res != 0) goto failed;
11552
0
                if (len != PyList_GET_SIZE(tmp)) {
11553
0
                    PyErr_SetString(PyExc_RuntimeError, "AsyncFunctionDef field \"body\" changed size during iteration");
11554
0
                    goto failed;
11555
0
                }
11556
0
                asdl_seq_SET(body, i, val);
11557
0
            }
11558
0
            Py_CLEAR(tmp);
11559
0
        }
11560
0
        if (PyObject_GetOptionalAttr(obj, state->decorator_list, &tmp) < 0) {
11561
0
            return -1;
11562
0
        }
11563
0
        if (tmp == NULL) {
11564
0
            tmp = PyList_New(0);
11565
0
            if (tmp == NULL) {
11566
0
                return -1;
11567
0
            }
11568
0
        }
11569
0
        {
11570
0
            int res;
11571
0
            Py_ssize_t len;
11572
0
            Py_ssize_t i;
11573
0
            if (!PyList_Check(tmp)) {
11574
0
                PyErr_Format(PyExc_TypeError, "AsyncFunctionDef field \"decorator_list\" must be a list, not a %.200s", _PyType_Name(Py_TYPE(tmp)));
11575
0
                goto failed;
11576
0
            }
11577
0
            len = PyList_GET_SIZE(tmp);
11578
0
            decorator_list = _Py_asdl_expr_seq_new(len, arena);
11579
0
            if (decorator_list == NULL) goto failed;
11580
0
            for (i = 0; i < len; i++) {
11581
0
                expr_ty val;
11582
0
                PyObject *tmp2 = Py_NewRef(PyList_GET_ITEM(tmp, i));
11583
0
                if (_Py_EnterRecursiveCall(" while traversing 'AsyncFunctionDef' node")) {
11584
0
                    goto failed;
11585
0
                }
11586
0
                res = obj2ast_expr(state, tmp2, &val, arena);
11587
0
                _Py_LeaveRecursiveCall();
11588
0
                Py_DECREF(tmp2);
11589
0
                if (res != 0) goto failed;
11590
0
                if (len != PyList_GET_SIZE(tmp)) {
11591
0
                    PyErr_SetString(PyExc_RuntimeError, "AsyncFunctionDef field \"decorator_list\" changed size during iteration");
11592
0
                    goto failed;
11593
0
                }
11594
0
                asdl_seq_SET(decorator_list, i, val);
11595
0
            }
11596
0
            Py_CLEAR(tmp);
11597
0
        }
11598
0
        if (PyObject_GetOptionalAttr(obj, state->returns, &tmp) < 0) {
11599
0
            return -1;
11600
0
        }
11601
0
        if (tmp == NULL || tmp == Py_None) {
11602
0
            Py_CLEAR(tmp);
11603
0
            returns = NULL;
11604
0
        }
11605
0
        else {
11606
0
            int res;
11607
0
            if (_Py_EnterRecursiveCall(" while traversing 'AsyncFunctionDef' node")) {
11608
0
                goto failed;
11609
0
            }
11610
0
            res = obj2ast_expr(state, tmp, &returns, arena);
11611
0
            _Py_LeaveRecursiveCall();
11612
0
            if (res != 0) goto failed;
11613
0
            Py_CLEAR(tmp);
11614
0
        }
11615
0
        if (PyObject_GetOptionalAttr(obj, state->type_comment, &tmp) < 0) {
11616
0
            return -1;
11617
0
        }
11618
0
        if (tmp == NULL || tmp == Py_None) {
11619
0
            Py_CLEAR(tmp);
11620
0
            type_comment = NULL;
11621
0
        }
11622
0
        else {
11623
0
            int res;
11624
0
            if (_Py_EnterRecursiveCall(" while traversing 'AsyncFunctionDef' node")) {
11625
0
                goto failed;
11626
0
            }
11627
0
            res = obj2ast_string(state, tmp, &type_comment, arena);
11628
0
            _Py_LeaveRecursiveCall();
11629
0
            if (res != 0) goto failed;
11630
0
            Py_CLEAR(tmp);
11631
0
        }
11632
0
        if (PyObject_GetOptionalAttr(obj, state->type_params, &tmp) < 0) {
11633
0
            return -1;
11634
0
        }
11635
0
        if (tmp == NULL) {
11636
0
            tmp = PyList_New(0);
11637
0
            if (tmp == NULL) {
11638
0
                return -1;
11639
0
            }
11640
0
        }
11641
0
        {
11642
0
            int res;
11643
0
            Py_ssize_t len;
11644
0
            Py_ssize_t i;
11645
0
            if (!PyList_Check(tmp)) {
11646
0
                PyErr_Format(PyExc_TypeError, "AsyncFunctionDef field \"type_params\" must be a list, not a %.200s", _PyType_Name(Py_TYPE(tmp)));
11647
0
                goto failed;
11648
0
            }
11649
0
            len = PyList_GET_SIZE(tmp);
11650
0
            type_params = _Py_asdl_type_param_seq_new(len, arena);
11651
0
            if (type_params == NULL) goto failed;
11652
0
            for (i = 0; i < len; i++) {
11653
0
                type_param_ty val;
11654
0
                PyObject *tmp2 = Py_NewRef(PyList_GET_ITEM(tmp, i));
11655
0
                if (_Py_EnterRecursiveCall(" while traversing 'AsyncFunctionDef' node")) {
11656
0
                    goto failed;
11657
0
                }
11658
0
                res = obj2ast_type_param(state, tmp2, &val, arena);
11659
0
                _Py_LeaveRecursiveCall();
11660
0
                Py_DECREF(tmp2);
11661
0
                if (res != 0) goto failed;
11662
0
                if (len != PyList_GET_SIZE(tmp)) {
11663
0
                    PyErr_SetString(PyExc_RuntimeError, "AsyncFunctionDef field \"type_params\" changed size during iteration");
11664
0
                    goto failed;
11665
0
                }
11666
0
                asdl_seq_SET(type_params, i, val);
11667
0
            }
11668
0
            Py_CLEAR(tmp);
11669
0
        }
11670
0
        *out = _PyAST_AsyncFunctionDef(name, args, body, decorator_list,
11671
0
                                       returns, type_comment, type_params,
11672
0
                                       lineno, col_offset, end_lineno,
11673
0
                                       end_col_offset, arena);
11674
0
        if (*out == NULL) goto failed;
11675
0
        return 0;
11676
0
    }
11677
0
    tp = state->ClassDef_type;
11678
0
    isinstance = PyObject_IsInstance(obj, tp);
11679
0
    if (isinstance == -1) {
11680
0
        return -1;
11681
0
    }
11682
0
    if (isinstance) {
11683
0
        identifier name;
11684
0
        asdl_expr_seq* bases;
11685
0
        asdl_keyword_seq* keywords;
11686
0
        asdl_stmt_seq* body;
11687
0
        asdl_expr_seq* decorator_list;
11688
0
        asdl_type_param_seq* type_params;
11689
11690
0
        if (PyObject_GetOptionalAttr(obj, state->name, &tmp) < 0) {
11691
0
            return -1;
11692
0
        }
11693
0
        if (tmp == NULL) {
11694
0
            PyErr_SetString(PyExc_TypeError, "required field \"name\" missing from ClassDef");
11695
0
            return -1;
11696
0
        }
11697
0
        else {
11698
0
            int res;
11699
0
            if (_Py_EnterRecursiveCall(" while traversing 'ClassDef' node")) {
11700
0
                goto failed;
11701
0
            }
11702
0
            res = obj2ast_identifier(state, tmp, &name, arena);
11703
0
            _Py_LeaveRecursiveCall();
11704
0
            if (res != 0) goto failed;
11705
0
            Py_CLEAR(tmp);
11706
0
        }
11707
0
        if (PyObject_GetOptionalAttr(obj, state->bases, &tmp) < 0) {
11708
0
            return -1;
11709
0
        }
11710
0
        if (tmp == NULL) {
11711
0
            tmp = PyList_New(0);
11712
0
            if (tmp == NULL) {
11713
0
                return -1;
11714
0
            }
11715
0
        }
11716
0
        {
11717
0
            int res;
11718
0
            Py_ssize_t len;
11719
0
            Py_ssize_t i;
11720
0
            if (!PyList_Check(tmp)) {
11721
0
                PyErr_Format(PyExc_TypeError, "ClassDef field \"bases\" must be a list, not a %.200s", _PyType_Name(Py_TYPE(tmp)));
11722
0
                goto failed;
11723
0
            }
11724
0
            len = PyList_GET_SIZE(tmp);
11725
0
            bases = _Py_asdl_expr_seq_new(len, arena);
11726
0
            if (bases == NULL) goto failed;
11727
0
            for (i = 0; i < len; i++) {
11728
0
                expr_ty val;
11729
0
                PyObject *tmp2 = Py_NewRef(PyList_GET_ITEM(tmp, i));
11730
0
                if (_Py_EnterRecursiveCall(" while traversing 'ClassDef' node")) {
11731
0
                    goto failed;
11732
0
                }
11733
0
                res = obj2ast_expr(state, tmp2, &val, arena);
11734
0
                _Py_LeaveRecursiveCall();
11735
0
                Py_DECREF(tmp2);
11736
0
                if (res != 0) goto failed;
11737
0
                if (len != PyList_GET_SIZE(tmp)) {
11738
0
                    PyErr_SetString(PyExc_RuntimeError, "ClassDef field \"bases\" changed size during iteration");
11739
0
                    goto failed;
11740
0
                }
11741
0
                asdl_seq_SET(bases, i, val);
11742
0
            }
11743
0
            Py_CLEAR(tmp);
11744
0
        }
11745
0
        if (PyObject_GetOptionalAttr(obj, state->keywords, &tmp) < 0) {
11746
0
            return -1;
11747
0
        }
11748
0
        if (tmp == NULL) {
11749
0
            tmp = PyList_New(0);
11750
0
            if (tmp == NULL) {
11751
0
                return -1;
11752
0
            }
11753
0
        }
11754
0
        {
11755
0
            int res;
11756
0
            Py_ssize_t len;
11757
0
            Py_ssize_t i;
11758
0
            if (!PyList_Check(tmp)) {
11759
0
                PyErr_Format(PyExc_TypeError, "ClassDef field \"keywords\" must be a list, not a %.200s", _PyType_Name(Py_TYPE(tmp)));
11760
0
                goto failed;
11761
0
            }
11762
0
            len = PyList_GET_SIZE(tmp);
11763
0
            keywords = _Py_asdl_keyword_seq_new(len, arena);
11764
0
            if (keywords == NULL) goto failed;
11765
0
            for (i = 0; i < len; i++) {
11766
0
                keyword_ty val;
11767
0
                PyObject *tmp2 = Py_NewRef(PyList_GET_ITEM(tmp, i));
11768
0
                if (_Py_EnterRecursiveCall(" while traversing 'ClassDef' node")) {
11769
0
                    goto failed;
11770
0
                }
11771
0
                res = obj2ast_keyword(state, tmp2, &val, arena);
11772
0
                _Py_LeaveRecursiveCall();
11773
0
                Py_DECREF(tmp2);
11774
0
                if (res != 0) goto failed;
11775
0
                if (len != PyList_GET_SIZE(tmp)) {
11776
0
                    PyErr_SetString(PyExc_RuntimeError, "ClassDef field \"keywords\" changed size during iteration");
11777
0
                    goto failed;
11778
0
                }
11779
0
                asdl_seq_SET(keywords, i, val);
11780
0
            }
11781
0
            Py_CLEAR(tmp);
11782
0
        }
11783
0
        if (PyObject_GetOptionalAttr(obj, state->body, &tmp) < 0) {
11784
0
            return -1;
11785
0
        }
11786
0
        if (tmp == NULL) {
11787
0
            tmp = PyList_New(0);
11788
0
            if (tmp == NULL) {
11789
0
                return -1;
11790
0
            }
11791
0
        }
11792
0
        {
11793
0
            int res;
11794
0
            Py_ssize_t len;
11795
0
            Py_ssize_t i;
11796
0
            if (!PyList_Check(tmp)) {
11797
0
                PyErr_Format(PyExc_TypeError, "ClassDef field \"body\" must be a list, not a %.200s", _PyType_Name(Py_TYPE(tmp)));
11798
0
                goto failed;
11799
0
            }
11800
0
            len = PyList_GET_SIZE(tmp);
11801
0
            body = _Py_asdl_stmt_seq_new(len, arena);
11802
0
            if (body == NULL) goto failed;
11803
0
            for (i = 0; i < len; i++) {
11804
0
                stmt_ty val;
11805
0
                PyObject *tmp2 = Py_NewRef(PyList_GET_ITEM(tmp, i));
11806
0
                if (_Py_EnterRecursiveCall(" while traversing 'ClassDef' node")) {
11807
0
                    goto failed;
11808
0
                }
11809
0
                res = obj2ast_stmt(state, tmp2, &val, arena);
11810
0
                _Py_LeaveRecursiveCall();
11811
0
                Py_DECREF(tmp2);
11812
0
                if (res != 0) goto failed;
11813
0
                if (len != PyList_GET_SIZE(tmp)) {
11814
0
                    PyErr_SetString(PyExc_RuntimeError, "ClassDef field \"body\" changed size during iteration");
11815
0
                    goto failed;
11816
0
                }
11817
0
                asdl_seq_SET(body, i, val);
11818
0
            }
11819
0
            Py_CLEAR(tmp);
11820
0
        }
11821
0
        if (PyObject_GetOptionalAttr(obj, state->decorator_list, &tmp) < 0) {
11822
0
            return -1;
11823
0
        }
11824
0
        if (tmp == NULL) {
11825
0
            tmp = PyList_New(0);
11826
0
            if (tmp == NULL) {
11827
0
                return -1;
11828
0
            }
11829
0
        }
11830
0
        {
11831
0
            int res;
11832
0
            Py_ssize_t len;
11833
0
            Py_ssize_t i;
11834
0
            if (!PyList_Check(tmp)) {
11835
0
                PyErr_Format(PyExc_TypeError, "ClassDef field \"decorator_list\" must be a list, not a %.200s", _PyType_Name(Py_TYPE(tmp)));
11836
0
                goto failed;
11837
0
            }
11838
0
            len = PyList_GET_SIZE(tmp);
11839
0
            decorator_list = _Py_asdl_expr_seq_new(len, arena);
11840
0
            if (decorator_list == NULL) goto failed;
11841
0
            for (i = 0; i < len; i++) {
11842
0
                expr_ty val;
11843
0
                PyObject *tmp2 = Py_NewRef(PyList_GET_ITEM(tmp, i));
11844
0
                if (_Py_EnterRecursiveCall(" while traversing 'ClassDef' node")) {
11845
0
                    goto failed;
11846
0
                }
11847
0
                res = obj2ast_expr(state, tmp2, &val, arena);
11848
0
                _Py_LeaveRecursiveCall();
11849
0
                Py_DECREF(tmp2);
11850
0
                if (res != 0) goto failed;
11851
0
                if (len != PyList_GET_SIZE(tmp)) {
11852
0
                    PyErr_SetString(PyExc_RuntimeError, "ClassDef field \"decorator_list\" changed size during iteration");
11853
0
                    goto failed;
11854
0
                }
11855
0
                asdl_seq_SET(decorator_list, i, val);
11856
0
            }
11857
0
            Py_CLEAR(tmp);
11858
0
        }
11859
0
        if (PyObject_GetOptionalAttr(obj, state->type_params, &tmp) < 0) {
11860
0
            return -1;
11861
0
        }
11862
0
        if (tmp == NULL) {
11863
0
            tmp = PyList_New(0);
11864
0
            if (tmp == NULL) {
11865
0
                return -1;
11866
0
            }
11867
0
        }
11868
0
        {
11869
0
            int res;
11870
0
            Py_ssize_t len;
11871
0
            Py_ssize_t i;
11872
0
            if (!PyList_Check(tmp)) {
11873
0
                PyErr_Format(PyExc_TypeError, "ClassDef field \"type_params\" must be a list, not a %.200s", _PyType_Name(Py_TYPE(tmp)));
11874
0
                goto failed;
11875
0
            }
11876
0
            len = PyList_GET_SIZE(tmp);
11877
0
            type_params = _Py_asdl_type_param_seq_new(len, arena);
11878
0
            if (type_params == NULL) goto failed;
11879
0
            for (i = 0; i < len; i++) {
11880
0
                type_param_ty val;
11881
0
                PyObject *tmp2 = Py_NewRef(PyList_GET_ITEM(tmp, i));
11882
0
                if (_Py_EnterRecursiveCall(" while traversing 'ClassDef' node")) {
11883
0
                    goto failed;
11884
0
                }
11885
0
                res = obj2ast_type_param(state, tmp2, &val, arena);
11886
0
                _Py_LeaveRecursiveCall();
11887
0
                Py_DECREF(tmp2);
11888
0
                if (res != 0) goto failed;
11889
0
                if (len != PyList_GET_SIZE(tmp)) {
11890
0
                    PyErr_SetString(PyExc_RuntimeError, "ClassDef field \"type_params\" changed size during iteration");
11891
0
                    goto failed;
11892
0
                }
11893
0
                asdl_seq_SET(type_params, i, val);
11894
0
            }
11895
0
            Py_CLEAR(tmp);
11896
0
        }
11897
0
        *out = _PyAST_ClassDef(name, bases, keywords, body, decorator_list,
11898
0
                               type_params, lineno, col_offset, end_lineno,
11899
0
                               end_col_offset, arena);
11900
0
        if (*out == NULL) goto failed;
11901
0
        return 0;
11902
0
    }
11903
0
    tp = state->Return_type;
11904
0
    isinstance = PyObject_IsInstance(obj, tp);
11905
0
    if (isinstance == -1) {
11906
0
        return -1;
11907
0
    }
11908
0
    if (isinstance) {
11909
0
        expr_ty value;
11910
11911
0
        if (PyObject_GetOptionalAttr(obj, state->value, &tmp) < 0) {
11912
0
            return -1;
11913
0
        }
11914
0
        if (tmp == NULL || tmp == Py_None) {
11915
0
            Py_CLEAR(tmp);
11916
0
            value = NULL;
11917
0
        }
11918
0
        else {
11919
0
            int res;
11920
0
            if (_Py_EnterRecursiveCall(" while traversing 'Return' node")) {
11921
0
                goto failed;
11922
0
            }
11923
0
            res = obj2ast_expr(state, tmp, &value, arena);
11924
0
            _Py_LeaveRecursiveCall();
11925
0
            if (res != 0) goto failed;
11926
0
            Py_CLEAR(tmp);
11927
0
        }
11928
0
        *out = _PyAST_Return(value, lineno, col_offset, end_lineno,
11929
0
                             end_col_offset, arena);
11930
0
        if (*out == NULL) goto failed;
11931
0
        return 0;
11932
0
    }
11933
0
    tp = state->Delete_type;
11934
0
    isinstance = PyObject_IsInstance(obj, tp);
11935
0
    if (isinstance == -1) {
11936
0
        return -1;
11937
0
    }
11938
0
    if (isinstance) {
11939
0
        asdl_expr_seq* targets;
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, "Delete 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 'Delete' 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, "Delete 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
        *out = _PyAST_Delete(targets, lineno, col_offset, end_lineno,
11980
0
                             end_col_offset, arena);
11981
0
        if (*out == NULL) goto failed;
11982
0
        return 0;
11983
0
    }
11984
0
    tp = state->Assign_type;
11985
0
    isinstance = PyObject_IsInstance(obj, tp);
11986
0
    if (isinstance == -1) {
11987
0
        return -1;
11988
0
    }
11989
0
    if (isinstance) {
11990
0
        asdl_expr_seq* targets;
11991
0
        expr_ty value;
11992
0
        string type_comment;
11993
11994
0
        if (PyObject_GetOptionalAttr(obj, state->targets, &tmp) < 0) {
11995
0
            return -1;
11996
0
        }
11997
0
        if (tmp == NULL) {
11998
0
            tmp = PyList_New(0);
11999
0
            if (tmp == NULL) {
12000
0
                return -1;
12001
0
            }
12002
0
        }
12003
0
        {
12004
0
            int res;
12005
0
            Py_ssize_t len;
12006
0
            Py_ssize_t i;
12007
0
            if (!PyList_Check(tmp)) {
12008
0
                PyErr_Format(PyExc_TypeError, "Assign field \"targets\" must be a list, not a %.200s", _PyType_Name(Py_TYPE(tmp)));
12009
0
                goto failed;
12010
0
            }
12011
0
            len = PyList_GET_SIZE(tmp);
12012
0
            targets = _Py_asdl_expr_seq_new(len, arena);
12013
0
            if (targets == NULL) goto failed;
12014
0
            for (i = 0; i < len; i++) {
12015
0
                expr_ty val;
12016
0
                PyObject *tmp2 = Py_NewRef(PyList_GET_ITEM(tmp, i));
12017
0
                if (_Py_EnterRecursiveCall(" while traversing 'Assign' node")) {
12018
0
                    goto failed;
12019
0
                }
12020
0
                res = obj2ast_expr(state, tmp2, &val, arena);
12021
0
                _Py_LeaveRecursiveCall();
12022
0
                Py_DECREF(tmp2);
12023
0
                if (res != 0) goto failed;
12024
0
                if (len != PyList_GET_SIZE(tmp)) {
12025
0
                    PyErr_SetString(PyExc_RuntimeError, "Assign field \"targets\" changed size during iteration");
12026
0
                    goto failed;
12027
0
                }
12028
0
                asdl_seq_SET(targets, i, val);
12029
0
            }
12030
0
            Py_CLEAR(tmp);
12031
0
        }
12032
0
        if (PyObject_GetOptionalAttr(obj, state->value, &tmp) < 0) {
12033
0
            return -1;
12034
0
        }
12035
0
        if (tmp == NULL) {
12036
0
            PyErr_SetString(PyExc_TypeError, "required field \"value\" missing from Assign");
12037
0
            return -1;
12038
0
        }
12039
0
        else {
12040
0
            int res;
12041
0
            if (_Py_EnterRecursiveCall(" while traversing 'Assign' node")) {
12042
0
                goto failed;
12043
0
            }
12044
0
            res = obj2ast_expr(state, tmp, &value, arena);
12045
0
            _Py_LeaveRecursiveCall();
12046
0
            if (res != 0) goto failed;
12047
0
            Py_CLEAR(tmp);
12048
0
        }
12049
0
        if (PyObject_GetOptionalAttr(obj, state->type_comment, &tmp) < 0) {
12050
0
            return -1;
12051
0
        }
12052
0
        if (tmp == NULL || tmp == Py_None) {
12053
0
            Py_CLEAR(tmp);
12054
0
            type_comment = NULL;
12055
0
        }
12056
0
        else {
12057
0
            int res;
12058
0
            if (_Py_EnterRecursiveCall(" while traversing 'Assign' node")) {
12059
0
                goto failed;
12060
0
            }
12061
0
            res = obj2ast_string(state, tmp, &type_comment, arena);
12062
0
            _Py_LeaveRecursiveCall();
12063
0
            if (res != 0) goto failed;
12064
0
            Py_CLEAR(tmp);
12065
0
        }
12066
0
        *out = _PyAST_Assign(targets, value, type_comment, lineno, col_offset,
12067
0
                             end_lineno, end_col_offset, arena);
12068
0
        if (*out == NULL) goto failed;
12069
0
        return 0;
12070
0
    }
12071
0
    tp = state->TypeAlias_type;
12072
0
    isinstance = PyObject_IsInstance(obj, tp);
12073
0
    if (isinstance == -1) {
12074
0
        return -1;
12075
0
    }
12076
0
    if (isinstance) {
12077
0
        expr_ty name;
12078
0
        asdl_type_param_seq* type_params;
12079
0
        expr_ty value;
12080
12081
0
        if (PyObject_GetOptionalAttr(obj, state->name, &tmp) < 0) {
12082
0
            return -1;
12083
0
        }
12084
0
        if (tmp == NULL) {
12085
0
            PyErr_SetString(PyExc_TypeError, "required field \"name\" missing from TypeAlias");
12086
0
            return -1;
12087
0
        }
12088
0
        else {
12089
0
            int res;
12090
0
            if (_Py_EnterRecursiveCall(" while traversing 'TypeAlias' node")) {
12091
0
                goto failed;
12092
0
            }
12093
0
            res = obj2ast_expr(state, tmp, &name, arena);
12094
0
            _Py_LeaveRecursiveCall();
12095
0
            if (res != 0) goto failed;
12096
0
            Py_CLEAR(tmp);
12097
0
        }
12098
0
        if (PyObject_GetOptionalAttr(obj, state->type_params, &tmp) < 0) {
12099
0
            return -1;
12100
0
        }
12101
0
        if (tmp == NULL) {
12102
0
            tmp = PyList_New(0);
12103
0
            if (tmp == NULL) {
12104
0
                return -1;
12105
0
            }
12106
0
        }
12107
0
        {
12108
0
            int res;
12109
0
            Py_ssize_t len;
12110
0
            Py_ssize_t i;
12111
0
            if (!PyList_Check(tmp)) {
12112
0
                PyErr_Format(PyExc_TypeError, "TypeAlias field \"type_params\" must be a list, not a %.200s", _PyType_Name(Py_TYPE(tmp)));
12113
0
                goto failed;
12114
0
            }
12115
0
            len = PyList_GET_SIZE(tmp);
12116
0
            type_params = _Py_asdl_type_param_seq_new(len, arena);
12117
0
            if (type_params == NULL) goto failed;
12118
0
            for (i = 0; i < len; i++) {
12119
0
                type_param_ty val;
12120
0
                PyObject *tmp2 = Py_NewRef(PyList_GET_ITEM(tmp, i));
12121
0
                if (_Py_EnterRecursiveCall(" while traversing 'TypeAlias' node")) {
12122
0
                    goto failed;
12123
0
                }
12124
0
                res = obj2ast_type_param(state, tmp2, &val, arena);
12125
0
                _Py_LeaveRecursiveCall();
12126
0
                Py_DECREF(tmp2);
12127
0
                if (res != 0) goto failed;
12128
0
                if (len != PyList_GET_SIZE(tmp)) {
12129
0
                    PyErr_SetString(PyExc_RuntimeError, "TypeAlias field \"type_params\" changed size during iteration");
12130
0
                    goto failed;
12131
0
                }
12132
0
                asdl_seq_SET(type_params, i, val);
12133
0
            }
12134
0
            Py_CLEAR(tmp);
12135
0
        }
12136
0
        if (PyObject_GetOptionalAttr(obj, state->value, &tmp) < 0) {
12137
0
            return -1;
12138
0
        }
12139
0
        if (tmp == NULL) {
12140
0
            PyErr_SetString(PyExc_TypeError, "required field \"value\" missing from TypeAlias");
12141
0
            return -1;
12142
0
        }
12143
0
        else {
12144
0
            int res;
12145
0
            if (_Py_EnterRecursiveCall(" while traversing 'TypeAlias' node")) {
12146
0
                goto failed;
12147
0
            }
12148
0
            res = obj2ast_expr(state, tmp, &value, arena);
12149
0
            _Py_LeaveRecursiveCall();
12150
0
            if (res != 0) goto failed;
12151
0
            Py_CLEAR(tmp);
12152
0
        }
12153
0
        *out = _PyAST_TypeAlias(name, type_params, value, lineno, col_offset,
12154
0
                                end_lineno, end_col_offset, arena);
12155
0
        if (*out == NULL) goto failed;
12156
0
        return 0;
12157
0
    }
12158
0
    tp = state->AugAssign_type;
12159
0
    isinstance = PyObject_IsInstance(obj, tp);
12160
0
    if (isinstance == -1) {
12161
0
        return -1;
12162
0
    }
12163
0
    if (isinstance) {
12164
0
        expr_ty target;
12165
0
        operator_ty op;
12166
0
        expr_ty value;
12167
12168
0
        if (PyObject_GetOptionalAttr(obj, state->target, &tmp) < 0) {
12169
0
            return -1;
12170
0
        }
12171
0
        if (tmp == NULL) {
12172
0
            PyErr_SetString(PyExc_TypeError, "required field \"target\" missing from AugAssign");
12173
0
            return -1;
12174
0
        }
12175
0
        else {
12176
0
            int res;
12177
0
            if (_Py_EnterRecursiveCall(" while traversing 'AugAssign' node")) {
12178
0
                goto failed;
12179
0
            }
12180
0
            res = obj2ast_expr(state, tmp, &target, arena);
12181
0
            _Py_LeaveRecursiveCall();
12182
0
            if (res != 0) goto failed;
12183
0
            Py_CLEAR(tmp);
12184
0
        }
12185
0
        if (PyObject_GetOptionalAttr(obj, state->op, &tmp) < 0) {
12186
0
            return -1;
12187
0
        }
12188
0
        if (tmp == NULL) {
12189
0
            PyErr_SetString(PyExc_TypeError, "required field \"op\" missing from AugAssign");
12190
0
            return -1;
12191
0
        }
12192
0
        else {
12193
0
            int res;
12194
0
            if (_Py_EnterRecursiveCall(" while traversing 'AugAssign' node")) {
12195
0
                goto failed;
12196
0
            }
12197
0
            res = obj2ast_operator(state, tmp, &op, arena);
12198
0
            _Py_LeaveRecursiveCall();
12199
0
            if (res != 0) goto failed;
12200
0
            Py_CLEAR(tmp);
12201
0
        }
12202
0
        if (PyObject_GetOptionalAttr(obj, state->value, &tmp) < 0) {
12203
0
            return -1;
12204
0
        }
12205
0
        if (tmp == NULL) {
12206
0
            PyErr_SetString(PyExc_TypeError, "required field \"value\" missing from AugAssign");
12207
0
            return -1;
12208
0
        }
12209
0
        else {
12210
0
            int res;
12211
0
            if (_Py_EnterRecursiveCall(" while traversing 'AugAssign' node")) {
12212
0
                goto failed;
12213
0
            }
12214
0
            res = obj2ast_expr(state, tmp, &value, arena);
12215
0
            _Py_LeaveRecursiveCall();
12216
0
            if (res != 0) goto failed;
12217
0
            Py_CLEAR(tmp);
12218
0
        }
12219
0
        *out = _PyAST_AugAssign(target, op, value, lineno, col_offset,
12220
0
                                end_lineno, end_col_offset, arena);
12221
0
        if (*out == NULL) goto failed;
12222
0
        return 0;
12223
0
    }
12224
0
    tp = state->AnnAssign_type;
12225
0
    isinstance = PyObject_IsInstance(obj, tp);
12226
0
    if (isinstance == -1) {
12227
0
        return -1;
12228
0
    }
12229
0
    if (isinstance) {
12230
0
        expr_ty target;
12231
0
        expr_ty annotation;
12232
0
        expr_ty value;
12233
0
        int simple;
12234
12235
0
        if (PyObject_GetOptionalAttr(obj, state->target, &tmp) < 0) {
12236
0
            return -1;
12237
0
        }
12238
0
        if (tmp == NULL) {
12239
0
            PyErr_SetString(PyExc_TypeError, "required field \"target\" missing from AnnAssign");
12240
0
            return -1;
12241
0
        }
12242
0
        else {
12243
0
            int res;
12244
0
            if (_Py_EnterRecursiveCall(" while traversing 'AnnAssign' node")) {
12245
0
                goto failed;
12246
0
            }
12247
0
            res = obj2ast_expr(state, tmp, &target, arena);
12248
0
            _Py_LeaveRecursiveCall();
12249
0
            if (res != 0) goto failed;
12250
0
            Py_CLEAR(tmp);
12251
0
        }
12252
0
        if (PyObject_GetOptionalAttr(obj, state->annotation, &tmp) < 0) {
12253
0
            return -1;
12254
0
        }
12255
0
        if (tmp == NULL) {
12256
0
            PyErr_SetString(PyExc_TypeError, "required field \"annotation\" missing from AnnAssign");
12257
0
            return -1;
12258
0
        }
12259
0
        else {
12260
0
            int res;
12261
0
            if (_Py_EnterRecursiveCall(" while traversing 'AnnAssign' node")) {
12262
0
                goto failed;
12263
0
            }
12264
0
            res = obj2ast_expr(state, tmp, &annotation, arena);
12265
0
            _Py_LeaveRecursiveCall();
12266
0
            if (res != 0) goto failed;
12267
0
            Py_CLEAR(tmp);
12268
0
        }
12269
0
        if (PyObject_GetOptionalAttr(obj, state->value, &tmp) < 0) {
12270
0
            return -1;
12271
0
        }
12272
0
        if (tmp == NULL || tmp == Py_None) {
12273
0
            Py_CLEAR(tmp);
12274
0
            value = NULL;
12275
0
        }
12276
0
        else {
12277
0
            int res;
12278
0
            if (_Py_EnterRecursiveCall(" while traversing 'AnnAssign' node")) {
12279
0
                goto failed;
12280
0
            }
12281
0
            res = obj2ast_expr(state, tmp, &value, arena);
12282
0
            _Py_LeaveRecursiveCall();
12283
0
            if (res != 0) goto failed;
12284
0
            Py_CLEAR(tmp);
12285
0
        }
12286
0
        if (PyObject_GetOptionalAttr(obj, state->simple, &tmp) < 0) {
12287
0
            return -1;
12288
0
        }
12289
0
        if (tmp == NULL) {
12290
0
            PyErr_SetString(PyExc_TypeError, "required field \"simple\" missing from AnnAssign");
12291
0
            return -1;
12292
0
        }
12293
0
        else {
12294
0
            int res;
12295
0
            if (_Py_EnterRecursiveCall(" while traversing 'AnnAssign' node")) {
12296
0
                goto failed;
12297
0
            }
12298
0
            res = obj2ast_int(state, tmp, &simple, arena);
12299
0
            _Py_LeaveRecursiveCall();
12300
0
            if (res != 0) goto failed;
12301
0
            Py_CLEAR(tmp);
12302
0
        }
12303
0
        *out = _PyAST_AnnAssign(target, annotation, value, simple, lineno,
12304
0
                                col_offset, end_lineno, end_col_offset, arena);
12305
0
        if (*out == NULL) goto failed;
12306
0
        return 0;
12307
0
    }
12308
0
    tp = state->For_type;
12309
0
    isinstance = PyObject_IsInstance(obj, tp);
12310
0
    if (isinstance == -1) {
12311
0
        return -1;
12312
0
    }
12313
0
    if (isinstance) {
12314
0
        expr_ty target;
12315
0
        expr_ty iter;
12316
0
        asdl_stmt_seq* body;
12317
0
        asdl_stmt_seq* orelse;
12318
0
        string type_comment;
12319
12320
0
        if (PyObject_GetOptionalAttr(obj, state->target, &tmp) < 0) {
12321
0
            return -1;
12322
0
        }
12323
0
        if (tmp == NULL) {
12324
0
            PyErr_SetString(PyExc_TypeError, "required field \"target\" missing from For");
12325
0
            return -1;
12326
0
        }
12327
0
        else {
12328
0
            int res;
12329
0
            if (_Py_EnterRecursiveCall(" while traversing 'For' node")) {
12330
0
                goto failed;
12331
0
            }
12332
0
            res = obj2ast_expr(state, tmp, &target, arena);
12333
0
            _Py_LeaveRecursiveCall();
12334
0
            if (res != 0) goto failed;
12335
0
            Py_CLEAR(tmp);
12336
0
        }
12337
0
        if (PyObject_GetOptionalAttr(obj, state->iter, &tmp) < 0) {
12338
0
            return -1;
12339
0
        }
12340
0
        if (tmp == NULL) {
12341
0
            PyErr_SetString(PyExc_TypeError, "required field \"iter\" missing from For");
12342
0
            return -1;
12343
0
        }
12344
0
        else {
12345
0
            int res;
12346
0
            if (_Py_EnterRecursiveCall(" while traversing 'For' node")) {
12347
0
                goto failed;
12348
0
            }
12349
0
            res = obj2ast_expr(state, tmp, &iter, arena);
12350
0
            _Py_LeaveRecursiveCall();
12351
0
            if (res != 0) goto failed;
12352
0
            Py_CLEAR(tmp);
12353
0
        }
12354
0
        if (PyObject_GetOptionalAttr(obj, state->body, &tmp) < 0) {
12355
0
            return -1;
12356
0
        }
12357
0
        if (tmp == NULL) {
12358
0
            tmp = PyList_New(0);
12359
0
            if (tmp == NULL) {
12360
0
                return -1;
12361
0
            }
12362
0
        }
12363
0
        {
12364
0
            int res;
12365
0
            Py_ssize_t len;
12366
0
            Py_ssize_t i;
12367
0
            if (!PyList_Check(tmp)) {
12368
0
                PyErr_Format(PyExc_TypeError, "For field \"body\" must be a list, not a %.200s", _PyType_Name(Py_TYPE(tmp)));
12369
0
                goto failed;
12370
0
            }
12371
0
            len = PyList_GET_SIZE(tmp);
12372
0
            body = _Py_asdl_stmt_seq_new(len, arena);
12373
0
            if (body == NULL) goto failed;
12374
0
            for (i = 0; i < len; i++) {
12375
0
                stmt_ty val;
12376
0
                PyObject *tmp2 = Py_NewRef(PyList_GET_ITEM(tmp, i));
12377
0
                if (_Py_EnterRecursiveCall(" while traversing 'For' node")) {
12378
0
                    goto failed;
12379
0
                }
12380
0
                res = obj2ast_stmt(state, tmp2, &val, arena);
12381
0
                _Py_LeaveRecursiveCall();
12382
0
                Py_DECREF(tmp2);
12383
0
                if (res != 0) goto failed;
12384
0
                if (len != PyList_GET_SIZE(tmp)) {
12385
0
                    PyErr_SetString(PyExc_RuntimeError, "For field \"body\" changed size during iteration");
12386
0
                    goto failed;
12387
0
                }
12388
0
                asdl_seq_SET(body, i, val);
12389
0
            }
12390
0
            Py_CLEAR(tmp);
12391
0
        }
12392
0
        if (PyObject_GetOptionalAttr(obj, state->orelse, &tmp) < 0) {
12393
0
            return -1;
12394
0
        }
12395
0
        if (tmp == NULL) {
12396
0
            tmp = PyList_New(0);
12397
0
            if (tmp == NULL) {
12398
0
                return -1;
12399
0
            }
12400
0
        }
12401
0
        {
12402
0
            int res;
12403
0
            Py_ssize_t len;
12404
0
            Py_ssize_t i;
12405
0
            if (!PyList_Check(tmp)) {
12406
0
                PyErr_Format(PyExc_TypeError, "For field \"orelse\" must be a list, not a %.200s", _PyType_Name(Py_TYPE(tmp)));
12407
0
                goto failed;
12408
0
            }
12409
0
            len = PyList_GET_SIZE(tmp);
12410
0
            orelse = _Py_asdl_stmt_seq_new(len, arena);
12411
0
            if (orelse == NULL) goto failed;
12412
0
            for (i = 0; i < len; i++) {
12413
0
                stmt_ty val;
12414
0
                PyObject *tmp2 = Py_NewRef(PyList_GET_ITEM(tmp, i));
12415
0
                if (_Py_EnterRecursiveCall(" while traversing 'For' node")) {
12416
0
                    goto failed;
12417
0
                }
12418
0
                res = obj2ast_stmt(state, tmp2, &val, arena);
12419
0
                _Py_LeaveRecursiveCall();
12420
0
                Py_DECREF(tmp2);
12421
0
                if (res != 0) goto failed;
12422
0
                if (len != PyList_GET_SIZE(tmp)) {
12423
0
                    PyErr_SetString(PyExc_RuntimeError, "For field \"orelse\" changed size during iteration");
12424
0
                    goto failed;
12425
0
                }
12426
0
                asdl_seq_SET(orelse, i, val);
12427
0
            }
12428
0
            Py_CLEAR(tmp);
12429
0
        }
12430
0
        if (PyObject_GetOptionalAttr(obj, state->type_comment, &tmp) < 0) {
12431
0
            return -1;
12432
0
        }
12433
0
        if (tmp == NULL || tmp == Py_None) {
12434
0
            Py_CLEAR(tmp);
12435
0
            type_comment = NULL;
12436
0
        }
12437
0
        else {
12438
0
            int res;
12439
0
            if (_Py_EnterRecursiveCall(" while traversing 'For' node")) {
12440
0
                goto failed;
12441
0
            }
12442
0
            res = obj2ast_string(state, tmp, &type_comment, arena);
12443
0
            _Py_LeaveRecursiveCall();
12444
0
            if (res != 0) goto failed;
12445
0
            Py_CLEAR(tmp);
12446
0
        }
12447
0
        *out = _PyAST_For(target, iter, body, orelse, type_comment, lineno,
12448
0
                          col_offset, end_lineno, end_col_offset, arena);
12449
0
        if (*out == NULL) goto failed;
12450
0
        return 0;
12451
0
    }
12452
0
    tp = state->AsyncFor_type;
12453
0
    isinstance = PyObject_IsInstance(obj, tp);
12454
0
    if (isinstance == -1) {
12455
0
        return -1;
12456
0
    }
12457
0
    if (isinstance) {
12458
0
        expr_ty target;
12459
0
        expr_ty iter;
12460
0
        asdl_stmt_seq* body;
12461
0
        asdl_stmt_seq* orelse;
12462
0
        string type_comment;
12463
12464
0
        if (PyObject_GetOptionalAttr(obj, state->target, &tmp) < 0) {
12465
0
            return -1;
12466
0
        }
12467
0
        if (tmp == NULL) {
12468
0
            PyErr_SetString(PyExc_TypeError, "required field \"target\" missing from AsyncFor");
12469
0
            return -1;
12470
0
        }
12471
0
        else {
12472
0
            int res;
12473
0
            if (_Py_EnterRecursiveCall(" while traversing 'AsyncFor' node")) {
12474
0
                goto failed;
12475
0
            }
12476
0
            res = obj2ast_expr(state, tmp, &target, arena);
12477
0
            _Py_LeaveRecursiveCall();
12478
0
            if (res != 0) goto failed;
12479
0
            Py_CLEAR(tmp);
12480
0
        }
12481
0
        if (PyObject_GetOptionalAttr(obj, state->iter, &tmp) < 0) {
12482
0
            return -1;
12483
0
        }
12484
0
        if (tmp == NULL) {
12485
0
            PyErr_SetString(PyExc_TypeError, "required field \"iter\" missing from AsyncFor");
12486
0
            return -1;
12487
0
        }
12488
0
        else {
12489
0
            int res;
12490
0
            if (_Py_EnterRecursiveCall(" while traversing 'AsyncFor' node")) {
12491
0
                goto failed;
12492
0
            }
12493
0
            res = obj2ast_expr(state, tmp, &iter, arena);
12494
0
            _Py_LeaveRecursiveCall();
12495
0
            if (res != 0) goto failed;
12496
0
            Py_CLEAR(tmp);
12497
0
        }
12498
0
        if (PyObject_GetOptionalAttr(obj, state->body, &tmp) < 0) {
12499
0
            return -1;
12500
0
        }
12501
0
        if (tmp == NULL) {
12502
0
            tmp = PyList_New(0);
12503
0
            if (tmp == NULL) {
12504
0
                return -1;
12505
0
            }
12506
0
        }
12507
0
        {
12508
0
            int res;
12509
0
            Py_ssize_t len;
12510
0
            Py_ssize_t i;
12511
0
            if (!PyList_Check(tmp)) {
12512
0
                PyErr_Format(PyExc_TypeError, "AsyncFor field \"body\" must be a list, not a %.200s", _PyType_Name(Py_TYPE(tmp)));
12513
0
                goto failed;
12514
0
            }
12515
0
            len = PyList_GET_SIZE(tmp);
12516
0
            body = _Py_asdl_stmt_seq_new(len, arena);
12517
0
            if (body == NULL) goto failed;
12518
0
            for (i = 0; i < len; i++) {
12519
0
                stmt_ty val;
12520
0
                PyObject *tmp2 = Py_NewRef(PyList_GET_ITEM(tmp, i));
12521
0
                if (_Py_EnterRecursiveCall(" while traversing 'AsyncFor' node")) {
12522
0
                    goto failed;
12523
0
                }
12524
0
                res = obj2ast_stmt(state, tmp2, &val, arena);
12525
0
                _Py_LeaveRecursiveCall();
12526
0
                Py_DECREF(tmp2);
12527
0
                if (res != 0) goto failed;
12528
0
                if (len != PyList_GET_SIZE(tmp)) {
12529
0
                    PyErr_SetString(PyExc_RuntimeError, "AsyncFor field \"body\" changed size during iteration");
12530
0
                    goto failed;
12531
0
                }
12532
0
                asdl_seq_SET(body, i, val);
12533
0
            }
12534
0
            Py_CLEAR(tmp);
12535
0
        }
12536
0
        if (PyObject_GetOptionalAttr(obj, state->orelse, &tmp) < 0) {
12537
0
            return -1;
12538
0
        }
12539
0
        if (tmp == NULL) {
12540
0
            tmp = PyList_New(0);
12541
0
            if (tmp == NULL) {
12542
0
                return -1;
12543
0
            }
12544
0
        }
12545
0
        {
12546
0
            int res;
12547
0
            Py_ssize_t len;
12548
0
            Py_ssize_t i;
12549
0
            if (!PyList_Check(tmp)) {
12550
0
                PyErr_Format(PyExc_TypeError, "AsyncFor field \"orelse\" must be a list, not a %.200s", _PyType_Name(Py_TYPE(tmp)));
12551
0
                goto failed;
12552
0
            }
12553
0
            len = PyList_GET_SIZE(tmp);
12554
0
            orelse = _Py_asdl_stmt_seq_new(len, arena);
12555
0
            if (orelse == NULL) goto failed;
12556
0
            for (i = 0; i < len; i++) {
12557
0
                stmt_ty val;
12558
0
                PyObject *tmp2 = Py_NewRef(PyList_GET_ITEM(tmp, i));
12559
0
                if (_Py_EnterRecursiveCall(" while traversing 'AsyncFor' node")) {
12560
0
                    goto failed;
12561
0
                }
12562
0
                res = obj2ast_stmt(state, tmp2, &val, arena);
12563
0
                _Py_LeaveRecursiveCall();
12564
0
                Py_DECREF(tmp2);
12565
0
                if (res != 0) goto failed;
12566
0
                if (len != PyList_GET_SIZE(tmp)) {
12567
0
                    PyErr_SetString(PyExc_RuntimeError, "AsyncFor field \"orelse\" changed size during iteration");
12568
0
                    goto failed;
12569
0
                }
12570
0
                asdl_seq_SET(orelse, i, val);
12571
0
            }
12572
0
            Py_CLEAR(tmp);
12573
0
        }
12574
0
        if (PyObject_GetOptionalAttr(obj, state->type_comment, &tmp) < 0) {
12575
0
            return -1;
12576
0
        }
12577
0
        if (tmp == NULL || tmp == Py_None) {
12578
0
            Py_CLEAR(tmp);
12579
0
            type_comment = NULL;
12580
0
        }
12581
0
        else {
12582
0
            int res;
12583
0
            if (_Py_EnterRecursiveCall(" while traversing 'AsyncFor' node")) {
12584
0
                goto failed;
12585
0
            }
12586
0
            res = obj2ast_string(state, tmp, &type_comment, arena);
12587
0
            _Py_LeaveRecursiveCall();
12588
0
            if (res != 0) goto failed;
12589
0
            Py_CLEAR(tmp);
12590
0
        }
12591
0
        *out = _PyAST_AsyncFor(target, iter, body, orelse, type_comment,
12592
0
                               lineno, col_offset, end_lineno, end_col_offset,
12593
0
                               arena);
12594
0
        if (*out == NULL) goto failed;
12595
0
        return 0;
12596
0
    }
12597
0
    tp = state->While_type;
12598
0
    isinstance = PyObject_IsInstance(obj, tp);
12599
0
    if (isinstance == -1) {
12600
0
        return -1;
12601
0
    }
12602
0
    if (isinstance) {
12603
0
        expr_ty test;
12604
0
        asdl_stmt_seq* body;
12605
0
        asdl_stmt_seq* orelse;
12606
12607
0
        if (PyObject_GetOptionalAttr(obj, state->test, &tmp) < 0) {
12608
0
            return -1;
12609
0
        }
12610
0
        if (tmp == NULL) {
12611
0
            PyErr_SetString(PyExc_TypeError, "required field \"test\" missing from While");
12612
0
            return -1;
12613
0
        }
12614
0
        else {
12615
0
            int res;
12616
0
            if (_Py_EnterRecursiveCall(" while traversing 'While' node")) {
12617
0
                goto failed;
12618
0
            }
12619
0
            res = obj2ast_expr(state, tmp, &test, arena);
12620
0
            _Py_LeaveRecursiveCall();
12621
0
            if (res != 0) goto failed;
12622
0
            Py_CLEAR(tmp);
12623
0
        }
12624
0
        if (PyObject_GetOptionalAttr(obj, state->body, &tmp) < 0) {
12625
0
            return -1;
12626
0
        }
12627
0
        if (tmp == NULL) {
12628
0
            tmp = PyList_New(0);
12629
0
            if (tmp == NULL) {
12630
0
                return -1;
12631
0
            }
12632
0
        }
12633
0
        {
12634
0
            int res;
12635
0
            Py_ssize_t len;
12636
0
            Py_ssize_t i;
12637
0
            if (!PyList_Check(tmp)) {
12638
0
                PyErr_Format(PyExc_TypeError, "While field \"body\" must be a list, not a %.200s", _PyType_Name(Py_TYPE(tmp)));
12639
0
                goto failed;
12640
0
            }
12641
0
            len = PyList_GET_SIZE(tmp);
12642
0
            body = _Py_asdl_stmt_seq_new(len, arena);
12643
0
            if (body == NULL) goto failed;
12644
0
            for (i = 0; i < len; i++) {
12645
0
                stmt_ty val;
12646
0
                PyObject *tmp2 = Py_NewRef(PyList_GET_ITEM(tmp, i));
12647
0
                if (_Py_EnterRecursiveCall(" while traversing 'While' node")) {
12648
0
                    goto failed;
12649
0
                }
12650
0
                res = obj2ast_stmt(state, tmp2, &val, arena);
12651
0
                _Py_LeaveRecursiveCall();
12652
0
                Py_DECREF(tmp2);
12653
0
                if (res != 0) goto failed;
12654
0
                if (len != PyList_GET_SIZE(tmp)) {
12655
0
                    PyErr_SetString(PyExc_RuntimeError, "While field \"body\" changed size during iteration");
12656
0
                    goto failed;
12657
0
                }
12658
0
                asdl_seq_SET(body, i, val);
12659
0
            }
12660
0
            Py_CLEAR(tmp);
12661
0
        }
12662
0
        if (PyObject_GetOptionalAttr(obj, state->orelse, &tmp) < 0) {
12663
0
            return -1;
12664
0
        }
12665
0
        if (tmp == NULL) {
12666
0
            tmp = PyList_New(0);
12667
0
            if (tmp == NULL) {
12668
0
                return -1;
12669
0
            }
12670
0
        }
12671
0
        {
12672
0
            int res;
12673
0
            Py_ssize_t len;
12674
0
            Py_ssize_t i;
12675
0
            if (!PyList_Check(tmp)) {
12676
0
                PyErr_Format(PyExc_TypeError, "While field \"orelse\" must be a list, not a %.200s", _PyType_Name(Py_TYPE(tmp)));
12677
0
                goto failed;
12678
0
            }
12679
0
            len = PyList_GET_SIZE(tmp);
12680
0
            orelse = _Py_asdl_stmt_seq_new(len, arena);
12681
0
            if (orelse == NULL) goto failed;
12682
0
            for (i = 0; i < len; i++) {
12683
0
                stmt_ty val;
12684
0
                PyObject *tmp2 = Py_NewRef(PyList_GET_ITEM(tmp, i));
12685
0
                if (_Py_EnterRecursiveCall(" while traversing 'While' node")) {
12686
0
                    goto failed;
12687
0
                }
12688
0
                res = obj2ast_stmt(state, tmp2, &val, arena);
12689
0
                _Py_LeaveRecursiveCall();
12690
0
                Py_DECREF(tmp2);
12691
0
                if (res != 0) goto failed;
12692
0
                if (len != PyList_GET_SIZE(tmp)) {
12693
0
                    PyErr_SetString(PyExc_RuntimeError, "While field \"orelse\" changed size during iteration");
12694
0
                    goto failed;
12695
0
                }
12696
0
                asdl_seq_SET(orelse, i, val);
12697
0
            }
12698
0
            Py_CLEAR(tmp);
12699
0
        }
12700
0
        *out = _PyAST_While(test, body, orelse, lineno, col_offset, end_lineno,
12701
0
                            end_col_offset, arena);
12702
0
        if (*out == NULL) goto failed;
12703
0
        return 0;
12704
0
    }
12705
0
    tp = state->If_type;
12706
0
    isinstance = PyObject_IsInstance(obj, tp);
12707
0
    if (isinstance == -1) {
12708
0
        return -1;
12709
0
    }
12710
0
    if (isinstance) {
12711
0
        expr_ty test;
12712
0
        asdl_stmt_seq* body;
12713
0
        asdl_stmt_seq* orelse;
12714
12715
0
        if (PyObject_GetOptionalAttr(obj, state->test, &tmp) < 0) {
12716
0
            return -1;
12717
0
        }
12718
0
        if (tmp == NULL) {
12719
0
            PyErr_SetString(PyExc_TypeError, "required field \"test\" missing from If");
12720
0
            return -1;
12721
0
        }
12722
0
        else {
12723
0
            int res;
12724
0
            if (_Py_EnterRecursiveCall(" while traversing 'If' node")) {
12725
0
                goto failed;
12726
0
            }
12727
0
            res = obj2ast_expr(state, tmp, &test, arena);
12728
0
            _Py_LeaveRecursiveCall();
12729
0
            if (res != 0) goto failed;
12730
0
            Py_CLEAR(tmp);
12731
0
        }
12732
0
        if (PyObject_GetOptionalAttr(obj, state->body, &tmp) < 0) {
12733
0
            return -1;
12734
0
        }
12735
0
        if (tmp == NULL) {
12736
0
            tmp = PyList_New(0);
12737
0
            if (tmp == NULL) {
12738
0
                return -1;
12739
0
            }
12740
0
        }
12741
0
        {
12742
0
            int res;
12743
0
            Py_ssize_t len;
12744
0
            Py_ssize_t i;
12745
0
            if (!PyList_Check(tmp)) {
12746
0
                PyErr_Format(PyExc_TypeError, "If field \"body\" must be a list, not a %.200s", _PyType_Name(Py_TYPE(tmp)));
12747
0
                goto failed;
12748
0
            }
12749
0
            len = PyList_GET_SIZE(tmp);
12750
0
            body = _Py_asdl_stmt_seq_new(len, arena);
12751
0
            if (body == NULL) goto failed;
12752
0
            for (i = 0; i < len; i++) {
12753
0
                stmt_ty val;
12754
0
                PyObject *tmp2 = Py_NewRef(PyList_GET_ITEM(tmp, i));
12755
0
                if (_Py_EnterRecursiveCall(" while traversing 'If' node")) {
12756
0
                    goto failed;
12757
0
                }
12758
0
                res = obj2ast_stmt(state, tmp2, &val, arena);
12759
0
                _Py_LeaveRecursiveCall();
12760
0
                Py_DECREF(tmp2);
12761
0
                if (res != 0) goto failed;
12762
0
                if (len != PyList_GET_SIZE(tmp)) {
12763
0
                    PyErr_SetString(PyExc_RuntimeError, "If field \"body\" changed size during iteration");
12764
0
                    goto failed;
12765
0
                }
12766
0
                asdl_seq_SET(body, i, val);
12767
0
            }
12768
0
            Py_CLEAR(tmp);
12769
0
        }
12770
0
        if (PyObject_GetOptionalAttr(obj, state->orelse, &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, "If field \"orelse\" 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
            orelse = _Py_asdl_stmt_seq_new(len, arena);
12789
0
            if (orelse == NULL) goto failed;
12790
0
            for (i = 0; i < len; i++) {
12791
0
                stmt_ty val;
12792
0
                PyObject *tmp2 = Py_NewRef(PyList_GET_ITEM(tmp, i));
12793
0
                if (_Py_EnterRecursiveCall(" while traversing 'If' node")) {
12794
0
                    goto failed;
12795
0
                }
12796
0
                res = obj2ast_stmt(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, "If field \"orelse\" changed size during iteration");
12802
0
                    goto failed;
12803
0
                }
12804
0
                asdl_seq_SET(orelse, i, val);
12805
0
            }
12806
0
            Py_CLEAR(tmp);
12807
0
        }
12808
0
        *out = _PyAST_If(test, body, orelse, lineno, col_offset, end_lineno,
12809
0
                         end_col_offset, arena);
12810
0
        if (*out == NULL) goto failed;
12811
0
        return 0;
12812
0
    }
12813
0
    tp = state->With_type;
12814
0
    isinstance = PyObject_IsInstance(obj, tp);
12815
0
    if (isinstance == -1) {
12816
0
        return -1;
12817
0
    }
12818
0
    if (isinstance) {
12819
0
        asdl_withitem_seq* items;
12820
0
        asdl_stmt_seq* body;
12821
0
        string type_comment;
12822
12823
0
        if (PyObject_GetOptionalAttr(obj, state->items, &tmp) < 0) {
12824
0
            return -1;
12825
0
        }
12826
0
        if (tmp == NULL) {
12827
0
            tmp = PyList_New(0);
12828
0
            if (tmp == NULL) {
12829
0
                return -1;
12830
0
            }
12831
0
        }
12832
0
        {
12833
0
            int res;
12834
0
            Py_ssize_t len;
12835
0
            Py_ssize_t i;
12836
0
            if (!PyList_Check(tmp)) {
12837
0
                PyErr_Format(PyExc_TypeError, "With field \"items\" must be a list, not a %.200s", _PyType_Name(Py_TYPE(tmp)));
12838
0
                goto failed;
12839
0
            }
12840
0
            len = PyList_GET_SIZE(tmp);
12841
0
            items = _Py_asdl_withitem_seq_new(len, arena);
12842
0
            if (items == NULL) goto failed;
12843
0
            for (i = 0; i < len; i++) {
12844
0
                withitem_ty val;
12845
0
                PyObject *tmp2 = Py_NewRef(PyList_GET_ITEM(tmp, i));
12846
0
                if (_Py_EnterRecursiveCall(" while traversing 'With' node")) {
12847
0
                    goto failed;
12848
0
                }
12849
0
                res = obj2ast_withitem(state, tmp2, &val, arena);
12850
0
                _Py_LeaveRecursiveCall();
12851
0
                Py_DECREF(tmp2);
12852
0
                if (res != 0) goto failed;
12853
0
                if (len != PyList_GET_SIZE(tmp)) {
12854
0
                    PyErr_SetString(PyExc_RuntimeError, "With field \"items\" changed size during iteration");
12855
0
                    goto failed;
12856
0
                }
12857
0
                asdl_seq_SET(items, i, val);
12858
0
            }
12859
0
            Py_CLEAR(tmp);
12860
0
        }
12861
0
        if (PyObject_GetOptionalAttr(obj, state->body, &tmp) < 0) {
12862
0
            return -1;
12863
0
        }
12864
0
        if (tmp == NULL) {
12865
0
            tmp = PyList_New(0);
12866
0
            if (tmp == NULL) {
12867
0
                return -1;
12868
0
            }
12869
0
        }
12870
0
        {
12871
0
            int res;
12872
0
            Py_ssize_t len;
12873
0
            Py_ssize_t i;
12874
0
            if (!PyList_Check(tmp)) {
12875
0
                PyErr_Format(PyExc_TypeError, "With field \"body\" must be a list, not a %.200s", _PyType_Name(Py_TYPE(tmp)));
12876
0
                goto failed;
12877
0
            }
12878
0
            len = PyList_GET_SIZE(tmp);
12879
0
            body = _Py_asdl_stmt_seq_new(len, arena);
12880
0
            if (body == NULL) goto failed;
12881
0
            for (i = 0; i < len; i++) {
12882
0
                stmt_ty val;
12883
0
                PyObject *tmp2 = Py_NewRef(PyList_GET_ITEM(tmp, i));
12884
0
                if (_Py_EnterRecursiveCall(" while traversing 'With' node")) {
12885
0
                    goto failed;
12886
0
                }
12887
0
                res = obj2ast_stmt(state, tmp2, &val, arena);
12888
0
                _Py_LeaveRecursiveCall();
12889
0
                Py_DECREF(tmp2);
12890
0
                if (res != 0) goto failed;
12891
0
                if (len != PyList_GET_SIZE(tmp)) {
12892
0
                    PyErr_SetString(PyExc_RuntimeError, "With field \"body\" changed size during iteration");
12893
0
                    goto failed;
12894
0
                }
12895
0
                asdl_seq_SET(body, i, val);
12896
0
            }
12897
0
            Py_CLEAR(tmp);
12898
0
        }
12899
0
        if (PyObject_GetOptionalAttr(obj, state->type_comment, &tmp) < 0) {
12900
0
            return -1;
12901
0
        }
12902
0
        if (tmp == NULL || tmp == Py_None) {
12903
0
            Py_CLEAR(tmp);
12904
0
            type_comment = NULL;
12905
0
        }
12906
0
        else {
12907
0
            int res;
12908
0
            if (_Py_EnterRecursiveCall(" while traversing 'With' node")) {
12909
0
                goto failed;
12910
0
            }
12911
0
            res = obj2ast_string(state, tmp, &type_comment, arena);
12912
0
            _Py_LeaveRecursiveCall();
12913
0
            if (res != 0) goto failed;
12914
0
            Py_CLEAR(tmp);
12915
0
        }
12916
0
        *out = _PyAST_With(items, body, type_comment, lineno, col_offset,
12917
0
                           end_lineno, end_col_offset, arena);
12918
0
        if (*out == NULL) goto failed;
12919
0
        return 0;
12920
0
    }
12921
0
    tp = state->AsyncWith_type;
12922
0
    isinstance = PyObject_IsInstance(obj, tp);
12923
0
    if (isinstance == -1) {
12924
0
        return -1;
12925
0
    }
12926
0
    if (isinstance) {
12927
0
        asdl_withitem_seq* items;
12928
0
        asdl_stmt_seq* body;
12929
0
        string type_comment;
12930
12931
0
        if (PyObject_GetOptionalAttr(obj, state->items, &tmp) < 0) {
12932
0
            return -1;
12933
0
        }
12934
0
        if (tmp == NULL) {
12935
0
            tmp = PyList_New(0);
12936
0
            if (tmp == NULL) {
12937
0
                return -1;
12938
0
            }
12939
0
        }
12940
0
        {
12941
0
            int res;
12942
0
            Py_ssize_t len;
12943
0
            Py_ssize_t i;
12944
0
            if (!PyList_Check(tmp)) {
12945
0
                PyErr_Format(PyExc_TypeError, "AsyncWith field \"items\" must be a list, not a %.200s", _PyType_Name(Py_TYPE(tmp)));
12946
0
                goto failed;
12947
0
            }
12948
0
            len = PyList_GET_SIZE(tmp);
12949
0
            items = _Py_asdl_withitem_seq_new(len, arena);
12950
0
            if (items == NULL) goto failed;
12951
0
            for (i = 0; i < len; i++) {
12952
0
                withitem_ty val;
12953
0
                PyObject *tmp2 = Py_NewRef(PyList_GET_ITEM(tmp, i));
12954
0
                if (_Py_EnterRecursiveCall(" while traversing 'AsyncWith' node")) {
12955
0
                    goto failed;
12956
0
                }
12957
0
                res = obj2ast_withitem(state, tmp2, &val, arena);
12958
0
                _Py_LeaveRecursiveCall();
12959
0
                Py_DECREF(tmp2);
12960
0
                if (res != 0) goto failed;
12961
0
                if (len != PyList_GET_SIZE(tmp)) {
12962
0
                    PyErr_SetString(PyExc_RuntimeError, "AsyncWith field \"items\" changed size during iteration");
12963
0
                    goto failed;
12964
0
                }
12965
0
                asdl_seq_SET(items, i, val);
12966
0
            }
12967
0
            Py_CLEAR(tmp);
12968
0
        }
12969
0
        if (PyObject_GetOptionalAttr(obj, state->body, &tmp) < 0) {
12970
0
            return -1;
12971
0
        }
12972
0
        if (tmp == NULL) {
12973
0
            tmp = PyList_New(0);
12974
0
            if (tmp == NULL) {
12975
0
                return -1;
12976
0
            }
12977
0
        }
12978
0
        {
12979
0
            int res;
12980
0
            Py_ssize_t len;
12981
0
            Py_ssize_t i;
12982
0
            if (!PyList_Check(tmp)) {
12983
0
                PyErr_Format(PyExc_TypeError, "AsyncWith field \"body\" must be a list, not a %.200s", _PyType_Name(Py_TYPE(tmp)));
12984
0
                goto failed;
12985
0
            }
12986
0
            len = PyList_GET_SIZE(tmp);
12987
0
            body = _Py_asdl_stmt_seq_new(len, arena);
12988
0
            if (body == NULL) goto failed;
12989
0
            for (i = 0; i < len; i++) {
12990
0
                stmt_ty val;
12991
0
                PyObject *tmp2 = Py_NewRef(PyList_GET_ITEM(tmp, i));
12992
0
                if (_Py_EnterRecursiveCall(" while traversing 'AsyncWith' node")) {
12993
0
                    goto failed;
12994
0
                }
12995
0
                res = obj2ast_stmt(state, tmp2, &val, arena);
12996
0
                _Py_LeaveRecursiveCall();
12997
0
                Py_DECREF(tmp2);
12998
0
                if (res != 0) goto failed;
12999
0
                if (len != PyList_GET_SIZE(tmp)) {
13000
0
                    PyErr_SetString(PyExc_RuntimeError, "AsyncWith field \"body\" changed size during iteration");
13001
0
                    goto failed;
13002
0
                }
13003
0
                asdl_seq_SET(body, i, val);
13004
0
            }
13005
0
            Py_CLEAR(tmp);
13006
0
        }
13007
0
        if (PyObject_GetOptionalAttr(obj, state->type_comment, &tmp) < 0) {
13008
0
            return -1;
13009
0
        }
13010
0
        if (tmp == NULL || tmp == Py_None) {
13011
0
            Py_CLEAR(tmp);
13012
0
            type_comment = NULL;
13013
0
        }
13014
0
        else {
13015
0
            int res;
13016
0
            if (_Py_EnterRecursiveCall(" while traversing 'AsyncWith' node")) {
13017
0
                goto failed;
13018
0
            }
13019
0
            res = obj2ast_string(state, tmp, &type_comment, arena);
13020
0
            _Py_LeaveRecursiveCall();
13021
0
            if (res != 0) goto failed;
13022
0
            Py_CLEAR(tmp);
13023
0
        }
13024
0
        *out = _PyAST_AsyncWith(items, body, type_comment, lineno, col_offset,
13025
0
                                end_lineno, end_col_offset, arena);
13026
0
        if (*out == NULL) goto failed;
13027
0
        return 0;
13028
0
    }
13029
0
    tp = state->Match_type;
13030
0
    isinstance = PyObject_IsInstance(obj, tp);
13031
0
    if (isinstance == -1) {
13032
0
        return -1;
13033
0
    }
13034
0
    if (isinstance) {
13035
0
        expr_ty subject;
13036
0
        asdl_match_case_seq* cases;
13037
13038
0
        if (PyObject_GetOptionalAttr(obj, state->subject, &tmp) < 0) {
13039
0
            return -1;
13040
0
        }
13041
0
        if (tmp == NULL) {
13042
0
            PyErr_SetString(PyExc_TypeError, "required field \"subject\" missing from Match");
13043
0
            return -1;
13044
0
        }
13045
0
        else {
13046
0
            int res;
13047
0
            if (_Py_EnterRecursiveCall(" while traversing 'Match' node")) {
13048
0
                goto failed;
13049
0
            }
13050
0
            res = obj2ast_expr(state, tmp, &subject, arena);
13051
0
            _Py_LeaveRecursiveCall();
13052
0
            if (res != 0) goto failed;
13053
0
            Py_CLEAR(tmp);
13054
0
        }
13055
0
        if (PyObject_GetOptionalAttr(obj, state->cases, &tmp) < 0) {
13056
0
            return -1;
13057
0
        }
13058
0
        if (tmp == NULL) {
13059
0
            tmp = PyList_New(0);
13060
0
            if (tmp == NULL) {
13061
0
                return -1;
13062
0
            }
13063
0
        }
13064
0
        {
13065
0
            int res;
13066
0
            Py_ssize_t len;
13067
0
            Py_ssize_t i;
13068
0
            if (!PyList_Check(tmp)) {
13069
0
                PyErr_Format(PyExc_TypeError, "Match field \"cases\" must be a list, not a %.200s", _PyType_Name(Py_TYPE(tmp)));
13070
0
                goto failed;
13071
0
            }
13072
0
            len = PyList_GET_SIZE(tmp);
13073
0
            cases = _Py_asdl_match_case_seq_new(len, arena);
13074
0
            if (cases == NULL) goto failed;
13075
0
            for (i = 0; i < len; i++) {
13076
0
                match_case_ty val;
13077
0
                PyObject *tmp2 = Py_NewRef(PyList_GET_ITEM(tmp, i));
13078
0
                if (_Py_EnterRecursiveCall(" while traversing 'Match' node")) {
13079
0
                    goto failed;
13080
0
                }
13081
0
                res = obj2ast_match_case(state, tmp2, &val, arena);
13082
0
                _Py_LeaveRecursiveCall();
13083
0
                Py_DECREF(tmp2);
13084
0
                if (res != 0) goto failed;
13085
0
                if (len != PyList_GET_SIZE(tmp)) {
13086
0
                    PyErr_SetString(PyExc_RuntimeError, "Match field \"cases\" changed size during iteration");
13087
0
                    goto failed;
13088
0
                }
13089
0
                asdl_seq_SET(cases, i, val);
13090
0
            }
13091
0
            Py_CLEAR(tmp);
13092
0
        }
13093
0
        *out = _PyAST_Match(subject, cases, lineno, col_offset, end_lineno,
13094
0
                            end_col_offset, arena);
13095
0
        if (*out == NULL) goto failed;
13096
0
        return 0;
13097
0
    }
13098
0
    tp = state->Raise_type;
13099
0
    isinstance = PyObject_IsInstance(obj, tp);
13100
0
    if (isinstance == -1) {
13101
0
        return -1;
13102
0
    }
13103
0
    if (isinstance) {
13104
0
        expr_ty exc;
13105
0
        expr_ty cause;
13106
13107
0
        if (PyObject_GetOptionalAttr(obj, state->exc, &tmp) < 0) {
13108
0
            return -1;
13109
0
        }
13110
0
        if (tmp == NULL || tmp == Py_None) {
13111
0
            Py_CLEAR(tmp);
13112
0
            exc = NULL;
13113
0
        }
13114
0
        else {
13115
0
            int res;
13116
0
            if (_Py_EnterRecursiveCall(" while traversing 'Raise' node")) {
13117
0
                goto failed;
13118
0
            }
13119
0
            res = obj2ast_expr(state, tmp, &exc, arena);
13120
0
            _Py_LeaveRecursiveCall();
13121
0
            if (res != 0) goto failed;
13122
0
            Py_CLEAR(tmp);
13123
0
        }
13124
0
        if (PyObject_GetOptionalAttr(obj, state->cause, &tmp) < 0) {
13125
0
            return -1;
13126
0
        }
13127
0
        if (tmp == NULL || tmp == Py_None) {
13128
0
            Py_CLEAR(tmp);
13129
0
            cause = NULL;
13130
0
        }
13131
0
        else {
13132
0
            int res;
13133
0
            if (_Py_EnterRecursiveCall(" while traversing 'Raise' node")) {
13134
0
                goto failed;
13135
0
            }
13136
0
            res = obj2ast_expr(state, tmp, &cause, arena);
13137
0
            _Py_LeaveRecursiveCall();
13138
0
            if (res != 0) goto failed;
13139
0
            Py_CLEAR(tmp);
13140
0
        }
13141
0
        *out = _PyAST_Raise(exc, cause, lineno, col_offset, end_lineno,
13142
0
                            end_col_offset, arena);
13143
0
        if (*out == NULL) goto failed;
13144
0
        return 0;
13145
0
    }
13146
0
    tp = state->Try_type;
13147
0
    isinstance = PyObject_IsInstance(obj, tp);
13148
0
    if (isinstance == -1) {
13149
0
        return -1;
13150
0
    }
13151
0
    if (isinstance) {
13152
0
        asdl_stmt_seq* body;
13153
0
        asdl_excepthandler_seq* handlers;
13154
0
        asdl_stmt_seq* orelse;
13155
0
        asdl_stmt_seq* finalbody;
13156
13157
0
        if (PyObject_GetOptionalAttr(obj, state->body, &tmp) < 0) {
13158
0
            return -1;
13159
0
        }
13160
0
        if (tmp == NULL) {
13161
0
            tmp = PyList_New(0);
13162
0
            if (tmp == NULL) {
13163
0
                return -1;
13164
0
            }
13165
0
        }
13166
0
        {
13167
0
            int res;
13168
0
            Py_ssize_t len;
13169
0
            Py_ssize_t i;
13170
0
            if (!PyList_Check(tmp)) {
13171
0
                PyErr_Format(PyExc_TypeError, "Try field \"body\" must be a list, not a %.200s", _PyType_Name(Py_TYPE(tmp)));
13172
0
                goto failed;
13173
0
            }
13174
0
            len = PyList_GET_SIZE(tmp);
13175
0
            body = _Py_asdl_stmt_seq_new(len, arena);
13176
0
            if (body == NULL) goto failed;
13177
0
            for (i = 0; i < len; i++) {
13178
0
                stmt_ty val;
13179
0
                PyObject *tmp2 = Py_NewRef(PyList_GET_ITEM(tmp, i));
13180
0
                if (_Py_EnterRecursiveCall(" while traversing 'Try' node")) {
13181
0
                    goto failed;
13182
0
                }
13183
0
                res = obj2ast_stmt(state, tmp2, &val, arena);
13184
0
                _Py_LeaveRecursiveCall();
13185
0
                Py_DECREF(tmp2);
13186
0
                if (res != 0) goto failed;
13187
0
                if (len != PyList_GET_SIZE(tmp)) {
13188
0
                    PyErr_SetString(PyExc_RuntimeError, "Try field \"body\" changed size during iteration");
13189
0
                    goto failed;
13190
0
                }
13191
0
                asdl_seq_SET(body, i, val);
13192
0
            }
13193
0
            Py_CLEAR(tmp);
13194
0
        }
13195
0
        if (PyObject_GetOptionalAttr(obj, state->handlers, &tmp) < 0) {
13196
0
            return -1;
13197
0
        }
13198
0
        if (tmp == NULL) {
13199
0
            tmp = PyList_New(0);
13200
0
            if (tmp == NULL) {
13201
0
                return -1;
13202
0
            }
13203
0
        }
13204
0
        {
13205
0
            int res;
13206
0
            Py_ssize_t len;
13207
0
            Py_ssize_t i;
13208
0
            if (!PyList_Check(tmp)) {
13209
0
                PyErr_Format(PyExc_TypeError, "Try field \"handlers\" must be a list, not a %.200s", _PyType_Name(Py_TYPE(tmp)));
13210
0
                goto failed;
13211
0
            }
13212
0
            len = PyList_GET_SIZE(tmp);
13213
0
            handlers = _Py_asdl_excepthandler_seq_new(len, arena);
13214
0
            if (handlers == NULL) goto failed;
13215
0
            for (i = 0; i < len; i++) {
13216
0
                excepthandler_ty val;
13217
0
                PyObject *tmp2 = Py_NewRef(PyList_GET_ITEM(tmp, i));
13218
0
                if (_Py_EnterRecursiveCall(" while traversing 'Try' node")) {
13219
0
                    goto failed;
13220
0
                }
13221
0
                res = obj2ast_excepthandler(state, tmp2, &val, arena);
13222
0
                _Py_LeaveRecursiveCall();
13223
0
                Py_DECREF(tmp2);
13224
0
                if (res != 0) goto failed;
13225
0
                if (len != PyList_GET_SIZE(tmp)) {
13226
0
                    PyErr_SetString(PyExc_RuntimeError, "Try field \"handlers\" changed size during iteration");
13227
0
                    goto failed;
13228
0
                }
13229
0
                asdl_seq_SET(handlers, i, val);
13230
0
            }
13231
0
            Py_CLEAR(tmp);
13232
0
        }
13233
0
        if (PyObject_GetOptionalAttr(obj, state->orelse, &tmp) < 0) {
13234
0
            return -1;
13235
0
        }
13236
0
        if (tmp == NULL) {
13237
0
            tmp = PyList_New(0);
13238
0
            if (tmp == NULL) {
13239
0
                return -1;
13240
0
            }
13241
0
        }
13242
0
        {
13243
0
            int res;
13244
0
            Py_ssize_t len;
13245
0
            Py_ssize_t i;
13246
0
            if (!PyList_Check(tmp)) {
13247
0
                PyErr_Format(PyExc_TypeError, "Try field \"orelse\" must be a list, not a %.200s", _PyType_Name(Py_TYPE(tmp)));
13248
0
                goto failed;
13249
0
            }
13250
0
            len = PyList_GET_SIZE(tmp);
13251
0
            orelse = _Py_asdl_stmt_seq_new(len, arena);
13252
0
            if (orelse == NULL) goto failed;
13253
0
            for (i = 0; i < len; i++) {
13254
0
                stmt_ty val;
13255
0
                PyObject *tmp2 = Py_NewRef(PyList_GET_ITEM(tmp, i));
13256
0
                if (_Py_EnterRecursiveCall(" while traversing 'Try' node")) {
13257
0
                    goto failed;
13258
0
                }
13259
0
                res = obj2ast_stmt(state, tmp2, &val, arena);
13260
0
                _Py_LeaveRecursiveCall();
13261
0
                Py_DECREF(tmp2);
13262
0
                if (res != 0) goto failed;
13263
0
                if (len != PyList_GET_SIZE(tmp)) {
13264
0
                    PyErr_SetString(PyExc_RuntimeError, "Try field \"orelse\" changed size during iteration");
13265
0
                    goto failed;
13266
0
                }
13267
0
                asdl_seq_SET(orelse, i, val);
13268
0
            }
13269
0
            Py_CLEAR(tmp);
13270
0
        }
13271
0
        if (PyObject_GetOptionalAttr(obj, state->finalbody, &tmp) < 0) {
13272
0
            return -1;
13273
0
        }
13274
0
        if (tmp == NULL) {
13275
0
            tmp = PyList_New(0);
13276
0
            if (tmp == NULL) {
13277
0
                return -1;
13278
0
            }
13279
0
        }
13280
0
        {
13281
0
            int res;
13282
0
            Py_ssize_t len;
13283
0
            Py_ssize_t i;
13284
0
            if (!PyList_Check(tmp)) {
13285
0
                PyErr_Format(PyExc_TypeError, "Try field \"finalbody\" must be a list, not a %.200s", _PyType_Name(Py_TYPE(tmp)));
13286
0
                goto failed;
13287
0
            }
13288
0
            len = PyList_GET_SIZE(tmp);
13289
0
            finalbody = _Py_asdl_stmt_seq_new(len, arena);
13290
0
            if (finalbody == NULL) goto failed;
13291
0
            for (i = 0; i < len; i++) {
13292
0
                stmt_ty val;
13293
0
                PyObject *tmp2 = Py_NewRef(PyList_GET_ITEM(tmp, i));
13294
0
                if (_Py_EnterRecursiveCall(" while traversing 'Try' node")) {
13295
0
                    goto failed;
13296
0
                }
13297
0
                res = obj2ast_stmt(state, tmp2, &val, arena);
13298
0
                _Py_LeaveRecursiveCall();
13299
0
                Py_DECREF(tmp2);
13300
0
                if (res != 0) goto failed;
13301
0
                if (len != PyList_GET_SIZE(tmp)) {
13302
0
                    PyErr_SetString(PyExc_RuntimeError, "Try field \"finalbody\" changed size during iteration");
13303
0
                    goto failed;
13304
0
                }
13305
0
                asdl_seq_SET(finalbody, i, val);
13306
0
            }
13307
0
            Py_CLEAR(tmp);
13308
0
        }
13309
0
        *out = _PyAST_Try(body, handlers, orelse, finalbody, lineno,
13310
0
                          col_offset, end_lineno, end_col_offset, arena);
13311
0
        if (*out == NULL) goto failed;
13312
0
        return 0;
13313
0
    }
13314
0
    tp = state->TryStar_type;
13315
0
    isinstance = PyObject_IsInstance(obj, tp);
13316
0
    if (isinstance == -1) {
13317
0
        return -1;
13318
0
    }
13319
0
    if (isinstance) {
13320
0
        asdl_stmt_seq* body;
13321
0
        asdl_excepthandler_seq* handlers;
13322
0
        asdl_stmt_seq* orelse;
13323
0
        asdl_stmt_seq* finalbody;
13324
13325
0
        if (PyObject_GetOptionalAttr(obj, state->body, &tmp) < 0) {
13326
0
            return -1;
13327
0
        }
13328
0
        if (tmp == NULL) {
13329
0
            tmp = PyList_New(0);
13330
0
            if (tmp == NULL) {
13331
0
                return -1;
13332
0
            }
13333
0
        }
13334
0
        {
13335
0
            int res;
13336
0
            Py_ssize_t len;
13337
0
            Py_ssize_t i;
13338
0
            if (!PyList_Check(tmp)) {
13339
0
                PyErr_Format(PyExc_TypeError, "TryStar field \"body\" must be a list, not a %.200s", _PyType_Name(Py_TYPE(tmp)));
13340
0
                goto failed;
13341
0
            }
13342
0
            len = PyList_GET_SIZE(tmp);
13343
0
            body = _Py_asdl_stmt_seq_new(len, arena);
13344
0
            if (body == NULL) goto failed;
13345
0
            for (i = 0; i < len; i++) {
13346
0
                stmt_ty val;
13347
0
                PyObject *tmp2 = Py_NewRef(PyList_GET_ITEM(tmp, i));
13348
0
                if (_Py_EnterRecursiveCall(" while traversing 'TryStar' node")) {
13349
0
                    goto failed;
13350
0
                }
13351
0
                res = obj2ast_stmt(state, tmp2, &val, arena);
13352
0
                _Py_LeaveRecursiveCall();
13353
0
                Py_DECREF(tmp2);
13354
0
                if (res != 0) goto failed;
13355
0
                if (len != PyList_GET_SIZE(tmp)) {
13356
0
                    PyErr_SetString(PyExc_RuntimeError, "TryStar field \"body\" changed size during iteration");
13357
0
                    goto failed;
13358
0
                }
13359
0
                asdl_seq_SET(body, i, val);
13360
0
            }
13361
0
            Py_CLEAR(tmp);
13362
0
        }
13363
0
        if (PyObject_GetOptionalAttr(obj, state->handlers, &tmp) < 0) {
13364
0
            return -1;
13365
0
        }
13366
0
        if (tmp == NULL) {
13367
0
            tmp = PyList_New(0);
13368
0
            if (tmp == NULL) {
13369
0
                return -1;
13370
0
            }
13371
0
        }
13372
0
        {
13373
0
            int res;
13374
0
            Py_ssize_t len;
13375
0
            Py_ssize_t i;
13376
0
            if (!PyList_Check(tmp)) {
13377
0
                PyErr_Format(PyExc_TypeError, "TryStar field \"handlers\" must be a list, not a %.200s", _PyType_Name(Py_TYPE(tmp)));
13378
0
                goto failed;
13379
0
            }
13380
0
            len = PyList_GET_SIZE(tmp);
13381
0
            handlers = _Py_asdl_excepthandler_seq_new(len, arena);
13382
0
            if (handlers == NULL) goto failed;
13383
0
            for (i = 0; i < len; i++) {
13384
0
                excepthandler_ty val;
13385
0
                PyObject *tmp2 = Py_NewRef(PyList_GET_ITEM(tmp, i));
13386
0
                if (_Py_EnterRecursiveCall(" while traversing 'TryStar' node")) {
13387
0
                    goto failed;
13388
0
                }
13389
0
                res = obj2ast_excepthandler(state, tmp2, &val, arena);
13390
0
                _Py_LeaveRecursiveCall();
13391
0
                Py_DECREF(tmp2);
13392
0
                if (res != 0) goto failed;
13393
0
                if (len != PyList_GET_SIZE(tmp)) {
13394
0
                    PyErr_SetString(PyExc_RuntimeError, "TryStar field \"handlers\" changed size during iteration");
13395
0
                    goto failed;
13396
0
                }
13397
0
                asdl_seq_SET(handlers, i, val);
13398
0
            }
13399
0
            Py_CLEAR(tmp);
13400
0
        }
13401
0
        if (PyObject_GetOptionalAttr(obj, state->orelse, &tmp) < 0) {
13402
0
            return -1;
13403
0
        }
13404
0
        if (tmp == NULL) {
13405
0
            tmp = PyList_New(0);
13406
0
            if (tmp == NULL) {
13407
0
                return -1;
13408
0
            }
13409
0
        }
13410
0
        {
13411
0
            int res;
13412
0
            Py_ssize_t len;
13413
0
            Py_ssize_t i;
13414
0
            if (!PyList_Check(tmp)) {
13415
0
                PyErr_Format(PyExc_TypeError, "TryStar field \"orelse\" must be a list, not a %.200s", _PyType_Name(Py_TYPE(tmp)));
13416
0
                goto failed;
13417
0
            }
13418
0
            len = PyList_GET_SIZE(tmp);
13419
0
            orelse = _Py_asdl_stmt_seq_new(len, arena);
13420
0
            if (orelse == NULL) goto failed;
13421
0
            for (i = 0; i < len; i++) {
13422
0
                stmt_ty val;
13423
0
                PyObject *tmp2 = Py_NewRef(PyList_GET_ITEM(tmp, i));
13424
0
                if (_Py_EnterRecursiveCall(" while traversing 'TryStar' node")) {
13425
0
                    goto failed;
13426
0
                }
13427
0
                res = obj2ast_stmt(state, tmp2, &val, arena);
13428
0
                _Py_LeaveRecursiveCall();
13429
0
                Py_DECREF(tmp2);
13430
0
                if (res != 0) goto failed;
13431
0
                if (len != PyList_GET_SIZE(tmp)) {
13432
0
                    PyErr_SetString(PyExc_RuntimeError, "TryStar field \"orelse\" changed size during iteration");
13433
0
                    goto failed;
13434
0
                }
13435
0
                asdl_seq_SET(orelse, i, val);
13436
0
            }
13437
0
            Py_CLEAR(tmp);
13438
0
        }
13439
0
        if (PyObject_GetOptionalAttr(obj, state->finalbody, &tmp) < 0) {
13440
0
            return -1;
13441
0
        }
13442
0
        if (tmp == NULL) {
13443
0
            tmp = PyList_New(0);
13444
0
            if (tmp == NULL) {
13445
0
                return -1;
13446
0
            }
13447
0
        }
13448
0
        {
13449
0
            int res;
13450
0
            Py_ssize_t len;
13451
0
            Py_ssize_t i;
13452
0
            if (!PyList_Check(tmp)) {
13453
0
                PyErr_Format(PyExc_TypeError, "TryStar field \"finalbody\" must be a list, not a %.200s", _PyType_Name(Py_TYPE(tmp)));
13454
0
                goto failed;
13455
0
            }
13456
0
            len = PyList_GET_SIZE(tmp);
13457
0
            finalbody = _Py_asdl_stmt_seq_new(len, arena);
13458
0
            if (finalbody == NULL) goto failed;
13459
0
            for (i = 0; i < len; i++) {
13460
0
                stmt_ty val;
13461
0
                PyObject *tmp2 = Py_NewRef(PyList_GET_ITEM(tmp, i));
13462
0
                if (_Py_EnterRecursiveCall(" while traversing 'TryStar' node")) {
13463
0
                    goto failed;
13464
0
                }
13465
0
                res = obj2ast_stmt(state, tmp2, &val, arena);
13466
0
                _Py_LeaveRecursiveCall();
13467
0
                Py_DECREF(tmp2);
13468
0
                if (res != 0) goto failed;
13469
0
                if (len != PyList_GET_SIZE(tmp)) {
13470
0
                    PyErr_SetString(PyExc_RuntimeError, "TryStar field \"finalbody\" changed size during iteration");
13471
0
                    goto failed;
13472
0
                }
13473
0
                asdl_seq_SET(finalbody, i, val);
13474
0
            }
13475
0
            Py_CLEAR(tmp);
13476
0
        }
13477
0
        *out = _PyAST_TryStar(body, handlers, orelse, finalbody, lineno,
13478
0
                              col_offset, end_lineno, end_col_offset, arena);
13479
0
        if (*out == NULL) goto failed;
13480
0
        return 0;
13481
0
    }
13482
0
    tp = state->Assert_type;
13483
0
    isinstance = PyObject_IsInstance(obj, tp);
13484
0
    if (isinstance == -1) {
13485
0
        return -1;
13486
0
    }
13487
0
    if (isinstance) {
13488
0
        expr_ty test;
13489
0
        expr_ty msg;
13490
13491
0
        if (PyObject_GetOptionalAttr(obj, state->test, &tmp) < 0) {
13492
0
            return -1;
13493
0
        }
13494
0
        if (tmp == NULL) {
13495
0
            PyErr_SetString(PyExc_TypeError, "required field \"test\" missing from Assert");
13496
0
            return -1;
13497
0
        }
13498
0
        else {
13499
0
            int res;
13500
0
            if (_Py_EnterRecursiveCall(" while traversing 'Assert' node")) {
13501
0
                goto failed;
13502
0
            }
13503
0
            res = obj2ast_expr(state, tmp, &test, arena);
13504
0
            _Py_LeaveRecursiveCall();
13505
0
            if (res != 0) goto failed;
13506
0
            Py_CLEAR(tmp);
13507
0
        }
13508
0
        if (PyObject_GetOptionalAttr(obj, state->msg, &tmp) < 0) {
13509
0
            return -1;
13510
0
        }
13511
0
        if (tmp == NULL || tmp == Py_None) {
13512
0
            Py_CLEAR(tmp);
13513
0
            msg = NULL;
13514
0
        }
13515
0
        else {
13516
0
            int res;
13517
0
            if (_Py_EnterRecursiveCall(" while traversing 'Assert' node")) {
13518
0
                goto failed;
13519
0
            }
13520
0
            res = obj2ast_expr(state, tmp, &msg, arena);
13521
0
            _Py_LeaveRecursiveCall();
13522
0
            if (res != 0) goto failed;
13523
0
            Py_CLEAR(tmp);
13524
0
        }
13525
0
        *out = _PyAST_Assert(test, msg, lineno, col_offset, end_lineno,
13526
0
                             end_col_offset, arena);
13527
0
        if (*out == NULL) goto failed;
13528
0
        return 0;
13529
0
    }
13530
0
    tp = state->Import_type;
13531
0
    isinstance = PyObject_IsInstance(obj, tp);
13532
0
    if (isinstance == -1) {
13533
0
        return -1;
13534
0
    }
13535
0
    if (isinstance) {
13536
0
        asdl_alias_seq* names;
13537
0
        int is_lazy;
13538
13539
0
        if (PyObject_GetOptionalAttr(obj, state->names, &tmp) < 0) {
13540
0
            return -1;
13541
0
        }
13542
0
        if (tmp == NULL) {
13543
0
            tmp = PyList_New(0);
13544
0
            if (tmp == NULL) {
13545
0
                return -1;
13546
0
            }
13547
0
        }
13548
0
        {
13549
0
            int res;
13550
0
            Py_ssize_t len;
13551
0
            Py_ssize_t i;
13552
0
            if (!PyList_Check(tmp)) {
13553
0
                PyErr_Format(PyExc_TypeError, "Import field \"names\" must be a list, not a %.200s", _PyType_Name(Py_TYPE(tmp)));
13554
0
                goto failed;
13555
0
            }
13556
0
            len = PyList_GET_SIZE(tmp);
13557
0
            names = _Py_asdl_alias_seq_new(len, arena);
13558
0
            if (names == NULL) goto failed;
13559
0
            for (i = 0; i < len; i++) {
13560
0
                alias_ty val;
13561
0
                PyObject *tmp2 = Py_NewRef(PyList_GET_ITEM(tmp, i));
13562
0
                if (_Py_EnterRecursiveCall(" while traversing 'Import' node")) {
13563
0
                    goto failed;
13564
0
                }
13565
0
                res = obj2ast_alias(state, tmp2, &val, arena);
13566
0
                _Py_LeaveRecursiveCall();
13567
0
                Py_DECREF(tmp2);
13568
0
                if (res != 0) goto failed;
13569
0
                if (len != PyList_GET_SIZE(tmp)) {
13570
0
                    PyErr_SetString(PyExc_RuntimeError, "Import field \"names\" changed size during iteration");
13571
0
                    goto failed;
13572
0
                }
13573
0
                asdl_seq_SET(names, i, val);
13574
0
            }
13575
0
            Py_CLEAR(tmp);
13576
0
        }
13577
0
        if (PyObject_GetOptionalAttr(obj, state->is_lazy, &tmp) < 0) {
13578
0
            return -1;
13579
0
        }
13580
0
        if (tmp == NULL || tmp == Py_None) {
13581
0
            Py_CLEAR(tmp);
13582
0
            is_lazy = 0;
13583
0
        }
13584
0
        else {
13585
0
            int res;
13586
0
            if (_Py_EnterRecursiveCall(" while traversing 'Import' node")) {
13587
0
                goto failed;
13588
0
            }
13589
0
            res = obj2ast_int(state, tmp, &is_lazy, arena);
13590
0
            _Py_LeaveRecursiveCall();
13591
0
            if (res != 0) goto failed;
13592
0
            Py_CLEAR(tmp);
13593
0
        }
13594
0
        *out = _PyAST_Import(names, is_lazy, lineno, col_offset, end_lineno,
13595
0
                             end_col_offset, arena);
13596
0
        if (*out == NULL) goto failed;
13597
0
        return 0;
13598
0
    }
13599
0
    tp = state->ImportFrom_type;
13600
0
    isinstance = PyObject_IsInstance(obj, tp);
13601
0
    if (isinstance == -1) {
13602
0
        return -1;
13603
0
    }
13604
0
    if (isinstance) {
13605
0
        identifier module;
13606
0
        asdl_alias_seq* names;
13607
0
        int level;
13608
0
        int is_lazy;
13609
13610
0
        if (PyObject_GetOptionalAttr(obj, state->module, &tmp) < 0) {
13611
0
            return -1;
13612
0
        }
13613
0
        if (tmp == NULL || tmp == Py_None) {
13614
0
            Py_CLEAR(tmp);
13615
0
            module = NULL;
13616
0
        }
13617
0
        else {
13618
0
            int res;
13619
0
            if (_Py_EnterRecursiveCall(" while traversing 'ImportFrom' node")) {
13620
0
                goto failed;
13621
0
            }
13622
0
            res = obj2ast_identifier(state, tmp, &module, arena);
13623
0
            _Py_LeaveRecursiveCall();
13624
0
            if (res != 0) goto failed;
13625
0
            Py_CLEAR(tmp);
13626
0
        }
13627
0
        if (PyObject_GetOptionalAttr(obj, state->names, &tmp) < 0) {
13628
0
            return -1;
13629
0
        }
13630
0
        if (tmp == NULL) {
13631
0
            tmp = PyList_New(0);
13632
0
            if (tmp == NULL) {
13633
0
                return -1;
13634
0
            }
13635
0
        }
13636
0
        {
13637
0
            int res;
13638
0
            Py_ssize_t len;
13639
0
            Py_ssize_t i;
13640
0
            if (!PyList_Check(tmp)) {
13641
0
                PyErr_Format(PyExc_TypeError, "ImportFrom field \"names\" must be a list, not a %.200s", _PyType_Name(Py_TYPE(tmp)));
13642
0
                goto failed;
13643
0
            }
13644
0
            len = PyList_GET_SIZE(tmp);
13645
0
            names = _Py_asdl_alias_seq_new(len, arena);
13646
0
            if (names == NULL) goto failed;
13647
0
            for (i = 0; i < len; i++) {
13648
0
                alias_ty val;
13649
0
                PyObject *tmp2 = Py_NewRef(PyList_GET_ITEM(tmp, i));
13650
0
                if (_Py_EnterRecursiveCall(" while traversing 'ImportFrom' node")) {
13651
0
                    goto failed;
13652
0
                }
13653
0
                res = obj2ast_alias(state, tmp2, &val, arena);
13654
0
                _Py_LeaveRecursiveCall();
13655
0
                Py_DECREF(tmp2);
13656
0
                if (res != 0) goto failed;
13657
0
                if (len != PyList_GET_SIZE(tmp)) {
13658
0
                    PyErr_SetString(PyExc_RuntimeError, "ImportFrom field \"names\" changed size during iteration");
13659
0
                    goto failed;
13660
0
                }
13661
0
                asdl_seq_SET(names, i, val);
13662
0
            }
13663
0
            Py_CLEAR(tmp);
13664
0
        }
13665
0
        if (PyObject_GetOptionalAttr(obj, state->level, &tmp) < 0) {
13666
0
            return -1;
13667
0
        }
13668
0
        if (tmp == NULL || tmp == Py_None) {
13669
0
            Py_CLEAR(tmp);
13670
0
            level = 0;
13671
0
        }
13672
0
        else {
13673
0
            int res;
13674
0
            if (_Py_EnterRecursiveCall(" while traversing 'ImportFrom' node")) {
13675
0
                goto failed;
13676
0
            }
13677
0
            res = obj2ast_int(state, tmp, &level, arena);
13678
0
            _Py_LeaveRecursiveCall();
13679
0
            if (res != 0) goto failed;
13680
0
            Py_CLEAR(tmp);
13681
0
        }
13682
0
        if (PyObject_GetOptionalAttr(obj, state->is_lazy, &tmp) < 0) {
13683
0
            return -1;
13684
0
        }
13685
0
        if (tmp == NULL || tmp == Py_None) {
13686
0
            Py_CLEAR(tmp);
13687
0
            is_lazy = 0;
13688
0
        }
13689
0
        else {
13690
0
            int res;
13691
0
            if (_Py_EnterRecursiveCall(" while traversing 'ImportFrom' node")) {
13692
0
                goto failed;
13693
0
            }
13694
0
            res = obj2ast_int(state, tmp, &is_lazy, arena);
13695
0
            _Py_LeaveRecursiveCall();
13696
0
            if (res != 0) goto failed;
13697
0
            Py_CLEAR(tmp);
13698
0
        }
13699
0
        *out = _PyAST_ImportFrom(module, names, level, is_lazy, lineno,
13700
0
                                 col_offset, end_lineno, end_col_offset, arena);
13701
0
        if (*out == NULL) goto failed;
13702
0
        return 0;
13703
0
    }
13704
0
    tp = state->Global_type;
13705
0
    isinstance = PyObject_IsInstance(obj, tp);
13706
0
    if (isinstance == -1) {
13707
0
        return -1;
13708
0
    }
13709
0
    if (isinstance) {
13710
0
        asdl_identifier_seq* names;
13711
13712
0
        if (PyObject_GetOptionalAttr(obj, state->names, &tmp) < 0) {
13713
0
            return -1;
13714
0
        }
13715
0
        if (tmp == NULL) {
13716
0
            tmp = PyList_New(0);
13717
0
            if (tmp == NULL) {
13718
0
                return -1;
13719
0
            }
13720
0
        }
13721
0
        {
13722
0
            int res;
13723
0
            Py_ssize_t len;
13724
0
            Py_ssize_t i;
13725
0
            if (!PyList_Check(tmp)) {
13726
0
                PyErr_Format(PyExc_TypeError, "Global field \"names\" must be a list, not a %.200s", _PyType_Name(Py_TYPE(tmp)));
13727
0
                goto failed;
13728
0
            }
13729
0
            len = PyList_GET_SIZE(tmp);
13730
0
            names = _Py_asdl_identifier_seq_new(len, arena);
13731
0
            if (names == NULL) goto failed;
13732
0
            for (i = 0; i < len; i++) {
13733
0
                identifier val;
13734
0
                PyObject *tmp2 = Py_NewRef(PyList_GET_ITEM(tmp, i));
13735
0
                if (_Py_EnterRecursiveCall(" while traversing 'Global' node")) {
13736
0
                    goto failed;
13737
0
                }
13738
0
                res = obj2ast_identifier(state, tmp2, &val, arena);
13739
0
                _Py_LeaveRecursiveCall();
13740
0
                Py_DECREF(tmp2);
13741
0
                if (res != 0) goto failed;
13742
0
                if (len != PyList_GET_SIZE(tmp)) {
13743
0
                    PyErr_SetString(PyExc_RuntimeError, "Global field \"names\" changed size during iteration");
13744
0
                    goto failed;
13745
0
                }
13746
0
                asdl_seq_SET(names, i, val);
13747
0
            }
13748
0
            Py_CLEAR(tmp);
13749
0
        }
13750
0
        *out = _PyAST_Global(names, lineno, col_offset, end_lineno,
13751
0
                             end_col_offset, arena);
13752
0
        if (*out == NULL) goto failed;
13753
0
        return 0;
13754
0
    }
13755
0
    tp = state->Nonlocal_type;
13756
0
    isinstance = PyObject_IsInstance(obj, tp);
13757
0
    if (isinstance == -1) {
13758
0
        return -1;
13759
0
    }
13760
0
    if (isinstance) {
13761
0
        asdl_identifier_seq* names;
13762
13763
0
        if (PyObject_GetOptionalAttr(obj, state->names, &tmp) < 0) {
13764
0
            return -1;
13765
0
        }
13766
0
        if (tmp == NULL) {
13767
0
            tmp = PyList_New(0);
13768
0
            if (tmp == NULL) {
13769
0
                return -1;
13770
0
            }
13771
0
        }
13772
0
        {
13773
0
            int res;
13774
0
            Py_ssize_t len;
13775
0
            Py_ssize_t i;
13776
0
            if (!PyList_Check(tmp)) {
13777
0
                PyErr_Format(PyExc_TypeError, "Nonlocal field \"names\" must be a list, not a %.200s", _PyType_Name(Py_TYPE(tmp)));
13778
0
                goto failed;
13779
0
            }
13780
0
            len = PyList_GET_SIZE(tmp);
13781
0
            names = _Py_asdl_identifier_seq_new(len, arena);
13782
0
            if (names == NULL) goto failed;
13783
0
            for (i = 0; i < len; i++) {
13784
0
                identifier val;
13785
0
                PyObject *tmp2 = Py_NewRef(PyList_GET_ITEM(tmp, i));
13786
0
                if (_Py_EnterRecursiveCall(" while traversing 'Nonlocal' node")) {
13787
0
                    goto failed;
13788
0
                }
13789
0
                res = obj2ast_identifier(state, tmp2, &val, arena);
13790
0
                _Py_LeaveRecursiveCall();
13791
0
                Py_DECREF(tmp2);
13792
0
                if (res != 0) goto failed;
13793
0
                if (len != PyList_GET_SIZE(tmp)) {
13794
0
                    PyErr_SetString(PyExc_RuntimeError, "Nonlocal field \"names\" changed size during iteration");
13795
0
                    goto failed;
13796
0
                }
13797
0
                asdl_seq_SET(names, i, val);
13798
0
            }
13799
0
            Py_CLEAR(tmp);
13800
0
        }
13801
0
        *out = _PyAST_Nonlocal(names, lineno, col_offset, end_lineno,
13802
0
                               end_col_offset, arena);
13803
0
        if (*out == NULL) goto failed;
13804
0
        return 0;
13805
0
    }
13806
0
    tp = state->Expr_type;
13807
0
    isinstance = PyObject_IsInstance(obj, tp);
13808
0
    if (isinstance == -1) {
13809
0
        return -1;
13810
0
    }
13811
0
    if (isinstance) {
13812
0
        expr_ty value;
13813
13814
0
        if (PyObject_GetOptionalAttr(obj, state->value, &tmp) < 0) {
13815
0
            return -1;
13816
0
        }
13817
0
        if (tmp == NULL) {
13818
0
            PyErr_SetString(PyExc_TypeError, "required field \"value\" missing from Expr");
13819
0
            return -1;
13820
0
        }
13821
0
        else {
13822
0
            int res;
13823
0
            if (_Py_EnterRecursiveCall(" while traversing 'Expr' node")) {
13824
0
                goto failed;
13825
0
            }
13826
0
            res = obj2ast_expr(state, tmp, &value, arena);
13827
0
            _Py_LeaveRecursiveCall();
13828
0
            if (res != 0) goto failed;
13829
0
            Py_CLEAR(tmp);
13830
0
        }
13831
0
        *out = _PyAST_Expr(value, lineno, col_offset, end_lineno,
13832
0
                           end_col_offset, arena);
13833
0
        if (*out == NULL) goto failed;
13834
0
        return 0;
13835
0
    }
13836
0
    tp = state->Pass_type;
13837
0
    isinstance = PyObject_IsInstance(obj, tp);
13838
0
    if (isinstance == -1) {
13839
0
        return -1;
13840
0
    }
13841
0
    if (isinstance) {
13842
13843
0
        *out = _PyAST_Pass(lineno, col_offset, end_lineno, end_col_offset,
13844
0
                           arena);
13845
0
        if (*out == NULL) goto failed;
13846
0
        return 0;
13847
0
    }
13848
0
    tp = state->Break_type;
13849
0
    isinstance = PyObject_IsInstance(obj, tp);
13850
0
    if (isinstance == -1) {
13851
0
        return -1;
13852
0
    }
13853
0
    if (isinstance) {
13854
13855
0
        *out = _PyAST_Break(lineno, col_offset, end_lineno, end_col_offset,
13856
0
                            arena);
13857
0
        if (*out == NULL) goto failed;
13858
0
        return 0;
13859
0
    }
13860
0
    tp = state->Continue_type;
13861
0
    isinstance = PyObject_IsInstance(obj, tp);
13862
0
    if (isinstance == -1) {
13863
0
        return -1;
13864
0
    }
13865
0
    if (isinstance) {
13866
13867
0
        *out = _PyAST_Continue(lineno, col_offset, end_lineno, end_col_offset,
13868
0
                               arena);
13869
0
        if (*out == NULL) goto failed;
13870
0
        return 0;
13871
0
    }
13872
13873
0
    PyErr_Format(PyExc_TypeError, "expected some sort of stmt, but got %R", obj);
13874
0
    failed:
13875
0
    Py_XDECREF(tmp);
13876
0
    return -1;
13877
0
}
13878
13879
int
13880
obj2ast_expr(struct ast_state *state, PyObject* obj, expr_ty* out, PyArena*
13881
             arena)
13882
0
{
13883
0
    int isinstance;
13884
13885
0
    PyObject *tmp = NULL;
13886
0
    PyObject *tp;
13887
0
    int lineno;
13888
0
    int col_offset;
13889
0
    int end_lineno;
13890
0
    int end_col_offset;
13891
13892
0
    if (obj == Py_None) {
13893
0
        *out = NULL;
13894
0
        return 0;
13895
0
    }
13896
0
    if (PyObject_GetOptionalAttr(obj, state->lineno, &tmp) < 0) {
13897
0
        return -1;
13898
0
    }
13899
0
    if (tmp == NULL) {
13900
0
        PyErr_SetString(PyExc_TypeError, "required field \"lineno\" missing from expr");
13901
0
        return -1;
13902
0
    }
13903
0
    else {
13904
0
        int res;
13905
0
        if (_Py_EnterRecursiveCall(" while traversing 'expr' node")) {
13906
0
            goto failed;
13907
0
        }
13908
0
        res = obj2ast_int(state, tmp, &lineno, arena);
13909
0
        _Py_LeaveRecursiveCall();
13910
0
        if (res != 0) goto failed;
13911
0
        Py_CLEAR(tmp);
13912
0
    }
13913
0
    if (PyObject_GetOptionalAttr(obj, state->col_offset, &tmp) < 0) {
13914
0
        return -1;
13915
0
    }
13916
0
    if (tmp == NULL) {
13917
0
        PyErr_SetString(PyExc_TypeError, "required field \"col_offset\" missing from expr");
13918
0
        return -1;
13919
0
    }
13920
0
    else {
13921
0
        int res;
13922
0
        if (_Py_EnterRecursiveCall(" while traversing 'expr' node")) {
13923
0
            goto failed;
13924
0
        }
13925
0
        res = obj2ast_int(state, tmp, &col_offset, arena);
13926
0
        _Py_LeaveRecursiveCall();
13927
0
        if (res != 0) goto failed;
13928
0
        Py_CLEAR(tmp);
13929
0
    }
13930
0
    if (PyObject_GetOptionalAttr(obj, state->end_lineno, &tmp) < 0) {
13931
0
        return -1;
13932
0
    }
13933
0
    if (tmp == NULL || tmp == Py_None) {
13934
0
        Py_CLEAR(tmp);
13935
0
        end_lineno = lineno;
13936
0
    }
13937
0
    else {
13938
0
        int res;
13939
0
        if (_Py_EnterRecursiveCall(" while traversing 'expr' node")) {
13940
0
            goto failed;
13941
0
        }
13942
0
        res = obj2ast_int(state, tmp, &end_lineno, arena);
13943
0
        _Py_LeaveRecursiveCall();
13944
0
        if (res != 0) goto failed;
13945
0
        Py_CLEAR(tmp);
13946
0
    }
13947
0
    if (PyObject_GetOptionalAttr(obj, state->end_col_offset, &tmp) < 0) {
13948
0
        return -1;
13949
0
    }
13950
0
    if (tmp == NULL || tmp == Py_None) {
13951
0
        Py_CLEAR(tmp);
13952
0
        end_col_offset = col_offset;
13953
0
    }
13954
0
    else {
13955
0
        int res;
13956
0
        if (_Py_EnterRecursiveCall(" while traversing 'expr' node")) {
13957
0
            goto failed;
13958
0
        }
13959
0
        res = obj2ast_int(state, tmp, &end_col_offset, arena);
13960
0
        _Py_LeaveRecursiveCall();
13961
0
        if (res != 0) goto failed;
13962
0
        Py_CLEAR(tmp);
13963
0
    }
13964
0
    tp = state->BoolOp_type;
13965
0
    isinstance = PyObject_IsInstance(obj, tp);
13966
0
    if (isinstance == -1) {
13967
0
        return -1;
13968
0
    }
13969
0
    if (isinstance) {
13970
0
        boolop_ty op;
13971
0
        asdl_expr_seq* values;
13972
13973
0
        if (PyObject_GetOptionalAttr(obj, state->op, &tmp) < 0) {
13974
0
            return -1;
13975
0
        }
13976
0
        if (tmp == NULL) {
13977
0
            PyErr_SetString(PyExc_TypeError, "required field \"op\" missing from BoolOp");
13978
0
            return -1;
13979
0
        }
13980
0
        else {
13981
0
            int res;
13982
0
            if (_Py_EnterRecursiveCall(" while traversing 'BoolOp' node")) {
13983
0
                goto failed;
13984
0
            }
13985
0
            res = obj2ast_boolop(state, tmp, &op, arena);
13986
0
            _Py_LeaveRecursiveCall();
13987
0
            if (res != 0) goto failed;
13988
0
            Py_CLEAR(tmp);
13989
0
        }
13990
0
        if (PyObject_GetOptionalAttr(obj, state->values, &tmp) < 0) {
13991
0
            return -1;
13992
0
        }
13993
0
        if (tmp == NULL) {
13994
0
            tmp = PyList_New(0);
13995
0
            if (tmp == NULL) {
13996
0
                return -1;
13997
0
            }
13998
0
        }
13999
0
        {
14000
0
            int res;
14001
0
            Py_ssize_t len;
14002
0
            Py_ssize_t i;
14003
0
            if (!PyList_Check(tmp)) {
14004
0
                PyErr_Format(PyExc_TypeError, "BoolOp field \"values\" must be a list, not a %.200s", _PyType_Name(Py_TYPE(tmp)));
14005
0
                goto failed;
14006
0
            }
14007
0
            len = PyList_GET_SIZE(tmp);
14008
0
            values = _Py_asdl_expr_seq_new(len, arena);
14009
0
            if (values == NULL) goto failed;
14010
0
            for (i = 0; i < len; i++) {
14011
0
                expr_ty val;
14012
0
                PyObject *tmp2 = Py_NewRef(PyList_GET_ITEM(tmp, i));
14013
0
                if (_Py_EnterRecursiveCall(" while traversing 'BoolOp' node")) {
14014
0
                    goto failed;
14015
0
                }
14016
0
                res = obj2ast_expr(state, tmp2, &val, arena);
14017
0
                _Py_LeaveRecursiveCall();
14018
0
                Py_DECREF(tmp2);
14019
0
                if (res != 0) goto failed;
14020
0
                if (len != PyList_GET_SIZE(tmp)) {
14021
0
                    PyErr_SetString(PyExc_RuntimeError, "BoolOp field \"values\" changed size during iteration");
14022
0
                    goto failed;
14023
0
                }
14024
0
                asdl_seq_SET(values, i, val);
14025
0
            }
14026
0
            Py_CLEAR(tmp);
14027
0
        }
14028
0
        *out = _PyAST_BoolOp(op, values, lineno, col_offset, end_lineno,
14029
0
                             end_col_offset, arena);
14030
0
        if (*out == NULL) goto failed;
14031
0
        return 0;
14032
0
    }
14033
0
    tp = state->NamedExpr_type;
14034
0
    isinstance = PyObject_IsInstance(obj, tp);
14035
0
    if (isinstance == -1) {
14036
0
        return -1;
14037
0
    }
14038
0
    if (isinstance) {
14039
0
        expr_ty target;
14040
0
        expr_ty value;
14041
14042
0
        if (PyObject_GetOptionalAttr(obj, state->target, &tmp) < 0) {
14043
0
            return -1;
14044
0
        }
14045
0
        if (tmp == NULL) {
14046
0
            PyErr_SetString(PyExc_TypeError, "required field \"target\" missing from NamedExpr");
14047
0
            return -1;
14048
0
        }
14049
0
        else {
14050
0
            int res;
14051
0
            if (_Py_EnterRecursiveCall(" while traversing 'NamedExpr' node")) {
14052
0
                goto failed;
14053
0
            }
14054
0
            res = obj2ast_expr(state, tmp, &target, arena);
14055
0
            _Py_LeaveRecursiveCall();
14056
0
            if (res != 0) goto failed;
14057
0
            Py_CLEAR(tmp);
14058
0
        }
14059
0
        if (PyObject_GetOptionalAttr(obj, state->value, &tmp) < 0) {
14060
0
            return -1;
14061
0
        }
14062
0
        if (tmp == NULL) {
14063
0
            PyErr_SetString(PyExc_TypeError, "required field \"value\" missing from NamedExpr");
14064
0
            return -1;
14065
0
        }
14066
0
        else {
14067
0
            int res;
14068
0
            if (_Py_EnterRecursiveCall(" while traversing 'NamedExpr' node")) {
14069
0
                goto failed;
14070
0
            }
14071
0
            res = obj2ast_expr(state, tmp, &value, arena);
14072
0
            _Py_LeaveRecursiveCall();
14073
0
            if (res != 0) goto failed;
14074
0
            Py_CLEAR(tmp);
14075
0
        }
14076
0
        *out = _PyAST_NamedExpr(target, value, lineno, col_offset, end_lineno,
14077
0
                                end_col_offset, arena);
14078
0
        if (*out == NULL) goto failed;
14079
0
        return 0;
14080
0
    }
14081
0
    tp = state->BinOp_type;
14082
0
    isinstance = PyObject_IsInstance(obj, tp);
14083
0
    if (isinstance == -1) {
14084
0
        return -1;
14085
0
    }
14086
0
    if (isinstance) {
14087
0
        expr_ty left;
14088
0
        operator_ty op;
14089
0
        expr_ty right;
14090
14091
0
        if (PyObject_GetOptionalAttr(obj, state->left, &tmp) < 0) {
14092
0
            return -1;
14093
0
        }
14094
0
        if (tmp == NULL) {
14095
0
            PyErr_SetString(PyExc_TypeError, "required field \"left\" missing from BinOp");
14096
0
            return -1;
14097
0
        }
14098
0
        else {
14099
0
            int res;
14100
0
            if (_Py_EnterRecursiveCall(" while traversing 'BinOp' node")) {
14101
0
                goto failed;
14102
0
            }
14103
0
            res = obj2ast_expr(state, tmp, &left, arena);
14104
0
            _Py_LeaveRecursiveCall();
14105
0
            if (res != 0) goto failed;
14106
0
            Py_CLEAR(tmp);
14107
0
        }
14108
0
        if (PyObject_GetOptionalAttr(obj, state->op, &tmp) < 0) {
14109
0
            return -1;
14110
0
        }
14111
0
        if (tmp == NULL) {
14112
0
            PyErr_SetString(PyExc_TypeError, "required field \"op\" missing from BinOp");
14113
0
            return -1;
14114
0
        }
14115
0
        else {
14116
0
            int res;
14117
0
            if (_Py_EnterRecursiveCall(" while traversing 'BinOp' node")) {
14118
0
                goto failed;
14119
0
            }
14120
0
            res = obj2ast_operator(state, tmp, &op, arena);
14121
0
            _Py_LeaveRecursiveCall();
14122
0
            if (res != 0) goto failed;
14123
0
            Py_CLEAR(tmp);
14124
0
        }
14125
0
        if (PyObject_GetOptionalAttr(obj, state->right, &tmp) < 0) {
14126
0
            return -1;
14127
0
        }
14128
0
        if (tmp == NULL) {
14129
0
            PyErr_SetString(PyExc_TypeError, "required field \"right\" missing from BinOp");
14130
0
            return -1;
14131
0
        }
14132
0
        else {
14133
0
            int res;
14134
0
            if (_Py_EnterRecursiveCall(" while traversing 'BinOp' node")) {
14135
0
                goto failed;
14136
0
            }
14137
0
            res = obj2ast_expr(state, tmp, &right, arena);
14138
0
            _Py_LeaveRecursiveCall();
14139
0
            if (res != 0) goto failed;
14140
0
            Py_CLEAR(tmp);
14141
0
        }
14142
0
        *out = _PyAST_BinOp(left, op, right, lineno, col_offset, end_lineno,
14143
0
                            end_col_offset, arena);
14144
0
        if (*out == NULL) goto failed;
14145
0
        return 0;
14146
0
    }
14147
0
    tp = state->UnaryOp_type;
14148
0
    isinstance = PyObject_IsInstance(obj, tp);
14149
0
    if (isinstance == -1) {
14150
0
        return -1;
14151
0
    }
14152
0
    if (isinstance) {
14153
0
        unaryop_ty op;
14154
0
        expr_ty operand;
14155
14156
0
        if (PyObject_GetOptionalAttr(obj, state->op, &tmp) < 0) {
14157
0
            return -1;
14158
0
        }
14159
0
        if (tmp == NULL) {
14160
0
            PyErr_SetString(PyExc_TypeError, "required field \"op\" missing from UnaryOp");
14161
0
            return -1;
14162
0
        }
14163
0
        else {
14164
0
            int res;
14165
0
            if (_Py_EnterRecursiveCall(" while traversing 'UnaryOp' node")) {
14166
0
                goto failed;
14167
0
            }
14168
0
            res = obj2ast_unaryop(state, tmp, &op, arena);
14169
0
            _Py_LeaveRecursiveCall();
14170
0
            if (res != 0) goto failed;
14171
0
            Py_CLEAR(tmp);
14172
0
        }
14173
0
        if (PyObject_GetOptionalAttr(obj, state->operand, &tmp) < 0) {
14174
0
            return -1;
14175
0
        }
14176
0
        if (tmp == NULL) {
14177
0
            PyErr_SetString(PyExc_TypeError, "required field \"operand\" missing from UnaryOp");
14178
0
            return -1;
14179
0
        }
14180
0
        else {
14181
0
            int res;
14182
0
            if (_Py_EnterRecursiveCall(" while traversing 'UnaryOp' node")) {
14183
0
                goto failed;
14184
0
            }
14185
0
            res = obj2ast_expr(state, tmp, &operand, arena);
14186
0
            _Py_LeaveRecursiveCall();
14187
0
            if (res != 0) goto failed;
14188
0
            Py_CLEAR(tmp);
14189
0
        }
14190
0
        *out = _PyAST_UnaryOp(op, operand, lineno, col_offset, end_lineno,
14191
0
                              end_col_offset, arena);
14192
0
        if (*out == NULL) goto failed;
14193
0
        return 0;
14194
0
    }
14195
0
    tp = state->Lambda_type;
14196
0
    isinstance = PyObject_IsInstance(obj, tp);
14197
0
    if (isinstance == -1) {
14198
0
        return -1;
14199
0
    }
14200
0
    if (isinstance) {
14201
0
        arguments_ty args;
14202
0
        expr_ty body;
14203
14204
0
        if (PyObject_GetOptionalAttr(obj, state->args, &tmp) < 0) {
14205
0
            return -1;
14206
0
        }
14207
0
        if (tmp == NULL) {
14208
0
            PyErr_SetString(PyExc_TypeError, "required field \"args\" missing from Lambda");
14209
0
            return -1;
14210
0
        }
14211
0
        else {
14212
0
            int res;
14213
0
            if (_Py_EnterRecursiveCall(" while traversing 'Lambda' node")) {
14214
0
                goto failed;
14215
0
            }
14216
0
            res = obj2ast_arguments(state, tmp, &args, arena);
14217
0
            _Py_LeaveRecursiveCall();
14218
0
            if (res != 0) goto failed;
14219
0
            Py_CLEAR(tmp);
14220
0
        }
14221
0
        if (PyObject_GetOptionalAttr(obj, state->body, &tmp) < 0) {
14222
0
            return -1;
14223
0
        }
14224
0
        if (tmp == NULL) {
14225
0
            PyErr_SetString(PyExc_TypeError, "required field \"body\" missing from Lambda");
14226
0
            return -1;
14227
0
        }
14228
0
        else {
14229
0
            int res;
14230
0
            if (_Py_EnterRecursiveCall(" while traversing 'Lambda' node")) {
14231
0
                goto failed;
14232
0
            }
14233
0
            res = obj2ast_expr(state, tmp, &body, arena);
14234
0
            _Py_LeaveRecursiveCall();
14235
0
            if (res != 0) goto failed;
14236
0
            Py_CLEAR(tmp);
14237
0
        }
14238
0
        *out = _PyAST_Lambda(args, body, lineno, col_offset, end_lineno,
14239
0
                             end_col_offset, arena);
14240
0
        if (*out == NULL) goto failed;
14241
0
        return 0;
14242
0
    }
14243
0
    tp = state->IfExp_type;
14244
0
    isinstance = PyObject_IsInstance(obj, tp);
14245
0
    if (isinstance == -1) {
14246
0
        return -1;
14247
0
    }
14248
0
    if (isinstance) {
14249
0
        expr_ty test;
14250
0
        expr_ty body;
14251
0
        expr_ty orelse;
14252
14253
0
        if (PyObject_GetOptionalAttr(obj, state->test, &tmp) < 0) {
14254
0
            return -1;
14255
0
        }
14256
0
        if (tmp == NULL) {
14257
0
            PyErr_SetString(PyExc_TypeError, "required field \"test\" missing from IfExp");
14258
0
            return -1;
14259
0
        }
14260
0
        else {
14261
0
            int res;
14262
0
            if (_Py_EnterRecursiveCall(" while traversing 'IfExp' node")) {
14263
0
                goto failed;
14264
0
            }
14265
0
            res = obj2ast_expr(state, tmp, &test, arena);
14266
0
            _Py_LeaveRecursiveCall();
14267
0
            if (res != 0) goto failed;
14268
0
            Py_CLEAR(tmp);
14269
0
        }
14270
0
        if (PyObject_GetOptionalAttr(obj, state->body, &tmp) < 0) {
14271
0
            return -1;
14272
0
        }
14273
0
        if (tmp == NULL) {
14274
0
            PyErr_SetString(PyExc_TypeError, "required field \"body\" missing from IfExp");
14275
0
            return -1;
14276
0
        }
14277
0
        else {
14278
0
            int res;
14279
0
            if (_Py_EnterRecursiveCall(" while traversing 'IfExp' node")) {
14280
0
                goto failed;
14281
0
            }
14282
0
            res = obj2ast_expr(state, tmp, &body, arena);
14283
0
            _Py_LeaveRecursiveCall();
14284
0
            if (res != 0) goto failed;
14285
0
            Py_CLEAR(tmp);
14286
0
        }
14287
0
        if (PyObject_GetOptionalAttr(obj, state->orelse, &tmp) < 0) {
14288
0
            return -1;
14289
0
        }
14290
0
        if (tmp == NULL) {
14291
0
            PyErr_SetString(PyExc_TypeError, "required field \"orelse\" missing from IfExp");
14292
0
            return -1;
14293
0
        }
14294
0
        else {
14295
0
            int res;
14296
0
            if (_Py_EnterRecursiveCall(" while traversing 'IfExp' node")) {
14297
0
                goto failed;
14298
0
            }
14299
0
            res = obj2ast_expr(state, tmp, &orelse, arena);
14300
0
            _Py_LeaveRecursiveCall();
14301
0
            if (res != 0) goto failed;
14302
0
            Py_CLEAR(tmp);
14303
0
        }
14304
0
        *out = _PyAST_IfExp(test, body, orelse, lineno, col_offset, end_lineno,
14305
0
                            end_col_offset, arena);
14306
0
        if (*out == NULL) goto failed;
14307
0
        return 0;
14308
0
    }
14309
0
    tp = state->Dict_type;
14310
0
    isinstance = PyObject_IsInstance(obj, tp);
14311
0
    if (isinstance == -1) {
14312
0
        return -1;
14313
0
    }
14314
0
    if (isinstance) {
14315
0
        asdl_expr_seq* keys;
14316
0
        asdl_expr_seq* values;
14317
14318
0
        if (PyObject_GetOptionalAttr(obj, state->keys, &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, "Dict field \"keys\" 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
            keys = _Py_asdl_expr_seq_new(len, arena);
14337
0
            if (keys == 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 'Dict' 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, "Dict field \"keys\" changed size during iteration");
14350
0
                    goto failed;
14351
0
                }
14352
0
                asdl_seq_SET(keys, i, val);
14353
0
            }
14354
0
            Py_CLEAR(tmp);
14355
0
        }
14356
0
        if (PyObject_GetOptionalAttr(obj, state->values, &tmp) < 0) {
14357
0
            return -1;
14358
0
        }
14359
0
        if (tmp == NULL) {
14360
0
            tmp = PyList_New(0);
14361
0
            if (tmp == NULL) {
14362
0
                return -1;
14363
0
            }
14364
0
        }
14365
0
        {
14366
0
            int res;
14367
0
            Py_ssize_t len;
14368
0
            Py_ssize_t i;
14369
0
            if (!PyList_Check(tmp)) {
14370
0
                PyErr_Format(PyExc_TypeError, "Dict field \"values\" must be a list, not a %.200s", _PyType_Name(Py_TYPE(tmp)));
14371
0
                goto failed;
14372
0
            }
14373
0
            len = PyList_GET_SIZE(tmp);
14374
0
            values = _Py_asdl_expr_seq_new(len, arena);
14375
0
            if (values == NULL) goto failed;
14376
0
            for (i = 0; i < len; i++) {
14377
0
                expr_ty val;
14378
0
                PyObject *tmp2 = Py_NewRef(PyList_GET_ITEM(tmp, i));
14379
0
                if (_Py_EnterRecursiveCall(" while traversing 'Dict' node")) {
14380
0
                    goto failed;
14381
0
                }
14382
0
                res = obj2ast_expr(state, tmp2, &val, arena);
14383
0
                _Py_LeaveRecursiveCall();
14384
0
                Py_DECREF(tmp2);
14385
0
                if (res != 0) goto failed;
14386
0
                if (len != PyList_GET_SIZE(tmp)) {
14387
0
                    PyErr_SetString(PyExc_RuntimeError, "Dict field \"values\" changed size during iteration");
14388
0
                    goto failed;
14389
0
                }
14390
0
                asdl_seq_SET(values, i, val);
14391
0
            }
14392
0
            Py_CLEAR(tmp);
14393
0
        }
14394
0
        *out = _PyAST_Dict(keys, values, lineno, col_offset, end_lineno,
14395
0
                           end_col_offset, arena);
14396
0
        if (*out == NULL) goto failed;
14397
0
        return 0;
14398
0
    }
14399
0
    tp = state->Set_type;
14400
0
    isinstance = PyObject_IsInstance(obj, tp);
14401
0
    if (isinstance == -1) {
14402
0
        return -1;
14403
0
    }
14404
0
    if (isinstance) {
14405
0
        asdl_expr_seq* elts;
14406
14407
0
        if (PyObject_GetOptionalAttr(obj, state->elts, &tmp) < 0) {
14408
0
            return -1;
14409
0
        }
14410
0
        if (tmp == NULL) {
14411
0
            tmp = PyList_New(0);
14412
0
            if (tmp == NULL) {
14413
0
                return -1;
14414
0
            }
14415
0
        }
14416
0
        {
14417
0
            int res;
14418
0
            Py_ssize_t len;
14419
0
            Py_ssize_t i;
14420
0
            if (!PyList_Check(tmp)) {
14421
0
                PyErr_Format(PyExc_TypeError, "Set field \"elts\" must be a list, not a %.200s", _PyType_Name(Py_TYPE(tmp)));
14422
0
                goto failed;
14423
0
            }
14424
0
            len = PyList_GET_SIZE(tmp);
14425
0
            elts = _Py_asdl_expr_seq_new(len, arena);
14426
0
            if (elts == NULL) goto failed;
14427
0
            for (i = 0; i < len; i++) {
14428
0
                expr_ty val;
14429
0
                PyObject *tmp2 = Py_NewRef(PyList_GET_ITEM(tmp, i));
14430
0
                if (_Py_EnterRecursiveCall(" while traversing 'Set' node")) {
14431
0
                    goto failed;
14432
0
                }
14433
0
                res = obj2ast_expr(state, tmp2, &val, arena);
14434
0
                _Py_LeaveRecursiveCall();
14435
0
                Py_DECREF(tmp2);
14436
0
                if (res != 0) goto failed;
14437
0
                if (len != PyList_GET_SIZE(tmp)) {
14438
0
                    PyErr_SetString(PyExc_RuntimeError, "Set field \"elts\" changed size during iteration");
14439
0
                    goto failed;
14440
0
                }
14441
0
                asdl_seq_SET(elts, i, val);
14442
0
            }
14443
0
            Py_CLEAR(tmp);
14444
0
        }
14445
0
        *out = _PyAST_Set(elts, lineno, col_offset, end_lineno, end_col_offset,
14446
0
                          arena);
14447
0
        if (*out == NULL) goto failed;
14448
0
        return 0;
14449
0
    }
14450
0
    tp = state->ListComp_type;
14451
0
    isinstance = PyObject_IsInstance(obj, tp);
14452
0
    if (isinstance == -1) {
14453
0
        return -1;
14454
0
    }
14455
0
    if (isinstance) {
14456
0
        expr_ty elt;
14457
0
        asdl_comprehension_seq* generators;
14458
14459
0
        if (PyObject_GetOptionalAttr(obj, state->elt, &tmp) < 0) {
14460
0
            return -1;
14461
0
        }
14462
0
        if (tmp == NULL) {
14463
0
            PyErr_SetString(PyExc_TypeError, "required field \"elt\" missing from ListComp");
14464
0
            return -1;
14465
0
        }
14466
0
        else {
14467
0
            int res;
14468
0
            if (_Py_EnterRecursiveCall(" while traversing 'ListComp' node")) {
14469
0
                goto failed;
14470
0
            }
14471
0
            res = obj2ast_expr(state, tmp, &elt, arena);
14472
0
            _Py_LeaveRecursiveCall();
14473
0
            if (res != 0) goto failed;
14474
0
            Py_CLEAR(tmp);
14475
0
        }
14476
0
        if (PyObject_GetOptionalAttr(obj, state->generators, &tmp) < 0) {
14477
0
            return -1;
14478
0
        }
14479
0
        if (tmp == NULL) {
14480
0
            tmp = PyList_New(0);
14481
0
            if (tmp == NULL) {
14482
0
                return -1;
14483
0
            }
14484
0
        }
14485
0
        {
14486
0
            int res;
14487
0
            Py_ssize_t len;
14488
0
            Py_ssize_t i;
14489
0
            if (!PyList_Check(tmp)) {
14490
0
                PyErr_Format(PyExc_TypeError, "ListComp field \"generators\" must be a list, not a %.200s", _PyType_Name(Py_TYPE(tmp)));
14491
0
                goto failed;
14492
0
            }
14493
0
            len = PyList_GET_SIZE(tmp);
14494
0
            generators = _Py_asdl_comprehension_seq_new(len, arena);
14495
0
            if (generators == NULL) goto failed;
14496
0
            for (i = 0; i < len; i++) {
14497
0
                comprehension_ty val;
14498
0
                PyObject *tmp2 = Py_NewRef(PyList_GET_ITEM(tmp, i));
14499
0
                if (_Py_EnterRecursiveCall(" while traversing 'ListComp' node")) {
14500
0
                    goto failed;
14501
0
                }
14502
0
                res = obj2ast_comprehension(state, tmp2, &val, arena);
14503
0
                _Py_LeaveRecursiveCall();
14504
0
                Py_DECREF(tmp2);
14505
0
                if (res != 0) goto failed;
14506
0
                if (len != PyList_GET_SIZE(tmp)) {
14507
0
                    PyErr_SetString(PyExc_RuntimeError, "ListComp field \"generators\" changed size during iteration");
14508
0
                    goto failed;
14509
0
                }
14510
0
                asdl_seq_SET(generators, i, val);
14511
0
            }
14512
0
            Py_CLEAR(tmp);
14513
0
        }
14514
0
        *out = _PyAST_ListComp(elt, generators, lineno, col_offset, end_lineno,
14515
0
                               end_col_offset, arena);
14516
0
        if (*out == NULL) goto failed;
14517
0
        return 0;
14518
0
    }
14519
0
    tp = state->SetComp_type;
14520
0
    isinstance = PyObject_IsInstance(obj, tp);
14521
0
    if (isinstance == -1) {
14522
0
        return -1;
14523
0
    }
14524
0
    if (isinstance) {
14525
0
        expr_ty elt;
14526
0
        asdl_comprehension_seq* generators;
14527
14528
0
        if (PyObject_GetOptionalAttr(obj, state->elt, &tmp) < 0) {
14529
0
            return -1;
14530
0
        }
14531
0
        if (tmp == NULL) {
14532
0
            PyErr_SetString(PyExc_TypeError, "required field \"elt\" missing from SetComp");
14533
0
            return -1;
14534
0
        }
14535
0
        else {
14536
0
            int res;
14537
0
            if (_Py_EnterRecursiveCall(" while traversing 'SetComp' node")) {
14538
0
                goto failed;
14539
0
            }
14540
0
            res = obj2ast_expr(state, tmp, &elt, arena);
14541
0
            _Py_LeaveRecursiveCall();
14542
0
            if (res != 0) goto failed;
14543
0
            Py_CLEAR(tmp);
14544
0
        }
14545
0
        if (PyObject_GetOptionalAttr(obj, state->generators, &tmp) < 0) {
14546
0
            return -1;
14547
0
        }
14548
0
        if (tmp == NULL) {
14549
0
            tmp = PyList_New(0);
14550
0
            if (tmp == NULL) {
14551
0
                return -1;
14552
0
            }
14553
0
        }
14554
0
        {
14555
0
            int res;
14556
0
            Py_ssize_t len;
14557
0
            Py_ssize_t i;
14558
0
            if (!PyList_Check(tmp)) {
14559
0
                PyErr_Format(PyExc_TypeError, "SetComp field \"generators\" must be a list, not a %.200s", _PyType_Name(Py_TYPE(tmp)));
14560
0
                goto failed;
14561
0
            }
14562
0
            len = PyList_GET_SIZE(tmp);
14563
0
            generators = _Py_asdl_comprehension_seq_new(len, arena);
14564
0
            if (generators == NULL) goto failed;
14565
0
            for (i = 0; i < len; i++) {
14566
0
                comprehension_ty val;
14567
0
                PyObject *tmp2 = Py_NewRef(PyList_GET_ITEM(tmp, i));
14568
0
                if (_Py_EnterRecursiveCall(" while traversing 'SetComp' node")) {
14569
0
                    goto failed;
14570
0
                }
14571
0
                res = obj2ast_comprehension(state, tmp2, &val, arena);
14572
0
                _Py_LeaveRecursiveCall();
14573
0
                Py_DECREF(tmp2);
14574
0
                if (res != 0) goto failed;
14575
0
                if (len != PyList_GET_SIZE(tmp)) {
14576
0
                    PyErr_SetString(PyExc_RuntimeError, "SetComp field \"generators\" changed size during iteration");
14577
0
                    goto failed;
14578
0
                }
14579
0
                asdl_seq_SET(generators, i, val);
14580
0
            }
14581
0
            Py_CLEAR(tmp);
14582
0
        }
14583
0
        *out = _PyAST_SetComp(elt, generators, lineno, col_offset, end_lineno,
14584
0
                              end_col_offset, arena);
14585
0
        if (*out == NULL) goto failed;
14586
0
        return 0;
14587
0
    }
14588
0
    tp = state->DictComp_type;
14589
0
    isinstance = PyObject_IsInstance(obj, tp);
14590
0
    if (isinstance == -1) {
14591
0
        return -1;
14592
0
    }
14593
0
    if (isinstance) {
14594
0
        expr_ty key;
14595
0
        expr_ty value;
14596
0
        asdl_comprehension_seq* generators;
14597
14598
0
        if (PyObject_GetOptionalAttr(obj, state->key, &tmp) < 0) {
14599
0
            return -1;
14600
0
        }
14601
0
        if (tmp == NULL) {
14602
0
            PyErr_SetString(PyExc_TypeError, "required field \"key\" missing from DictComp");
14603
0
            return -1;
14604
0
        }
14605
0
        else {
14606
0
            int res;
14607
0
            if (_Py_EnterRecursiveCall(" while traversing 'DictComp' node")) {
14608
0
                goto failed;
14609
0
            }
14610
0
            res = obj2ast_expr(state, tmp, &key, arena);
14611
0
            _Py_LeaveRecursiveCall();
14612
0
            if (res != 0) goto failed;
14613
0
            Py_CLEAR(tmp);
14614
0
        }
14615
0
        if (PyObject_GetOptionalAttr(obj, state->value, &tmp) < 0) {
14616
0
            return -1;
14617
0
        }
14618
0
        if (tmp == NULL || tmp == Py_None) {
14619
0
            Py_CLEAR(tmp);
14620
0
            value = NULL;
14621
0
        }
14622
0
        else {
14623
0
            int res;
14624
0
            if (_Py_EnterRecursiveCall(" while traversing 'DictComp' node")) {
14625
0
                goto failed;
14626
0
            }
14627
0
            res = obj2ast_expr(state, tmp, &value, arena);
14628
0
            _Py_LeaveRecursiveCall();
14629
0
            if (res != 0) goto failed;
14630
0
            Py_CLEAR(tmp);
14631
0
        }
14632
0
        if (PyObject_GetOptionalAttr(obj, state->generators, &tmp) < 0) {
14633
0
            return -1;
14634
0
        }
14635
0
        if (tmp == NULL) {
14636
0
            tmp = PyList_New(0);
14637
0
            if (tmp == NULL) {
14638
0
                return -1;
14639
0
            }
14640
0
        }
14641
0
        {
14642
0
            int res;
14643
0
            Py_ssize_t len;
14644
0
            Py_ssize_t i;
14645
0
            if (!PyList_Check(tmp)) {
14646
0
                PyErr_Format(PyExc_TypeError, "DictComp field \"generators\" must be a list, not a %.200s", _PyType_Name(Py_TYPE(tmp)));
14647
0
                goto failed;
14648
0
            }
14649
0
            len = PyList_GET_SIZE(tmp);
14650
0
            generators = _Py_asdl_comprehension_seq_new(len, arena);
14651
0
            if (generators == NULL) goto failed;
14652
0
            for (i = 0; i < len; i++) {
14653
0
                comprehension_ty val;
14654
0
                PyObject *tmp2 = Py_NewRef(PyList_GET_ITEM(tmp, i));
14655
0
                if (_Py_EnterRecursiveCall(" while traversing 'DictComp' node")) {
14656
0
                    goto failed;
14657
0
                }
14658
0
                res = obj2ast_comprehension(state, tmp2, &val, arena);
14659
0
                _Py_LeaveRecursiveCall();
14660
0
                Py_DECREF(tmp2);
14661
0
                if (res != 0) goto failed;
14662
0
                if (len != PyList_GET_SIZE(tmp)) {
14663
0
                    PyErr_SetString(PyExc_RuntimeError, "DictComp field \"generators\" changed size during iteration");
14664
0
                    goto failed;
14665
0
                }
14666
0
                asdl_seq_SET(generators, i, val);
14667
0
            }
14668
0
            Py_CLEAR(tmp);
14669
0
        }
14670
0
        *out = _PyAST_DictComp(key, value, generators, lineno, col_offset,
14671
0
                               end_lineno, end_col_offset, arena);
14672
0
        if (*out == NULL) goto failed;
14673
0
        return 0;
14674
0
    }
14675
0
    tp = state->GeneratorExp_type;
14676
0
    isinstance = PyObject_IsInstance(obj, tp);
14677
0
    if (isinstance == -1) {
14678
0
        return -1;
14679
0
    }
14680
0
    if (isinstance) {
14681
0
        expr_ty elt;
14682
0
        asdl_comprehension_seq* generators;
14683
14684
0
        if (PyObject_GetOptionalAttr(obj, state->elt, &tmp) < 0) {
14685
0
            return -1;
14686
0
        }
14687
0
        if (tmp == NULL) {
14688
0
            PyErr_SetString(PyExc_TypeError, "required field \"elt\" missing from GeneratorExp");
14689
0
            return -1;
14690
0
        }
14691
0
        else {
14692
0
            int res;
14693
0
            if (_Py_EnterRecursiveCall(" while traversing 'GeneratorExp' node")) {
14694
0
                goto failed;
14695
0
            }
14696
0
            res = obj2ast_expr(state, tmp, &elt, arena);
14697
0
            _Py_LeaveRecursiveCall();
14698
0
            if (res != 0) goto failed;
14699
0
            Py_CLEAR(tmp);
14700
0
        }
14701
0
        if (PyObject_GetOptionalAttr(obj, state->generators, &tmp) < 0) {
14702
0
            return -1;
14703
0
        }
14704
0
        if (tmp == NULL) {
14705
0
            tmp = PyList_New(0);
14706
0
            if (tmp == NULL) {
14707
0
                return -1;
14708
0
            }
14709
0
        }
14710
0
        {
14711
0
            int res;
14712
0
            Py_ssize_t len;
14713
0
            Py_ssize_t i;
14714
0
            if (!PyList_Check(tmp)) {
14715
0
                PyErr_Format(PyExc_TypeError, "GeneratorExp field \"generators\" must be a list, not a %.200s", _PyType_Name(Py_TYPE(tmp)));
14716
0
                goto failed;
14717
0
            }
14718
0
            len = PyList_GET_SIZE(tmp);
14719
0
            generators = _Py_asdl_comprehension_seq_new(len, arena);
14720
0
            if (generators == NULL) goto failed;
14721
0
            for (i = 0; i < len; i++) {
14722
0
                comprehension_ty val;
14723
0
                PyObject *tmp2 = Py_NewRef(PyList_GET_ITEM(tmp, i));
14724
0
                if (_Py_EnterRecursiveCall(" while traversing 'GeneratorExp' node")) {
14725
0
                    goto failed;
14726
0
                }
14727
0
                res = obj2ast_comprehension(state, tmp2, &val, arena);
14728
0
                _Py_LeaveRecursiveCall();
14729
0
                Py_DECREF(tmp2);
14730
0
                if (res != 0) goto failed;
14731
0
                if (len != PyList_GET_SIZE(tmp)) {
14732
0
                    PyErr_SetString(PyExc_RuntimeError, "GeneratorExp field \"generators\" changed size during iteration");
14733
0
                    goto failed;
14734
0
                }
14735
0
                asdl_seq_SET(generators, i, val);
14736
0
            }
14737
0
            Py_CLEAR(tmp);
14738
0
        }
14739
0
        *out = _PyAST_GeneratorExp(elt, generators, lineno, col_offset,
14740
0
                                   end_lineno, end_col_offset, arena);
14741
0
        if (*out == NULL) goto failed;
14742
0
        return 0;
14743
0
    }
14744
0
    tp = state->Await_type;
14745
0
    isinstance = PyObject_IsInstance(obj, tp);
14746
0
    if (isinstance == -1) {
14747
0
        return -1;
14748
0
    }
14749
0
    if (isinstance) {
14750
0
        expr_ty value;
14751
14752
0
        if (PyObject_GetOptionalAttr(obj, state->value, &tmp) < 0) {
14753
0
            return -1;
14754
0
        }
14755
0
        if (tmp == NULL) {
14756
0
            PyErr_SetString(PyExc_TypeError, "required field \"value\" missing from Await");
14757
0
            return -1;
14758
0
        }
14759
0
        else {
14760
0
            int res;
14761
0
            if (_Py_EnterRecursiveCall(" while traversing 'Await' node")) {
14762
0
                goto failed;
14763
0
            }
14764
0
            res = obj2ast_expr(state, tmp, &value, arena);
14765
0
            _Py_LeaveRecursiveCall();
14766
0
            if (res != 0) goto failed;
14767
0
            Py_CLEAR(tmp);
14768
0
        }
14769
0
        *out = _PyAST_Await(value, lineno, col_offset, end_lineno,
14770
0
                            end_col_offset, arena);
14771
0
        if (*out == NULL) goto failed;
14772
0
        return 0;
14773
0
    }
14774
0
    tp = state->Yield_type;
14775
0
    isinstance = PyObject_IsInstance(obj, tp);
14776
0
    if (isinstance == -1) {
14777
0
        return -1;
14778
0
    }
14779
0
    if (isinstance) {
14780
0
        expr_ty value;
14781
14782
0
        if (PyObject_GetOptionalAttr(obj, state->value, &tmp) < 0) {
14783
0
            return -1;
14784
0
        }
14785
0
        if (tmp == NULL || tmp == Py_None) {
14786
0
            Py_CLEAR(tmp);
14787
0
            value = NULL;
14788
0
        }
14789
0
        else {
14790
0
            int res;
14791
0
            if (_Py_EnterRecursiveCall(" while traversing 'Yield' node")) {
14792
0
                goto failed;
14793
0
            }
14794
0
            res = obj2ast_expr(state, tmp, &value, arena);
14795
0
            _Py_LeaveRecursiveCall();
14796
0
            if (res != 0) goto failed;
14797
0
            Py_CLEAR(tmp);
14798
0
        }
14799
0
        *out = _PyAST_Yield(value, lineno, col_offset, end_lineno,
14800
0
                            end_col_offset, arena);
14801
0
        if (*out == NULL) goto failed;
14802
0
        return 0;
14803
0
    }
14804
0
    tp = state->YieldFrom_type;
14805
0
    isinstance = PyObject_IsInstance(obj, tp);
14806
0
    if (isinstance == -1) {
14807
0
        return -1;
14808
0
    }
14809
0
    if (isinstance) {
14810
0
        expr_ty value;
14811
14812
0
        if (PyObject_GetOptionalAttr(obj, state->value, &tmp) < 0) {
14813
0
            return -1;
14814
0
        }
14815
0
        if (tmp == NULL) {
14816
0
            PyErr_SetString(PyExc_TypeError, "required field \"value\" missing from YieldFrom");
14817
0
            return -1;
14818
0
        }
14819
0
        else {
14820
0
            int res;
14821
0
            if (_Py_EnterRecursiveCall(" while traversing 'YieldFrom' node")) {
14822
0
                goto failed;
14823
0
            }
14824
0
            res = obj2ast_expr(state, tmp, &value, arena);
14825
0
            _Py_LeaveRecursiveCall();
14826
0
            if (res != 0) goto failed;
14827
0
            Py_CLEAR(tmp);
14828
0
        }
14829
0
        *out = _PyAST_YieldFrom(value, lineno, col_offset, end_lineno,
14830
0
                                end_col_offset, arena);
14831
0
        if (*out == NULL) goto failed;
14832
0
        return 0;
14833
0
    }
14834
0
    tp = state->Compare_type;
14835
0
    isinstance = PyObject_IsInstance(obj, tp);
14836
0
    if (isinstance == -1) {
14837
0
        return -1;
14838
0
    }
14839
0
    if (isinstance) {
14840
0
        expr_ty left;
14841
0
        asdl_int_seq* ops;
14842
0
        asdl_expr_seq* comparators;
14843
14844
0
        if (PyObject_GetOptionalAttr(obj, state->left, &tmp) < 0) {
14845
0
            return -1;
14846
0
        }
14847
0
        if (tmp == NULL) {
14848
0
            PyErr_SetString(PyExc_TypeError, "required field \"left\" missing from Compare");
14849
0
            return -1;
14850
0
        }
14851
0
        else {
14852
0
            int res;
14853
0
            if (_Py_EnterRecursiveCall(" while traversing 'Compare' node")) {
14854
0
                goto failed;
14855
0
            }
14856
0
            res = obj2ast_expr(state, tmp, &left, arena);
14857
0
            _Py_LeaveRecursiveCall();
14858
0
            if (res != 0) goto failed;
14859
0
            Py_CLEAR(tmp);
14860
0
        }
14861
0
        if (PyObject_GetOptionalAttr(obj, state->ops, &tmp) < 0) {
14862
0
            return -1;
14863
0
        }
14864
0
        if (tmp == NULL) {
14865
0
            tmp = PyList_New(0);
14866
0
            if (tmp == NULL) {
14867
0
                return -1;
14868
0
            }
14869
0
        }
14870
0
        {
14871
0
            int res;
14872
0
            Py_ssize_t len;
14873
0
            Py_ssize_t i;
14874
0
            if (!PyList_Check(tmp)) {
14875
0
                PyErr_Format(PyExc_TypeError, "Compare field \"ops\" must be a list, not a %.200s", _PyType_Name(Py_TYPE(tmp)));
14876
0
                goto failed;
14877
0
            }
14878
0
            len = PyList_GET_SIZE(tmp);
14879
0
            ops = _Py_asdl_int_seq_new(len, arena);
14880
0
            if (ops == NULL) goto failed;
14881
0
            for (i = 0; i < len; i++) {
14882
0
                cmpop_ty val;
14883
0
                PyObject *tmp2 = Py_NewRef(PyList_GET_ITEM(tmp, i));
14884
0
                if (_Py_EnterRecursiveCall(" while traversing 'Compare' node")) {
14885
0
                    goto failed;
14886
0
                }
14887
0
                res = obj2ast_cmpop(state, tmp2, &val, arena);
14888
0
                _Py_LeaveRecursiveCall();
14889
0
                Py_DECREF(tmp2);
14890
0
                if (res != 0) goto failed;
14891
0
                if (len != PyList_GET_SIZE(tmp)) {
14892
0
                    PyErr_SetString(PyExc_RuntimeError, "Compare field \"ops\" changed size during iteration");
14893
0
                    goto failed;
14894
0
                }
14895
0
                asdl_seq_SET(ops, i, val);
14896
0
            }
14897
0
            Py_CLEAR(tmp);
14898
0
        }
14899
0
        if (PyObject_GetOptionalAttr(obj, state->comparators, &tmp) < 0) {
14900
0
            return -1;
14901
0
        }
14902
0
        if (tmp == NULL) {
14903
0
            tmp = PyList_New(0);
14904
0
            if (tmp == NULL) {
14905
0
                return -1;
14906
0
            }
14907
0
        }
14908
0
        {
14909
0
            int res;
14910
0
            Py_ssize_t len;
14911
0
            Py_ssize_t i;
14912
0
            if (!PyList_Check(tmp)) {
14913
0
                PyErr_Format(PyExc_TypeError, "Compare field \"comparators\" must be a list, not a %.200s", _PyType_Name(Py_TYPE(tmp)));
14914
0
                goto failed;
14915
0
            }
14916
0
            len = PyList_GET_SIZE(tmp);
14917
0
            comparators = _Py_asdl_expr_seq_new(len, arena);
14918
0
            if (comparators == NULL) goto failed;
14919
0
            for (i = 0; i < len; i++) {
14920
0
                expr_ty val;
14921
0
                PyObject *tmp2 = Py_NewRef(PyList_GET_ITEM(tmp, i));
14922
0
                if (_Py_EnterRecursiveCall(" while traversing 'Compare' node")) {
14923
0
                    goto failed;
14924
0
                }
14925
0
                res = obj2ast_expr(state, tmp2, &val, arena);
14926
0
                _Py_LeaveRecursiveCall();
14927
0
                Py_DECREF(tmp2);
14928
0
                if (res != 0) goto failed;
14929
0
                if (len != PyList_GET_SIZE(tmp)) {
14930
0
                    PyErr_SetString(PyExc_RuntimeError, "Compare field \"comparators\" changed size during iteration");
14931
0
                    goto failed;
14932
0
                }
14933
0
                asdl_seq_SET(comparators, i, val);
14934
0
            }
14935
0
            Py_CLEAR(tmp);
14936
0
        }
14937
0
        *out = _PyAST_Compare(left, ops, comparators, lineno, col_offset,
14938
0
                              end_lineno, end_col_offset, arena);
14939
0
        if (*out == NULL) goto failed;
14940
0
        return 0;
14941
0
    }
14942
0
    tp = state->Call_type;
14943
0
    isinstance = PyObject_IsInstance(obj, tp);
14944
0
    if (isinstance == -1) {
14945
0
        return -1;
14946
0
    }
14947
0
    if (isinstance) {
14948
0
        expr_ty func;
14949
0
        asdl_expr_seq* args;
14950
0
        asdl_keyword_seq* keywords;
14951
14952
0
        if (PyObject_GetOptionalAttr(obj, state->func, &tmp) < 0) {
14953
0
            return -1;
14954
0
        }
14955
0
        if (tmp == NULL) {
14956
0
            PyErr_SetString(PyExc_TypeError, "required field \"func\" missing from Call");
14957
0
            return -1;
14958
0
        }
14959
0
        else {
14960
0
            int res;
14961
0
            if (_Py_EnterRecursiveCall(" while traversing 'Call' node")) {
14962
0
                goto failed;
14963
0
            }
14964
0
            res = obj2ast_expr(state, tmp, &func, arena);
14965
0
            _Py_LeaveRecursiveCall();
14966
0
            if (res != 0) goto failed;
14967
0
            Py_CLEAR(tmp);
14968
0
        }
14969
0
        if (PyObject_GetOptionalAttr(obj, state->args, &tmp) < 0) {
14970
0
            return -1;
14971
0
        }
14972
0
        if (tmp == NULL) {
14973
0
            tmp = PyList_New(0);
14974
0
            if (tmp == NULL) {
14975
0
                return -1;
14976
0
            }
14977
0
        }
14978
0
        {
14979
0
            int res;
14980
0
            Py_ssize_t len;
14981
0
            Py_ssize_t i;
14982
0
            if (!PyList_Check(tmp)) {
14983
0
                PyErr_Format(PyExc_TypeError, "Call field \"args\" must be a list, not a %.200s", _PyType_Name(Py_TYPE(tmp)));
14984
0
                goto failed;
14985
0
            }
14986
0
            len = PyList_GET_SIZE(tmp);
14987
0
            args = _Py_asdl_expr_seq_new(len, arena);
14988
0
            if (args == NULL) goto failed;
14989
0
            for (i = 0; i < len; i++) {
14990
0
                expr_ty val;
14991
0
                PyObject *tmp2 = Py_NewRef(PyList_GET_ITEM(tmp, i));
14992
0
                if (_Py_EnterRecursiveCall(" while traversing 'Call' node")) {
14993
0
                    goto failed;
14994
0
                }
14995
0
                res = obj2ast_expr(state, tmp2, &val, arena);
14996
0
                _Py_LeaveRecursiveCall();
14997
0
                Py_DECREF(tmp2);
14998
0
                if (res != 0) goto failed;
14999
0
                if (len != PyList_GET_SIZE(tmp)) {
15000
0
                    PyErr_SetString(PyExc_RuntimeError, "Call field \"args\" changed size during iteration");
15001
0
                    goto failed;
15002
0
                }
15003
0
                asdl_seq_SET(args, i, val);
15004
0
            }
15005
0
            Py_CLEAR(tmp);
15006
0
        }
15007
0
        if (PyObject_GetOptionalAttr(obj, state->keywords, &tmp) < 0) {
15008
0
            return -1;
15009
0
        }
15010
0
        if (tmp == NULL) {
15011
0
            tmp = PyList_New(0);
15012
0
            if (tmp == NULL) {
15013
0
                return -1;
15014
0
            }
15015
0
        }
15016
0
        {
15017
0
            int res;
15018
0
            Py_ssize_t len;
15019
0
            Py_ssize_t i;
15020
0
            if (!PyList_Check(tmp)) {
15021
0
                PyErr_Format(PyExc_TypeError, "Call field \"keywords\" must be a list, not a %.200s", _PyType_Name(Py_TYPE(tmp)));
15022
0
                goto failed;
15023
0
            }
15024
0
            len = PyList_GET_SIZE(tmp);
15025
0
            keywords = _Py_asdl_keyword_seq_new(len, arena);
15026
0
            if (keywords == NULL) goto failed;
15027
0
            for (i = 0; i < len; i++) {
15028
0
                keyword_ty val;
15029
0
                PyObject *tmp2 = Py_NewRef(PyList_GET_ITEM(tmp, i));
15030
0
                if (_Py_EnterRecursiveCall(" while traversing 'Call' node")) {
15031
0
                    goto failed;
15032
0
                }
15033
0
                res = obj2ast_keyword(state, tmp2, &val, arena);
15034
0
                _Py_LeaveRecursiveCall();
15035
0
                Py_DECREF(tmp2);
15036
0
                if (res != 0) goto failed;
15037
0
                if (len != PyList_GET_SIZE(tmp)) {
15038
0
                    PyErr_SetString(PyExc_RuntimeError, "Call field \"keywords\" changed size during iteration");
15039
0
                    goto failed;
15040
0
                }
15041
0
                asdl_seq_SET(keywords, i, val);
15042
0
            }
15043
0
            Py_CLEAR(tmp);
15044
0
        }
15045
0
        *out = _PyAST_Call(func, args, keywords, lineno, col_offset,
15046
0
                           end_lineno, end_col_offset, arena);
15047
0
        if (*out == NULL) goto failed;
15048
0
        return 0;
15049
0
    }
15050
0
    tp = state->FormattedValue_type;
15051
0
    isinstance = PyObject_IsInstance(obj, tp);
15052
0
    if (isinstance == -1) {
15053
0
        return -1;
15054
0
    }
15055
0
    if (isinstance) {
15056
0
        expr_ty value;
15057
0
        int conversion;
15058
0
        expr_ty format_spec;
15059
15060
0
        if (PyObject_GetOptionalAttr(obj, state->value, &tmp) < 0) {
15061
0
            return -1;
15062
0
        }
15063
0
        if (tmp == NULL) {
15064
0
            PyErr_SetString(PyExc_TypeError, "required field \"value\" missing from FormattedValue");
15065
0
            return -1;
15066
0
        }
15067
0
        else {
15068
0
            int res;
15069
0
            if (_Py_EnterRecursiveCall(" while traversing 'FormattedValue' node")) {
15070
0
                goto failed;
15071
0
            }
15072
0
            res = obj2ast_expr(state, tmp, &value, arena);
15073
0
            _Py_LeaveRecursiveCall();
15074
0
            if (res != 0) goto failed;
15075
0
            Py_CLEAR(tmp);
15076
0
        }
15077
0
        if (PyObject_GetOptionalAttr(obj, state->conversion, &tmp) < 0) {
15078
0
            return -1;
15079
0
        }
15080
0
        if (tmp == NULL) {
15081
0
            PyErr_SetString(PyExc_TypeError, "required field \"conversion\" missing from FormattedValue");
15082
0
            return -1;
15083
0
        }
15084
0
        else {
15085
0
            int res;
15086
0
            if (_Py_EnterRecursiveCall(" while traversing 'FormattedValue' node")) {
15087
0
                goto failed;
15088
0
            }
15089
0
            res = obj2ast_int(state, tmp, &conversion, arena);
15090
0
            _Py_LeaveRecursiveCall();
15091
0
            if (res != 0) goto failed;
15092
0
            Py_CLEAR(tmp);
15093
0
        }
15094
0
        if (PyObject_GetOptionalAttr(obj, state->format_spec, &tmp) < 0) {
15095
0
            return -1;
15096
0
        }
15097
0
        if (tmp == NULL || tmp == Py_None) {
15098
0
            Py_CLEAR(tmp);
15099
0
            format_spec = NULL;
15100
0
        }
15101
0
        else {
15102
0
            int res;
15103
0
            if (_Py_EnterRecursiveCall(" while traversing 'FormattedValue' node")) {
15104
0
                goto failed;
15105
0
            }
15106
0
            res = obj2ast_expr(state, tmp, &format_spec, arena);
15107
0
            _Py_LeaveRecursiveCall();
15108
0
            if (res != 0) goto failed;
15109
0
            Py_CLEAR(tmp);
15110
0
        }
15111
0
        *out = _PyAST_FormattedValue(value, conversion, format_spec, lineno,
15112
0
                                     col_offset, end_lineno, end_col_offset,
15113
0
                                     arena);
15114
0
        if (*out == NULL) goto failed;
15115
0
        return 0;
15116
0
    }
15117
0
    tp = state->Interpolation_type;
15118
0
    isinstance = PyObject_IsInstance(obj, tp);
15119
0
    if (isinstance == -1) {
15120
0
        return -1;
15121
0
    }
15122
0
    if (isinstance) {
15123
0
        expr_ty value;
15124
0
        constant str;
15125
0
        int conversion;
15126
0
        expr_ty format_spec;
15127
15128
0
        if (PyObject_GetOptionalAttr(obj, state->value, &tmp) < 0) {
15129
0
            return -1;
15130
0
        }
15131
0
        if (tmp == NULL) {
15132
0
            PyErr_SetString(PyExc_TypeError, "required field \"value\" missing from Interpolation");
15133
0
            return -1;
15134
0
        }
15135
0
        else {
15136
0
            int res;
15137
0
            if (_Py_EnterRecursiveCall(" while traversing 'Interpolation' node")) {
15138
0
                goto failed;
15139
0
            }
15140
0
            res = obj2ast_expr(state, tmp, &value, arena);
15141
0
            _Py_LeaveRecursiveCall();
15142
0
            if (res != 0) goto failed;
15143
0
            Py_CLEAR(tmp);
15144
0
        }
15145
0
        if (PyObject_GetOptionalAttr(obj, state->str, &tmp) < 0) {
15146
0
            return -1;
15147
0
        }
15148
0
        if (tmp == NULL) {
15149
0
            PyErr_SetString(PyExc_TypeError, "required field \"str\" missing from Interpolation");
15150
0
            return -1;
15151
0
        }
15152
0
        else {
15153
0
            int res;
15154
0
            if (_Py_EnterRecursiveCall(" while traversing 'Interpolation' node")) {
15155
0
                goto failed;
15156
0
            }
15157
0
            res = obj2ast_constant(state, tmp, &str, arena);
15158
0
            _Py_LeaveRecursiveCall();
15159
0
            if (res != 0) goto failed;
15160
0
            Py_CLEAR(tmp);
15161
0
        }
15162
0
        if (PyObject_GetOptionalAttr(obj, state->conversion, &tmp) < 0) {
15163
0
            return -1;
15164
0
        }
15165
0
        if (tmp == NULL) {
15166
0
            PyErr_SetString(PyExc_TypeError, "required field \"conversion\" missing from Interpolation");
15167
0
            return -1;
15168
0
        }
15169
0
        else {
15170
0
            int res;
15171
0
            if (_Py_EnterRecursiveCall(" while traversing 'Interpolation' node")) {
15172
0
                goto failed;
15173
0
            }
15174
0
            res = obj2ast_int(state, tmp, &conversion, arena);
15175
0
            _Py_LeaveRecursiveCall();
15176
0
            if (res != 0) goto failed;
15177
0
            Py_CLEAR(tmp);
15178
0
        }
15179
0
        if (PyObject_GetOptionalAttr(obj, state->format_spec, &tmp) < 0) {
15180
0
            return -1;
15181
0
        }
15182
0
        if (tmp == NULL || tmp == Py_None) {
15183
0
            Py_CLEAR(tmp);
15184
0
            format_spec = NULL;
15185
0
        }
15186
0
        else {
15187
0
            int res;
15188
0
            if (_Py_EnterRecursiveCall(" while traversing 'Interpolation' node")) {
15189
0
                goto failed;
15190
0
            }
15191
0
            res = obj2ast_expr(state, tmp, &format_spec, arena);
15192
0
            _Py_LeaveRecursiveCall();
15193
0
            if (res != 0) goto failed;
15194
0
            Py_CLEAR(tmp);
15195
0
        }
15196
0
        *out = _PyAST_Interpolation(value, str, conversion, format_spec,
15197
0
                                    lineno, col_offset, end_lineno,
15198
0
                                    end_col_offset, arena);
15199
0
        if (*out == NULL) goto failed;
15200
0
        return 0;
15201
0
    }
15202
0
    tp = state->JoinedStr_type;
15203
0
    isinstance = PyObject_IsInstance(obj, tp);
15204
0
    if (isinstance == -1) {
15205
0
        return -1;
15206
0
    }
15207
0
    if (isinstance) {
15208
0
        asdl_expr_seq* values;
15209
15210
0
        if (PyObject_GetOptionalAttr(obj, state->values, &tmp) < 0) {
15211
0
            return -1;
15212
0
        }
15213
0
        if (tmp == NULL) {
15214
0
            tmp = PyList_New(0);
15215
0
            if (tmp == NULL) {
15216
0
                return -1;
15217
0
            }
15218
0
        }
15219
0
        {
15220
0
            int res;
15221
0
            Py_ssize_t len;
15222
0
            Py_ssize_t i;
15223
0
            if (!PyList_Check(tmp)) {
15224
0
                PyErr_Format(PyExc_TypeError, "JoinedStr field \"values\" must be a list, not a %.200s", _PyType_Name(Py_TYPE(tmp)));
15225
0
                goto failed;
15226
0
            }
15227
0
            len = PyList_GET_SIZE(tmp);
15228
0
            values = _Py_asdl_expr_seq_new(len, arena);
15229
0
            if (values == NULL) goto failed;
15230
0
            for (i = 0; i < len; i++) {
15231
0
                expr_ty val;
15232
0
                PyObject *tmp2 = Py_NewRef(PyList_GET_ITEM(tmp, i));
15233
0
                if (_Py_EnterRecursiveCall(" while traversing 'JoinedStr' node")) {
15234
0
                    goto failed;
15235
0
                }
15236
0
                res = obj2ast_expr(state, tmp2, &val, arena);
15237
0
                _Py_LeaveRecursiveCall();
15238
0
                Py_DECREF(tmp2);
15239
0
                if (res != 0) goto failed;
15240
0
                if (len != PyList_GET_SIZE(tmp)) {
15241
0
                    PyErr_SetString(PyExc_RuntimeError, "JoinedStr field \"values\" changed size during iteration");
15242
0
                    goto failed;
15243
0
                }
15244
0
                asdl_seq_SET(values, i, val);
15245
0
            }
15246
0
            Py_CLEAR(tmp);
15247
0
        }
15248
0
        *out = _PyAST_JoinedStr(values, lineno, col_offset, end_lineno,
15249
0
                                end_col_offset, arena);
15250
0
        if (*out == NULL) goto failed;
15251
0
        return 0;
15252
0
    }
15253
0
    tp = state->TemplateStr_type;
15254
0
    isinstance = PyObject_IsInstance(obj, tp);
15255
0
    if (isinstance == -1) {
15256
0
        return -1;
15257
0
    }
15258
0
    if (isinstance) {
15259
0
        asdl_expr_seq* values;
15260
15261
0
        if (PyObject_GetOptionalAttr(obj, state->values, &tmp) < 0) {
15262
0
            return -1;
15263
0
        }
15264
0
        if (tmp == NULL) {
15265
0
            tmp = PyList_New(0);
15266
0
            if (tmp == NULL) {
15267
0
                return -1;
15268
0
            }
15269
0
        }
15270
0
        {
15271
0
            int res;
15272
0
            Py_ssize_t len;
15273
0
            Py_ssize_t i;
15274
0
            if (!PyList_Check(tmp)) {
15275
0
                PyErr_Format(PyExc_TypeError, "TemplateStr field \"values\" must be a list, not a %.200s", _PyType_Name(Py_TYPE(tmp)));
15276
0
                goto failed;
15277
0
            }
15278
0
            len = PyList_GET_SIZE(tmp);
15279
0
            values = _Py_asdl_expr_seq_new(len, arena);
15280
0
            if (values == NULL) goto failed;
15281
0
            for (i = 0; i < len; i++) {
15282
0
                expr_ty val;
15283
0
                PyObject *tmp2 = Py_NewRef(PyList_GET_ITEM(tmp, i));
15284
0
                if (_Py_EnterRecursiveCall(" while traversing 'TemplateStr' node")) {
15285
0
                    goto failed;
15286
0
                }
15287
0
                res = obj2ast_expr(state, tmp2, &val, arena);
15288
0
                _Py_LeaveRecursiveCall();
15289
0
                Py_DECREF(tmp2);
15290
0
                if (res != 0) goto failed;
15291
0
                if (len != PyList_GET_SIZE(tmp)) {
15292
0
                    PyErr_SetString(PyExc_RuntimeError, "TemplateStr field \"values\" changed size during iteration");
15293
0
                    goto failed;
15294
0
                }
15295
0
                asdl_seq_SET(values, i, val);
15296
0
            }
15297
0
            Py_CLEAR(tmp);
15298
0
        }
15299
0
        *out = _PyAST_TemplateStr(values, lineno, col_offset, end_lineno,
15300
0
                                  end_col_offset, arena);
15301
0
        if (*out == NULL) goto failed;
15302
0
        return 0;
15303
0
    }
15304
0
    tp = state->Constant_type;
15305
0
    isinstance = PyObject_IsInstance(obj, tp);
15306
0
    if (isinstance == -1) {
15307
0
        return -1;
15308
0
    }
15309
0
    if (isinstance) {
15310
0
        constant value;
15311
0
        string kind;
15312
15313
0
        if (PyObject_GetOptionalAttr(obj, state->value, &tmp) < 0) {
15314
0
            return -1;
15315
0
        }
15316
0
        if (tmp == NULL) {
15317
0
            PyErr_SetString(PyExc_TypeError, "required field \"value\" missing from Constant");
15318
0
            return -1;
15319
0
        }
15320
0
        else {
15321
0
            int res;
15322
0
            if (_Py_EnterRecursiveCall(" while traversing 'Constant' node")) {
15323
0
                goto failed;
15324
0
            }
15325
0
            res = obj2ast_constant(state, tmp, &value, arena);
15326
0
            _Py_LeaveRecursiveCall();
15327
0
            if (res != 0) goto failed;
15328
0
            Py_CLEAR(tmp);
15329
0
        }
15330
0
        if (PyObject_GetOptionalAttr(obj, state->kind, &tmp) < 0) {
15331
0
            return -1;
15332
0
        }
15333
0
        if (tmp == NULL || tmp == Py_None) {
15334
0
            Py_CLEAR(tmp);
15335
0
            kind = NULL;
15336
0
        }
15337
0
        else {
15338
0
            int res;
15339
0
            if (_Py_EnterRecursiveCall(" while traversing 'Constant' node")) {
15340
0
                goto failed;
15341
0
            }
15342
0
            res = obj2ast_string(state, tmp, &kind, arena);
15343
0
            _Py_LeaveRecursiveCall();
15344
0
            if (res != 0) goto failed;
15345
0
            Py_CLEAR(tmp);
15346
0
        }
15347
0
        *out = _PyAST_Constant(value, kind, lineno, col_offset, end_lineno,
15348
0
                               end_col_offset, arena);
15349
0
        if (*out == NULL) goto failed;
15350
0
        return 0;
15351
0
    }
15352
0
    tp = state->Attribute_type;
15353
0
    isinstance = PyObject_IsInstance(obj, tp);
15354
0
    if (isinstance == -1) {
15355
0
        return -1;
15356
0
    }
15357
0
    if (isinstance) {
15358
0
        expr_ty value;
15359
0
        identifier attr;
15360
0
        expr_context_ty ctx;
15361
15362
0
        if (PyObject_GetOptionalAttr(obj, state->value, &tmp) < 0) {
15363
0
            return -1;
15364
0
        }
15365
0
        if (tmp == NULL) {
15366
0
            PyErr_SetString(PyExc_TypeError, "required field \"value\" missing from Attribute");
15367
0
            return -1;
15368
0
        }
15369
0
        else {
15370
0
            int res;
15371
0
            if (_Py_EnterRecursiveCall(" while traversing 'Attribute' node")) {
15372
0
                goto failed;
15373
0
            }
15374
0
            res = obj2ast_expr(state, tmp, &value, arena);
15375
0
            _Py_LeaveRecursiveCall();
15376
0
            if (res != 0) goto failed;
15377
0
            Py_CLEAR(tmp);
15378
0
        }
15379
0
        if (PyObject_GetOptionalAttr(obj, state->attr, &tmp) < 0) {
15380
0
            return -1;
15381
0
        }
15382
0
        if (tmp == NULL) {
15383
0
            PyErr_SetString(PyExc_TypeError, "required field \"attr\" missing from Attribute");
15384
0
            return -1;
15385
0
        }
15386
0
        else {
15387
0
            int res;
15388
0
            if (_Py_EnterRecursiveCall(" while traversing 'Attribute' node")) {
15389
0
                goto failed;
15390
0
            }
15391
0
            res = obj2ast_identifier(state, tmp, &attr, arena);
15392
0
            _Py_LeaveRecursiveCall();
15393
0
            if (res != 0) goto failed;
15394
0
            Py_CLEAR(tmp);
15395
0
        }
15396
0
        if (PyObject_GetOptionalAttr(obj, state->ctx, &tmp) < 0) {
15397
0
            return -1;
15398
0
        }
15399
0
        if (tmp == NULL) {
15400
0
            PyErr_SetString(PyExc_TypeError, "required field \"ctx\" missing from Attribute");
15401
0
            return -1;
15402
0
        }
15403
0
        else {
15404
0
            int res;
15405
0
            if (_Py_EnterRecursiveCall(" while traversing 'Attribute' node")) {
15406
0
                goto failed;
15407
0
            }
15408
0
            res = obj2ast_expr_context(state, tmp, &ctx, arena);
15409
0
            _Py_LeaveRecursiveCall();
15410
0
            if (res != 0) goto failed;
15411
0
            Py_CLEAR(tmp);
15412
0
        }
15413
0
        *out = _PyAST_Attribute(value, attr, ctx, lineno, col_offset,
15414
0
                                end_lineno, end_col_offset, arena);
15415
0
        if (*out == NULL) goto failed;
15416
0
        return 0;
15417
0
    }
15418
0
    tp = state->Subscript_type;
15419
0
    isinstance = PyObject_IsInstance(obj, tp);
15420
0
    if (isinstance == -1) {
15421
0
        return -1;
15422
0
    }
15423
0
    if (isinstance) {
15424
0
        expr_ty value;
15425
0
        expr_ty slice;
15426
0
        expr_context_ty ctx;
15427
15428
0
        if (PyObject_GetOptionalAttr(obj, state->value, &tmp) < 0) {
15429
0
            return -1;
15430
0
        }
15431
0
        if (tmp == NULL) {
15432
0
            PyErr_SetString(PyExc_TypeError, "required field \"value\" missing from Subscript");
15433
0
            return -1;
15434
0
        }
15435
0
        else {
15436
0
            int res;
15437
0
            if (_Py_EnterRecursiveCall(" while traversing 'Subscript' node")) {
15438
0
                goto failed;
15439
0
            }
15440
0
            res = obj2ast_expr(state, tmp, &value, arena);
15441
0
            _Py_LeaveRecursiveCall();
15442
0
            if (res != 0) goto failed;
15443
0
            Py_CLEAR(tmp);
15444
0
        }
15445
0
        if (PyObject_GetOptionalAttr(obj, state->slice, &tmp) < 0) {
15446
0
            return -1;
15447
0
        }
15448
0
        if (tmp == NULL) {
15449
0
            PyErr_SetString(PyExc_TypeError, "required field \"slice\" missing from Subscript");
15450
0
            return -1;
15451
0
        }
15452
0
        else {
15453
0
            int res;
15454
0
            if (_Py_EnterRecursiveCall(" while traversing 'Subscript' node")) {
15455
0
                goto failed;
15456
0
            }
15457
0
            res = obj2ast_expr(state, tmp, &slice, arena);
15458
0
            _Py_LeaveRecursiveCall();
15459
0
            if (res != 0) goto failed;
15460
0
            Py_CLEAR(tmp);
15461
0
        }
15462
0
        if (PyObject_GetOptionalAttr(obj, state->ctx, &tmp) < 0) {
15463
0
            return -1;
15464
0
        }
15465
0
        if (tmp == NULL) {
15466
0
            PyErr_SetString(PyExc_TypeError, "required field \"ctx\" missing from Subscript");
15467
0
            return -1;
15468
0
        }
15469
0
        else {
15470
0
            int res;
15471
0
            if (_Py_EnterRecursiveCall(" while traversing 'Subscript' node")) {
15472
0
                goto failed;
15473
0
            }
15474
0
            res = obj2ast_expr_context(state, tmp, &ctx, arena);
15475
0
            _Py_LeaveRecursiveCall();
15476
0
            if (res != 0) goto failed;
15477
0
            Py_CLEAR(tmp);
15478
0
        }
15479
0
        *out = _PyAST_Subscript(value, slice, ctx, lineno, col_offset,
15480
0
                                end_lineno, end_col_offset, arena);
15481
0
        if (*out == NULL) goto failed;
15482
0
        return 0;
15483
0
    }
15484
0
    tp = state->Starred_type;
15485
0
    isinstance = PyObject_IsInstance(obj, tp);
15486
0
    if (isinstance == -1) {
15487
0
        return -1;
15488
0
    }
15489
0
    if (isinstance) {
15490
0
        expr_ty value;
15491
0
        expr_context_ty ctx;
15492
15493
0
        if (PyObject_GetOptionalAttr(obj, state->value, &tmp) < 0) {
15494
0
            return -1;
15495
0
        }
15496
0
        if (tmp == NULL) {
15497
0
            PyErr_SetString(PyExc_TypeError, "required field \"value\" missing from Starred");
15498
0
            return -1;
15499
0
        }
15500
0
        else {
15501
0
            int res;
15502
0
            if (_Py_EnterRecursiveCall(" while traversing 'Starred' node")) {
15503
0
                goto failed;
15504
0
            }
15505
0
            res = obj2ast_expr(state, tmp, &value, arena);
15506
0
            _Py_LeaveRecursiveCall();
15507
0
            if (res != 0) goto failed;
15508
0
            Py_CLEAR(tmp);
15509
0
        }
15510
0
        if (PyObject_GetOptionalAttr(obj, state->ctx, &tmp) < 0) {
15511
0
            return -1;
15512
0
        }
15513
0
        if (tmp == NULL) {
15514
0
            PyErr_SetString(PyExc_TypeError, "required field \"ctx\" missing from Starred");
15515
0
            return -1;
15516
0
        }
15517
0
        else {
15518
0
            int res;
15519
0
            if (_Py_EnterRecursiveCall(" while traversing 'Starred' node")) {
15520
0
                goto failed;
15521
0
            }
15522
0
            res = obj2ast_expr_context(state, tmp, &ctx, arena);
15523
0
            _Py_LeaveRecursiveCall();
15524
0
            if (res != 0) goto failed;
15525
0
            Py_CLEAR(tmp);
15526
0
        }
15527
0
        *out = _PyAST_Starred(value, ctx, lineno, col_offset, end_lineno,
15528
0
                              end_col_offset, arena);
15529
0
        if (*out == NULL) goto failed;
15530
0
        return 0;
15531
0
    }
15532
0
    tp = state->Name_type;
15533
0
    isinstance = PyObject_IsInstance(obj, tp);
15534
0
    if (isinstance == -1) {
15535
0
        return -1;
15536
0
    }
15537
0
    if (isinstance) {
15538
0
        identifier id;
15539
0
        expr_context_ty ctx;
15540
15541
0
        if (PyObject_GetOptionalAttr(obj, state->id, &tmp) < 0) {
15542
0
            return -1;
15543
0
        }
15544
0
        if (tmp == NULL) {
15545
0
            PyErr_SetString(PyExc_TypeError, "required field \"id\" missing from Name");
15546
0
            return -1;
15547
0
        }
15548
0
        else {
15549
0
            int res;
15550
0
            if (_Py_EnterRecursiveCall(" while traversing 'Name' node")) {
15551
0
                goto failed;
15552
0
            }
15553
0
            res = obj2ast_identifier(state, tmp, &id, arena);
15554
0
            _Py_LeaveRecursiveCall();
15555
0
            if (res != 0) goto failed;
15556
0
            Py_CLEAR(tmp);
15557
0
        }
15558
0
        if (PyObject_GetOptionalAttr(obj, state->ctx, &tmp) < 0) {
15559
0
            return -1;
15560
0
        }
15561
0
        if (tmp == NULL) {
15562
0
            PyErr_SetString(PyExc_TypeError, "required field \"ctx\" missing from Name");
15563
0
            return -1;
15564
0
        }
15565
0
        else {
15566
0
            int res;
15567
0
            if (_Py_EnterRecursiveCall(" while traversing 'Name' node")) {
15568
0
                goto failed;
15569
0
            }
15570
0
            res = obj2ast_expr_context(state, tmp, &ctx, arena);
15571
0
            _Py_LeaveRecursiveCall();
15572
0
            if (res != 0) goto failed;
15573
0
            Py_CLEAR(tmp);
15574
0
        }
15575
0
        *out = _PyAST_Name(id, ctx, lineno, col_offset, end_lineno,
15576
0
                           end_col_offset, arena);
15577
0
        if (*out == NULL) goto failed;
15578
0
        return 0;
15579
0
    }
15580
0
    tp = state->List_type;
15581
0
    isinstance = PyObject_IsInstance(obj, tp);
15582
0
    if (isinstance == -1) {
15583
0
        return -1;
15584
0
    }
15585
0
    if (isinstance) {
15586
0
        asdl_expr_seq* elts;
15587
0
        expr_context_ty ctx;
15588
15589
0
        if (PyObject_GetOptionalAttr(obj, state->elts, &tmp) < 0) {
15590
0
            return -1;
15591
0
        }
15592
0
        if (tmp == NULL) {
15593
0
            tmp = PyList_New(0);
15594
0
            if (tmp == NULL) {
15595
0
                return -1;
15596
0
            }
15597
0
        }
15598
0
        {
15599
0
            int res;
15600
0
            Py_ssize_t len;
15601
0
            Py_ssize_t i;
15602
0
            if (!PyList_Check(tmp)) {
15603
0
                PyErr_Format(PyExc_TypeError, "List field \"elts\" must be a list, not a %.200s", _PyType_Name(Py_TYPE(tmp)));
15604
0
                goto failed;
15605
0
            }
15606
0
            len = PyList_GET_SIZE(tmp);
15607
0
            elts = _Py_asdl_expr_seq_new(len, arena);
15608
0
            if (elts == NULL) goto failed;
15609
0
            for (i = 0; i < len; i++) {
15610
0
                expr_ty val;
15611
0
                PyObject *tmp2 = Py_NewRef(PyList_GET_ITEM(tmp, i));
15612
0
                if (_Py_EnterRecursiveCall(" while traversing 'List' node")) {
15613
0
                    goto failed;
15614
0
                }
15615
0
                res = obj2ast_expr(state, tmp2, &val, arena);
15616
0
                _Py_LeaveRecursiveCall();
15617
0
                Py_DECREF(tmp2);
15618
0
                if (res != 0) goto failed;
15619
0
                if (len != PyList_GET_SIZE(tmp)) {
15620
0
                    PyErr_SetString(PyExc_RuntimeError, "List field \"elts\" changed size during iteration");
15621
0
                    goto failed;
15622
0
                }
15623
0
                asdl_seq_SET(elts, i, val);
15624
0
            }
15625
0
            Py_CLEAR(tmp);
15626
0
        }
15627
0
        if (PyObject_GetOptionalAttr(obj, state->ctx, &tmp) < 0) {
15628
0
            return -1;
15629
0
        }
15630
0
        if (tmp == NULL) {
15631
0
            PyErr_SetString(PyExc_TypeError, "required field \"ctx\" missing from List");
15632
0
            return -1;
15633
0
        }
15634
0
        else {
15635
0
            int res;
15636
0
            if (_Py_EnterRecursiveCall(" while traversing 'List' node")) {
15637
0
                goto failed;
15638
0
            }
15639
0
            res = obj2ast_expr_context(state, tmp, &ctx, arena);
15640
0
            _Py_LeaveRecursiveCall();
15641
0
            if (res != 0) goto failed;
15642
0
            Py_CLEAR(tmp);
15643
0
        }
15644
0
        *out = _PyAST_List(elts, ctx, lineno, col_offset, end_lineno,
15645
0
                           end_col_offset, arena);
15646
0
        if (*out == NULL) goto failed;
15647
0
        return 0;
15648
0
    }
15649
0
    tp = state->Tuple_type;
15650
0
    isinstance = PyObject_IsInstance(obj, tp);
15651
0
    if (isinstance == -1) {
15652
0
        return -1;
15653
0
    }
15654
0
    if (isinstance) {
15655
0
        asdl_expr_seq* elts;
15656
0
        expr_context_ty ctx;
15657
15658
0
        if (PyObject_GetOptionalAttr(obj, state->elts, &tmp) < 0) {
15659
0
            return -1;
15660
0
        }
15661
0
        if (tmp == NULL) {
15662
0
            tmp = PyList_New(0);
15663
0
            if (tmp == NULL) {
15664
0
                return -1;
15665
0
            }
15666
0
        }
15667
0
        {
15668
0
            int res;
15669
0
            Py_ssize_t len;
15670
0
            Py_ssize_t i;
15671
0
            if (!PyList_Check(tmp)) {
15672
0
                PyErr_Format(PyExc_TypeError, "Tuple field \"elts\" must be a list, not a %.200s", _PyType_Name(Py_TYPE(tmp)));
15673
0
                goto failed;
15674
0
            }
15675
0
            len = PyList_GET_SIZE(tmp);
15676
0
            elts = _Py_asdl_expr_seq_new(len, arena);
15677
0
            if (elts == NULL) goto failed;
15678
0
            for (i = 0; i < len; i++) {
15679
0
                expr_ty val;
15680
0
                PyObject *tmp2 = Py_NewRef(PyList_GET_ITEM(tmp, i));
15681
0
                if (_Py_EnterRecursiveCall(" while traversing 'Tuple' node")) {
15682
0
                    goto failed;
15683
0
                }
15684
0
                res = obj2ast_expr(state, tmp2, &val, arena);
15685
0
                _Py_LeaveRecursiveCall();
15686
0
                Py_DECREF(tmp2);
15687
0
                if (res != 0) goto failed;
15688
0
                if (len != PyList_GET_SIZE(tmp)) {
15689
0
                    PyErr_SetString(PyExc_RuntimeError, "Tuple field \"elts\" changed size during iteration");
15690
0
                    goto failed;
15691
0
                }
15692
0
                asdl_seq_SET(elts, i, val);
15693
0
            }
15694
0
            Py_CLEAR(tmp);
15695
0
        }
15696
0
        if (PyObject_GetOptionalAttr(obj, state->ctx, &tmp) < 0) {
15697
0
            return -1;
15698
0
        }
15699
0
        if (tmp == NULL) {
15700
0
            PyErr_SetString(PyExc_TypeError, "required field \"ctx\" missing from Tuple");
15701
0
            return -1;
15702
0
        }
15703
0
        else {
15704
0
            int res;
15705
0
            if (_Py_EnterRecursiveCall(" while traversing 'Tuple' node")) {
15706
0
                goto failed;
15707
0
            }
15708
0
            res = obj2ast_expr_context(state, tmp, &ctx, arena);
15709
0
            _Py_LeaveRecursiveCall();
15710
0
            if (res != 0) goto failed;
15711
0
            Py_CLEAR(tmp);
15712
0
        }
15713
0
        *out = _PyAST_Tuple(elts, ctx, lineno, col_offset, end_lineno,
15714
0
                            end_col_offset, arena);
15715
0
        if (*out == NULL) goto failed;
15716
0
        return 0;
15717
0
    }
15718
0
    tp = state->Slice_type;
15719
0
    isinstance = PyObject_IsInstance(obj, tp);
15720
0
    if (isinstance == -1) {
15721
0
        return -1;
15722
0
    }
15723
0
    if (isinstance) {
15724
0
        expr_ty lower;
15725
0
        expr_ty upper;
15726
0
        expr_ty step;
15727
15728
0
        if (PyObject_GetOptionalAttr(obj, state->lower, &tmp) < 0) {
15729
0
            return -1;
15730
0
        }
15731
0
        if (tmp == NULL || tmp == Py_None) {
15732
0
            Py_CLEAR(tmp);
15733
0
            lower = NULL;
15734
0
        }
15735
0
        else {
15736
0
            int res;
15737
0
            if (_Py_EnterRecursiveCall(" while traversing 'Slice' node")) {
15738
0
                goto failed;
15739
0
            }
15740
0
            res = obj2ast_expr(state, tmp, &lower, arena);
15741
0
            _Py_LeaveRecursiveCall();
15742
0
            if (res != 0) goto failed;
15743
0
            Py_CLEAR(tmp);
15744
0
        }
15745
0
        if (PyObject_GetOptionalAttr(obj, state->upper, &tmp) < 0) {
15746
0
            return -1;
15747
0
        }
15748
0
        if (tmp == NULL || tmp == Py_None) {
15749
0
            Py_CLEAR(tmp);
15750
0
            upper = NULL;
15751
0
        }
15752
0
        else {
15753
0
            int res;
15754
0
            if (_Py_EnterRecursiveCall(" while traversing 'Slice' node")) {
15755
0
                goto failed;
15756
0
            }
15757
0
            res = obj2ast_expr(state, tmp, &upper, arena);
15758
0
            _Py_LeaveRecursiveCall();
15759
0
            if (res != 0) goto failed;
15760
0
            Py_CLEAR(tmp);
15761
0
        }
15762
0
        if (PyObject_GetOptionalAttr(obj, state->step, &tmp) < 0) {
15763
0
            return -1;
15764
0
        }
15765
0
        if (tmp == NULL || tmp == Py_None) {
15766
0
            Py_CLEAR(tmp);
15767
0
            step = NULL;
15768
0
        }
15769
0
        else {
15770
0
            int res;
15771
0
            if (_Py_EnterRecursiveCall(" while traversing 'Slice' node")) {
15772
0
                goto failed;
15773
0
            }
15774
0
            res = obj2ast_expr(state, tmp, &step, arena);
15775
0
            _Py_LeaveRecursiveCall();
15776
0
            if (res != 0) goto failed;
15777
0
            Py_CLEAR(tmp);
15778
0
        }
15779
0
        *out = _PyAST_Slice(lower, upper, step, lineno, col_offset, end_lineno,
15780
0
                            end_col_offset, arena);
15781
0
        if (*out == NULL) goto failed;
15782
0
        return 0;
15783
0
    }
15784
15785
0
    PyErr_Format(PyExc_TypeError, "expected some sort of expr, but got %R", obj);
15786
0
    failed:
15787
0
    Py_XDECREF(tmp);
15788
0
    return -1;
15789
0
}
15790
15791
int
15792
obj2ast_expr_context(struct ast_state *state, PyObject* obj, expr_context_ty*
15793
                     out, PyArena* arena)
15794
0
{
15795
0
    int isinstance;
15796
15797
0
    isinstance = PyObject_IsInstance(obj, state->Load_type);
15798
0
    if (isinstance == -1) {
15799
0
        return -1;
15800
0
    }
15801
0
    if (isinstance) {
15802
0
        *out = Load;
15803
0
        return 0;
15804
0
    }
15805
0
    isinstance = PyObject_IsInstance(obj, state->Store_type);
15806
0
    if (isinstance == -1) {
15807
0
        return -1;
15808
0
    }
15809
0
    if (isinstance) {
15810
0
        *out = Store;
15811
0
        return 0;
15812
0
    }
15813
0
    isinstance = PyObject_IsInstance(obj, state->Del_type);
15814
0
    if (isinstance == -1) {
15815
0
        return -1;
15816
0
    }
15817
0
    if (isinstance) {
15818
0
        *out = Del;
15819
0
        return 0;
15820
0
    }
15821
15822
0
    PyErr_Format(PyExc_TypeError, "expected some sort of expr_context, but got %R", obj);
15823
0
    return -1;
15824
0
}
15825
15826
int
15827
obj2ast_boolop(struct ast_state *state, PyObject* obj, boolop_ty* out, PyArena*
15828
               arena)
15829
0
{
15830
0
    int isinstance;
15831
15832
0
    isinstance = PyObject_IsInstance(obj, state->And_type);
15833
0
    if (isinstance == -1) {
15834
0
        return -1;
15835
0
    }
15836
0
    if (isinstance) {
15837
0
        *out = And;
15838
0
        return 0;
15839
0
    }
15840
0
    isinstance = PyObject_IsInstance(obj, state->Or_type);
15841
0
    if (isinstance == -1) {
15842
0
        return -1;
15843
0
    }
15844
0
    if (isinstance) {
15845
0
        *out = Or;
15846
0
        return 0;
15847
0
    }
15848
15849
0
    PyErr_Format(PyExc_TypeError, "expected some sort of boolop, but got %R", obj);
15850
0
    return -1;
15851
0
}
15852
15853
int
15854
obj2ast_operator(struct ast_state *state, PyObject* obj, operator_ty* out,
15855
                 PyArena* arena)
15856
0
{
15857
0
    int isinstance;
15858
15859
0
    isinstance = PyObject_IsInstance(obj, state->Add_type);
15860
0
    if (isinstance == -1) {
15861
0
        return -1;
15862
0
    }
15863
0
    if (isinstance) {
15864
0
        *out = Add;
15865
0
        return 0;
15866
0
    }
15867
0
    isinstance = PyObject_IsInstance(obj, state->Sub_type);
15868
0
    if (isinstance == -1) {
15869
0
        return -1;
15870
0
    }
15871
0
    if (isinstance) {
15872
0
        *out = Sub;
15873
0
        return 0;
15874
0
    }
15875
0
    isinstance = PyObject_IsInstance(obj, state->Mult_type);
15876
0
    if (isinstance == -1) {
15877
0
        return -1;
15878
0
    }
15879
0
    if (isinstance) {
15880
0
        *out = Mult;
15881
0
        return 0;
15882
0
    }
15883
0
    isinstance = PyObject_IsInstance(obj, state->MatMult_type);
15884
0
    if (isinstance == -1) {
15885
0
        return -1;
15886
0
    }
15887
0
    if (isinstance) {
15888
0
        *out = MatMult;
15889
0
        return 0;
15890
0
    }
15891
0
    isinstance = PyObject_IsInstance(obj, state->Div_type);
15892
0
    if (isinstance == -1) {
15893
0
        return -1;
15894
0
    }
15895
0
    if (isinstance) {
15896
0
        *out = Div;
15897
0
        return 0;
15898
0
    }
15899
0
    isinstance = PyObject_IsInstance(obj, state->Mod_type);
15900
0
    if (isinstance == -1) {
15901
0
        return -1;
15902
0
    }
15903
0
    if (isinstance) {
15904
0
        *out = Mod;
15905
0
        return 0;
15906
0
    }
15907
0
    isinstance = PyObject_IsInstance(obj, state->Pow_type);
15908
0
    if (isinstance == -1) {
15909
0
        return -1;
15910
0
    }
15911
0
    if (isinstance) {
15912
0
        *out = Pow;
15913
0
        return 0;
15914
0
    }
15915
0
    isinstance = PyObject_IsInstance(obj, state->LShift_type);
15916
0
    if (isinstance == -1) {
15917
0
        return -1;
15918
0
    }
15919
0
    if (isinstance) {
15920
0
        *out = LShift;
15921
0
        return 0;
15922
0
    }
15923
0
    isinstance = PyObject_IsInstance(obj, state->RShift_type);
15924
0
    if (isinstance == -1) {
15925
0
        return -1;
15926
0
    }
15927
0
    if (isinstance) {
15928
0
        *out = RShift;
15929
0
        return 0;
15930
0
    }
15931
0
    isinstance = PyObject_IsInstance(obj, state->BitOr_type);
15932
0
    if (isinstance == -1) {
15933
0
        return -1;
15934
0
    }
15935
0
    if (isinstance) {
15936
0
        *out = BitOr;
15937
0
        return 0;
15938
0
    }
15939
0
    isinstance = PyObject_IsInstance(obj, state->BitXor_type);
15940
0
    if (isinstance == -1) {
15941
0
        return -1;
15942
0
    }
15943
0
    if (isinstance) {
15944
0
        *out = BitXor;
15945
0
        return 0;
15946
0
    }
15947
0
    isinstance = PyObject_IsInstance(obj, state->BitAnd_type);
15948
0
    if (isinstance == -1) {
15949
0
        return -1;
15950
0
    }
15951
0
    if (isinstance) {
15952
0
        *out = BitAnd;
15953
0
        return 0;
15954
0
    }
15955
0
    isinstance = PyObject_IsInstance(obj, state->FloorDiv_type);
15956
0
    if (isinstance == -1) {
15957
0
        return -1;
15958
0
    }
15959
0
    if (isinstance) {
15960
0
        *out = FloorDiv;
15961
0
        return 0;
15962
0
    }
15963
15964
0
    PyErr_Format(PyExc_TypeError, "expected some sort of operator, but got %R", obj);
15965
0
    return -1;
15966
0
}
15967
15968
int
15969
obj2ast_unaryop(struct ast_state *state, PyObject* obj, unaryop_ty* out,
15970
                PyArena* arena)
15971
0
{
15972
0
    int isinstance;
15973
15974
0
    isinstance = PyObject_IsInstance(obj, state->Invert_type);
15975
0
    if (isinstance == -1) {
15976
0
        return -1;
15977
0
    }
15978
0
    if (isinstance) {
15979
0
        *out = Invert;
15980
0
        return 0;
15981
0
    }
15982
0
    isinstance = PyObject_IsInstance(obj, state->Not_type);
15983
0
    if (isinstance == -1) {
15984
0
        return -1;
15985
0
    }
15986
0
    if (isinstance) {
15987
0
        *out = Not;
15988
0
        return 0;
15989
0
    }
15990
0
    isinstance = PyObject_IsInstance(obj, state->UAdd_type);
15991
0
    if (isinstance == -1) {
15992
0
        return -1;
15993
0
    }
15994
0
    if (isinstance) {
15995
0
        *out = UAdd;
15996
0
        return 0;
15997
0
    }
15998
0
    isinstance = PyObject_IsInstance(obj, state->USub_type);
15999
0
    if (isinstance == -1) {
16000
0
        return -1;
16001
0
    }
16002
0
    if (isinstance) {
16003
0
        *out = USub;
16004
0
        return 0;
16005
0
    }
16006
16007
0
    PyErr_Format(PyExc_TypeError, "expected some sort of unaryop, but got %R", obj);
16008
0
    return -1;
16009
0
}
16010
16011
int
16012
obj2ast_cmpop(struct ast_state *state, PyObject* obj, cmpop_ty* out, PyArena*
16013
              arena)
16014
0
{
16015
0
    int isinstance;
16016
16017
0
    isinstance = PyObject_IsInstance(obj, state->Eq_type);
16018
0
    if (isinstance == -1) {
16019
0
        return -1;
16020
0
    }
16021
0
    if (isinstance) {
16022
0
        *out = Eq;
16023
0
        return 0;
16024
0
    }
16025
0
    isinstance = PyObject_IsInstance(obj, state->NotEq_type);
16026
0
    if (isinstance == -1) {
16027
0
        return -1;
16028
0
    }
16029
0
    if (isinstance) {
16030
0
        *out = NotEq;
16031
0
        return 0;
16032
0
    }
16033
0
    isinstance = PyObject_IsInstance(obj, state->Lt_type);
16034
0
    if (isinstance == -1) {
16035
0
        return -1;
16036
0
    }
16037
0
    if (isinstance) {
16038
0
        *out = Lt;
16039
0
        return 0;
16040
0
    }
16041
0
    isinstance = PyObject_IsInstance(obj, state->LtE_type);
16042
0
    if (isinstance == -1) {
16043
0
        return -1;
16044
0
    }
16045
0
    if (isinstance) {
16046
0
        *out = LtE;
16047
0
        return 0;
16048
0
    }
16049
0
    isinstance = PyObject_IsInstance(obj, state->Gt_type);
16050
0
    if (isinstance == -1) {
16051
0
        return -1;
16052
0
    }
16053
0
    if (isinstance) {
16054
0
        *out = Gt;
16055
0
        return 0;
16056
0
    }
16057
0
    isinstance = PyObject_IsInstance(obj, state->GtE_type);
16058
0
    if (isinstance == -1) {
16059
0
        return -1;
16060
0
    }
16061
0
    if (isinstance) {
16062
0
        *out = GtE;
16063
0
        return 0;
16064
0
    }
16065
0
    isinstance = PyObject_IsInstance(obj, state->Is_type);
16066
0
    if (isinstance == -1) {
16067
0
        return -1;
16068
0
    }
16069
0
    if (isinstance) {
16070
0
        *out = Is;
16071
0
        return 0;
16072
0
    }
16073
0
    isinstance = PyObject_IsInstance(obj, state->IsNot_type);
16074
0
    if (isinstance == -1) {
16075
0
        return -1;
16076
0
    }
16077
0
    if (isinstance) {
16078
0
        *out = IsNot;
16079
0
        return 0;
16080
0
    }
16081
0
    isinstance = PyObject_IsInstance(obj, state->In_type);
16082
0
    if (isinstance == -1) {
16083
0
        return -1;
16084
0
    }
16085
0
    if (isinstance) {
16086
0
        *out = In;
16087
0
        return 0;
16088
0
    }
16089
0
    isinstance = PyObject_IsInstance(obj, state->NotIn_type);
16090
0
    if (isinstance == -1) {
16091
0
        return -1;
16092
0
    }
16093
0
    if (isinstance) {
16094
0
        *out = NotIn;
16095
0
        return 0;
16096
0
    }
16097
16098
0
    PyErr_Format(PyExc_TypeError, "expected some sort of cmpop, but got %R", obj);
16099
0
    return -1;
16100
0
}
16101
16102
int
16103
obj2ast_comprehension(struct ast_state *state, PyObject* obj, comprehension_ty*
16104
                      out, PyArena* arena)
16105
0
{
16106
0
    PyObject* tmp = NULL;
16107
0
    expr_ty target;
16108
0
    expr_ty iter;
16109
0
    asdl_expr_seq* ifs;
16110
0
    int is_async;
16111
16112
0
    if (PyObject_GetOptionalAttr(obj, state->target, &tmp) < 0) {
16113
0
        return -1;
16114
0
    }
16115
0
    if (tmp == NULL) {
16116
0
        PyErr_SetString(PyExc_TypeError, "required field \"target\" missing from comprehension");
16117
0
        return -1;
16118
0
    }
16119
0
    else {
16120
0
        int res;
16121
0
        if (_Py_EnterRecursiveCall(" while traversing 'comprehension' node")) {
16122
0
            goto failed;
16123
0
        }
16124
0
        res = obj2ast_expr(state, tmp, &target, arena);
16125
0
        _Py_LeaveRecursiveCall();
16126
0
        if (res != 0) goto failed;
16127
0
        Py_CLEAR(tmp);
16128
0
    }
16129
0
    if (PyObject_GetOptionalAttr(obj, state->iter, &tmp) < 0) {
16130
0
        return -1;
16131
0
    }
16132
0
    if (tmp == NULL) {
16133
0
        PyErr_SetString(PyExc_TypeError, "required field \"iter\" missing from comprehension");
16134
0
        return -1;
16135
0
    }
16136
0
    else {
16137
0
        int res;
16138
0
        if (_Py_EnterRecursiveCall(" while traversing 'comprehension' node")) {
16139
0
            goto failed;
16140
0
        }
16141
0
        res = obj2ast_expr(state, tmp, &iter, arena);
16142
0
        _Py_LeaveRecursiveCall();
16143
0
        if (res != 0) goto failed;
16144
0
        Py_CLEAR(tmp);
16145
0
    }
16146
0
    if (PyObject_GetOptionalAttr(obj, state->ifs, &tmp) < 0) {
16147
0
        return -1;
16148
0
    }
16149
0
    if (tmp == NULL) {
16150
0
        tmp = PyList_New(0);
16151
0
        if (tmp == NULL) {
16152
0
            return -1;
16153
0
        }
16154
0
    }
16155
0
    {
16156
0
        int res;
16157
0
        Py_ssize_t len;
16158
0
        Py_ssize_t i;
16159
0
        if (!PyList_Check(tmp)) {
16160
0
            PyErr_Format(PyExc_TypeError, "comprehension field \"ifs\" must be a list, not a %.200s", _PyType_Name(Py_TYPE(tmp)));
16161
0
            goto failed;
16162
0
        }
16163
0
        len = PyList_GET_SIZE(tmp);
16164
0
        ifs = _Py_asdl_expr_seq_new(len, arena);
16165
0
        if (ifs == NULL) goto failed;
16166
0
        for (i = 0; i < len; i++) {
16167
0
            expr_ty val;
16168
0
            PyObject *tmp2 = Py_NewRef(PyList_GET_ITEM(tmp, i));
16169
0
            if (_Py_EnterRecursiveCall(" while traversing 'comprehension' node")) {
16170
0
                goto failed;
16171
0
            }
16172
0
            res = obj2ast_expr(state, tmp2, &val, arena);
16173
0
            _Py_LeaveRecursiveCall();
16174
0
            Py_DECREF(tmp2);
16175
0
            if (res != 0) goto failed;
16176
0
            if (len != PyList_GET_SIZE(tmp)) {
16177
0
                PyErr_SetString(PyExc_RuntimeError, "comprehension field \"ifs\" changed size during iteration");
16178
0
                goto failed;
16179
0
            }
16180
0
            asdl_seq_SET(ifs, i, val);
16181
0
        }
16182
0
        Py_CLEAR(tmp);
16183
0
    }
16184
0
    if (PyObject_GetOptionalAttr(obj, state->is_async, &tmp) < 0) {
16185
0
        return -1;
16186
0
    }
16187
0
    if (tmp == NULL) {
16188
0
        PyErr_SetString(PyExc_TypeError, "required field \"is_async\" missing from comprehension");
16189
0
        return -1;
16190
0
    }
16191
0
    else {
16192
0
        int res;
16193
0
        if (_Py_EnterRecursiveCall(" while traversing 'comprehension' node")) {
16194
0
            goto failed;
16195
0
        }
16196
0
        res = obj2ast_int(state, tmp, &is_async, arena);
16197
0
        _Py_LeaveRecursiveCall();
16198
0
        if (res != 0) goto failed;
16199
0
        Py_CLEAR(tmp);
16200
0
    }
16201
0
    *out = _PyAST_comprehension(target, iter, ifs, is_async, arena);
16202
0
    if (*out == NULL) goto failed;
16203
0
    return 0;
16204
0
failed:
16205
0
    Py_XDECREF(tmp);
16206
0
    return -1;
16207
0
}
16208
16209
int
16210
obj2ast_excepthandler(struct ast_state *state, PyObject* obj, excepthandler_ty*
16211
                      out, PyArena* arena)
16212
0
{
16213
0
    int isinstance;
16214
16215
0
    PyObject *tmp = NULL;
16216
0
    PyObject *tp;
16217
0
    int lineno;
16218
0
    int col_offset;
16219
0
    int end_lineno;
16220
0
    int end_col_offset;
16221
16222
0
    if (obj == Py_None) {
16223
0
        *out = NULL;
16224
0
        return 0;
16225
0
    }
16226
0
    if (PyObject_GetOptionalAttr(obj, state->lineno, &tmp) < 0) {
16227
0
        return -1;
16228
0
    }
16229
0
    if (tmp == NULL) {
16230
0
        PyErr_SetString(PyExc_TypeError, "required field \"lineno\" missing from excepthandler");
16231
0
        return -1;
16232
0
    }
16233
0
    else {
16234
0
        int res;
16235
0
        if (_Py_EnterRecursiveCall(" while traversing 'excepthandler' node")) {
16236
0
            goto failed;
16237
0
        }
16238
0
        res = obj2ast_int(state, tmp, &lineno, arena);
16239
0
        _Py_LeaveRecursiveCall();
16240
0
        if (res != 0) goto failed;
16241
0
        Py_CLEAR(tmp);
16242
0
    }
16243
0
    if (PyObject_GetOptionalAttr(obj, state->col_offset, &tmp) < 0) {
16244
0
        return -1;
16245
0
    }
16246
0
    if (tmp == NULL) {
16247
0
        PyErr_SetString(PyExc_TypeError, "required field \"col_offset\" missing from excepthandler");
16248
0
        return -1;
16249
0
    }
16250
0
    else {
16251
0
        int res;
16252
0
        if (_Py_EnterRecursiveCall(" while traversing 'excepthandler' node")) {
16253
0
            goto failed;
16254
0
        }
16255
0
        res = obj2ast_int(state, tmp, &col_offset, arena);
16256
0
        _Py_LeaveRecursiveCall();
16257
0
        if (res != 0) goto failed;
16258
0
        Py_CLEAR(tmp);
16259
0
    }
16260
0
    if (PyObject_GetOptionalAttr(obj, state->end_lineno, &tmp) < 0) {
16261
0
        return -1;
16262
0
    }
16263
0
    if (tmp == NULL || tmp == Py_None) {
16264
0
        Py_CLEAR(tmp);
16265
0
        end_lineno = lineno;
16266
0
    }
16267
0
    else {
16268
0
        int res;
16269
0
        if (_Py_EnterRecursiveCall(" while traversing 'excepthandler' node")) {
16270
0
            goto failed;
16271
0
        }
16272
0
        res = obj2ast_int(state, tmp, &end_lineno, arena);
16273
0
        _Py_LeaveRecursiveCall();
16274
0
        if (res != 0) goto failed;
16275
0
        Py_CLEAR(tmp);
16276
0
    }
16277
0
    if (PyObject_GetOptionalAttr(obj, state->end_col_offset, &tmp) < 0) {
16278
0
        return -1;
16279
0
    }
16280
0
    if (tmp == NULL || tmp == Py_None) {
16281
0
        Py_CLEAR(tmp);
16282
0
        end_col_offset = col_offset;
16283
0
    }
16284
0
    else {
16285
0
        int res;
16286
0
        if (_Py_EnterRecursiveCall(" while traversing 'excepthandler' node")) {
16287
0
            goto failed;
16288
0
        }
16289
0
        res = obj2ast_int(state, tmp, &end_col_offset, arena);
16290
0
        _Py_LeaveRecursiveCall();
16291
0
        if (res != 0) goto failed;
16292
0
        Py_CLEAR(tmp);
16293
0
    }
16294
0
    tp = state->ExceptHandler_type;
16295
0
    isinstance = PyObject_IsInstance(obj, tp);
16296
0
    if (isinstance == -1) {
16297
0
        return -1;
16298
0
    }
16299
0
    if (isinstance) {
16300
0
        expr_ty type;
16301
0
        identifier name;
16302
0
        asdl_stmt_seq* body;
16303
16304
0
        if (PyObject_GetOptionalAttr(obj, state->type, &tmp) < 0) {
16305
0
            return -1;
16306
0
        }
16307
0
        if (tmp == NULL || tmp == Py_None) {
16308
0
            Py_CLEAR(tmp);
16309
0
            type = NULL;
16310
0
        }
16311
0
        else {
16312
0
            int res;
16313
0
            if (_Py_EnterRecursiveCall(" while traversing 'ExceptHandler' node")) {
16314
0
                goto failed;
16315
0
            }
16316
0
            res = obj2ast_expr(state, tmp, &type, arena);
16317
0
            _Py_LeaveRecursiveCall();
16318
0
            if (res != 0) goto failed;
16319
0
            Py_CLEAR(tmp);
16320
0
        }
16321
0
        if (PyObject_GetOptionalAttr(obj, state->name, &tmp) < 0) {
16322
0
            return -1;
16323
0
        }
16324
0
        if (tmp == NULL || tmp == Py_None) {
16325
0
            Py_CLEAR(tmp);
16326
0
            name = NULL;
16327
0
        }
16328
0
        else {
16329
0
            int res;
16330
0
            if (_Py_EnterRecursiveCall(" while traversing 'ExceptHandler' node")) {
16331
0
                goto failed;
16332
0
            }
16333
0
            res = obj2ast_identifier(state, tmp, &name, arena);
16334
0
            _Py_LeaveRecursiveCall();
16335
0
            if (res != 0) goto failed;
16336
0
            Py_CLEAR(tmp);
16337
0
        }
16338
0
        if (PyObject_GetOptionalAttr(obj, state->body, &tmp) < 0) {
16339
0
            return -1;
16340
0
        }
16341
0
        if (tmp == NULL) {
16342
0
            tmp = PyList_New(0);
16343
0
            if (tmp == NULL) {
16344
0
                return -1;
16345
0
            }
16346
0
        }
16347
0
        {
16348
0
            int res;
16349
0
            Py_ssize_t len;
16350
0
            Py_ssize_t i;
16351
0
            if (!PyList_Check(tmp)) {
16352
0
                PyErr_Format(PyExc_TypeError, "ExceptHandler field \"body\" must be a list, not a %.200s", _PyType_Name(Py_TYPE(tmp)));
16353
0
                goto failed;
16354
0
            }
16355
0
            len = PyList_GET_SIZE(tmp);
16356
0
            body = _Py_asdl_stmt_seq_new(len, arena);
16357
0
            if (body == NULL) goto failed;
16358
0
            for (i = 0; i < len; i++) {
16359
0
                stmt_ty val;
16360
0
                PyObject *tmp2 = Py_NewRef(PyList_GET_ITEM(tmp, i));
16361
0
                if (_Py_EnterRecursiveCall(" while traversing 'ExceptHandler' node")) {
16362
0
                    goto failed;
16363
0
                }
16364
0
                res = obj2ast_stmt(state, tmp2, &val, arena);
16365
0
                _Py_LeaveRecursiveCall();
16366
0
                Py_DECREF(tmp2);
16367
0
                if (res != 0) goto failed;
16368
0
                if (len != PyList_GET_SIZE(tmp)) {
16369
0
                    PyErr_SetString(PyExc_RuntimeError, "ExceptHandler field \"body\" changed size during iteration");
16370
0
                    goto failed;
16371
0
                }
16372
0
                asdl_seq_SET(body, i, val);
16373
0
            }
16374
0
            Py_CLEAR(tmp);
16375
0
        }
16376
0
        *out = _PyAST_ExceptHandler(type, name, body, lineno, col_offset,
16377
0
                                    end_lineno, end_col_offset, arena);
16378
0
        if (*out == NULL) goto failed;
16379
0
        return 0;
16380
0
    }
16381
16382
0
    PyErr_Format(PyExc_TypeError, "expected some sort of excepthandler, but got %R", obj);
16383
0
    failed:
16384
0
    Py_XDECREF(tmp);
16385
0
    return -1;
16386
0
}
16387
16388
int
16389
obj2ast_arguments(struct ast_state *state, PyObject* obj, arguments_ty* out,
16390
                  PyArena* arena)
16391
0
{
16392
0
    PyObject* tmp = NULL;
16393
0
    asdl_arg_seq* posonlyargs;
16394
0
    asdl_arg_seq* args;
16395
0
    arg_ty vararg;
16396
0
    asdl_arg_seq* kwonlyargs;
16397
0
    asdl_expr_seq* kw_defaults;
16398
0
    arg_ty kwarg;
16399
0
    asdl_expr_seq* defaults;
16400
16401
0
    if (PyObject_GetOptionalAttr(obj, state->posonlyargs, &tmp) < 0) {
16402
0
        return -1;
16403
0
    }
16404
0
    if (tmp == NULL) {
16405
0
        tmp = PyList_New(0);
16406
0
        if (tmp == NULL) {
16407
0
            return -1;
16408
0
        }
16409
0
    }
16410
0
    {
16411
0
        int res;
16412
0
        Py_ssize_t len;
16413
0
        Py_ssize_t i;
16414
0
        if (!PyList_Check(tmp)) {
16415
0
            PyErr_Format(PyExc_TypeError, "arguments field \"posonlyargs\" must be a list, not a %.200s", _PyType_Name(Py_TYPE(tmp)));
16416
0
            goto failed;
16417
0
        }
16418
0
        len = PyList_GET_SIZE(tmp);
16419
0
        posonlyargs = _Py_asdl_arg_seq_new(len, arena);
16420
0
        if (posonlyargs == NULL) goto failed;
16421
0
        for (i = 0; i < len; i++) {
16422
0
            arg_ty val;
16423
0
            PyObject *tmp2 = Py_NewRef(PyList_GET_ITEM(tmp, i));
16424
0
            if (_Py_EnterRecursiveCall(" while traversing 'arguments' node")) {
16425
0
                goto failed;
16426
0
            }
16427
0
            res = obj2ast_arg(state, tmp2, &val, arena);
16428
0
            _Py_LeaveRecursiveCall();
16429
0
            Py_DECREF(tmp2);
16430
0
            if (res != 0) goto failed;
16431
0
            if (len != PyList_GET_SIZE(tmp)) {
16432
0
                PyErr_SetString(PyExc_RuntimeError, "arguments field \"posonlyargs\" changed size during iteration");
16433
0
                goto failed;
16434
0
            }
16435
0
            asdl_seq_SET(posonlyargs, i, val);
16436
0
        }
16437
0
        Py_CLEAR(tmp);
16438
0
    }
16439
0
    if (PyObject_GetOptionalAttr(obj, state->args, &tmp) < 0) {
16440
0
        return -1;
16441
0
    }
16442
0
    if (tmp == NULL) {
16443
0
        tmp = PyList_New(0);
16444
0
        if (tmp == NULL) {
16445
0
            return -1;
16446
0
        }
16447
0
    }
16448
0
    {
16449
0
        int res;
16450
0
        Py_ssize_t len;
16451
0
        Py_ssize_t i;
16452
0
        if (!PyList_Check(tmp)) {
16453
0
            PyErr_Format(PyExc_TypeError, "arguments field \"args\" must be a list, not a %.200s", _PyType_Name(Py_TYPE(tmp)));
16454
0
            goto failed;
16455
0
        }
16456
0
        len = PyList_GET_SIZE(tmp);
16457
0
        args = _Py_asdl_arg_seq_new(len, arena);
16458
0
        if (args == NULL) goto failed;
16459
0
        for (i = 0; i < len; i++) {
16460
0
            arg_ty val;
16461
0
            PyObject *tmp2 = Py_NewRef(PyList_GET_ITEM(tmp, i));
16462
0
            if (_Py_EnterRecursiveCall(" while traversing 'arguments' node")) {
16463
0
                goto failed;
16464
0
            }
16465
0
            res = obj2ast_arg(state, tmp2, &val, arena);
16466
0
            _Py_LeaveRecursiveCall();
16467
0
            Py_DECREF(tmp2);
16468
0
            if (res != 0) goto failed;
16469
0
            if (len != PyList_GET_SIZE(tmp)) {
16470
0
                PyErr_SetString(PyExc_RuntimeError, "arguments field \"args\" changed size during iteration");
16471
0
                goto failed;
16472
0
            }
16473
0
            asdl_seq_SET(args, i, val);
16474
0
        }
16475
0
        Py_CLEAR(tmp);
16476
0
    }
16477
0
    if (PyObject_GetOptionalAttr(obj, state->vararg, &tmp) < 0) {
16478
0
        return -1;
16479
0
    }
16480
0
    if (tmp == NULL || tmp == Py_None) {
16481
0
        Py_CLEAR(tmp);
16482
0
        vararg = NULL;
16483
0
    }
16484
0
    else {
16485
0
        int res;
16486
0
        if (_Py_EnterRecursiveCall(" while traversing 'arguments' node")) {
16487
0
            goto failed;
16488
0
        }
16489
0
        res = obj2ast_arg(state, tmp, &vararg, arena);
16490
0
        _Py_LeaveRecursiveCall();
16491
0
        if (res != 0) goto failed;
16492
0
        Py_CLEAR(tmp);
16493
0
    }
16494
0
    if (PyObject_GetOptionalAttr(obj, state->kwonlyargs, &tmp) < 0) {
16495
0
        return -1;
16496
0
    }
16497
0
    if (tmp == NULL) {
16498
0
        tmp = PyList_New(0);
16499
0
        if (tmp == NULL) {
16500
0
            return -1;
16501
0
        }
16502
0
    }
16503
0
    {
16504
0
        int res;
16505
0
        Py_ssize_t len;
16506
0
        Py_ssize_t i;
16507
0
        if (!PyList_Check(tmp)) {
16508
0
            PyErr_Format(PyExc_TypeError, "arguments field \"kwonlyargs\" must be a list, not a %.200s", _PyType_Name(Py_TYPE(tmp)));
16509
0
            goto failed;
16510
0
        }
16511
0
        len = PyList_GET_SIZE(tmp);
16512
0
        kwonlyargs = _Py_asdl_arg_seq_new(len, arena);
16513
0
        if (kwonlyargs == NULL) goto failed;
16514
0
        for (i = 0; i < len; i++) {
16515
0
            arg_ty val;
16516
0
            PyObject *tmp2 = Py_NewRef(PyList_GET_ITEM(tmp, i));
16517
0
            if (_Py_EnterRecursiveCall(" while traversing 'arguments' node")) {
16518
0
                goto failed;
16519
0
            }
16520
0
            res = obj2ast_arg(state, tmp2, &val, arena);
16521
0
            _Py_LeaveRecursiveCall();
16522
0
            Py_DECREF(tmp2);
16523
0
            if (res != 0) goto failed;
16524
0
            if (len != PyList_GET_SIZE(tmp)) {
16525
0
                PyErr_SetString(PyExc_RuntimeError, "arguments field \"kwonlyargs\" changed size during iteration");
16526
0
                goto failed;
16527
0
            }
16528
0
            asdl_seq_SET(kwonlyargs, i, val);
16529
0
        }
16530
0
        Py_CLEAR(tmp);
16531
0
    }
16532
0
    if (PyObject_GetOptionalAttr(obj, state->kw_defaults, &tmp) < 0) {
16533
0
        return -1;
16534
0
    }
16535
0
    if (tmp == NULL) {
16536
0
        tmp = PyList_New(0);
16537
0
        if (tmp == NULL) {
16538
0
            return -1;
16539
0
        }
16540
0
    }
16541
0
    {
16542
0
        int res;
16543
0
        Py_ssize_t len;
16544
0
        Py_ssize_t i;
16545
0
        if (!PyList_Check(tmp)) {
16546
0
            PyErr_Format(PyExc_TypeError, "arguments field \"kw_defaults\" must be a list, not a %.200s", _PyType_Name(Py_TYPE(tmp)));
16547
0
            goto failed;
16548
0
        }
16549
0
        len = PyList_GET_SIZE(tmp);
16550
0
        kw_defaults = _Py_asdl_expr_seq_new(len, arena);
16551
0
        if (kw_defaults == NULL) goto failed;
16552
0
        for (i = 0; i < len; i++) {
16553
0
            expr_ty val;
16554
0
            PyObject *tmp2 = Py_NewRef(PyList_GET_ITEM(tmp, i));
16555
0
            if (_Py_EnterRecursiveCall(" while traversing 'arguments' node")) {
16556
0
                goto failed;
16557
0
            }
16558
0
            res = obj2ast_expr(state, tmp2, &val, arena);
16559
0
            _Py_LeaveRecursiveCall();
16560
0
            Py_DECREF(tmp2);
16561
0
            if (res != 0) goto failed;
16562
0
            if (len != PyList_GET_SIZE(tmp)) {
16563
0
                PyErr_SetString(PyExc_RuntimeError, "arguments field \"kw_defaults\" changed size during iteration");
16564
0
                goto failed;
16565
0
            }
16566
0
            asdl_seq_SET(kw_defaults, i, val);
16567
0
        }
16568
0
        Py_CLEAR(tmp);
16569
0
    }
16570
0
    if (PyObject_GetOptionalAttr(obj, state->kwarg, &tmp) < 0) {
16571
0
        return -1;
16572
0
    }
16573
0
    if (tmp == NULL || tmp == Py_None) {
16574
0
        Py_CLEAR(tmp);
16575
0
        kwarg = NULL;
16576
0
    }
16577
0
    else {
16578
0
        int res;
16579
0
        if (_Py_EnterRecursiveCall(" while traversing 'arguments' node")) {
16580
0
            goto failed;
16581
0
        }
16582
0
        res = obj2ast_arg(state, tmp, &kwarg, arena);
16583
0
        _Py_LeaveRecursiveCall();
16584
0
        if (res != 0) goto failed;
16585
0
        Py_CLEAR(tmp);
16586
0
    }
16587
0
    if (PyObject_GetOptionalAttr(obj, state->defaults, &tmp) < 0) {
16588
0
        return -1;
16589
0
    }
16590
0
    if (tmp == NULL) {
16591
0
        tmp = PyList_New(0);
16592
0
        if (tmp == NULL) {
16593
0
            return -1;
16594
0
        }
16595
0
    }
16596
0
    {
16597
0
        int res;
16598
0
        Py_ssize_t len;
16599
0
        Py_ssize_t i;
16600
0
        if (!PyList_Check(tmp)) {
16601
0
            PyErr_Format(PyExc_TypeError, "arguments field \"defaults\" must be a list, not a %.200s", _PyType_Name(Py_TYPE(tmp)));
16602
0
            goto failed;
16603
0
        }
16604
0
        len = PyList_GET_SIZE(tmp);
16605
0
        defaults = _Py_asdl_expr_seq_new(len, arena);
16606
0
        if (defaults == NULL) goto failed;
16607
0
        for (i = 0; i < len; i++) {
16608
0
            expr_ty val;
16609
0
            PyObject *tmp2 = Py_NewRef(PyList_GET_ITEM(tmp, i));
16610
0
            if (_Py_EnterRecursiveCall(" while traversing 'arguments' node")) {
16611
0
                goto failed;
16612
0
            }
16613
0
            res = obj2ast_expr(state, tmp2, &val, arena);
16614
0
            _Py_LeaveRecursiveCall();
16615
0
            Py_DECREF(tmp2);
16616
0
            if (res != 0) goto failed;
16617
0
            if (len != PyList_GET_SIZE(tmp)) {
16618
0
                PyErr_SetString(PyExc_RuntimeError, "arguments field \"defaults\" changed size during iteration");
16619
0
                goto failed;
16620
0
            }
16621
0
            asdl_seq_SET(defaults, i, val);
16622
0
        }
16623
0
        Py_CLEAR(tmp);
16624
0
    }
16625
0
    *out = _PyAST_arguments(posonlyargs, args, vararg, kwonlyargs, kw_defaults,
16626
0
                            kwarg, defaults, arena);
16627
0
    if (*out == NULL) goto failed;
16628
0
    return 0;
16629
0
failed:
16630
0
    Py_XDECREF(tmp);
16631
0
    return -1;
16632
0
}
16633
16634
int
16635
obj2ast_arg(struct ast_state *state, PyObject* obj, arg_ty* out, PyArena* arena)
16636
0
{
16637
0
    PyObject* tmp = NULL;
16638
0
    identifier arg;
16639
0
    expr_ty annotation;
16640
0
    string type_comment;
16641
0
    int lineno;
16642
0
    int col_offset;
16643
0
    int end_lineno;
16644
0
    int end_col_offset;
16645
16646
0
    if (PyObject_GetOptionalAttr(obj, state->arg, &tmp) < 0) {
16647
0
        return -1;
16648
0
    }
16649
0
    if (tmp == NULL) {
16650
0
        PyErr_SetString(PyExc_TypeError, "required field \"arg\" missing from arg");
16651
0
        return -1;
16652
0
    }
16653
0
    else {
16654
0
        int res;
16655
0
        if (_Py_EnterRecursiveCall(" while traversing 'arg' node")) {
16656
0
            goto failed;
16657
0
        }
16658
0
        res = obj2ast_identifier(state, tmp, &arg, arena);
16659
0
        _Py_LeaveRecursiveCall();
16660
0
        if (res != 0) goto failed;
16661
0
        Py_CLEAR(tmp);
16662
0
    }
16663
0
    if (PyObject_GetOptionalAttr(obj, state->annotation, &tmp) < 0) {
16664
0
        return -1;
16665
0
    }
16666
0
    if (tmp == NULL || tmp == Py_None) {
16667
0
        Py_CLEAR(tmp);
16668
0
        annotation = NULL;
16669
0
    }
16670
0
    else {
16671
0
        int res;
16672
0
        if (_Py_EnterRecursiveCall(" while traversing 'arg' node")) {
16673
0
            goto failed;
16674
0
        }
16675
0
        res = obj2ast_expr(state, tmp, &annotation, arena);
16676
0
        _Py_LeaveRecursiveCall();
16677
0
        if (res != 0) goto failed;
16678
0
        Py_CLEAR(tmp);
16679
0
    }
16680
0
    if (PyObject_GetOptionalAttr(obj, state->type_comment, &tmp) < 0) {
16681
0
        return -1;
16682
0
    }
16683
0
    if (tmp == NULL || tmp == Py_None) {
16684
0
        Py_CLEAR(tmp);
16685
0
        type_comment = NULL;
16686
0
    }
16687
0
    else {
16688
0
        int res;
16689
0
        if (_Py_EnterRecursiveCall(" while traversing 'arg' node")) {
16690
0
            goto failed;
16691
0
        }
16692
0
        res = obj2ast_string(state, tmp, &type_comment, arena);
16693
0
        _Py_LeaveRecursiveCall();
16694
0
        if (res != 0) goto failed;
16695
0
        Py_CLEAR(tmp);
16696
0
    }
16697
0
    if (PyObject_GetOptionalAttr(obj, state->lineno, &tmp) < 0) {
16698
0
        return -1;
16699
0
    }
16700
0
    if (tmp == NULL) {
16701
0
        PyErr_SetString(PyExc_TypeError, "required field \"lineno\" missing from arg");
16702
0
        return -1;
16703
0
    }
16704
0
    else {
16705
0
        int res;
16706
0
        if (_Py_EnterRecursiveCall(" while traversing 'arg' node")) {
16707
0
            goto failed;
16708
0
        }
16709
0
        res = obj2ast_int(state, tmp, &lineno, 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->col_offset, &tmp) < 0) {
16715
0
        return -1;
16716
0
    }
16717
0
    if (tmp == NULL) {
16718
0
        PyErr_SetString(PyExc_TypeError, "required field \"col_offset\" missing from arg");
16719
0
        return -1;
16720
0
    }
16721
0
    else {
16722
0
        int res;
16723
0
        if (_Py_EnterRecursiveCall(" while traversing 'arg' node")) {
16724
0
            goto failed;
16725
0
        }
16726
0
        res = obj2ast_int(state, tmp, &col_offset, 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->end_lineno, &tmp) < 0) {
16732
0
        return -1;
16733
0
    }
16734
0
    if (tmp == NULL || tmp == Py_None) {
16735
0
        Py_CLEAR(tmp);
16736
0
        end_lineno = lineno;
16737
0
    }
16738
0
    else {
16739
0
        int res;
16740
0
        if (_Py_EnterRecursiveCall(" while traversing 'arg' node")) {
16741
0
            goto failed;
16742
0
        }
16743
0
        res = obj2ast_int(state, tmp, &end_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->end_col_offset, &tmp) < 0) {
16749
0
        return -1;
16750
0
    }
16751
0
    if (tmp == NULL || tmp == Py_None) {
16752
0
        Py_CLEAR(tmp);
16753
0
        end_col_offset = col_offset;
16754
0
    }
16755
0
    else {
16756
0
        int res;
16757
0
        if (_Py_EnterRecursiveCall(" while traversing 'arg' node")) {
16758
0
            goto failed;
16759
0
        }
16760
0
        res = obj2ast_int(state, tmp, &end_col_offset, arena);
16761
0
        _Py_LeaveRecursiveCall();
16762
0
        if (res != 0) goto failed;
16763
0
        Py_CLEAR(tmp);
16764
0
    }
16765
0
    *out = _PyAST_arg(arg, annotation, type_comment, lineno, col_offset,
16766
0
                      end_lineno, end_col_offset, arena);
16767
0
    if (*out == NULL) goto failed;
16768
0
    return 0;
16769
0
failed:
16770
0
    Py_XDECREF(tmp);
16771
0
    return -1;
16772
0
}
16773
16774
int
16775
obj2ast_keyword(struct ast_state *state, PyObject* obj, keyword_ty* out,
16776
                PyArena* arena)
16777
0
{
16778
0
    PyObject* tmp = NULL;
16779
0
    identifier arg;
16780
0
    expr_ty value;
16781
0
    int lineno;
16782
0
    int col_offset;
16783
0
    int end_lineno;
16784
0
    int end_col_offset;
16785
16786
0
    if (PyObject_GetOptionalAttr(obj, state->arg, &tmp) < 0) {
16787
0
        return -1;
16788
0
    }
16789
0
    if (tmp == NULL || tmp == Py_None) {
16790
0
        Py_CLEAR(tmp);
16791
0
        arg = NULL;
16792
0
    }
16793
0
    else {
16794
0
        int res;
16795
0
        if (_Py_EnterRecursiveCall(" while traversing 'keyword' node")) {
16796
0
            goto failed;
16797
0
        }
16798
0
        res = obj2ast_identifier(state, tmp, &arg, arena);
16799
0
        _Py_LeaveRecursiveCall();
16800
0
        if (res != 0) goto failed;
16801
0
        Py_CLEAR(tmp);
16802
0
    }
16803
0
    if (PyObject_GetOptionalAttr(obj, state->value, &tmp) < 0) {
16804
0
        return -1;
16805
0
    }
16806
0
    if (tmp == NULL) {
16807
0
        PyErr_SetString(PyExc_TypeError, "required field \"value\" missing from keyword");
16808
0
        return -1;
16809
0
    }
16810
0
    else {
16811
0
        int res;
16812
0
        if (_Py_EnterRecursiveCall(" while traversing 'keyword' node")) {
16813
0
            goto failed;
16814
0
        }
16815
0
        res = obj2ast_expr(state, tmp, &value, arena);
16816
0
        _Py_LeaveRecursiveCall();
16817
0
        if (res != 0) goto failed;
16818
0
        Py_CLEAR(tmp);
16819
0
    }
16820
0
    if (PyObject_GetOptionalAttr(obj, state->lineno, &tmp) < 0) {
16821
0
        return -1;
16822
0
    }
16823
0
    if (tmp == NULL) {
16824
0
        PyErr_SetString(PyExc_TypeError, "required field \"lineno\" missing from keyword");
16825
0
        return -1;
16826
0
    }
16827
0
    else {
16828
0
        int res;
16829
0
        if (_Py_EnterRecursiveCall(" while traversing 'keyword' node")) {
16830
0
            goto failed;
16831
0
        }
16832
0
        res = obj2ast_int(state, tmp, &lineno, 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->col_offset, &tmp) < 0) {
16838
0
        return -1;
16839
0
    }
16840
0
    if (tmp == NULL) {
16841
0
        PyErr_SetString(PyExc_TypeError, "required field \"col_offset\" missing from keyword");
16842
0
        return -1;
16843
0
    }
16844
0
    else {
16845
0
        int res;
16846
0
        if (_Py_EnterRecursiveCall(" while traversing 'keyword' node")) {
16847
0
            goto failed;
16848
0
        }
16849
0
        res = obj2ast_int(state, tmp, &col_offset, 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->end_lineno, &tmp) < 0) {
16855
0
        return -1;
16856
0
    }
16857
0
    if (tmp == NULL || tmp == Py_None) {
16858
0
        Py_CLEAR(tmp);
16859
0
        end_lineno = lineno;
16860
0
    }
16861
0
    else {
16862
0
        int res;
16863
0
        if (_Py_EnterRecursiveCall(" while traversing 'keyword' node")) {
16864
0
            goto failed;
16865
0
        }
16866
0
        res = obj2ast_int(state, tmp, &end_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->end_col_offset, &tmp) < 0) {
16872
0
        return -1;
16873
0
    }
16874
0
    if (tmp == NULL || tmp == Py_None) {
16875
0
        Py_CLEAR(tmp);
16876
0
        end_col_offset = col_offset;
16877
0
    }
16878
0
    else {
16879
0
        int res;
16880
0
        if (_Py_EnterRecursiveCall(" while traversing 'keyword' node")) {
16881
0
            goto failed;
16882
0
        }
16883
0
        res = obj2ast_int(state, tmp, &end_col_offset, arena);
16884
0
        _Py_LeaveRecursiveCall();
16885
0
        if (res != 0) goto failed;
16886
0
        Py_CLEAR(tmp);
16887
0
    }
16888
0
    *out = _PyAST_keyword(arg, value, lineno, col_offset, end_lineno,
16889
0
                          end_col_offset, arena);
16890
0
    if (*out == NULL) goto failed;
16891
0
    return 0;
16892
0
failed:
16893
0
    Py_XDECREF(tmp);
16894
0
    return -1;
16895
0
}
16896
16897
int
16898
obj2ast_alias(struct ast_state *state, PyObject* obj, alias_ty* out, PyArena*
16899
              arena)
16900
0
{
16901
0
    PyObject* tmp = NULL;
16902
0
    identifier name;
16903
0
    identifier asname;
16904
0
    int lineno;
16905
0
    int col_offset;
16906
0
    int end_lineno;
16907
0
    int end_col_offset;
16908
16909
0
    if (PyObject_GetOptionalAttr(obj, state->name, &tmp) < 0) {
16910
0
        return -1;
16911
0
    }
16912
0
    if (tmp == NULL) {
16913
0
        PyErr_SetString(PyExc_TypeError, "required field \"name\" missing from alias");
16914
0
        return -1;
16915
0
    }
16916
0
    else {
16917
0
        int res;
16918
0
        if (_Py_EnterRecursiveCall(" while traversing 'alias' node")) {
16919
0
            goto failed;
16920
0
        }
16921
0
        res = obj2ast_identifier(state, tmp, &name, arena);
16922
0
        _Py_LeaveRecursiveCall();
16923
0
        if (res != 0) goto failed;
16924
0
        Py_CLEAR(tmp);
16925
0
    }
16926
0
    if (PyObject_GetOptionalAttr(obj, state->asname, &tmp) < 0) {
16927
0
        return -1;
16928
0
    }
16929
0
    if (tmp == NULL || tmp == Py_None) {
16930
0
        Py_CLEAR(tmp);
16931
0
        asname = NULL;
16932
0
    }
16933
0
    else {
16934
0
        int res;
16935
0
        if (_Py_EnterRecursiveCall(" while traversing 'alias' node")) {
16936
0
            goto failed;
16937
0
        }
16938
0
        res = obj2ast_identifier(state, tmp, &asname, arena);
16939
0
        _Py_LeaveRecursiveCall();
16940
0
        if (res != 0) goto failed;
16941
0
        Py_CLEAR(tmp);
16942
0
    }
16943
0
    if (PyObject_GetOptionalAttr(obj, state->lineno, &tmp) < 0) {
16944
0
        return -1;
16945
0
    }
16946
0
    if (tmp == NULL) {
16947
0
        PyErr_SetString(PyExc_TypeError, "required field \"lineno\" missing from alias");
16948
0
        return -1;
16949
0
    }
16950
0
    else {
16951
0
        int res;
16952
0
        if (_Py_EnterRecursiveCall(" while traversing 'alias' node")) {
16953
0
            goto failed;
16954
0
        }
16955
0
        res = obj2ast_int(state, tmp, &lineno, arena);
16956
0
        _Py_LeaveRecursiveCall();
16957
0
        if (res != 0) goto failed;
16958
0
        Py_CLEAR(tmp);
16959
0
    }
16960
0
    if (PyObject_GetOptionalAttr(obj, state->col_offset, &tmp) < 0) {
16961
0
        return -1;
16962
0
    }
16963
0
    if (tmp == NULL) {
16964
0
        PyErr_SetString(PyExc_TypeError, "required field \"col_offset\" missing from alias");
16965
0
        return -1;
16966
0
    }
16967
0
    else {
16968
0
        int res;
16969
0
        if (_Py_EnterRecursiveCall(" while traversing 'alias' node")) {
16970
0
            goto failed;
16971
0
        }
16972
0
        res = obj2ast_int(state, tmp, &col_offset, arena);
16973
0
        _Py_LeaveRecursiveCall();
16974
0
        if (res != 0) goto failed;
16975
0
        Py_CLEAR(tmp);
16976
0
    }
16977
0
    if (PyObject_GetOptionalAttr(obj, state->end_lineno, &tmp) < 0) {
16978
0
        return -1;
16979
0
    }
16980
0
    if (tmp == NULL || tmp == Py_None) {
16981
0
        Py_CLEAR(tmp);
16982
0
        end_lineno = lineno;
16983
0
    }
16984
0
    else {
16985
0
        int res;
16986
0
        if (_Py_EnterRecursiveCall(" while traversing 'alias' node")) {
16987
0
            goto failed;
16988
0
        }
16989
0
        res = obj2ast_int(state, tmp, &end_lineno, arena);
16990
0
        _Py_LeaveRecursiveCall();
16991
0
        if (res != 0) goto failed;
16992
0
        Py_CLEAR(tmp);
16993
0
    }
16994
0
    if (PyObject_GetOptionalAttr(obj, state->end_col_offset, &tmp) < 0) {
16995
0
        return -1;
16996
0
    }
16997
0
    if (tmp == NULL || tmp == Py_None) {
16998
0
        Py_CLEAR(tmp);
16999
0
        end_col_offset = col_offset;
17000
0
    }
17001
0
    else {
17002
0
        int res;
17003
0
        if (_Py_EnterRecursiveCall(" while traversing 'alias' node")) {
17004
0
            goto failed;
17005
0
        }
17006
0
        res = obj2ast_int(state, tmp, &end_col_offset, arena);
17007
0
        _Py_LeaveRecursiveCall();
17008
0
        if (res != 0) goto failed;
17009
0
        Py_CLEAR(tmp);
17010
0
    }
17011
0
    *out = _PyAST_alias(name, asname, lineno, col_offset, end_lineno,
17012
0
                        end_col_offset, arena);
17013
0
    if (*out == NULL) goto failed;
17014
0
    return 0;
17015
0
failed:
17016
0
    Py_XDECREF(tmp);
17017
0
    return -1;
17018
0
}
17019
17020
int
17021
obj2ast_withitem(struct ast_state *state, PyObject* obj, withitem_ty* out,
17022
                 PyArena* arena)
17023
0
{
17024
0
    PyObject* tmp = NULL;
17025
0
    expr_ty context_expr;
17026
0
    expr_ty optional_vars;
17027
17028
0
    if (PyObject_GetOptionalAttr(obj, state->context_expr, &tmp) < 0) {
17029
0
        return -1;
17030
0
    }
17031
0
    if (tmp == NULL) {
17032
0
        PyErr_SetString(PyExc_TypeError, "required field \"context_expr\" missing from withitem");
17033
0
        return -1;
17034
0
    }
17035
0
    else {
17036
0
        int res;
17037
0
        if (_Py_EnterRecursiveCall(" while traversing 'withitem' node")) {
17038
0
            goto failed;
17039
0
        }
17040
0
        res = obj2ast_expr(state, tmp, &context_expr, arena);
17041
0
        _Py_LeaveRecursiveCall();
17042
0
        if (res != 0) goto failed;
17043
0
        Py_CLEAR(tmp);
17044
0
    }
17045
0
    if (PyObject_GetOptionalAttr(obj, state->optional_vars, &tmp) < 0) {
17046
0
        return -1;
17047
0
    }
17048
0
    if (tmp == NULL || tmp == Py_None) {
17049
0
        Py_CLEAR(tmp);
17050
0
        optional_vars = NULL;
17051
0
    }
17052
0
    else {
17053
0
        int res;
17054
0
        if (_Py_EnterRecursiveCall(" while traversing 'withitem' node")) {
17055
0
            goto failed;
17056
0
        }
17057
0
        res = obj2ast_expr(state, tmp, &optional_vars, arena);
17058
0
        _Py_LeaveRecursiveCall();
17059
0
        if (res != 0) goto failed;
17060
0
        Py_CLEAR(tmp);
17061
0
    }
17062
0
    *out = _PyAST_withitem(context_expr, optional_vars, 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_match_case(struct ast_state *state, PyObject* obj, match_case_ty* out,
17072
                   PyArena* arena)
17073
0
{
17074
0
    PyObject* tmp = NULL;
17075
0
    pattern_ty pattern;
17076
0
    expr_ty guard;
17077
0
    asdl_stmt_seq* body;
17078
17079
0
    if (PyObject_GetOptionalAttr(obj, state->pattern, &tmp) < 0) {
17080
0
        return -1;
17081
0
    }
17082
0
    if (tmp == NULL) {
17083
0
        PyErr_SetString(PyExc_TypeError, "required field \"pattern\" missing from match_case");
17084
0
        return -1;
17085
0
    }
17086
0
    else {
17087
0
        int res;
17088
0
        if (_Py_EnterRecursiveCall(" while traversing 'match_case' node")) {
17089
0
            goto failed;
17090
0
        }
17091
0
        res = obj2ast_pattern(state, tmp, &pattern, arena);
17092
0
        _Py_LeaveRecursiveCall();
17093
0
        if (res != 0) goto failed;
17094
0
        Py_CLEAR(tmp);
17095
0
    }
17096
0
    if (PyObject_GetOptionalAttr(obj, state->guard, &tmp) < 0) {
17097
0
        return -1;
17098
0
    }
17099
0
    if (tmp == NULL || tmp == Py_None) {
17100
0
        Py_CLEAR(tmp);
17101
0
        guard = NULL;
17102
0
    }
17103
0
    else {
17104
0
        int res;
17105
0
        if (_Py_EnterRecursiveCall(" while traversing 'match_case' node")) {
17106
0
            goto failed;
17107
0
        }
17108
0
        res = obj2ast_expr(state, tmp, &guard, arena);
17109
0
        _Py_LeaveRecursiveCall();
17110
0
        if (res != 0) goto failed;
17111
0
        Py_CLEAR(tmp);
17112
0
    }
17113
0
    if (PyObject_GetOptionalAttr(obj, state->body, &tmp) < 0) {
17114
0
        return -1;
17115
0
    }
17116
0
    if (tmp == NULL) {
17117
0
        tmp = PyList_New(0);
17118
0
        if (tmp == NULL) {
17119
0
            return -1;
17120
0
        }
17121
0
    }
17122
0
    {
17123
0
        int res;
17124
0
        Py_ssize_t len;
17125
0
        Py_ssize_t i;
17126
0
        if (!PyList_Check(tmp)) {
17127
0
            PyErr_Format(PyExc_TypeError, "match_case field \"body\" must be a list, not a %.200s", _PyType_Name(Py_TYPE(tmp)));
17128
0
            goto failed;
17129
0
        }
17130
0
        len = PyList_GET_SIZE(tmp);
17131
0
        body = _Py_asdl_stmt_seq_new(len, arena);
17132
0
        if (body == NULL) goto failed;
17133
0
        for (i = 0; i < len; i++) {
17134
0
            stmt_ty val;
17135
0
            PyObject *tmp2 = Py_NewRef(PyList_GET_ITEM(tmp, i));
17136
0
            if (_Py_EnterRecursiveCall(" while traversing 'match_case' node")) {
17137
0
                goto failed;
17138
0
            }
17139
0
            res = obj2ast_stmt(state, tmp2, &val, arena);
17140
0
            _Py_LeaveRecursiveCall();
17141
0
            Py_DECREF(tmp2);
17142
0
            if (res != 0) goto failed;
17143
0
            if (len != PyList_GET_SIZE(tmp)) {
17144
0
                PyErr_SetString(PyExc_RuntimeError, "match_case field \"body\" changed size during iteration");
17145
0
                goto failed;
17146
0
            }
17147
0
            asdl_seq_SET(body, i, val);
17148
0
        }
17149
0
        Py_CLEAR(tmp);
17150
0
    }
17151
0
    *out = _PyAST_match_case(pattern, guard, body, arena);
17152
0
    if (*out == NULL) goto failed;
17153
0
    return 0;
17154
0
failed:
17155
0
    Py_XDECREF(tmp);
17156
0
    return -1;
17157
0
}
17158
17159
int
17160
obj2ast_pattern(struct ast_state *state, PyObject* obj, pattern_ty* out,
17161
                PyArena* arena)
17162
0
{
17163
0
    int isinstance;
17164
17165
0
    PyObject *tmp = NULL;
17166
0
    PyObject *tp;
17167
0
    int lineno;
17168
0
    int col_offset;
17169
0
    int end_lineno;
17170
0
    int end_col_offset;
17171
17172
0
    if (obj == Py_None) {
17173
0
        *out = NULL;
17174
0
        return 0;
17175
0
    }
17176
0
    if (PyObject_GetOptionalAttr(obj, state->lineno, &tmp) < 0) {
17177
0
        return -1;
17178
0
    }
17179
0
    if (tmp == NULL) {
17180
0
        PyErr_SetString(PyExc_TypeError, "required field \"lineno\" missing from pattern");
17181
0
        return -1;
17182
0
    }
17183
0
    else {
17184
0
        int res;
17185
0
        if (_Py_EnterRecursiveCall(" while traversing 'pattern' node")) {
17186
0
            goto failed;
17187
0
        }
17188
0
        res = obj2ast_int(state, tmp, &lineno, arena);
17189
0
        _Py_LeaveRecursiveCall();
17190
0
        if (res != 0) goto failed;
17191
0
        Py_CLEAR(tmp);
17192
0
    }
17193
0
    if (PyObject_GetOptionalAttr(obj, state->col_offset, &tmp) < 0) {
17194
0
        return -1;
17195
0
    }
17196
0
    if (tmp == NULL) {
17197
0
        PyErr_SetString(PyExc_TypeError, "required field \"col_offset\" missing from pattern");
17198
0
        return -1;
17199
0
    }
17200
0
    else {
17201
0
        int res;
17202
0
        if (_Py_EnterRecursiveCall(" while traversing 'pattern' node")) {
17203
0
            goto failed;
17204
0
        }
17205
0
        res = obj2ast_int(state, tmp, &col_offset, arena);
17206
0
        _Py_LeaveRecursiveCall();
17207
0
        if (res != 0) goto failed;
17208
0
        Py_CLEAR(tmp);
17209
0
    }
17210
0
    if (PyObject_GetOptionalAttr(obj, state->end_lineno, &tmp) < 0) {
17211
0
        return -1;
17212
0
    }
17213
0
    if (tmp == NULL) {
17214
0
        PyErr_SetString(PyExc_TypeError, "required field \"end_lineno\" missing from pattern");
17215
0
        return -1;
17216
0
    }
17217
0
    else {
17218
0
        int res;
17219
0
        if (_Py_EnterRecursiveCall(" while traversing 'pattern' node")) {
17220
0
            goto failed;
17221
0
        }
17222
0
        res = obj2ast_int(state, tmp, &end_lineno, arena);
17223
0
        _Py_LeaveRecursiveCall();
17224
0
        if (res != 0) goto failed;
17225
0
        Py_CLEAR(tmp);
17226
0
    }
17227
0
    if (PyObject_GetOptionalAttr(obj, state->end_col_offset, &tmp) < 0) {
17228
0
        return -1;
17229
0
    }
17230
0
    if (tmp == NULL) {
17231
0
        PyErr_SetString(PyExc_TypeError, "required field \"end_col_offset\" missing from pattern");
17232
0
        return -1;
17233
0
    }
17234
0
    else {
17235
0
        int res;
17236
0
        if (_Py_EnterRecursiveCall(" while traversing 'pattern' node")) {
17237
0
            goto failed;
17238
0
        }
17239
0
        res = obj2ast_int(state, tmp, &end_col_offset, arena);
17240
0
        _Py_LeaveRecursiveCall();
17241
0
        if (res != 0) goto failed;
17242
0
        Py_CLEAR(tmp);
17243
0
    }
17244
0
    tp = state->MatchValue_type;
17245
0
    isinstance = PyObject_IsInstance(obj, tp);
17246
0
    if (isinstance == -1) {
17247
0
        return -1;
17248
0
    }
17249
0
    if (isinstance) {
17250
0
        expr_ty value;
17251
17252
0
        if (PyObject_GetOptionalAttr(obj, state->value, &tmp) < 0) {
17253
0
            return -1;
17254
0
        }
17255
0
        if (tmp == NULL) {
17256
0
            PyErr_SetString(PyExc_TypeError, "required field \"value\" missing from MatchValue");
17257
0
            return -1;
17258
0
        }
17259
0
        else {
17260
0
            int res;
17261
0
            if (_Py_EnterRecursiveCall(" while traversing 'MatchValue' node")) {
17262
0
                goto failed;
17263
0
            }
17264
0
            res = obj2ast_expr(state, tmp, &value, arena);
17265
0
            _Py_LeaveRecursiveCall();
17266
0
            if (res != 0) goto failed;
17267
0
            Py_CLEAR(tmp);
17268
0
        }
17269
0
        *out = _PyAST_MatchValue(value, lineno, col_offset, end_lineno,
17270
0
                                 end_col_offset, arena);
17271
0
        if (*out == NULL) goto failed;
17272
0
        return 0;
17273
0
    }
17274
0
    tp = state->MatchSingleton_type;
17275
0
    isinstance = PyObject_IsInstance(obj, tp);
17276
0
    if (isinstance == -1) {
17277
0
        return -1;
17278
0
    }
17279
0
    if (isinstance) {
17280
0
        constant value;
17281
17282
0
        if (PyObject_GetOptionalAttr(obj, state->value, &tmp) < 0) {
17283
0
            return -1;
17284
0
        }
17285
0
        if (tmp == NULL) {
17286
0
            PyErr_SetString(PyExc_TypeError, "required field \"value\" missing from MatchSingleton");
17287
0
            return -1;
17288
0
        }
17289
0
        else {
17290
0
            int res;
17291
0
            if (_Py_EnterRecursiveCall(" while traversing 'MatchSingleton' node")) {
17292
0
                goto failed;
17293
0
            }
17294
0
            res = obj2ast_constant(state, tmp, &value, arena);
17295
0
            _Py_LeaveRecursiveCall();
17296
0
            if (res != 0) goto failed;
17297
0
            Py_CLEAR(tmp);
17298
0
        }
17299
0
        *out = _PyAST_MatchSingleton(value, lineno, col_offset, end_lineno,
17300
0
                                     end_col_offset, arena);
17301
0
        if (*out == NULL) goto failed;
17302
0
        return 0;
17303
0
    }
17304
0
    tp = state->MatchSequence_type;
17305
0
    isinstance = PyObject_IsInstance(obj, tp);
17306
0
    if (isinstance == -1) {
17307
0
        return -1;
17308
0
    }
17309
0
    if (isinstance) {
17310
0
        asdl_pattern_seq* patterns;
17311
17312
0
        if (PyObject_GetOptionalAttr(obj, state->patterns, &tmp) < 0) {
17313
0
            return -1;
17314
0
        }
17315
0
        if (tmp == NULL) {
17316
0
            tmp = PyList_New(0);
17317
0
            if (tmp == NULL) {
17318
0
                return -1;
17319
0
            }
17320
0
        }
17321
0
        {
17322
0
            int res;
17323
0
            Py_ssize_t len;
17324
0
            Py_ssize_t i;
17325
0
            if (!PyList_Check(tmp)) {
17326
0
                PyErr_Format(PyExc_TypeError, "MatchSequence field \"patterns\" must be a list, not a %.200s", _PyType_Name(Py_TYPE(tmp)));
17327
0
                goto failed;
17328
0
            }
17329
0
            len = PyList_GET_SIZE(tmp);
17330
0
            patterns = _Py_asdl_pattern_seq_new(len, arena);
17331
0
            if (patterns == NULL) goto failed;
17332
0
            for (i = 0; i < len; i++) {
17333
0
                pattern_ty val;
17334
0
                PyObject *tmp2 = Py_NewRef(PyList_GET_ITEM(tmp, i));
17335
0
                if (_Py_EnterRecursiveCall(" while traversing 'MatchSequence' node")) {
17336
0
                    goto failed;
17337
0
                }
17338
0
                res = obj2ast_pattern(state, tmp2, &val, arena);
17339
0
                _Py_LeaveRecursiveCall();
17340
0
                Py_DECREF(tmp2);
17341
0
                if (res != 0) goto failed;
17342
0
                if (len != PyList_GET_SIZE(tmp)) {
17343
0
                    PyErr_SetString(PyExc_RuntimeError, "MatchSequence field \"patterns\" changed size during iteration");
17344
0
                    goto failed;
17345
0
                }
17346
0
                asdl_seq_SET(patterns, i, val);
17347
0
            }
17348
0
            Py_CLEAR(tmp);
17349
0
        }
17350
0
        *out = _PyAST_MatchSequence(patterns, lineno, col_offset, end_lineno,
17351
0
                                    end_col_offset, arena);
17352
0
        if (*out == NULL) goto failed;
17353
0
        return 0;
17354
0
    }
17355
0
    tp = state->MatchMapping_type;
17356
0
    isinstance = PyObject_IsInstance(obj, tp);
17357
0
    if (isinstance == -1) {
17358
0
        return -1;
17359
0
    }
17360
0
    if (isinstance) {
17361
0
        asdl_expr_seq* keys;
17362
0
        asdl_pattern_seq* patterns;
17363
0
        identifier rest;
17364
17365
0
        if (PyObject_GetOptionalAttr(obj, state->keys, &tmp) < 0) {
17366
0
            return -1;
17367
0
        }
17368
0
        if (tmp == NULL) {
17369
0
            tmp = PyList_New(0);
17370
0
            if (tmp == NULL) {
17371
0
                return -1;
17372
0
            }
17373
0
        }
17374
0
        {
17375
0
            int res;
17376
0
            Py_ssize_t len;
17377
0
            Py_ssize_t i;
17378
0
            if (!PyList_Check(tmp)) {
17379
0
                PyErr_Format(PyExc_TypeError, "MatchMapping field \"keys\" must be a list, not a %.200s", _PyType_Name(Py_TYPE(tmp)));
17380
0
                goto failed;
17381
0
            }
17382
0
            len = PyList_GET_SIZE(tmp);
17383
0
            keys = _Py_asdl_expr_seq_new(len, arena);
17384
0
            if (keys == NULL) goto failed;
17385
0
            for (i = 0; i < len; i++) {
17386
0
                expr_ty val;
17387
0
                PyObject *tmp2 = Py_NewRef(PyList_GET_ITEM(tmp, i));
17388
0
                if (_Py_EnterRecursiveCall(" while traversing 'MatchMapping' node")) {
17389
0
                    goto failed;
17390
0
                }
17391
0
                res = obj2ast_expr(state, tmp2, &val, arena);
17392
0
                _Py_LeaveRecursiveCall();
17393
0
                Py_DECREF(tmp2);
17394
0
                if (res != 0) goto failed;
17395
0
                if (len != PyList_GET_SIZE(tmp)) {
17396
0
                    PyErr_SetString(PyExc_RuntimeError, "MatchMapping field \"keys\" changed size during iteration");
17397
0
                    goto failed;
17398
0
                }
17399
0
                asdl_seq_SET(keys, i, val);
17400
0
            }
17401
0
            Py_CLEAR(tmp);
17402
0
        }
17403
0
        if (PyObject_GetOptionalAttr(obj, state->patterns, &tmp) < 0) {
17404
0
            return -1;
17405
0
        }
17406
0
        if (tmp == NULL) {
17407
0
            tmp = PyList_New(0);
17408
0
            if (tmp == NULL) {
17409
0
                return -1;
17410
0
            }
17411
0
        }
17412
0
        {
17413
0
            int res;
17414
0
            Py_ssize_t len;
17415
0
            Py_ssize_t i;
17416
0
            if (!PyList_Check(tmp)) {
17417
0
                PyErr_Format(PyExc_TypeError, "MatchMapping field \"patterns\" must be a list, not a %.200s", _PyType_Name(Py_TYPE(tmp)));
17418
0
                goto failed;
17419
0
            }
17420
0
            len = PyList_GET_SIZE(tmp);
17421
0
            patterns = _Py_asdl_pattern_seq_new(len, arena);
17422
0
            if (patterns == NULL) goto failed;
17423
0
            for (i = 0; i < len; i++) {
17424
0
                pattern_ty val;
17425
0
                PyObject *tmp2 = Py_NewRef(PyList_GET_ITEM(tmp, i));
17426
0
                if (_Py_EnterRecursiveCall(" while traversing 'MatchMapping' node")) {
17427
0
                    goto failed;
17428
0
                }
17429
0
                res = obj2ast_pattern(state, tmp2, &val, arena);
17430
0
                _Py_LeaveRecursiveCall();
17431
0
                Py_DECREF(tmp2);
17432
0
                if (res != 0) goto failed;
17433
0
                if (len != PyList_GET_SIZE(tmp)) {
17434
0
                    PyErr_SetString(PyExc_RuntimeError, "MatchMapping field \"patterns\" changed size during iteration");
17435
0
                    goto failed;
17436
0
                }
17437
0
                asdl_seq_SET(patterns, i, val);
17438
0
            }
17439
0
            Py_CLEAR(tmp);
17440
0
        }
17441
0
        if (PyObject_GetOptionalAttr(obj, state->rest, &tmp) < 0) {
17442
0
            return -1;
17443
0
        }
17444
0
        if (tmp == NULL || tmp == Py_None) {
17445
0
            Py_CLEAR(tmp);
17446
0
            rest = NULL;
17447
0
        }
17448
0
        else {
17449
0
            int res;
17450
0
            if (_Py_EnterRecursiveCall(" while traversing 'MatchMapping' node")) {
17451
0
                goto failed;
17452
0
            }
17453
0
            res = obj2ast_identifier(state, tmp, &rest, arena);
17454
0
            _Py_LeaveRecursiveCall();
17455
0
            if (res != 0) goto failed;
17456
0
            Py_CLEAR(tmp);
17457
0
        }
17458
0
        *out = _PyAST_MatchMapping(keys, patterns, rest, lineno, col_offset,
17459
0
                                   end_lineno, end_col_offset, arena);
17460
0
        if (*out == NULL) goto failed;
17461
0
        return 0;
17462
0
    }
17463
0
    tp = state->MatchClass_type;
17464
0
    isinstance = PyObject_IsInstance(obj, tp);
17465
0
    if (isinstance == -1) {
17466
0
        return -1;
17467
0
    }
17468
0
    if (isinstance) {
17469
0
        expr_ty cls;
17470
0
        asdl_pattern_seq* patterns;
17471
0
        asdl_identifier_seq* kwd_attrs;
17472
0
        asdl_pattern_seq* kwd_patterns;
17473
17474
0
        if (PyObject_GetOptionalAttr(obj, state->cls, &tmp) < 0) {
17475
0
            return -1;
17476
0
        }
17477
0
        if (tmp == NULL) {
17478
0
            PyErr_SetString(PyExc_TypeError, "required field \"cls\" missing from MatchClass");
17479
0
            return -1;
17480
0
        }
17481
0
        else {
17482
0
            int res;
17483
0
            if (_Py_EnterRecursiveCall(" while traversing 'MatchClass' node")) {
17484
0
                goto failed;
17485
0
            }
17486
0
            res = obj2ast_expr(state, tmp, &cls, arena);
17487
0
            _Py_LeaveRecursiveCall();
17488
0
            if (res != 0) goto failed;
17489
0
            Py_CLEAR(tmp);
17490
0
        }
17491
0
        if (PyObject_GetOptionalAttr(obj, state->patterns, &tmp) < 0) {
17492
0
            return -1;
17493
0
        }
17494
0
        if (tmp == NULL) {
17495
0
            tmp = PyList_New(0);
17496
0
            if (tmp == NULL) {
17497
0
                return -1;
17498
0
            }
17499
0
        }
17500
0
        {
17501
0
            int res;
17502
0
            Py_ssize_t len;
17503
0
            Py_ssize_t i;
17504
0
            if (!PyList_Check(tmp)) {
17505
0
                PyErr_Format(PyExc_TypeError, "MatchClass field \"patterns\" must be a list, not a %.200s", _PyType_Name(Py_TYPE(tmp)));
17506
0
                goto failed;
17507
0
            }
17508
0
            len = PyList_GET_SIZE(tmp);
17509
0
            patterns = _Py_asdl_pattern_seq_new(len, arena);
17510
0
            if (patterns == NULL) goto failed;
17511
0
            for (i = 0; i < len; i++) {
17512
0
                pattern_ty val;
17513
0
                PyObject *tmp2 = Py_NewRef(PyList_GET_ITEM(tmp, i));
17514
0
                if (_Py_EnterRecursiveCall(" while traversing 'MatchClass' node")) {
17515
0
                    goto failed;
17516
0
                }
17517
0
                res = obj2ast_pattern(state, tmp2, &val, arena);
17518
0
                _Py_LeaveRecursiveCall();
17519
0
                Py_DECREF(tmp2);
17520
0
                if (res != 0) goto failed;
17521
0
                if (len != PyList_GET_SIZE(tmp)) {
17522
0
                    PyErr_SetString(PyExc_RuntimeError, "MatchClass field \"patterns\" changed size during iteration");
17523
0
                    goto failed;
17524
0
                }
17525
0
                asdl_seq_SET(patterns, i, val);
17526
0
            }
17527
0
            Py_CLEAR(tmp);
17528
0
        }
17529
0
        if (PyObject_GetOptionalAttr(obj, state->kwd_attrs, &tmp) < 0) {
17530
0
            return -1;
17531
0
        }
17532
0
        if (tmp == NULL) {
17533
0
            tmp = PyList_New(0);
17534
0
            if (tmp == NULL) {
17535
0
                return -1;
17536
0
            }
17537
0
        }
17538
0
        {
17539
0
            int res;
17540
0
            Py_ssize_t len;
17541
0
            Py_ssize_t i;
17542
0
            if (!PyList_Check(tmp)) {
17543
0
                PyErr_Format(PyExc_TypeError, "MatchClass field \"kwd_attrs\" must be a list, not a %.200s", _PyType_Name(Py_TYPE(tmp)));
17544
0
                goto failed;
17545
0
            }
17546
0
            len = PyList_GET_SIZE(tmp);
17547
0
            kwd_attrs = _Py_asdl_identifier_seq_new(len, arena);
17548
0
            if (kwd_attrs == NULL) goto failed;
17549
0
            for (i = 0; i < len; i++) {
17550
0
                identifier val;
17551
0
                PyObject *tmp2 = Py_NewRef(PyList_GET_ITEM(tmp, i));
17552
0
                if (_Py_EnterRecursiveCall(" while traversing 'MatchClass' node")) {
17553
0
                    goto failed;
17554
0
                }
17555
0
                res = obj2ast_identifier(state, tmp2, &val, arena);
17556
0
                _Py_LeaveRecursiveCall();
17557
0
                Py_DECREF(tmp2);
17558
0
                if (res != 0) goto failed;
17559
0
                if (len != PyList_GET_SIZE(tmp)) {
17560
0
                    PyErr_SetString(PyExc_RuntimeError, "MatchClass field \"kwd_attrs\" changed size during iteration");
17561
0
                    goto failed;
17562
0
                }
17563
0
                asdl_seq_SET(kwd_attrs, i, val);
17564
0
            }
17565
0
            Py_CLEAR(tmp);
17566
0
        }
17567
0
        if (PyObject_GetOptionalAttr(obj, state->kwd_patterns, &tmp) < 0) {
17568
0
            return -1;
17569
0
        }
17570
0
        if (tmp == NULL) {
17571
0
            tmp = PyList_New(0);
17572
0
            if (tmp == NULL) {
17573
0
                return -1;
17574
0
            }
17575
0
        }
17576
0
        {
17577
0
            int res;
17578
0
            Py_ssize_t len;
17579
0
            Py_ssize_t i;
17580
0
            if (!PyList_Check(tmp)) {
17581
0
                PyErr_Format(PyExc_TypeError, "MatchClass field \"kwd_patterns\" must be a list, not a %.200s", _PyType_Name(Py_TYPE(tmp)));
17582
0
                goto failed;
17583
0
            }
17584
0
            len = PyList_GET_SIZE(tmp);
17585
0
            kwd_patterns = _Py_asdl_pattern_seq_new(len, arena);
17586
0
            if (kwd_patterns == NULL) goto failed;
17587
0
            for (i = 0; i < len; i++) {
17588
0
                pattern_ty val;
17589
0
                PyObject *tmp2 = Py_NewRef(PyList_GET_ITEM(tmp, i));
17590
0
                if (_Py_EnterRecursiveCall(" while traversing 'MatchClass' node")) {
17591
0
                    goto failed;
17592
0
                }
17593
0
                res = obj2ast_pattern(state, tmp2, &val, arena);
17594
0
                _Py_LeaveRecursiveCall();
17595
0
                Py_DECREF(tmp2);
17596
0
                if (res != 0) goto failed;
17597
0
                if (len != PyList_GET_SIZE(tmp)) {
17598
0
                    PyErr_SetString(PyExc_RuntimeError, "MatchClass field \"kwd_patterns\" changed size during iteration");
17599
0
                    goto failed;
17600
0
                }
17601
0
                asdl_seq_SET(kwd_patterns, i, val);
17602
0
            }
17603
0
            Py_CLEAR(tmp);
17604
0
        }
17605
0
        *out = _PyAST_MatchClass(cls, patterns, kwd_attrs, kwd_patterns,
17606
0
                                 lineno, col_offset, end_lineno,
17607
0
                                 end_col_offset, arena);
17608
0
        if (*out == NULL) goto failed;
17609
0
        return 0;
17610
0
    }
17611
0
    tp = state->MatchStar_type;
17612
0
    isinstance = PyObject_IsInstance(obj, tp);
17613
0
    if (isinstance == -1) {
17614
0
        return -1;
17615
0
    }
17616
0
    if (isinstance) {
17617
0
        identifier name;
17618
17619
0
        if (PyObject_GetOptionalAttr(obj, state->name, &tmp) < 0) {
17620
0
            return -1;
17621
0
        }
17622
0
        if (tmp == NULL || tmp == Py_None) {
17623
0
            Py_CLEAR(tmp);
17624
0
            name = NULL;
17625
0
        }
17626
0
        else {
17627
0
            int res;
17628
0
            if (_Py_EnterRecursiveCall(" while traversing 'MatchStar' node")) {
17629
0
                goto failed;
17630
0
            }
17631
0
            res = obj2ast_identifier(state, tmp, &name, arena);
17632
0
            _Py_LeaveRecursiveCall();
17633
0
            if (res != 0) goto failed;
17634
0
            Py_CLEAR(tmp);
17635
0
        }
17636
0
        *out = _PyAST_MatchStar(name, lineno, col_offset, end_lineno,
17637
0
                                end_col_offset, arena);
17638
0
        if (*out == NULL) goto failed;
17639
0
        return 0;
17640
0
    }
17641
0
    tp = state->MatchAs_type;
17642
0
    isinstance = PyObject_IsInstance(obj, tp);
17643
0
    if (isinstance == -1) {
17644
0
        return -1;
17645
0
    }
17646
0
    if (isinstance) {
17647
0
        pattern_ty pattern;
17648
0
        identifier name;
17649
17650
0
        if (PyObject_GetOptionalAttr(obj, state->pattern, &tmp) < 0) {
17651
0
            return -1;
17652
0
        }
17653
0
        if (tmp == NULL || tmp == Py_None) {
17654
0
            Py_CLEAR(tmp);
17655
0
            pattern = NULL;
17656
0
        }
17657
0
        else {
17658
0
            int res;
17659
0
            if (_Py_EnterRecursiveCall(" while traversing 'MatchAs' node")) {
17660
0
                goto failed;
17661
0
            }
17662
0
            res = obj2ast_pattern(state, tmp, &pattern, arena);
17663
0
            _Py_LeaveRecursiveCall();
17664
0
            if (res != 0) goto failed;
17665
0
            Py_CLEAR(tmp);
17666
0
        }
17667
0
        if (PyObject_GetOptionalAttr(obj, state->name, &tmp) < 0) {
17668
0
            return -1;
17669
0
        }
17670
0
        if (tmp == NULL || tmp == Py_None) {
17671
0
            Py_CLEAR(tmp);
17672
0
            name = NULL;
17673
0
        }
17674
0
        else {
17675
0
            int res;
17676
0
            if (_Py_EnterRecursiveCall(" while traversing 'MatchAs' node")) {
17677
0
                goto failed;
17678
0
            }
17679
0
            res = obj2ast_identifier(state, tmp, &name, arena);
17680
0
            _Py_LeaveRecursiveCall();
17681
0
            if (res != 0) goto failed;
17682
0
            Py_CLEAR(tmp);
17683
0
        }
17684
0
        *out = _PyAST_MatchAs(pattern, name, lineno, col_offset, end_lineno,
17685
0
                              end_col_offset, arena);
17686
0
        if (*out == NULL) goto failed;
17687
0
        return 0;
17688
0
    }
17689
0
    tp = state->MatchOr_type;
17690
0
    isinstance = PyObject_IsInstance(obj, tp);
17691
0
    if (isinstance == -1) {
17692
0
        return -1;
17693
0
    }
17694
0
    if (isinstance) {
17695
0
        asdl_pattern_seq* patterns;
17696
17697
0
        if (PyObject_GetOptionalAttr(obj, state->patterns, &tmp) < 0) {
17698
0
            return -1;
17699
0
        }
17700
0
        if (tmp == NULL) {
17701
0
            tmp = PyList_New(0);
17702
0
            if (tmp == NULL) {
17703
0
                return -1;
17704
0
            }
17705
0
        }
17706
0
        {
17707
0
            int res;
17708
0
            Py_ssize_t len;
17709
0
            Py_ssize_t i;
17710
0
            if (!PyList_Check(tmp)) {
17711
0
                PyErr_Format(PyExc_TypeError, "MatchOr field \"patterns\" must be a list, not a %.200s", _PyType_Name(Py_TYPE(tmp)));
17712
0
                goto failed;
17713
0
            }
17714
0
            len = PyList_GET_SIZE(tmp);
17715
0
            patterns = _Py_asdl_pattern_seq_new(len, arena);
17716
0
            if (patterns == NULL) goto failed;
17717
0
            for (i = 0; i < len; i++) {
17718
0
                pattern_ty val;
17719
0
                PyObject *tmp2 = Py_NewRef(PyList_GET_ITEM(tmp, i));
17720
0
                if (_Py_EnterRecursiveCall(" while traversing 'MatchOr' node")) {
17721
0
                    goto failed;
17722
0
                }
17723
0
                res = obj2ast_pattern(state, tmp2, &val, arena);
17724
0
                _Py_LeaveRecursiveCall();
17725
0
                Py_DECREF(tmp2);
17726
0
                if (res != 0) goto failed;
17727
0
                if (len != PyList_GET_SIZE(tmp)) {
17728
0
                    PyErr_SetString(PyExc_RuntimeError, "MatchOr field \"patterns\" changed size during iteration");
17729
0
                    goto failed;
17730
0
                }
17731
0
                asdl_seq_SET(patterns, i, val);
17732
0
            }
17733
0
            Py_CLEAR(tmp);
17734
0
        }
17735
0
        *out = _PyAST_MatchOr(patterns, lineno, col_offset, end_lineno,
17736
0
                              end_col_offset, arena);
17737
0
        if (*out == NULL) goto failed;
17738
0
        return 0;
17739
0
    }
17740
17741
0
    PyErr_Format(PyExc_TypeError, "expected some sort of pattern, but got %R", obj);
17742
0
    failed:
17743
0
    Py_XDECREF(tmp);
17744
0
    return -1;
17745
0
}
17746
17747
int
17748
obj2ast_type_ignore(struct ast_state *state, PyObject* obj, type_ignore_ty*
17749
                    out, PyArena* arena)
17750
0
{
17751
0
    int isinstance;
17752
17753
0
    PyObject *tmp = NULL;
17754
0
    PyObject *tp;
17755
17756
0
    if (obj == Py_None) {
17757
0
        *out = NULL;
17758
0
        return 0;
17759
0
    }
17760
0
    tp = state->TypeIgnore_type;
17761
0
    isinstance = PyObject_IsInstance(obj, tp);
17762
0
    if (isinstance == -1) {
17763
0
        return -1;
17764
0
    }
17765
0
    if (isinstance) {
17766
0
        int lineno;
17767
0
        string tag;
17768
17769
0
        if (PyObject_GetOptionalAttr(obj, state->lineno, &tmp) < 0) {
17770
0
            return -1;
17771
0
        }
17772
0
        if (tmp == NULL) {
17773
0
            PyErr_SetString(PyExc_TypeError, "required field \"lineno\" missing from TypeIgnore");
17774
0
            return -1;
17775
0
        }
17776
0
        else {
17777
0
            int res;
17778
0
            if (_Py_EnterRecursiveCall(" while traversing 'TypeIgnore' node")) {
17779
0
                goto failed;
17780
0
            }
17781
0
            res = obj2ast_int(state, tmp, &lineno, arena);
17782
0
            _Py_LeaveRecursiveCall();
17783
0
            if (res != 0) goto failed;
17784
0
            Py_CLEAR(tmp);
17785
0
        }
17786
0
        if (PyObject_GetOptionalAttr(obj, state->tag, &tmp) < 0) {
17787
0
            return -1;
17788
0
        }
17789
0
        if (tmp == NULL) {
17790
0
            PyErr_SetString(PyExc_TypeError, "required field \"tag\" missing from TypeIgnore");
17791
0
            return -1;
17792
0
        }
17793
0
        else {
17794
0
            int res;
17795
0
            if (_Py_EnterRecursiveCall(" while traversing 'TypeIgnore' node")) {
17796
0
                goto failed;
17797
0
            }
17798
0
            res = obj2ast_string(state, tmp, &tag, arena);
17799
0
            _Py_LeaveRecursiveCall();
17800
0
            if (res != 0) goto failed;
17801
0
            Py_CLEAR(tmp);
17802
0
        }
17803
0
        *out = _PyAST_TypeIgnore(lineno, tag, arena);
17804
0
        if (*out == NULL) goto failed;
17805
0
        return 0;
17806
0
    }
17807
17808
0
    PyErr_Format(PyExc_TypeError, "expected some sort of type_ignore, but got %R", obj);
17809
0
    failed:
17810
0
    Py_XDECREF(tmp);
17811
0
    return -1;
17812
0
}
17813
17814
int
17815
obj2ast_type_param(struct ast_state *state, PyObject* obj, type_param_ty* out,
17816
                   PyArena* arena)
17817
0
{
17818
0
    int isinstance;
17819
17820
0
    PyObject *tmp = NULL;
17821
0
    PyObject *tp;
17822
0
    int lineno;
17823
0
    int col_offset;
17824
0
    int end_lineno;
17825
0
    int end_col_offset;
17826
17827
0
    if (obj == Py_None) {
17828
0
        *out = NULL;
17829
0
        return 0;
17830
0
    }
17831
0
    if (PyObject_GetOptionalAttr(obj, state->lineno, &tmp) < 0) {
17832
0
        return -1;
17833
0
    }
17834
0
    if (tmp == NULL) {
17835
0
        PyErr_SetString(PyExc_TypeError, "required field \"lineno\" missing from type_param");
17836
0
        return -1;
17837
0
    }
17838
0
    else {
17839
0
        int res;
17840
0
        if (_Py_EnterRecursiveCall(" while traversing 'type_param' node")) {
17841
0
            goto failed;
17842
0
        }
17843
0
        res = obj2ast_int(state, tmp, &lineno, arena);
17844
0
        _Py_LeaveRecursiveCall();
17845
0
        if (res != 0) goto failed;
17846
0
        Py_CLEAR(tmp);
17847
0
    }
17848
0
    if (PyObject_GetOptionalAttr(obj, state->col_offset, &tmp) < 0) {
17849
0
        return -1;
17850
0
    }
17851
0
    if (tmp == NULL) {
17852
0
        PyErr_SetString(PyExc_TypeError, "required field \"col_offset\" missing from type_param");
17853
0
        return -1;
17854
0
    }
17855
0
    else {
17856
0
        int res;
17857
0
        if (_Py_EnterRecursiveCall(" while traversing 'type_param' node")) {
17858
0
            goto failed;
17859
0
        }
17860
0
        res = obj2ast_int(state, tmp, &col_offset, arena);
17861
0
        _Py_LeaveRecursiveCall();
17862
0
        if (res != 0) goto failed;
17863
0
        Py_CLEAR(tmp);
17864
0
    }
17865
0
    if (PyObject_GetOptionalAttr(obj, state->end_lineno, &tmp) < 0) {
17866
0
        return -1;
17867
0
    }
17868
0
    if (tmp == NULL) {
17869
0
        PyErr_SetString(PyExc_TypeError, "required field \"end_lineno\" missing from type_param");
17870
0
        return -1;
17871
0
    }
17872
0
    else {
17873
0
        int res;
17874
0
        if (_Py_EnterRecursiveCall(" while traversing 'type_param' node")) {
17875
0
            goto failed;
17876
0
        }
17877
0
        res = obj2ast_int(state, tmp, &end_lineno, arena);
17878
0
        _Py_LeaveRecursiveCall();
17879
0
        if (res != 0) goto failed;
17880
0
        Py_CLEAR(tmp);
17881
0
    }
17882
0
    if (PyObject_GetOptionalAttr(obj, state->end_col_offset, &tmp) < 0) {
17883
0
        return -1;
17884
0
    }
17885
0
    if (tmp == NULL) {
17886
0
        PyErr_SetString(PyExc_TypeError, "required field \"end_col_offset\" missing from type_param");
17887
0
        return -1;
17888
0
    }
17889
0
    else {
17890
0
        int res;
17891
0
        if (_Py_EnterRecursiveCall(" while traversing 'type_param' node")) {
17892
0
            goto failed;
17893
0
        }
17894
0
        res = obj2ast_int(state, tmp, &end_col_offset, arena);
17895
0
        _Py_LeaveRecursiveCall();
17896
0
        if (res != 0) goto failed;
17897
0
        Py_CLEAR(tmp);
17898
0
    }
17899
0
    tp = state->TypeVar_type;
17900
0
    isinstance = PyObject_IsInstance(obj, tp);
17901
0
    if (isinstance == -1) {
17902
0
        return -1;
17903
0
    }
17904
0
    if (isinstance) {
17905
0
        identifier name;
17906
0
        expr_ty bound;
17907
0
        expr_ty default_value;
17908
17909
0
        if (PyObject_GetOptionalAttr(obj, state->name, &tmp) < 0) {
17910
0
            return -1;
17911
0
        }
17912
0
        if (tmp == NULL) {
17913
0
            PyErr_SetString(PyExc_TypeError, "required field \"name\" missing from TypeVar");
17914
0
            return -1;
17915
0
        }
17916
0
        else {
17917
0
            int res;
17918
0
            if (_Py_EnterRecursiveCall(" while traversing 'TypeVar' node")) {
17919
0
                goto failed;
17920
0
            }
17921
0
            res = obj2ast_identifier(state, tmp, &name, arena);
17922
0
            _Py_LeaveRecursiveCall();
17923
0
            if (res != 0) goto failed;
17924
0
            Py_CLEAR(tmp);
17925
0
        }
17926
0
        if (PyObject_GetOptionalAttr(obj, state->bound, &tmp) < 0) {
17927
0
            return -1;
17928
0
        }
17929
0
        if (tmp == NULL || tmp == Py_None) {
17930
0
            Py_CLEAR(tmp);
17931
0
            bound = NULL;
17932
0
        }
17933
0
        else {
17934
0
            int res;
17935
0
            if (_Py_EnterRecursiveCall(" while traversing 'TypeVar' node")) {
17936
0
                goto failed;
17937
0
            }
17938
0
            res = obj2ast_expr(state, tmp, &bound, arena);
17939
0
            _Py_LeaveRecursiveCall();
17940
0
            if (res != 0) goto failed;
17941
0
            Py_CLEAR(tmp);
17942
0
        }
17943
0
        if (PyObject_GetOptionalAttr(obj, state->default_value, &tmp) < 0) {
17944
0
            return -1;
17945
0
        }
17946
0
        if (tmp == NULL || tmp == Py_None) {
17947
0
            Py_CLEAR(tmp);
17948
0
            default_value = NULL;
17949
0
        }
17950
0
        else {
17951
0
            int res;
17952
0
            if (_Py_EnterRecursiveCall(" while traversing 'TypeVar' node")) {
17953
0
                goto failed;
17954
0
            }
17955
0
            res = obj2ast_expr(state, tmp, &default_value, arena);
17956
0
            _Py_LeaveRecursiveCall();
17957
0
            if (res != 0) goto failed;
17958
0
            Py_CLEAR(tmp);
17959
0
        }
17960
0
        *out = _PyAST_TypeVar(name, bound, default_value, lineno, col_offset,
17961
0
                              end_lineno, end_col_offset, arena);
17962
0
        if (*out == NULL) goto failed;
17963
0
        return 0;
17964
0
    }
17965
0
    tp = state->ParamSpec_type;
17966
0
    isinstance = PyObject_IsInstance(obj, tp);
17967
0
    if (isinstance == -1) {
17968
0
        return -1;
17969
0
    }
17970
0
    if (isinstance) {
17971
0
        identifier name;
17972
0
        expr_ty default_value;
17973
17974
0
        if (PyObject_GetOptionalAttr(obj, state->name, &tmp) < 0) {
17975
0
            return -1;
17976
0
        }
17977
0
        if (tmp == NULL) {
17978
0
            PyErr_SetString(PyExc_TypeError, "required field \"name\" missing from ParamSpec");
17979
0
            return -1;
17980
0
        }
17981
0
        else {
17982
0
            int res;
17983
0
            if (_Py_EnterRecursiveCall(" while traversing 'ParamSpec' node")) {
17984
0
                goto failed;
17985
0
            }
17986
0
            res = obj2ast_identifier(state, tmp, &name, arena);
17987
0
            _Py_LeaveRecursiveCall();
17988
0
            if (res != 0) goto failed;
17989
0
            Py_CLEAR(tmp);
17990
0
        }
17991
0
        if (PyObject_GetOptionalAttr(obj, state->default_value, &tmp) < 0) {
17992
0
            return -1;
17993
0
        }
17994
0
        if (tmp == NULL || tmp == Py_None) {
17995
0
            Py_CLEAR(tmp);
17996
0
            default_value = NULL;
17997
0
        }
17998
0
        else {
17999
0
            int res;
18000
0
            if (_Py_EnterRecursiveCall(" while traversing 'ParamSpec' node")) {
18001
0
                goto failed;
18002
0
            }
18003
0
            res = obj2ast_expr(state, tmp, &default_value, arena);
18004
0
            _Py_LeaveRecursiveCall();
18005
0
            if (res != 0) goto failed;
18006
0
            Py_CLEAR(tmp);
18007
0
        }
18008
0
        *out = _PyAST_ParamSpec(name, default_value, lineno, col_offset,
18009
0
                                end_lineno, end_col_offset, arena);
18010
0
        if (*out == NULL) goto failed;
18011
0
        return 0;
18012
0
    }
18013
0
    tp = state->TypeVarTuple_type;
18014
0
    isinstance = PyObject_IsInstance(obj, tp);
18015
0
    if (isinstance == -1) {
18016
0
        return -1;
18017
0
    }
18018
0
    if (isinstance) {
18019
0
        identifier name;
18020
0
        expr_ty default_value;
18021
18022
0
        if (PyObject_GetOptionalAttr(obj, state->name, &tmp) < 0) {
18023
0
            return -1;
18024
0
        }
18025
0
        if (tmp == NULL) {
18026
0
            PyErr_SetString(PyExc_TypeError, "required field \"name\" missing from TypeVarTuple");
18027
0
            return -1;
18028
0
        }
18029
0
        else {
18030
0
            int res;
18031
0
            if (_Py_EnterRecursiveCall(" while traversing 'TypeVarTuple' node")) {
18032
0
                goto failed;
18033
0
            }
18034
0
            res = obj2ast_identifier(state, tmp, &name, arena);
18035
0
            _Py_LeaveRecursiveCall();
18036
0
            if (res != 0) goto failed;
18037
0
            Py_CLEAR(tmp);
18038
0
        }
18039
0
        if (PyObject_GetOptionalAttr(obj, state->default_value, &tmp) < 0) {
18040
0
            return -1;
18041
0
        }
18042
0
        if (tmp == NULL || tmp == Py_None) {
18043
0
            Py_CLEAR(tmp);
18044
0
            default_value = NULL;
18045
0
        }
18046
0
        else {
18047
0
            int res;
18048
0
            if (_Py_EnterRecursiveCall(" while traversing 'TypeVarTuple' node")) {
18049
0
                goto failed;
18050
0
            }
18051
0
            res = obj2ast_expr(state, tmp, &default_value, arena);
18052
0
            _Py_LeaveRecursiveCall();
18053
0
            if (res != 0) goto failed;
18054
0
            Py_CLEAR(tmp);
18055
0
        }
18056
0
        *out = _PyAST_TypeVarTuple(name, default_value, lineno, col_offset,
18057
0
                                   end_lineno, end_col_offset, arena);
18058
0
        if (*out == NULL) goto failed;
18059
0
        return 0;
18060
0
    }
18061
18062
0
    PyErr_Format(PyExc_TypeError, "expected some sort of type_param, but got %R", obj);
18063
0
    failed:
18064
0
    Py_XDECREF(tmp);
18065
0
    return -1;
18066
0
}
18067
18068
18069
static int
18070
astmodule_exec(PyObject *m)
18071
1
{
18072
1
    struct ast_state *state = get_ast_state();
18073
1
    if (state == NULL) {
18074
0
        return -1;
18075
0
    }
18076
1
    if (PyModule_AddObjectRef(m, "AST", state->AST_type) < 0) {
18077
0
        return -1;
18078
0
    }
18079
1
    if (PyModule_AddIntMacro(m, PyCF_ALLOW_TOP_LEVEL_AWAIT) < 0) {
18080
0
        return -1;
18081
0
    }
18082
1
    if (PyModule_AddIntMacro(m, PyCF_ONLY_AST) < 0) {
18083
0
        return -1;
18084
0
    }
18085
1
    if (PyModule_AddIntMacro(m, PyCF_TYPE_COMMENTS) < 0) {
18086
0
        return -1;
18087
0
    }
18088
1
    if (PyModule_AddIntMacro(m, PyCF_OPTIMIZED_AST) < 0) {
18089
0
        return -1;
18090
0
    }
18091
1
    if (PyModule_AddObjectRef(m, "mod", state->mod_type) < 0) {
18092
0
        return -1;
18093
0
    }
18094
1
    if (PyModule_AddObjectRef(m, "Module", state->Module_type) < 0) {
18095
0
        return -1;
18096
0
    }
18097
1
    if (PyModule_AddObjectRef(m, "Interactive", state->Interactive_type) < 0) {
18098
0
        return -1;
18099
0
    }
18100
1
    if (PyModule_AddObjectRef(m, "Expression", state->Expression_type) < 0) {
18101
0
        return -1;
18102
0
    }
18103
1
    if (PyModule_AddObjectRef(m, "FunctionType", state->FunctionType_type) < 0)
18104
0
        {
18105
0
        return -1;
18106
0
    }
18107
1
    if (PyModule_AddObjectRef(m, "stmt", state->stmt_type) < 0) {
18108
0
        return -1;
18109
0
    }
18110
1
    if (PyModule_AddObjectRef(m, "FunctionDef", state->FunctionDef_type) < 0) {
18111
0
        return -1;
18112
0
    }
18113
1
    if (PyModule_AddObjectRef(m, "AsyncFunctionDef",
18114
1
        state->AsyncFunctionDef_type) < 0) {
18115
0
        return -1;
18116
0
    }
18117
1
    if (PyModule_AddObjectRef(m, "ClassDef", state->ClassDef_type) < 0) {
18118
0
        return -1;
18119
0
    }
18120
1
    if (PyModule_AddObjectRef(m, "Return", state->Return_type) < 0) {
18121
0
        return -1;
18122
0
    }
18123
1
    if (PyModule_AddObjectRef(m, "Delete", state->Delete_type) < 0) {
18124
0
        return -1;
18125
0
    }
18126
1
    if (PyModule_AddObjectRef(m, "Assign", state->Assign_type) < 0) {
18127
0
        return -1;
18128
0
    }
18129
1
    if (PyModule_AddObjectRef(m, "TypeAlias", state->TypeAlias_type) < 0) {
18130
0
        return -1;
18131
0
    }
18132
1
    if (PyModule_AddObjectRef(m, "AugAssign", state->AugAssign_type) < 0) {
18133
0
        return -1;
18134
0
    }
18135
1
    if (PyModule_AddObjectRef(m, "AnnAssign", state->AnnAssign_type) < 0) {
18136
0
        return -1;
18137
0
    }
18138
1
    if (PyModule_AddObjectRef(m, "For", state->For_type) < 0) {
18139
0
        return -1;
18140
0
    }
18141
1
    if (PyModule_AddObjectRef(m, "AsyncFor", state->AsyncFor_type) < 0) {
18142
0
        return -1;
18143
0
    }
18144
1
    if (PyModule_AddObjectRef(m, "While", state->While_type) < 0) {
18145
0
        return -1;
18146
0
    }
18147
1
    if (PyModule_AddObjectRef(m, "If", state->If_type) < 0) {
18148
0
        return -1;
18149
0
    }
18150
1
    if (PyModule_AddObjectRef(m, "With", state->With_type) < 0) {
18151
0
        return -1;
18152
0
    }
18153
1
    if (PyModule_AddObjectRef(m, "AsyncWith", state->AsyncWith_type) < 0) {
18154
0
        return -1;
18155
0
    }
18156
1
    if (PyModule_AddObjectRef(m, "Match", state->Match_type) < 0) {
18157
0
        return -1;
18158
0
    }
18159
1
    if (PyModule_AddObjectRef(m, "Raise", state->Raise_type) < 0) {
18160
0
        return -1;
18161
0
    }
18162
1
    if (PyModule_AddObjectRef(m, "Try", state->Try_type) < 0) {
18163
0
        return -1;
18164
0
    }
18165
1
    if (PyModule_AddObjectRef(m, "TryStar", state->TryStar_type) < 0) {
18166
0
        return -1;
18167
0
    }
18168
1
    if (PyModule_AddObjectRef(m, "Assert", state->Assert_type) < 0) {
18169
0
        return -1;
18170
0
    }
18171
1
    if (PyModule_AddObjectRef(m, "Import", state->Import_type) < 0) {
18172
0
        return -1;
18173
0
    }
18174
1
    if (PyModule_AddObjectRef(m, "ImportFrom", state->ImportFrom_type) < 0) {
18175
0
        return -1;
18176
0
    }
18177
1
    if (PyModule_AddObjectRef(m, "Global", state->Global_type) < 0) {
18178
0
        return -1;
18179
0
    }
18180
1
    if (PyModule_AddObjectRef(m, "Nonlocal", state->Nonlocal_type) < 0) {
18181
0
        return -1;
18182
0
    }
18183
1
    if (PyModule_AddObjectRef(m, "Expr", state->Expr_type) < 0) {
18184
0
        return -1;
18185
0
    }
18186
1
    if (PyModule_AddObjectRef(m, "Pass", state->Pass_type) < 0) {
18187
0
        return -1;
18188
0
    }
18189
1
    if (PyModule_AddObjectRef(m, "Break", state->Break_type) < 0) {
18190
0
        return -1;
18191
0
    }
18192
1
    if (PyModule_AddObjectRef(m, "Continue", state->Continue_type) < 0) {
18193
0
        return -1;
18194
0
    }
18195
1
    if (PyModule_AddObjectRef(m, "expr", state->expr_type) < 0) {
18196
0
        return -1;
18197
0
    }
18198
1
    if (PyModule_AddObjectRef(m, "BoolOp", state->BoolOp_type) < 0) {
18199
0
        return -1;
18200
0
    }
18201
1
    if (PyModule_AddObjectRef(m, "NamedExpr", state->NamedExpr_type) < 0) {
18202
0
        return -1;
18203
0
    }
18204
1
    if (PyModule_AddObjectRef(m, "BinOp", state->BinOp_type) < 0) {
18205
0
        return -1;
18206
0
    }
18207
1
    if (PyModule_AddObjectRef(m, "UnaryOp", state->UnaryOp_type) < 0) {
18208
0
        return -1;
18209
0
    }
18210
1
    if (PyModule_AddObjectRef(m, "Lambda", state->Lambda_type) < 0) {
18211
0
        return -1;
18212
0
    }
18213
1
    if (PyModule_AddObjectRef(m, "IfExp", state->IfExp_type) < 0) {
18214
0
        return -1;
18215
0
    }
18216
1
    if (PyModule_AddObjectRef(m, "Dict", state->Dict_type) < 0) {
18217
0
        return -1;
18218
0
    }
18219
1
    if (PyModule_AddObjectRef(m, "Set", state->Set_type) < 0) {
18220
0
        return -1;
18221
0
    }
18222
1
    if (PyModule_AddObjectRef(m, "ListComp", state->ListComp_type) < 0) {
18223
0
        return -1;
18224
0
    }
18225
1
    if (PyModule_AddObjectRef(m, "SetComp", state->SetComp_type) < 0) {
18226
0
        return -1;
18227
0
    }
18228
1
    if (PyModule_AddObjectRef(m, "DictComp", state->DictComp_type) < 0) {
18229
0
        return -1;
18230
0
    }
18231
1
    if (PyModule_AddObjectRef(m, "GeneratorExp", state->GeneratorExp_type) < 0)
18232
0
        {
18233
0
        return -1;
18234
0
    }
18235
1
    if (PyModule_AddObjectRef(m, "Await", state->Await_type) < 0) {
18236
0
        return -1;
18237
0
    }
18238
1
    if (PyModule_AddObjectRef(m, "Yield", state->Yield_type) < 0) {
18239
0
        return -1;
18240
0
    }
18241
1
    if (PyModule_AddObjectRef(m, "YieldFrom", state->YieldFrom_type) < 0) {
18242
0
        return -1;
18243
0
    }
18244
1
    if (PyModule_AddObjectRef(m, "Compare", state->Compare_type) < 0) {
18245
0
        return -1;
18246
0
    }
18247
1
    if (PyModule_AddObjectRef(m, "Call", state->Call_type) < 0) {
18248
0
        return -1;
18249
0
    }
18250
1
    if (PyModule_AddObjectRef(m, "FormattedValue", state->FormattedValue_type)
18251
1
        < 0) {
18252
0
        return -1;
18253
0
    }
18254
1
    if (PyModule_AddObjectRef(m, "Interpolation", state->Interpolation_type) <
18255
1
        0) {
18256
0
        return -1;
18257
0
    }
18258
1
    if (PyModule_AddObjectRef(m, "JoinedStr", state->JoinedStr_type) < 0) {
18259
0
        return -1;
18260
0
    }
18261
1
    if (PyModule_AddObjectRef(m, "TemplateStr", state->TemplateStr_type) < 0) {
18262
0
        return -1;
18263
0
    }
18264
1
    if (PyModule_AddObjectRef(m, "Constant", state->Constant_type) < 0) {
18265
0
        return -1;
18266
0
    }
18267
1
    if (PyModule_AddObjectRef(m, "Attribute", state->Attribute_type) < 0) {
18268
0
        return -1;
18269
0
    }
18270
1
    if (PyModule_AddObjectRef(m, "Subscript", state->Subscript_type) < 0) {
18271
0
        return -1;
18272
0
    }
18273
1
    if (PyModule_AddObjectRef(m, "Starred", state->Starred_type) < 0) {
18274
0
        return -1;
18275
0
    }
18276
1
    if (PyModule_AddObjectRef(m, "Name", state->Name_type) < 0) {
18277
0
        return -1;
18278
0
    }
18279
1
    if (PyModule_AddObjectRef(m, "List", state->List_type) < 0) {
18280
0
        return -1;
18281
0
    }
18282
1
    if (PyModule_AddObjectRef(m, "Tuple", state->Tuple_type) < 0) {
18283
0
        return -1;
18284
0
    }
18285
1
    if (PyModule_AddObjectRef(m, "Slice", state->Slice_type) < 0) {
18286
0
        return -1;
18287
0
    }
18288
1
    if (PyModule_AddObjectRef(m, "expr_context", state->expr_context_type) < 0)
18289
0
        {
18290
0
        return -1;
18291
0
    }
18292
1
    if (PyModule_AddObjectRef(m, "Load", state->Load_type) < 0) {
18293
0
        return -1;
18294
0
    }
18295
1
    if (PyModule_AddObjectRef(m, "Store", state->Store_type) < 0) {
18296
0
        return -1;
18297
0
    }
18298
1
    if (PyModule_AddObjectRef(m, "Del", state->Del_type) < 0) {
18299
0
        return -1;
18300
0
    }
18301
1
    if (PyModule_AddObjectRef(m, "boolop", state->boolop_type) < 0) {
18302
0
        return -1;
18303
0
    }
18304
1
    if (PyModule_AddObjectRef(m, "And", state->And_type) < 0) {
18305
0
        return -1;
18306
0
    }
18307
1
    if (PyModule_AddObjectRef(m, "Or", state->Or_type) < 0) {
18308
0
        return -1;
18309
0
    }
18310
1
    if (PyModule_AddObjectRef(m, "operator", state->operator_type) < 0) {
18311
0
        return -1;
18312
0
    }
18313
1
    if (PyModule_AddObjectRef(m, "Add", state->Add_type) < 0) {
18314
0
        return -1;
18315
0
    }
18316
1
    if (PyModule_AddObjectRef(m, "Sub", state->Sub_type) < 0) {
18317
0
        return -1;
18318
0
    }
18319
1
    if (PyModule_AddObjectRef(m, "Mult", state->Mult_type) < 0) {
18320
0
        return -1;
18321
0
    }
18322
1
    if (PyModule_AddObjectRef(m, "MatMult", state->MatMult_type) < 0) {
18323
0
        return -1;
18324
0
    }
18325
1
    if (PyModule_AddObjectRef(m, "Div", state->Div_type) < 0) {
18326
0
        return -1;
18327
0
    }
18328
1
    if (PyModule_AddObjectRef(m, "Mod", state->Mod_type) < 0) {
18329
0
        return -1;
18330
0
    }
18331
1
    if (PyModule_AddObjectRef(m, "Pow", state->Pow_type) < 0) {
18332
0
        return -1;
18333
0
    }
18334
1
    if (PyModule_AddObjectRef(m, "LShift", state->LShift_type) < 0) {
18335
0
        return -1;
18336
0
    }
18337
1
    if (PyModule_AddObjectRef(m, "RShift", state->RShift_type) < 0) {
18338
0
        return -1;
18339
0
    }
18340
1
    if (PyModule_AddObjectRef(m, "BitOr", state->BitOr_type) < 0) {
18341
0
        return -1;
18342
0
    }
18343
1
    if (PyModule_AddObjectRef(m, "BitXor", state->BitXor_type) < 0) {
18344
0
        return -1;
18345
0
    }
18346
1
    if (PyModule_AddObjectRef(m, "BitAnd", state->BitAnd_type) < 0) {
18347
0
        return -1;
18348
0
    }
18349
1
    if (PyModule_AddObjectRef(m, "FloorDiv", state->FloorDiv_type) < 0) {
18350
0
        return -1;
18351
0
    }
18352
1
    if (PyModule_AddObjectRef(m, "unaryop", state->unaryop_type) < 0) {
18353
0
        return -1;
18354
0
    }
18355
1
    if (PyModule_AddObjectRef(m, "Invert", state->Invert_type) < 0) {
18356
0
        return -1;
18357
0
    }
18358
1
    if (PyModule_AddObjectRef(m, "Not", state->Not_type) < 0) {
18359
0
        return -1;
18360
0
    }
18361
1
    if (PyModule_AddObjectRef(m, "UAdd", state->UAdd_type) < 0) {
18362
0
        return -1;
18363
0
    }
18364
1
    if (PyModule_AddObjectRef(m, "USub", state->USub_type) < 0) {
18365
0
        return -1;
18366
0
    }
18367
1
    if (PyModule_AddObjectRef(m, "cmpop", state->cmpop_type) < 0) {
18368
0
        return -1;
18369
0
    }
18370
1
    if (PyModule_AddObjectRef(m, "Eq", state->Eq_type) < 0) {
18371
0
        return -1;
18372
0
    }
18373
1
    if (PyModule_AddObjectRef(m, "NotEq", state->NotEq_type) < 0) {
18374
0
        return -1;
18375
0
    }
18376
1
    if (PyModule_AddObjectRef(m, "Lt", state->Lt_type) < 0) {
18377
0
        return -1;
18378
0
    }
18379
1
    if (PyModule_AddObjectRef(m, "LtE", state->LtE_type) < 0) {
18380
0
        return -1;
18381
0
    }
18382
1
    if (PyModule_AddObjectRef(m, "Gt", state->Gt_type) < 0) {
18383
0
        return -1;
18384
0
    }
18385
1
    if (PyModule_AddObjectRef(m, "GtE", state->GtE_type) < 0) {
18386
0
        return -1;
18387
0
    }
18388
1
    if (PyModule_AddObjectRef(m, "Is", state->Is_type) < 0) {
18389
0
        return -1;
18390
0
    }
18391
1
    if (PyModule_AddObjectRef(m, "IsNot", state->IsNot_type) < 0) {
18392
0
        return -1;
18393
0
    }
18394
1
    if (PyModule_AddObjectRef(m, "In", state->In_type) < 0) {
18395
0
        return -1;
18396
0
    }
18397
1
    if (PyModule_AddObjectRef(m, "NotIn", state->NotIn_type) < 0) {
18398
0
        return -1;
18399
0
    }
18400
1
    if (PyModule_AddObjectRef(m, "comprehension", state->comprehension_type) <
18401
1
        0) {
18402
0
        return -1;
18403
0
    }
18404
1
    if (PyModule_AddObjectRef(m, "excepthandler", state->excepthandler_type) <
18405
1
        0) {
18406
0
        return -1;
18407
0
    }
18408
1
    if (PyModule_AddObjectRef(m, "ExceptHandler", state->ExceptHandler_type) <
18409
1
        0) {
18410
0
        return -1;
18411
0
    }
18412
1
    if (PyModule_AddObjectRef(m, "arguments", state->arguments_type) < 0) {
18413
0
        return -1;
18414
0
    }
18415
1
    if (PyModule_AddObjectRef(m, "arg", state->arg_type) < 0) {
18416
0
        return -1;
18417
0
    }
18418
1
    if (PyModule_AddObjectRef(m, "keyword", state->keyword_type) < 0) {
18419
0
        return -1;
18420
0
    }
18421
1
    if (PyModule_AddObjectRef(m, "alias", state->alias_type) < 0) {
18422
0
        return -1;
18423
0
    }
18424
1
    if (PyModule_AddObjectRef(m, "withitem", state->withitem_type) < 0) {
18425
0
        return -1;
18426
0
    }
18427
1
    if (PyModule_AddObjectRef(m, "match_case", state->match_case_type) < 0) {
18428
0
        return -1;
18429
0
    }
18430
1
    if (PyModule_AddObjectRef(m, "pattern", state->pattern_type) < 0) {
18431
0
        return -1;
18432
0
    }
18433
1
    if (PyModule_AddObjectRef(m, "MatchValue", state->MatchValue_type) < 0) {
18434
0
        return -1;
18435
0
    }
18436
1
    if (PyModule_AddObjectRef(m, "MatchSingleton", state->MatchSingleton_type)
18437
1
        < 0) {
18438
0
        return -1;
18439
0
    }
18440
1
    if (PyModule_AddObjectRef(m, "MatchSequence", state->MatchSequence_type) <
18441
1
        0) {
18442
0
        return -1;
18443
0
    }
18444
1
    if (PyModule_AddObjectRef(m, "MatchMapping", state->MatchMapping_type) < 0)
18445
0
        {
18446
0
        return -1;
18447
0
    }
18448
1
    if (PyModule_AddObjectRef(m, "MatchClass", state->MatchClass_type) < 0) {
18449
0
        return -1;
18450
0
    }
18451
1
    if (PyModule_AddObjectRef(m, "MatchStar", state->MatchStar_type) < 0) {
18452
0
        return -1;
18453
0
    }
18454
1
    if (PyModule_AddObjectRef(m, "MatchAs", state->MatchAs_type) < 0) {
18455
0
        return -1;
18456
0
    }
18457
1
    if (PyModule_AddObjectRef(m, "MatchOr", state->MatchOr_type) < 0) {
18458
0
        return -1;
18459
0
    }
18460
1
    if (PyModule_AddObjectRef(m, "type_ignore", state->type_ignore_type) < 0) {
18461
0
        return -1;
18462
0
    }
18463
1
    if (PyModule_AddObjectRef(m, "TypeIgnore", state->TypeIgnore_type) < 0) {
18464
0
        return -1;
18465
0
    }
18466
1
    if (PyModule_AddObjectRef(m, "type_param", state->type_param_type) < 0) {
18467
0
        return -1;
18468
0
    }
18469
1
    if (PyModule_AddObjectRef(m, "TypeVar", state->TypeVar_type) < 0) {
18470
0
        return -1;
18471
0
    }
18472
1
    if (PyModule_AddObjectRef(m, "ParamSpec", state->ParamSpec_type) < 0) {
18473
0
        return -1;
18474
0
    }
18475
1
    if (PyModule_AddObjectRef(m, "TypeVarTuple", state->TypeVarTuple_type) < 0)
18476
0
        {
18477
0
        return -1;
18478
0
    }
18479
1
    return 0;
18480
1
}
18481
18482
static PyModuleDef_Slot astmodule_slots[] = {
18483
    {Py_mod_exec, astmodule_exec},
18484
    {Py_mod_multiple_interpreters, Py_MOD_PER_INTERPRETER_GIL_SUPPORTED},
18485
    {Py_mod_gil, Py_MOD_GIL_NOT_USED},
18486
    {0, NULL}
18487
};
18488
18489
static struct PyModuleDef _astmodule = {
18490
    PyModuleDef_HEAD_INIT,
18491
    .m_name = "_ast",
18492
    // The _ast module uses a per-interpreter state (PyInterpreterState.ast)
18493
    .m_size = 0,
18494
    .m_slots = astmodule_slots,
18495
};
18496
18497
PyMODINIT_FUNC
18498
PyInit__ast(void)
18499
1
{
18500
1
    return PyModuleDef_Init(&_astmodule);
18501
1
}
18502
18503
18504
PyObject* PyAST_mod2obj(mod_ty t)
18505
1.64k
{
18506
1.64k
    struct ast_state *state = get_ast_state();
18507
1.64k
    if (state == NULL) {
18508
0
        return NULL;
18509
0
    }
18510
1.64k
    PyObject *result = ast2obj_mod(state, t);
18511
18512
1.64k
    return result;
18513
1.64k
}
18514
18515
/* mode is 0 for "exec", 1 for "eval" and 2 for "single" input */
18516
int PyAst_CheckMode(PyObject *ast, int mode)
18517
0
{
18518
0
    const char * const req_name[] = {"Module", "Expression", "Interactive"};
18519
18520
0
    struct ast_state *state = get_ast_state();
18521
0
    if (state == NULL) {
18522
0
        return -1;
18523
0
    }
18524
18525
0
    PyObject *req_type[3];
18526
0
    req_type[0] = state->Module_type;
18527
0
    req_type[1] = state->Expression_type;
18528
0
    req_type[2] = state->Interactive_type;
18529
18530
0
    assert(0 <= mode && mode <= 2);
18531
0
    int isinstance = PyObject_IsInstance(ast, req_type[mode]);
18532
0
    if (isinstance == -1) {
18533
0
        return -1;
18534
0
    }
18535
0
    if (!isinstance) {
18536
0
        PyErr_Format(PyExc_TypeError, "expected %s node, got %.400s",
18537
0
                     req_name[mode], _PyType_Name(Py_TYPE(ast)));
18538
0
        return -1;
18539
0
    }
18540
0
    return 0;
18541
0
}
18542
18543
mod_ty PyAST_obj2mod(PyObject* ast, PyArena* arena, int mode)
18544
0
{
18545
0
    if (PySys_Audit("compile", "OO", ast, Py_None) < 0) {
18546
0
        return NULL;
18547
0
    }
18548
18549
0
    struct ast_state *state = get_ast_state();
18550
0
    if (state == NULL) {
18551
0
        return NULL;
18552
0
    }
18553
18554
0
    if (PyAst_CheckMode(ast, mode) < 0) {
18555
0
        return NULL;
18556
0
    }
18557
18558
0
    mod_ty res = NULL;
18559
0
    if (obj2ast_mod(state, ast, &res, arena) != 0)
18560
0
        return NULL;
18561
0
    else
18562
0
        return res;
18563
0
}
18564
18565
int PyAST_Check(PyObject* obj)
18566
15
{
18567
15
    struct ast_state *state = get_ast_state();
18568
15
    if (state == NULL) {
18569
0
        return -1;
18570
0
    }
18571
15
    return PyObject_IsInstance(obj, state->AST_type);
18572
15
}
18573
18574