Coverage Report

Created: 2026-04-12 06:54

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/cpython/Python/Python-ast.c
Line
Count
Source
1
// File automatically generated by Parser/asdl_c.py.
2
3
#include "Python.h"
4
#include "pycore_ast.h"
5
#include "pycore_ast_state.h"     // struct ast_state
6
#include "pycore_ceval.h"         // _Py_EnterRecursiveCall()
7
#include "pycore_lock.h"          // _PyOnceFlag
8
#include "pycore_modsupport.h"    // _PyArg_NoPositional()
9
#include "pycore_pystate.h"       // _PyInterpreterState_GET()
10
#include "pycore_runtime.h"       // _Py_ID()
11
#include "pycore_setobject.h"     // _PySet_NextEntry()
12
#include "pycore_unionobject.h"   // _Py_union_type_or
13
14
#include <stddef.h>               // offsetof()
15
16
17
// Forward declaration
18
static int init_types(void *arg);
19
20
static struct ast_state*
21
get_ast_state(void)
22
107k
{
23
107k
    PyInterpreterState *interp = _PyInterpreterState_GET();
24
107k
    struct ast_state *state = &interp->ast;
25
107k
    assert(!state->finalized);
26
107k
    if (_PyOnceFlag_CallOnce(&state->once, (_Py_once_fn_t *)&init_types, state) < 0) {
27
0
        return NULL;
28
0
    }
29
107k
    return state;
30
107k
}
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
16
{
290
16
    if ((state->__dict__ = PyUnicode_InternFromString("__dict__")) == NULL) return -1;
291
16
    if ((state->__doc__ = PyUnicode_InternFromString("__doc__")) == NULL) return -1;
292
16
    if ((state->__match_args__ = PyUnicode_InternFromString("__match_args__")) == NULL) return -1;
293
16
    if ((state->__module__ = PyUnicode_InternFromString("__module__")) == NULL) return -1;
294
16
    if ((state->_attributes = PyUnicode_InternFromString("_attributes")) == NULL) return -1;
295
16
    if ((state->_fields = PyUnicode_InternFromString("_fields")) == NULL) return -1;
296
16
    if ((state->annotation = PyUnicode_InternFromString("annotation")) == NULL) return -1;
297
16
    if ((state->arg = PyUnicode_InternFromString("arg")) == NULL) return -1;
298
16
    if ((state->args = PyUnicode_InternFromString("args")) == NULL) return -1;
299
16
    if ((state->argtypes = PyUnicode_InternFromString("argtypes")) == NULL) return -1;
300
16
    if ((state->asname = PyUnicode_InternFromString("asname")) == NULL) return -1;
301
16
    if ((state->ast = PyUnicode_InternFromString("ast")) == NULL) return -1;
302
16
    if ((state->attr = PyUnicode_InternFromString("attr")) == NULL) return -1;
303
16
    if ((state->bases = PyUnicode_InternFromString("bases")) == NULL) return -1;
304
16
    if ((state->body = PyUnicode_InternFromString("body")) == NULL) return -1;
305
16
    if ((state->bound = PyUnicode_InternFromString("bound")) == NULL) return -1;
306
16
    if ((state->cases = PyUnicode_InternFromString("cases")) == NULL) return -1;
307
16
    if ((state->cause = PyUnicode_InternFromString("cause")) == NULL) return -1;
308
16
    if ((state->cls = PyUnicode_InternFromString("cls")) == NULL) return -1;
309
16
    if ((state->col_offset = PyUnicode_InternFromString("col_offset")) == NULL) return -1;
310
16
    if ((state->comparators = PyUnicode_InternFromString("comparators")) == NULL) return -1;
311
16
    if ((state->context_expr = PyUnicode_InternFromString("context_expr")) == NULL) return -1;
312
16
    if ((state->conversion = PyUnicode_InternFromString("conversion")) == NULL) return -1;
313
16
    if ((state->ctx = PyUnicode_InternFromString("ctx")) == NULL) return -1;
314
16
    if ((state->decorator_list = PyUnicode_InternFromString("decorator_list")) == NULL) return -1;
315
16
    if ((state->default_value = PyUnicode_InternFromString("default_value")) == NULL) return -1;
316
16
    if ((state->defaults = PyUnicode_InternFromString("defaults")) == NULL) return -1;
317
16
    if ((state->elt = PyUnicode_InternFromString("elt")) == NULL) return -1;
318
16
    if ((state->elts = PyUnicode_InternFromString("elts")) == NULL) return -1;
319
16
    if ((state->end_col_offset = PyUnicode_InternFromString("end_col_offset")) == NULL) return -1;
320
16
    if ((state->end_lineno = PyUnicode_InternFromString("end_lineno")) == NULL) return -1;
321
16
    if ((state->exc = PyUnicode_InternFromString("exc")) == NULL) return -1;
322
16
    if ((state->finalbody = PyUnicode_InternFromString("finalbody")) == NULL) return -1;
323
16
    if ((state->format_spec = PyUnicode_InternFromString("format_spec")) == NULL) return -1;
324
16
    if ((state->func = PyUnicode_InternFromString("func")) == NULL) return -1;
325
16
    if ((state->generators = PyUnicode_InternFromString("generators")) == NULL) return -1;
326
16
    if ((state->guard = PyUnicode_InternFromString("guard")) == NULL) return -1;
327
16
    if ((state->handlers = PyUnicode_InternFromString("handlers")) == NULL) return -1;
328
16
    if ((state->id = PyUnicode_InternFromString("id")) == NULL) return -1;
329
16
    if ((state->ifs = PyUnicode_InternFromString("ifs")) == NULL) return -1;
330
16
    if ((state->is_async = PyUnicode_InternFromString("is_async")) == NULL) return -1;
331
16
    if ((state->is_lazy = PyUnicode_InternFromString("is_lazy")) == NULL) return -1;
332
16
    if ((state->items = PyUnicode_InternFromString("items")) == NULL) return -1;
333
16
    if ((state->iter = PyUnicode_InternFromString("iter")) == NULL) return -1;
334
16
    if ((state->key = PyUnicode_InternFromString("key")) == NULL) return -1;
335
16
    if ((state->keys = PyUnicode_InternFromString("keys")) == NULL) return -1;
336
16
    if ((state->keywords = PyUnicode_InternFromString("keywords")) == NULL) return -1;
337
16
    if ((state->kind = PyUnicode_InternFromString("kind")) == NULL) return -1;
338
16
    if ((state->kw_defaults = PyUnicode_InternFromString("kw_defaults")) == NULL) return -1;
339
16
    if ((state->kwarg = PyUnicode_InternFromString("kwarg")) == NULL) return -1;
340
16
    if ((state->kwd_attrs = PyUnicode_InternFromString("kwd_attrs")) == NULL) return -1;
341
16
    if ((state->kwd_patterns = PyUnicode_InternFromString("kwd_patterns")) == NULL) return -1;
342
16
    if ((state->kwonlyargs = PyUnicode_InternFromString("kwonlyargs")) == NULL) return -1;
343
16
    if ((state->left = PyUnicode_InternFromString("left")) == NULL) return -1;
344
16
    if ((state->level = PyUnicode_InternFromString("level")) == NULL) return -1;
345
16
    if ((state->lineno = PyUnicode_InternFromString("lineno")) == NULL) return -1;
346
16
    if ((state->lower = PyUnicode_InternFromString("lower")) == NULL) return -1;
347
16
    if ((state->module = PyUnicode_InternFromString("module")) == NULL) return -1;
348
16
    if ((state->msg = PyUnicode_InternFromString("msg")) == NULL) return -1;
349
16
    if ((state->name = PyUnicode_InternFromString("name")) == NULL) return -1;
350
16
    if ((state->names = PyUnicode_InternFromString("names")) == NULL) return -1;
351
16
    if ((state->op = PyUnicode_InternFromString("op")) == NULL) return -1;
352
16
    if ((state->operand = PyUnicode_InternFromString("operand")) == NULL) return -1;
353
16
    if ((state->ops = PyUnicode_InternFromString("ops")) == NULL) return -1;
354
16
    if ((state->optional_vars = PyUnicode_InternFromString("optional_vars")) == NULL) return -1;
355
16
    if ((state->orelse = PyUnicode_InternFromString("orelse")) == NULL) return -1;
356
16
    if ((state->pattern = PyUnicode_InternFromString("pattern")) == NULL) return -1;
357
16
    if ((state->patterns = PyUnicode_InternFromString("patterns")) == NULL) return -1;
358
16
    if ((state->posonlyargs = PyUnicode_InternFromString("posonlyargs")) == NULL) return -1;
359
16
    if ((state->rest = PyUnicode_InternFromString("rest")) == NULL) return -1;
360
16
    if ((state->returns = PyUnicode_InternFromString("returns")) == NULL) return -1;
361
16
    if ((state->right = PyUnicode_InternFromString("right")) == NULL) return -1;
362
16
    if ((state->simple = PyUnicode_InternFromString("simple")) == NULL) return -1;
363
16
    if ((state->slice = PyUnicode_InternFromString("slice")) == NULL) return -1;
364
16
    if ((state->step = PyUnicode_InternFromString("step")) == NULL) return -1;
365
16
    if ((state->str = PyUnicode_InternFromString("str")) == NULL) return -1;
366
16
    if ((state->subject = PyUnicode_InternFromString("subject")) == NULL) return -1;
367
16
    if ((state->tag = PyUnicode_InternFromString("tag")) == NULL) return -1;
368
16
    if ((state->target = PyUnicode_InternFromString("target")) == NULL) return -1;
369
16
    if ((state->targets = PyUnicode_InternFromString("targets")) == NULL) return -1;
370
16
    if ((state->test = PyUnicode_InternFromString("test")) == NULL) return -1;
371
16
    if ((state->type = PyUnicode_InternFromString("type")) == NULL) return -1;
372
16
    if ((state->type_comment = PyUnicode_InternFromString("type_comment")) == NULL) return -1;
373
16
    if ((state->type_ignores = PyUnicode_InternFromString("type_ignores")) == NULL) return -1;
374
16
    if ((state->type_params = PyUnicode_InternFromString("type_params")) == NULL) return -1;
375
16
    if ((state->upper = PyUnicode_InternFromString("upper")) == NULL) return -1;
376
16
    if ((state->value = PyUnicode_InternFromString("value")) == NULL) return -1;
377
16
    if ((state->values = PyUnicode_InternFromString("values")) == NULL) return -1;
378
16
    if ((state->vararg = PyUnicode_InternFromString("vararg")) == NULL) return -1;
379
16
    return 0;
380
16
};
381
382
0
GENERATE_ASDL_SEQ_CONSTRUCTOR(mod, mod_ty)
383
0
GENERATE_ASDL_SEQ_CONSTRUCTOR(stmt, stmt_ty)
384
766k
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
1.02M
GENERATE_ASDL_SEQ_CONSTRUCTOR(arg, arg_ty)
389
8.55k
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
1.18k
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
16
{
823
16
    bool cond;
824
16
    PyObject *Module_annotations = PyDict_New();
825
16
    if (!Module_annotations) return 0;
826
16
    {
827
16
        PyObject *type = state->stmt_type;
828
16
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
829
16
        cond = type != NULL;
830
16
        if (!cond) {
831
0
            Py_DECREF(Module_annotations);
832
0
            return 0;
833
0
        }
834
16
        cond = PyDict_SetItemString(Module_annotations, "body", type) == 0;
835
16
        Py_DECREF(type);
836
16
        if (!cond) {
837
0
            Py_DECREF(Module_annotations);
838
0
            return 0;
839
0
        }
840
16
    }
841
16
    {
842
16
        PyObject *type = state->type_ignore_type;
843
16
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
844
16
        cond = type != NULL;
845
16
        if (!cond) {
846
0
            Py_DECREF(Module_annotations);
847
0
            return 0;
848
0
        }
849
16
        cond = PyDict_SetItemString(Module_annotations, "type_ignores", type)
850
16
                                    == 0;
851
16
        Py_DECREF(type);
852
16
        if (!cond) {
853
0
            Py_DECREF(Module_annotations);
854
0
            return 0;
855
0
        }
856
16
    }
857
16
    cond = PyObject_SetAttrString(state->Module_type, "_field_types",
858
16
                                  Module_annotations) == 0;
859
16
    if (!cond) {
860
0
        Py_DECREF(Module_annotations);
861
0
        return 0;
862
0
    }
863
16
    cond = PyObject_SetAttrString(state->Module_type, "__annotations__",
864
16
                                  Module_annotations) == 0;
865
16
    if (!cond) {
866
0
        Py_DECREF(Module_annotations);
867
0
        return 0;
868
0
    }
869
16
    Py_DECREF(Module_annotations);
870
16
    PyObject *Interactive_annotations = PyDict_New();
871
16
    if (!Interactive_annotations) return 0;
872
16
    {
873
16
        PyObject *type = state->stmt_type;
874
16
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
875
16
        cond = type != NULL;
876
16
        if (!cond) {
877
0
            Py_DECREF(Interactive_annotations);
878
0
            return 0;
879
0
        }
880
16
        cond = PyDict_SetItemString(Interactive_annotations, "body", type) == 0;
881
16
        Py_DECREF(type);
882
16
        if (!cond) {
883
0
            Py_DECREF(Interactive_annotations);
884
0
            return 0;
885
0
        }
886
16
    }
887
16
    cond = PyObject_SetAttrString(state->Interactive_type, "_field_types",
888
16
                                  Interactive_annotations) == 0;
889
16
    if (!cond) {
890
0
        Py_DECREF(Interactive_annotations);
891
0
        return 0;
892
0
    }
893
16
    cond = PyObject_SetAttrString(state->Interactive_type, "__annotations__",
894
16
                                  Interactive_annotations) == 0;
895
16
    if (!cond) {
896
0
        Py_DECREF(Interactive_annotations);
897
0
        return 0;
898
0
    }
899
16
    Py_DECREF(Interactive_annotations);
900
16
    PyObject *Expression_annotations = PyDict_New();
901
16
    if (!Expression_annotations) return 0;
902
16
    {
903
16
        PyObject *type = state->expr_type;
904
16
        Py_INCREF(type);
905
16
        cond = PyDict_SetItemString(Expression_annotations, "body", type) == 0;
906
16
        Py_DECREF(type);
907
16
        if (!cond) {
908
0
            Py_DECREF(Expression_annotations);
909
0
            return 0;
910
0
        }
911
16
    }
912
16
    cond = PyObject_SetAttrString(state->Expression_type, "_field_types",
913
16
                                  Expression_annotations) == 0;
914
16
    if (!cond) {
915
0
        Py_DECREF(Expression_annotations);
916
0
        return 0;
917
0
    }
918
16
    cond = PyObject_SetAttrString(state->Expression_type, "__annotations__",
919
16
                                  Expression_annotations) == 0;
920
16
    if (!cond) {
921
0
        Py_DECREF(Expression_annotations);
922
0
        return 0;
923
0
    }
924
16
    Py_DECREF(Expression_annotations);
925
16
    PyObject *FunctionType_annotations = PyDict_New();
926
16
    if (!FunctionType_annotations) return 0;
927
16
    {
928
16
        PyObject *type = state->expr_type;
929
16
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
930
16
        cond = type != NULL;
931
16
        if (!cond) {
932
0
            Py_DECREF(FunctionType_annotations);
933
0
            return 0;
934
0
        }
935
16
        cond = PyDict_SetItemString(FunctionType_annotations, "argtypes", type)
936
16
                                    == 0;
937
16
        Py_DECREF(type);
938
16
        if (!cond) {
939
0
            Py_DECREF(FunctionType_annotations);
940
0
            return 0;
941
0
        }
942
16
    }
943
16
    {
944
16
        PyObject *type = state->expr_type;
945
16
        Py_INCREF(type);
946
16
        cond = PyDict_SetItemString(FunctionType_annotations, "returns", type)
947
16
                                    == 0;
948
16
        Py_DECREF(type);
949
16
        if (!cond) {
950
0
            Py_DECREF(FunctionType_annotations);
951
0
            return 0;
952
0
        }
953
16
    }
954
16
    cond = PyObject_SetAttrString(state->FunctionType_type, "_field_types",
955
16
                                  FunctionType_annotations) == 0;
956
16
    if (!cond) {
957
0
        Py_DECREF(FunctionType_annotations);
958
0
        return 0;
959
0
    }
960
16
    cond = PyObject_SetAttrString(state->FunctionType_type, "__annotations__",
961
16
                                  FunctionType_annotations) == 0;
962
16
    if (!cond) {
963
0
        Py_DECREF(FunctionType_annotations);
964
0
        return 0;
965
0
    }
966
16
    Py_DECREF(FunctionType_annotations);
967
16
    PyObject *FunctionDef_annotations = PyDict_New();
968
16
    if (!FunctionDef_annotations) return 0;
969
16
    {
970
16
        PyObject *type = (PyObject *)&PyUnicode_Type;
971
16
        Py_INCREF(type);
972
16
        cond = PyDict_SetItemString(FunctionDef_annotations, "name", type) == 0;
973
16
        Py_DECREF(type);
974
16
        if (!cond) {
975
0
            Py_DECREF(FunctionDef_annotations);
976
0
            return 0;
977
0
        }
978
16
    }
979
16
    {
980
16
        PyObject *type = state->arguments_type;
981
16
        Py_INCREF(type);
982
16
        cond = PyDict_SetItemString(FunctionDef_annotations, "args", type) == 0;
983
16
        Py_DECREF(type);
984
16
        if (!cond) {
985
0
            Py_DECREF(FunctionDef_annotations);
986
0
            return 0;
987
0
        }
988
16
    }
989
16
    {
990
16
        PyObject *type = state->stmt_type;
991
16
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
992
16
        cond = type != NULL;
993
16
        if (!cond) {
994
0
            Py_DECREF(FunctionDef_annotations);
995
0
            return 0;
996
0
        }
997
16
        cond = PyDict_SetItemString(FunctionDef_annotations, "body", type) == 0;
998
16
        Py_DECREF(type);
999
16
        if (!cond) {
1000
0
            Py_DECREF(FunctionDef_annotations);
1001
0
            return 0;
1002
0
        }
1003
16
    }
1004
16
    {
1005
16
        PyObject *type = state->expr_type;
1006
16
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
1007
16
        cond = type != NULL;
1008
16
        if (!cond) {
1009
0
            Py_DECREF(FunctionDef_annotations);
1010
0
            return 0;
1011
0
        }
1012
16
        cond = PyDict_SetItemString(FunctionDef_annotations, "decorator_list",
1013
16
                                    type) == 0;
1014
16
        Py_DECREF(type);
1015
16
        if (!cond) {
1016
0
            Py_DECREF(FunctionDef_annotations);
1017
0
            return 0;
1018
0
        }
1019
16
    }
1020
16
    {
1021
16
        PyObject *type = state->expr_type;
1022
16
        type = _Py_union_type_or(type, Py_None);
1023
16
        cond = type != NULL;
1024
16
        if (!cond) {
1025
0
            Py_DECREF(FunctionDef_annotations);
1026
0
            return 0;
1027
0
        }
1028
16
        cond = PyDict_SetItemString(FunctionDef_annotations, "returns", type)
1029
16
                                    == 0;
1030
16
        Py_DECREF(type);
1031
16
        if (!cond) {
1032
0
            Py_DECREF(FunctionDef_annotations);
1033
0
            return 0;
1034
0
        }
1035
16
    }
1036
16
    {
1037
16
        PyObject *type = (PyObject *)&PyUnicode_Type;
1038
16
        type = _Py_union_type_or(type, Py_None);
1039
16
        cond = type != NULL;
1040
16
        if (!cond) {
1041
0
            Py_DECREF(FunctionDef_annotations);
1042
0
            return 0;
1043
0
        }
1044
16
        cond = PyDict_SetItemString(FunctionDef_annotations, "type_comment",
1045
16
                                    type) == 0;
1046
16
        Py_DECREF(type);
1047
16
        if (!cond) {
1048
0
            Py_DECREF(FunctionDef_annotations);
1049
0
            return 0;
1050
0
        }
1051
16
    }
1052
16
    {
1053
16
        PyObject *type = state->type_param_type;
1054
16
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
1055
16
        cond = type != NULL;
1056
16
        if (!cond) {
1057
0
            Py_DECREF(FunctionDef_annotations);
1058
0
            return 0;
1059
0
        }
1060
16
        cond = PyDict_SetItemString(FunctionDef_annotations, "type_params",
1061
16
                                    type) == 0;
1062
16
        Py_DECREF(type);
1063
16
        if (!cond) {
1064
0
            Py_DECREF(FunctionDef_annotations);
1065
0
            return 0;
1066
0
        }
1067
16
    }
1068
16
    cond = PyObject_SetAttrString(state->FunctionDef_type, "_field_types",
1069
16
                                  FunctionDef_annotations) == 0;
1070
16
    if (!cond) {
1071
0
        Py_DECREF(FunctionDef_annotations);
1072
0
        return 0;
1073
0
    }
1074
16
    cond = PyObject_SetAttrString(state->FunctionDef_type, "__annotations__",
1075
16
                                  FunctionDef_annotations) == 0;
1076
16
    if (!cond) {
1077
0
        Py_DECREF(FunctionDef_annotations);
1078
0
        return 0;
1079
0
    }
1080
16
    Py_DECREF(FunctionDef_annotations);
1081
16
    PyObject *AsyncFunctionDef_annotations = PyDict_New();
1082
16
    if (!AsyncFunctionDef_annotations) return 0;
1083
16
    {
1084
16
        PyObject *type = (PyObject *)&PyUnicode_Type;
1085
16
        Py_INCREF(type);
1086
16
        cond = PyDict_SetItemString(AsyncFunctionDef_annotations, "name", type)
1087
16
                                    == 0;
1088
16
        Py_DECREF(type);
1089
16
        if (!cond) {
1090
0
            Py_DECREF(AsyncFunctionDef_annotations);
1091
0
            return 0;
1092
0
        }
1093
16
    }
1094
16
    {
1095
16
        PyObject *type = state->arguments_type;
1096
16
        Py_INCREF(type);
1097
16
        cond = PyDict_SetItemString(AsyncFunctionDef_annotations, "args", type)
1098
16
                                    == 0;
1099
16
        Py_DECREF(type);
1100
16
        if (!cond) {
1101
0
            Py_DECREF(AsyncFunctionDef_annotations);
1102
0
            return 0;
1103
0
        }
1104
16
    }
1105
16
    {
1106
16
        PyObject *type = state->stmt_type;
1107
16
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
1108
16
        cond = type != NULL;
1109
16
        if (!cond) {
1110
0
            Py_DECREF(AsyncFunctionDef_annotations);
1111
0
            return 0;
1112
0
        }
1113
16
        cond = PyDict_SetItemString(AsyncFunctionDef_annotations, "body", type)
1114
16
                                    == 0;
1115
16
        Py_DECREF(type);
1116
16
        if (!cond) {
1117
0
            Py_DECREF(AsyncFunctionDef_annotations);
1118
0
            return 0;
1119
0
        }
1120
16
    }
1121
16
    {
1122
16
        PyObject *type = state->expr_type;
1123
16
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
1124
16
        cond = type != NULL;
1125
16
        if (!cond) {
1126
0
            Py_DECREF(AsyncFunctionDef_annotations);
1127
0
            return 0;
1128
0
        }
1129
16
        cond = PyDict_SetItemString(AsyncFunctionDef_annotations,
1130
16
                                    "decorator_list", type) == 0;
1131
16
        Py_DECREF(type);
1132
16
        if (!cond) {
1133
0
            Py_DECREF(AsyncFunctionDef_annotations);
1134
0
            return 0;
1135
0
        }
1136
16
    }
1137
16
    {
1138
16
        PyObject *type = state->expr_type;
1139
16
        type = _Py_union_type_or(type, Py_None);
1140
16
        cond = type != NULL;
1141
16
        if (!cond) {
1142
0
            Py_DECREF(AsyncFunctionDef_annotations);
1143
0
            return 0;
1144
0
        }
1145
16
        cond = PyDict_SetItemString(AsyncFunctionDef_annotations, "returns",
1146
16
                                    type) == 0;
1147
16
        Py_DECREF(type);
1148
16
        if (!cond) {
1149
0
            Py_DECREF(AsyncFunctionDef_annotations);
1150
0
            return 0;
1151
0
        }
1152
16
    }
1153
16
    {
1154
16
        PyObject *type = (PyObject *)&PyUnicode_Type;
1155
16
        type = _Py_union_type_or(type, Py_None);
1156
16
        cond = type != NULL;
1157
16
        if (!cond) {
1158
0
            Py_DECREF(AsyncFunctionDef_annotations);
1159
0
            return 0;
1160
0
        }
1161
16
        cond = PyDict_SetItemString(AsyncFunctionDef_annotations,
1162
16
                                    "type_comment", type) == 0;
1163
16
        Py_DECREF(type);
1164
16
        if (!cond) {
1165
0
            Py_DECREF(AsyncFunctionDef_annotations);
1166
0
            return 0;
1167
0
        }
1168
16
    }
1169
16
    {
1170
16
        PyObject *type = state->type_param_type;
1171
16
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
1172
16
        cond = type != NULL;
1173
16
        if (!cond) {
1174
0
            Py_DECREF(AsyncFunctionDef_annotations);
1175
0
            return 0;
1176
0
        }
1177
16
        cond = PyDict_SetItemString(AsyncFunctionDef_annotations,
1178
16
                                    "type_params", type) == 0;
1179
16
        Py_DECREF(type);
1180
16
        if (!cond) {
1181
0
            Py_DECREF(AsyncFunctionDef_annotations);
1182
0
            return 0;
1183
0
        }
1184
16
    }
1185
16
    cond = PyObject_SetAttrString(state->AsyncFunctionDef_type, "_field_types",
1186
16
                                  AsyncFunctionDef_annotations) == 0;
1187
16
    if (!cond) {
1188
0
        Py_DECREF(AsyncFunctionDef_annotations);
1189
0
        return 0;
1190
0
    }
1191
16
    cond = PyObject_SetAttrString(state->AsyncFunctionDef_type,
1192
16
                                  "__annotations__",
1193
16
                                  AsyncFunctionDef_annotations) == 0;
1194
16
    if (!cond) {
1195
0
        Py_DECREF(AsyncFunctionDef_annotations);
1196
0
        return 0;
1197
0
    }
1198
16
    Py_DECREF(AsyncFunctionDef_annotations);
1199
16
    PyObject *ClassDef_annotations = PyDict_New();
1200
16
    if (!ClassDef_annotations) return 0;
1201
16
    {
1202
16
        PyObject *type = (PyObject *)&PyUnicode_Type;
1203
16
        Py_INCREF(type);
1204
16
        cond = PyDict_SetItemString(ClassDef_annotations, "name", type) == 0;
1205
16
        Py_DECREF(type);
1206
16
        if (!cond) {
1207
0
            Py_DECREF(ClassDef_annotations);
1208
0
            return 0;
1209
0
        }
1210
16
    }
1211
16
    {
1212
16
        PyObject *type = state->expr_type;
1213
16
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
1214
16
        cond = type != NULL;
1215
16
        if (!cond) {
1216
0
            Py_DECREF(ClassDef_annotations);
1217
0
            return 0;
1218
0
        }
1219
16
        cond = PyDict_SetItemString(ClassDef_annotations, "bases", type) == 0;
1220
16
        Py_DECREF(type);
1221
16
        if (!cond) {
1222
0
            Py_DECREF(ClassDef_annotations);
1223
0
            return 0;
1224
0
        }
1225
16
    }
1226
16
    {
1227
16
        PyObject *type = state->keyword_type;
1228
16
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
1229
16
        cond = type != NULL;
1230
16
        if (!cond) {
1231
0
            Py_DECREF(ClassDef_annotations);
1232
0
            return 0;
1233
0
        }
1234
16
        cond = PyDict_SetItemString(ClassDef_annotations, "keywords", type) ==
1235
16
                                    0;
1236
16
        Py_DECREF(type);
1237
16
        if (!cond) {
1238
0
            Py_DECREF(ClassDef_annotations);
1239
0
            return 0;
1240
0
        }
1241
16
    }
1242
16
    {
1243
16
        PyObject *type = state->stmt_type;
1244
16
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
1245
16
        cond = type != NULL;
1246
16
        if (!cond) {
1247
0
            Py_DECREF(ClassDef_annotations);
1248
0
            return 0;
1249
0
        }
1250
16
        cond = PyDict_SetItemString(ClassDef_annotations, "body", type) == 0;
1251
16
        Py_DECREF(type);
1252
16
        if (!cond) {
1253
0
            Py_DECREF(ClassDef_annotations);
1254
0
            return 0;
1255
0
        }
1256
16
    }
1257
16
    {
1258
16
        PyObject *type = state->expr_type;
1259
16
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
1260
16
        cond = type != NULL;
1261
16
        if (!cond) {
1262
0
            Py_DECREF(ClassDef_annotations);
1263
0
            return 0;
1264
0
        }
1265
16
        cond = PyDict_SetItemString(ClassDef_annotations, "decorator_list",
1266
16
                                    type) == 0;
1267
16
        Py_DECREF(type);
1268
16
        if (!cond) {
1269
0
            Py_DECREF(ClassDef_annotations);
1270
0
            return 0;
1271
0
        }
1272
16
    }
1273
16
    {
1274
16
        PyObject *type = state->type_param_type;
1275
16
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
1276
16
        cond = type != NULL;
1277
16
        if (!cond) {
1278
0
            Py_DECREF(ClassDef_annotations);
1279
0
            return 0;
1280
0
        }
1281
16
        cond = PyDict_SetItemString(ClassDef_annotations, "type_params", type)
1282
16
                                    == 0;
1283
16
        Py_DECREF(type);
1284
16
        if (!cond) {
1285
0
            Py_DECREF(ClassDef_annotations);
1286
0
            return 0;
1287
0
        }
1288
16
    }
1289
16
    cond = PyObject_SetAttrString(state->ClassDef_type, "_field_types",
1290
16
                                  ClassDef_annotations) == 0;
1291
16
    if (!cond) {
1292
0
        Py_DECREF(ClassDef_annotations);
1293
0
        return 0;
1294
0
    }
1295
16
    cond = PyObject_SetAttrString(state->ClassDef_type, "__annotations__",
1296
16
                                  ClassDef_annotations) == 0;
1297
16
    if (!cond) {
1298
0
        Py_DECREF(ClassDef_annotations);
1299
0
        return 0;
1300
0
    }
1301
16
    Py_DECREF(ClassDef_annotations);
1302
16
    PyObject *Return_annotations = PyDict_New();
1303
16
    if (!Return_annotations) return 0;
1304
16
    {
1305
16
        PyObject *type = state->expr_type;
1306
16
        type = _Py_union_type_or(type, Py_None);
1307
16
        cond = type != NULL;
1308
16
        if (!cond) {
1309
0
            Py_DECREF(Return_annotations);
1310
0
            return 0;
1311
0
        }
1312
16
        cond = PyDict_SetItemString(Return_annotations, "value", type) == 0;
1313
16
        Py_DECREF(type);
1314
16
        if (!cond) {
1315
0
            Py_DECREF(Return_annotations);
1316
0
            return 0;
1317
0
        }
1318
16
    }
1319
16
    cond = PyObject_SetAttrString(state->Return_type, "_field_types",
1320
16
                                  Return_annotations) == 0;
1321
16
    if (!cond) {
1322
0
        Py_DECREF(Return_annotations);
1323
0
        return 0;
1324
0
    }
1325
16
    cond = PyObject_SetAttrString(state->Return_type, "__annotations__",
1326
16
                                  Return_annotations) == 0;
1327
16
    if (!cond) {
1328
0
        Py_DECREF(Return_annotations);
1329
0
        return 0;
1330
0
    }
1331
16
    Py_DECREF(Return_annotations);
1332
16
    PyObject *Delete_annotations = PyDict_New();
1333
16
    if (!Delete_annotations) return 0;
1334
16
    {
1335
16
        PyObject *type = state->expr_type;
1336
16
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
1337
16
        cond = type != NULL;
1338
16
        if (!cond) {
1339
0
            Py_DECREF(Delete_annotations);
1340
0
            return 0;
1341
0
        }
1342
16
        cond = PyDict_SetItemString(Delete_annotations, "targets", type) == 0;
1343
16
        Py_DECREF(type);
1344
16
        if (!cond) {
1345
0
            Py_DECREF(Delete_annotations);
1346
0
            return 0;
1347
0
        }
1348
16
    }
1349
16
    cond = PyObject_SetAttrString(state->Delete_type, "_field_types",
1350
16
                                  Delete_annotations) == 0;
1351
16
    if (!cond) {
1352
0
        Py_DECREF(Delete_annotations);
1353
0
        return 0;
1354
0
    }
1355
16
    cond = PyObject_SetAttrString(state->Delete_type, "__annotations__",
1356
16
                                  Delete_annotations) == 0;
1357
16
    if (!cond) {
1358
0
        Py_DECREF(Delete_annotations);
1359
0
        return 0;
1360
0
    }
1361
16
    Py_DECREF(Delete_annotations);
1362
16
    PyObject *Assign_annotations = PyDict_New();
1363
16
    if (!Assign_annotations) return 0;
1364
16
    {
1365
16
        PyObject *type = state->expr_type;
1366
16
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
1367
16
        cond = type != NULL;
1368
16
        if (!cond) {
1369
0
            Py_DECREF(Assign_annotations);
1370
0
            return 0;
1371
0
        }
1372
16
        cond = PyDict_SetItemString(Assign_annotations, "targets", type) == 0;
1373
16
        Py_DECREF(type);
1374
16
        if (!cond) {
1375
0
            Py_DECREF(Assign_annotations);
1376
0
            return 0;
1377
0
        }
1378
16
    }
1379
16
    {
1380
16
        PyObject *type = state->expr_type;
1381
16
        Py_INCREF(type);
1382
16
        cond = PyDict_SetItemString(Assign_annotations, "value", type) == 0;
1383
16
        Py_DECREF(type);
1384
16
        if (!cond) {
1385
0
            Py_DECREF(Assign_annotations);
1386
0
            return 0;
1387
0
        }
1388
16
    }
1389
16
    {
1390
16
        PyObject *type = (PyObject *)&PyUnicode_Type;
1391
16
        type = _Py_union_type_or(type, Py_None);
1392
16
        cond = type != NULL;
1393
16
        if (!cond) {
1394
0
            Py_DECREF(Assign_annotations);
1395
0
            return 0;
1396
0
        }
1397
16
        cond = PyDict_SetItemString(Assign_annotations, "type_comment", type)
1398
16
                                    == 0;
1399
16
        Py_DECREF(type);
1400
16
        if (!cond) {
1401
0
            Py_DECREF(Assign_annotations);
1402
0
            return 0;
1403
0
        }
1404
16
    }
1405
16
    cond = PyObject_SetAttrString(state->Assign_type, "_field_types",
1406
16
                                  Assign_annotations) == 0;
1407
16
    if (!cond) {
1408
0
        Py_DECREF(Assign_annotations);
1409
0
        return 0;
1410
0
    }
1411
16
    cond = PyObject_SetAttrString(state->Assign_type, "__annotations__",
1412
16
                                  Assign_annotations) == 0;
1413
16
    if (!cond) {
1414
0
        Py_DECREF(Assign_annotations);
1415
0
        return 0;
1416
0
    }
1417
16
    Py_DECREF(Assign_annotations);
1418
16
    PyObject *TypeAlias_annotations = PyDict_New();
1419
16
    if (!TypeAlias_annotations) return 0;
1420
16
    {
1421
16
        PyObject *type = state->expr_type;
1422
16
        Py_INCREF(type);
1423
16
        cond = PyDict_SetItemString(TypeAlias_annotations, "name", type) == 0;
1424
16
        Py_DECREF(type);
1425
16
        if (!cond) {
1426
0
            Py_DECREF(TypeAlias_annotations);
1427
0
            return 0;
1428
0
        }
1429
16
    }
1430
16
    {
1431
16
        PyObject *type = state->type_param_type;
1432
16
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
1433
16
        cond = type != NULL;
1434
16
        if (!cond) {
1435
0
            Py_DECREF(TypeAlias_annotations);
1436
0
            return 0;
1437
0
        }
1438
16
        cond = PyDict_SetItemString(TypeAlias_annotations, "type_params", type)
1439
16
                                    == 0;
1440
16
        Py_DECREF(type);
1441
16
        if (!cond) {
1442
0
            Py_DECREF(TypeAlias_annotations);
1443
0
            return 0;
1444
0
        }
1445
16
    }
1446
16
    {
1447
16
        PyObject *type = state->expr_type;
1448
16
        Py_INCREF(type);
1449
16
        cond = PyDict_SetItemString(TypeAlias_annotations, "value", type) == 0;
1450
16
        Py_DECREF(type);
1451
16
        if (!cond) {
1452
0
            Py_DECREF(TypeAlias_annotations);
1453
0
            return 0;
1454
0
        }
1455
16
    }
1456
16
    cond = PyObject_SetAttrString(state->TypeAlias_type, "_field_types",
1457
16
                                  TypeAlias_annotations) == 0;
1458
16
    if (!cond) {
1459
0
        Py_DECREF(TypeAlias_annotations);
1460
0
        return 0;
1461
0
    }
1462
16
    cond = PyObject_SetAttrString(state->TypeAlias_type, "__annotations__",
1463
16
                                  TypeAlias_annotations) == 0;
1464
16
    if (!cond) {
1465
0
        Py_DECREF(TypeAlias_annotations);
1466
0
        return 0;
1467
0
    }
1468
16
    Py_DECREF(TypeAlias_annotations);
1469
16
    PyObject *AugAssign_annotations = PyDict_New();
1470
16
    if (!AugAssign_annotations) return 0;
1471
16
    {
1472
16
        PyObject *type = state->expr_type;
1473
16
        Py_INCREF(type);
1474
16
        cond = PyDict_SetItemString(AugAssign_annotations, "target", type) == 0;
1475
16
        Py_DECREF(type);
1476
16
        if (!cond) {
1477
0
            Py_DECREF(AugAssign_annotations);
1478
0
            return 0;
1479
0
        }
1480
16
    }
1481
16
    {
1482
16
        PyObject *type = state->operator_type;
1483
16
        Py_INCREF(type);
1484
16
        cond = PyDict_SetItemString(AugAssign_annotations, "op", type) == 0;
1485
16
        Py_DECREF(type);
1486
16
        if (!cond) {
1487
0
            Py_DECREF(AugAssign_annotations);
1488
0
            return 0;
1489
0
        }
1490
16
    }
1491
16
    {
1492
16
        PyObject *type = state->expr_type;
1493
16
        Py_INCREF(type);
1494
16
        cond = PyDict_SetItemString(AugAssign_annotations, "value", type) == 0;
1495
16
        Py_DECREF(type);
1496
16
        if (!cond) {
1497
0
            Py_DECREF(AugAssign_annotations);
1498
0
            return 0;
1499
0
        }
1500
16
    }
1501
16
    cond = PyObject_SetAttrString(state->AugAssign_type, "_field_types",
1502
16
                                  AugAssign_annotations) == 0;
1503
16
    if (!cond) {
1504
0
        Py_DECREF(AugAssign_annotations);
1505
0
        return 0;
1506
0
    }
1507
16
    cond = PyObject_SetAttrString(state->AugAssign_type, "__annotations__",
1508
16
                                  AugAssign_annotations) == 0;
1509
16
    if (!cond) {
1510
0
        Py_DECREF(AugAssign_annotations);
1511
0
        return 0;
1512
0
    }
1513
16
    Py_DECREF(AugAssign_annotations);
1514
16
    PyObject *AnnAssign_annotations = PyDict_New();
1515
16
    if (!AnnAssign_annotations) return 0;
1516
16
    {
1517
16
        PyObject *type = state->expr_type;
1518
16
        Py_INCREF(type);
1519
16
        cond = PyDict_SetItemString(AnnAssign_annotations, "target", type) == 0;
1520
16
        Py_DECREF(type);
1521
16
        if (!cond) {
1522
0
            Py_DECREF(AnnAssign_annotations);
1523
0
            return 0;
1524
0
        }
1525
16
    }
1526
16
    {
1527
16
        PyObject *type = state->expr_type;
1528
16
        Py_INCREF(type);
1529
16
        cond = PyDict_SetItemString(AnnAssign_annotations, "annotation", type)
1530
16
                                    == 0;
1531
16
        Py_DECREF(type);
1532
16
        if (!cond) {
1533
0
            Py_DECREF(AnnAssign_annotations);
1534
0
            return 0;
1535
0
        }
1536
16
    }
1537
16
    {
1538
16
        PyObject *type = state->expr_type;
1539
16
        type = _Py_union_type_or(type, Py_None);
1540
16
        cond = type != NULL;
1541
16
        if (!cond) {
1542
0
            Py_DECREF(AnnAssign_annotations);
1543
0
            return 0;
1544
0
        }
1545
16
        cond = PyDict_SetItemString(AnnAssign_annotations, "value", type) == 0;
1546
16
        Py_DECREF(type);
1547
16
        if (!cond) {
1548
0
            Py_DECREF(AnnAssign_annotations);
1549
0
            return 0;
1550
0
        }
1551
16
    }
1552
16
    {
1553
16
        PyObject *type = (PyObject *)&PyLong_Type;
1554
16
        Py_INCREF(type);
1555
16
        cond = PyDict_SetItemString(AnnAssign_annotations, "simple", type) == 0;
1556
16
        Py_DECREF(type);
1557
16
        if (!cond) {
1558
0
            Py_DECREF(AnnAssign_annotations);
1559
0
            return 0;
1560
0
        }
1561
16
    }
1562
16
    cond = PyObject_SetAttrString(state->AnnAssign_type, "_field_types",
1563
16
                                  AnnAssign_annotations) == 0;
1564
16
    if (!cond) {
1565
0
        Py_DECREF(AnnAssign_annotations);
1566
0
        return 0;
1567
0
    }
1568
16
    cond = PyObject_SetAttrString(state->AnnAssign_type, "__annotations__",
1569
16
                                  AnnAssign_annotations) == 0;
1570
16
    if (!cond) {
1571
0
        Py_DECREF(AnnAssign_annotations);
1572
0
        return 0;
1573
0
    }
1574
16
    Py_DECREF(AnnAssign_annotations);
1575
16
    PyObject *For_annotations = PyDict_New();
1576
16
    if (!For_annotations) return 0;
1577
16
    {
1578
16
        PyObject *type = state->expr_type;
1579
16
        Py_INCREF(type);
1580
16
        cond = PyDict_SetItemString(For_annotations, "target", type) == 0;
1581
16
        Py_DECREF(type);
1582
16
        if (!cond) {
1583
0
            Py_DECREF(For_annotations);
1584
0
            return 0;
1585
0
        }
1586
16
    }
1587
16
    {
1588
16
        PyObject *type = state->expr_type;
1589
16
        Py_INCREF(type);
1590
16
        cond = PyDict_SetItemString(For_annotations, "iter", type) == 0;
1591
16
        Py_DECREF(type);
1592
16
        if (!cond) {
1593
0
            Py_DECREF(For_annotations);
1594
0
            return 0;
1595
0
        }
1596
16
    }
1597
16
    {
1598
16
        PyObject *type = state->stmt_type;
1599
16
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
1600
16
        cond = type != NULL;
1601
16
        if (!cond) {
1602
0
            Py_DECREF(For_annotations);
1603
0
            return 0;
1604
0
        }
1605
16
        cond = PyDict_SetItemString(For_annotations, "body", type) == 0;
1606
16
        Py_DECREF(type);
1607
16
        if (!cond) {
1608
0
            Py_DECREF(For_annotations);
1609
0
            return 0;
1610
0
        }
1611
16
    }
1612
16
    {
1613
16
        PyObject *type = state->stmt_type;
1614
16
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
1615
16
        cond = type != NULL;
1616
16
        if (!cond) {
1617
0
            Py_DECREF(For_annotations);
1618
0
            return 0;
1619
0
        }
1620
16
        cond = PyDict_SetItemString(For_annotations, "orelse", type) == 0;
1621
16
        Py_DECREF(type);
1622
16
        if (!cond) {
1623
0
            Py_DECREF(For_annotations);
1624
0
            return 0;
1625
0
        }
1626
16
    }
1627
16
    {
1628
16
        PyObject *type = (PyObject *)&PyUnicode_Type;
1629
16
        type = _Py_union_type_or(type, Py_None);
1630
16
        cond = type != NULL;
1631
16
        if (!cond) {
1632
0
            Py_DECREF(For_annotations);
1633
0
            return 0;
1634
0
        }
1635
16
        cond = PyDict_SetItemString(For_annotations, "type_comment", type) == 0;
1636
16
        Py_DECREF(type);
1637
16
        if (!cond) {
1638
0
            Py_DECREF(For_annotations);
1639
0
            return 0;
1640
0
        }
1641
16
    }
1642
16
    cond = PyObject_SetAttrString(state->For_type, "_field_types",
1643
16
                                  For_annotations) == 0;
1644
16
    if (!cond) {
1645
0
        Py_DECREF(For_annotations);
1646
0
        return 0;
1647
0
    }
1648
16
    cond = PyObject_SetAttrString(state->For_type, "__annotations__",
1649
16
                                  For_annotations) == 0;
1650
16
    if (!cond) {
1651
0
        Py_DECREF(For_annotations);
1652
0
        return 0;
1653
0
    }
1654
16
    Py_DECREF(For_annotations);
1655
16
    PyObject *AsyncFor_annotations = PyDict_New();
1656
16
    if (!AsyncFor_annotations) return 0;
1657
16
    {
1658
16
        PyObject *type = state->expr_type;
1659
16
        Py_INCREF(type);
1660
16
        cond = PyDict_SetItemString(AsyncFor_annotations, "target", type) == 0;
1661
16
        Py_DECREF(type);
1662
16
        if (!cond) {
1663
0
            Py_DECREF(AsyncFor_annotations);
1664
0
            return 0;
1665
0
        }
1666
16
    }
1667
16
    {
1668
16
        PyObject *type = state->expr_type;
1669
16
        Py_INCREF(type);
1670
16
        cond = PyDict_SetItemString(AsyncFor_annotations, "iter", type) == 0;
1671
16
        Py_DECREF(type);
1672
16
        if (!cond) {
1673
0
            Py_DECREF(AsyncFor_annotations);
1674
0
            return 0;
1675
0
        }
1676
16
    }
1677
16
    {
1678
16
        PyObject *type = state->stmt_type;
1679
16
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
1680
16
        cond = type != NULL;
1681
16
        if (!cond) {
1682
0
            Py_DECREF(AsyncFor_annotations);
1683
0
            return 0;
1684
0
        }
1685
16
        cond = PyDict_SetItemString(AsyncFor_annotations, "body", type) == 0;
1686
16
        Py_DECREF(type);
1687
16
        if (!cond) {
1688
0
            Py_DECREF(AsyncFor_annotations);
1689
0
            return 0;
1690
0
        }
1691
16
    }
1692
16
    {
1693
16
        PyObject *type = state->stmt_type;
1694
16
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
1695
16
        cond = type != NULL;
1696
16
        if (!cond) {
1697
0
            Py_DECREF(AsyncFor_annotations);
1698
0
            return 0;
1699
0
        }
1700
16
        cond = PyDict_SetItemString(AsyncFor_annotations, "orelse", type) == 0;
1701
16
        Py_DECREF(type);
1702
16
        if (!cond) {
1703
0
            Py_DECREF(AsyncFor_annotations);
1704
0
            return 0;
1705
0
        }
1706
16
    }
1707
16
    {
1708
16
        PyObject *type = (PyObject *)&PyUnicode_Type;
1709
16
        type = _Py_union_type_or(type, Py_None);
1710
16
        cond = type != NULL;
1711
16
        if (!cond) {
1712
0
            Py_DECREF(AsyncFor_annotations);
1713
0
            return 0;
1714
0
        }
1715
16
        cond = PyDict_SetItemString(AsyncFor_annotations, "type_comment", type)
1716
16
                                    == 0;
1717
16
        Py_DECREF(type);
1718
16
        if (!cond) {
1719
0
            Py_DECREF(AsyncFor_annotations);
1720
0
            return 0;
1721
0
        }
1722
16
    }
1723
16
    cond = PyObject_SetAttrString(state->AsyncFor_type, "_field_types",
1724
16
                                  AsyncFor_annotations) == 0;
1725
16
    if (!cond) {
1726
0
        Py_DECREF(AsyncFor_annotations);
1727
0
        return 0;
1728
0
    }
1729
16
    cond = PyObject_SetAttrString(state->AsyncFor_type, "__annotations__",
1730
16
                                  AsyncFor_annotations) == 0;
1731
16
    if (!cond) {
1732
0
        Py_DECREF(AsyncFor_annotations);
1733
0
        return 0;
1734
0
    }
1735
16
    Py_DECREF(AsyncFor_annotations);
1736
16
    PyObject *While_annotations = PyDict_New();
1737
16
    if (!While_annotations) return 0;
1738
16
    {
1739
16
        PyObject *type = state->expr_type;
1740
16
        Py_INCREF(type);
1741
16
        cond = PyDict_SetItemString(While_annotations, "test", type) == 0;
1742
16
        Py_DECREF(type);
1743
16
        if (!cond) {
1744
0
            Py_DECREF(While_annotations);
1745
0
            return 0;
1746
0
        }
1747
16
    }
1748
16
    {
1749
16
        PyObject *type = state->stmt_type;
1750
16
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
1751
16
        cond = type != NULL;
1752
16
        if (!cond) {
1753
0
            Py_DECREF(While_annotations);
1754
0
            return 0;
1755
0
        }
1756
16
        cond = PyDict_SetItemString(While_annotations, "body", type) == 0;
1757
16
        Py_DECREF(type);
1758
16
        if (!cond) {
1759
0
            Py_DECREF(While_annotations);
1760
0
            return 0;
1761
0
        }
1762
16
    }
1763
16
    {
1764
16
        PyObject *type = state->stmt_type;
1765
16
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
1766
16
        cond = type != NULL;
1767
16
        if (!cond) {
1768
0
            Py_DECREF(While_annotations);
1769
0
            return 0;
1770
0
        }
1771
16
        cond = PyDict_SetItemString(While_annotations, "orelse", type) == 0;
1772
16
        Py_DECREF(type);
1773
16
        if (!cond) {
1774
0
            Py_DECREF(While_annotations);
1775
0
            return 0;
1776
0
        }
1777
16
    }
1778
16
    cond = PyObject_SetAttrString(state->While_type, "_field_types",
1779
16
                                  While_annotations) == 0;
1780
16
    if (!cond) {
1781
0
        Py_DECREF(While_annotations);
1782
0
        return 0;
1783
0
    }
1784
16
    cond = PyObject_SetAttrString(state->While_type, "__annotations__",
1785
16
                                  While_annotations) == 0;
1786
16
    if (!cond) {
1787
0
        Py_DECREF(While_annotations);
1788
0
        return 0;
1789
0
    }
1790
16
    Py_DECREF(While_annotations);
1791
16
    PyObject *If_annotations = PyDict_New();
1792
16
    if (!If_annotations) return 0;
1793
16
    {
1794
16
        PyObject *type = state->expr_type;
1795
16
        Py_INCREF(type);
1796
16
        cond = PyDict_SetItemString(If_annotations, "test", type) == 0;
1797
16
        Py_DECREF(type);
1798
16
        if (!cond) {
1799
0
            Py_DECREF(If_annotations);
1800
0
            return 0;
1801
0
        }
1802
16
    }
1803
16
    {
1804
16
        PyObject *type = state->stmt_type;
1805
16
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
1806
16
        cond = type != NULL;
1807
16
        if (!cond) {
1808
0
            Py_DECREF(If_annotations);
1809
0
            return 0;
1810
0
        }
1811
16
        cond = PyDict_SetItemString(If_annotations, "body", type) == 0;
1812
16
        Py_DECREF(type);
1813
16
        if (!cond) {
1814
0
            Py_DECREF(If_annotations);
1815
0
            return 0;
1816
0
        }
1817
16
    }
1818
16
    {
1819
16
        PyObject *type = state->stmt_type;
1820
16
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
1821
16
        cond = type != NULL;
1822
16
        if (!cond) {
1823
0
            Py_DECREF(If_annotations);
1824
0
            return 0;
1825
0
        }
1826
16
        cond = PyDict_SetItemString(If_annotations, "orelse", type) == 0;
1827
16
        Py_DECREF(type);
1828
16
        if (!cond) {
1829
0
            Py_DECREF(If_annotations);
1830
0
            return 0;
1831
0
        }
1832
16
    }
1833
16
    cond = PyObject_SetAttrString(state->If_type, "_field_types",
1834
16
                                  If_annotations) == 0;
1835
16
    if (!cond) {
1836
0
        Py_DECREF(If_annotations);
1837
0
        return 0;
1838
0
    }
1839
16
    cond = PyObject_SetAttrString(state->If_type, "__annotations__",
1840
16
                                  If_annotations) == 0;
1841
16
    if (!cond) {
1842
0
        Py_DECREF(If_annotations);
1843
0
        return 0;
1844
0
    }
1845
16
    Py_DECREF(If_annotations);
1846
16
    PyObject *With_annotations = PyDict_New();
1847
16
    if (!With_annotations) return 0;
1848
16
    {
1849
16
        PyObject *type = state->withitem_type;
1850
16
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
1851
16
        cond = type != NULL;
1852
16
        if (!cond) {
1853
0
            Py_DECREF(With_annotations);
1854
0
            return 0;
1855
0
        }
1856
16
        cond = PyDict_SetItemString(With_annotations, "items", type) == 0;
1857
16
        Py_DECREF(type);
1858
16
        if (!cond) {
1859
0
            Py_DECREF(With_annotations);
1860
0
            return 0;
1861
0
        }
1862
16
    }
1863
16
    {
1864
16
        PyObject *type = state->stmt_type;
1865
16
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
1866
16
        cond = type != NULL;
1867
16
        if (!cond) {
1868
0
            Py_DECREF(With_annotations);
1869
0
            return 0;
1870
0
        }
1871
16
        cond = PyDict_SetItemString(With_annotations, "body", type) == 0;
1872
16
        Py_DECREF(type);
1873
16
        if (!cond) {
1874
0
            Py_DECREF(With_annotations);
1875
0
            return 0;
1876
0
        }
1877
16
    }
1878
16
    {
1879
16
        PyObject *type = (PyObject *)&PyUnicode_Type;
1880
16
        type = _Py_union_type_or(type, Py_None);
1881
16
        cond = type != NULL;
1882
16
        if (!cond) {
1883
0
            Py_DECREF(With_annotations);
1884
0
            return 0;
1885
0
        }
1886
16
        cond = PyDict_SetItemString(With_annotations, "type_comment", type) ==
1887
16
                                    0;
1888
16
        Py_DECREF(type);
1889
16
        if (!cond) {
1890
0
            Py_DECREF(With_annotations);
1891
0
            return 0;
1892
0
        }
1893
16
    }
1894
16
    cond = PyObject_SetAttrString(state->With_type, "_field_types",
1895
16
                                  With_annotations) == 0;
1896
16
    if (!cond) {
1897
0
        Py_DECREF(With_annotations);
1898
0
        return 0;
1899
0
    }
1900
16
    cond = PyObject_SetAttrString(state->With_type, "__annotations__",
1901
16
                                  With_annotations) == 0;
1902
16
    if (!cond) {
1903
0
        Py_DECREF(With_annotations);
1904
0
        return 0;
1905
0
    }
1906
16
    Py_DECREF(With_annotations);
1907
16
    PyObject *AsyncWith_annotations = PyDict_New();
1908
16
    if (!AsyncWith_annotations) return 0;
1909
16
    {
1910
16
        PyObject *type = state->withitem_type;
1911
16
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
1912
16
        cond = type != NULL;
1913
16
        if (!cond) {
1914
0
            Py_DECREF(AsyncWith_annotations);
1915
0
            return 0;
1916
0
        }
1917
16
        cond = PyDict_SetItemString(AsyncWith_annotations, "items", type) == 0;
1918
16
        Py_DECREF(type);
1919
16
        if (!cond) {
1920
0
            Py_DECREF(AsyncWith_annotations);
1921
0
            return 0;
1922
0
        }
1923
16
    }
1924
16
    {
1925
16
        PyObject *type = state->stmt_type;
1926
16
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
1927
16
        cond = type != NULL;
1928
16
        if (!cond) {
1929
0
            Py_DECREF(AsyncWith_annotations);
1930
0
            return 0;
1931
0
        }
1932
16
        cond = PyDict_SetItemString(AsyncWith_annotations, "body", type) == 0;
1933
16
        Py_DECREF(type);
1934
16
        if (!cond) {
1935
0
            Py_DECREF(AsyncWith_annotations);
1936
0
            return 0;
1937
0
        }
1938
16
    }
1939
16
    {
1940
16
        PyObject *type = (PyObject *)&PyUnicode_Type;
1941
16
        type = _Py_union_type_or(type, Py_None);
1942
16
        cond = type != NULL;
1943
16
        if (!cond) {
1944
0
            Py_DECREF(AsyncWith_annotations);
1945
0
            return 0;
1946
0
        }
1947
16
        cond = PyDict_SetItemString(AsyncWith_annotations, "type_comment",
1948
16
                                    type) == 0;
1949
16
        Py_DECREF(type);
1950
16
        if (!cond) {
1951
0
            Py_DECREF(AsyncWith_annotations);
1952
0
            return 0;
1953
0
        }
1954
16
    }
1955
16
    cond = PyObject_SetAttrString(state->AsyncWith_type, "_field_types",
1956
16
                                  AsyncWith_annotations) == 0;
1957
16
    if (!cond) {
1958
0
        Py_DECREF(AsyncWith_annotations);
1959
0
        return 0;
1960
0
    }
1961
16
    cond = PyObject_SetAttrString(state->AsyncWith_type, "__annotations__",
1962
16
                                  AsyncWith_annotations) == 0;
1963
16
    if (!cond) {
1964
0
        Py_DECREF(AsyncWith_annotations);
1965
0
        return 0;
1966
0
    }
1967
16
    Py_DECREF(AsyncWith_annotations);
1968
16
    PyObject *Match_annotations = PyDict_New();
1969
16
    if (!Match_annotations) return 0;
1970
16
    {
1971
16
        PyObject *type = state->expr_type;
1972
16
        Py_INCREF(type);
1973
16
        cond = PyDict_SetItemString(Match_annotations, "subject", type) == 0;
1974
16
        Py_DECREF(type);
1975
16
        if (!cond) {
1976
0
            Py_DECREF(Match_annotations);
1977
0
            return 0;
1978
0
        }
1979
16
    }
1980
16
    {
1981
16
        PyObject *type = state->match_case_type;
1982
16
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
1983
16
        cond = type != NULL;
1984
16
        if (!cond) {
1985
0
            Py_DECREF(Match_annotations);
1986
0
            return 0;
1987
0
        }
1988
16
        cond = PyDict_SetItemString(Match_annotations, "cases", type) == 0;
1989
16
        Py_DECREF(type);
1990
16
        if (!cond) {
1991
0
            Py_DECREF(Match_annotations);
1992
0
            return 0;
1993
0
        }
1994
16
    }
1995
16
    cond = PyObject_SetAttrString(state->Match_type, "_field_types",
1996
16
                                  Match_annotations) == 0;
1997
16
    if (!cond) {
1998
0
        Py_DECREF(Match_annotations);
1999
0
        return 0;
2000
0
    }
2001
16
    cond = PyObject_SetAttrString(state->Match_type, "__annotations__",
2002
16
                                  Match_annotations) == 0;
2003
16
    if (!cond) {
2004
0
        Py_DECREF(Match_annotations);
2005
0
        return 0;
2006
0
    }
2007
16
    Py_DECREF(Match_annotations);
2008
16
    PyObject *Raise_annotations = PyDict_New();
2009
16
    if (!Raise_annotations) return 0;
2010
16
    {
2011
16
        PyObject *type = state->expr_type;
2012
16
        type = _Py_union_type_or(type, Py_None);
2013
16
        cond = type != NULL;
2014
16
        if (!cond) {
2015
0
            Py_DECREF(Raise_annotations);
2016
0
            return 0;
2017
0
        }
2018
16
        cond = PyDict_SetItemString(Raise_annotations, "exc", type) == 0;
2019
16
        Py_DECREF(type);
2020
16
        if (!cond) {
2021
0
            Py_DECREF(Raise_annotations);
2022
0
            return 0;
2023
0
        }
2024
16
    }
2025
16
    {
2026
16
        PyObject *type = state->expr_type;
2027
16
        type = _Py_union_type_or(type, Py_None);
2028
16
        cond = type != NULL;
2029
16
        if (!cond) {
2030
0
            Py_DECREF(Raise_annotations);
2031
0
            return 0;
2032
0
        }
2033
16
        cond = PyDict_SetItemString(Raise_annotations, "cause", type) == 0;
2034
16
        Py_DECREF(type);
2035
16
        if (!cond) {
2036
0
            Py_DECREF(Raise_annotations);
2037
0
            return 0;
2038
0
        }
2039
16
    }
2040
16
    cond = PyObject_SetAttrString(state->Raise_type, "_field_types",
2041
16
                                  Raise_annotations) == 0;
2042
16
    if (!cond) {
2043
0
        Py_DECREF(Raise_annotations);
2044
0
        return 0;
2045
0
    }
2046
16
    cond = PyObject_SetAttrString(state->Raise_type, "__annotations__",
2047
16
                                  Raise_annotations) == 0;
2048
16
    if (!cond) {
2049
0
        Py_DECREF(Raise_annotations);
2050
0
        return 0;
2051
0
    }
2052
16
    Py_DECREF(Raise_annotations);
2053
16
    PyObject *Try_annotations = PyDict_New();
2054
16
    if (!Try_annotations) return 0;
2055
16
    {
2056
16
        PyObject *type = state->stmt_type;
2057
16
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
2058
16
        cond = type != NULL;
2059
16
        if (!cond) {
2060
0
            Py_DECREF(Try_annotations);
2061
0
            return 0;
2062
0
        }
2063
16
        cond = PyDict_SetItemString(Try_annotations, "body", type) == 0;
2064
16
        Py_DECREF(type);
2065
16
        if (!cond) {
2066
0
            Py_DECREF(Try_annotations);
2067
0
            return 0;
2068
0
        }
2069
16
    }
2070
16
    {
2071
16
        PyObject *type = state->excepthandler_type;
2072
16
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
2073
16
        cond = type != NULL;
2074
16
        if (!cond) {
2075
0
            Py_DECREF(Try_annotations);
2076
0
            return 0;
2077
0
        }
2078
16
        cond = PyDict_SetItemString(Try_annotations, "handlers", type) == 0;
2079
16
        Py_DECREF(type);
2080
16
        if (!cond) {
2081
0
            Py_DECREF(Try_annotations);
2082
0
            return 0;
2083
0
        }
2084
16
    }
2085
16
    {
2086
16
        PyObject *type = state->stmt_type;
2087
16
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
2088
16
        cond = type != NULL;
2089
16
        if (!cond) {
2090
0
            Py_DECREF(Try_annotations);
2091
0
            return 0;
2092
0
        }
2093
16
        cond = PyDict_SetItemString(Try_annotations, "orelse", type) == 0;
2094
16
        Py_DECREF(type);
2095
16
        if (!cond) {
2096
0
            Py_DECREF(Try_annotations);
2097
0
            return 0;
2098
0
        }
2099
16
    }
2100
16
    {
2101
16
        PyObject *type = state->stmt_type;
2102
16
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
2103
16
        cond = type != NULL;
2104
16
        if (!cond) {
2105
0
            Py_DECREF(Try_annotations);
2106
0
            return 0;
2107
0
        }
2108
16
        cond = PyDict_SetItemString(Try_annotations, "finalbody", type) == 0;
2109
16
        Py_DECREF(type);
2110
16
        if (!cond) {
2111
0
            Py_DECREF(Try_annotations);
2112
0
            return 0;
2113
0
        }
2114
16
    }
2115
16
    cond = PyObject_SetAttrString(state->Try_type, "_field_types",
2116
16
                                  Try_annotations) == 0;
2117
16
    if (!cond) {
2118
0
        Py_DECREF(Try_annotations);
2119
0
        return 0;
2120
0
    }
2121
16
    cond = PyObject_SetAttrString(state->Try_type, "__annotations__",
2122
16
                                  Try_annotations) == 0;
2123
16
    if (!cond) {
2124
0
        Py_DECREF(Try_annotations);
2125
0
        return 0;
2126
0
    }
2127
16
    Py_DECREF(Try_annotations);
2128
16
    PyObject *TryStar_annotations = PyDict_New();
2129
16
    if (!TryStar_annotations) return 0;
2130
16
    {
2131
16
        PyObject *type = state->stmt_type;
2132
16
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
2133
16
        cond = type != NULL;
2134
16
        if (!cond) {
2135
0
            Py_DECREF(TryStar_annotations);
2136
0
            return 0;
2137
0
        }
2138
16
        cond = PyDict_SetItemString(TryStar_annotations, "body", type) == 0;
2139
16
        Py_DECREF(type);
2140
16
        if (!cond) {
2141
0
            Py_DECREF(TryStar_annotations);
2142
0
            return 0;
2143
0
        }
2144
16
    }
2145
16
    {
2146
16
        PyObject *type = state->excepthandler_type;
2147
16
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
2148
16
        cond = type != NULL;
2149
16
        if (!cond) {
2150
0
            Py_DECREF(TryStar_annotations);
2151
0
            return 0;
2152
0
        }
2153
16
        cond = PyDict_SetItemString(TryStar_annotations, "handlers", type) == 0;
2154
16
        Py_DECREF(type);
2155
16
        if (!cond) {
2156
0
            Py_DECREF(TryStar_annotations);
2157
0
            return 0;
2158
0
        }
2159
16
    }
2160
16
    {
2161
16
        PyObject *type = state->stmt_type;
2162
16
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
2163
16
        cond = type != NULL;
2164
16
        if (!cond) {
2165
0
            Py_DECREF(TryStar_annotations);
2166
0
            return 0;
2167
0
        }
2168
16
        cond = PyDict_SetItemString(TryStar_annotations, "orelse", type) == 0;
2169
16
        Py_DECREF(type);
2170
16
        if (!cond) {
2171
0
            Py_DECREF(TryStar_annotations);
2172
0
            return 0;
2173
0
        }
2174
16
    }
2175
16
    {
2176
16
        PyObject *type = state->stmt_type;
2177
16
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
2178
16
        cond = type != NULL;
2179
16
        if (!cond) {
2180
0
            Py_DECREF(TryStar_annotations);
2181
0
            return 0;
2182
0
        }
2183
16
        cond = PyDict_SetItemString(TryStar_annotations, "finalbody", type) ==
2184
16
                                    0;
2185
16
        Py_DECREF(type);
2186
16
        if (!cond) {
2187
0
            Py_DECREF(TryStar_annotations);
2188
0
            return 0;
2189
0
        }
2190
16
    }
2191
16
    cond = PyObject_SetAttrString(state->TryStar_type, "_field_types",
2192
16
                                  TryStar_annotations) == 0;
2193
16
    if (!cond) {
2194
0
        Py_DECREF(TryStar_annotations);
2195
0
        return 0;
2196
0
    }
2197
16
    cond = PyObject_SetAttrString(state->TryStar_type, "__annotations__",
2198
16
                                  TryStar_annotations) == 0;
2199
16
    if (!cond) {
2200
0
        Py_DECREF(TryStar_annotations);
2201
0
        return 0;
2202
0
    }
2203
16
    Py_DECREF(TryStar_annotations);
2204
16
    PyObject *Assert_annotations = PyDict_New();
2205
16
    if (!Assert_annotations) return 0;
2206
16
    {
2207
16
        PyObject *type = state->expr_type;
2208
16
        Py_INCREF(type);
2209
16
        cond = PyDict_SetItemString(Assert_annotations, "test", type) == 0;
2210
16
        Py_DECREF(type);
2211
16
        if (!cond) {
2212
0
            Py_DECREF(Assert_annotations);
2213
0
            return 0;
2214
0
        }
2215
16
    }
2216
16
    {
2217
16
        PyObject *type = state->expr_type;
2218
16
        type = _Py_union_type_or(type, Py_None);
2219
16
        cond = type != NULL;
2220
16
        if (!cond) {
2221
0
            Py_DECREF(Assert_annotations);
2222
0
            return 0;
2223
0
        }
2224
16
        cond = PyDict_SetItemString(Assert_annotations, "msg", type) == 0;
2225
16
        Py_DECREF(type);
2226
16
        if (!cond) {
2227
0
            Py_DECREF(Assert_annotations);
2228
0
            return 0;
2229
0
        }
2230
16
    }
2231
16
    cond = PyObject_SetAttrString(state->Assert_type, "_field_types",
2232
16
                                  Assert_annotations) == 0;
2233
16
    if (!cond) {
2234
0
        Py_DECREF(Assert_annotations);
2235
0
        return 0;
2236
0
    }
2237
16
    cond = PyObject_SetAttrString(state->Assert_type, "__annotations__",
2238
16
                                  Assert_annotations) == 0;
2239
16
    if (!cond) {
2240
0
        Py_DECREF(Assert_annotations);
2241
0
        return 0;
2242
0
    }
2243
16
    Py_DECREF(Assert_annotations);
2244
16
    PyObject *Import_annotations = PyDict_New();
2245
16
    if (!Import_annotations) return 0;
2246
16
    {
2247
16
        PyObject *type = state->alias_type;
2248
16
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
2249
16
        cond = type != NULL;
2250
16
        if (!cond) {
2251
0
            Py_DECREF(Import_annotations);
2252
0
            return 0;
2253
0
        }
2254
16
        cond = PyDict_SetItemString(Import_annotations, "names", type) == 0;
2255
16
        Py_DECREF(type);
2256
16
        if (!cond) {
2257
0
            Py_DECREF(Import_annotations);
2258
0
            return 0;
2259
0
        }
2260
16
    }
2261
16
    {
2262
16
        PyObject *type = (PyObject *)&PyLong_Type;
2263
16
        type = _Py_union_type_or(type, Py_None);
2264
16
        cond = type != NULL;
2265
16
        if (!cond) {
2266
0
            Py_DECREF(Import_annotations);
2267
0
            return 0;
2268
0
        }
2269
16
        cond = PyDict_SetItemString(Import_annotations, "is_lazy", type) == 0;
2270
16
        Py_DECREF(type);
2271
16
        if (!cond) {
2272
0
            Py_DECREF(Import_annotations);
2273
0
            return 0;
2274
0
        }
2275
16
    }
2276
16
    cond = PyObject_SetAttrString(state->Import_type, "_field_types",
2277
16
                                  Import_annotations) == 0;
2278
16
    if (!cond) {
2279
0
        Py_DECREF(Import_annotations);
2280
0
        return 0;
2281
0
    }
2282
16
    cond = PyObject_SetAttrString(state->Import_type, "__annotations__",
2283
16
                                  Import_annotations) == 0;
2284
16
    if (!cond) {
2285
0
        Py_DECREF(Import_annotations);
2286
0
        return 0;
2287
0
    }
2288
16
    Py_DECREF(Import_annotations);
2289
16
    PyObject *ImportFrom_annotations = PyDict_New();
2290
16
    if (!ImportFrom_annotations) return 0;
2291
16
    {
2292
16
        PyObject *type = (PyObject *)&PyUnicode_Type;
2293
16
        type = _Py_union_type_or(type, Py_None);
2294
16
        cond = type != NULL;
2295
16
        if (!cond) {
2296
0
            Py_DECREF(ImportFrom_annotations);
2297
0
            return 0;
2298
0
        }
2299
16
        cond = PyDict_SetItemString(ImportFrom_annotations, "module", type) ==
2300
16
                                    0;
2301
16
        Py_DECREF(type);
2302
16
        if (!cond) {
2303
0
            Py_DECREF(ImportFrom_annotations);
2304
0
            return 0;
2305
0
        }
2306
16
    }
2307
16
    {
2308
16
        PyObject *type = state->alias_type;
2309
16
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
2310
16
        cond = type != NULL;
2311
16
        if (!cond) {
2312
0
            Py_DECREF(ImportFrom_annotations);
2313
0
            return 0;
2314
0
        }
2315
16
        cond = PyDict_SetItemString(ImportFrom_annotations, "names", type) == 0;
2316
16
        Py_DECREF(type);
2317
16
        if (!cond) {
2318
0
            Py_DECREF(ImportFrom_annotations);
2319
0
            return 0;
2320
0
        }
2321
16
    }
2322
16
    {
2323
16
        PyObject *type = (PyObject *)&PyLong_Type;
2324
16
        type = _Py_union_type_or(type, Py_None);
2325
16
        cond = type != NULL;
2326
16
        if (!cond) {
2327
0
            Py_DECREF(ImportFrom_annotations);
2328
0
            return 0;
2329
0
        }
2330
16
        cond = PyDict_SetItemString(ImportFrom_annotations, "level", type) == 0;
2331
16
        Py_DECREF(type);
2332
16
        if (!cond) {
2333
0
            Py_DECREF(ImportFrom_annotations);
2334
0
            return 0;
2335
0
        }
2336
16
    }
2337
16
    {
2338
16
        PyObject *type = (PyObject *)&PyLong_Type;
2339
16
        type = _Py_union_type_or(type, Py_None);
2340
16
        cond = type != NULL;
2341
16
        if (!cond) {
2342
0
            Py_DECREF(ImportFrom_annotations);
2343
0
            return 0;
2344
0
        }
2345
16
        cond = PyDict_SetItemString(ImportFrom_annotations, "is_lazy", type) ==
2346
16
                                    0;
2347
16
        Py_DECREF(type);
2348
16
        if (!cond) {
2349
0
            Py_DECREF(ImportFrom_annotations);
2350
0
            return 0;
2351
0
        }
2352
16
    }
2353
16
    cond = PyObject_SetAttrString(state->ImportFrom_type, "_field_types",
2354
16
                                  ImportFrom_annotations) == 0;
2355
16
    if (!cond) {
2356
0
        Py_DECREF(ImportFrom_annotations);
2357
0
        return 0;
2358
0
    }
2359
16
    cond = PyObject_SetAttrString(state->ImportFrom_type, "__annotations__",
2360
16
                                  ImportFrom_annotations) == 0;
2361
16
    if (!cond) {
2362
0
        Py_DECREF(ImportFrom_annotations);
2363
0
        return 0;
2364
0
    }
2365
16
    Py_DECREF(ImportFrom_annotations);
2366
16
    PyObject *Global_annotations = PyDict_New();
2367
16
    if (!Global_annotations) return 0;
2368
16
    {
2369
16
        PyObject *type = (PyObject *)&PyUnicode_Type;
2370
16
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
2371
16
        cond = type != NULL;
2372
16
        if (!cond) {
2373
0
            Py_DECREF(Global_annotations);
2374
0
            return 0;
2375
0
        }
2376
16
        cond = PyDict_SetItemString(Global_annotations, "names", type) == 0;
2377
16
        Py_DECREF(type);
2378
16
        if (!cond) {
2379
0
            Py_DECREF(Global_annotations);
2380
0
            return 0;
2381
0
        }
2382
16
    }
2383
16
    cond = PyObject_SetAttrString(state->Global_type, "_field_types",
2384
16
                                  Global_annotations) == 0;
2385
16
    if (!cond) {
2386
0
        Py_DECREF(Global_annotations);
2387
0
        return 0;
2388
0
    }
2389
16
    cond = PyObject_SetAttrString(state->Global_type, "__annotations__",
2390
16
                                  Global_annotations) == 0;
2391
16
    if (!cond) {
2392
0
        Py_DECREF(Global_annotations);
2393
0
        return 0;
2394
0
    }
2395
16
    Py_DECREF(Global_annotations);
2396
16
    PyObject *Nonlocal_annotations = PyDict_New();
2397
16
    if (!Nonlocal_annotations) return 0;
2398
16
    {
2399
16
        PyObject *type = (PyObject *)&PyUnicode_Type;
2400
16
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
2401
16
        cond = type != NULL;
2402
16
        if (!cond) {
2403
0
            Py_DECREF(Nonlocal_annotations);
2404
0
            return 0;
2405
0
        }
2406
16
        cond = PyDict_SetItemString(Nonlocal_annotations, "names", type) == 0;
2407
16
        Py_DECREF(type);
2408
16
        if (!cond) {
2409
0
            Py_DECREF(Nonlocal_annotations);
2410
0
            return 0;
2411
0
        }
2412
16
    }
2413
16
    cond = PyObject_SetAttrString(state->Nonlocal_type, "_field_types",
2414
16
                                  Nonlocal_annotations) == 0;
2415
16
    if (!cond) {
2416
0
        Py_DECREF(Nonlocal_annotations);
2417
0
        return 0;
2418
0
    }
2419
16
    cond = PyObject_SetAttrString(state->Nonlocal_type, "__annotations__",
2420
16
                                  Nonlocal_annotations) == 0;
2421
16
    if (!cond) {
2422
0
        Py_DECREF(Nonlocal_annotations);
2423
0
        return 0;
2424
0
    }
2425
16
    Py_DECREF(Nonlocal_annotations);
2426
16
    PyObject *Expr_annotations = PyDict_New();
2427
16
    if (!Expr_annotations) return 0;
2428
16
    {
2429
16
        PyObject *type = state->expr_type;
2430
16
        Py_INCREF(type);
2431
16
        cond = PyDict_SetItemString(Expr_annotations, "value", type) == 0;
2432
16
        Py_DECREF(type);
2433
16
        if (!cond) {
2434
0
            Py_DECREF(Expr_annotations);
2435
0
            return 0;
2436
0
        }
2437
16
    }
2438
16
    cond = PyObject_SetAttrString(state->Expr_type, "_field_types",
2439
16
                                  Expr_annotations) == 0;
2440
16
    if (!cond) {
2441
0
        Py_DECREF(Expr_annotations);
2442
0
        return 0;
2443
0
    }
2444
16
    cond = PyObject_SetAttrString(state->Expr_type, "__annotations__",
2445
16
                                  Expr_annotations) == 0;
2446
16
    if (!cond) {
2447
0
        Py_DECREF(Expr_annotations);
2448
0
        return 0;
2449
0
    }
2450
16
    Py_DECREF(Expr_annotations);
2451
16
    PyObject *Pass_annotations = PyDict_New();
2452
16
    if (!Pass_annotations) return 0;
2453
16
    cond = PyObject_SetAttrString(state->Pass_type, "_field_types",
2454
16
                                  Pass_annotations) == 0;
2455
16
    if (!cond) {
2456
0
        Py_DECREF(Pass_annotations);
2457
0
        return 0;
2458
0
    }
2459
16
    cond = PyObject_SetAttrString(state->Pass_type, "__annotations__",
2460
16
                                  Pass_annotations) == 0;
2461
16
    if (!cond) {
2462
0
        Py_DECREF(Pass_annotations);
2463
0
        return 0;
2464
0
    }
2465
16
    Py_DECREF(Pass_annotations);
2466
16
    PyObject *Break_annotations = PyDict_New();
2467
16
    if (!Break_annotations) return 0;
2468
16
    cond = PyObject_SetAttrString(state->Break_type, "_field_types",
2469
16
                                  Break_annotations) == 0;
2470
16
    if (!cond) {
2471
0
        Py_DECREF(Break_annotations);
2472
0
        return 0;
2473
0
    }
2474
16
    cond = PyObject_SetAttrString(state->Break_type, "__annotations__",
2475
16
                                  Break_annotations) == 0;
2476
16
    if (!cond) {
2477
0
        Py_DECREF(Break_annotations);
2478
0
        return 0;
2479
0
    }
2480
16
    Py_DECREF(Break_annotations);
2481
16
    PyObject *Continue_annotations = PyDict_New();
2482
16
    if (!Continue_annotations) return 0;
2483
16
    cond = PyObject_SetAttrString(state->Continue_type, "_field_types",
2484
16
                                  Continue_annotations) == 0;
2485
16
    if (!cond) {
2486
0
        Py_DECREF(Continue_annotations);
2487
0
        return 0;
2488
0
    }
2489
16
    cond = PyObject_SetAttrString(state->Continue_type, "__annotations__",
2490
16
                                  Continue_annotations) == 0;
2491
16
    if (!cond) {
2492
0
        Py_DECREF(Continue_annotations);
2493
0
        return 0;
2494
0
    }
2495
16
    Py_DECREF(Continue_annotations);
2496
16
    PyObject *BoolOp_annotations = PyDict_New();
2497
16
    if (!BoolOp_annotations) return 0;
2498
16
    {
2499
16
        PyObject *type = state->boolop_type;
2500
16
        Py_INCREF(type);
2501
16
        cond = PyDict_SetItemString(BoolOp_annotations, "op", type) == 0;
2502
16
        Py_DECREF(type);
2503
16
        if (!cond) {
2504
0
            Py_DECREF(BoolOp_annotations);
2505
0
            return 0;
2506
0
        }
2507
16
    }
2508
16
    {
2509
16
        PyObject *type = state->expr_type;
2510
16
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
2511
16
        cond = type != NULL;
2512
16
        if (!cond) {
2513
0
            Py_DECREF(BoolOp_annotations);
2514
0
            return 0;
2515
0
        }
2516
16
        cond = PyDict_SetItemString(BoolOp_annotations, "values", type) == 0;
2517
16
        Py_DECREF(type);
2518
16
        if (!cond) {
2519
0
            Py_DECREF(BoolOp_annotations);
2520
0
            return 0;
2521
0
        }
2522
16
    }
2523
16
    cond = PyObject_SetAttrString(state->BoolOp_type, "_field_types",
2524
16
                                  BoolOp_annotations) == 0;
2525
16
    if (!cond) {
2526
0
        Py_DECREF(BoolOp_annotations);
2527
0
        return 0;
2528
0
    }
2529
16
    cond = PyObject_SetAttrString(state->BoolOp_type, "__annotations__",
2530
16
                                  BoolOp_annotations) == 0;
2531
16
    if (!cond) {
2532
0
        Py_DECREF(BoolOp_annotations);
2533
0
        return 0;
2534
0
    }
2535
16
    Py_DECREF(BoolOp_annotations);
2536
16
    PyObject *NamedExpr_annotations = PyDict_New();
2537
16
    if (!NamedExpr_annotations) return 0;
2538
16
    {
2539
16
        PyObject *type = state->expr_type;
2540
16
        Py_INCREF(type);
2541
16
        cond = PyDict_SetItemString(NamedExpr_annotations, "target", type) == 0;
2542
16
        Py_DECREF(type);
2543
16
        if (!cond) {
2544
0
            Py_DECREF(NamedExpr_annotations);
2545
0
            return 0;
2546
0
        }
2547
16
    }
2548
16
    {
2549
16
        PyObject *type = state->expr_type;
2550
16
        Py_INCREF(type);
2551
16
        cond = PyDict_SetItemString(NamedExpr_annotations, "value", type) == 0;
2552
16
        Py_DECREF(type);
2553
16
        if (!cond) {
2554
0
            Py_DECREF(NamedExpr_annotations);
2555
0
            return 0;
2556
0
        }
2557
16
    }
2558
16
    cond = PyObject_SetAttrString(state->NamedExpr_type, "_field_types",
2559
16
                                  NamedExpr_annotations) == 0;
2560
16
    if (!cond) {
2561
0
        Py_DECREF(NamedExpr_annotations);
2562
0
        return 0;
2563
0
    }
2564
16
    cond = PyObject_SetAttrString(state->NamedExpr_type, "__annotations__",
2565
16
                                  NamedExpr_annotations) == 0;
2566
16
    if (!cond) {
2567
0
        Py_DECREF(NamedExpr_annotations);
2568
0
        return 0;
2569
0
    }
2570
16
    Py_DECREF(NamedExpr_annotations);
2571
16
    PyObject *BinOp_annotations = PyDict_New();
2572
16
    if (!BinOp_annotations) return 0;
2573
16
    {
2574
16
        PyObject *type = state->expr_type;
2575
16
        Py_INCREF(type);
2576
16
        cond = PyDict_SetItemString(BinOp_annotations, "left", type) == 0;
2577
16
        Py_DECREF(type);
2578
16
        if (!cond) {
2579
0
            Py_DECREF(BinOp_annotations);
2580
0
            return 0;
2581
0
        }
2582
16
    }
2583
16
    {
2584
16
        PyObject *type = state->operator_type;
2585
16
        Py_INCREF(type);
2586
16
        cond = PyDict_SetItemString(BinOp_annotations, "op", type) == 0;
2587
16
        Py_DECREF(type);
2588
16
        if (!cond) {
2589
0
            Py_DECREF(BinOp_annotations);
2590
0
            return 0;
2591
0
        }
2592
16
    }
2593
16
    {
2594
16
        PyObject *type = state->expr_type;
2595
16
        Py_INCREF(type);
2596
16
        cond = PyDict_SetItemString(BinOp_annotations, "right", type) == 0;
2597
16
        Py_DECREF(type);
2598
16
        if (!cond) {
2599
0
            Py_DECREF(BinOp_annotations);
2600
0
            return 0;
2601
0
        }
2602
16
    }
2603
16
    cond = PyObject_SetAttrString(state->BinOp_type, "_field_types",
2604
16
                                  BinOp_annotations) == 0;
2605
16
    if (!cond) {
2606
0
        Py_DECREF(BinOp_annotations);
2607
0
        return 0;
2608
0
    }
2609
16
    cond = PyObject_SetAttrString(state->BinOp_type, "__annotations__",
2610
16
                                  BinOp_annotations) == 0;
2611
16
    if (!cond) {
2612
0
        Py_DECREF(BinOp_annotations);
2613
0
        return 0;
2614
0
    }
2615
16
    Py_DECREF(BinOp_annotations);
2616
16
    PyObject *UnaryOp_annotations = PyDict_New();
2617
16
    if (!UnaryOp_annotations) return 0;
2618
16
    {
2619
16
        PyObject *type = state->unaryop_type;
2620
16
        Py_INCREF(type);
2621
16
        cond = PyDict_SetItemString(UnaryOp_annotations, "op", type) == 0;
2622
16
        Py_DECREF(type);
2623
16
        if (!cond) {
2624
0
            Py_DECREF(UnaryOp_annotations);
2625
0
            return 0;
2626
0
        }
2627
16
    }
2628
16
    {
2629
16
        PyObject *type = state->expr_type;
2630
16
        Py_INCREF(type);
2631
16
        cond = PyDict_SetItemString(UnaryOp_annotations, "operand", type) == 0;
2632
16
        Py_DECREF(type);
2633
16
        if (!cond) {
2634
0
            Py_DECREF(UnaryOp_annotations);
2635
0
            return 0;
2636
0
        }
2637
16
    }
2638
16
    cond = PyObject_SetAttrString(state->UnaryOp_type, "_field_types",
2639
16
                                  UnaryOp_annotations) == 0;
2640
16
    if (!cond) {
2641
0
        Py_DECREF(UnaryOp_annotations);
2642
0
        return 0;
2643
0
    }
2644
16
    cond = PyObject_SetAttrString(state->UnaryOp_type, "__annotations__",
2645
16
                                  UnaryOp_annotations) == 0;
2646
16
    if (!cond) {
2647
0
        Py_DECREF(UnaryOp_annotations);
2648
0
        return 0;
2649
0
    }
2650
16
    Py_DECREF(UnaryOp_annotations);
2651
16
    PyObject *Lambda_annotations = PyDict_New();
2652
16
    if (!Lambda_annotations) return 0;
2653
16
    {
2654
16
        PyObject *type = state->arguments_type;
2655
16
        Py_INCREF(type);
2656
16
        cond = PyDict_SetItemString(Lambda_annotations, "args", type) == 0;
2657
16
        Py_DECREF(type);
2658
16
        if (!cond) {
2659
0
            Py_DECREF(Lambda_annotations);
2660
0
            return 0;
2661
0
        }
2662
16
    }
2663
16
    {
2664
16
        PyObject *type = state->expr_type;
2665
16
        Py_INCREF(type);
2666
16
        cond = PyDict_SetItemString(Lambda_annotations, "body", type) == 0;
2667
16
        Py_DECREF(type);
2668
16
        if (!cond) {
2669
0
            Py_DECREF(Lambda_annotations);
2670
0
            return 0;
2671
0
        }
2672
16
    }
2673
16
    cond = PyObject_SetAttrString(state->Lambda_type, "_field_types",
2674
16
                                  Lambda_annotations) == 0;
2675
16
    if (!cond) {
2676
0
        Py_DECREF(Lambda_annotations);
2677
0
        return 0;
2678
0
    }
2679
16
    cond = PyObject_SetAttrString(state->Lambda_type, "__annotations__",
2680
16
                                  Lambda_annotations) == 0;
2681
16
    if (!cond) {
2682
0
        Py_DECREF(Lambda_annotations);
2683
0
        return 0;
2684
0
    }
2685
16
    Py_DECREF(Lambda_annotations);
2686
16
    PyObject *IfExp_annotations = PyDict_New();
2687
16
    if (!IfExp_annotations) return 0;
2688
16
    {
2689
16
        PyObject *type = state->expr_type;
2690
16
        Py_INCREF(type);
2691
16
        cond = PyDict_SetItemString(IfExp_annotations, "test", type) == 0;
2692
16
        Py_DECREF(type);
2693
16
        if (!cond) {
2694
0
            Py_DECREF(IfExp_annotations);
2695
0
            return 0;
2696
0
        }
2697
16
    }
2698
16
    {
2699
16
        PyObject *type = state->expr_type;
2700
16
        Py_INCREF(type);
2701
16
        cond = PyDict_SetItemString(IfExp_annotations, "body", type) == 0;
2702
16
        Py_DECREF(type);
2703
16
        if (!cond) {
2704
0
            Py_DECREF(IfExp_annotations);
2705
0
            return 0;
2706
0
        }
2707
16
    }
2708
16
    {
2709
16
        PyObject *type = state->expr_type;
2710
16
        Py_INCREF(type);
2711
16
        cond = PyDict_SetItemString(IfExp_annotations, "orelse", type) == 0;
2712
16
        Py_DECREF(type);
2713
16
        if (!cond) {
2714
0
            Py_DECREF(IfExp_annotations);
2715
0
            return 0;
2716
0
        }
2717
16
    }
2718
16
    cond = PyObject_SetAttrString(state->IfExp_type, "_field_types",
2719
16
                                  IfExp_annotations) == 0;
2720
16
    if (!cond) {
2721
0
        Py_DECREF(IfExp_annotations);
2722
0
        return 0;
2723
0
    }
2724
16
    cond = PyObject_SetAttrString(state->IfExp_type, "__annotations__",
2725
16
                                  IfExp_annotations) == 0;
2726
16
    if (!cond) {
2727
0
        Py_DECREF(IfExp_annotations);
2728
0
        return 0;
2729
0
    }
2730
16
    Py_DECREF(IfExp_annotations);
2731
16
    PyObject *Dict_annotations = PyDict_New();
2732
16
    if (!Dict_annotations) return 0;
2733
16
    {
2734
16
        PyObject *type = state->expr_type;
2735
16
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
2736
16
        cond = type != NULL;
2737
16
        if (!cond) {
2738
0
            Py_DECREF(Dict_annotations);
2739
0
            return 0;
2740
0
        }
2741
16
        cond = PyDict_SetItemString(Dict_annotations, "keys", type) == 0;
2742
16
        Py_DECREF(type);
2743
16
        if (!cond) {
2744
0
            Py_DECREF(Dict_annotations);
2745
0
            return 0;
2746
0
        }
2747
16
    }
2748
16
    {
2749
16
        PyObject *type = state->expr_type;
2750
16
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
2751
16
        cond = type != NULL;
2752
16
        if (!cond) {
2753
0
            Py_DECREF(Dict_annotations);
2754
0
            return 0;
2755
0
        }
2756
16
        cond = PyDict_SetItemString(Dict_annotations, "values", type) == 0;
2757
16
        Py_DECREF(type);
2758
16
        if (!cond) {
2759
0
            Py_DECREF(Dict_annotations);
2760
0
            return 0;
2761
0
        }
2762
16
    }
2763
16
    cond = PyObject_SetAttrString(state->Dict_type, "_field_types",
2764
16
                                  Dict_annotations) == 0;
2765
16
    if (!cond) {
2766
0
        Py_DECREF(Dict_annotations);
2767
0
        return 0;
2768
0
    }
2769
16
    cond = PyObject_SetAttrString(state->Dict_type, "__annotations__",
2770
16
                                  Dict_annotations) == 0;
2771
16
    if (!cond) {
2772
0
        Py_DECREF(Dict_annotations);
2773
0
        return 0;
2774
0
    }
2775
16
    Py_DECREF(Dict_annotations);
2776
16
    PyObject *Set_annotations = PyDict_New();
2777
16
    if (!Set_annotations) return 0;
2778
16
    {
2779
16
        PyObject *type = state->expr_type;
2780
16
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
2781
16
        cond = type != NULL;
2782
16
        if (!cond) {
2783
0
            Py_DECREF(Set_annotations);
2784
0
            return 0;
2785
0
        }
2786
16
        cond = PyDict_SetItemString(Set_annotations, "elts", type) == 0;
2787
16
        Py_DECREF(type);
2788
16
        if (!cond) {
2789
0
            Py_DECREF(Set_annotations);
2790
0
            return 0;
2791
0
        }
2792
16
    }
2793
16
    cond = PyObject_SetAttrString(state->Set_type, "_field_types",
2794
16
                                  Set_annotations) == 0;
2795
16
    if (!cond) {
2796
0
        Py_DECREF(Set_annotations);
2797
0
        return 0;
2798
0
    }
2799
16
    cond = PyObject_SetAttrString(state->Set_type, "__annotations__",
2800
16
                                  Set_annotations) == 0;
2801
16
    if (!cond) {
2802
0
        Py_DECREF(Set_annotations);
2803
0
        return 0;
2804
0
    }
2805
16
    Py_DECREF(Set_annotations);
2806
16
    PyObject *ListComp_annotations = PyDict_New();
2807
16
    if (!ListComp_annotations) return 0;
2808
16
    {
2809
16
        PyObject *type = state->expr_type;
2810
16
        Py_INCREF(type);
2811
16
        cond = PyDict_SetItemString(ListComp_annotations, "elt", type) == 0;
2812
16
        Py_DECREF(type);
2813
16
        if (!cond) {
2814
0
            Py_DECREF(ListComp_annotations);
2815
0
            return 0;
2816
0
        }
2817
16
    }
2818
16
    {
2819
16
        PyObject *type = state->comprehension_type;
2820
16
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
2821
16
        cond = type != NULL;
2822
16
        if (!cond) {
2823
0
            Py_DECREF(ListComp_annotations);
2824
0
            return 0;
2825
0
        }
2826
16
        cond = PyDict_SetItemString(ListComp_annotations, "generators", type)
2827
16
                                    == 0;
2828
16
        Py_DECREF(type);
2829
16
        if (!cond) {
2830
0
            Py_DECREF(ListComp_annotations);
2831
0
            return 0;
2832
0
        }
2833
16
    }
2834
16
    cond = PyObject_SetAttrString(state->ListComp_type, "_field_types",
2835
16
                                  ListComp_annotations) == 0;
2836
16
    if (!cond) {
2837
0
        Py_DECREF(ListComp_annotations);
2838
0
        return 0;
2839
0
    }
2840
16
    cond = PyObject_SetAttrString(state->ListComp_type, "__annotations__",
2841
16
                                  ListComp_annotations) == 0;
2842
16
    if (!cond) {
2843
0
        Py_DECREF(ListComp_annotations);
2844
0
        return 0;
2845
0
    }
2846
16
    Py_DECREF(ListComp_annotations);
2847
16
    PyObject *SetComp_annotations = PyDict_New();
2848
16
    if (!SetComp_annotations) return 0;
2849
16
    {
2850
16
        PyObject *type = state->expr_type;
2851
16
        Py_INCREF(type);
2852
16
        cond = PyDict_SetItemString(SetComp_annotations, "elt", type) == 0;
2853
16
        Py_DECREF(type);
2854
16
        if (!cond) {
2855
0
            Py_DECREF(SetComp_annotations);
2856
0
            return 0;
2857
0
        }
2858
16
    }
2859
16
    {
2860
16
        PyObject *type = state->comprehension_type;
2861
16
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
2862
16
        cond = type != NULL;
2863
16
        if (!cond) {
2864
0
            Py_DECREF(SetComp_annotations);
2865
0
            return 0;
2866
0
        }
2867
16
        cond = PyDict_SetItemString(SetComp_annotations, "generators", type) ==
2868
16
                                    0;
2869
16
        Py_DECREF(type);
2870
16
        if (!cond) {
2871
0
            Py_DECREF(SetComp_annotations);
2872
0
            return 0;
2873
0
        }
2874
16
    }
2875
16
    cond = PyObject_SetAttrString(state->SetComp_type, "_field_types",
2876
16
                                  SetComp_annotations) == 0;
2877
16
    if (!cond) {
2878
0
        Py_DECREF(SetComp_annotations);
2879
0
        return 0;
2880
0
    }
2881
16
    cond = PyObject_SetAttrString(state->SetComp_type, "__annotations__",
2882
16
                                  SetComp_annotations) == 0;
2883
16
    if (!cond) {
2884
0
        Py_DECREF(SetComp_annotations);
2885
0
        return 0;
2886
0
    }
2887
16
    Py_DECREF(SetComp_annotations);
2888
16
    PyObject *DictComp_annotations = PyDict_New();
2889
16
    if (!DictComp_annotations) return 0;
2890
16
    {
2891
16
        PyObject *type = state->expr_type;
2892
16
        Py_INCREF(type);
2893
16
        cond = PyDict_SetItemString(DictComp_annotations, "key", type) == 0;
2894
16
        Py_DECREF(type);
2895
16
        if (!cond) {
2896
0
            Py_DECREF(DictComp_annotations);
2897
0
            return 0;
2898
0
        }
2899
16
    }
2900
16
    {
2901
16
        PyObject *type = state->expr_type;
2902
16
        type = _Py_union_type_or(type, Py_None);
2903
16
        cond = type != NULL;
2904
16
        if (!cond) {
2905
0
            Py_DECREF(DictComp_annotations);
2906
0
            return 0;
2907
0
        }
2908
16
        cond = PyDict_SetItemString(DictComp_annotations, "value", type) == 0;
2909
16
        Py_DECREF(type);
2910
16
        if (!cond) {
2911
0
            Py_DECREF(DictComp_annotations);
2912
0
            return 0;
2913
0
        }
2914
16
    }
2915
16
    {
2916
16
        PyObject *type = state->comprehension_type;
2917
16
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
2918
16
        cond = type != NULL;
2919
16
        if (!cond) {
2920
0
            Py_DECREF(DictComp_annotations);
2921
0
            return 0;
2922
0
        }
2923
16
        cond = PyDict_SetItemString(DictComp_annotations, "generators", type)
2924
16
                                    == 0;
2925
16
        Py_DECREF(type);
2926
16
        if (!cond) {
2927
0
            Py_DECREF(DictComp_annotations);
2928
0
            return 0;
2929
0
        }
2930
16
    }
2931
16
    cond = PyObject_SetAttrString(state->DictComp_type, "_field_types",
2932
16
                                  DictComp_annotations) == 0;
2933
16
    if (!cond) {
2934
0
        Py_DECREF(DictComp_annotations);
2935
0
        return 0;
2936
0
    }
2937
16
    cond = PyObject_SetAttrString(state->DictComp_type, "__annotations__",
2938
16
                                  DictComp_annotations) == 0;
2939
16
    if (!cond) {
2940
0
        Py_DECREF(DictComp_annotations);
2941
0
        return 0;
2942
0
    }
2943
16
    Py_DECREF(DictComp_annotations);
2944
16
    PyObject *GeneratorExp_annotations = PyDict_New();
2945
16
    if (!GeneratorExp_annotations) return 0;
2946
16
    {
2947
16
        PyObject *type = state->expr_type;
2948
16
        Py_INCREF(type);
2949
16
        cond = PyDict_SetItemString(GeneratorExp_annotations, "elt", type) == 0;
2950
16
        Py_DECREF(type);
2951
16
        if (!cond) {
2952
0
            Py_DECREF(GeneratorExp_annotations);
2953
0
            return 0;
2954
0
        }
2955
16
    }
2956
16
    {
2957
16
        PyObject *type = state->comprehension_type;
2958
16
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
2959
16
        cond = type != NULL;
2960
16
        if (!cond) {
2961
0
            Py_DECREF(GeneratorExp_annotations);
2962
0
            return 0;
2963
0
        }
2964
16
        cond = PyDict_SetItemString(GeneratorExp_annotations, "generators",
2965
16
                                    type) == 0;
2966
16
        Py_DECREF(type);
2967
16
        if (!cond) {
2968
0
            Py_DECREF(GeneratorExp_annotations);
2969
0
            return 0;
2970
0
        }
2971
16
    }
2972
16
    cond = PyObject_SetAttrString(state->GeneratorExp_type, "_field_types",
2973
16
                                  GeneratorExp_annotations) == 0;
2974
16
    if (!cond) {
2975
0
        Py_DECREF(GeneratorExp_annotations);
2976
0
        return 0;
2977
0
    }
2978
16
    cond = PyObject_SetAttrString(state->GeneratorExp_type, "__annotations__",
2979
16
                                  GeneratorExp_annotations) == 0;
2980
16
    if (!cond) {
2981
0
        Py_DECREF(GeneratorExp_annotations);
2982
0
        return 0;
2983
0
    }
2984
16
    Py_DECREF(GeneratorExp_annotations);
2985
16
    PyObject *Await_annotations = PyDict_New();
2986
16
    if (!Await_annotations) return 0;
2987
16
    {
2988
16
        PyObject *type = state->expr_type;
2989
16
        Py_INCREF(type);
2990
16
        cond = PyDict_SetItemString(Await_annotations, "value", type) == 0;
2991
16
        Py_DECREF(type);
2992
16
        if (!cond) {
2993
0
            Py_DECREF(Await_annotations);
2994
0
            return 0;
2995
0
        }
2996
16
    }
2997
16
    cond = PyObject_SetAttrString(state->Await_type, "_field_types",
2998
16
                                  Await_annotations) == 0;
2999
16
    if (!cond) {
3000
0
        Py_DECREF(Await_annotations);
3001
0
        return 0;
3002
0
    }
3003
16
    cond = PyObject_SetAttrString(state->Await_type, "__annotations__",
3004
16
                                  Await_annotations) == 0;
3005
16
    if (!cond) {
3006
0
        Py_DECREF(Await_annotations);
3007
0
        return 0;
3008
0
    }
3009
16
    Py_DECREF(Await_annotations);
3010
16
    PyObject *Yield_annotations = PyDict_New();
3011
16
    if (!Yield_annotations) return 0;
3012
16
    {
3013
16
        PyObject *type = state->expr_type;
3014
16
        type = _Py_union_type_or(type, Py_None);
3015
16
        cond = type != NULL;
3016
16
        if (!cond) {
3017
0
            Py_DECREF(Yield_annotations);
3018
0
            return 0;
3019
0
        }
3020
16
        cond = PyDict_SetItemString(Yield_annotations, "value", type) == 0;
3021
16
        Py_DECREF(type);
3022
16
        if (!cond) {
3023
0
            Py_DECREF(Yield_annotations);
3024
0
            return 0;
3025
0
        }
3026
16
    }
3027
16
    cond = PyObject_SetAttrString(state->Yield_type, "_field_types",
3028
16
                                  Yield_annotations) == 0;
3029
16
    if (!cond) {
3030
0
        Py_DECREF(Yield_annotations);
3031
0
        return 0;
3032
0
    }
3033
16
    cond = PyObject_SetAttrString(state->Yield_type, "__annotations__",
3034
16
                                  Yield_annotations) == 0;
3035
16
    if (!cond) {
3036
0
        Py_DECREF(Yield_annotations);
3037
0
        return 0;
3038
0
    }
3039
16
    Py_DECREF(Yield_annotations);
3040
16
    PyObject *YieldFrom_annotations = PyDict_New();
3041
16
    if (!YieldFrom_annotations) return 0;
3042
16
    {
3043
16
        PyObject *type = state->expr_type;
3044
16
        Py_INCREF(type);
3045
16
        cond = PyDict_SetItemString(YieldFrom_annotations, "value", type) == 0;
3046
16
        Py_DECREF(type);
3047
16
        if (!cond) {
3048
0
            Py_DECREF(YieldFrom_annotations);
3049
0
            return 0;
3050
0
        }
3051
16
    }
3052
16
    cond = PyObject_SetAttrString(state->YieldFrom_type, "_field_types",
3053
16
                                  YieldFrom_annotations) == 0;
3054
16
    if (!cond) {
3055
0
        Py_DECREF(YieldFrom_annotations);
3056
0
        return 0;
3057
0
    }
3058
16
    cond = PyObject_SetAttrString(state->YieldFrom_type, "__annotations__",
3059
16
                                  YieldFrom_annotations) == 0;
3060
16
    if (!cond) {
3061
0
        Py_DECREF(YieldFrom_annotations);
3062
0
        return 0;
3063
0
    }
3064
16
    Py_DECREF(YieldFrom_annotations);
3065
16
    PyObject *Compare_annotations = PyDict_New();
3066
16
    if (!Compare_annotations) return 0;
3067
16
    {
3068
16
        PyObject *type = state->expr_type;
3069
16
        Py_INCREF(type);
3070
16
        cond = PyDict_SetItemString(Compare_annotations, "left", type) == 0;
3071
16
        Py_DECREF(type);
3072
16
        if (!cond) {
3073
0
            Py_DECREF(Compare_annotations);
3074
0
            return 0;
3075
0
        }
3076
16
    }
3077
16
    {
3078
16
        PyObject *type = state->cmpop_type;
3079
16
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
3080
16
        cond = type != NULL;
3081
16
        if (!cond) {
3082
0
            Py_DECREF(Compare_annotations);
3083
0
            return 0;
3084
0
        }
3085
16
        cond = PyDict_SetItemString(Compare_annotations, "ops", type) == 0;
3086
16
        Py_DECREF(type);
3087
16
        if (!cond) {
3088
0
            Py_DECREF(Compare_annotations);
3089
0
            return 0;
3090
0
        }
3091
16
    }
3092
16
    {
3093
16
        PyObject *type = state->expr_type;
3094
16
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
3095
16
        cond = type != NULL;
3096
16
        if (!cond) {
3097
0
            Py_DECREF(Compare_annotations);
3098
0
            return 0;
3099
0
        }
3100
16
        cond = PyDict_SetItemString(Compare_annotations, "comparators", type)
3101
16
                                    == 0;
3102
16
        Py_DECREF(type);
3103
16
        if (!cond) {
3104
0
            Py_DECREF(Compare_annotations);
3105
0
            return 0;
3106
0
        }
3107
16
    }
3108
16
    cond = PyObject_SetAttrString(state->Compare_type, "_field_types",
3109
16
                                  Compare_annotations) == 0;
3110
16
    if (!cond) {
3111
0
        Py_DECREF(Compare_annotations);
3112
0
        return 0;
3113
0
    }
3114
16
    cond = PyObject_SetAttrString(state->Compare_type, "__annotations__",
3115
16
                                  Compare_annotations) == 0;
3116
16
    if (!cond) {
3117
0
        Py_DECREF(Compare_annotations);
3118
0
        return 0;
3119
0
    }
3120
16
    Py_DECREF(Compare_annotations);
3121
16
    PyObject *Call_annotations = PyDict_New();
3122
16
    if (!Call_annotations) return 0;
3123
16
    {
3124
16
        PyObject *type = state->expr_type;
3125
16
        Py_INCREF(type);
3126
16
        cond = PyDict_SetItemString(Call_annotations, "func", type) == 0;
3127
16
        Py_DECREF(type);
3128
16
        if (!cond) {
3129
0
            Py_DECREF(Call_annotations);
3130
0
            return 0;
3131
0
        }
3132
16
    }
3133
16
    {
3134
16
        PyObject *type = state->expr_type;
3135
16
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
3136
16
        cond = type != NULL;
3137
16
        if (!cond) {
3138
0
            Py_DECREF(Call_annotations);
3139
0
            return 0;
3140
0
        }
3141
16
        cond = PyDict_SetItemString(Call_annotations, "args", type) == 0;
3142
16
        Py_DECREF(type);
3143
16
        if (!cond) {
3144
0
            Py_DECREF(Call_annotations);
3145
0
            return 0;
3146
0
        }
3147
16
    }
3148
16
    {
3149
16
        PyObject *type = state->keyword_type;
3150
16
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
3151
16
        cond = type != NULL;
3152
16
        if (!cond) {
3153
0
            Py_DECREF(Call_annotations);
3154
0
            return 0;
3155
0
        }
3156
16
        cond = PyDict_SetItemString(Call_annotations, "keywords", type) == 0;
3157
16
        Py_DECREF(type);
3158
16
        if (!cond) {
3159
0
            Py_DECREF(Call_annotations);
3160
0
            return 0;
3161
0
        }
3162
16
    }
3163
16
    cond = PyObject_SetAttrString(state->Call_type, "_field_types",
3164
16
                                  Call_annotations) == 0;
3165
16
    if (!cond) {
3166
0
        Py_DECREF(Call_annotations);
3167
0
        return 0;
3168
0
    }
3169
16
    cond = PyObject_SetAttrString(state->Call_type, "__annotations__",
3170
16
                                  Call_annotations) == 0;
3171
16
    if (!cond) {
3172
0
        Py_DECREF(Call_annotations);
3173
0
        return 0;
3174
0
    }
3175
16
    Py_DECREF(Call_annotations);
3176
16
    PyObject *FormattedValue_annotations = PyDict_New();
3177
16
    if (!FormattedValue_annotations) return 0;
3178
16
    {
3179
16
        PyObject *type = state->expr_type;
3180
16
        Py_INCREF(type);
3181
16
        cond = PyDict_SetItemString(FormattedValue_annotations, "value", type)
3182
16
                                    == 0;
3183
16
        Py_DECREF(type);
3184
16
        if (!cond) {
3185
0
            Py_DECREF(FormattedValue_annotations);
3186
0
            return 0;
3187
0
        }
3188
16
    }
3189
16
    {
3190
16
        PyObject *type = (PyObject *)&PyLong_Type;
3191
16
        Py_INCREF(type);
3192
16
        cond = PyDict_SetItemString(FormattedValue_annotations, "conversion",
3193
16
                                    type) == 0;
3194
16
        Py_DECREF(type);
3195
16
        if (!cond) {
3196
0
            Py_DECREF(FormattedValue_annotations);
3197
0
            return 0;
3198
0
        }
3199
16
    }
3200
16
    {
3201
16
        PyObject *type = state->expr_type;
3202
16
        type = _Py_union_type_or(type, Py_None);
3203
16
        cond = type != NULL;
3204
16
        if (!cond) {
3205
0
            Py_DECREF(FormattedValue_annotations);
3206
0
            return 0;
3207
0
        }
3208
16
        cond = PyDict_SetItemString(FormattedValue_annotations, "format_spec",
3209
16
                                    type) == 0;
3210
16
        Py_DECREF(type);
3211
16
        if (!cond) {
3212
0
            Py_DECREF(FormattedValue_annotations);
3213
0
            return 0;
3214
0
        }
3215
16
    }
3216
16
    cond = PyObject_SetAttrString(state->FormattedValue_type, "_field_types",
3217
16
                                  FormattedValue_annotations) == 0;
3218
16
    if (!cond) {
3219
0
        Py_DECREF(FormattedValue_annotations);
3220
0
        return 0;
3221
0
    }
3222
16
    cond = PyObject_SetAttrString(state->FormattedValue_type,
3223
16
                                  "__annotations__",
3224
16
                                  FormattedValue_annotations) == 0;
3225
16
    if (!cond) {
3226
0
        Py_DECREF(FormattedValue_annotations);
3227
0
        return 0;
3228
0
    }
3229
16
    Py_DECREF(FormattedValue_annotations);
3230
16
    PyObject *Interpolation_annotations = PyDict_New();
3231
16
    if (!Interpolation_annotations) return 0;
3232
16
    {
3233
16
        PyObject *type = state->expr_type;
3234
16
        Py_INCREF(type);
3235
16
        cond = PyDict_SetItemString(Interpolation_annotations, "value", type)
3236
16
                                    == 0;
3237
16
        Py_DECREF(type);
3238
16
        if (!cond) {
3239
0
            Py_DECREF(Interpolation_annotations);
3240
0
            return 0;
3241
0
        }
3242
16
    }
3243
16
    {
3244
16
        PyObject *type = (PyObject *)&PyBaseObject_Type;
3245
16
        Py_INCREF(type);
3246
16
        cond = PyDict_SetItemString(Interpolation_annotations, "str", type) ==
3247
16
                                    0;
3248
16
        Py_DECREF(type);
3249
16
        if (!cond) {
3250
0
            Py_DECREF(Interpolation_annotations);
3251
0
            return 0;
3252
0
        }
3253
16
    }
3254
16
    {
3255
16
        PyObject *type = (PyObject *)&PyLong_Type;
3256
16
        Py_INCREF(type);
3257
16
        cond = PyDict_SetItemString(Interpolation_annotations, "conversion",
3258
16
                                    type) == 0;
3259
16
        Py_DECREF(type);
3260
16
        if (!cond) {
3261
0
            Py_DECREF(Interpolation_annotations);
3262
0
            return 0;
3263
0
        }
3264
16
    }
3265
16
    {
3266
16
        PyObject *type = state->expr_type;
3267
16
        type = _Py_union_type_or(type, Py_None);
3268
16
        cond = type != NULL;
3269
16
        if (!cond) {
3270
0
            Py_DECREF(Interpolation_annotations);
3271
0
            return 0;
3272
0
        }
3273
16
        cond = PyDict_SetItemString(Interpolation_annotations, "format_spec",
3274
16
                                    type) == 0;
3275
16
        Py_DECREF(type);
3276
16
        if (!cond) {
3277
0
            Py_DECREF(Interpolation_annotations);
3278
0
            return 0;
3279
0
        }
3280
16
    }
3281
16
    cond = PyObject_SetAttrString(state->Interpolation_type, "_field_types",
3282
16
                                  Interpolation_annotations) == 0;
3283
16
    if (!cond) {
3284
0
        Py_DECREF(Interpolation_annotations);
3285
0
        return 0;
3286
0
    }
3287
16
    cond = PyObject_SetAttrString(state->Interpolation_type, "__annotations__",
3288
16
                                  Interpolation_annotations) == 0;
3289
16
    if (!cond) {
3290
0
        Py_DECREF(Interpolation_annotations);
3291
0
        return 0;
3292
0
    }
3293
16
    Py_DECREF(Interpolation_annotations);
3294
16
    PyObject *JoinedStr_annotations = PyDict_New();
3295
16
    if (!JoinedStr_annotations) return 0;
3296
16
    {
3297
16
        PyObject *type = state->expr_type;
3298
16
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
3299
16
        cond = type != NULL;
3300
16
        if (!cond) {
3301
0
            Py_DECREF(JoinedStr_annotations);
3302
0
            return 0;
3303
0
        }
3304
16
        cond = PyDict_SetItemString(JoinedStr_annotations, "values", type) == 0;
3305
16
        Py_DECREF(type);
3306
16
        if (!cond) {
3307
0
            Py_DECREF(JoinedStr_annotations);
3308
0
            return 0;
3309
0
        }
3310
16
    }
3311
16
    cond = PyObject_SetAttrString(state->JoinedStr_type, "_field_types",
3312
16
                                  JoinedStr_annotations) == 0;
3313
16
    if (!cond) {
3314
0
        Py_DECREF(JoinedStr_annotations);
3315
0
        return 0;
3316
0
    }
3317
16
    cond = PyObject_SetAttrString(state->JoinedStr_type, "__annotations__",
3318
16
                                  JoinedStr_annotations) == 0;
3319
16
    if (!cond) {
3320
0
        Py_DECREF(JoinedStr_annotations);
3321
0
        return 0;
3322
0
    }
3323
16
    Py_DECREF(JoinedStr_annotations);
3324
16
    PyObject *TemplateStr_annotations = PyDict_New();
3325
16
    if (!TemplateStr_annotations) return 0;
3326
16
    {
3327
16
        PyObject *type = state->expr_type;
3328
16
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
3329
16
        cond = type != NULL;
3330
16
        if (!cond) {
3331
0
            Py_DECREF(TemplateStr_annotations);
3332
0
            return 0;
3333
0
        }
3334
16
        cond = PyDict_SetItemString(TemplateStr_annotations, "values", type) ==
3335
16
                                    0;
3336
16
        Py_DECREF(type);
3337
16
        if (!cond) {
3338
0
            Py_DECREF(TemplateStr_annotations);
3339
0
            return 0;
3340
0
        }
3341
16
    }
3342
16
    cond = PyObject_SetAttrString(state->TemplateStr_type, "_field_types",
3343
16
                                  TemplateStr_annotations) == 0;
3344
16
    if (!cond) {
3345
0
        Py_DECREF(TemplateStr_annotations);
3346
0
        return 0;
3347
0
    }
3348
16
    cond = PyObject_SetAttrString(state->TemplateStr_type, "__annotations__",
3349
16
                                  TemplateStr_annotations) == 0;
3350
16
    if (!cond) {
3351
0
        Py_DECREF(TemplateStr_annotations);
3352
0
        return 0;
3353
0
    }
3354
16
    Py_DECREF(TemplateStr_annotations);
3355
16
    PyObject *Constant_annotations = PyDict_New();
3356
16
    if (!Constant_annotations) return 0;
3357
16
    {
3358
16
        PyObject *type = (PyObject *)&PyBaseObject_Type;
3359
16
        Py_INCREF(type);
3360
16
        cond = PyDict_SetItemString(Constant_annotations, "value", type) == 0;
3361
16
        Py_DECREF(type);
3362
16
        if (!cond) {
3363
0
            Py_DECREF(Constant_annotations);
3364
0
            return 0;
3365
0
        }
3366
16
    }
3367
16
    {
3368
16
        PyObject *type = (PyObject *)&PyUnicode_Type;
3369
16
        type = _Py_union_type_or(type, Py_None);
3370
16
        cond = type != NULL;
3371
16
        if (!cond) {
3372
0
            Py_DECREF(Constant_annotations);
3373
0
            return 0;
3374
0
        }
3375
16
        cond = PyDict_SetItemString(Constant_annotations, "kind", type) == 0;
3376
16
        Py_DECREF(type);
3377
16
        if (!cond) {
3378
0
            Py_DECREF(Constant_annotations);
3379
0
            return 0;
3380
0
        }
3381
16
    }
3382
16
    cond = PyObject_SetAttrString(state->Constant_type, "_field_types",
3383
16
                                  Constant_annotations) == 0;
3384
16
    if (!cond) {
3385
0
        Py_DECREF(Constant_annotations);
3386
0
        return 0;
3387
0
    }
3388
16
    cond = PyObject_SetAttrString(state->Constant_type, "__annotations__",
3389
16
                                  Constant_annotations) == 0;
3390
16
    if (!cond) {
3391
0
        Py_DECREF(Constant_annotations);
3392
0
        return 0;
3393
0
    }
3394
16
    Py_DECREF(Constant_annotations);
3395
16
    PyObject *Attribute_annotations = PyDict_New();
3396
16
    if (!Attribute_annotations) return 0;
3397
16
    {
3398
16
        PyObject *type = state->expr_type;
3399
16
        Py_INCREF(type);
3400
16
        cond = PyDict_SetItemString(Attribute_annotations, "value", type) == 0;
3401
16
        Py_DECREF(type);
3402
16
        if (!cond) {
3403
0
            Py_DECREF(Attribute_annotations);
3404
0
            return 0;
3405
0
        }
3406
16
    }
3407
16
    {
3408
16
        PyObject *type = (PyObject *)&PyUnicode_Type;
3409
16
        Py_INCREF(type);
3410
16
        cond = PyDict_SetItemString(Attribute_annotations, "attr", type) == 0;
3411
16
        Py_DECREF(type);
3412
16
        if (!cond) {
3413
0
            Py_DECREF(Attribute_annotations);
3414
0
            return 0;
3415
0
        }
3416
16
    }
3417
16
    {
3418
16
        PyObject *type = state->expr_context_type;
3419
16
        Py_INCREF(type);
3420
16
        cond = PyDict_SetItemString(Attribute_annotations, "ctx", type) == 0;
3421
16
        Py_DECREF(type);
3422
16
        if (!cond) {
3423
0
            Py_DECREF(Attribute_annotations);
3424
0
            return 0;
3425
0
        }
3426
16
    }
3427
16
    cond = PyObject_SetAttrString(state->Attribute_type, "_field_types",
3428
16
                                  Attribute_annotations) == 0;
3429
16
    if (!cond) {
3430
0
        Py_DECREF(Attribute_annotations);
3431
0
        return 0;
3432
0
    }
3433
16
    cond = PyObject_SetAttrString(state->Attribute_type, "__annotations__",
3434
16
                                  Attribute_annotations) == 0;
3435
16
    if (!cond) {
3436
0
        Py_DECREF(Attribute_annotations);
3437
0
        return 0;
3438
0
    }
3439
16
    Py_DECREF(Attribute_annotations);
3440
16
    PyObject *Subscript_annotations = PyDict_New();
3441
16
    if (!Subscript_annotations) return 0;
3442
16
    {
3443
16
        PyObject *type = state->expr_type;
3444
16
        Py_INCREF(type);
3445
16
        cond = PyDict_SetItemString(Subscript_annotations, "value", type) == 0;
3446
16
        Py_DECREF(type);
3447
16
        if (!cond) {
3448
0
            Py_DECREF(Subscript_annotations);
3449
0
            return 0;
3450
0
        }
3451
16
    }
3452
16
    {
3453
16
        PyObject *type = state->expr_type;
3454
16
        Py_INCREF(type);
3455
16
        cond = PyDict_SetItemString(Subscript_annotations, "slice", type) == 0;
3456
16
        Py_DECREF(type);
3457
16
        if (!cond) {
3458
0
            Py_DECREF(Subscript_annotations);
3459
0
            return 0;
3460
0
        }
3461
16
    }
3462
16
    {
3463
16
        PyObject *type = state->expr_context_type;
3464
16
        Py_INCREF(type);
3465
16
        cond = PyDict_SetItemString(Subscript_annotations, "ctx", type) == 0;
3466
16
        Py_DECREF(type);
3467
16
        if (!cond) {
3468
0
            Py_DECREF(Subscript_annotations);
3469
0
            return 0;
3470
0
        }
3471
16
    }
3472
16
    cond = PyObject_SetAttrString(state->Subscript_type, "_field_types",
3473
16
                                  Subscript_annotations) == 0;
3474
16
    if (!cond) {
3475
0
        Py_DECREF(Subscript_annotations);
3476
0
        return 0;
3477
0
    }
3478
16
    cond = PyObject_SetAttrString(state->Subscript_type, "__annotations__",
3479
16
                                  Subscript_annotations) == 0;
3480
16
    if (!cond) {
3481
0
        Py_DECREF(Subscript_annotations);
3482
0
        return 0;
3483
0
    }
3484
16
    Py_DECREF(Subscript_annotations);
3485
16
    PyObject *Starred_annotations = PyDict_New();
3486
16
    if (!Starred_annotations) return 0;
3487
16
    {
3488
16
        PyObject *type = state->expr_type;
3489
16
        Py_INCREF(type);
3490
16
        cond = PyDict_SetItemString(Starred_annotations, "value", type) == 0;
3491
16
        Py_DECREF(type);
3492
16
        if (!cond) {
3493
0
            Py_DECREF(Starred_annotations);
3494
0
            return 0;
3495
0
        }
3496
16
    }
3497
16
    {
3498
16
        PyObject *type = state->expr_context_type;
3499
16
        Py_INCREF(type);
3500
16
        cond = PyDict_SetItemString(Starred_annotations, "ctx", type) == 0;
3501
16
        Py_DECREF(type);
3502
16
        if (!cond) {
3503
0
            Py_DECREF(Starred_annotations);
3504
0
            return 0;
3505
0
        }
3506
16
    }
3507
16
    cond = PyObject_SetAttrString(state->Starred_type, "_field_types",
3508
16
                                  Starred_annotations) == 0;
3509
16
    if (!cond) {
3510
0
        Py_DECREF(Starred_annotations);
3511
0
        return 0;
3512
0
    }
3513
16
    cond = PyObject_SetAttrString(state->Starred_type, "__annotations__",
3514
16
                                  Starred_annotations) == 0;
3515
16
    if (!cond) {
3516
0
        Py_DECREF(Starred_annotations);
3517
0
        return 0;
3518
0
    }
3519
16
    Py_DECREF(Starred_annotations);
3520
16
    PyObject *Name_annotations = PyDict_New();
3521
16
    if (!Name_annotations) return 0;
3522
16
    {
3523
16
        PyObject *type = (PyObject *)&PyUnicode_Type;
3524
16
        Py_INCREF(type);
3525
16
        cond = PyDict_SetItemString(Name_annotations, "id", type) == 0;
3526
16
        Py_DECREF(type);
3527
16
        if (!cond) {
3528
0
            Py_DECREF(Name_annotations);
3529
0
            return 0;
3530
0
        }
3531
16
    }
3532
16
    {
3533
16
        PyObject *type = state->expr_context_type;
3534
16
        Py_INCREF(type);
3535
16
        cond = PyDict_SetItemString(Name_annotations, "ctx", type) == 0;
3536
16
        Py_DECREF(type);
3537
16
        if (!cond) {
3538
0
            Py_DECREF(Name_annotations);
3539
0
            return 0;
3540
0
        }
3541
16
    }
3542
16
    cond = PyObject_SetAttrString(state->Name_type, "_field_types",
3543
16
                                  Name_annotations) == 0;
3544
16
    if (!cond) {
3545
0
        Py_DECREF(Name_annotations);
3546
0
        return 0;
3547
0
    }
3548
16
    cond = PyObject_SetAttrString(state->Name_type, "__annotations__",
3549
16
                                  Name_annotations) == 0;
3550
16
    if (!cond) {
3551
0
        Py_DECREF(Name_annotations);
3552
0
        return 0;
3553
0
    }
3554
16
    Py_DECREF(Name_annotations);
3555
16
    PyObject *List_annotations = PyDict_New();
3556
16
    if (!List_annotations) return 0;
3557
16
    {
3558
16
        PyObject *type = state->expr_type;
3559
16
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
3560
16
        cond = type != NULL;
3561
16
        if (!cond) {
3562
0
            Py_DECREF(List_annotations);
3563
0
            return 0;
3564
0
        }
3565
16
        cond = PyDict_SetItemString(List_annotations, "elts", type) == 0;
3566
16
        Py_DECREF(type);
3567
16
        if (!cond) {
3568
0
            Py_DECREF(List_annotations);
3569
0
            return 0;
3570
0
        }
3571
16
    }
3572
16
    {
3573
16
        PyObject *type = state->expr_context_type;
3574
16
        Py_INCREF(type);
3575
16
        cond = PyDict_SetItemString(List_annotations, "ctx", type) == 0;
3576
16
        Py_DECREF(type);
3577
16
        if (!cond) {
3578
0
            Py_DECREF(List_annotations);
3579
0
            return 0;
3580
0
        }
3581
16
    }
3582
16
    cond = PyObject_SetAttrString(state->List_type, "_field_types",
3583
16
                                  List_annotations) == 0;
3584
16
    if (!cond) {
3585
0
        Py_DECREF(List_annotations);
3586
0
        return 0;
3587
0
    }
3588
16
    cond = PyObject_SetAttrString(state->List_type, "__annotations__",
3589
16
                                  List_annotations) == 0;
3590
16
    if (!cond) {
3591
0
        Py_DECREF(List_annotations);
3592
0
        return 0;
3593
0
    }
3594
16
    Py_DECREF(List_annotations);
3595
16
    PyObject *Tuple_annotations = PyDict_New();
3596
16
    if (!Tuple_annotations) return 0;
3597
16
    {
3598
16
        PyObject *type = state->expr_type;
3599
16
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
3600
16
        cond = type != NULL;
3601
16
        if (!cond) {
3602
0
            Py_DECREF(Tuple_annotations);
3603
0
            return 0;
3604
0
        }
3605
16
        cond = PyDict_SetItemString(Tuple_annotations, "elts", type) == 0;
3606
16
        Py_DECREF(type);
3607
16
        if (!cond) {
3608
0
            Py_DECREF(Tuple_annotations);
3609
0
            return 0;
3610
0
        }
3611
16
    }
3612
16
    {
3613
16
        PyObject *type = state->expr_context_type;
3614
16
        Py_INCREF(type);
3615
16
        cond = PyDict_SetItemString(Tuple_annotations, "ctx", type) == 0;
3616
16
        Py_DECREF(type);
3617
16
        if (!cond) {
3618
0
            Py_DECREF(Tuple_annotations);
3619
0
            return 0;
3620
0
        }
3621
16
    }
3622
16
    cond = PyObject_SetAttrString(state->Tuple_type, "_field_types",
3623
16
                                  Tuple_annotations) == 0;
3624
16
    if (!cond) {
3625
0
        Py_DECREF(Tuple_annotations);
3626
0
        return 0;
3627
0
    }
3628
16
    cond = PyObject_SetAttrString(state->Tuple_type, "__annotations__",
3629
16
                                  Tuple_annotations) == 0;
3630
16
    if (!cond) {
3631
0
        Py_DECREF(Tuple_annotations);
3632
0
        return 0;
3633
0
    }
3634
16
    Py_DECREF(Tuple_annotations);
3635
16
    PyObject *Slice_annotations = PyDict_New();
3636
16
    if (!Slice_annotations) return 0;
3637
16
    {
3638
16
        PyObject *type = state->expr_type;
3639
16
        type = _Py_union_type_or(type, Py_None);
3640
16
        cond = type != NULL;
3641
16
        if (!cond) {
3642
0
            Py_DECREF(Slice_annotations);
3643
0
            return 0;
3644
0
        }
3645
16
        cond = PyDict_SetItemString(Slice_annotations, "lower", type) == 0;
3646
16
        Py_DECREF(type);
3647
16
        if (!cond) {
3648
0
            Py_DECREF(Slice_annotations);
3649
0
            return 0;
3650
0
        }
3651
16
    }
3652
16
    {
3653
16
        PyObject *type = state->expr_type;
3654
16
        type = _Py_union_type_or(type, Py_None);
3655
16
        cond = type != NULL;
3656
16
        if (!cond) {
3657
0
            Py_DECREF(Slice_annotations);
3658
0
            return 0;
3659
0
        }
3660
16
        cond = PyDict_SetItemString(Slice_annotations, "upper", type) == 0;
3661
16
        Py_DECREF(type);
3662
16
        if (!cond) {
3663
0
            Py_DECREF(Slice_annotations);
3664
0
            return 0;
3665
0
        }
3666
16
    }
3667
16
    {
3668
16
        PyObject *type = state->expr_type;
3669
16
        type = _Py_union_type_or(type, Py_None);
3670
16
        cond = type != NULL;
3671
16
        if (!cond) {
3672
0
            Py_DECREF(Slice_annotations);
3673
0
            return 0;
3674
0
        }
3675
16
        cond = PyDict_SetItemString(Slice_annotations, "step", type) == 0;
3676
16
        Py_DECREF(type);
3677
16
        if (!cond) {
3678
0
            Py_DECREF(Slice_annotations);
3679
0
            return 0;
3680
0
        }
3681
16
    }
3682
16
    cond = PyObject_SetAttrString(state->Slice_type, "_field_types",
3683
16
                                  Slice_annotations) == 0;
3684
16
    if (!cond) {
3685
0
        Py_DECREF(Slice_annotations);
3686
0
        return 0;
3687
0
    }
3688
16
    cond = PyObject_SetAttrString(state->Slice_type, "__annotations__",
3689
16
                                  Slice_annotations) == 0;
3690
16
    if (!cond) {
3691
0
        Py_DECREF(Slice_annotations);
3692
0
        return 0;
3693
0
    }
3694
16
    Py_DECREF(Slice_annotations);
3695
16
    PyObject *Load_annotations = PyDict_New();
3696
16
    if (!Load_annotations) return 0;
3697
16
    cond = PyObject_SetAttrString(state->Load_type, "_field_types",
3698
16
                                  Load_annotations) == 0;
3699
16
    if (!cond) {
3700
0
        Py_DECREF(Load_annotations);
3701
0
        return 0;
3702
0
    }
3703
16
    cond = PyObject_SetAttrString(state->Load_type, "__annotations__",
3704
16
                                  Load_annotations) == 0;
3705
16
    if (!cond) {
3706
0
        Py_DECREF(Load_annotations);
3707
0
        return 0;
3708
0
    }
3709
16
    Py_DECREF(Load_annotations);
3710
16
    PyObject *Store_annotations = PyDict_New();
3711
16
    if (!Store_annotations) return 0;
3712
16
    cond = PyObject_SetAttrString(state->Store_type, "_field_types",
3713
16
                                  Store_annotations) == 0;
3714
16
    if (!cond) {
3715
0
        Py_DECREF(Store_annotations);
3716
0
        return 0;
3717
0
    }
3718
16
    cond = PyObject_SetAttrString(state->Store_type, "__annotations__",
3719
16
                                  Store_annotations) == 0;
3720
16
    if (!cond) {
3721
0
        Py_DECREF(Store_annotations);
3722
0
        return 0;
3723
0
    }
3724
16
    Py_DECREF(Store_annotations);
3725
16
    PyObject *Del_annotations = PyDict_New();
3726
16
    if (!Del_annotations) return 0;
3727
16
    cond = PyObject_SetAttrString(state->Del_type, "_field_types",
3728
16
                                  Del_annotations) == 0;
3729
16
    if (!cond) {
3730
0
        Py_DECREF(Del_annotations);
3731
0
        return 0;
3732
0
    }
3733
16
    cond = PyObject_SetAttrString(state->Del_type, "__annotations__",
3734
16
                                  Del_annotations) == 0;
3735
16
    if (!cond) {
3736
0
        Py_DECREF(Del_annotations);
3737
0
        return 0;
3738
0
    }
3739
16
    Py_DECREF(Del_annotations);
3740
16
    PyObject *And_annotations = PyDict_New();
3741
16
    if (!And_annotations) return 0;
3742
16
    cond = PyObject_SetAttrString(state->And_type, "_field_types",
3743
16
                                  And_annotations) == 0;
3744
16
    if (!cond) {
3745
0
        Py_DECREF(And_annotations);
3746
0
        return 0;
3747
0
    }
3748
16
    cond = PyObject_SetAttrString(state->And_type, "__annotations__",
3749
16
                                  And_annotations) == 0;
3750
16
    if (!cond) {
3751
0
        Py_DECREF(And_annotations);
3752
0
        return 0;
3753
0
    }
3754
16
    Py_DECREF(And_annotations);
3755
16
    PyObject *Or_annotations = PyDict_New();
3756
16
    if (!Or_annotations) return 0;
3757
16
    cond = PyObject_SetAttrString(state->Or_type, "_field_types",
3758
16
                                  Or_annotations) == 0;
3759
16
    if (!cond) {
3760
0
        Py_DECREF(Or_annotations);
3761
0
        return 0;
3762
0
    }
3763
16
    cond = PyObject_SetAttrString(state->Or_type, "__annotations__",
3764
16
                                  Or_annotations) == 0;
3765
16
    if (!cond) {
3766
0
        Py_DECREF(Or_annotations);
3767
0
        return 0;
3768
0
    }
3769
16
    Py_DECREF(Or_annotations);
3770
16
    PyObject *Add_annotations = PyDict_New();
3771
16
    if (!Add_annotations) return 0;
3772
16
    cond = PyObject_SetAttrString(state->Add_type, "_field_types",
3773
16
                                  Add_annotations) == 0;
3774
16
    if (!cond) {
3775
0
        Py_DECREF(Add_annotations);
3776
0
        return 0;
3777
0
    }
3778
16
    cond = PyObject_SetAttrString(state->Add_type, "__annotations__",
3779
16
                                  Add_annotations) == 0;
3780
16
    if (!cond) {
3781
0
        Py_DECREF(Add_annotations);
3782
0
        return 0;
3783
0
    }
3784
16
    Py_DECREF(Add_annotations);
3785
16
    PyObject *Sub_annotations = PyDict_New();
3786
16
    if (!Sub_annotations) return 0;
3787
16
    cond = PyObject_SetAttrString(state->Sub_type, "_field_types",
3788
16
                                  Sub_annotations) == 0;
3789
16
    if (!cond) {
3790
0
        Py_DECREF(Sub_annotations);
3791
0
        return 0;
3792
0
    }
3793
16
    cond = PyObject_SetAttrString(state->Sub_type, "__annotations__",
3794
16
                                  Sub_annotations) == 0;
3795
16
    if (!cond) {
3796
0
        Py_DECREF(Sub_annotations);
3797
0
        return 0;
3798
0
    }
3799
16
    Py_DECREF(Sub_annotations);
3800
16
    PyObject *Mult_annotations = PyDict_New();
3801
16
    if (!Mult_annotations) return 0;
3802
16
    cond = PyObject_SetAttrString(state->Mult_type, "_field_types",
3803
16
                                  Mult_annotations) == 0;
3804
16
    if (!cond) {
3805
0
        Py_DECREF(Mult_annotations);
3806
0
        return 0;
3807
0
    }
3808
16
    cond = PyObject_SetAttrString(state->Mult_type, "__annotations__",
3809
16
                                  Mult_annotations) == 0;
3810
16
    if (!cond) {
3811
0
        Py_DECREF(Mult_annotations);
3812
0
        return 0;
3813
0
    }
3814
16
    Py_DECREF(Mult_annotations);
3815
16
    PyObject *MatMult_annotations = PyDict_New();
3816
16
    if (!MatMult_annotations) return 0;
3817
16
    cond = PyObject_SetAttrString(state->MatMult_type, "_field_types",
3818
16
                                  MatMult_annotations) == 0;
3819
16
    if (!cond) {
3820
0
        Py_DECREF(MatMult_annotations);
3821
0
        return 0;
3822
0
    }
3823
16
    cond = PyObject_SetAttrString(state->MatMult_type, "__annotations__",
3824
16
                                  MatMult_annotations) == 0;
3825
16
    if (!cond) {
3826
0
        Py_DECREF(MatMult_annotations);
3827
0
        return 0;
3828
0
    }
3829
16
    Py_DECREF(MatMult_annotations);
3830
16
    PyObject *Div_annotations = PyDict_New();
3831
16
    if (!Div_annotations) return 0;
3832
16
    cond = PyObject_SetAttrString(state->Div_type, "_field_types",
3833
16
                                  Div_annotations) == 0;
3834
16
    if (!cond) {
3835
0
        Py_DECREF(Div_annotations);
3836
0
        return 0;
3837
0
    }
3838
16
    cond = PyObject_SetAttrString(state->Div_type, "__annotations__",
3839
16
                                  Div_annotations) == 0;
3840
16
    if (!cond) {
3841
0
        Py_DECREF(Div_annotations);
3842
0
        return 0;
3843
0
    }
3844
16
    Py_DECREF(Div_annotations);
3845
16
    PyObject *Mod_annotations = PyDict_New();
3846
16
    if (!Mod_annotations) return 0;
3847
16
    cond = PyObject_SetAttrString(state->Mod_type, "_field_types",
3848
16
                                  Mod_annotations) == 0;
3849
16
    if (!cond) {
3850
0
        Py_DECREF(Mod_annotations);
3851
0
        return 0;
3852
0
    }
3853
16
    cond = PyObject_SetAttrString(state->Mod_type, "__annotations__",
3854
16
                                  Mod_annotations) == 0;
3855
16
    if (!cond) {
3856
0
        Py_DECREF(Mod_annotations);
3857
0
        return 0;
3858
0
    }
3859
16
    Py_DECREF(Mod_annotations);
3860
16
    PyObject *Pow_annotations = PyDict_New();
3861
16
    if (!Pow_annotations) return 0;
3862
16
    cond = PyObject_SetAttrString(state->Pow_type, "_field_types",
3863
16
                                  Pow_annotations) == 0;
3864
16
    if (!cond) {
3865
0
        Py_DECREF(Pow_annotations);
3866
0
        return 0;
3867
0
    }
3868
16
    cond = PyObject_SetAttrString(state->Pow_type, "__annotations__",
3869
16
                                  Pow_annotations) == 0;
3870
16
    if (!cond) {
3871
0
        Py_DECREF(Pow_annotations);
3872
0
        return 0;
3873
0
    }
3874
16
    Py_DECREF(Pow_annotations);
3875
16
    PyObject *LShift_annotations = PyDict_New();
3876
16
    if (!LShift_annotations) return 0;
3877
16
    cond = PyObject_SetAttrString(state->LShift_type, "_field_types",
3878
16
                                  LShift_annotations) == 0;
3879
16
    if (!cond) {
3880
0
        Py_DECREF(LShift_annotations);
3881
0
        return 0;
3882
0
    }
3883
16
    cond = PyObject_SetAttrString(state->LShift_type, "__annotations__",
3884
16
                                  LShift_annotations) == 0;
3885
16
    if (!cond) {
3886
0
        Py_DECREF(LShift_annotations);
3887
0
        return 0;
3888
0
    }
3889
16
    Py_DECREF(LShift_annotations);
3890
16
    PyObject *RShift_annotations = PyDict_New();
3891
16
    if (!RShift_annotations) return 0;
3892
16
    cond = PyObject_SetAttrString(state->RShift_type, "_field_types",
3893
16
                                  RShift_annotations) == 0;
3894
16
    if (!cond) {
3895
0
        Py_DECREF(RShift_annotations);
3896
0
        return 0;
3897
0
    }
3898
16
    cond = PyObject_SetAttrString(state->RShift_type, "__annotations__",
3899
16
                                  RShift_annotations) == 0;
3900
16
    if (!cond) {
3901
0
        Py_DECREF(RShift_annotations);
3902
0
        return 0;
3903
0
    }
3904
16
    Py_DECREF(RShift_annotations);
3905
16
    PyObject *BitOr_annotations = PyDict_New();
3906
16
    if (!BitOr_annotations) return 0;
3907
16
    cond = PyObject_SetAttrString(state->BitOr_type, "_field_types",
3908
16
                                  BitOr_annotations) == 0;
3909
16
    if (!cond) {
3910
0
        Py_DECREF(BitOr_annotations);
3911
0
        return 0;
3912
0
    }
3913
16
    cond = PyObject_SetAttrString(state->BitOr_type, "__annotations__",
3914
16
                                  BitOr_annotations) == 0;
3915
16
    if (!cond) {
3916
0
        Py_DECREF(BitOr_annotations);
3917
0
        return 0;
3918
0
    }
3919
16
    Py_DECREF(BitOr_annotations);
3920
16
    PyObject *BitXor_annotations = PyDict_New();
3921
16
    if (!BitXor_annotations) return 0;
3922
16
    cond = PyObject_SetAttrString(state->BitXor_type, "_field_types",
3923
16
                                  BitXor_annotations) == 0;
3924
16
    if (!cond) {
3925
0
        Py_DECREF(BitXor_annotations);
3926
0
        return 0;
3927
0
    }
3928
16
    cond = PyObject_SetAttrString(state->BitXor_type, "__annotations__",
3929
16
                                  BitXor_annotations) == 0;
3930
16
    if (!cond) {
3931
0
        Py_DECREF(BitXor_annotations);
3932
0
        return 0;
3933
0
    }
3934
16
    Py_DECREF(BitXor_annotations);
3935
16
    PyObject *BitAnd_annotations = PyDict_New();
3936
16
    if (!BitAnd_annotations) return 0;
3937
16
    cond = PyObject_SetAttrString(state->BitAnd_type, "_field_types",
3938
16
                                  BitAnd_annotations) == 0;
3939
16
    if (!cond) {
3940
0
        Py_DECREF(BitAnd_annotations);
3941
0
        return 0;
3942
0
    }
3943
16
    cond = PyObject_SetAttrString(state->BitAnd_type, "__annotations__",
3944
16
                                  BitAnd_annotations) == 0;
3945
16
    if (!cond) {
3946
0
        Py_DECREF(BitAnd_annotations);
3947
0
        return 0;
3948
0
    }
3949
16
    Py_DECREF(BitAnd_annotations);
3950
16
    PyObject *FloorDiv_annotations = PyDict_New();
3951
16
    if (!FloorDiv_annotations) return 0;
3952
16
    cond = PyObject_SetAttrString(state->FloorDiv_type, "_field_types",
3953
16
                                  FloorDiv_annotations) == 0;
3954
16
    if (!cond) {
3955
0
        Py_DECREF(FloorDiv_annotations);
3956
0
        return 0;
3957
0
    }
3958
16
    cond = PyObject_SetAttrString(state->FloorDiv_type, "__annotations__",
3959
16
                                  FloorDiv_annotations) == 0;
3960
16
    if (!cond) {
3961
0
        Py_DECREF(FloorDiv_annotations);
3962
0
        return 0;
3963
0
    }
3964
16
    Py_DECREF(FloorDiv_annotations);
3965
16
    PyObject *Invert_annotations = PyDict_New();
3966
16
    if (!Invert_annotations) return 0;
3967
16
    cond = PyObject_SetAttrString(state->Invert_type, "_field_types",
3968
16
                                  Invert_annotations) == 0;
3969
16
    if (!cond) {
3970
0
        Py_DECREF(Invert_annotations);
3971
0
        return 0;
3972
0
    }
3973
16
    cond = PyObject_SetAttrString(state->Invert_type, "__annotations__",
3974
16
                                  Invert_annotations) == 0;
3975
16
    if (!cond) {
3976
0
        Py_DECREF(Invert_annotations);
3977
0
        return 0;
3978
0
    }
3979
16
    Py_DECREF(Invert_annotations);
3980
16
    PyObject *Not_annotations = PyDict_New();
3981
16
    if (!Not_annotations) return 0;
3982
16
    cond = PyObject_SetAttrString(state->Not_type, "_field_types",
3983
16
                                  Not_annotations) == 0;
3984
16
    if (!cond) {
3985
0
        Py_DECREF(Not_annotations);
3986
0
        return 0;
3987
0
    }
3988
16
    cond = PyObject_SetAttrString(state->Not_type, "__annotations__",
3989
16
                                  Not_annotations) == 0;
3990
16
    if (!cond) {
3991
0
        Py_DECREF(Not_annotations);
3992
0
        return 0;
3993
0
    }
3994
16
    Py_DECREF(Not_annotations);
3995
16
    PyObject *UAdd_annotations = PyDict_New();
3996
16
    if (!UAdd_annotations) return 0;
3997
16
    cond = PyObject_SetAttrString(state->UAdd_type, "_field_types",
3998
16
                                  UAdd_annotations) == 0;
3999
16
    if (!cond) {
4000
0
        Py_DECREF(UAdd_annotations);
4001
0
        return 0;
4002
0
    }
4003
16
    cond = PyObject_SetAttrString(state->UAdd_type, "__annotations__",
4004
16
                                  UAdd_annotations) == 0;
4005
16
    if (!cond) {
4006
0
        Py_DECREF(UAdd_annotations);
4007
0
        return 0;
4008
0
    }
4009
16
    Py_DECREF(UAdd_annotations);
4010
16
    PyObject *USub_annotations = PyDict_New();
4011
16
    if (!USub_annotations) return 0;
4012
16
    cond = PyObject_SetAttrString(state->USub_type, "_field_types",
4013
16
                                  USub_annotations) == 0;
4014
16
    if (!cond) {
4015
0
        Py_DECREF(USub_annotations);
4016
0
        return 0;
4017
0
    }
4018
16
    cond = PyObject_SetAttrString(state->USub_type, "__annotations__",
4019
16
                                  USub_annotations) == 0;
4020
16
    if (!cond) {
4021
0
        Py_DECREF(USub_annotations);
4022
0
        return 0;
4023
0
    }
4024
16
    Py_DECREF(USub_annotations);
4025
16
    PyObject *Eq_annotations = PyDict_New();
4026
16
    if (!Eq_annotations) return 0;
4027
16
    cond = PyObject_SetAttrString(state->Eq_type, "_field_types",
4028
16
                                  Eq_annotations) == 0;
4029
16
    if (!cond) {
4030
0
        Py_DECREF(Eq_annotations);
4031
0
        return 0;
4032
0
    }
4033
16
    cond = PyObject_SetAttrString(state->Eq_type, "__annotations__",
4034
16
                                  Eq_annotations) == 0;
4035
16
    if (!cond) {
4036
0
        Py_DECREF(Eq_annotations);
4037
0
        return 0;
4038
0
    }
4039
16
    Py_DECREF(Eq_annotations);
4040
16
    PyObject *NotEq_annotations = PyDict_New();
4041
16
    if (!NotEq_annotations) return 0;
4042
16
    cond = PyObject_SetAttrString(state->NotEq_type, "_field_types",
4043
16
                                  NotEq_annotations) == 0;
4044
16
    if (!cond) {
4045
0
        Py_DECREF(NotEq_annotations);
4046
0
        return 0;
4047
0
    }
4048
16
    cond = PyObject_SetAttrString(state->NotEq_type, "__annotations__",
4049
16
                                  NotEq_annotations) == 0;
4050
16
    if (!cond) {
4051
0
        Py_DECREF(NotEq_annotations);
4052
0
        return 0;
4053
0
    }
4054
16
    Py_DECREF(NotEq_annotations);
4055
16
    PyObject *Lt_annotations = PyDict_New();
4056
16
    if (!Lt_annotations) return 0;
4057
16
    cond = PyObject_SetAttrString(state->Lt_type, "_field_types",
4058
16
                                  Lt_annotations) == 0;
4059
16
    if (!cond) {
4060
0
        Py_DECREF(Lt_annotations);
4061
0
        return 0;
4062
0
    }
4063
16
    cond = PyObject_SetAttrString(state->Lt_type, "__annotations__",
4064
16
                                  Lt_annotations) == 0;
4065
16
    if (!cond) {
4066
0
        Py_DECREF(Lt_annotations);
4067
0
        return 0;
4068
0
    }
4069
16
    Py_DECREF(Lt_annotations);
4070
16
    PyObject *LtE_annotations = PyDict_New();
4071
16
    if (!LtE_annotations) return 0;
4072
16
    cond = PyObject_SetAttrString(state->LtE_type, "_field_types",
4073
16
                                  LtE_annotations) == 0;
4074
16
    if (!cond) {
4075
0
        Py_DECREF(LtE_annotations);
4076
0
        return 0;
4077
0
    }
4078
16
    cond = PyObject_SetAttrString(state->LtE_type, "__annotations__",
4079
16
                                  LtE_annotations) == 0;
4080
16
    if (!cond) {
4081
0
        Py_DECREF(LtE_annotations);
4082
0
        return 0;
4083
0
    }
4084
16
    Py_DECREF(LtE_annotations);
4085
16
    PyObject *Gt_annotations = PyDict_New();
4086
16
    if (!Gt_annotations) return 0;
4087
16
    cond = PyObject_SetAttrString(state->Gt_type, "_field_types",
4088
16
                                  Gt_annotations) == 0;
4089
16
    if (!cond) {
4090
0
        Py_DECREF(Gt_annotations);
4091
0
        return 0;
4092
0
    }
4093
16
    cond = PyObject_SetAttrString(state->Gt_type, "__annotations__",
4094
16
                                  Gt_annotations) == 0;
4095
16
    if (!cond) {
4096
0
        Py_DECREF(Gt_annotations);
4097
0
        return 0;
4098
0
    }
4099
16
    Py_DECREF(Gt_annotations);
4100
16
    PyObject *GtE_annotations = PyDict_New();
4101
16
    if (!GtE_annotations) return 0;
4102
16
    cond = PyObject_SetAttrString(state->GtE_type, "_field_types",
4103
16
                                  GtE_annotations) == 0;
4104
16
    if (!cond) {
4105
0
        Py_DECREF(GtE_annotations);
4106
0
        return 0;
4107
0
    }
4108
16
    cond = PyObject_SetAttrString(state->GtE_type, "__annotations__",
4109
16
                                  GtE_annotations) == 0;
4110
16
    if (!cond) {
4111
0
        Py_DECREF(GtE_annotations);
4112
0
        return 0;
4113
0
    }
4114
16
    Py_DECREF(GtE_annotations);
4115
16
    PyObject *Is_annotations = PyDict_New();
4116
16
    if (!Is_annotations) return 0;
4117
16
    cond = PyObject_SetAttrString(state->Is_type, "_field_types",
4118
16
                                  Is_annotations) == 0;
4119
16
    if (!cond) {
4120
0
        Py_DECREF(Is_annotations);
4121
0
        return 0;
4122
0
    }
4123
16
    cond = PyObject_SetAttrString(state->Is_type, "__annotations__",
4124
16
                                  Is_annotations) == 0;
4125
16
    if (!cond) {
4126
0
        Py_DECREF(Is_annotations);
4127
0
        return 0;
4128
0
    }
4129
16
    Py_DECREF(Is_annotations);
4130
16
    PyObject *IsNot_annotations = PyDict_New();
4131
16
    if (!IsNot_annotations) return 0;
4132
16
    cond = PyObject_SetAttrString(state->IsNot_type, "_field_types",
4133
16
                                  IsNot_annotations) == 0;
4134
16
    if (!cond) {
4135
0
        Py_DECREF(IsNot_annotations);
4136
0
        return 0;
4137
0
    }
4138
16
    cond = PyObject_SetAttrString(state->IsNot_type, "__annotations__",
4139
16
                                  IsNot_annotations) == 0;
4140
16
    if (!cond) {
4141
0
        Py_DECREF(IsNot_annotations);
4142
0
        return 0;
4143
0
    }
4144
16
    Py_DECREF(IsNot_annotations);
4145
16
    PyObject *In_annotations = PyDict_New();
4146
16
    if (!In_annotations) return 0;
4147
16
    cond = PyObject_SetAttrString(state->In_type, "_field_types",
4148
16
                                  In_annotations) == 0;
4149
16
    if (!cond) {
4150
0
        Py_DECREF(In_annotations);
4151
0
        return 0;
4152
0
    }
4153
16
    cond = PyObject_SetAttrString(state->In_type, "__annotations__",
4154
16
                                  In_annotations) == 0;
4155
16
    if (!cond) {
4156
0
        Py_DECREF(In_annotations);
4157
0
        return 0;
4158
0
    }
4159
16
    Py_DECREF(In_annotations);
4160
16
    PyObject *NotIn_annotations = PyDict_New();
4161
16
    if (!NotIn_annotations) return 0;
4162
16
    cond = PyObject_SetAttrString(state->NotIn_type, "_field_types",
4163
16
                                  NotIn_annotations) == 0;
4164
16
    if (!cond) {
4165
0
        Py_DECREF(NotIn_annotations);
4166
0
        return 0;
4167
0
    }
4168
16
    cond = PyObject_SetAttrString(state->NotIn_type, "__annotations__",
4169
16
                                  NotIn_annotations) == 0;
4170
16
    if (!cond) {
4171
0
        Py_DECREF(NotIn_annotations);
4172
0
        return 0;
4173
0
    }
4174
16
    Py_DECREF(NotIn_annotations);
4175
16
    PyObject *comprehension_annotations = PyDict_New();
4176
16
    if (!comprehension_annotations) return 0;
4177
16
    {
4178
16
        PyObject *type = state->expr_type;
4179
16
        Py_INCREF(type);
4180
16
        cond = PyDict_SetItemString(comprehension_annotations, "target", type)
4181
16
                                    == 0;
4182
16
        Py_DECREF(type);
4183
16
        if (!cond) {
4184
0
            Py_DECREF(comprehension_annotations);
4185
0
            return 0;
4186
0
        }
4187
16
    }
4188
16
    {
4189
16
        PyObject *type = state->expr_type;
4190
16
        Py_INCREF(type);
4191
16
        cond = PyDict_SetItemString(comprehension_annotations, "iter", type) ==
4192
16
                                    0;
4193
16
        Py_DECREF(type);
4194
16
        if (!cond) {
4195
0
            Py_DECREF(comprehension_annotations);
4196
0
            return 0;
4197
0
        }
4198
16
    }
4199
16
    {
4200
16
        PyObject *type = state->expr_type;
4201
16
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
4202
16
        cond = type != NULL;
4203
16
        if (!cond) {
4204
0
            Py_DECREF(comprehension_annotations);
4205
0
            return 0;
4206
0
        }
4207
16
        cond = PyDict_SetItemString(comprehension_annotations, "ifs", type) ==
4208
16
                                    0;
4209
16
        Py_DECREF(type);
4210
16
        if (!cond) {
4211
0
            Py_DECREF(comprehension_annotations);
4212
0
            return 0;
4213
0
        }
4214
16
    }
4215
16
    {
4216
16
        PyObject *type = (PyObject *)&PyLong_Type;
4217
16
        Py_INCREF(type);
4218
16
        cond = PyDict_SetItemString(comprehension_annotations, "is_async",
4219
16
                                    type) == 0;
4220
16
        Py_DECREF(type);
4221
16
        if (!cond) {
4222
0
            Py_DECREF(comprehension_annotations);
4223
0
            return 0;
4224
0
        }
4225
16
    }
4226
16
    cond = PyObject_SetAttrString(state->comprehension_type, "_field_types",
4227
16
                                  comprehension_annotations) == 0;
4228
16
    if (!cond) {
4229
0
        Py_DECREF(comprehension_annotations);
4230
0
        return 0;
4231
0
    }
4232
16
    cond = PyObject_SetAttrString(state->comprehension_type, "__annotations__",
4233
16
                                  comprehension_annotations) == 0;
4234
16
    if (!cond) {
4235
0
        Py_DECREF(comprehension_annotations);
4236
0
        return 0;
4237
0
    }
4238
16
    Py_DECREF(comprehension_annotations);
4239
16
    PyObject *ExceptHandler_annotations = PyDict_New();
4240
16
    if (!ExceptHandler_annotations) return 0;
4241
16
    {
4242
16
        PyObject *type = state->expr_type;
4243
16
        type = _Py_union_type_or(type, Py_None);
4244
16
        cond = type != NULL;
4245
16
        if (!cond) {
4246
0
            Py_DECREF(ExceptHandler_annotations);
4247
0
            return 0;
4248
0
        }
4249
16
        cond = PyDict_SetItemString(ExceptHandler_annotations, "type", type) ==
4250
16
                                    0;
4251
16
        Py_DECREF(type);
4252
16
        if (!cond) {
4253
0
            Py_DECREF(ExceptHandler_annotations);
4254
0
            return 0;
4255
0
        }
4256
16
    }
4257
16
    {
4258
16
        PyObject *type = (PyObject *)&PyUnicode_Type;
4259
16
        type = _Py_union_type_or(type, Py_None);
4260
16
        cond = type != NULL;
4261
16
        if (!cond) {
4262
0
            Py_DECREF(ExceptHandler_annotations);
4263
0
            return 0;
4264
0
        }
4265
16
        cond = PyDict_SetItemString(ExceptHandler_annotations, "name", type) ==
4266
16
                                    0;
4267
16
        Py_DECREF(type);
4268
16
        if (!cond) {
4269
0
            Py_DECREF(ExceptHandler_annotations);
4270
0
            return 0;
4271
0
        }
4272
16
    }
4273
16
    {
4274
16
        PyObject *type = state->stmt_type;
4275
16
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
4276
16
        cond = type != NULL;
4277
16
        if (!cond) {
4278
0
            Py_DECREF(ExceptHandler_annotations);
4279
0
            return 0;
4280
0
        }
4281
16
        cond = PyDict_SetItemString(ExceptHandler_annotations, "body", type) ==
4282
16
                                    0;
4283
16
        Py_DECREF(type);
4284
16
        if (!cond) {
4285
0
            Py_DECREF(ExceptHandler_annotations);
4286
0
            return 0;
4287
0
        }
4288
16
    }
4289
16
    cond = PyObject_SetAttrString(state->ExceptHandler_type, "_field_types",
4290
16
                                  ExceptHandler_annotations) == 0;
4291
16
    if (!cond) {
4292
0
        Py_DECREF(ExceptHandler_annotations);
4293
0
        return 0;
4294
0
    }
4295
16
    cond = PyObject_SetAttrString(state->ExceptHandler_type, "__annotations__",
4296
16
                                  ExceptHandler_annotations) == 0;
4297
16
    if (!cond) {
4298
0
        Py_DECREF(ExceptHandler_annotations);
4299
0
        return 0;
4300
0
    }
4301
16
    Py_DECREF(ExceptHandler_annotations);
4302
16
    PyObject *arguments_annotations = PyDict_New();
4303
16
    if (!arguments_annotations) return 0;
4304
16
    {
4305
16
        PyObject *type = state->arg_type;
4306
16
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
4307
16
        cond = type != NULL;
4308
16
        if (!cond) {
4309
0
            Py_DECREF(arguments_annotations);
4310
0
            return 0;
4311
0
        }
4312
16
        cond = PyDict_SetItemString(arguments_annotations, "posonlyargs", type)
4313
16
                                    == 0;
4314
16
        Py_DECREF(type);
4315
16
        if (!cond) {
4316
0
            Py_DECREF(arguments_annotations);
4317
0
            return 0;
4318
0
        }
4319
16
    }
4320
16
    {
4321
16
        PyObject *type = state->arg_type;
4322
16
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
4323
16
        cond = type != NULL;
4324
16
        if (!cond) {
4325
0
            Py_DECREF(arguments_annotations);
4326
0
            return 0;
4327
0
        }
4328
16
        cond = PyDict_SetItemString(arguments_annotations, "args", type) == 0;
4329
16
        Py_DECREF(type);
4330
16
        if (!cond) {
4331
0
            Py_DECREF(arguments_annotations);
4332
0
            return 0;
4333
0
        }
4334
16
    }
4335
16
    {
4336
16
        PyObject *type = state->arg_type;
4337
16
        type = _Py_union_type_or(type, Py_None);
4338
16
        cond = type != NULL;
4339
16
        if (!cond) {
4340
0
            Py_DECREF(arguments_annotations);
4341
0
            return 0;
4342
0
        }
4343
16
        cond = PyDict_SetItemString(arguments_annotations, "vararg", type) == 0;
4344
16
        Py_DECREF(type);
4345
16
        if (!cond) {
4346
0
            Py_DECREF(arguments_annotations);
4347
0
            return 0;
4348
0
        }
4349
16
    }
4350
16
    {
4351
16
        PyObject *type = state->arg_type;
4352
16
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
4353
16
        cond = type != NULL;
4354
16
        if (!cond) {
4355
0
            Py_DECREF(arguments_annotations);
4356
0
            return 0;
4357
0
        }
4358
16
        cond = PyDict_SetItemString(arguments_annotations, "kwonlyargs", type)
4359
16
                                    == 0;
4360
16
        Py_DECREF(type);
4361
16
        if (!cond) {
4362
0
            Py_DECREF(arguments_annotations);
4363
0
            return 0;
4364
0
        }
4365
16
    }
4366
16
    {
4367
16
        PyObject *type = state->expr_type;
4368
16
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
4369
16
        cond = type != NULL;
4370
16
        if (!cond) {
4371
0
            Py_DECREF(arguments_annotations);
4372
0
            return 0;
4373
0
        }
4374
16
        cond = PyDict_SetItemString(arguments_annotations, "kw_defaults", type)
4375
16
                                    == 0;
4376
16
        Py_DECREF(type);
4377
16
        if (!cond) {
4378
0
            Py_DECREF(arguments_annotations);
4379
0
            return 0;
4380
0
        }
4381
16
    }
4382
16
    {
4383
16
        PyObject *type = state->arg_type;
4384
16
        type = _Py_union_type_or(type, Py_None);
4385
16
        cond = type != NULL;
4386
16
        if (!cond) {
4387
0
            Py_DECREF(arguments_annotations);
4388
0
            return 0;
4389
0
        }
4390
16
        cond = PyDict_SetItemString(arguments_annotations, "kwarg", type) == 0;
4391
16
        Py_DECREF(type);
4392
16
        if (!cond) {
4393
0
            Py_DECREF(arguments_annotations);
4394
0
            return 0;
4395
0
        }
4396
16
    }
4397
16
    {
4398
16
        PyObject *type = state->expr_type;
4399
16
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
4400
16
        cond = type != NULL;
4401
16
        if (!cond) {
4402
0
            Py_DECREF(arguments_annotations);
4403
0
            return 0;
4404
0
        }
4405
16
        cond = PyDict_SetItemString(arguments_annotations, "defaults", type) ==
4406
16
                                    0;
4407
16
        Py_DECREF(type);
4408
16
        if (!cond) {
4409
0
            Py_DECREF(arguments_annotations);
4410
0
            return 0;
4411
0
        }
4412
16
    }
4413
16
    cond = PyObject_SetAttrString(state->arguments_type, "_field_types",
4414
16
                                  arguments_annotations) == 0;
4415
16
    if (!cond) {
4416
0
        Py_DECREF(arguments_annotations);
4417
0
        return 0;
4418
0
    }
4419
16
    cond = PyObject_SetAttrString(state->arguments_type, "__annotations__",
4420
16
                                  arguments_annotations) == 0;
4421
16
    if (!cond) {
4422
0
        Py_DECREF(arguments_annotations);
4423
0
        return 0;
4424
0
    }
4425
16
    Py_DECREF(arguments_annotations);
4426
16
    PyObject *arg_annotations = PyDict_New();
4427
16
    if (!arg_annotations) return 0;
4428
16
    {
4429
16
        PyObject *type = (PyObject *)&PyUnicode_Type;
4430
16
        Py_INCREF(type);
4431
16
        cond = PyDict_SetItemString(arg_annotations, "arg", type) == 0;
4432
16
        Py_DECREF(type);
4433
16
        if (!cond) {
4434
0
            Py_DECREF(arg_annotations);
4435
0
            return 0;
4436
0
        }
4437
16
    }
4438
16
    {
4439
16
        PyObject *type = state->expr_type;
4440
16
        type = _Py_union_type_or(type, Py_None);
4441
16
        cond = type != NULL;
4442
16
        if (!cond) {
4443
0
            Py_DECREF(arg_annotations);
4444
0
            return 0;
4445
0
        }
4446
16
        cond = PyDict_SetItemString(arg_annotations, "annotation", type) == 0;
4447
16
        Py_DECREF(type);
4448
16
        if (!cond) {
4449
0
            Py_DECREF(arg_annotations);
4450
0
            return 0;
4451
0
        }
4452
16
    }
4453
16
    {
4454
16
        PyObject *type = (PyObject *)&PyUnicode_Type;
4455
16
        type = _Py_union_type_or(type, Py_None);
4456
16
        cond = type != NULL;
4457
16
        if (!cond) {
4458
0
            Py_DECREF(arg_annotations);
4459
0
            return 0;
4460
0
        }
4461
16
        cond = PyDict_SetItemString(arg_annotations, "type_comment", type) == 0;
4462
16
        Py_DECREF(type);
4463
16
        if (!cond) {
4464
0
            Py_DECREF(arg_annotations);
4465
0
            return 0;
4466
0
        }
4467
16
    }
4468
16
    cond = PyObject_SetAttrString(state->arg_type, "_field_types",
4469
16
                                  arg_annotations) == 0;
4470
16
    if (!cond) {
4471
0
        Py_DECREF(arg_annotations);
4472
0
        return 0;
4473
0
    }
4474
16
    cond = PyObject_SetAttrString(state->arg_type, "__annotations__",
4475
16
                                  arg_annotations) == 0;
4476
16
    if (!cond) {
4477
0
        Py_DECREF(arg_annotations);
4478
0
        return 0;
4479
0
    }
4480
16
    Py_DECREF(arg_annotations);
4481
16
    PyObject *keyword_annotations = PyDict_New();
4482
16
    if (!keyword_annotations) return 0;
4483
16
    {
4484
16
        PyObject *type = (PyObject *)&PyUnicode_Type;
4485
16
        type = _Py_union_type_or(type, Py_None);
4486
16
        cond = type != NULL;
4487
16
        if (!cond) {
4488
0
            Py_DECREF(keyword_annotations);
4489
0
            return 0;
4490
0
        }
4491
16
        cond = PyDict_SetItemString(keyword_annotations, "arg", type) == 0;
4492
16
        Py_DECREF(type);
4493
16
        if (!cond) {
4494
0
            Py_DECREF(keyword_annotations);
4495
0
            return 0;
4496
0
        }
4497
16
    }
4498
16
    {
4499
16
        PyObject *type = state->expr_type;
4500
16
        Py_INCREF(type);
4501
16
        cond = PyDict_SetItemString(keyword_annotations, "value", type) == 0;
4502
16
        Py_DECREF(type);
4503
16
        if (!cond) {
4504
0
            Py_DECREF(keyword_annotations);
4505
0
            return 0;
4506
0
        }
4507
16
    }
4508
16
    cond = PyObject_SetAttrString(state->keyword_type, "_field_types",
4509
16
                                  keyword_annotations) == 0;
4510
16
    if (!cond) {
4511
0
        Py_DECREF(keyword_annotations);
4512
0
        return 0;
4513
0
    }
4514
16
    cond = PyObject_SetAttrString(state->keyword_type, "__annotations__",
4515
16
                                  keyword_annotations) == 0;
4516
16
    if (!cond) {
4517
0
        Py_DECREF(keyword_annotations);
4518
0
        return 0;
4519
0
    }
4520
16
    Py_DECREF(keyword_annotations);
4521
16
    PyObject *alias_annotations = PyDict_New();
4522
16
    if (!alias_annotations) return 0;
4523
16
    {
4524
16
        PyObject *type = (PyObject *)&PyUnicode_Type;
4525
16
        Py_INCREF(type);
4526
16
        cond = PyDict_SetItemString(alias_annotations, "name", type) == 0;
4527
16
        Py_DECREF(type);
4528
16
        if (!cond) {
4529
0
            Py_DECREF(alias_annotations);
4530
0
            return 0;
4531
0
        }
4532
16
    }
4533
16
    {
4534
16
        PyObject *type = (PyObject *)&PyUnicode_Type;
4535
16
        type = _Py_union_type_or(type, Py_None);
4536
16
        cond = type != NULL;
4537
16
        if (!cond) {
4538
0
            Py_DECREF(alias_annotations);
4539
0
            return 0;
4540
0
        }
4541
16
        cond = PyDict_SetItemString(alias_annotations, "asname", type) == 0;
4542
16
        Py_DECREF(type);
4543
16
        if (!cond) {
4544
0
            Py_DECREF(alias_annotations);
4545
0
            return 0;
4546
0
        }
4547
16
    }
4548
16
    cond = PyObject_SetAttrString(state->alias_type, "_field_types",
4549
16
                                  alias_annotations) == 0;
4550
16
    if (!cond) {
4551
0
        Py_DECREF(alias_annotations);
4552
0
        return 0;
4553
0
    }
4554
16
    cond = PyObject_SetAttrString(state->alias_type, "__annotations__",
4555
16
                                  alias_annotations) == 0;
4556
16
    if (!cond) {
4557
0
        Py_DECREF(alias_annotations);
4558
0
        return 0;
4559
0
    }
4560
16
    Py_DECREF(alias_annotations);
4561
16
    PyObject *withitem_annotations = PyDict_New();
4562
16
    if (!withitem_annotations) return 0;
4563
16
    {
4564
16
        PyObject *type = state->expr_type;
4565
16
        Py_INCREF(type);
4566
16
        cond = PyDict_SetItemString(withitem_annotations, "context_expr", type)
4567
16
                                    == 0;
4568
16
        Py_DECREF(type);
4569
16
        if (!cond) {
4570
0
            Py_DECREF(withitem_annotations);
4571
0
            return 0;
4572
0
        }
4573
16
    }
4574
16
    {
4575
16
        PyObject *type = state->expr_type;
4576
16
        type = _Py_union_type_or(type, Py_None);
4577
16
        cond = type != NULL;
4578
16
        if (!cond) {
4579
0
            Py_DECREF(withitem_annotations);
4580
0
            return 0;
4581
0
        }
4582
16
        cond = PyDict_SetItemString(withitem_annotations, "optional_vars",
4583
16
                                    type) == 0;
4584
16
        Py_DECREF(type);
4585
16
        if (!cond) {
4586
0
            Py_DECREF(withitem_annotations);
4587
0
            return 0;
4588
0
        }
4589
16
    }
4590
16
    cond = PyObject_SetAttrString(state->withitem_type, "_field_types",
4591
16
                                  withitem_annotations) == 0;
4592
16
    if (!cond) {
4593
0
        Py_DECREF(withitem_annotations);
4594
0
        return 0;
4595
0
    }
4596
16
    cond = PyObject_SetAttrString(state->withitem_type, "__annotations__",
4597
16
                                  withitem_annotations) == 0;
4598
16
    if (!cond) {
4599
0
        Py_DECREF(withitem_annotations);
4600
0
        return 0;
4601
0
    }
4602
16
    Py_DECREF(withitem_annotations);
4603
16
    PyObject *match_case_annotations = PyDict_New();
4604
16
    if (!match_case_annotations) return 0;
4605
16
    {
4606
16
        PyObject *type = state->pattern_type;
4607
16
        Py_INCREF(type);
4608
16
        cond = PyDict_SetItemString(match_case_annotations, "pattern", type) ==
4609
16
                                    0;
4610
16
        Py_DECREF(type);
4611
16
        if (!cond) {
4612
0
            Py_DECREF(match_case_annotations);
4613
0
            return 0;
4614
0
        }
4615
16
    }
4616
16
    {
4617
16
        PyObject *type = state->expr_type;
4618
16
        type = _Py_union_type_or(type, Py_None);
4619
16
        cond = type != NULL;
4620
16
        if (!cond) {
4621
0
            Py_DECREF(match_case_annotations);
4622
0
            return 0;
4623
0
        }
4624
16
        cond = PyDict_SetItemString(match_case_annotations, "guard", type) == 0;
4625
16
        Py_DECREF(type);
4626
16
        if (!cond) {
4627
0
            Py_DECREF(match_case_annotations);
4628
0
            return 0;
4629
0
        }
4630
16
    }
4631
16
    {
4632
16
        PyObject *type = state->stmt_type;
4633
16
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
4634
16
        cond = type != NULL;
4635
16
        if (!cond) {
4636
0
            Py_DECREF(match_case_annotations);
4637
0
            return 0;
4638
0
        }
4639
16
        cond = PyDict_SetItemString(match_case_annotations, "body", type) == 0;
4640
16
        Py_DECREF(type);
4641
16
        if (!cond) {
4642
0
            Py_DECREF(match_case_annotations);
4643
0
            return 0;
4644
0
        }
4645
16
    }
4646
16
    cond = PyObject_SetAttrString(state->match_case_type, "_field_types",
4647
16
                                  match_case_annotations) == 0;
4648
16
    if (!cond) {
4649
0
        Py_DECREF(match_case_annotations);
4650
0
        return 0;
4651
0
    }
4652
16
    cond = PyObject_SetAttrString(state->match_case_type, "__annotations__",
4653
16
                                  match_case_annotations) == 0;
4654
16
    if (!cond) {
4655
0
        Py_DECREF(match_case_annotations);
4656
0
        return 0;
4657
0
    }
4658
16
    Py_DECREF(match_case_annotations);
4659
16
    PyObject *MatchValue_annotations = PyDict_New();
4660
16
    if (!MatchValue_annotations) return 0;
4661
16
    {
4662
16
        PyObject *type = state->expr_type;
4663
16
        Py_INCREF(type);
4664
16
        cond = PyDict_SetItemString(MatchValue_annotations, "value", type) == 0;
4665
16
        Py_DECREF(type);
4666
16
        if (!cond) {
4667
0
            Py_DECREF(MatchValue_annotations);
4668
0
            return 0;
4669
0
        }
4670
16
    }
4671
16
    cond = PyObject_SetAttrString(state->MatchValue_type, "_field_types",
4672
16
                                  MatchValue_annotations) == 0;
4673
16
    if (!cond) {
4674
0
        Py_DECREF(MatchValue_annotations);
4675
0
        return 0;
4676
0
    }
4677
16
    cond = PyObject_SetAttrString(state->MatchValue_type, "__annotations__",
4678
16
                                  MatchValue_annotations) == 0;
4679
16
    if (!cond) {
4680
0
        Py_DECREF(MatchValue_annotations);
4681
0
        return 0;
4682
0
    }
4683
16
    Py_DECREF(MatchValue_annotations);
4684
16
    PyObject *MatchSingleton_annotations = PyDict_New();
4685
16
    if (!MatchSingleton_annotations) return 0;
4686
16
    {
4687
16
        PyObject *type = (PyObject *)&PyBaseObject_Type;
4688
16
        Py_INCREF(type);
4689
16
        cond = PyDict_SetItemString(MatchSingleton_annotations, "value", type)
4690
16
                                    == 0;
4691
16
        Py_DECREF(type);
4692
16
        if (!cond) {
4693
0
            Py_DECREF(MatchSingleton_annotations);
4694
0
            return 0;
4695
0
        }
4696
16
    }
4697
16
    cond = PyObject_SetAttrString(state->MatchSingleton_type, "_field_types",
4698
16
                                  MatchSingleton_annotations) == 0;
4699
16
    if (!cond) {
4700
0
        Py_DECREF(MatchSingleton_annotations);
4701
0
        return 0;
4702
0
    }
4703
16
    cond = PyObject_SetAttrString(state->MatchSingleton_type,
4704
16
                                  "__annotations__",
4705
16
                                  MatchSingleton_annotations) == 0;
4706
16
    if (!cond) {
4707
0
        Py_DECREF(MatchSingleton_annotations);
4708
0
        return 0;
4709
0
    }
4710
16
    Py_DECREF(MatchSingleton_annotations);
4711
16
    PyObject *MatchSequence_annotations = PyDict_New();
4712
16
    if (!MatchSequence_annotations) return 0;
4713
16
    {
4714
16
        PyObject *type = state->pattern_type;
4715
16
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
4716
16
        cond = type != NULL;
4717
16
        if (!cond) {
4718
0
            Py_DECREF(MatchSequence_annotations);
4719
0
            return 0;
4720
0
        }
4721
16
        cond = PyDict_SetItemString(MatchSequence_annotations, "patterns",
4722
16
                                    type) == 0;
4723
16
        Py_DECREF(type);
4724
16
        if (!cond) {
4725
0
            Py_DECREF(MatchSequence_annotations);
4726
0
            return 0;
4727
0
        }
4728
16
    }
4729
16
    cond = PyObject_SetAttrString(state->MatchSequence_type, "_field_types",
4730
16
                                  MatchSequence_annotations) == 0;
4731
16
    if (!cond) {
4732
0
        Py_DECREF(MatchSequence_annotations);
4733
0
        return 0;
4734
0
    }
4735
16
    cond = PyObject_SetAttrString(state->MatchSequence_type, "__annotations__",
4736
16
                                  MatchSequence_annotations) == 0;
4737
16
    if (!cond) {
4738
0
        Py_DECREF(MatchSequence_annotations);
4739
0
        return 0;
4740
0
    }
4741
16
    Py_DECREF(MatchSequence_annotations);
4742
16
    PyObject *MatchMapping_annotations = PyDict_New();
4743
16
    if (!MatchMapping_annotations) return 0;
4744
16
    {
4745
16
        PyObject *type = state->expr_type;
4746
16
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
4747
16
        cond = type != NULL;
4748
16
        if (!cond) {
4749
0
            Py_DECREF(MatchMapping_annotations);
4750
0
            return 0;
4751
0
        }
4752
16
        cond = PyDict_SetItemString(MatchMapping_annotations, "keys", type) ==
4753
16
                                    0;
4754
16
        Py_DECREF(type);
4755
16
        if (!cond) {
4756
0
            Py_DECREF(MatchMapping_annotations);
4757
0
            return 0;
4758
0
        }
4759
16
    }
4760
16
    {
4761
16
        PyObject *type = state->pattern_type;
4762
16
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
4763
16
        cond = type != NULL;
4764
16
        if (!cond) {
4765
0
            Py_DECREF(MatchMapping_annotations);
4766
0
            return 0;
4767
0
        }
4768
16
        cond = PyDict_SetItemString(MatchMapping_annotations, "patterns", type)
4769
16
                                    == 0;
4770
16
        Py_DECREF(type);
4771
16
        if (!cond) {
4772
0
            Py_DECREF(MatchMapping_annotations);
4773
0
            return 0;
4774
0
        }
4775
16
    }
4776
16
    {
4777
16
        PyObject *type = (PyObject *)&PyUnicode_Type;
4778
16
        type = _Py_union_type_or(type, Py_None);
4779
16
        cond = type != NULL;
4780
16
        if (!cond) {
4781
0
            Py_DECREF(MatchMapping_annotations);
4782
0
            return 0;
4783
0
        }
4784
16
        cond = PyDict_SetItemString(MatchMapping_annotations, "rest", type) ==
4785
16
                                    0;
4786
16
        Py_DECREF(type);
4787
16
        if (!cond) {
4788
0
            Py_DECREF(MatchMapping_annotations);
4789
0
            return 0;
4790
0
        }
4791
16
    }
4792
16
    cond = PyObject_SetAttrString(state->MatchMapping_type, "_field_types",
4793
16
                                  MatchMapping_annotations) == 0;
4794
16
    if (!cond) {
4795
0
        Py_DECREF(MatchMapping_annotations);
4796
0
        return 0;
4797
0
    }
4798
16
    cond = PyObject_SetAttrString(state->MatchMapping_type, "__annotations__",
4799
16
                                  MatchMapping_annotations) == 0;
4800
16
    if (!cond) {
4801
0
        Py_DECREF(MatchMapping_annotations);
4802
0
        return 0;
4803
0
    }
4804
16
    Py_DECREF(MatchMapping_annotations);
4805
16
    PyObject *MatchClass_annotations = PyDict_New();
4806
16
    if (!MatchClass_annotations) return 0;
4807
16
    {
4808
16
        PyObject *type = state->expr_type;
4809
16
        Py_INCREF(type);
4810
16
        cond = PyDict_SetItemString(MatchClass_annotations, "cls", type) == 0;
4811
16
        Py_DECREF(type);
4812
16
        if (!cond) {
4813
0
            Py_DECREF(MatchClass_annotations);
4814
0
            return 0;
4815
0
        }
4816
16
    }
4817
16
    {
4818
16
        PyObject *type = state->pattern_type;
4819
16
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
4820
16
        cond = type != NULL;
4821
16
        if (!cond) {
4822
0
            Py_DECREF(MatchClass_annotations);
4823
0
            return 0;
4824
0
        }
4825
16
        cond = PyDict_SetItemString(MatchClass_annotations, "patterns", type)
4826
16
                                    == 0;
4827
16
        Py_DECREF(type);
4828
16
        if (!cond) {
4829
0
            Py_DECREF(MatchClass_annotations);
4830
0
            return 0;
4831
0
        }
4832
16
    }
4833
16
    {
4834
16
        PyObject *type = (PyObject *)&PyUnicode_Type;
4835
16
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
4836
16
        cond = type != NULL;
4837
16
        if (!cond) {
4838
0
            Py_DECREF(MatchClass_annotations);
4839
0
            return 0;
4840
0
        }
4841
16
        cond = PyDict_SetItemString(MatchClass_annotations, "kwd_attrs", type)
4842
16
                                    == 0;
4843
16
        Py_DECREF(type);
4844
16
        if (!cond) {
4845
0
            Py_DECREF(MatchClass_annotations);
4846
0
            return 0;
4847
0
        }
4848
16
    }
4849
16
    {
4850
16
        PyObject *type = state->pattern_type;
4851
16
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
4852
16
        cond = type != NULL;
4853
16
        if (!cond) {
4854
0
            Py_DECREF(MatchClass_annotations);
4855
0
            return 0;
4856
0
        }
4857
16
        cond = PyDict_SetItemString(MatchClass_annotations, "kwd_patterns",
4858
16
                                    type) == 0;
4859
16
        Py_DECREF(type);
4860
16
        if (!cond) {
4861
0
            Py_DECREF(MatchClass_annotations);
4862
0
            return 0;
4863
0
        }
4864
16
    }
4865
16
    cond = PyObject_SetAttrString(state->MatchClass_type, "_field_types",
4866
16
                                  MatchClass_annotations) == 0;
4867
16
    if (!cond) {
4868
0
        Py_DECREF(MatchClass_annotations);
4869
0
        return 0;
4870
0
    }
4871
16
    cond = PyObject_SetAttrString(state->MatchClass_type, "__annotations__",
4872
16
                                  MatchClass_annotations) == 0;
4873
16
    if (!cond) {
4874
0
        Py_DECREF(MatchClass_annotations);
4875
0
        return 0;
4876
0
    }
4877
16
    Py_DECREF(MatchClass_annotations);
4878
16
    PyObject *MatchStar_annotations = PyDict_New();
4879
16
    if (!MatchStar_annotations) return 0;
4880
16
    {
4881
16
        PyObject *type = (PyObject *)&PyUnicode_Type;
4882
16
        type = _Py_union_type_or(type, Py_None);
4883
16
        cond = type != NULL;
4884
16
        if (!cond) {
4885
0
            Py_DECREF(MatchStar_annotations);
4886
0
            return 0;
4887
0
        }
4888
16
        cond = PyDict_SetItemString(MatchStar_annotations, "name", type) == 0;
4889
16
        Py_DECREF(type);
4890
16
        if (!cond) {
4891
0
            Py_DECREF(MatchStar_annotations);
4892
0
            return 0;
4893
0
        }
4894
16
    }
4895
16
    cond = PyObject_SetAttrString(state->MatchStar_type, "_field_types",
4896
16
                                  MatchStar_annotations) == 0;
4897
16
    if (!cond) {
4898
0
        Py_DECREF(MatchStar_annotations);
4899
0
        return 0;
4900
0
    }
4901
16
    cond = PyObject_SetAttrString(state->MatchStar_type, "__annotations__",
4902
16
                                  MatchStar_annotations) == 0;
4903
16
    if (!cond) {
4904
0
        Py_DECREF(MatchStar_annotations);
4905
0
        return 0;
4906
0
    }
4907
16
    Py_DECREF(MatchStar_annotations);
4908
16
    PyObject *MatchAs_annotations = PyDict_New();
4909
16
    if (!MatchAs_annotations) return 0;
4910
16
    {
4911
16
        PyObject *type = state->pattern_type;
4912
16
        type = _Py_union_type_or(type, Py_None);
4913
16
        cond = type != NULL;
4914
16
        if (!cond) {
4915
0
            Py_DECREF(MatchAs_annotations);
4916
0
            return 0;
4917
0
        }
4918
16
        cond = PyDict_SetItemString(MatchAs_annotations, "pattern", type) == 0;
4919
16
        Py_DECREF(type);
4920
16
        if (!cond) {
4921
0
            Py_DECREF(MatchAs_annotations);
4922
0
            return 0;
4923
0
        }
4924
16
    }
4925
16
    {
4926
16
        PyObject *type = (PyObject *)&PyUnicode_Type;
4927
16
        type = _Py_union_type_or(type, Py_None);
4928
16
        cond = type != NULL;
4929
16
        if (!cond) {
4930
0
            Py_DECREF(MatchAs_annotations);
4931
0
            return 0;
4932
0
        }
4933
16
        cond = PyDict_SetItemString(MatchAs_annotations, "name", type) == 0;
4934
16
        Py_DECREF(type);
4935
16
        if (!cond) {
4936
0
            Py_DECREF(MatchAs_annotations);
4937
0
            return 0;
4938
0
        }
4939
16
    }
4940
16
    cond = PyObject_SetAttrString(state->MatchAs_type, "_field_types",
4941
16
                                  MatchAs_annotations) == 0;
4942
16
    if (!cond) {
4943
0
        Py_DECREF(MatchAs_annotations);
4944
0
        return 0;
4945
0
    }
4946
16
    cond = PyObject_SetAttrString(state->MatchAs_type, "__annotations__",
4947
16
                                  MatchAs_annotations) == 0;
4948
16
    if (!cond) {
4949
0
        Py_DECREF(MatchAs_annotations);
4950
0
        return 0;
4951
0
    }
4952
16
    Py_DECREF(MatchAs_annotations);
4953
16
    PyObject *MatchOr_annotations = PyDict_New();
4954
16
    if (!MatchOr_annotations) return 0;
4955
16
    {
4956
16
        PyObject *type = state->pattern_type;
4957
16
        type = Py_GenericAlias((PyObject *)&PyList_Type, type);
4958
16
        cond = type != NULL;
4959
16
        if (!cond) {
4960
0
            Py_DECREF(MatchOr_annotations);
4961
0
            return 0;
4962
0
        }
4963
16
        cond = PyDict_SetItemString(MatchOr_annotations, "patterns", type) == 0;
4964
16
        Py_DECREF(type);
4965
16
        if (!cond) {
4966
0
            Py_DECREF(MatchOr_annotations);
4967
0
            return 0;
4968
0
        }
4969
16
    }
4970
16
    cond = PyObject_SetAttrString(state->MatchOr_type, "_field_types",
4971
16
                                  MatchOr_annotations) == 0;
4972
16
    if (!cond) {
4973
0
        Py_DECREF(MatchOr_annotations);
4974
0
        return 0;
4975
0
    }
4976
16
    cond = PyObject_SetAttrString(state->MatchOr_type, "__annotations__",
4977
16
                                  MatchOr_annotations) == 0;
4978
16
    if (!cond) {
4979
0
        Py_DECREF(MatchOr_annotations);
4980
0
        return 0;
4981
0
    }
4982
16
    Py_DECREF(MatchOr_annotations);
4983
16
    PyObject *TypeIgnore_annotations = PyDict_New();
4984
16
    if (!TypeIgnore_annotations) return 0;
4985
16
    {
4986
16
        PyObject *type = (PyObject *)&PyLong_Type;
4987
16
        Py_INCREF(type);
4988
16
        cond = PyDict_SetItemString(TypeIgnore_annotations, "lineno", type) ==
4989
16
                                    0;
4990
16
        Py_DECREF(type);
4991
16
        if (!cond) {
4992
0
            Py_DECREF(TypeIgnore_annotations);
4993
0
            return 0;
4994
0
        }
4995
16
    }
4996
16
    {
4997
16
        PyObject *type = (PyObject *)&PyUnicode_Type;
4998
16
        Py_INCREF(type);
4999
16
        cond = PyDict_SetItemString(TypeIgnore_annotations, "tag", type) == 0;
5000
16
        Py_DECREF(type);
5001
16
        if (!cond) {
5002
0
            Py_DECREF(TypeIgnore_annotations);
5003
0
            return 0;
5004
0
        }
5005
16
    }
5006
16
    cond = PyObject_SetAttrString(state->TypeIgnore_type, "_field_types",
5007
16
                                  TypeIgnore_annotations) == 0;
5008
16
    if (!cond) {
5009
0
        Py_DECREF(TypeIgnore_annotations);
5010
0
        return 0;
5011
0
    }
5012
16
    cond = PyObject_SetAttrString(state->TypeIgnore_type, "__annotations__",
5013
16
                                  TypeIgnore_annotations) == 0;
5014
16
    if (!cond) {
5015
0
        Py_DECREF(TypeIgnore_annotations);
5016
0
        return 0;
5017
0
    }
5018
16
    Py_DECREF(TypeIgnore_annotations);
5019
16
    PyObject *TypeVar_annotations = PyDict_New();
5020
16
    if (!TypeVar_annotations) return 0;
5021
16
    {
5022
16
        PyObject *type = (PyObject *)&PyUnicode_Type;
5023
16
        Py_INCREF(type);
5024
16
        cond = PyDict_SetItemString(TypeVar_annotations, "name", type) == 0;
5025
16
        Py_DECREF(type);
5026
16
        if (!cond) {
5027
0
            Py_DECREF(TypeVar_annotations);
5028
0
            return 0;
5029
0
        }
5030
16
    }
5031
16
    {
5032
16
        PyObject *type = state->expr_type;
5033
16
        type = _Py_union_type_or(type, Py_None);
5034
16
        cond = type != NULL;
5035
16
        if (!cond) {
5036
0
            Py_DECREF(TypeVar_annotations);
5037
0
            return 0;
5038
0
        }
5039
16
        cond = PyDict_SetItemString(TypeVar_annotations, "bound", type) == 0;
5040
16
        Py_DECREF(type);
5041
16
        if (!cond) {
5042
0
            Py_DECREF(TypeVar_annotations);
5043
0
            return 0;
5044
0
        }
5045
16
    }
5046
16
    {
5047
16
        PyObject *type = state->expr_type;
5048
16
        type = _Py_union_type_or(type, Py_None);
5049
16
        cond = type != NULL;
5050
16
        if (!cond) {
5051
0
            Py_DECREF(TypeVar_annotations);
5052
0
            return 0;
5053
0
        }
5054
16
        cond = PyDict_SetItemString(TypeVar_annotations, "default_value", type)
5055
16
                                    == 0;
5056
16
        Py_DECREF(type);
5057
16
        if (!cond) {
5058
0
            Py_DECREF(TypeVar_annotations);
5059
0
            return 0;
5060
0
        }
5061
16
    }
5062
16
    cond = PyObject_SetAttrString(state->TypeVar_type, "_field_types",
5063
16
                                  TypeVar_annotations) == 0;
5064
16
    if (!cond) {
5065
0
        Py_DECREF(TypeVar_annotations);
5066
0
        return 0;
5067
0
    }
5068
16
    cond = PyObject_SetAttrString(state->TypeVar_type, "__annotations__",
5069
16
                                  TypeVar_annotations) == 0;
5070
16
    if (!cond) {
5071
0
        Py_DECREF(TypeVar_annotations);
5072
0
        return 0;
5073
0
    }
5074
16
    Py_DECREF(TypeVar_annotations);
5075
16
    PyObject *ParamSpec_annotations = PyDict_New();
5076
16
    if (!ParamSpec_annotations) return 0;
5077
16
    {
5078
16
        PyObject *type = (PyObject *)&PyUnicode_Type;
5079
16
        Py_INCREF(type);
5080
16
        cond = PyDict_SetItemString(ParamSpec_annotations, "name", type) == 0;
5081
16
        Py_DECREF(type);
5082
16
        if (!cond) {
5083
0
            Py_DECREF(ParamSpec_annotations);
5084
0
            return 0;
5085
0
        }
5086
16
    }
5087
16
    {
5088
16
        PyObject *type = state->expr_type;
5089
16
        type = _Py_union_type_or(type, Py_None);
5090
16
        cond = type != NULL;
5091
16
        if (!cond) {
5092
0
            Py_DECREF(ParamSpec_annotations);
5093
0
            return 0;
5094
0
        }
5095
16
        cond = PyDict_SetItemString(ParamSpec_annotations, "default_value",
5096
16
                                    type) == 0;
5097
16
        Py_DECREF(type);
5098
16
        if (!cond) {
5099
0
            Py_DECREF(ParamSpec_annotations);
5100
0
            return 0;
5101
0
        }
5102
16
    }
5103
16
    cond = PyObject_SetAttrString(state->ParamSpec_type, "_field_types",
5104
16
                                  ParamSpec_annotations) == 0;
5105
16
    if (!cond) {
5106
0
        Py_DECREF(ParamSpec_annotations);
5107
0
        return 0;
5108
0
    }
5109
16
    cond = PyObject_SetAttrString(state->ParamSpec_type, "__annotations__",
5110
16
                                  ParamSpec_annotations) == 0;
5111
16
    if (!cond) {
5112
0
        Py_DECREF(ParamSpec_annotations);
5113
0
        return 0;
5114
0
    }
5115
16
    Py_DECREF(ParamSpec_annotations);
5116
16
    PyObject *TypeVarTuple_annotations = PyDict_New();
5117
16
    if (!TypeVarTuple_annotations) return 0;
5118
16
    {
5119
16
        PyObject *type = (PyObject *)&PyUnicode_Type;
5120
16
        Py_INCREF(type);
5121
16
        cond = PyDict_SetItemString(TypeVarTuple_annotations, "name", type) ==
5122
16
                                    0;
5123
16
        Py_DECREF(type);
5124
16
        if (!cond) {
5125
0
            Py_DECREF(TypeVarTuple_annotations);
5126
0
            return 0;
5127
0
        }
5128
16
    }
5129
16
    {
5130
16
        PyObject *type = state->expr_type;
5131
16
        type = _Py_union_type_or(type, Py_None);
5132
16
        cond = type != NULL;
5133
16
        if (!cond) {
5134
0
            Py_DECREF(TypeVarTuple_annotations);
5135
0
            return 0;
5136
0
        }
5137
16
        cond = PyDict_SetItemString(TypeVarTuple_annotations, "default_value",
5138
16
                                    type) == 0;
5139
16
        Py_DECREF(type);
5140
16
        if (!cond) {
5141
0
            Py_DECREF(TypeVarTuple_annotations);
5142
0
            return 0;
5143
0
        }
5144
16
    }
5145
16
    cond = PyObject_SetAttrString(state->TypeVarTuple_type, "_field_types",
5146
16
                                  TypeVarTuple_annotations) == 0;
5147
16
    if (!cond) {
5148
0
        Py_DECREF(TypeVarTuple_annotations);
5149
0
        return 0;
5150
0
    }
5151
16
    cond = PyObject_SetAttrString(state->TypeVarTuple_type, "__annotations__",
5152
16
                                  TypeVarTuple_annotations) == 0;
5153
16
    if (!cond) {
5154
0
        Py_DECREF(TypeVarTuple_annotations);
5155
0
        return 0;
5156
0
    }
5157
16
    Py_DECREF(TypeVarTuple_annotations);
5158
5159
16
    return 1;
5160
16
}
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
489k
{
5172
489k
    AST_object *self = (AST_object*)op;
5173
    /* bpo-31095: UnTrack is needed before calling any callbacks */
5174
489k
    PyTypeObject *tp = Py_TYPE(self);
5175
489k
    PyObject_GC_UnTrack(self);
5176
489k
    Py_CLEAR(self->dict);
5177
489k
    freefunc free_func = PyType_GetSlot(tp, Py_tp_free);
5178
489k
    assert(free_func != NULL);
5179
489k
    free_func(self);
5180
489k
    Py_DECREF(tp);
5181
489k
}
5182
5183
static int
5184
ast_traverse(PyObject *op, visitproc visit, void *arg)
5185
220k
{
5186
220k
    AST_object *self = (AST_object*)op;
5187
220k
    Py_VISIT(Py_TYPE(self));
5188
220k
    Py_VISIT(self->dict);
5189
220k
    return 0;
5190
220k
}
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
436
{
5203
436
    struct ast_state *state = get_ast_state();
5204
436
    if (state == NULL) {
5205
0
        return -1;
5206
0
    }
5207
5208
436
    Py_ssize_t i, numfields = 0;
5209
436
    int res = -1;
5210
436
    PyObject *key, *value, *fields, *attributes = NULL, *remaining_fields = NULL;
5211
5212
436
    fields = PyObject_GetAttr((PyObject*)Py_TYPE(self), state->_fields);
5213
436
    if (fields == NULL) {
5214
0
        goto cleanup;
5215
0
    }
5216
5217
436
    numfields = PySequence_Size(fields);
5218
436
    if (numfields == -1) {
5219
0
        goto cleanup;
5220
0
    }
5221
436
    remaining_fields = PySet_New(fields);
5222
436
    if (remaining_fields == NULL) {
5223
0
        goto cleanup;
5224
0
    }
5225
5226
436
    res = 0; /* if no error occurs, this stays 0 to the end */
5227
436
    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
538
    for (i = 0; i < PyTuple_GET_SIZE(args); i++) {
5236
        /* cannot be reached when fields is NULL */
5237
102
        PyObject *name = PySequence_GetItem(fields, i);
5238
102
        if (!name) {
5239
0
            res = -1;
5240
0
            goto cleanup;
5241
0
        }
5242
102
        res = PyObject_SetAttr(self, name, PyTuple_GET_ITEM(args, i));
5243
102
        if (PySet_Discard(remaining_fields, name) < 0) {
5244
0
            res = -1;
5245
0
            Py_DECREF(name);
5246
0
            goto cleanup;
5247
0
        }
5248
102
        Py_DECREF(name);
5249
102
        if (res < 0) {
5250
0
            goto cleanup;
5251
0
        }
5252
102
    }
5253
436
    if (kw) {
5254
102
        i = 0;  /* needed by PyDict_Next */
5255
204
        while (PyDict_Next(kw, &i, &key, &value)) {
5256
102
            int contains = PySequence_Contains(fields, key);
5257
102
            if (contains == -1) {
5258
0
                res = -1;
5259
0
                goto cleanup;
5260
0
            }
5261
102
            else if (contains == 1) {
5262
102
                int p = PySet_Discard(remaining_fields, key);
5263
102
                if (p == -1) {
5264
0
                    res = -1;
5265
0
                    goto cleanup;
5266
0
                }
5267
102
                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
102
            }
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
102
            res = PyObject_SetAttr(self, key, value);
5303
102
            if (res < 0) {
5304
0
                goto cleanup;
5305
0
            }
5306
102
        }
5307
102
    }
5308
436
    Py_ssize_t size = PySet_Size(remaining_fields);
5309
436
    PyObject *field_types = NULL, *remaining_list = NULL;
5310
436
    if (size > 0) {
5311
156
        if (PyObject_GetOptionalAttr((PyObject*)Py_TYPE(self), &_Py_ID(_field_types),
5312
156
                                     &field_types) < 0) {
5313
0
            res = -1;
5314
0
            goto cleanup;
5315
0
        }
5316
156
        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
156
        remaining_list = PySequence_List(remaining_fields);
5323
156
        if (!remaining_list) {
5324
0
            goto set_remaining_cleanup;
5325
0
        }
5326
312
        for (Py_ssize_t i = 0; i < size; i++) {
5327
156
            PyObject *name = PyList_GET_ITEM(remaining_list, i);
5328
156
            PyObject *type = PyDict_GetItemWithError(field_types, name);
5329
156
            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
156
            else if (_PyUnion_Check(type)) {
5345
                // optional field
5346
                // do nothing, we'll have set a None default on the class
5347
12
            }
5348
144
            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
144
            else if (type == state->expr_context_type) {
5361
                // special case for expr_context: default to Load()
5362
144
                res = PyObject_SetAttr(self, name, state->Load_singleton);
5363
144
                if (res < 0) {
5364
0
                    goto set_remaining_cleanup;
5365
0
                }
5366
144
            }
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
156
        }
5379
156
        Py_DECREF(remaining_list);
5380
156
        Py_DECREF(field_types);
5381
156
    }
5382
436
  cleanup:
5383
436
    Py_XDECREF(attributes);
5384
436
    Py_XDECREF(fields);
5385
436
    Py_XDECREF(remaining_fields);
5386
436
    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
436
}
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
0
{
5887
0
    struct ast_state *state = get_ast_state();
5888
0
    if (state == NULL) {
5889
0
        return NULL;
5890
0
    }
5891
5892
0
    if (depth <= 0) {
5893
0
        return PyUnicode_FromFormat("%s(...)", Py_TYPE(self)->tp_name);
5894
0
    }
5895
5896
0
    int status = Py_ReprEnter((PyObject *)self);
5897
0
    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
0
    PyObject *fields;
5905
0
    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
0
    Py_ssize_t numfields = PySequence_Size(fields);
5911
0
    if (numfields < 0) {
5912
0
        Py_ReprLeave((PyObject *)self);
5913
0
        Py_DECREF(fields);
5914
0
        return NULL;
5915
0
    }
5916
5917
0
    if (numfields == 0) {
5918
0
        Py_ReprLeave((PyObject *)self);
5919
0
        Py_DECREF(fields);
5920
0
        return PyUnicode_FromFormat("%s()", Py_TYPE(self)->tp_name);
5921
0
    }
5922
5923
0
    const char* tp_name = Py_TYPE(self)->tp_name;
5924
0
    PyUnicodeWriter *writer = PyUnicodeWriter_Create(0);
5925
0
    if (writer == NULL) {
5926
0
        goto error;
5927
0
    }
5928
5929
0
    if (PyUnicodeWriter_WriteUTF8(writer, tp_name, -1) < 0) {
5930
0
        goto error;
5931
0
    }
5932
0
    if (PyUnicodeWriter_WriteChar(writer, '(') < 0) {
5933
0
        goto error;
5934
0
    }
5935
5936
0
    for (Py_ssize_t i = 0; i < numfields; i++) {
5937
0
        PyObject *name = PySequence_GetItem(fields, i);
5938
0
        if (!name) {
5939
0
            goto error;
5940
0
        }
5941
5942
0
        PyObject *value = PyObject_GetAttr((PyObject *)self, name);
5943
0
        if (!value) {
5944
0
            Py_DECREF(name);
5945
0
            goto error;
5946
0
        }
5947
5948
0
        PyObject *value_repr;
5949
0
        if (PyList_Check(value) || PyTuple_Check(value)) {
5950
0
            value_repr = ast_repr_list(value, depth);
5951
0
        }
5952
0
        else if (PyType_IsSubtype(Py_TYPE(value), (PyTypeObject *)state->AST_type)) {
5953
0
            value_repr = ast_repr_max_depth((AST_object*)value, depth - 1);
5954
0
        }
5955
0
        else {
5956
0
            value_repr = PyObject_Repr(value);
5957
0
        }
5958
5959
0
        Py_DECREF(value);
5960
5961
0
        if (!value_repr) {
5962
0
            Py_DECREF(name);
5963
0
            goto error;
5964
0
        }
5965
5966
0
        if (i > 0) {
5967
0
            if (PyUnicodeWriter_WriteASCII(writer, ", ", 2) < 0) {
5968
0
                Py_DECREF(name);
5969
0
                Py_DECREF(value_repr);
5970
0
                goto error;
5971
0
            }
5972
0
        }
5973
0
        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
0
        Py_DECREF(name);
5980
5981
0
        if (PyUnicodeWriter_WriteChar(writer, '=') < 0) {
5982
0
            Py_DECREF(value_repr);
5983
0
            goto error;
5984
0
        }
5985
0
        if (PyUnicodeWriter_WriteStr(writer, value_repr) < 0) {
5986
0
            Py_DECREF(value_repr);
5987
0
            goto error;
5988
0
        }
5989
5990
0
        Py_DECREF(value_repr);
5991
0
    }
5992
5993
0
    if (PyUnicodeWriter_WriteChar(writer, ')') < 0) {
5994
0
        goto error;
5995
0
    }
5996
0
    Py_ReprLeave((PyObject *)self);
5997
0
    Py_DECREF(fields);
5998
0
    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
0
}
6006
6007
static PyObject *
6008
ast_repr(PyObject *self)
6009
0
{
6010
0
    return ast_repr_max_depth((AST_object*)self, 3);
6011
0
}
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
2.00k
{
6042
2.00k
    PyObject *fnames, *result;
6043
2.00k
    int i;
6044
2.00k
    fnames = PyTuple_New(num_fields);
6045
2.00k
    if (!fnames) return NULL;
6046
5.16k
    for (i = 0; i < num_fields; i++) {
6047
3.16k
        PyObject *field = PyUnicode_InternFromString(fields[i]);
6048
3.16k
        if (!field) {
6049
0
            Py_DECREF(fnames);
6050
0
            return NULL;
6051
0
        }
6052
3.16k
        PyTuple_SET_ITEM(fnames, i, field);
6053
3.16k
    }
6054
2.00k
    result = PyObject_CallFunction((PyObject*)&PyType_Type, "s(O){OOOOOOOs}",
6055
2.00k
                    type, base,
6056
2.00k
                    state->_fields, fnames,
6057
2.00k
                    state->__match_args__, fnames,
6058
2.00k
                    state->__module__,
6059
2.00k
                    state->ast,
6060
2.00k
                    state->__doc__, doc);
6061
2.00k
    Py_DECREF(fnames);
6062
2.00k
    return result;
6063
2.00k
}
6064
6065
static int
6066
add_attributes(struct ast_state *state, PyObject *type, const char * const *attrs, int num_fields)
6067
304
{
6068
304
    int i, result;
6069
304
    PyObject *s, *l = PyTuple_New(num_fields);
6070
304
    if (!l)
6071
0
        return -1;
6072
816
    for (i = 0; i < num_fields; i++) {
6073
512
        s = PyUnicode_InternFromString(attrs[i]);
6074
512
        if (!s) {
6075
0
            Py_DECREF(l);
6076
0
            return -1;
6077
0
        }
6078
512
        PyTuple_SET_ITEM(l, i, s);
6079
512
    }
6080
304
    result = PyObject_SetAttr(type, state->_attributes, l);
6081
304
    Py_DECREF(l);
6082
304
    return result;
6083
304
}
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
92.4k
{
6090
92.4k
    Py_ssize_t i, n = asdl_seq_LEN(seq);
6091
92.4k
    PyObject *result = PyList_New(n);
6092
92.4k
    PyObject *value;
6093
92.4k
    if (!result)
6094
0
        return NULL;
6095
245k
    for (i = 0; i < n; i++) {
6096
152k
        value = func(state, asdl_seq_GET_UNTYPED(seq, i));
6097
152k
        if (!value) {
6098
0
            Py_DECREF(result);
6099
0
            return NULL;
6100
0
        }
6101
152k
        PyList_SET_ITEM(result, i, value);
6102
152k
    }
6103
92.4k
    return result;
6104
92.4k
}
6105
6106
static PyObject* ast2obj_object(struct ast_state *Py_UNUSED(state), void *o)
6107
263k
{
6108
263k
    PyObject *op = (PyObject*)o;
6109
263k
    if (!op) {
6110
95.2k
        op = Py_None;
6111
95.2k
    }
6112
263k
    return Py_NewRef(op);
6113
263k
}
6114
68.4k
#define ast2obj_constant ast2obj_object
6115
110k
#define ast2obj_identifier ast2obj_object
6116
84.6k
#define ast2obj_string ast2obj_object
6117
6118
static PyObject* ast2obj_int(struct ast_state *Py_UNUSED(state), long b)
6119
1.93M
{
6120
1.93M
    return PyLong_FromLong(b);
6121
1.93M
}
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
16
{
6187
16
    PyObject *empty_tuple;
6188
16
    empty_tuple = PyTuple_New(0);
6189
16
    if (!empty_tuple ||
6190
16
        PyObject_SetAttrString(state->AST_type, "_fields", empty_tuple) < 0 ||
6191
16
        PyObject_SetAttrString(state->AST_type, "__match_args__", empty_tuple) < 0 ||
6192
16
        PyObject_SetAttrString(state->AST_type, "_attributes", empty_tuple) < 0) {
6193
0
        Py_XDECREF(empty_tuple);
6194
0
        return -1;
6195
0
    }
6196
16
    Py_DECREF(empty_tuple);
6197
16
    return 0;
6198
16
}
6199
6200
6201
6202
static int
6203
init_types(void *arg)
6204
16
{
6205
16
    struct ast_state *state = arg;
6206
16
    if (init_identifiers(state) < 0) {
6207
0
        return -1;
6208
0
    }
6209
16
    state->AST_type = PyType_FromSpec(&AST_type_spec);
6210
16
    if (!state->AST_type) {
6211
0
        return -1;
6212
0
    }
6213
16
    if (add_ast_fields(state) < 0) {
6214
0
        return -1;
6215
0
    }
6216
16
    state->mod_type = make_type(state, "mod", state->AST_type, NULL, 0,
6217
16
        "mod = Module(stmt* body, type_ignore* type_ignores)\n"
6218
16
        "    | Interactive(stmt* body)\n"
6219
16
        "    | Expression(expr body)\n"
6220
16
        "    | FunctionType(expr* argtypes, expr returns)");
6221
16
    if (!state->mod_type) return -1;
6222
16
    if (add_attributes(state, state->mod_type, NULL, 0) < 0) return -1;
6223
16
    state->Module_type = make_type(state, "Module", state->mod_type,
6224
16
                                   Module_fields, 2,
6225
16
        "Module(stmt* body, type_ignore* type_ignores)");
6226
16
    if (!state->Module_type) return -1;
6227
16
    state->Interactive_type = make_type(state, "Interactive", state->mod_type,
6228
16
                                        Interactive_fields, 1,
6229
16
        "Interactive(stmt* body)");
6230
16
    if (!state->Interactive_type) return -1;
6231
16
    state->Expression_type = make_type(state, "Expression", state->mod_type,
6232
16
                                       Expression_fields, 1,
6233
16
        "Expression(expr body)");
6234
16
    if (!state->Expression_type) return -1;
6235
16
    state->FunctionType_type = make_type(state, "FunctionType",
6236
16
                                         state->mod_type, FunctionType_fields,
6237
16
                                         2,
6238
16
        "FunctionType(expr* argtypes, expr returns)");
6239
16
    if (!state->FunctionType_type) return -1;
6240
16
    state->stmt_type = make_type(state, "stmt", state->AST_type, NULL, 0,
6241
16
        "stmt = FunctionDef(identifier name, arguments args, stmt* body, expr* decorator_list, expr? returns, string? type_comment, type_param* type_params)\n"
6242
16
        "     | AsyncFunctionDef(identifier name, arguments args, stmt* body, expr* decorator_list, expr? returns, string? type_comment, type_param* type_params)\n"
6243
16
        "     | ClassDef(identifier name, expr* bases, keyword* keywords, stmt* body, expr* decorator_list, type_param* type_params)\n"
6244
16
        "     | Return(expr? value)\n"
6245
16
        "     | Delete(expr* targets)\n"
6246
16
        "     | Assign(expr* targets, expr value, string? type_comment)\n"
6247
16
        "     | TypeAlias(expr name, type_param* type_params, expr value)\n"
6248
16
        "     | AugAssign(expr target, operator op, expr value)\n"
6249
16
        "     | AnnAssign(expr target, expr annotation, expr? value, int simple)\n"
6250
16
        "     | For(expr target, expr iter, stmt* body, stmt* orelse, string? type_comment)\n"
6251
16
        "     | AsyncFor(expr target, expr iter, stmt* body, stmt* orelse, string? type_comment)\n"
6252
16
        "     | While(expr test, stmt* body, stmt* orelse)\n"
6253
16
        "     | If(expr test, stmt* body, stmt* orelse)\n"
6254
16
        "     | With(withitem* items, stmt* body, string? type_comment)\n"
6255
16
        "     | AsyncWith(withitem* items, stmt* body, string? type_comment)\n"
6256
16
        "     | Match(expr subject, match_case* cases)\n"
6257
16
        "     | Raise(expr? exc, expr? cause)\n"
6258
16
        "     | Try(stmt* body, excepthandler* handlers, stmt* orelse, stmt* finalbody)\n"
6259
16
        "     | TryStar(stmt* body, excepthandler* handlers, stmt* orelse, stmt* finalbody)\n"
6260
16
        "     | Assert(expr test, expr? msg)\n"
6261
16
        "     | Import(alias* names, int? is_lazy)\n"
6262
16
        "     | ImportFrom(identifier? module, alias* names, int? level, int? is_lazy)\n"
6263
16
        "     | Global(identifier* names)\n"
6264
16
        "     | Nonlocal(identifier* names)\n"
6265
16
        "     | Expr(expr value)\n"
6266
16
        "     | Pass\n"
6267
16
        "     | Break\n"
6268
16
        "     | Continue");
6269
16
    if (!state->stmt_type) return -1;
6270
16
    if (add_attributes(state, state->stmt_type, stmt_attributes, 4) < 0) return
6271
0
        -1;
6272
16
    if (PyObject_SetAttr(state->stmt_type, state->end_lineno, Py_None) == -1)
6273
0
        return -1;
6274
16
    if (PyObject_SetAttr(state->stmt_type, state->end_col_offset, Py_None) ==
6275
16
        -1)
6276
0
        return -1;
6277
16
    state->FunctionDef_type = make_type(state, "FunctionDef", state->stmt_type,
6278
16
                                        FunctionDef_fields, 7,
6279
16
        "FunctionDef(identifier name, arguments args, stmt* body, expr* decorator_list, expr? returns, string? type_comment, type_param* type_params)");
6280
16
    if (!state->FunctionDef_type) return -1;
6281
16
    if (PyObject_SetAttr(state->FunctionDef_type, state->returns, Py_None) ==
6282
16
        -1)
6283
0
        return -1;
6284
16
    if (PyObject_SetAttr(state->FunctionDef_type, state->type_comment, Py_None)
6285
16
        == -1)
6286
0
        return -1;
6287
16
    state->AsyncFunctionDef_type = make_type(state, "AsyncFunctionDef",
6288
16
                                             state->stmt_type,
6289
16
                                             AsyncFunctionDef_fields, 7,
6290
16
        "AsyncFunctionDef(identifier name, arguments args, stmt* body, expr* decorator_list, expr? returns, string? type_comment, type_param* type_params)");
6291
16
    if (!state->AsyncFunctionDef_type) return -1;
6292
16
    if (PyObject_SetAttr(state->AsyncFunctionDef_type, state->returns, Py_None)
6293
16
        == -1)
6294
0
        return -1;
6295
16
    if (PyObject_SetAttr(state->AsyncFunctionDef_type, state->type_comment,
6296
16
        Py_None) == -1)
6297
0
        return -1;
6298
16
    state->ClassDef_type = make_type(state, "ClassDef", state->stmt_type,
6299
16
                                     ClassDef_fields, 6,
6300
16
        "ClassDef(identifier name, expr* bases, keyword* keywords, stmt* body, expr* decorator_list, type_param* type_params)");
6301
16
    if (!state->ClassDef_type) return -1;
6302
16
    state->Return_type = make_type(state, "Return", state->stmt_type,
6303
16
                                   Return_fields, 1,
6304
16
        "Return(expr? value)");
6305
16
    if (!state->Return_type) return -1;
6306
16
    if (PyObject_SetAttr(state->Return_type, state->value, Py_None) == -1)
6307
0
        return -1;
6308
16
    state->Delete_type = make_type(state, "Delete", state->stmt_type,
6309
16
                                   Delete_fields, 1,
6310
16
        "Delete(expr* targets)");
6311
16
    if (!state->Delete_type) return -1;
6312
16
    state->Assign_type = make_type(state, "Assign", state->stmt_type,
6313
16
                                   Assign_fields, 3,
6314
16
        "Assign(expr* targets, expr value, string? type_comment)");
6315
16
    if (!state->Assign_type) return -1;
6316
16
    if (PyObject_SetAttr(state->Assign_type, state->type_comment, Py_None) ==
6317
16
        -1)
6318
0
        return -1;
6319
16
    state->TypeAlias_type = make_type(state, "TypeAlias", state->stmt_type,
6320
16
                                      TypeAlias_fields, 3,
6321
16
        "TypeAlias(expr name, type_param* type_params, expr value)");
6322
16
    if (!state->TypeAlias_type) return -1;
6323
16
    state->AugAssign_type = make_type(state, "AugAssign", state->stmt_type,
6324
16
                                      AugAssign_fields, 3,
6325
16
        "AugAssign(expr target, operator op, expr value)");
6326
16
    if (!state->AugAssign_type) return -1;
6327
16
    state->AnnAssign_type = make_type(state, "AnnAssign", state->stmt_type,
6328
16
                                      AnnAssign_fields, 4,
6329
16
        "AnnAssign(expr target, expr annotation, expr? value, int simple)");
6330
16
    if (!state->AnnAssign_type) return -1;
6331
16
    if (PyObject_SetAttr(state->AnnAssign_type, state->value, Py_None) == -1)
6332
0
        return -1;
6333
16
    state->For_type = make_type(state, "For", state->stmt_type, For_fields, 5,
6334
16
        "For(expr target, expr iter, stmt* body, stmt* orelse, string? type_comment)");
6335
16
    if (!state->For_type) return -1;
6336
16
    if (PyObject_SetAttr(state->For_type, state->type_comment, Py_None) == -1)
6337
0
        return -1;
6338
16
    state->AsyncFor_type = make_type(state, "AsyncFor", state->stmt_type,
6339
16
                                     AsyncFor_fields, 5,
6340
16
        "AsyncFor(expr target, expr iter, stmt* body, stmt* orelse, string? type_comment)");
6341
16
    if (!state->AsyncFor_type) return -1;
6342
16
    if (PyObject_SetAttr(state->AsyncFor_type, state->type_comment, Py_None) ==
6343
16
        -1)
6344
0
        return -1;
6345
16
    state->While_type = make_type(state, "While", state->stmt_type,
6346
16
                                  While_fields, 3,
6347
16
        "While(expr test, stmt* body, stmt* orelse)");
6348
16
    if (!state->While_type) return -1;
6349
16
    state->If_type = make_type(state, "If", state->stmt_type, If_fields, 3,
6350
16
        "If(expr test, stmt* body, stmt* orelse)");
6351
16
    if (!state->If_type) return -1;
6352
16
    state->With_type = make_type(state, "With", state->stmt_type, With_fields,
6353
16
                                 3,
6354
16
        "With(withitem* items, stmt* body, string? type_comment)");
6355
16
    if (!state->With_type) return -1;
6356
16
    if (PyObject_SetAttr(state->With_type, state->type_comment, Py_None) == -1)
6357
0
        return -1;
6358
16
    state->AsyncWith_type = make_type(state, "AsyncWith", state->stmt_type,
6359
16
                                      AsyncWith_fields, 3,
6360
16
        "AsyncWith(withitem* items, stmt* body, string? type_comment)");
6361
16
    if (!state->AsyncWith_type) return -1;
6362
16
    if (PyObject_SetAttr(state->AsyncWith_type, state->type_comment, Py_None)
6363
16
        == -1)
6364
0
        return -1;
6365
16
    state->Match_type = make_type(state, "Match", state->stmt_type,
6366
16
                                  Match_fields, 2,
6367
16
        "Match(expr subject, match_case* cases)");
6368
16
    if (!state->Match_type) return -1;
6369
16
    state->Raise_type = make_type(state, "Raise", state->stmt_type,
6370
16
                                  Raise_fields, 2,
6371
16
        "Raise(expr? exc, expr? cause)");
6372
16
    if (!state->Raise_type) return -1;
6373
16
    if (PyObject_SetAttr(state->Raise_type, state->exc, Py_None) == -1)
6374
0
        return -1;
6375
16
    if (PyObject_SetAttr(state->Raise_type, state->cause, Py_None) == -1)
6376
0
        return -1;
6377
16
    state->Try_type = make_type(state, "Try", state->stmt_type, Try_fields, 4,
6378
16
        "Try(stmt* body, excepthandler* handlers, stmt* orelse, stmt* finalbody)");
6379
16
    if (!state->Try_type) return -1;
6380
16
    state->TryStar_type = make_type(state, "TryStar", state->stmt_type,
6381
16
                                    TryStar_fields, 4,
6382
16
        "TryStar(stmt* body, excepthandler* handlers, stmt* orelse, stmt* finalbody)");
6383
16
    if (!state->TryStar_type) return -1;
6384
16
    state->Assert_type = make_type(state, "Assert", state->stmt_type,
6385
16
                                   Assert_fields, 2,
6386
16
        "Assert(expr test, expr? msg)");
6387
16
    if (!state->Assert_type) return -1;
6388
16
    if (PyObject_SetAttr(state->Assert_type, state->msg, Py_None) == -1)
6389
0
        return -1;
6390
16
    state->Import_type = make_type(state, "Import", state->stmt_type,
6391
16
                                   Import_fields, 2,
6392
16
        "Import(alias* names, int? is_lazy)");
6393
16
    if (!state->Import_type) return -1;
6394
16
    if (PyObject_SetAttr(state->Import_type, state->is_lazy, Py_None) == -1)
6395
0
        return -1;
6396
16
    state->ImportFrom_type = make_type(state, "ImportFrom", state->stmt_type,
6397
16
                                       ImportFrom_fields, 4,
6398
16
        "ImportFrom(identifier? module, alias* names, int? level, int? is_lazy)");
6399
16
    if (!state->ImportFrom_type) return -1;
6400
16
    if (PyObject_SetAttr(state->ImportFrom_type, state->module, Py_None) == -1)
6401
0
        return -1;
6402
16
    if (PyObject_SetAttr(state->ImportFrom_type, state->level, Py_None) == -1)
6403
0
        return -1;
6404
16
    if (PyObject_SetAttr(state->ImportFrom_type, state->is_lazy, Py_None) == -1)
6405
0
        return -1;
6406
16
    state->Global_type = make_type(state, "Global", state->stmt_type,
6407
16
                                   Global_fields, 1,
6408
16
        "Global(identifier* names)");
6409
16
    if (!state->Global_type) return -1;
6410
16
    state->Nonlocal_type = make_type(state, "Nonlocal", state->stmt_type,
6411
16
                                     Nonlocal_fields, 1,
6412
16
        "Nonlocal(identifier* names)");
6413
16
    if (!state->Nonlocal_type) return -1;
6414
16
    state->Expr_type = make_type(state, "Expr", state->stmt_type, Expr_fields,
6415
16
                                 1,
6416
16
        "Expr(expr value)");
6417
16
    if (!state->Expr_type) return -1;
6418
16
    state->Pass_type = make_type(state, "Pass", state->stmt_type, NULL, 0,
6419
16
        "Pass");
6420
16
    if (!state->Pass_type) return -1;
6421
16
    state->Break_type = make_type(state, "Break", state->stmt_type, NULL, 0,
6422
16
        "Break");
6423
16
    if (!state->Break_type) return -1;
6424
16
    state->Continue_type = make_type(state, "Continue", state->stmt_type, NULL,
6425
16
                                     0,
6426
16
        "Continue");
6427
16
    if (!state->Continue_type) return -1;
6428
16
    state->expr_type = make_type(state, "expr", state->AST_type, NULL, 0,
6429
16
        "expr = BoolOp(boolop op, expr* values)\n"
6430
16
        "     | NamedExpr(expr target, expr value)\n"
6431
16
        "     | BinOp(expr left, operator op, expr right)\n"
6432
16
        "     | UnaryOp(unaryop op, expr operand)\n"
6433
16
        "     | Lambda(arguments args, expr body)\n"
6434
16
        "     | IfExp(expr test, expr body, expr orelse)\n"
6435
16
        "     | Dict(expr?* keys, expr* values)\n"
6436
16
        "     | Set(expr* elts)\n"
6437
16
        "     | ListComp(expr elt, comprehension* generators)\n"
6438
16
        "     | SetComp(expr elt, comprehension* generators)\n"
6439
16
        "     | DictComp(expr key, expr? value, comprehension* generators)\n"
6440
16
        "     | GeneratorExp(expr elt, comprehension* generators)\n"
6441
16
        "     | Await(expr value)\n"
6442
16
        "     | Yield(expr? value)\n"
6443
16
        "     | YieldFrom(expr value)\n"
6444
16
        "     | Compare(expr left, cmpop* ops, expr* comparators)\n"
6445
16
        "     | Call(expr func, expr* args, keyword* keywords)\n"
6446
16
        "     | FormattedValue(expr value, int conversion, expr? format_spec)\n"
6447
16
        "     | Interpolation(expr value, constant str, int conversion, expr? format_spec)\n"
6448
16
        "     | JoinedStr(expr* values)\n"
6449
16
        "     | TemplateStr(expr* values)\n"
6450
16
        "     | Constant(constant value, string? kind)\n"
6451
16
        "     | Attribute(expr value, identifier attr, expr_context ctx)\n"
6452
16
        "     | Subscript(expr value, expr slice, expr_context ctx)\n"
6453
16
        "     | Starred(expr value, expr_context ctx)\n"
6454
16
        "     | Name(identifier id, expr_context ctx)\n"
6455
16
        "     | List(expr* elts, expr_context ctx)\n"
6456
16
        "     | Tuple(expr* elts, expr_context ctx)\n"
6457
16
        "     | Slice(expr? lower, expr? upper, expr? step)");
6458
16
    if (!state->expr_type) return -1;
6459
16
    if (add_attributes(state, state->expr_type, expr_attributes, 4) < 0) return
6460
0
        -1;
6461
16
    if (PyObject_SetAttr(state->expr_type, state->end_lineno, Py_None) == -1)
6462
0
        return -1;
6463
16
    if (PyObject_SetAttr(state->expr_type, state->end_col_offset, Py_None) ==
6464
16
        -1)
6465
0
        return -1;
6466
16
    state->BoolOp_type = make_type(state, "BoolOp", state->expr_type,
6467
16
                                   BoolOp_fields, 2,
6468
16
        "BoolOp(boolop op, expr* values)");
6469
16
    if (!state->BoolOp_type) return -1;
6470
16
    state->NamedExpr_type = make_type(state, "NamedExpr", state->expr_type,
6471
16
                                      NamedExpr_fields, 2,
6472
16
        "NamedExpr(expr target, expr value)");
6473
16
    if (!state->NamedExpr_type) return -1;
6474
16
    state->BinOp_type = make_type(state, "BinOp", state->expr_type,
6475
16
                                  BinOp_fields, 3,
6476
16
        "BinOp(expr left, operator op, expr right)");
6477
16
    if (!state->BinOp_type) return -1;
6478
16
    state->UnaryOp_type = make_type(state, "UnaryOp", state->expr_type,
6479
16
                                    UnaryOp_fields, 2,
6480
16
        "UnaryOp(unaryop op, expr operand)");
6481
16
    if (!state->UnaryOp_type) return -1;
6482
16
    state->Lambda_type = make_type(state, "Lambda", state->expr_type,
6483
16
                                   Lambda_fields, 2,
6484
16
        "Lambda(arguments args, expr body)");
6485
16
    if (!state->Lambda_type) return -1;
6486
16
    state->IfExp_type = make_type(state, "IfExp", state->expr_type,
6487
16
                                  IfExp_fields, 3,
6488
16
        "IfExp(expr test, expr body, expr orelse)");
6489
16
    if (!state->IfExp_type) return -1;
6490
16
    state->Dict_type = make_type(state, "Dict", state->expr_type, Dict_fields,
6491
16
                                 2,
6492
16
        "Dict(expr?* keys, expr* values)");
6493
16
    if (!state->Dict_type) return -1;
6494
16
    state->Set_type = make_type(state, "Set", state->expr_type, Set_fields, 1,
6495
16
        "Set(expr* elts)");
6496
16
    if (!state->Set_type) return -1;
6497
16
    state->ListComp_type = make_type(state, "ListComp", state->expr_type,
6498
16
                                     ListComp_fields, 2,
6499
16
        "ListComp(expr elt, comprehension* generators)");
6500
16
    if (!state->ListComp_type) return -1;
6501
16
    state->SetComp_type = make_type(state, "SetComp", state->expr_type,
6502
16
                                    SetComp_fields, 2,
6503
16
        "SetComp(expr elt, comprehension* generators)");
6504
16
    if (!state->SetComp_type) return -1;
6505
16
    state->DictComp_type = make_type(state, "DictComp", state->expr_type,
6506
16
                                     DictComp_fields, 3,
6507
16
        "DictComp(expr key, expr? value, comprehension* generators)");
6508
16
    if (!state->DictComp_type) return -1;
6509
16
    if (PyObject_SetAttr(state->DictComp_type, state->value, Py_None) == -1)
6510
0
        return -1;
6511
16
    state->GeneratorExp_type = make_type(state, "GeneratorExp",
6512
16
                                         state->expr_type, GeneratorExp_fields,
6513
16
                                         2,
6514
16
        "GeneratorExp(expr elt, comprehension* generators)");
6515
16
    if (!state->GeneratorExp_type) return -1;
6516
16
    state->Await_type = make_type(state, "Await", state->expr_type,
6517
16
                                  Await_fields, 1,
6518
16
        "Await(expr value)");
6519
16
    if (!state->Await_type) return -1;
6520
16
    state->Yield_type = make_type(state, "Yield", state->expr_type,
6521
16
                                  Yield_fields, 1,
6522
16
        "Yield(expr? value)");
6523
16
    if (!state->Yield_type) return -1;
6524
16
    if (PyObject_SetAttr(state->Yield_type, state->value, Py_None) == -1)
6525
0
        return -1;
6526
16
    state->YieldFrom_type = make_type(state, "YieldFrom", state->expr_type,
6527
16
                                      YieldFrom_fields, 1,
6528
16
        "YieldFrom(expr value)");
6529
16
    if (!state->YieldFrom_type) return -1;
6530
16
    state->Compare_type = make_type(state, "Compare", state->expr_type,
6531
16
                                    Compare_fields, 3,
6532
16
        "Compare(expr left, cmpop* ops, expr* comparators)");
6533
16
    if (!state->Compare_type) return -1;
6534
16
    state->Call_type = make_type(state, "Call", state->expr_type, Call_fields,
6535
16
                                 3,
6536
16
        "Call(expr func, expr* args, keyword* keywords)");
6537
16
    if (!state->Call_type) return -1;
6538
16
    state->FormattedValue_type = make_type(state, "FormattedValue",
6539
16
                                           state->expr_type,
6540
16
                                           FormattedValue_fields, 3,
6541
16
        "FormattedValue(expr value, int conversion, expr? format_spec)");
6542
16
    if (!state->FormattedValue_type) return -1;
6543
16
    if (PyObject_SetAttr(state->FormattedValue_type, state->format_spec,
6544
16
        Py_None) == -1)
6545
0
        return -1;
6546
16
    state->Interpolation_type = make_type(state, "Interpolation",
6547
16
                                          state->expr_type,
6548
16
                                          Interpolation_fields, 4,
6549
16
        "Interpolation(expr value, constant str, int conversion, expr? format_spec)");
6550
16
    if (!state->Interpolation_type) return -1;
6551
16
    if (PyObject_SetAttr(state->Interpolation_type, state->format_spec,
6552
16
        Py_None) == -1)
6553
0
        return -1;
6554
16
    state->JoinedStr_type = make_type(state, "JoinedStr", state->expr_type,
6555
16
                                      JoinedStr_fields, 1,
6556
16
        "JoinedStr(expr* values)");
6557
16
    if (!state->JoinedStr_type) return -1;
6558
16
    state->TemplateStr_type = make_type(state, "TemplateStr", state->expr_type,
6559
16
                                        TemplateStr_fields, 1,
6560
16
        "TemplateStr(expr* values)");
6561
16
    if (!state->TemplateStr_type) return -1;
6562
16
    state->Constant_type = make_type(state, "Constant", state->expr_type,
6563
16
                                     Constant_fields, 2,
6564
16
        "Constant(constant value, string? kind)");
6565
16
    if (!state->Constant_type) return -1;
6566
16
    if (PyObject_SetAttr(state->Constant_type, state->kind, Py_None) == -1)
6567
0
        return -1;
6568
16
    state->Attribute_type = make_type(state, "Attribute", state->expr_type,
6569
16
                                      Attribute_fields, 3,
6570
16
        "Attribute(expr value, identifier attr, expr_context ctx)");
6571
16
    if (!state->Attribute_type) return -1;
6572
16
    state->Subscript_type = make_type(state, "Subscript", state->expr_type,
6573
16
                                      Subscript_fields, 3,
6574
16
        "Subscript(expr value, expr slice, expr_context ctx)");
6575
16
    if (!state->Subscript_type) return -1;
6576
16
    state->Starred_type = make_type(state, "Starred", state->expr_type,
6577
16
                                    Starred_fields, 2,
6578
16
        "Starred(expr value, expr_context ctx)");
6579
16
    if (!state->Starred_type) return -1;
6580
16
    state->Name_type = make_type(state, "Name", state->expr_type, Name_fields,
6581
16
                                 2,
6582
16
        "Name(identifier id, expr_context ctx)");
6583
16
    if (!state->Name_type) return -1;
6584
16
    state->List_type = make_type(state, "List", state->expr_type, List_fields,
6585
16
                                 2,
6586
16
        "List(expr* elts, expr_context ctx)");
6587
16
    if (!state->List_type) return -1;
6588
16
    state->Tuple_type = make_type(state, "Tuple", state->expr_type,
6589
16
                                  Tuple_fields, 2,
6590
16
        "Tuple(expr* elts, expr_context ctx)");
6591
16
    if (!state->Tuple_type) return -1;
6592
16
    state->Slice_type = make_type(state, "Slice", state->expr_type,
6593
16
                                  Slice_fields, 3,
6594
16
        "Slice(expr? lower, expr? upper, expr? step)");
6595
16
    if (!state->Slice_type) return -1;
6596
16
    if (PyObject_SetAttr(state->Slice_type, state->lower, Py_None) == -1)
6597
0
        return -1;
6598
16
    if (PyObject_SetAttr(state->Slice_type, state->upper, Py_None) == -1)
6599
0
        return -1;
6600
16
    if (PyObject_SetAttr(state->Slice_type, state->step, Py_None) == -1)
6601
0
        return -1;
6602
16
    state->expr_context_type = make_type(state, "expr_context",
6603
16
                                         state->AST_type, NULL, 0,
6604
16
        "expr_context = Load | Store | Del");
6605
16
    if (!state->expr_context_type) return -1;
6606
16
    if (add_attributes(state, state->expr_context_type, NULL, 0) < 0) return -1;
6607
16
    state->Load_type = make_type(state, "Load", state->expr_context_type, NULL,
6608
16
                                 0,
6609
16
        "Load");
6610
16
    if (!state->Load_type) return -1;
6611
16
    state->Load_singleton = PyType_GenericNew((PyTypeObject *)state->Load_type,
6612
16
                                              NULL, NULL);
6613
16
    if (!state->Load_singleton) return -1;
6614
16
    state->Store_type = make_type(state, "Store", state->expr_context_type,
6615
16
                                  NULL, 0,
6616
16
        "Store");
6617
16
    if (!state->Store_type) return -1;
6618
16
    state->Store_singleton = PyType_GenericNew((PyTypeObject
6619
16
                                               *)state->Store_type, NULL, NULL);
6620
16
    if (!state->Store_singleton) return -1;
6621
16
    state->Del_type = make_type(state, "Del", state->expr_context_type, NULL, 0,
6622
16
        "Del");
6623
16
    if (!state->Del_type) return -1;
6624
16
    state->Del_singleton = PyType_GenericNew((PyTypeObject *)state->Del_type,
6625
16
                                             NULL, NULL);
6626
16
    if (!state->Del_singleton) return -1;
6627
16
    state->boolop_type = make_type(state, "boolop", state->AST_type, NULL, 0,
6628
16
        "boolop = And | Or");
6629
16
    if (!state->boolop_type) return -1;
6630
16
    if (add_attributes(state, state->boolop_type, NULL, 0) < 0) return -1;
6631
16
    state->And_type = make_type(state, "And", state->boolop_type, NULL, 0,
6632
16
        "And");
6633
16
    if (!state->And_type) return -1;
6634
16
    state->And_singleton = PyType_GenericNew((PyTypeObject *)state->And_type,
6635
16
                                             NULL, NULL);
6636
16
    if (!state->And_singleton) return -1;
6637
16
    state->Or_type = make_type(state, "Or", state->boolop_type, NULL, 0,
6638
16
        "Or");
6639
16
    if (!state->Or_type) return -1;
6640
16
    state->Or_singleton = PyType_GenericNew((PyTypeObject *)state->Or_type,
6641
16
                                            NULL, NULL);
6642
16
    if (!state->Or_singleton) return -1;
6643
16
    state->operator_type = make_type(state, "operator", state->AST_type, NULL,
6644
16
                                     0,
6645
16
        "operator = Add | Sub | Mult | MatMult | Div | Mod | Pow | LShift | RShift | BitOr | BitXor | BitAnd | FloorDiv");
6646
16
    if (!state->operator_type) return -1;
6647
16
    if (add_attributes(state, state->operator_type, NULL, 0) < 0) return -1;
6648
16
    state->Add_type = make_type(state, "Add", state->operator_type, NULL, 0,
6649
16
        "Add");
6650
16
    if (!state->Add_type) return -1;
6651
16
    state->Add_singleton = PyType_GenericNew((PyTypeObject *)state->Add_type,
6652
16
                                             NULL, NULL);
6653
16
    if (!state->Add_singleton) return -1;
6654
16
    state->Sub_type = make_type(state, "Sub", state->operator_type, NULL, 0,
6655
16
        "Sub");
6656
16
    if (!state->Sub_type) return -1;
6657
16
    state->Sub_singleton = PyType_GenericNew((PyTypeObject *)state->Sub_type,
6658
16
                                             NULL, NULL);
6659
16
    if (!state->Sub_singleton) return -1;
6660
16
    state->Mult_type = make_type(state, "Mult", state->operator_type, NULL, 0,
6661
16
        "Mult");
6662
16
    if (!state->Mult_type) return -1;
6663
16
    state->Mult_singleton = PyType_GenericNew((PyTypeObject *)state->Mult_type,
6664
16
                                              NULL, NULL);
6665
16
    if (!state->Mult_singleton) return -1;
6666
16
    state->MatMult_type = make_type(state, "MatMult", state->operator_type,
6667
16
                                    NULL, 0,
6668
16
        "MatMult");
6669
16
    if (!state->MatMult_type) return -1;
6670
16
    state->MatMult_singleton = PyType_GenericNew((PyTypeObject
6671
16
                                                 *)state->MatMult_type, NULL,
6672
16
                                                 NULL);
6673
16
    if (!state->MatMult_singleton) return -1;
6674
16
    state->Div_type = make_type(state, "Div", state->operator_type, NULL, 0,
6675
16
        "Div");
6676
16
    if (!state->Div_type) return -1;
6677
16
    state->Div_singleton = PyType_GenericNew((PyTypeObject *)state->Div_type,
6678
16
                                             NULL, NULL);
6679
16
    if (!state->Div_singleton) return -1;
6680
16
    state->Mod_type = make_type(state, "Mod", state->operator_type, NULL, 0,
6681
16
        "Mod");
6682
16
    if (!state->Mod_type) return -1;
6683
16
    state->Mod_singleton = PyType_GenericNew((PyTypeObject *)state->Mod_type,
6684
16
                                             NULL, NULL);
6685
16
    if (!state->Mod_singleton) return -1;
6686
16
    state->Pow_type = make_type(state, "Pow", state->operator_type, NULL, 0,
6687
16
        "Pow");
6688
16
    if (!state->Pow_type) return -1;
6689
16
    state->Pow_singleton = PyType_GenericNew((PyTypeObject *)state->Pow_type,
6690
16
                                             NULL, NULL);
6691
16
    if (!state->Pow_singleton) return -1;
6692
16
    state->LShift_type = make_type(state, "LShift", state->operator_type, NULL,
6693
16
                                   0,
6694
16
        "LShift");
6695
16
    if (!state->LShift_type) return -1;
6696
16
    state->LShift_singleton = PyType_GenericNew((PyTypeObject
6697
16
                                                *)state->LShift_type, NULL,
6698
16
                                                NULL);
6699
16
    if (!state->LShift_singleton) return -1;
6700
16
    state->RShift_type = make_type(state, "RShift", state->operator_type, NULL,
6701
16
                                   0,
6702
16
        "RShift");
6703
16
    if (!state->RShift_type) return -1;
6704
16
    state->RShift_singleton = PyType_GenericNew((PyTypeObject
6705
16
                                                *)state->RShift_type, NULL,
6706
16
                                                NULL);
6707
16
    if (!state->RShift_singleton) return -1;
6708
16
    state->BitOr_type = make_type(state, "BitOr", state->operator_type, NULL, 0,
6709
16
        "BitOr");
6710
16
    if (!state->BitOr_type) return -1;
6711
16
    state->BitOr_singleton = PyType_GenericNew((PyTypeObject
6712
16
                                               *)state->BitOr_type, NULL, NULL);
6713
16
    if (!state->BitOr_singleton) return -1;
6714
16
    state->BitXor_type = make_type(state, "BitXor", state->operator_type, NULL,
6715
16
                                   0,
6716
16
        "BitXor");
6717
16
    if (!state->BitXor_type) return -1;
6718
16
    state->BitXor_singleton = PyType_GenericNew((PyTypeObject
6719
16
                                                *)state->BitXor_type, NULL,
6720
16
                                                NULL);
6721
16
    if (!state->BitXor_singleton) return -1;
6722
16
    state->BitAnd_type = make_type(state, "BitAnd", state->operator_type, NULL,
6723
16
                                   0,
6724
16
        "BitAnd");
6725
16
    if (!state->BitAnd_type) return -1;
6726
16
    state->BitAnd_singleton = PyType_GenericNew((PyTypeObject
6727
16
                                                *)state->BitAnd_type, NULL,
6728
16
                                                NULL);
6729
16
    if (!state->BitAnd_singleton) return -1;
6730
16
    state->FloorDiv_type = make_type(state, "FloorDiv", state->operator_type,
6731
16
                                     NULL, 0,
6732
16
        "FloorDiv");
6733
16
    if (!state->FloorDiv_type) return -1;
6734
16
    state->FloorDiv_singleton = PyType_GenericNew((PyTypeObject
6735
16
                                                  *)state->FloorDiv_type, NULL,
6736
16
                                                  NULL);
6737
16
    if (!state->FloorDiv_singleton) return -1;
6738
16
    state->unaryop_type = make_type(state, "unaryop", state->AST_type, NULL, 0,
6739
16
        "unaryop = Invert | Not | UAdd | USub");
6740
16
    if (!state->unaryop_type) return -1;
6741
16
    if (add_attributes(state, state->unaryop_type, NULL, 0) < 0) return -1;
6742
16
    state->Invert_type = make_type(state, "Invert", state->unaryop_type, NULL,
6743
16
                                   0,
6744
16
        "Invert");
6745
16
    if (!state->Invert_type) return -1;
6746
16
    state->Invert_singleton = PyType_GenericNew((PyTypeObject
6747
16
                                                *)state->Invert_type, NULL,
6748
16
                                                NULL);
6749
16
    if (!state->Invert_singleton) return -1;
6750
16
    state->Not_type = make_type(state, "Not", state->unaryop_type, NULL, 0,
6751
16
        "Not");
6752
16
    if (!state->Not_type) return -1;
6753
16
    state->Not_singleton = PyType_GenericNew((PyTypeObject *)state->Not_type,
6754
16
                                             NULL, NULL);
6755
16
    if (!state->Not_singleton) return -1;
6756
16
    state->UAdd_type = make_type(state, "UAdd", state->unaryop_type, NULL, 0,
6757
16
        "UAdd");
6758
16
    if (!state->UAdd_type) return -1;
6759
16
    state->UAdd_singleton = PyType_GenericNew((PyTypeObject *)state->UAdd_type,
6760
16
                                              NULL, NULL);
6761
16
    if (!state->UAdd_singleton) return -1;
6762
16
    state->USub_type = make_type(state, "USub", state->unaryop_type, NULL, 0,
6763
16
        "USub");
6764
16
    if (!state->USub_type) return -1;
6765
16
    state->USub_singleton = PyType_GenericNew((PyTypeObject *)state->USub_type,
6766
16
                                              NULL, NULL);
6767
16
    if (!state->USub_singleton) return -1;
6768
16
    state->cmpop_type = make_type(state, "cmpop", state->AST_type, NULL, 0,
6769
16
        "cmpop = Eq | NotEq | Lt | LtE | Gt | GtE | Is | IsNot | In | NotIn");
6770
16
    if (!state->cmpop_type) return -1;
6771
16
    if (add_attributes(state, state->cmpop_type, NULL, 0) < 0) return -1;
6772
16
    state->Eq_type = make_type(state, "Eq", state->cmpop_type, NULL, 0,
6773
16
        "Eq");
6774
16
    if (!state->Eq_type) return -1;
6775
16
    state->Eq_singleton = PyType_GenericNew((PyTypeObject *)state->Eq_type,
6776
16
                                            NULL, NULL);
6777
16
    if (!state->Eq_singleton) return -1;
6778
16
    state->NotEq_type = make_type(state, "NotEq", state->cmpop_type, NULL, 0,
6779
16
        "NotEq");
6780
16
    if (!state->NotEq_type) return -1;
6781
16
    state->NotEq_singleton = PyType_GenericNew((PyTypeObject
6782
16
                                               *)state->NotEq_type, NULL, NULL);
6783
16
    if (!state->NotEq_singleton) return -1;
6784
16
    state->Lt_type = make_type(state, "Lt", state->cmpop_type, NULL, 0,
6785
16
        "Lt");
6786
16
    if (!state->Lt_type) return -1;
6787
16
    state->Lt_singleton = PyType_GenericNew((PyTypeObject *)state->Lt_type,
6788
16
                                            NULL, NULL);
6789
16
    if (!state->Lt_singleton) return -1;
6790
16
    state->LtE_type = make_type(state, "LtE", state->cmpop_type, NULL, 0,
6791
16
        "LtE");
6792
16
    if (!state->LtE_type) return -1;
6793
16
    state->LtE_singleton = PyType_GenericNew((PyTypeObject *)state->LtE_type,
6794
16
                                             NULL, NULL);
6795
16
    if (!state->LtE_singleton) return -1;
6796
16
    state->Gt_type = make_type(state, "Gt", state->cmpop_type, NULL, 0,
6797
16
        "Gt");
6798
16
    if (!state->Gt_type) return -1;
6799
16
    state->Gt_singleton = PyType_GenericNew((PyTypeObject *)state->Gt_type,
6800
16
                                            NULL, NULL);
6801
16
    if (!state->Gt_singleton) return -1;
6802
16
    state->GtE_type = make_type(state, "GtE", state->cmpop_type, NULL, 0,
6803
16
        "GtE");
6804
16
    if (!state->GtE_type) return -1;
6805
16
    state->GtE_singleton = PyType_GenericNew((PyTypeObject *)state->GtE_type,
6806
16
                                             NULL, NULL);
6807
16
    if (!state->GtE_singleton) return -1;
6808
16
    state->Is_type = make_type(state, "Is", state->cmpop_type, NULL, 0,
6809
16
        "Is");
6810
16
    if (!state->Is_type) return -1;
6811
16
    state->Is_singleton = PyType_GenericNew((PyTypeObject *)state->Is_type,
6812
16
                                            NULL, NULL);
6813
16
    if (!state->Is_singleton) return -1;
6814
16
    state->IsNot_type = make_type(state, "IsNot", state->cmpop_type, NULL, 0,
6815
16
        "IsNot");
6816
16
    if (!state->IsNot_type) return -1;
6817
16
    state->IsNot_singleton = PyType_GenericNew((PyTypeObject
6818
16
                                               *)state->IsNot_type, NULL, NULL);
6819
16
    if (!state->IsNot_singleton) return -1;
6820
16
    state->In_type = make_type(state, "In", state->cmpop_type, NULL, 0,
6821
16
        "In");
6822
16
    if (!state->In_type) return -1;
6823
16
    state->In_singleton = PyType_GenericNew((PyTypeObject *)state->In_type,
6824
16
                                            NULL, NULL);
6825
16
    if (!state->In_singleton) return -1;
6826
16
    state->NotIn_type = make_type(state, "NotIn", state->cmpop_type, NULL, 0,
6827
16
        "NotIn");
6828
16
    if (!state->NotIn_type) return -1;
6829
16
    state->NotIn_singleton = PyType_GenericNew((PyTypeObject
6830
16
                                               *)state->NotIn_type, NULL, NULL);
6831
16
    if (!state->NotIn_singleton) return -1;
6832
16
    state->comprehension_type = make_type(state, "comprehension",
6833
16
                                          state->AST_type,
6834
16
                                          comprehension_fields, 4,
6835
16
        "comprehension(expr target, expr iter, expr* ifs, int is_async)");
6836
16
    if (!state->comprehension_type) return -1;
6837
16
    if (add_attributes(state, state->comprehension_type, NULL, 0) < 0) return
6838
0
        -1;
6839
16
    state->excepthandler_type = make_type(state, "excepthandler",
6840
16
                                          state->AST_type, NULL, 0,
6841
16
        "excepthandler = ExceptHandler(expr? type, identifier? name, stmt* body)");
6842
16
    if (!state->excepthandler_type) return -1;
6843
16
    if (add_attributes(state, state->excepthandler_type,
6844
16
        excepthandler_attributes, 4) < 0) return -1;
6845
16
    if (PyObject_SetAttr(state->excepthandler_type, state->end_lineno, Py_None)
6846
16
        == -1)
6847
0
        return -1;
6848
16
    if (PyObject_SetAttr(state->excepthandler_type, state->end_col_offset,
6849
16
        Py_None) == -1)
6850
0
        return -1;
6851
16
    state->ExceptHandler_type = make_type(state, "ExceptHandler",
6852
16
                                          state->excepthandler_type,
6853
16
                                          ExceptHandler_fields, 3,
6854
16
        "ExceptHandler(expr? type, identifier? name, stmt* body)");
6855
16
    if (!state->ExceptHandler_type) return -1;
6856
16
    if (PyObject_SetAttr(state->ExceptHandler_type, state->type, Py_None) == -1)
6857
0
        return -1;
6858
16
    if (PyObject_SetAttr(state->ExceptHandler_type, state->name, Py_None) == -1)
6859
0
        return -1;
6860
16
    state->arguments_type = make_type(state, "arguments", state->AST_type,
6861
16
                                      arguments_fields, 7,
6862
16
        "arguments(arg* posonlyargs, arg* args, arg? vararg, arg* kwonlyargs, expr?* kw_defaults, arg? kwarg, expr* defaults)");
6863
16
    if (!state->arguments_type) return -1;
6864
16
    if (add_attributes(state, state->arguments_type, NULL, 0) < 0) return -1;
6865
16
    if (PyObject_SetAttr(state->arguments_type, state->vararg, Py_None) == -1)
6866
0
        return -1;
6867
16
    if (PyObject_SetAttr(state->arguments_type, state->kwarg, Py_None) == -1)
6868
0
        return -1;
6869
16
    state->arg_type = make_type(state, "arg", state->AST_type, arg_fields, 3,
6870
16
        "arg(identifier arg, expr? annotation, string? type_comment)");
6871
16
    if (!state->arg_type) return -1;
6872
16
    if (add_attributes(state, state->arg_type, arg_attributes, 4) < 0) return
6873
0
        -1;
6874
16
    if (PyObject_SetAttr(state->arg_type, state->annotation, Py_None) == -1)
6875
0
        return -1;
6876
16
    if (PyObject_SetAttr(state->arg_type, state->type_comment, Py_None) == -1)
6877
0
        return -1;
6878
16
    if (PyObject_SetAttr(state->arg_type, state->end_lineno, Py_None) == -1)
6879
0
        return -1;
6880
16
    if (PyObject_SetAttr(state->arg_type, state->end_col_offset, Py_None) == -1)
6881
0
        return -1;
6882
16
    state->keyword_type = make_type(state, "keyword", state->AST_type,
6883
16
                                    keyword_fields, 2,
6884
16
        "keyword(identifier? arg, expr value)");
6885
16
    if (!state->keyword_type) return -1;
6886
16
    if (add_attributes(state, state->keyword_type, keyword_attributes, 4) < 0)
6887
0
        return -1;
6888
16
    if (PyObject_SetAttr(state->keyword_type, state->arg, Py_None) == -1)
6889
0
        return -1;
6890
16
    if (PyObject_SetAttr(state->keyword_type, state->end_lineno, Py_None) == -1)
6891
0
        return -1;
6892
16
    if (PyObject_SetAttr(state->keyword_type, state->end_col_offset, Py_None)
6893
16
        == -1)
6894
0
        return -1;
6895
16
    state->alias_type = make_type(state, "alias", state->AST_type,
6896
16
                                  alias_fields, 2,
6897
16
        "alias(identifier name, identifier? asname)");
6898
16
    if (!state->alias_type) return -1;
6899
16
    if (add_attributes(state, state->alias_type, alias_attributes, 4) < 0)
6900
0
        return -1;
6901
16
    if (PyObject_SetAttr(state->alias_type, state->asname, Py_None) == -1)
6902
0
        return -1;
6903
16
    if (PyObject_SetAttr(state->alias_type, state->end_lineno, Py_None) == -1)
6904
0
        return -1;
6905
16
    if (PyObject_SetAttr(state->alias_type, state->end_col_offset, Py_None) ==
6906
16
        -1)
6907
0
        return -1;
6908
16
    state->withitem_type = make_type(state, "withitem", state->AST_type,
6909
16
                                     withitem_fields, 2,
6910
16
        "withitem(expr context_expr, expr? optional_vars)");
6911
16
    if (!state->withitem_type) return -1;
6912
16
    if (add_attributes(state, state->withitem_type, NULL, 0) < 0) return -1;
6913
16
    if (PyObject_SetAttr(state->withitem_type, state->optional_vars, Py_None)
6914
16
        == -1)
6915
0
        return -1;
6916
16
    state->match_case_type = make_type(state, "match_case", state->AST_type,
6917
16
                                       match_case_fields, 3,
6918
16
        "match_case(pattern pattern, expr? guard, stmt* body)");
6919
16
    if (!state->match_case_type) return -1;
6920
16
    if (add_attributes(state, state->match_case_type, NULL, 0) < 0) return -1;
6921
16
    if (PyObject_SetAttr(state->match_case_type, state->guard, Py_None) == -1)
6922
0
        return -1;
6923
16
    state->pattern_type = make_type(state, "pattern", state->AST_type, NULL, 0,
6924
16
        "pattern = MatchValue(expr value)\n"
6925
16
        "        | MatchSingleton(constant value)\n"
6926
16
        "        | MatchSequence(pattern* patterns)\n"
6927
16
        "        | MatchMapping(expr* keys, pattern* patterns, identifier? rest)\n"
6928
16
        "        | MatchClass(expr cls, pattern* patterns, identifier* kwd_attrs, pattern* kwd_patterns)\n"
6929
16
        "        | MatchStar(identifier? name)\n"
6930
16
        "        | MatchAs(pattern? pattern, identifier? name)\n"
6931
16
        "        | MatchOr(pattern* patterns)");
6932
16
    if (!state->pattern_type) return -1;
6933
16
    if (add_attributes(state, state->pattern_type, pattern_attributes, 4) < 0)
6934
0
        return -1;
6935
16
    state->MatchValue_type = make_type(state, "MatchValue",
6936
16
                                       state->pattern_type, MatchValue_fields,
6937
16
                                       1,
6938
16
        "MatchValue(expr value)");
6939
16
    if (!state->MatchValue_type) return -1;
6940
16
    state->MatchSingleton_type = make_type(state, "MatchSingleton",
6941
16
                                           state->pattern_type,
6942
16
                                           MatchSingleton_fields, 1,
6943
16
        "MatchSingleton(constant value)");
6944
16
    if (!state->MatchSingleton_type) return -1;
6945
16
    state->MatchSequence_type = make_type(state, "MatchSequence",
6946
16
                                          state->pattern_type,
6947
16
                                          MatchSequence_fields, 1,
6948
16
        "MatchSequence(pattern* patterns)");
6949
16
    if (!state->MatchSequence_type) return -1;
6950
16
    state->MatchMapping_type = make_type(state, "MatchMapping",
6951
16
                                         state->pattern_type,
6952
16
                                         MatchMapping_fields, 3,
6953
16
        "MatchMapping(expr* keys, pattern* patterns, identifier? rest)");
6954
16
    if (!state->MatchMapping_type) return -1;
6955
16
    if (PyObject_SetAttr(state->MatchMapping_type, state->rest, Py_None) == -1)
6956
0
        return -1;
6957
16
    state->MatchClass_type = make_type(state, "MatchClass",
6958
16
                                       state->pattern_type, MatchClass_fields,
6959
16
                                       4,
6960
16
        "MatchClass(expr cls, pattern* patterns, identifier* kwd_attrs, pattern* kwd_patterns)");
6961
16
    if (!state->MatchClass_type) return -1;
6962
16
    state->MatchStar_type = make_type(state, "MatchStar", state->pattern_type,
6963
16
                                      MatchStar_fields, 1,
6964
16
        "MatchStar(identifier? name)");
6965
16
    if (!state->MatchStar_type) return -1;
6966
16
    if (PyObject_SetAttr(state->MatchStar_type, state->name, Py_None) == -1)
6967
0
        return -1;
6968
16
    state->MatchAs_type = make_type(state, "MatchAs", state->pattern_type,
6969
16
                                    MatchAs_fields, 2,
6970
16
        "MatchAs(pattern? pattern, identifier? name)");
6971
16
    if (!state->MatchAs_type) return -1;
6972
16
    if (PyObject_SetAttr(state->MatchAs_type, state->pattern, Py_None) == -1)
6973
0
        return -1;
6974
16
    if (PyObject_SetAttr(state->MatchAs_type, state->name, Py_None) == -1)
6975
0
        return -1;
6976
16
    state->MatchOr_type = make_type(state, "MatchOr", state->pattern_type,
6977
16
                                    MatchOr_fields, 1,
6978
16
        "MatchOr(pattern* patterns)");
6979
16
    if (!state->MatchOr_type) return -1;
6980
16
    state->type_ignore_type = make_type(state, "type_ignore", state->AST_type,
6981
16
                                        NULL, 0,
6982
16
        "type_ignore = TypeIgnore(int lineno, string tag)");
6983
16
    if (!state->type_ignore_type) return -1;
6984
16
    if (add_attributes(state, state->type_ignore_type, NULL, 0) < 0) return -1;
6985
16
    state->TypeIgnore_type = make_type(state, "TypeIgnore",
6986
16
                                       state->type_ignore_type,
6987
16
                                       TypeIgnore_fields, 2,
6988
16
        "TypeIgnore(int lineno, string tag)");
6989
16
    if (!state->TypeIgnore_type) return -1;
6990
16
    state->type_param_type = make_type(state, "type_param", state->AST_type,
6991
16
                                       NULL, 0,
6992
16
        "type_param = TypeVar(identifier name, expr? bound, expr? default_value)\n"
6993
16
        "           | ParamSpec(identifier name, expr? default_value)\n"
6994
16
        "           | TypeVarTuple(identifier name, expr? default_value)");
6995
16
    if (!state->type_param_type) return -1;
6996
16
    if (add_attributes(state, state->type_param_type, type_param_attributes, 4)
6997
16
        < 0) return -1;
6998
16
    state->TypeVar_type = make_type(state, "TypeVar", state->type_param_type,
6999
16
                                    TypeVar_fields, 3,
7000
16
        "TypeVar(identifier name, expr? bound, expr? default_value)");
7001
16
    if (!state->TypeVar_type) return -1;
7002
16
    if (PyObject_SetAttr(state->TypeVar_type, state->bound, Py_None) == -1)
7003
0
        return -1;
7004
16
    if (PyObject_SetAttr(state->TypeVar_type, state->default_value, Py_None) ==
7005
16
        -1)
7006
0
        return -1;
7007
16
    state->ParamSpec_type = make_type(state, "ParamSpec",
7008
16
                                      state->type_param_type, ParamSpec_fields,
7009
16
                                      2,
7010
16
        "ParamSpec(identifier name, expr? default_value)");
7011
16
    if (!state->ParamSpec_type) return -1;
7012
16
    if (PyObject_SetAttr(state->ParamSpec_type, state->default_value, Py_None)
7013
16
        == -1)
7014
0
        return -1;
7015
16
    state->TypeVarTuple_type = make_type(state, "TypeVarTuple",
7016
16
                                         state->type_param_type,
7017
16
                                         TypeVarTuple_fields, 2,
7018
16
        "TypeVarTuple(identifier name, expr? default_value)");
7019
16
    if (!state->TypeVarTuple_type) return -1;
7020
16
    if (PyObject_SetAttr(state->TypeVarTuple_type, state->default_value,
7021
16
        Py_None) == -1)
7022
0
        return -1;
7023
7024
16
    if (!add_ast_annotations(state)) {
7025
0
        return -1;
7026
0
    }
7027
16
    return 0;
7028
16
}
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
6.73k
{
7073
6.73k
    mod_ty p;
7074
6.73k
    p = (mod_ty)_PyArena_Malloc(arena, sizeof(*p));
7075
6.73k
    if (!p)
7076
0
        return NULL;
7077
6.73k
    p->kind = Module_kind;
7078
6.73k
    p->v.Module.body = body;
7079
6.73k
    p->v.Module.type_ignores = type_ignores;
7080
6.73k
    return p;
7081
6.73k
}
7082
7083
mod_ty
7084
_PyAST_Interactive(asdl_stmt_seq * body, PyArena *arena)
7085
0
{
7086
0
    mod_ty p;
7087
0
    p = (mod_ty)_PyArena_Malloc(arena, sizeof(*p));
7088
0
    if (!p)
7089
0
        return NULL;
7090
0
    p->kind = Interactive_kind;
7091
0
    p->v.Interactive.body = body;
7092
0
    return p;
7093
0
}
7094
7095
mod_ty
7096
_PyAST_Expression(expr_ty body, PyArena *arena)
7097
251
{
7098
251
    mod_ty p;
7099
251
    if (!body) {
7100
0
        PyErr_SetString(PyExc_ValueError,
7101
0
                        "field 'body' is required for Expression");
7102
0
        return NULL;
7103
0
    }
7104
251
    p = (mod_ty)_PyArena_Malloc(arena, sizeof(*p));
7105
251
    if (!p)
7106
0
        return NULL;
7107
251
    p->kind = Expression_kind;
7108
251
    p->v.Expression.body = body;
7109
251
    return p;
7110
251
}
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
7.02k
{
7137
7.02k
    stmt_ty p;
7138
7.02k
    if (!name) {
7139
0
        PyErr_SetString(PyExc_ValueError,
7140
0
                        "field 'name' is required for FunctionDef");
7141
0
        return NULL;
7142
0
    }
7143
7.02k
    if (!args) {
7144
0
        PyErr_SetString(PyExc_ValueError,
7145
0
                        "field 'args' is required for FunctionDef");
7146
0
        return NULL;
7147
0
    }
7148
7.02k
    p = (stmt_ty)_PyArena_Malloc(arena, sizeof(*p));
7149
7.02k
    if (!p)
7150
0
        return NULL;
7151
7.02k
    p->kind = FunctionDef_kind;
7152
7.02k
    p->v.FunctionDef.name = name;
7153
7.02k
    p->v.FunctionDef.args = args;
7154
7.02k
    p->v.FunctionDef.body = body;
7155
7.02k
    p->v.FunctionDef.decorator_list = decorator_list;
7156
7.02k
    p->v.FunctionDef.returns = returns;
7157
7.02k
    p->v.FunctionDef.type_comment = type_comment;
7158
7.02k
    p->v.FunctionDef.type_params = type_params;
7159
7.02k
    p->lineno = lineno;
7160
7.02k
    p->col_offset = col_offset;
7161
7.02k
    p->end_lineno = end_lineno;
7162
7.02k
    p->end_col_offset = end_col_offset;
7163
7.02k
    return p;
7164
7.02k
}
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
638
{
7173
638
    stmt_ty p;
7174
638
    if (!name) {
7175
0
        PyErr_SetString(PyExc_ValueError,
7176
0
                        "field 'name' is required for AsyncFunctionDef");
7177
0
        return NULL;
7178
0
    }
7179
638
    if (!args) {
7180
0
        PyErr_SetString(PyExc_ValueError,
7181
0
                        "field 'args' is required for AsyncFunctionDef");
7182
0
        return NULL;
7183
0
    }
7184
638
    p = (stmt_ty)_PyArena_Malloc(arena, sizeof(*p));
7185
638
    if (!p)
7186
0
        return NULL;
7187
638
    p->kind = AsyncFunctionDef_kind;
7188
638
    p->v.AsyncFunctionDef.name = name;
7189
638
    p->v.AsyncFunctionDef.args = args;
7190
638
    p->v.AsyncFunctionDef.body = body;
7191
638
    p->v.AsyncFunctionDef.decorator_list = decorator_list;
7192
638
    p->v.AsyncFunctionDef.returns = returns;
7193
638
    p->v.AsyncFunctionDef.type_comment = type_comment;
7194
638
    p->v.AsyncFunctionDef.type_params = type_params;
7195
638
    p->lineno = lineno;
7196
638
    p->col_offset = col_offset;
7197
638
    p->end_lineno = end_lineno;
7198
638
    p->end_col_offset = end_col_offset;
7199
638
    return p;
7200
638
}
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
3.13k
{
7208
3.13k
    stmt_ty p;
7209
3.13k
    if (!name) {
7210
0
        PyErr_SetString(PyExc_ValueError,
7211
0
                        "field 'name' is required for ClassDef");
7212
0
        return NULL;
7213
0
    }
7214
3.13k
    p = (stmt_ty)_PyArena_Malloc(arena, sizeof(*p));
7215
3.13k
    if (!p)
7216
0
        return NULL;
7217
3.13k
    p->kind = ClassDef_kind;
7218
3.13k
    p->v.ClassDef.name = name;
7219
3.13k
    p->v.ClassDef.bases = bases;
7220
3.13k
    p->v.ClassDef.keywords = keywords;
7221
3.13k
    p->v.ClassDef.body = body;
7222
3.13k
    p->v.ClassDef.decorator_list = decorator_list;
7223
3.13k
    p->v.ClassDef.type_params = type_params;
7224
3.13k
    p->lineno = lineno;
7225
3.13k
    p->col_offset = col_offset;
7226
3.13k
    p->end_lineno = end_lineno;
7227
3.13k
    p->end_col_offset = end_col_offset;
7228
3.13k
    return p;
7229
3.13k
}
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
3.46k
{
7235
3.46k
    stmt_ty p;
7236
3.46k
    p = (stmt_ty)_PyArena_Malloc(arena, sizeof(*p));
7237
3.46k
    if (!p)
7238
0
        return NULL;
7239
3.46k
    p->kind = Return_kind;
7240
3.46k
    p->v.Return.value = value;
7241
3.46k
    p->lineno = lineno;
7242
3.46k
    p->col_offset = col_offset;
7243
3.46k
    p->end_lineno = end_lineno;
7244
3.46k
    p->end_col_offset = end_col_offset;
7245
3.46k
    return p;
7246
3.46k
}
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
566
{
7252
566
    stmt_ty p;
7253
566
    p = (stmt_ty)_PyArena_Malloc(arena, sizeof(*p));
7254
566
    if (!p)
7255
0
        return NULL;
7256
566
    p->kind = Delete_kind;
7257
566
    p->v.Delete.targets = targets;
7258
566
    p->lineno = lineno;
7259
566
    p->col_offset = col_offset;
7260
566
    p->end_lineno = end_lineno;
7261
566
    p->end_col_offset = end_col_offset;
7262
566
    return p;
7263
566
}
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
6.49k
{
7270
6.49k
    stmt_ty p;
7271
6.49k
    if (!value) {
7272
0
        PyErr_SetString(PyExc_ValueError,
7273
0
                        "field 'value' is required for Assign");
7274
0
        return NULL;
7275
0
    }
7276
6.49k
    p = (stmt_ty)_PyArena_Malloc(arena, sizeof(*p));
7277
6.49k
    if (!p)
7278
0
        return NULL;
7279
6.49k
    p->kind = Assign_kind;
7280
6.49k
    p->v.Assign.targets = targets;
7281
6.49k
    p->v.Assign.value = value;
7282
6.49k
    p->v.Assign.type_comment = type_comment;
7283
6.49k
    p->lineno = lineno;
7284
6.49k
    p->col_offset = col_offset;
7285
6.49k
    p->end_lineno = end_lineno;
7286
6.49k
    p->end_col_offset = end_col_offset;
7287
6.49k
    return p;
7288
6.49k
}
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
264
{
7295
264
    stmt_ty p;
7296
264
    if (!name) {
7297
0
        PyErr_SetString(PyExc_ValueError,
7298
0
                        "field 'name' is required for TypeAlias");
7299
0
        return NULL;
7300
0
    }
7301
264
    if (!value) {
7302
0
        PyErr_SetString(PyExc_ValueError,
7303
0
                        "field 'value' is required for TypeAlias");
7304
0
        return NULL;
7305
0
    }
7306
264
    p = (stmt_ty)_PyArena_Malloc(arena, sizeof(*p));
7307
264
    if (!p)
7308
0
        return NULL;
7309
264
    p->kind = TypeAlias_kind;
7310
264
    p->v.TypeAlias.name = name;
7311
264
    p->v.TypeAlias.type_params = type_params;
7312
264
    p->v.TypeAlias.value = value;
7313
264
    p->lineno = lineno;
7314
264
    p->col_offset = col_offset;
7315
264
    p->end_lineno = end_lineno;
7316
264
    p->end_col_offset = end_col_offset;
7317
264
    return p;
7318
264
}
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
2.29k
{
7324
2.29k
    stmt_ty p;
7325
2.29k
    if (!target) {
7326
0
        PyErr_SetString(PyExc_ValueError,
7327
0
                        "field 'target' is required for AugAssign");
7328
0
        return NULL;
7329
0
    }
7330
2.29k
    if (!op) {
7331
0
        PyErr_SetString(PyExc_ValueError,
7332
0
                        "field 'op' is required for AugAssign");
7333
0
        return NULL;
7334
0
    }
7335
2.29k
    if (!value) {
7336
0
        PyErr_SetString(PyExc_ValueError,
7337
0
                        "field 'value' is required for AugAssign");
7338
0
        return NULL;
7339
0
    }
7340
2.29k
    p = (stmt_ty)_PyArena_Malloc(arena, sizeof(*p));
7341
2.29k
    if (!p)
7342
0
        return NULL;
7343
2.29k
    p->kind = AugAssign_kind;
7344
2.29k
    p->v.AugAssign.target = target;
7345
2.29k
    p->v.AugAssign.op = op;
7346
2.29k
    p->v.AugAssign.value = value;
7347
2.29k
    p->lineno = lineno;
7348
2.29k
    p->col_offset = col_offset;
7349
2.29k
    p->end_lineno = end_lineno;
7350
2.29k
    p->end_col_offset = end_col_offset;
7351
2.29k
    return p;
7352
2.29k
}
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
2.98k
{
7359
2.98k
    stmt_ty p;
7360
2.98k
    if (!target) {
7361
0
        PyErr_SetString(PyExc_ValueError,
7362
0
                        "field 'target' is required for AnnAssign");
7363
0
        return NULL;
7364
0
    }
7365
2.98k
    if (!annotation) {
7366
0
        PyErr_SetString(PyExc_ValueError,
7367
0
                        "field 'annotation' is required for AnnAssign");
7368
0
        return NULL;
7369
0
    }
7370
2.98k
    p = (stmt_ty)_PyArena_Malloc(arena, sizeof(*p));
7371
2.98k
    if (!p)
7372
0
        return NULL;
7373
2.98k
    p->kind = AnnAssign_kind;
7374
2.98k
    p->v.AnnAssign.target = target;
7375
2.98k
    p->v.AnnAssign.annotation = annotation;
7376
2.98k
    p->v.AnnAssign.value = value;
7377
2.98k
    p->v.AnnAssign.simple = simple;
7378
2.98k
    p->lineno = lineno;
7379
2.98k
    p->col_offset = col_offset;
7380
2.98k
    p->end_lineno = end_lineno;
7381
2.98k
    p->end_col_offset = end_col_offset;
7382
2.98k
    return p;
7383
2.98k
}
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
1.16k
{
7390
1.16k
    stmt_ty p;
7391
1.16k
    if (!target) {
7392
0
        PyErr_SetString(PyExc_ValueError,
7393
0
                        "field 'target' is required for For");
7394
0
        return NULL;
7395
0
    }
7396
1.16k
    if (!iter) {
7397
0
        PyErr_SetString(PyExc_ValueError,
7398
0
                        "field 'iter' is required for For");
7399
0
        return NULL;
7400
0
    }
7401
1.16k
    p = (stmt_ty)_PyArena_Malloc(arena, sizeof(*p));
7402
1.16k
    if (!p)
7403
0
        return NULL;
7404
1.16k
    p->kind = For_kind;
7405
1.16k
    p->v.For.target = target;
7406
1.16k
    p->v.For.iter = iter;
7407
1.16k
    p->v.For.body = body;
7408
1.16k
    p->v.For.orelse = orelse;
7409
1.16k
    p->v.For.type_comment = type_comment;
7410
1.16k
    p->lineno = lineno;
7411
1.16k
    p->col_offset = col_offset;
7412
1.16k
    p->end_lineno = end_lineno;
7413
1.16k
    p->end_col_offset = end_col_offset;
7414
1.16k
    return p;
7415
1.16k
}
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
313
{
7422
313
    stmt_ty p;
7423
313
    if (!target) {
7424
0
        PyErr_SetString(PyExc_ValueError,
7425
0
                        "field 'target' is required for AsyncFor");
7426
0
        return NULL;
7427
0
    }
7428
313
    if (!iter) {
7429
0
        PyErr_SetString(PyExc_ValueError,
7430
0
                        "field 'iter' is required for AsyncFor");
7431
0
        return NULL;
7432
0
    }
7433
313
    p = (stmt_ty)_PyArena_Malloc(arena, sizeof(*p));
7434
313
    if (!p)
7435
0
        return NULL;
7436
313
    p->kind = AsyncFor_kind;
7437
313
    p->v.AsyncFor.target = target;
7438
313
    p->v.AsyncFor.iter = iter;
7439
313
    p->v.AsyncFor.body = body;
7440
313
    p->v.AsyncFor.orelse = orelse;
7441
313
    p->v.AsyncFor.type_comment = type_comment;
7442
313
    p->lineno = lineno;
7443
313
    p->col_offset = col_offset;
7444
313
    p->end_lineno = end_lineno;
7445
313
    p->end_col_offset = end_col_offset;
7446
313
    return p;
7447
313
}
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
718
{
7454
718
    stmt_ty p;
7455
718
    if (!test) {
7456
0
        PyErr_SetString(PyExc_ValueError,
7457
0
                        "field 'test' is required for While");
7458
0
        return NULL;
7459
0
    }
7460
718
    p = (stmt_ty)_PyArena_Malloc(arena, sizeof(*p));
7461
718
    if (!p)
7462
0
        return NULL;
7463
718
    p->kind = While_kind;
7464
718
    p->v.While.test = test;
7465
718
    p->v.While.body = body;
7466
718
    p->v.While.orelse = orelse;
7467
718
    p->lineno = lineno;
7468
718
    p->col_offset = col_offset;
7469
718
    p->end_lineno = end_lineno;
7470
718
    p->end_col_offset = end_col_offset;
7471
718
    return p;
7472
718
}
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
5.08k
{
7479
5.08k
    stmt_ty p;
7480
5.08k
    if (!test) {
7481
0
        PyErr_SetString(PyExc_ValueError,
7482
0
                        "field 'test' is required for If");
7483
0
        return NULL;
7484
0
    }
7485
5.08k
    p = (stmt_ty)_PyArena_Malloc(arena, sizeof(*p));
7486
5.08k
    if (!p)
7487
0
        return NULL;
7488
5.08k
    p->kind = If_kind;
7489
5.08k
    p->v.If.test = test;
7490
5.08k
    p->v.If.body = body;
7491
5.08k
    p->v.If.orelse = orelse;
7492
5.08k
    p->lineno = lineno;
7493
5.08k
    p->col_offset = col_offset;
7494
5.08k
    p->end_lineno = end_lineno;
7495
5.08k
    p->end_col_offset = end_col_offset;
7496
5.08k
    return p;
7497
5.08k
}
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
1.51k
{
7504
1.51k
    stmt_ty p;
7505
1.51k
    p = (stmt_ty)_PyArena_Malloc(arena, sizeof(*p));
7506
1.51k
    if (!p)
7507
0
        return NULL;
7508
1.51k
    p->kind = With_kind;
7509
1.51k
    p->v.With.items = items;
7510
1.51k
    p->v.With.body = body;
7511
1.51k
    p->v.With.type_comment = type_comment;
7512
1.51k
    p->lineno = lineno;
7513
1.51k
    p->col_offset = col_offset;
7514
1.51k
    p->end_lineno = end_lineno;
7515
1.51k
    p->end_col_offset = end_col_offset;
7516
1.51k
    return p;
7517
1.51k
}
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
681
{
7524
681
    stmt_ty p;
7525
681
    p = (stmt_ty)_PyArena_Malloc(arena, sizeof(*p));
7526
681
    if (!p)
7527
0
        return NULL;
7528
681
    p->kind = AsyncWith_kind;
7529
681
    p->v.AsyncWith.items = items;
7530
681
    p->v.AsyncWith.body = body;
7531
681
    p->v.AsyncWith.type_comment = type_comment;
7532
681
    p->lineno = lineno;
7533
681
    p->col_offset = col_offset;
7534
681
    p->end_lineno = end_lineno;
7535
681
    p->end_col_offset = end_col_offset;
7536
681
    return p;
7537
681
}
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
385
{
7543
385
    stmt_ty p;
7544
385
    if (!subject) {
7545
0
        PyErr_SetString(PyExc_ValueError,
7546
0
                        "field 'subject' is required for Match");
7547
0
        return NULL;
7548
0
    }
7549
385
    p = (stmt_ty)_PyArena_Malloc(arena, sizeof(*p));
7550
385
    if (!p)
7551
0
        return NULL;
7552
385
    p->kind = Match_kind;
7553
385
    p->v.Match.subject = subject;
7554
385
    p->v.Match.cases = cases;
7555
385
    p->lineno = lineno;
7556
385
    p->col_offset = col_offset;
7557
385
    p->end_lineno = end_lineno;
7558
385
    p->end_col_offset = end_col_offset;
7559
385
    return p;
7560
385
}
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
2.00k
{
7566
2.00k
    stmt_ty p;
7567
2.00k
    p = (stmt_ty)_PyArena_Malloc(arena, sizeof(*p));
7568
2.00k
    if (!p)
7569
0
        return NULL;
7570
2.00k
    p->kind = Raise_kind;
7571
2.00k
    p->v.Raise.exc = exc;
7572
2.00k
    p->v.Raise.cause = cause;
7573
2.00k
    p->lineno = lineno;
7574
2.00k
    p->col_offset = col_offset;
7575
2.00k
    p->end_lineno = end_lineno;
7576
2.00k
    p->end_col_offset = end_col_offset;
7577
2.00k
    return p;
7578
2.00k
}
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
2.46k
{
7585
2.46k
    stmt_ty p;
7586
2.46k
    p = (stmt_ty)_PyArena_Malloc(arena, sizeof(*p));
7587
2.46k
    if (!p)
7588
0
        return NULL;
7589
2.46k
    p->kind = Try_kind;
7590
2.46k
    p->v.Try.body = body;
7591
2.46k
    p->v.Try.handlers = handlers;
7592
2.46k
    p->v.Try.orelse = orelse;
7593
2.46k
    p->v.Try.finalbody = finalbody;
7594
2.46k
    p->lineno = lineno;
7595
2.46k
    p->col_offset = col_offset;
7596
2.46k
    p->end_lineno = end_lineno;
7597
2.46k
    p->end_col_offset = end_col_offset;
7598
2.46k
    return p;
7599
2.46k
}
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.49k
{
7607
1.49k
    stmt_ty p;
7608
1.49k
    p = (stmt_ty)_PyArena_Malloc(arena, sizeof(*p));
7609
1.49k
    if (!p)
7610
0
        return NULL;
7611
1.49k
    p->kind = TryStar_kind;
7612
1.49k
    p->v.TryStar.body = body;
7613
1.49k
    p->v.TryStar.handlers = handlers;
7614
1.49k
    p->v.TryStar.orelse = orelse;
7615
1.49k
    p->v.TryStar.finalbody = finalbody;
7616
1.49k
    p->lineno = lineno;
7617
1.49k
    p->col_offset = col_offset;
7618
1.49k
    p->end_lineno = end_lineno;
7619
1.49k
    p->end_col_offset = end_col_offset;
7620
1.49k
    return p;
7621
1.49k
}
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.27k
{
7627
1.27k
    stmt_ty p;
7628
1.27k
    if (!test) {
7629
0
        PyErr_SetString(PyExc_ValueError,
7630
0
                        "field 'test' is required for Assert");
7631
0
        return NULL;
7632
0
    }
7633
1.27k
    p = (stmt_ty)_PyArena_Malloc(arena, sizeof(*p));
7634
1.27k
    if (!p)
7635
0
        return NULL;
7636
1.27k
    p->kind = Assert_kind;
7637
1.27k
    p->v.Assert.test = test;
7638
1.27k
    p->v.Assert.msg = msg;
7639
1.27k
    p->lineno = lineno;
7640
1.27k
    p->col_offset = col_offset;
7641
1.27k
    p->end_lineno = end_lineno;
7642
1.27k
    p->end_col_offset = end_col_offset;
7643
1.27k
    return p;
7644
1.27k
}
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.26k
{
7650
2.26k
    stmt_ty p;
7651
2.26k
    p = (stmt_ty)_PyArena_Malloc(arena, sizeof(*p));
7652
2.26k
    if (!p)
7653
0
        return NULL;
7654
2.26k
    p->kind = Import_kind;
7655
2.26k
    p->v.Import.names = names;
7656
2.26k
    p->v.Import.is_lazy = is_lazy;
7657
2.26k
    p->lineno = lineno;
7658
2.26k
    p->col_offset = col_offset;
7659
2.26k
    p->end_lineno = end_lineno;
7660
2.26k
    p->end_col_offset = end_col_offset;
7661
2.26k
    return p;
7662
2.26k
}
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
2.59k
{
7669
2.59k
    stmt_ty p;
7670
2.59k
    p = (stmt_ty)_PyArena_Malloc(arena, sizeof(*p));
7671
2.59k
    if (!p)
7672
0
        return NULL;
7673
2.59k
    p->kind = ImportFrom_kind;
7674
2.59k
    p->v.ImportFrom.module = module;
7675
2.59k
    p->v.ImportFrom.names = names;
7676
2.59k
    p->v.ImportFrom.level = level;
7677
2.59k
    p->v.ImportFrom.is_lazy = is_lazy;
7678
2.59k
    p->lineno = lineno;
7679
2.59k
    p->col_offset = col_offset;
7680
2.59k
    p->end_lineno = end_lineno;
7681
2.59k
    p->end_col_offset = end_col_offset;
7682
2.59k
    return p;
7683
2.59k
}
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
635
{
7689
635
    stmt_ty p;
7690
635
    p = (stmt_ty)_PyArena_Malloc(arena, sizeof(*p));
7691
635
    if (!p)
7692
0
        return NULL;
7693
635
    p->kind = Global_kind;
7694
635
    p->v.Global.names = names;
7695
635
    p->lineno = lineno;
7696
635
    p->col_offset = col_offset;
7697
635
    p->end_lineno = end_lineno;
7698
635
    p->end_col_offset = end_col_offset;
7699
635
    return p;
7700
635
}
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
95
{
7706
95
    stmt_ty p;
7707
95
    p = (stmt_ty)_PyArena_Malloc(arena, sizeof(*p));
7708
95
    if (!p)
7709
0
        return NULL;
7710
95
    p->kind = Nonlocal_kind;
7711
95
    p->v.Nonlocal.names = names;
7712
95
    p->lineno = lineno;
7713
95
    p->col_offset = col_offset;
7714
95
    p->end_lineno = end_lineno;
7715
95
    p->end_col_offset = end_col_offset;
7716
95
    return p;
7717
95
}
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
78.5k
{
7723
78.5k
    stmt_ty p;
7724
78.5k
    if (!value) {
7725
0
        PyErr_SetString(PyExc_ValueError,
7726
0
                        "field 'value' is required for Expr");
7727
0
        return NULL;
7728
0
    }
7729
78.5k
    p = (stmt_ty)_PyArena_Malloc(arena, sizeof(*p));
7730
78.5k
    if (!p)
7731
0
        return NULL;
7732
78.5k
    p->kind = Expr_kind;
7733
78.5k
    p->v.Expr.value = value;
7734
78.5k
    p->lineno = lineno;
7735
78.5k
    p->col_offset = col_offset;
7736
78.5k
    p->end_lineno = end_lineno;
7737
78.5k
    p->end_col_offset = end_col_offset;
7738
78.5k
    return p;
7739
78.5k
}
7740
7741
stmt_ty
7742
_PyAST_Pass(int lineno, int col_offset, int end_lineno, int end_col_offset,
7743
            PyArena *arena)
7744
2.03k
{
7745
2.03k
    stmt_ty p;
7746
2.03k
    p = (stmt_ty)_PyArena_Malloc(arena, sizeof(*p));
7747
2.03k
    if (!p)
7748
0
        return NULL;
7749
2.03k
    p->kind = Pass_kind;
7750
2.03k
    p->lineno = lineno;
7751
2.03k
    p->col_offset = col_offset;
7752
2.03k
    p->end_lineno = end_lineno;
7753
2.03k
    p->end_col_offset = end_col_offset;
7754
2.03k
    return p;
7755
2.03k
}
7756
7757
stmt_ty
7758
_PyAST_Break(int lineno, int col_offset, int end_lineno, int end_col_offset,
7759
             PyArena *arena)
7760
1.40k
{
7761
1.40k
    stmt_ty p;
7762
1.40k
    p = (stmt_ty)_PyArena_Malloc(arena, sizeof(*p));
7763
1.40k
    if (!p)
7764
0
        return NULL;
7765
1.40k
    p->kind = Break_kind;
7766
1.40k
    p->lineno = lineno;
7767
1.40k
    p->col_offset = col_offset;
7768
1.40k
    p->end_lineno = end_lineno;
7769
1.40k
    p->end_col_offset = end_col_offset;
7770
1.40k
    return p;
7771
1.40k
}
7772
7773
stmt_ty
7774
_PyAST_Continue(int lineno, int col_offset, int end_lineno, int end_col_offset,
7775
                PyArena *arena)
7776
2.61k
{
7777
2.61k
    stmt_ty p;
7778
2.61k
    p = (stmt_ty)_PyArena_Malloc(arena, sizeof(*p));
7779
2.61k
    if (!p)
7780
0
        return NULL;
7781
2.61k
    p->kind = Continue_kind;
7782
2.61k
    p->lineno = lineno;
7783
2.61k
    p->col_offset = col_offset;
7784
2.61k
    p->end_lineno = end_lineno;
7785
2.61k
    p->end_col_offset = end_col_offset;
7786
2.61k
    return p;
7787
2.61k
}
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
1.95k
{
7793
1.95k
    expr_ty p;
7794
1.95k
    if (!op) {
7795
0
        PyErr_SetString(PyExc_ValueError,
7796
0
                        "field 'op' is required for BoolOp");
7797
0
        return NULL;
7798
0
    }
7799
1.95k
    p = (expr_ty)_PyArena_Malloc(arena, sizeof(*p));
7800
1.95k
    if (!p)
7801
0
        return NULL;
7802
1.95k
    p->kind = BoolOp_kind;
7803
1.95k
    p->v.BoolOp.op = op;
7804
1.95k
    p->v.BoolOp.values = values;
7805
1.95k
    p->lineno = lineno;
7806
1.95k
    p->col_offset = col_offset;
7807
1.95k
    p->end_lineno = end_lineno;
7808
1.95k
    p->end_col_offset = end_col_offset;
7809
1.95k
    return p;
7810
1.95k
}
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
1.77k
{
7816
1.77k
    expr_ty p;
7817
1.77k
    if (!target) {
7818
0
        PyErr_SetString(PyExc_ValueError,
7819
0
                        "field 'target' is required for NamedExpr");
7820
0
        return NULL;
7821
0
    }
7822
1.77k
    if (!value) {
7823
0
        PyErr_SetString(PyExc_ValueError,
7824
0
                        "field 'value' is required for NamedExpr");
7825
0
        return NULL;
7826
0
    }
7827
1.77k
    p = (expr_ty)_PyArena_Malloc(arena, sizeof(*p));
7828
1.77k
    if (!p)
7829
0
        return NULL;
7830
1.77k
    p->kind = NamedExpr_kind;
7831
1.77k
    p->v.NamedExpr.target = target;
7832
1.77k
    p->v.NamedExpr.value = value;
7833
1.77k
    p->lineno = lineno;
7834
1.77k
    p->col_offset = col_offset;
7835
1.77k
    p->end_lineno = end_lineno;
7836
1.77k
    p->end_col_offset = end_col_offset;
7837
1.77k
    return p;
7838
1.77k
}
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
49.1k
{
7844
49.1k
    expr_ty p;
7845
49.1k
    if (!left) {
7846
0
        PyErr_SetString(PyExc_ValueError,
7847
0
                        "field 'left' is required for BinOp");
7848
0
        return NULL;
7849
0
    }
7850
49.1k
    if (!op) {
7851
0
        PyErr_SetString(PyExc_ValueError,
7852
0
                        "field 'op' is required for BinOp");
7853
0
        return NULL;
7854
0
    }
7855
49.1k
    if (!right) {
7856
0
        PyErr_SetString(PyExc_ValueError,
7857
0
                        "field 'right' is required for BinOp");
7858
0
        return NULL;
7859
0
    }
7860
49.1k
    p = (expr_ty)_PyArena_Malloc(arena, sizeof(*p));
7861
49.1k
    if (!p)
7862
0
        return NULL;
7863
49.1k
    p->kind = BinOp_kind;
7864
49.1k
    p->v.BinOp.left = left;
7865
49.1k
    p->v.BinOp.op = op;
7866
49.1k
    p->v.BinOp.right = right;
7867
49.1k
    p->lineno = lineno;
7868
49.1k
    p->col_offset = col_offset;
7869
49.1k
    p->end_lineno = end_lineno;
7870
49.1k
    p->end_col_offset = end_col_offset;
7871
49.1k
    return p;
7872
49.1k
}
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
194k
{
7878
194k
    expr_ty p;
7879
194k
    if (!op) {
7880
0
        PyErr_SetString(PyExc_ValueError,
7881
0
                        "field 'op' is required for UnaryOp");
7882
0
        return NULL;
7883
0
    }
7884
194k
    if (!operand) {
7885
0
        PyErr_SetString(PyExc_ValueError,
7886
0
                        "field 'operand' is required for UnaryOp");
7887
0
        return NULL;
7888
0
    }
7889
194k
    p = (expr_ty)_PyArena_Malloc(arena, sizeof(*p));
7890
194k
    if (!p)
7891
0
        return NULL;
7892
194k
    p->kind = UnaryOp_kind;
7893
194k
    p->v.UnaryOp.op = op;
7894
194k
    p->v.UnaryOp.operand = operand;
7895
194k
    p->lineno = lineno;
7896
194k
    p->col_offset = col_offset;
7897
194k
    p->end_lineno = end_lineno;
7898
194k
    p->end_col_offset = end_col_offset;
7899
194k
    return p;
7900
194k
}
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
2.53k
{
7906
2.53k
    expr_ty p;
7907
2.53k
    if (!args) {
7908
0
        PyErr_SetString(PyExc_ValueError,
7909
0
                        "field 'args' is required for Lambda");
7910
0
        return NULL;
7911
0
    }
7912
2.53k
    if (!body) {
7913
0
        PyErr_SetString(PyExc_ValueError,
7914
0
                        "field 'body' is required for Lambda");
7915
0
        return NULL;
7916
0
    }
7917
2.53k
    p = (expr_ty)_PyArena_Malloc(arena, sizeof(*p));
7918
2.53k
    if (!p)
7919
0
        return NULL;
7920
2.53k
    p->kind = Lambda_kind;
7921
2.53k
    p->v.Lambda.args = args;
7922
2.53k
    p->v.Lambda.body = body;
7923
2.53k
    p->lineno = lineno;
7924
2.53k
    p->col_offset = col_offset;
7925
2.53k
    p->end_lineno = end_lineno;
7926
2.53k
    p->end_col_offset = end_col_offset;
7927
2.53k
    return p;
7928
2.53k
}
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
1.05k
{
7934
1.05k
    expr_ty p;
7935
1.05k
    if (!test) {
7936
0
        PyErr_SetString(PyExc_ValueError,
7937
0
                        "field 'test' is required for IfExp");
7938
0
        return NULL;
7939
0
    }
7940
1.05k
    if (!body) {
7941
0
        PyErr_SetString(PyExc_ValueError,
7942
0
                        "field 'body' is required for IfExp");
7943
0
        return NULL;
7944
0
    }
7945
1.05k
    if (!orelse) {
7946
0
        PyErr_SetString(PyExc_ValueError,
7947
0
                        "field 'orelse' is required for IfExp");
7948
0
        return NULL;
7949
0
    }
7950
1.05k
    p = (expr_ty)_PyArena_Malloc(arena, sizeof(*p));
7951
1.05k
    if (!p)
7952
0
        return NULL;
7953
1.05k
    p->kind = IfExp_kind;
7954
1.05k
    p->v.IfExp.test = test;
7955
1.05k
    p->v.IfExp.body = body;
7956
1.05k
    p->v.IfExp.orelse = orelse;
7957
1.05k
    p->lineno = lineno;
7958
1.05k
    p->col_offset = col_offset;
7959
1.05k
    p->end_lineno = end_lineno;
7960
1.05k
    p->end_col_offset = end_col_offset;
7961
1.05k
    return p;
7962
1.05k
}
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
6.05k
{
7968
6.05k
    expr_ty p;
7969
6.05k
    p = (expr_ty)_PyArena_Malloc(arena, sizeof(*p));
7970
6.05k
    if (!p)
7971
0
        return NULL;
7972
6.05k
    p->kind = Dict_kind;
7973
6.05k
    p->v.Dict.keys = keys;
7974
6.05k
    p->v.Dict.values = values;
7975
6.05k
    p->lineno = lineno;
7976
6.05k
    p->col_offset = col_offset;
7977
6.05k
    p->end_lineno = end_lineno;
7978
6.05k
    p->end_col_offset = end_col_offset;
7979
6.05k
    return p;
7980
6.05k
}
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
1.25k
{
7986
1.25k
    expr_ty p;
7987
1.25k
    p = (expr_ty)_PyArena_Malloc(arena, sizeof(*p));
7988
1.25k
    if (!p)
7989
0
        return NULL;
7990
1.25k
    p->kind = Set_kind;
7991
1.25k
    p->v.Set.elts = elts;
7992
1.25k
    p->lineno = lineno;
7993
1.25k
    p->col_offset = col_offset;
7994
1.25k
    p->end_lineno = end_lineno;
7995
1.25k
    p->end_col_offset = end_col_offset;
7996
1.25k
    return p;
7997
1.25k
}
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
693
{
8004
693
    expr_ty p;
8005
693
    if (!elt) {
8006
0
        PyErr_SetString(PyExc_ValueError,
8007
0
                        "field 'elt' is required for ListComp");
8008
0
        return NULL;
8009
0
    }
8010
693
    p = (expr_ty)_PyArena_Malloc(arena, sizeof(*p));
8011
693
    if (!p)
8012
0
        return NULL;
8013
693
    p->kind = ListComp_kind;
8014
693
    p->v.ListComp.elt = elt;
8015
693
    p->v.ListComp.generators = generators;
8016
693
    p->lineno = lineno;
8017
693
    p->col_offset = col_offset;
8018
693
    p->end_lineno = end_lineno;
8019
693
    p->end_col_offset = end_col_offset;
8020
693
    return p;
8021
693
}
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
858
{
8028
858
    expr_ty p;
8029
858
    if (!elt) {
8030
0
        PyErr_SetString(PyExc_ValueError,
8031
0
                        "field 'elt' is required for SetComp");
8032
0
        return NULL;
8033
0
    }
8034
858
    p = (expr_ty)_PyArena_Malloc(arena, sizeof(*p));
8035
858
    if (!p)
8036
0
        return NULL;
8037
858
    p->kind = SetComp_kind;
8038
858
    p->v.SetComp.elt = elt;
8039
858
    p->v.SetComp.generators = generators;
8040
858
    p->lineno = lineno;
8041
858
    p->col_offset = col_offset;
8042
858
    p->end_lineno = end_lineno;
8043
858
    p->end_col_offset = end_col_offset;
8044
858
    return p;
8045
858
}
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
892
{
8052
892
    expr_ty p;
8053
892
    if (!key) {
8054
0
        PyErr_SetString(PyExc_ValueError,
8055
0
                        "field 'key' is required for DictComp");
8056
0
        return NULL;
8057
0
    }
8058
892
    p = (expr_ty)_PyArena_Malloc(arena, sizeof(*p));
8059
892
    if (!p)
8060
0
        return NULL;
8061
892
    p->kind = DictComp_kind;
8062
892
    p->v.DictComp.key = key;
8063
892
    p->v.DictComp.value = value;
8064
892
    p->v.DictComp.generators = generators;
8065
892
    p->lineno = lineno;
8066
892
    p->col_offset = col_offset;
8067
892
    p->end_lineno = end_lineno;
8068
892
    p->end_col_offset = end_col_offset;
8069
892
    return p;
8070
892
}
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
3.95k
{
8077
3.95k
    expr_ty p;
8078
3.95k
    if (!elt) {
8079
0
        PyErr_SetString(PyExc_ValueError,
8080
0
                        "field 'elt' is required for GeneratorExp");
8081
0
        return NULL;
8082
0
    }
8083
3.95k
    p = (expr_ty)_PyArena_Malloc(arena, sizeof(*p));
8084
3.95k
    if (!p)
8085
0
        return NULL;
8086
3.95k
    p->kind = GeneratorExp_kind;
8087
3.95k
    p->v.GeneratorExp.elt = elt;
8088
3.95k
    p->v.GeneratorExp.generators = generators;
8089
3.95k
    p->lineno = lineno;
8090
3.95k
    p->col_offset = col_offset;
8091
3.95k
    p->end_lineno = end_lineno;
8092
3.95k
    p->end_col_offset = end_col_offset;
8093
3.95k
    return p;
8094
3.95k
}
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
386
{
8100
386
    expr_ty p;
8101
386
    if (!value) {
8102
0
        PyErr_SetString(PyExc_ValueError,
8103
0
                        "field 'value' is required for Await");
8104
0
        return NULL;
8105
0
    }
8106
386
    p = (expr_ty)_PyArena_Malloc(arena, sizeof(*p));
8107
386
    if (!p)
8108
0
        return NULL;
8109
386
    p->kind = Await_kind;
8110
386
    p->v.Await.value = value;
8111
386
    p->lineno = lineno;
8112
386
    p->col_offset = col_offset;
8113
386
    p->end_lineno = end_lineno;
8114
386
    p->end_col_offset = end_col_offset;
8115
386
    return p;
8116
386
}
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
2.66k
{
8122
2.66k
    expr_ty p;
8123
2.66k
    p = (expr_ty)_PyArena_Malloc(arena, sizeof(*p));
8124
2.66k
    if (!p)
8125
0
        return NULL;
8126
2.66k
    p->kind = Yield_kind;
8127
2.66k
    p->v.Yield.value = value;
8128
2.66k
    p->lineno = lineno;
8129
2.66k
    p->col_offset = col_offset;
8130
2.66k
    p->end_lineno = end_lineno;
8131
2.66k
    p->end_col_offset = end_col_offset;
8132
2.66k
    return p;
8133
2.66k
}
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
275
{
8139
275
    expr_ty p;
8140
275
    if (!value) {
8141
0
        PyErr_SetString(PyExc_ValueError,
8142
0
                        "field 'value' is required for YieldFrom");
8143
0
        return NULL;
8144
0
    }
8145
275
    p = (expr_ty)_PyArena_Malloc(arena, sizeof(*p));
8146
275
    if (!p)
8147
0
        return NULL;
8148
275
    p->kind = YieldFrom_kind;
8149
275
    p->v.YieldFrom.value = value;
8150
275
    p->lineno = lineno;
8151
275
    p->col_offset = col_offset;
8152
275
    p->end_lineno = end_lineno;
8153
275
    p->end_col_offset = end_col_offset;
8154
275
    return p;
8155
275
}
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
6.16k
{
8162
6.16k
    expr_ty p;
8163
6.16k
    if (!left) {
8164
0
        PyErr_SetString(PyExc_ValueError,
8165
0
                        "field 'left' is required for Compare");
8166
0
        return NULL;
8167
0
    }
8168
6.16k
    p = (expr_ty)_PyArena_Malloc(arena, sizeof(*p));
8169
6.16k
    if (!p)
8170
0
        return NULL;
8171
6.16k
    p->kind = Compare_kind;
8172
6.16k
    p->v.Compare.left = left;
8173
6.16k
    p->v.Compare.ops = ops;
8174
6.16k
    p->v.Compare.comparators = comparators;
8175
6.16k
    p->lineno = lineno;
8176
6.16k
    p->col_offset = col_offset;
8177
6.16k
    p->end_lineno = end_lineno;
8178
6.16k
    p->end_col_offset = end_col_offset;
8179
6.16k
    return p;
8180
6.16k
}
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
58.9k
{
8187
58.9k
    expr_ty p;
8188
58.9k
    if (!func) {
8189
0
        PyErr_SetString(PyExc_ValueError,
8190
0
                        "field 'func' is required for Call");
8191
0
        return NULL;
8192
0
    }
8193
58.9k
    p = (expr_ty)_PyArena_Malloc(arena, sizeof(*p));
8194
58.9k
    if (!p)
8195
0
        return NULL;
8196
58.9k
    p->kind = Call_kind;
8197
58.9k
    p->v.Call.func = func;
8198
58.9k
    p->v.Call.args = args;
8199
58.9k
    p->v.Call.keywords = keywords;
8200
58.9k
    p->lineno = lineno;
8201
58.9k
    p->col_offset = col_offset;
8202
58.9k
    p->end_lineno = end_lineno;
8203
58.9k
    p->end_col_offset = end_col_offset;
8204
58.9k
    return p;
8205
58.9k
}
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
23.3k
{
8212
23.3k
    expr_ty p;
8213
23.3k
    if (!value) {
8214
0
        PyErr_SetString(PyExc_ValueError,
8215
0
                        "field 'value' is required for FormattedValue");
8216
0
        return NULL;
8217
0
    }
8218
23.3k
    p = (expr_ty)_PyArena_Malloc(arena, sizeof(*p));
8219
23.3k
    if (!p)
8220
0
        return NULL;
8221
23.3k
    p->kind = FormattedValue_kind;
8222
23.3k
    p->v.FormattedValue.value = value;
8223
23.3k
    p->v.FormattedValue.conversion = conversion;
8224
23.3k
    p->v.FormattedValue.format_spec = format_spec;
8225
23.3k
    p->lineno = lineno;
8226
23.3k
    p->col_offset = col_offset;
8227
23.3k
    p->end_lineno = end_lineno;
8228
23.3k
    p->end_col_offset = end_col_offset;
8229
23.3k
    return p;
8230
23.3k
}
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
4.97k
{
8237
4.97k
    expr_ty p;
8238
4.97k
    if (!value) {
8239
0
        PyErr_SetString(PyExc_ValueError,
8240
0
                        "field 'value' is required for Interpolation");
8241
0
        return NULL;
8242
0
    }
8243
4.97k
    if (!str) {
8244
0
        PyErr_SetString(PyExc_ValueError,
8245
0
                        "field 'str' is required for Interpolation");
8246
0
        return NULL;
8247
0
    }
8248
4.97k
    p = (expr_ty)_PyArena_Malloc(arena, sizeof(*p));
8249
4.97k
    if (!p)
8250
0
        return NULL;
8251
4.97k
    p->kind = Interpolation_kind;
8252
4.97k
    p->v.Interpolation.value = value;
8253
4.97k
    p->v.Interpolation.str = str;
8254
4.97k
    p->v.Interpolation.conversion = conversion;
8255
4.97k
    p->v.Interpolation.format_spec = format_spec;
8256
4.97k
    p->lineno = lineno;
8257
4.97k
    p->col_offset = col_offset;
8258
4.97k
    p->end_lineno = end_lineno;
8259
4.97k
    p->end_col_offset = end_col_offset;
8260
4.97k
    return p;
8261
4.97k
}
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
36.1k
{
8267
36.1k
    expr_ty p;
8268
36.1k
    p = (expr_ty)_PyArena_Malloc(arena, sizeof(*p));
8269
36.1k
    if (!p)
8270
0
        return NULL;
8271
36.1k
    p->kind = JoinedStr_kind;
8272
36.1k
    p->v.JoinedStr.values = values;
8273
36.1k
    p->lineno = lineno;
8274
36.1k
    p->col_offset = col_offset;
8275
36.1k
    p->end_lineno = end_lineno;
8276
36.1k
    p->end_col_offset = end_col_offset;
8277
36.1k
    return p;
8278
36.1k
}
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
8.27k
{
8284
8.27k
    expr_ty p;
8285
8.27k
    p = (expr_ty)_PyArena_Malloc(arena, sizeof(*p));
8286
8.27k
    if (!p)
8287
0
        return NULL;
8288
8.27k
    p->kind = TemplateStr_kind;
8289
8.27k
    p->v.TemplateStr.values = values;
8290
8.27k
    p->lineno = lineno;
8291
8.27k
    p->col_offset = col_offset;
8292
8.27k
    p->end_lineno = end_lineno;
8293
8.27k
    p->end_col_offset = end_col_offset;
8294
8.27k
    return p;
8295
8.27k
}
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
369k
{
8301
369k
    expr_ty p;
8302
369k
    if (!value) {
8303
2
        PyErr_SetString(PyExc_ValueError,
8304
2
                        "field 'value' is required for Constant");
8305
2
        return NULL;
8306
2
    }
8307
369k
    p = (expr_ty)_PyArena_Malloc(arena, sizeof(*p));
8308
369k
    if (!p)
8309
0
        return NULL;
8310
369k
    p->kind = Constant_kind;
8311
369k
    p->v.Constant.value = value;
8312
369k
    p->v.Constant.kind = kind;
8313
369k
    p->lineno = lineno;
8314
369k
    p->col_offset = col_offset;
8315
369k
    p->end_lineno = end_lineno;
8316
369k
    p->end_col_offset = end_col_offset;
8317
369k
    return p;
8318
369k
}
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
40.1k
{
8325
40.1k
    expr_ty p;
8326
40.1k
    if (!value) {
8327
0
        PyErr_SetString(PyExc_ValueError,
8328
0
                        "field 'value' is required for Attribute");
8329
0
        return NULL;
8330
0
    }
8331
40.1k
    if (!attr) {
8332
0
        PyErr_SetString(PyExc_ValueError,
8333
0
                        "field 'attr' is required for Attribute");
8334
0
        return NULL;
8335
0
    }
8336
40.1k
    if (!ctx) {
8337
0
        PyErr_SetString(PyExc_ValueError,
8338
0
                        "field 'ctx' is required for Attribute");
8339
0
        return NULL;
8340
0
    }
8341
40.1k
    p = (expr_ty)_PyArena_Malloc(arena, sizeof(*p));
8342
40.1k
    if (!p)
8343
0
        return NULL;
8344
40.1k
    p->kind = Attribute_kind;
8345
40.1k
    p->v.Attribute.value = value;
8346
40.1k
    p->v.Attribute.attr = attr;
8347
40.1k
    p->v.Attribute.ctx = ctx;
8348
40.1k
    p->lineno = lineno;
8349
40.1k
    p->col_offset = col_offset;
8350
40.1k
    p->end_lineno = end_lineno;
8351
40.1k
    p->end_col_offset = end_col_offset;
8352
40.1k
    return p;
8353
40.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
4.58k
{
8360
4.58k
    expr_ty p;
8361
4.58k
    if (!value) {
8362
0
        PyErr_SetString(PyExc_ValueError,
8363
0
                        "field 'value' is required for Subscript");
8364
0
        return NULL;
8365
0
    }
8366
4.58k
    if (!slice) {
8367
0
        PyErr_SetString(PyExc_ValueError,
8368
0
                        "field 'slice' is required for Subscript");
8369
0
        return NULL;
8370
0
    }
8371
4.58k
    if (!ctx) {
8372
0
        PyErr_SetString(PyExc_ValueError,
8373
0
                        "field 'ctx' is required for Subscript");
8374
0
        return NULL;
8375
0
    }
8376
4.58k
    p = (expr_ty)_PyArena_Malloc(arena, sizeof(*p));
8377
4.58k
    if (!p)
8378
0
        return NULL;
8379
4.58k
    p->kind = Subscript_kind;
8380
4.58k
    p->v.Subscript.value = value;
8381
4.58k
    p->v.Subscript.slice = slice;
8382
4.58k
    p->v.Subscript.ctx = ctx;
8383
4.58k
    p->lineno = lineno;
8384
4.58k
    p->col_offset = col_offset;
8385
4.58k
    p->end_lineno = end_lineno;
8386
4.58k
    p->end_col_offset = end_col_offset;
8387
4.58k
    return p;
8388
4.58k
}
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
18.1k
{
8394
18.1k
    expr_ty p;
8395
18.1k
    if (!value) {
8396
0
        PyErr_SetString(PyExc_ValueError,
8397
0
                        "field 'value' is required for Starred");
8398
0
        return NULL;
8399
0
    }
8400
18.1k
    if (!ctx) {
8401
0
        PyErr_SetString(PyExc_ValueError,
8402
0
                        "field 'ctx' is required for Starred");
8403
0
        return NULL;
8404
0
    }
8405
18.1k
    p = (expr_ty)_PyArena_Malloc(arena, sizeof(*p));
8406
18.1k
    if (!p)
8407
0
        return NULL;
8408
18.1k
    p->kind = Starred_kind;
8409
18.1k
    p->v.Starred.value = value;
8410
18.1k
    p->v.Starred.ctx = ctx;
8411
18.1k
    p->lineno = lineno;
8412
18.1k
    p->col_offset = col_offset;
8413
18.1k
    p->end_lineno = end_lineno;
8414
18.1k
    p->end_col_offset = end_col_offset;
8415
18.1k
    return p;
8416
18.1k
}
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
12.1M
{
8422
12.1M
    expr_ty p;
8423
12.1M
    if (!id) {
8424
0
        PyErr_SetString(PyExc_ValueError,
8425
0
                        "field 'id' is required for Name");
8426
0
        return NULL;
8427
0
    }
8428
12.1M
    if (!ctx) {
8429
0
        PyErr_SetString(PyExc_ValueError,
8430
0
                        "field 'ctx' is required for Name");
8431
0
        return NULL;
8432
0
    }
8433
12.1M
    p = (expr_ty)_PyArena_Malloc(arena, sizeof(*p));
8434
12.1M
    if (!p)
8435
0
        return NULL;
8436
12.1M
    p->kind = Name_kind;
8437
12.1M
    p->v.Name.id = id;
8438
12.1M
    p->v.Name.ctx = ctx;
8439
12.1M
    p->lineno = lineno;
8440
12.1M
    p->col_offset = col_offset;
8441
12.1M
    p->end_lineno = end_lineno;
8442
12.1M
    p->end_col_offset = end_col_offset;
8443
12.1M
    return p;
8444
12.1M
}
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
15.3k
{
8450
15.3k
    expr_ty p;
8451
15.3k
    if (!ctx) {
8452
0
        PyErr_SetString(PyExc_ValueError,
8453
0
                        "field 'ctx' is required for List");
8454
0
        return NULL;
8455
0
    }
8456
15.3k
    p = (expr_ty)_PyArena_Malloc(arena, sizeof(*p));
8457
15.3k
    if (!p)
8458
0
        return NULL;
8459
15.3k
    p->kind = List_kind;
8460
15.3k
    p->v.List.elts = elts;
8461
15.3k
    p->v.List.ctx = ctx;
8462
15.3k
    p->lineno = lineno;
8463
15.3k
    p->col_offset = col_offset;
8464
15.3k
    p->end_lineno = end_lineno;
8465
15.3k
    p->end_col_offset = end_col_offset;
8466
15.3k
    return p;
8467
15.3k
}
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
68.0k
{
8473
68.0k
    expr_ty p;
8474
68.0k
    if (!ctx) {
8475
0
        PyErr_SetString(PyExc_ValueError,
8476
0
                        "field 'ctx' is required for Tuple");
8477
0
        return NULL;
8478
0
    }
8479
68.0k
    p = (expr_ty)_PyArena_Malloc(arena, sizeof(*p));
8480
68.0k
    if (!p)
8481
0
        return NULL;
8482
68.0k
    p->kind = Tuple_kind;
8483
68.0k
    p->v.Tuple.elts = elts;
8484
68.0k
    p->v.Tuple.ctx = ctx;
8485
68.0k
    p->lineno = lineno;
8486
68.0k
    p->col_offset = col_offset;
8487
68.0k
    p->end_lineno = end_lineno;
8488
68.0k
    p->end_col_offset = end_col_offset;
8489
68.0k
    return p;
8490
68.0k
}
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
16.4k
{
8496
16.4k
    expr_ty p;
8497
16.4k
    p = (expr_ty)_PyArena_Malloc(arena, sizeof(*p));
8498
16.4k
    if (!p)
8499
0
        return NULL;
8500
16.4k
    p->kind = Slice_kind;
8501
16.4k
    p->v.Slice.lower = lower;
8502
16.4k
    p->v.Slice.upper = upper;
8503
16.4k
    p->v.Slice.step = step;
8504
16.4k
    p->lineno = lineno;
8505
16.4k
    p->col_offset = col_offset;
8506
16.4k
    p->end_lineno = end_lineno;
8507
16.4k
    p->end_col_offset = end_col_offset;
8508
16.4k
    return p;
8509
16.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
8.86k
{
8515
8.86k
    comprehension_ty p;
8516
8.86k
    if (!target) {
8517
0
        PyErr_SetString(PyExc_ValueError,
8518
0
                        "field 'target' is required for comprehension");
8519
0
        return NULL;
8520
0
    }
8521
8.86k
    if (!iter) {
8522
0
        PyErr_SetString(PyExc_ValueError,
8523
0
                        "field 'iter' is required for comprehension");
8524
0
        return NULL;
8525
0
    }
8526
8.86k
    p = (comprehension_ty)_PyArena_Malloc(arena, sizeof(*p));
8527
8.86k
    if (!p)
8528
0
        return NULL;
8529
8.86k
    p->target = target;
8530
8.86k
    p->iter = iter;
8531
8.86k
    p->ifs = ifs;
8532
8.86k
    p->is_async = is_async;
8533
8.86k
    return p;
8534
8.86k
}
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
7.69k
{
8541
7.69k
    excepthandler_ty p;
8542
7.69k
    p = (excepthandler_ty)_PyArena_Malloc(arena, sizeof(*p));
8543
7.69k
    if (!p)
8544
0
        return NULL;
8545
7.69k
    p->kind = ExceptHandler_kind;
8546
7.69k
    p->v.ExceptHandler.type = type;
8547
7.69k
    p->v.ExceptHandler.name = name;
8548
7.69k
    p->v.ExceptHandler.body = body;
8549
7.69k
    p->lineno = lineno;
8550
7.69k
    p->col_offset = col_offset;
8551
7.69k
    p->end_lineno = end_lineno;
8552
7.69k
    p->end_col_offset = end_col_offset;
8553
7.69k
    return p;
8554
7.69k
}
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
343k
{
8562
343k
    arguments_ty p;
8563
343k
    p = (arguments_ty)_PyArena_Malloc(arena, sizeof(*p));
8564
343k
    if (!p)
8565
0
        return NULL;
8566
343k
    p->posonlyargs = posonlyargs;
8567
343k
    p->args = args;
8568
343k
    p->vararg = vararg;
8569
343k
    p->kwonlyargs = kwonlyargs;
8570
343k
    p->kw_defaults = kw_defaults;
8571
343k
    p->kwarg = kwarg;
8572
343k
    p->defaults = defaults;
8573
343k
    return p;
8574
343k
}
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
10.5M
{
8580
10.5M
    arg_ty p;
8581
10.5M
    if (!arg) {
8582
0
        PyErr_SetString(PyExc_ValueError,
8583
0
                        "field 'arg' is required for arg");
8584
0
        return NULL;
8585
0
    }
8586
10.5M
    p = (arg_ty)_PyArena_Malloc(arena, sizeof(*p));
8587
10.5M
    if (!p)
8588
0
        return NULL;
8589
10.5M
    p->arg = arg;
8590
10.5M
    p->annotation = annotation;
8591
10.5M
    p->type_comment = type_comment;
8592
10.5M
    p->lineno = lineno;
8593
10.5M
    p->col_offset = col_offset;
8594
10.5M
    p->end_lineno = end_lineno;
8595
10.5M
    p->end_col_offset = end_col_offset;
8596
10.5M
    return p;
8597
10.5M
}
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
33.0k
{
8603
33.0k
    keyword_ty p;
8604
33.0k
    if (!value) {
8605
0
        PyErr_SetString(PyExc_ValueError,
8606
0
                        "field 'value' is required for keyword");
8607
0
        return NULL;
8608
0
    }
8609
33.0k
    p = (keyword_ty)_PyArena_Malloc(arena, sizeof(*p));
8610
33.0k
    if (!p)
8611
0
        return NULL;
8612
33.0k
    p->arg = arg;
8613
33.0k
    p->value = value;
8614
33.0k
    p->lineno = lineno;
8615
33.0k
    p->col_offset = col_offset;
8616
33.0k
    p->end_lineno = end_lineno;
8617
33.0k
    p->end_col_offset = end_col_offset;
8618
33.0k
    return p;
8619
33.0k
}
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
11.9k
{
8625
11.9k
    alias_ty p;
8626
11.9k
    if (!name) {
8627
0
        PyErr_SetString(PyExc_ValueError,
8628
0
                        "field 'name' is required for alias");
8629
0
        return NULL;
8630
0
    }
8631
11.9k
    p = (alias_ty)_PyArena_Malloc(arena, sizeof(*p));
8632
11.9k
    if (!p)
8633
0
        return NULL;
8634
11.9k
    p->name = name;
8635
11.9k
    p->asname = asname;
8636
11.9k
    p->lineno = lineno;
8637
11.9k
    p->col_offset = col_offset;
8638
11.9k
    p->end_lineno = end_lineno;
8639
11.9k
    p->end_col_offset = end_col_offset;
8640
11.9k
    return p;
8641
11.9k
}
8642
8643
withitem_ty
8644
_PyAST_withitem(expr_ty context_expr, expr_ty optional_vars, PyArena *arena)
8645
6.08k
{
8646
6.08k
    withitem_ty p;
8647
6.08k
    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
6.08k
    p = (withitem_ty)_PyArena_Malloc(arena, sizeof(*p));
8653
6.08k
    if (!p)
8654
0
        return NULL;
8655
6.08k
    p->context_expr = context_expr;
8656
6.08k
    p->optional_vars = optional_vars;
8657
6.08k
    return p;
8658
6.08k
}
8659
8660
match_case_ty
8661
_PyAST_match_case(pattern_ty pattern, expr_ty guard, asdl_stmt_seq * body,
8662
                  PyArena *arena)
8663
1.89k
{
8664
1.89k
    match_case_ty p;
8665
1.89k
    if (!pattern) {
8666
0
        PyErr_SetString(PyExc_ValueError,
8667
0
                        "field 'pattern' is required for match_case");
8668
0
        return NULL;
8669
0
    }
8670
1.89k
    p = (match_case_ty)_PyArena_Malloc(arena, sizeof(*p));
8671
1.89k
    if (!p)
8672
0
        return NULL;
8673
1.89k
    p->pattern = pattern;
8674
1.89k
    p->guard = guard;
8675
1.89k
    p->body = body;
8676
1.89k
    return p;
8677
1.89k
}
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
3.46k
{
8683
3.46k
    pattern_ty p;
8684
3.46k
    if (!value) {
8685
0
        PyErr_SetString(PyExc_ValueError,
8686
0
                        "field 'value' is required for MatchValue");
8687
0
        return NULL;
8688
0
    }
8689
3.46k
    p = (pattern_ty)_PyArena_Malloc(arena, sizeof(*p));
8690
3.46k
    if (!p)
8691
0
        return NULL;
8692
3.46k
    p->kind = MatchValue_kind;
8693
3.46k
    p->v.MatchValue.value = value;
8694
3.46k
    p->lineno = lineno;
8695
3.46k
    p->col_offset = col_offset;
8696
3.46k
    p->end_lineno = end_lineno;
8697
3.46k
    p->end_col_offset = end_col_offset;
8698
3.46k
    return p;
8699
3.46k
}
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
985
{
8705
985
    pattern_ty p;
8706
985
    if (!value) {
8707
0
        PyErr_SetString(PyExc_ValueError,
8708
0
                        "field 'value' is required for MatchSingleton");
8709
0
        return NULL;
8710
0
    }
8711
985
    p = (pattern_ty)_PyArena_Malloc(arena, sizeof(*p));
8712
985
    if (!p)
8713
0
        return NULL;
8714
985
    p->kind = MatchSingleton_kind;
8715
985
    p->v.MatchSingleton.value = value;
8716
985
    p->lineno = lineno;
8717
985
    p->col_offset = col_offset;
8718
985
    p->end_lineno = end_lineno;
8719
985
    p->end_col_offset = end_col_offset;
8720
985
    return p;
8721
985
}
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
1.98k
{
8727
1.98k
    pattern_ty p;
8728
1.98k
    p = (pattern_ty)_PyArena_Malloc(arena, sizeof(*p));
8729
1.98k
    if (!p)
8730
0
        return NULL;
8731
1.98k
    p->kind = MatchSequence_kind;
8732
1.98k
    p->v.MatchSequence.patterns = patterns;
8733
1.98k
    p->lineno = lineno;
8734
1.98k
    p->col_offset = col_offset;
8735
1.98k
    p->end_lineno = end_lineno;
8736
1.98k
    p->end_col_offset = end_col_offset;
8737
1.98k
    return p;
8738
1.98k
}
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
948
{
8745
948
    pattern_ty p;
8746
948
    p = (pattern_ty)_PyArena_Malloc(arena, sizeof(*p));
8747
948
    if (!p)
8748
0
        return NULL;
8749
948
    p->kind = MatchMapping_kind;
8750
948
    p->v.MatchMapping.keys = keys;
8751
948
    p->v.MatchMapping.patterns = patterns;
8752
948
    p->v.MatchMapping.rest = rest;
8753
948
    p->lineno = lineno;
8754
948
    p->col_offset = col_offset;
8755
948
    p->end_lineno = end_lineno;
8756
948
    p->end_col_offset = end_col_offset;
8757
948
    return p;
8758
948
}
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
1.71k
{
8766
1.71k
    pattern_ty p;
8767
1.71k
    if (!cls) {
8768
0
        PyErr_SetString(PyExc_ValueError,
8769
0
                        "field 'cls' is required for MatchClass");
8770
0
        return NULL;
8771
0
    }
8772
1.71k
    p = (pattern_ty)_PyArena_Malloc(arena, sizeof(*p));
8773
1.71k
    if (!p)
8774
0
        return NULL;
8775
1.71k
    p->kind = MatchClass_kind;
8776
1.71k
    p->v.MatchClass.cls = cls;
8777
1.71k
    p->v.MatchClass.patterns = patterns;
8778
1.71k
    p->v.MatchClass.kwd_attrs = kwd_attrs;
8779
1.71k
    p->v.MatchClass.kwd_patterns = kwd_patterns;
8780
1.71k
    p->lineno = lineno;
8781
1.71k
    p->col_offset = col_offset;
8782
1.71k
    p->end_lineno = end_lineno;
8783
1.71k
    p->end_col_offset = end_col_offset;
8784
1.71k
    return p;
8785
1.71k
}
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
1.02k
{
8791
1.02k
    pattern_ty p;
8792
1.02k
    p = (pattern_ty)_PyArena_Malloc(arena, sizeof(*p));
8793
1.02k
    if (!p)
8794
0
        return NULL;
8795
1.02k
    p->kind = MatchStar_kind;
8796
1.02k
    p->v.MatchStar.name = name;
8797
1.02k
    p->lineno = lineno;
8798
1.02k
    p->col_offset = col_offset;
8799
1.02k
    p->end_lineno = end_lineno;
8800
1.02k
    p->end_col_offset = end_col_offset;
8801
1.02k
    return p;
8802
1.02k
}
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
20.5k
{
8808
20.5k
    pattern_ty p;
8809
20.5k
    p = (pattern_ty)_PyArena_Malloc(arena, sizeof(*p));
8810
20.5k
    if (!p)
8811
0
        return NULL;
8812
20.5k
    p->kind = MatchAs_kind;
8813
20.5k
    p->v.MatchAs.pattern = pattern;
8814
20.5k
    p->v.MatchAs.name = name;
8815
20.5k
    p->lineno = lineno;
8816
20.5k
    p->col_offset = col_offset;
8817
20.5k
    p->end_lineno = end_lineno;
8818
20.5k
    p->end_col_offset = end_col_offset;
8819
20.5k
    return p;
8820
20.5k
}
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
8.28k
{
8826
8.28k
    pattern_ty p;
8827
8.28k
    p = (pattern_ty)_PyArena_Malloc(arena, sizeof(*p));
8828
8.28k
    if (!p)
8829
0
        return NULL;
8830
8.28k
    p->kind = MatchOr_kind;
8831
8.28k
    p->v.MatchOr.patterns = patterns;
8832
8.28k
    p->lineno = lineno;
8833
8.28k
    p->col_offset = col_offset;
8834
8.28k
    p->end_lineno = end_lineno;
8835
8.28k
    p->end_col_offset = end_col_offset;
8836
8.28k
    return p;
8837
8.28k
}
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
5.96k
{
8862
5.96k
    type_param_ty p;
8863
5.96k
    if (!name) {
8864
0
        PyErr_SetString(PyExc_ValueError,
8865
0
                        "field 'name' is required for TypeVar");
8866
0
        return NULL;
8867
0
    }
8868
5.96k
    p = (type_param_ty)_PyArena_Malloc(arena, sizeof(*p));
8869
5.96k
    if (!p)
8870
0
        return NULL;
8871
5.96k
    p->kind = TypeVar_kind;
8872
5.96k
    p->v.TypeVar.name = name;
8873
5.96k
    p->v.TypeVar.bound = bound;
8874
5.96k
    p->v.TypeVar.default_value = default_value;
8875
5.96k
    p->lineno = lineno;
8876
5.96k
    p->col_offset = col_offset;
8877
5.96k
    p->end_lineno = end_lineno;
8878
5.96k
    p->end_col_offset = end_col_offset;
8879
5.96k
    return p;
8880
5.96k
}
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
862
{
8886
862
    type_param_ty p;
8887
862
    if (!name) {
8888
0
        PyErr_SetString(PyExc_ValueError,
8889
0
                        "field 'name' is required for ParamSpec");
8890
0
        return NULL;
8891
0
    }
8892
862
    p = (type_param_ty)_PyArena_Malloc(arena, sizeof(*p));
8893
862
    if (!p)
8894
0
        return NULL;
8895
862
    p->kind = ParamSpec_kind;
8896
862
    p->v.ParamSpec.name = name;
8897
862
    p->v.ParamSpec.default_value = default_value;
8898
862
    p->lineno = lineno;
8899
862
    p->col_offset = col_offset;
8900
862
    p->end_lineno = end_lineno;
8901
862
    p->end_col_offset = end_col_offset;
8902
862
    return p;
8903
862
}
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
1.61k
{
8910
1.61k
    type_param_ty p;
8911
1.61k
    if (!name) {
8912
0
        PyErr_SetString(PyExc_ValueError,
8913
0
                        "field 'name' is required for TypeVarTuple");
8914
0
        return NULL;
8915
0
    }
8916
1.61k
    p = (type_param_ty)_PyArena_Malloc(arena, sizeof(*p));
8917
1.61k
    if (!p)
8918
0
        return NULL;
8919
1.61k
    p->kind = TypeVarTuple_kind;
8920
1.61k
    p->v.TypeVarTuple.name = name;
8921
1.61k
    p->v.TypeVarTuple.default_value = default_value;
8922
1.61k
    p->lineno = lineno;
8923
1.61k
    p->col_offset = col_offset;
8924
1.61k
    p->end_lineno = end_lineno;
8925
1.61k
    p->end_col_offset = end_col_offset;
8926
1.61k
    return p;
8927
1.61k
}
8928
8929
8930
PyObject*
8931
ast2obj_mod(struct ast_state *state, void* _o)
8932
6.10k
{
8933
6.10k
    mod_ty o = (mod_ty)_o;
8934
6.10k
    PyObject *result = NULL, *value = NULL;
8935
6.10k
    PyTypeObject *tp;
8936
6.10k
    if (!o) {
8937
0
        Py_RETURN_NONE;
8938
0
    }
8939
6.10k
    if (Py_EnterRecursiveCall("during  ast construction")) {
8940
0
        return NULL;
8941
0
    }
8942
6.10k
    switch (o->kind) {
8943
6.10k
    case Module_kind:
8944
6.10k
        tp = (PyTypeObject *)state->Module_type;
8945
6.10k
        result = PyType_GenericNew(tp, NULL, NULL);
8946
6.10k
        if (!result) goto failed;
8947
6.10k
        value = ast2obj_list(state, (asdl_seq*)o->v.Module.body, ast2obj_stmt);
8948
6.10k
        if (!value) goto failed;
8949
6.10k
        if (PyObject_SetAttr(result, state->body, value) == -1)
8950
0
            goto failed;
8951
6.10k
        Py_DECREF(value);
8952
6.10k
        value = ast2obj_list(state, (asdl_seq*)o->v.Module.type_ignores,
8953
6.10k
                             ast2obj_type_ignore);
8954
6.10k
        if (!value) goto failed;
8955
6.10k
        if (PyObject_SetAttr(result, state->type_ignores, value) == -1)
8956
0
            goto failed;
8957
6.10k
        Py_DECREF(value);
8958
6.10k
        break;
8959
0
    case Interactive_kind:
8960
0
        tp = (PyTypeObject *)state->Interactive_type;
8961
0
        result = PyType_GenericNew(tp, NULL, NULL);
8962
0
        if (!result) goto failed;
8963
0
        value = ast2obj_list(state, (asdl_seq*)o->v.Interactive.body,
8964
0
                             ast2obj_stmt);
8965
0
        if (!value) goto failed;
8966
0
        if (PyObject_SetAttr(result, state->body, value) == -1)
8967
0
            goto failed;
8968
0
        Py_DECREF(value);
8969
0
        break;
8970
0
    case Expression_kind:
8971
0
        tp = (PyTypeObject *)state->Expression_type;
8972
0
        result = PyType_GenericNew(tp, NULL, NULL);
8973
0
        if (!result) goto failed;
8974
0
        value = ast2obj_expr(state, o->v.Expression.body);
8975
0
        if (!value) goto failed;
8976
0
        if (PyObject_SetAttr(result, state->body, value) == -1)
8977
0
            goto failed;
8978
0
        Py_DECREF(value);
8979
0
        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
6.10k
    }
8997
6.10k
    Py_LeaveRecursiveCall();
8998
6.10k
    return result;
8999
0
failed:
9000
0
    Py_LeaveRecursiveCall();
9001
0
    Py_XDECREF(value);
9002
0
    Py_XDECREF(result);
9003
0
    return NULL;
9004
6.10k
}
9005
9006
PyObject*
9007
ast2obj_stmt(struct ast_state *state, void* _o)
9008
39.4k
{
9009
39.4k
    stmt_ty o = (stmt_ty)_o;
9010
39.4k
    PyObject *result = NULL, *value = NULL;
9011
39.4k
    PyTypeObject *tp;
9012
39.4k
    if (!o) {
9013
0
        Py_RETURN_NONE;
9014
0
    }
9015
39.4k
    if (Py_EnterRecursiveCall("during  ast construction")) {
9016
0
        return NULL;
9017
0
    }
9018
39.4k
    switch (o->kind) {
9019
1.57k
    case FunctionDef_kind:
9020
1.57k
        tp = (PyTypeObject *)state->FunctionDef_type;
9021
1.57k
        result = PyType_GenericNew(tp, NULL, NULL);
9022
1.57k
        if (!result) goto failed;
9023
1.57k
        value = ast2obj_identifier(state, o->v.FunctionDef.name);
9024
1.57k
        if (!value) goto failed;
9025
1.57k
        if (PyObject_SetAttr(result, state->name, value) == -1)
9026
0
            goto failed;
9027
1.57k
        Py_DECREF(value);
9028
1.57k
        value = ast2obj_arguments(state, o->v.FunctionDef.args);
9029
1.57k
        if (!value) goto failed;
9030
1.57k
        if (PyObject_SetAttr(result, state->args, value) == -1)
9031
0
            goto failed;
9032
1.57k
        Py_DECREF(value);
9033
1.57k
        value = ast2obj_list(state, (asdl_seq*)o->v.FunctionDef.body,
9034
1.57k
                             ast2obj_stmt);
9035
1.57k
        if (!value) goto failed;
9036
1.57k
        if (PyObject_SetAttr(result, state->body, value) == -1)
9037
0
            goto failed;
9038
1.57k
        Py_DECREF(value);
9039
1.57k
        value = ast2obj_list(state, (asdl_seq*)o->v.FunctionDef.decorator_list,
9040
1.57k
                             ast2obj_expr);
9041
1.57k
        if (!value) goto failed;
9042
1.57k
        if (PyObject_SetAttr(result, state->decorator_list, value) == -1)
9043
0
            goto failed;
9044
1.57k
        Py_DECREF(value);
9045
1.57k
        value = ast2obj_expr(state, o->v.FunctionDef.returns);
9046
1.57k
        if (!value) goto failed;
9047
1.57k
        if (PyObject_SetAttr(result, state->returns, value) == -1)
9048
0
            goto failed;
9049
1.57k
        Py_DECREF(value);
9050
1.57k
        value = ast2obj_string(state, o->v.FunctionDef.type_comment);
9051
1.57k
        if (!value) goto failed;
9052
1.57k
        if (PyObject_SetAttr(result, state->type_comment, value) == -1)
9053
0
            goto failed;
9054
1.57k
        Py_DECREF(value);
9055
1.57k
        value = ast2obj_list(state, (asdl_seq*)o->v.FunctionDef.type_params,
9056
1.57k
                             ast2obj_type_param);
9057
1.57k
        if (!value) goto failed;
9058
1.57k
        if (PyObject_SetAttr(result, state->type_params, value) == -1)
9059
0
            goto failed;
9060
1.57k
        Py_DECREF(value);
9061
1.57k
        break;
9062
233
    case AsyncFunctionDef_kind:
9063
233
        tp = (PyTypeObject *)state->AsyncFunctionDef_type;
9064
233
        result = PyType_GenericNew(tp, NULL, NULL);
9065
233
        if (!result) goto failed;
9066
233
        value = ast2obj_identifier(state, o->v.AsyncFunctionDef.name);
9067
233
        if (!value) goto failed;
9068
233
        if (PyObject_SetAttr(result, state->name, value) == -1)
9069
0
            goto failed;
9070
233
        Py_DECREF(value);
9071
233
        value = ast2obj_arguments(state, o->v.AsyncFunctionDef.args);
9072
233
        if (!value) goto failed;
9073
233
        if (PyObject_SetAttr(result, state->args, value) == -1)
9074
0
            goto failed;
9075
233
        Py_DECREF(value);
9076
233
        value = ast2obj_list(state, (asdl_seq*)o->v.AsyncFunctionDef.body,
9077
233
                             ast2obj_stmt);
9078
233
        if (!value) goto failed;
9079
233
        if (PyObject_SetAttr(result, state->body, value) == -1)
9080
0
            goto failed;
9081
233
        Py_DECREF(value);
9082
233
        value = ast2obj_list(state,
9083
233
                             (asdl_seq*)o->v.AsyncFunctionDef.decorator_list,
9084
233
                             ast2obj_expr);
9085
233
        if (!value) goto failed;
9086
233
        if (PyObject_SetAttr(result, state->decorator_list, value) == -1)
9087
0
            goto failed;
9088
233
        Py_DECREF(value);
9089
233
        value = ast2obj_expr(state, o->v.AsyncFunctionDef.returns);
9090
233
        if (!value) goto failed;
9091
233
        if (PyObject_SetAttr(result, state->returns, value) == -1)
9092
0
            goto failed;
9093
233
        Py_DECREF(value);
9094
233
        value = ast2obj_string(state, o->v.AsyncFunctionDef.type_comment);
9095
233
        if (!value) goto failed;
9096
233
        if (PyObject_SetAttr(result, state->type_comment, value) == -1)
9097
0
            goto failed;
9098
233
        Py_DECREF(value);
9099
233
        value = ast2obj_list(state,
9100
233
                             (asdl_seq*)o->v.AsyncFunctionDef.type_params,
9101
233
                             ast2obj_type_param);
9102
233
        if (!value) goto failed;
9103
233
        if (PyObject_SetAttr(result, state->type_params, value) == -1)
9104
0
            goto failed;
9105
233
        Py_DECREF(value);
9106
233
        break;
9107
536
    case ClassDef_kind:
9108
536
        tp = (PyTypeObject *)state->ClassDef_type;
9109
536
        result = PyType_GenericNew(tp, NULL, NULL);
9110
536
        if (!result) goto failed;
9111
536
        value = ast2obj_identifier(state, o->v.ClassDef.name);
9112
536
        if (!value) goto failed;
9113
536
        if (PyObject_SetAttr(result, state->name, value) == -1)
9114
0
            goto failed;
9115
536
        Py_DECREF(value);
9116
536
        value = ast2obj_list(state, (asdl_seq*)o->v.ClassDef.bases,
9117
536
                             ast2obj_expr);
9118
536
        if (!value) goto failed;
9119
536
        if (PyObject_SetAttr(result, state->bases, value) == -1)
9120
0
            goto failed;
9121
536
        Py_DECREF(value);
9122
536
        value = ast2obj_list(state, (asdl_seq*)o->v.ClassDef.keywords,
9123
536
                             ast2obj_keyword);
9124
536
        if (!value) goto failed;
9125
536
        if (PyObject_SetAttr(result, state->keywords, value) == -1)
9126
0
            goto failed;
9127
536
        Py_DECREF(value);
9128
536
        value = ast2obj_list(state, (asdl_seq*)o->v.ClassDef.body,
9129
536
                             ast2obj_stmt);
9130
536
        if (!value) goto failed;
9131
536
        if (PyObject_SetAttr(result, state->body, value) == -1)
9132
0
            goto failed;
9133
536
        Py_DECREF(value);
9134
536
        value = ast2obj_list(state, (asdl_seq*)o->v.ClassDef.decorator_list,
9135
536
                             ast2obj_expr);
9136
536
        if (!value) goto failed;
9137
536
        if (PyObject_SetAttr(result, state->decorator_list, value) == -1)
9138
0
            goto failed;
9139
536
        Py_DECREF(value);
9140
536
        value = ast2obj_list(state, (asdl_seq*)o->v.ClassDef.type_params,
9141
536
                             ast2obj_type_param);
9142
536
        if (!value) goto failed;
9143
536
        if (PyObject_SetAttr(result, state->type_params, value) == -1)
9144
0
            goto failed;
9145
536
        Py_DECREF(value);
9146
536
        break;
9147
244
    case Return_kind:
9148
244
        tp = (PyTypeObject *)state->Return_type;
9149
244
        result = PyType_GenericNew(tp, NULL, NULL);
9150
244
        if (!result) goto failed;
9151
244
        value = ast2obj_expr(state, o->v.Return.value);
9152
244
        if (!value) goto failed;
9153
244
        if (PyObject_SetAttr(result, state->value, value) == -1)
9154
0
            goto failed;
9155
244
        Py_DECREF(value);
9156
244
        break;
9157
231
    case Delete_kind:
9158
231
        tp = (PyTypeObject *)state->Delete_type;
9159
231
        result = PyType_GenericNew(tp, NULL, NULL);
9160
231
        if (!result) goto failed;
9161
231
        value = ast2obj_list(state, (asdl_seq*)o->v.Delete.targets,
9162
231
                             ast2obj_expr);
9163
231
        if (!value) goto failed;
9164
231
        if (PyObject_SetAttr(result, state->targets, value) == -1)
9165
0
            goto failed;
9166
231
        Py_DECREF(value);
9167
231
        break;
9168
930
    case Assign_kind:
9169
930
        tp = (PyTypeObject *)state->Assign_type;
9170
930
        result = PyType_GenericNew(tp, NULL, NULL);
9171
930
        if (!result) goto failed;
9172
930
        value = ast2obj_list(state, (asdl_seq*)o->v.Assign.targets,
9173
930
                             ast2obj_expr);
9174
930
        if (!value) goto failed;
9175
930
        if (PyObject_SetAttr(result, state->targets, value) == -1)
9176
0
            goto failed;
9177
930
        Py_DECREF(value);
9178
930
        value = ast2obj_expr(state, o->v.Assign.value);
9179
930
        if (!value) goto failed;
9180
930
        if (PyObject_SetAttr(result, state->value, value) == -1)
9181
0
            goto failed;
9182
930
        Py_DECREF(value);
9183
930
        value = ast2obj_string(state, o->v.Assign.type_comment);
9184
930
        if (!value) goto failed;
9185
930
        if (PyObject_SetAttr(result, state->type_comment, value) == -1)
9186
0
            goto failed;
9187
930
        Py_DECREF(value);
9188
930
        break;
9189
73
    case TypeAlias_kind:
9190
73
        tp = (PyTypeObject *)state->TypeAlias_type;
9191
73
        result = PyType_GenericNew(tp, NULL, NULL);
9192
73
        if (!result) goto failed;
9193
73
        value = ast2obj_expr(state, o->v.TypeAlias.name);
9194
73
        if (!value) goto failed;
9195
73
        if (PyObject_SetAttr(result, state->name, value) == -1)
9196
0
            goto failed;
9197
73
        Py_DECREF(value);
9198
73
        value = ast2obj_list(state, (asdl_seq*)o->v.TypeAlias.type_params,
9199
73
                             ast2obj_type_param);
9200
73
        if (!value) goto failed;
9201
73
        if (PyObject_SetAttr(result, state->type_params, value) == -1)
9202
0
            goto failed;
9203
73
        Py_DECREF(value);
9204
73
        value = ast2obj_expr(state, o->v.TypeAlias.value);
9205
73
        if (!value) goto failed;
9206
73
        if (PyObject_SetAttr(result, state->value, value) == -1)
9207
0
            goto failed;
9208
73
        Py_DECREF(value);
9209
73
        break;
9210
329
    case AugAssign_kind:
9211
329
        tp = (PyTypeObject *)state->AugAssign_type;
9212
329
        result = PyType_GenericNew(tp, NULL, NULL);
9213
329
        if (!result) goto failed;
9214
329
        value = ast2obj_expr(state, o->v.AugAssign.target);
9215
329
        if (!value) goto failed;
9216
329
        if (PyObject_SetAttr(result, state->target, value) == -1)
9217
0
            goto failed;
9218
329
        Py_DECREF(value);
9219
329
        value = ast2obj_operator(state, o->v.AugAssign.op);
9220
329
        if (!value) goto failed;
9221
329
        if (PyObject_SetAttr(result, state->op, value) == -1)
9222
0
            goto failed;
9223
329
        Py_DECREF(value);
9224
329
        value = ast2obj_expr(state, o->v.AugAssign.value);
9225
329
        if (!value) goto failed;
9226
329
        if (PyObject_SetAttr(result, state->value, value) == -1)
9227
0
            goto failed;
9228
329
        Py_DECREF(value);
9229
329
        break;
9230
1.11k
    case AnnAssign_kind:
9231
1.11k
        tp = (PyTypeObject *)state->AnnAssign_type;
9232
1.11k
        result = PyType_GenericNew(tp, NULL, NULL);
9233
1.11k
        if (!result) goto failed;
9234
1.11k
        value = ast2obj_expr(state, o->v.AnnAssign.target);
9235
1.11k
        if (!value) goto failed;
9236
1.11k
        if (PyObject_SetAttr(result, state->target, value) == -1)
9237
0
            goto failed;
9238
1.11k
        Py_DECREF(value);
9239
1.11k
        value = ast2obj_expr(state, o->v.AnnAssign.annotation);
9240
1.11k
        if (!value) goto failed;
9241
1.11k
        if (PyObject_SetAttr(result, state->annotation, value) == -1)
9242
0
            goto failed;
9243
1.11k
        Py_DECREF(value);
9244
1.11k
        value = ast2obj_expr(state, o->v.AnnAssign.value);
9245
1.11k
        if (!value) goto failed;
9246
1.11k
        if (PyObject_SetAttr(result, state->value, value) == -1)
9247
0
            goto failed;
9248
1.11k
        Py_DECREF(value);
9249
1.11k
        value = ast2obj_int(state, o->v.AnnAssign.simple);
9250
1.11k
        if (!value) goto failed;
9251
1.11k
        if (PyObject_SetAttr(result, state->simple, value) == -1)
9252
0
            goto failed;
9253
1.11k
        Py_DECREF(value);
9254
1.11k
        break;
9255
318
    case For_kind:
9256
318
        tp = (PyTypeObject *)state->For_type;
9257
318
        result = PyType_GenericNew(tp, NULL, NULL);
9258
318
        if (!result) goto failed;
9259
318
        value = ast2obj_expr(state, o->v.For.target);
9260
318
        if (!value) goto failed;
9261
318
        if (PyObject_SetAttr(result, state->target, value) == -1)
9262
0
            goto failed;
9263
318
        Py_DECREF(value);
9264
318
        value = ast2obj_expr(state, o->v.For.iter);
9265
318
        if (!value) goto failed;
9266
318
        if (PyObject_SetAttr(result, state->iter, value) == -1)
9267
0
            goto failed;
9268
318
        Py_DECREF(value);
9269
318
        value = ast2obj_list(state, (asdl_seq*)o->v.For.body, ast2obj_stmt);
9270
318
        if (!value) goto failed;
9271
318
        if (PyObject_SetAttr(result, state->body, value) == -1)
9272
0
            goto failed;
9273
318
        Py_DECREF(value);
9274
318
        value = ast2obj_list(state, (asdl_seq*)o->v.For.orelse, ast2obj_stmt);
9275
318
        if (!value) goto failed;
9276
318
        if (PyObject_SetAttr(result, state->orelse, value) == -1)
9277
0
            goto failed;
9278
318
        Py_DECREF(value);
9279
318
        value = ast2obj_string(state, o->v.For.type_comment);
9280
318
        if (!value) goto failed;
9281
318
        if (PyObject_SetAttr(result, state->type_comment, value) == -1)
9282
0
            goto failed;
9283
318
        Py_DECREF(value);
9284
318
        break;
9285
113
    case AsyncFor_kind:
9286
113
        tp = (PyTypeObject *)state->AsyncFor_type;
9287
113
        result = PyType_GenericNew(tp, NULL, NULL);
9288
113
        if (!result) goto failed;
9289
113
        value = ast2obj_expr(state, o->v.AsyncFor.target);
9290
113
        if (!value) goto failed;
9291
113
        if (PyObject_SetAttr(result, state->target, value) == -1)
9292
0
            goto failed;
9293
113
        Py_DECREF(value);
9294
113
        value = ast2obj_expr(state, o->v.AsyncFor.iter);
9295
113
        if (!value) goto failed;
9296
113
        if (PyObject_SetAttr(result, state->iter, value) == -1)
9297
0
            goto failed;
9298
113
        Py_DECREF(value);
9299
113
        value = ast2obj_list(state, (asdl_seq*)o->v.AsyncFor.body,
9300
113
                             ast2obj_stmt);
9301
113
        if (!value) goto failed;
9302
113
        if (PyObject_SetAttr(result, state->body, value) == -1)
9303
0
            goto failed;
9304
113
        Py_DECREF(value);
9305
113
        value = ast2obj_list(state, (asdl_seq*)o->v.AsyncFor.orelse,
9306
113
                             ast2obj_stmt);
9307
113
        if (!value) goto failed;
9308
113
        if (PyObject_SetAttr(result, state->orelse, value) == -1)
9309
0
            goto failed;
9310
113
        Py_DECREF(value);
9311
113
        value = ast2obj_string(state, o->v.AsyncFor.type_comment);
9312
113
        if (!value) goto failed;
9313
113
        if (PyObject_SetAttr(result, state->type_comment, value) == -1)
9314
0
            goto failed;
9315
113
        Py_DECREF(value);
9316
113
        break;
9317
224
    case While_kind:
9318
224
        tp = (PyTypeObject *)state->While_type;
9319
224
        result = PyType_GenericNew(tp, NULL, NULL);
9320
224
        if (!result) goto failed;
9321
224
        value = ast2obj_expr(state, o->v.While.test);
9322
224
        if (!value) goto failed;
9323
224
        if (PyObject_SetAttr(result, state->test, value) == -1)
9324
0
            goto failed;
9325
224
        Py_DECREF(value);
9326
224
        value = ast2obj_list(state, (asdl_seq*)o->v.While.body, ast2obj_stmt);
9327
224
        if (!value) goto failed;
9328
224
        if (PyObject_SetAttr(result, state->body, value) == -1)
9329
0
            goto failed;
9330
224
        Py_DECREF(value);
9331
224
        value = ast2obj_list(state, (asdl_seq*)o->v.While.orelse, ast2obj_stmt);
9332
224
        if (!value) goto failed;
9333
224
        if (PyObject_SetAttr(result, state->orelse, value) == -1)
9334
0
            goto failed;
9335
224
        Py_DECREF(value);
9336
224
        break;
9337
527
    case If_kind:
9338
527
        tp = (PyTypeObject *)state->If_type;
9339
527
        result = PyType_GenericNew(tp, NULL, NULL);
9340
527
        if (!result) goto failed;
9341
527
        value = ast2obj_expr(state, o->v.If.test);
9342
527
        if (!value) goto failed;
9343
527
        if (PyObject_SetAttr(result, state->test, value) == -1)
9344
0
            goto failed;
9345
527
        Py_DECREF(value);
9346
527
        value = ast2obj_list(state, (asdl_seq*)o->v.If.body, ast2obj_stmt);
9347
527
        if (!value) goto failed;
9348
527
        if (PyObject_SetAttr(result, state->body, value) == -1)
9349
0
            goto failed;
9350
527
        Py_DECREF(value);
9351
527
        value = ast2obj_list(state, (asdl_seq*)o->v.If.orelse, ast2obj_stmt);
9352
527
        if (!value) goto failed;
9353
527
        if (PyObject_SetAttr(result, state->orelse, value) == -1)
9354
0
            goto failed;
9355
527
        Py_DECREF(value);
9356
527
        break;
9357
216
    case With_kind:
9358
216
        tp = (PyTypeObject *)state->With_type;
9359
216
        result = PyType_GenericNew(tp, NULL, NULL);
9360
216
        if (!result) goto failed;
9361
216
        value = ast2obj_list(state, (asdl_seq*)o->v.With.items,
9362
216
                             ast2obj_withitem);
9363
216
        if (!value) goto failed;
9364
216
        if (PyObject_SetAttr(result, state->items, value) == -1)
9365
0
            goto failed;
9366
216
        Py_DECREF(value);
9367
216
        value = ast2obj_list(state, (asdl_seq*)o->v.With.body, ast2obj_stmt);
9368
216
        if (!value) goto failed;
9369
216
        if (PyObject_SetAttr(result, state->body, value) == -1)
9370
0
            goto failed;
9371
216
        Py_DECREF(value);
9372
216
        value = ast2obj_string(state, o->v.With.type_comment);
9373
216
        if (!value) goto failed;
9374
216
        if (PyObject_SetAttr(result, state->type_comment, value) == -1)
9375
0
            goto failed;
9376
216
        Py_DECREF(value);
9377
216
        break;
9378
154
    case AsyncWith_kind:
9379
154
        tp = (PyTypeObject *)state->AsyncWith_type;
9380
154
        result = PyType_GenericNew(tp, NULL, NULL);
9381
154
        if (!result) goto failed;
9382
154
        value = ast2obj_list(state, (asdl_seq*)o->v.AsyncWith.items,
9383
154
                             ast2obj_withitem);
9384
154
        if (!value) goto failed;
9385
154
        if (PyObject_SetAttr(result, state->items, value) == -1)
9386
0
            goto failed;
9387
154
        Py_DECREF(value);
9388
154
        value = ast2obj_list(state, (asdl_seq*)o->v.AsyncWith.body,
9389
154
                             ast2obj_stmt);
9390
154
        if (!value) goto failed;
9391
154
        if (PyObject_SetAttr(result, state->body, value) == -1)
9392
0
            goto failed;
9393
154
        Py_DECREF(value);
9394
154
        value = ast2obj_string(state, o->v.AsyncWith.type_comment);
9395
154
        if (!value) goto failed;
9396
154
        if (PyObject_SetAttr(result, state->type_comment, value) == -1)
9397
0
            goto failed;
9398
154
        Py_DECREF(value);
9399
154
        break;
9400
200
    case Match_kind:
9401
200
        tp = (PyTypeObject *)state->Match_type;
9402
200
        result = PyType_GenericNew(tp, NULL, NULL);
9403
200
        if (!result) goto failed;
9404
200
        value = ast2obj_expr(state, o->v.Match.subject);
9405
200
        if (!value) goto failed;
9406
200
        if (PyObject_SetAttr(result, state->subject, value) == -1)
9407
0
            goto failed;
9408
200
        Py_DECREF(value);
9409
200
        value = ast2obj_list(state, (asdl_seq*)o->v.Match.cases,
9410
200
                             ast2obj_match_case);
9411
200
        if (!value) goto failed;
9412
200
        if (PyObject_SetAttr(result, state->cases, value) == -1)
9413
0
            goto failed;
9414
200
        Py_DECREF(value);
9415
200
        break;
9416
353
    case Raise_kind:
9417
353
        tp = (PyTypeObject *)state->Raise_type;
9418
353
        result = PyType_GenericNew(tp, NULL, NULL);
9419
353
        if (!result) goto failed;
9420
353
        value = ast2obj_expr(state, o->v.Raise.exc);
9421
353
        if (!value) goto failed;
9422
353
        if (PyObject_SetAttr(result, state->exc, value) == -1)
9423
0
            goto failed;
9424
353
        Py_DECREF(value);
9425
353
        value = ast2obj_expr(state, o->v.Raise.cause);
9426
353
        if (!value) goto failed;
9427
353
        if (PyObject_SetAttr(result, state->cause, value) == -1)
9428
0
            goto failed;
9429
353
        Py_DECREF(value);
9430
353
        break;
9431
344
    case Try_kind:
9432
344
        tp = (PyTypeObject *)state->Try_type;
9433
344
        result = PyType_GenericNew(tp, NULL, NULL);
9434
344
        if (!result) goto failed;
9435
344
        value = ast2obj_list(state, (asdl_seq*)o->v.Try.body, ast2obj_stmt);
9436
344
        if (!value) goto failed;
9437
344
        if (PyObject_SetAttr(result, state->body, value) == -1)
9438
0
            goto failed;
9439
344
        Py_DECREF(value);
9440
344
        value = ast2obj_list(state, (asdl_seq*)o->v.Try.handlers,
9441
344
                             ast2obj_excepthandler);
9442
344
        if (!value) goto failed;
9443
344
        if (PyObject_SetAttr(result, state->handlers, value) == -1)
9444
0
            goto failed;
9445
344
        Py_DECREF(value);
9446
344
        value = ast2obj_list(state, (asdl_seq*)o->v.Try.orelse, ast2obj_stmt);
9447
344
        if (!value) goto failed;
9448
344
        if (PyObject_SetAttr(result, state->orelse, value) == -1)
9449
0
            goto failed;
9450
344
        Py_DECREF(value);
9451
344
        value = ast2obj_list(state, (asdl_seq*)o->v.Try.finalbody,
9452
344
                             ast2obj_stmt);
9453
344
        if (!value) goto failed;
9454
344
        if (PyObject_SetAttr(result, state->finalbody, value) == -1)
9455
0
            goto failed;
9456
344
        Py_DECREF(value);
9457
344
        break;
9458
512
    case TryStar_kind:
9459
512
        tp = (PyTypeObject *)state->TryStar_type;
9460
512
        result = PyType_GenericNew(tp, NULL, NULL);
9461
512
        if (!result) goto failed;
9462
512
        value = ast2obj_list(state, (asdl_seq*)o->v.TryStar.body, ast2obj_stmt);
9463
512
        if (!value) goto failed;
9464
512
        if (PyObject_SetAttr(result, state->body, value) == -1)
9465
0
            goto failed;
9466
512
        Py_DECREF(value);
9467
512
        value = ast2obj_list(state, (asdl_seq*)o->v.TryStar.handlers,
9468
512
                             ast2obj_excepthandler);
9469
512
        if (!value) goto failed;
9470
512
        if (PyObject_SetAttr(result, state->handlers, value) == -1)
9471
0
            goto failed;
9472
512
        Py_DECREF(value);
9473
512
        value = ast2obj_list(state, (asdl_seq*)o->v.TryStar.orelse,
9474
512
                             ast2obj_stmt);
9475
512
        if (!value) goto failed;
9476
512
        if (PyObject_SetAttr(result, state->orelse, value) == -1)
9477
0
            goto failed;
9478
512
        Py_DECREF(value);
9479
512
        value = ast2obj_list(state, (asdl_seq*)o->v.TryStar.finalbody,
9480
512
                             ast2obj_stmt);
9481
512
        if (!value) goto failed;
9482
512
        if (PyObject_SetAttr(result, state->finalbody, value) == -1)
9483
0
            goto failed;
9484
512
        Py_DECREF(value);
9485
512
        break;
9486
419
    case Assert_kind:
9487
419
        tp = (PyTypeObject *)state->Assert_type;
9488
419
        result = PyType_GenericNew(tp, NULL, NULL);
9489
419
        if (!result) goto failed;
9490
419
        value = ast2obj_expr(state, o->v.Assert.test);
9491
419
        if (!value) goto failed;
9492
419
        if (PyObject_SetAttr(result, state->test, value) == -1)
9493
0
            goto failed;
9494
419
        Py_DECREF(value);
9495
419
        value = ast2obj_expr(state, o->v.Assert.msg);
9496
419
        if (!value) goto failed;
9497
419
        if (PyObject_SetAttr(result, state->msg, value) == -1)
9498
0
            goto failed;
9499
419
        Py_DECREF(value);
9500
419
        break;
9501
777
    case Import_kind:
9502
777
        tp = (PyTypeObject *)state->Import_type;
9503
777
        result = PyType_GenericNew(tp, NULL, NULL);
9504
777
        if (!result) goto failed;
9505
777
        value = ast2obj_list(state, (asdl_seq*)o->v.Import.names,
9506
777
                             ast2obj_alias);
9507
777
        if (!value) goto failed;
9508
777
        if (PyObject_SetAttr(result, state->names, value) == -1)
9509
0
            goto failed;
9510
777
        Py_DECREF(value);
9511
777
        value = ast2obj_int(state, o->v.Import.is_lazy);
9512
777
        if (!value) goto failed;
9513
777
        if (PyObject_SetAttr(result, state->is_lazy, value) == -1)
9514
0
            goto failed;
9515
777
        Py_DECREF(value);
9516
777
        break;
9517
791
    case ImportFrom_kind:
9518
791
        tp = (PyTypeObject *)state->ImportFrom_type;
9519
791
        result = PyType_GenericNew(tp, NULL, NULL);
9520
791
        if (!result) goto failed;
9521
791
        value = ast2obj_identifier(state, o->v.ImportFrom.module);
9522
791
        if (!value) goto failed;
9523
791
        if (PyObject_SetAttr(result, state->module, value) == -1)
9524
0
            goto failed;
9525
791
        Py_DECREF(value);
9526
791
        value = ast2obj_list(state, (asdl_seq*)o->v.ImportFrom.names,
9527
791
                             ast2obj_alias);
9528
791
        if (!value) goto failed;
9529
791
        if (PyObject_SetAttr(result, state->names, value) == -1)
9530
0
            goto failed;
9531
791
        Py_DECREF(value);
9532
791
        value = ast2obj_int(state, o->v.ImportFrom.level);
9533
791
        if (!value) goto failed;
9534
791
        if (PyObject_SetAttr(result, state->level, value) == -1)
9535
0
            goto failed;
9536
791
        Py_DECREF(value);
9537
791
        value = ast2obj_int(state, o->v.ImportFrom.is_lazy);
9538
791
        if (!value) goto failed;
9539
791
        if (PyObject_SetAttr(result, state->is_lazy, value) == -1)
9540
0
            goto failed;
9541
791
        Py_DECREF(value);
9542
791
        break;
9543
114
    case Global_kind:
9544
114
        tp = (PyTypeObject *)state->Global_type;
9545
114
        result = PyType_GenericNew(tp, NULL, NULL);
9546
114
        if (!result) goto failed;
9547
114
        value = ast2obj_list(state, (asdl_seq*)o->v.Global.names,
9548
114
                             ast2obj_identifier);
9549
114
        if (!value) goto failed;
9550
114
        if (PyObject_SetAttr(result, state->names, value) == -1)
9551
0
            goto failed;
9552
114
        Py_DECREF(value);
9553
114
        break;
9554
67
    case Nonlocal_kind:
9555
67
        tp = (PyTypeObject *)state->Nonlocal_type;
9556
67
        result = PyType_GenericNew(tp, NULL, NULL);
9557
67
        if (!result) goto failed;
9558
67
        value = ast2obj_list(state, (asdl_seq*)o->v.Nonlocal.names,
9559
67
                             ast2obj_identifier);
9560
67
        if (!value) goto failed;
9561
67
        if (PyObject_SetAttr(result, state->names, value) == -1)
9562
0
            goto failed;
9563
67
        Py_DECREF(value);
9564
67
        break;
9565
27.7k
    case Expr_kind:
9566
27.7k
        tp = (PyTypeObject *)state->Expr_type;
9567
27.7k
        result = PyType_GenericNew(tp, NULL, NULL);
9568
27.7k
        if (!result) goto failed;
9569
27.7k
        value = ast2obj_expr(state, o->v.Expr.value);
9570
27.7k
        if (!value) goto failed;
9571
27.7k
        if (PyObject_SetAttr(result, state->value, value) == -1)
9572
0
            goto failed;
9573
27.7k
        Py_DECREF(value);
9574
27.7k
        break;
9575
821
    case Pass_kind:
9576
821
        tp = (PyTypeObject *)state->Pass_type;
9577
821
        result = PyType_GenericNew(tp, NULL, NULL);
9578
821
        if (!result) goto failed;
9579
821
        break;
9580
821
    case Break_kind:
9581
299
        tp = (PyTypeObject *)state->Break_type;
9582
299
        result = PyType_GenericNew(tp, NULL, NULL);
9583
299
        if (!result) goto failed;
9584
299
        break;
9585
299
    case Continue_kind:
9586
232
        tp = (PyTypeObject *)state->Continue_type;
9587
232
        result = PyType_GenericNew(tp, NULL, NULL);
9588
232
        if (!result) goto failed;
9589
232
        break;
9590
39.4k
    }
9591
39.4k
    value = ast2obj_int(state, o->lineno);
9592
39.4k
    if (!value) goto failed;
9593
39.4k
    if (PyObject_SetAttr(result, state->lineno, value) < 0)
9594
0
        goto failed;
9595
39.4k
    Py_DECREF(value);
9596
39.4k
    value = ast2obj_int(state, o->col_offset);
9597
39.4k
    if (!value) goto failed;
9598
39.4k
    if (PyObject_SetAttr(result, state->col_offset, value) < 0)
9599
0
        goto failed;
9600
39.4k
    Py_DECREF(value);
9601
39.4k
    value = ast2obj_int(state, o->end_lineno);
9602
39.4k
    if (!value) goto failed;
9603
39.4k
    if (PyObject_SetAttr(result, state->end_lineno, value) < 0)
9604
0
        goto failed;
9605
39.4k
    Py_DECREF(value);
9606
39.4k
    value = ast2obj_int(state, o->end_col_offset);
9607
39.4k
    if (!value) goto failed;
9608
39.4k
    if (PyObject_SetAttr(result, state->end_col_offset, value) < 0)
9609
0
        goto failed;
9610
39.4k
    Py_DECREF(value);
9611
39.4k
    Py_LeaveRecursiveCall();
9612
39.4k
    return result;
9613
0
failed:
9614
0
    Py_LeaveRecursiveCall();
9615
0
    Py_XDECREF(value);
9616
0
    Py_XDECREF(result);
9617
0
    return NULL;
9618
39.4k
}
9619
9620
PyObject*
9621
ast2obj_expr(struct ast_state *state, void* _o)
9622
443k
{
9623
443k
    expr_ty o = (expr_ty)_o;
9624
443k
    PyObject *result = NULL, *value = NULL;
9625
443k
    PyTypeObject *tp;
9626
443k
    if (!o) {
9627
48.3k
        Py_RETURN_NONE;
9628
48.3k
    }
9629
395k
    if (Py_EnterRecursiveCall("during  ast construction")) {
9630
0
        return NULL;
9631
0
    }
9632
395k
    switch (o->kind) {
9633
364
    case BoolOp_kind:
9634
364
        tp = (PyTypeObject *)state->BoolOp_type;
9635
364
        result = PyType_GenericNew(tp, NULL, NULL);
9636
364
        if (!result) goto failed;
9637
364
        value = ast2obj_boolop(state, o->v.BoolOp.op);
9638
364
        if (!value) goto failed;
9639
364
        if (PyObject_SetAttr(result, state->op, value) == -1)
9640
0
            goto failed;
9641
364
        Py_DECREF(value);
9642
364
        value = ast2obj_list(state, (asdl_seq*)o->v.BoolOp.values,
9643
364
                             ast2obj_expr);
9644
364
        if (!value) goto failed;
9645
364
        if (PyObject_SetAttr(result, state->values, value) == -1)
9646
0
            goto failed;
9647
364
        Py_DECREF(value);
9648
364
        break;
9649
69
    case NamedExpr_kind:
9650
69
        tp = (PyTypeObject *)state->NamedExpr_type;
9651
69
        result = PyType_GenericNew(tp, NULL, NULL);
9652
69
        if (!result) goto failed;
9653
69
        value = ast2obj_expr(state, o->v.NamedExpr.target);
9654
69
        if (!value) goto failed;
9655
69
        if (PyObject_SetAttr(result, state->target, value) == -1)
9656
0
            goto failed;
9657
69
        Py_DECREF(value);
9658
69
        value = ast2obj_expr(state, o->v.NamedExpr.value);
9659
69
        if (!value) goto failed;
9660
69
        if (PyObject_SetAttr(result, state->value, value) == -1)
9661
0
            goto failed;
9662
69
        Py_DECREF(value);
9663
69
        break;
9664
32.6k
    case BinOp_kind:
9665
32.6k
        tp = (PyTypeObject *)state->BinOp_type;
9666
32.6k
        result = PyType_GenericNew(tp, NULL, NULL);
9667
32.6k
        if (!result) goto failed;
9668
32.6k
        value = ast2obj_expr(state, o->v.BinOp.left);
9669
32.6k
        if (!value) goto failed;
9670
32.6k
        if (PyObject_SetAttr(result, state->left, value) == -1)
9671
0
            goto failed;
9672
32.6k
        Py_DECREF(value);
9673
32.6k
        value = ast2obj_operator(state, o->v.BinOp.op);
9674
32.6k
        if (!value) goto failed;
9675
32.6k
        if (PyObject_SetAttr(result, state->op, value) == -1)
9676
0
            goto failed;
9677
32.6k
        Py_DECREF(value);
9678
32.6k
        value = ast2obj_expr(state, o->v.BinOp.right);
9679
32.6k
        if (!value) goto failed;
9680
32.6k
        if (PyObject_SetAttr(result, state->right, value) == -1)
9681
0
            goto failed;
9682
32.6k
        Py_DECREF(value);
9683
32.6k
        break;
9684
179k
    case UnaryOp_kind:
9685
179k
        tp = (PyTypeObject *)state->UnaryOp_type;
9686
179k
        result = PyType_GenericNew(tp, NULL, NULL);
9687
179k
        if (!result) goto failed;
9688
179k
        value = ast2obj_unaryop(state, o->v.UnaryOp.op);
9689
179k
        if (!value) goto failed;
9690
179k
        if (PyObject_SetAttr(result, state->op, value) == -1)
9691
0
            goto failed;
9692
179k
        Py_DECREF(value);
9693
179k
        value = ast2obj_expr(state, o->v.UnaryOp.operand);
9694
179k
        if (!value) goto failed;
9695
179k
        if (PyObject_SetAttr(result, state->operand, value) == -1)
9696
0
            goto failed;
9697
179k
        Py_DECREF(value);
9698
179k
        break;
9699
850
    case Lambda_kind:
9700
850
        tp = (PyTypeObject *)state->Lambda_type;
9701
850
        result = PyType_GenericNew(tp, NULL, NULL);
9702
850
        if (!result) goto failed;
9703
850
        value = ast2obj_arguments(state, o->v.Lambda.args);
9704
850
        if (!value) goto failed;
9705
850
        if (PyObject_SetAttr(result, state->args, value) == -1)
9706
0
            goto failed;
9707
850
        Py_DECREF(value);
9708
850
        value = ast2obj_expr(state, o->v.Lambda.body);
9709
850
        if (!value) goto failed;
9710
850
        if (PyObject_SetAttr(result, state->body, value) == -1)
9711
0
            goto failed;
9712
850
        Py_DECREF(value);
9713
850
        break;
9714
229
    case IfExp_kind:
9715
229
        tp = (PyTypeObject *)state->IfExp_type;
9716
229
        result = PyType_GenericNew(tp, NULL, NULL);
9717
229
        if (!result) goto failed;
9718
229
        value = ast2obj_expr(state, o->v.IfExp.test);
9719
229
        if (!value) goto failed;
9720
229
        if (PyObject_SetAttr(result, state->test, value) == -1)
9721
0
            goto failed;
9722
229
        Py_DECREF(value);
9723
229
        value = ast2obj_expr(state, o->v.IfExp.body);
9724
229
        if (!value) goto failed;
9725
229
        if (PyObject_SetAttr(result, state->body, value) == -1)
9726
0
            goto failed;
9727
229
        Py_DECREF(value);
9728
229
        value = ast2obj_expr(state, o->v.IfExp.orelse);
9729
229
        if (!value) goto failed;
9730
229
        if (PyObject_SetAttr(result, state->orelse, value) == -1)
9731
0
            goto failed;
9732
229
        Py_DECREF(value);
9733
229
        break;
9734
2.43k
    case Dict_kind:
9735
2.43k
        tp = (PyTypeObject *)state->Dict_type;
9736
2.43k
        result = PyType_GenericNew(tp, NULL, NULL);
9737
2.43k
        if (!result) goto failed;
9738
2.43k
        value = ast2obj_list(state, (asdl_seq*)o->v.Dict.keys, ast2obj_expr);
9739
2.43k
        if (!value) goto failed;
9740
2.43k
        if (PyObject_SetAttr(result, state->keys, value) == -1)
9741
0
            goto failed;
9742
2.43k
        Py_DECREF(value);
9743
2.43k
        value = ast2obj_list(state, (asdl_seq*)o->v.Dict.values, ast2obj_expr);
9744
2.43k
        if (!value) goto failed;
9745
2.43k
        if (PyObject_SetAttr(result, state->values, value) == -1)
9746
0
            goto failed;
9747
2.43k
        Py_DECREF(value);
9748
2.43k
        break;
9749
174
    case Set_kind:
9750
174
        tp = (PyTypeObject *)state->Set_type;
9751
174
        result = PyType_GenericNew(tp, NULL, NULL);
9752
174
        if (!result) goto failed;
9753
174
        value = ast2obj_list(state, (asdl_seq*)o->v.Set.elts, ast2obj_expr);
9754
174
        if (!value) goto failed;
9755
174
        if (PyObject_SetAttr(result, state->elts, value) == -1)
9756
0
            goto failed;
9757
174
        Py_DECREF(value);
9758
174
        break;
9759
201
    case ListComp_kind:
9760
201
        tp = (PyTypeObject *)state->ListComp_type;
9761
201
        result = PyType_GenericNew(tp, NULL, NULL);
9762
201
        if (!result) goto failed;
9763
201
        value = ast2obj_expr(state, o->v.ListComp.elt);
9764
201
        if (!value) goto failed;
9765
201
        if (PyObject_SetAttr(result, state->elt, value) == -1)
9766
0
            goto failed;
9767
201
        Py_DECREF(value);
9768
201
        value = ast2obj_list(state, (asdl_seq*)o->v.ListComp.generators,
9769
201
                             ast2obj_comprehension);
9770
201
        if (!value) goto failed;
9771
201
        if (PyObject_SetAttr(result, state->generators, value) == -1)
9772
0
            goto failed;
9773
201
        Py_DECREF(value);
9774
201
        break;
9775
314
    case SetComp_kind:
9776
314
        tp = (PyTypeObject *)state->SetComp_type;
9777
314
        result = PyType_GenericNew(tp, NULL, NULL);
9778
314
        if (!result) goto failed;
9779
314
        value = ast2obj_expr(state, o->v.SetComp.elt);
9780
314
        if (!value) goto failed;
9781
314
        if (PyObject_SetAttr(result, state->elt, value) == -1)
9782
0
            goto failed;
9783
314
        Py_DECREF(value);
9784
314
        value = ast2obj_list(state, (asdl_seq*)o->v.SetComp.generators,
9785
314
                             ast2obj_comprehension);
9786
314
        if (!value) goto failed;
9787
314
        if (PyObject_SetAttr(result, state->generators, value) == -1)
9788
0
            goto failed;
9789
314
        Py_DECREF(value);
9790
314
        break;
9791
267
    case DictComp_kind:
9792
267
        tp = (PyTypeObject *)state->DictComp_type;
9793
267
        result = PyType_GenericNew(tp, NULL, NULL);
9794
267
        if (!result) goto failed;
9795
267
        value = ast2obj_expr(state, o->v.DictComp.key);
9796
267
        if (!value) goto failed;
9797
267
        if (PyObject_SetAttr(result, state->key, value) == -1)
9798
0
            goto failed;
9799
267
        Py_DECREF(value);
9800
267
        value = ast2obj_expr(state, o->v.DictComp.value);
9801
267
        if (!value) goto failed;
9802
267
        if (PyObject_SetAttr(result, state->value, value) == -1)
9803
0
            goto failed;
9804
267
        Py_DECREF(value);
9805
267
        value = ast2obj_list(state, (asdl_seq*)o->v.DictComp.generators,
9806
267
                             ast2obj_comprehension);
9807
267
        if (!value) goto failed;
9808
267
        if (PyObject_SetAttr(result, state->generators, value) == -1)
9809
0
            goto failed;
9810
267
        Py_DECREF(value);
9811
267
        break;
9812
379
    case GeneratorExp_kind:
9813
379
        tp = (PyTypeObject *)state->GeneratorExp_type;
9814
379
        result = PyType_GenericNew(tp, NULL, NULL);
9815
379
        if (!result) goto failed;
9816
379
        value = ast2obj_expr(state, o->v.GeneratorExp.elt);
9817
379
        if (!value) goto failed;
9818
379
        if (PyObject_SetAttr(result, state->elt, value) == -1)
9819
0
            goto failed;
9820
379
        Py_DECREF(value);
9821
379
        value = ast2obj_list(state, (asdl_seq*)o->v.GeneratorExp.generators,
9822
379
                             ast2obj_comprehension);
9823
379
        if (!value) goto failed;
9824
379
        if (PyObject_SetAttr(result, state->generators, value) == -1)
9825
0
            goto failed;
9826
379
        Py_DECREF(value);
9827
379
        break;
9828
77
    case Await_kind:
9829
77
        tp = (PyTypeObject *)state->Await_type;
9830
77
        result = PyType_GenericNew(tp, NULL, NULL);
9831
77
        if (!result) goto failed;
9832
77
        value = ast2obj_expr(state, o->v.Await.value);
9833
77
        if (!value) goto failed;
9834
77
        if (PyObject_SetAttr(result, state->value, value) == -1)
9835
0
            goto failed;
9836
77
        Py_DECREF(value);
9837
77
        break;
9838
774
    case Yield_kind:
9839
774
        tp = (PyTypeObject *)state->Yield_type;
9840
774
        result = PyType_GenericNew(tp, NULL, NULL);
9841
774
        if (!result) goto failed;
9842
774
        value = ast2obj_expr(state, o->v.Yield.value);
9843
774
        if (!value) goto failed;
9844
774
        if (PyObject_SetAttr(result, state->value, value) == -1)
9845
0
            goto failed;
9846
774
        Py_DECREF(value);
9847
774
        break;
9848
62
    case YieldFrom_kind:
9849
62
        tp = (PyTypeObject *)state->YieldFrom_type;
9850
62
        result = PyType_GenericNew(tp, NULL, NULL);
9851
62
        if (!result) goto failed;
9852
62
        value = ast2obj_expr(state, o->v.YieldFrom.value);
9853
62
        if (!value) goto failed;
9854
62
        if (PyObject_SetAttr(result, state->value, value) == -1)
9855
0
            goto failed;
9856
62
        Py_DECREF(value);
9857
62
        break;
9858
1.07k
    case Compare_kind:
9859
1.07k
        tp = (PyTypeObject *)state->Compare_type;
9860
1.07k
        result = PyType_GenericNew(tp, NULL, NULL);
9861
1.07k
        if (!result) goto failed;
9862
1.07k
        value = ast2obj_expr(state, o->v.Compare.left);
9863
1.07k
        if (!value) goto failed;
9864
1.07k
        if (PyObject_SetAttr(result, state->left, value) == -1)
9865
0
            goto failed;
9866
1.07k
        Py_DECREF(value);
9867
1.07k
        {
9868
1.07k
            Py_ssize_t i, n = asdl_seq_LEN(o->v.Compare.ops);
9869
1.07k
            value = PyList_New(n);
9870
1.07k
            if (!value) goto failed;
9871
7.43k
            for(i = 0; i < n; i++)
9872
6.36k
                PyList_SET_ITEM(value, i, ast2obj_cmpop(state, (cmpop_ty)asdl_seq_GET(o->v.Compare.ops, i)));
9873
1.07k
        }
9874
1.07k
        if (!value) goto failed;
9875
1.07k
        if (PyObject_SetAttr(result, state->ops, value) == -1)
9876
0
            goto failed;
9877
1.07k
        Py_DECREF(value);
9878
1.07k
        value = ast2obj_list(state, (asdl_seq*)o->v.Compare.comparators,
9879
1.07k
                             ast2obj_expr);
9880
1.07k
        if (!value) goto failed;
9881
1.07k
        if (PyObject_SetAttr(result, state->comparators, value) == -1)
9882
0
            goto failed;
9883
1.07k
        Py_DECREF(value);
9884
1.07k
        break;
9885
8.38k
    case Call_kind:
9886
8.38k
        tp = (PyTypeObject *)state->Call_type;
9887
8.38k
        result = PyType_GenericNew(tp, NULL, NULL);
9888
8.38k
        if (!result) goto failed;
9889
8.38k
        value = ast2obj_expr(state, o->v.Call.func);
9890
8.38k
        if (!value) goto failed;
9891
8.38k
        if (PyObject_SetAttr(result, state->func, value) == -1)
9892
0
            goto failed;
9893
8.38k
        Py_DECREF(value);
9894
8.38k
        value = ast2obj_list(state, (asdl_seq*)o->v.Call.args, ast2obj_expr);
9895
8.38k
        if (!value) goto failed;
9896
8.38k
        if (PyObject_SetAttr(result, state->args, value) == -1)
9897
0
            goto failed;
9898
8.38k
        Py_DECREF(value);
9899
8.38k
        value = ast2obj_list(state, (asdl_seq*)o->v.Call.keywords,
9900
8.38k
                             ast2obj_keyword);
9901
8.38k
        if (!value) goto failed;
9902
8.38k
        if (PyObject_SetAttr(result, state->keywords, value) == -1)
9903
0
            goto failed;
9904
8.38k
        Py_DECREF(value);
9905
8.38k
        break;
9906
14.4k
    case FormattedValue_kind:
9907
14.4k
        tp = (PyTypeObject *)state->FormattedValue_type;
9908
14.4k
        result = PyType_GenericNew(tp, NULL, NULL);
9909
14.4k
        if (!result) goto failed;
9910
14.4k
        value = ast2obj_expr(state, o->v.FormattedValue.value);
9911
14.4k
        if (!value) goto failed;
9912
14.4k
        if (PyObject_SetAttr(result, state->value, value) == -1)
9913
0
            goto failed;
9914
14.4k
        Py_DECREF(value);
9915
14.4k
        value = ast2obj_int(state, o->v.FormattedValue.conversion);
9916
14.4k
        if (!value) goto failed;
9917
14.4k
        if (PyObject_SetAttr(result, state->conversion, value) == -1)
9918
0
            goto failed;
9919
14.4k
        Py_DECREF(value);
9920
14.4k
        value = ast2obj_expr(state, o->v.FormattedValue.format_spec);
9921
14.4k
        if (!value) goto failed;
9922
14.4k
        if (PyObject_SetAttr(result, state->format_spec, value) == -1)
9923
0
            goto failed;
9924
14.4k
        Py_DECREF(value);
9925
14.4k
        break;
9926
1.25k
    case Interpolation_kind:
9927
1.25k
        tp = (PyTypeObject *)state->Interpolation_type;
9928
1.25k
        result = PyType_GenericNew(tp, NULL, NULL);
9929
1.25k
        if (!result) goto failed;
9930
1.25k
        value = ast2obj_expr(state, o->v.Interpolation.value);
9931
1.25k
        if (!value) goto failed;
9932
1.25k
        if (PyObject_SetAttr(result, state->value, value) == -1)
9933
0
            goto failed;
9934
1.25k
        Py_DECREF(value);
9935
1.25k
        value = ast2obj_constant(state, o->v.Interpolation.str);
9936
1.25k
        if (!value) goto failed;
9937
1.25k
        if (PyObject_SetAttr(result, state->str, value) == -1)
9938
0
            goto failed;
9939
1.25k
        Py_DECREF(value);
9940
1.25k
        value = ast2obj_int(state, o->v.Interpolation.conversion);
9941
1.25k
        if (!value) goto failed;
9942
1.25k
        if (PyObject_SetAttr(result, state->conversion, value) == -1)
9943
0
            goto failed;
9944
1.25k
        Py_DECREF(value);
9945
1.25k
        value = ast2obj_expr(state, o->v.Interpolation.format_spec);
9946
1.25k
        if (!value) goto failed;
9947
1.25k
        if (PyObject_SetAttr(result, state->format_spec, value) == -1)
9948
0
            goto failed;
9949
1.25k
        Py_DECREF(value);
9950
1.25k
        break;
9951
6.80k
    case JoinedStr_kind:
9952
6.80k
        tp = (PyTypeObject *)state->JoinedStr_type;
9953
6.80k
        result = PyType_GenericNew(tp, NULL, NULL);
9954
6.80k
        if (!result) goto failed;
9955
6.80k
        value = ast2obj_list(state, (asdl_seq*)o->v.JoinedStr.values,
9956
6.80k
                             ast2obj_expr);
9957
6.80k
        if (!value) goto failed;
9958
6.80k
        if (PyObject_SetAttr(result, state->values, value) == -1)
9959
0
            goto failed;
9960
6.80k
        Py_DECREF(value);
9961
6.80k
        break;
9962
499
    case TemplateStr_kind:
9963
499
        tp = (PyTypeObject *)state->TemplateStr_type;
9964
499
        result = PyType_GenericNew(tp, NULL, NULL);
9965
499
        if (!result) goto failed;
9966
499
        value = ast2obj_list(state, (asdl_seq*)o->v.TemplateStr.values,
9967
499
                             ast2obj_expr);
9968
499
        if (!value) goto failed;
9969
499
        if (PyObject_SetAttr(result, state->values, value) == -1)
9970
0
            goto failed;
9971
499
        Py_DECREF(value);
9972
499
        break;
9973
66.7k
    case Constant_kind:
9974
66.7k
        tp = (PyTypeObject *)state->Constant_type;
9975
66.7k
        result = PyType_GenericNew(tp, NULL, NULL);
9976
66.7k
        if (!result) goto failed;
9977
66.7k
        value = ast2obj_constant(state, o->v.Constant.value);
9978
66.7k
        if (!value) goto failed;
9979
66.7k
        if (PyObject_SetAttr(result, state->value, value) == -1)
9980
0
            goto failed;
9981
66.7k
        Py_DECREF(value);
9982
66.7k
        value = ast2obj_string(state, o->v.Constant.kind);
9983
66.7k
        if (!value) goto failed;
9984
66.7k
        if (PyObject_SetAttr(result, state->kind, value) == -1)
9985
0
            goto failed;
9986
66.7k
        Py_DECREF(value);
9987
66.7k
        break;
9988
2.26k
    case Attribute_kind:
9989
2.26k
        tp = (PyTypeObject *)state->Attribute_type;
9990
2.26k
        result = PyType_GenericNew(tp, NULL, NULL);
9991
2.26k
        if (!result) goto failed;
9992
2.26k
        value = ast2obj_expr(state, o->v.Attribute.value);
9993
2.26k
        if (!value) goto failed;
9994
2.26k
        if (PyObject_SetAttr(result, state->value, value) == -1)
9995
0
            goto failed;
9996
2.26k
        Py_DECREF(value);
9997
2.26k
        value = ast2obj_identifier(state, o->v.Attribute.attr);
9998
2.26k
        if (!value) goto failed;
9999
2.26k
        if (PyObject_SetAttr(result, state->attr, value) == -1)
10000
0
            goto failed;
10001
2.26k
        Py_DECREF(value);
10002
2.26k
        value = ast2obj_expr_context(state, o->v.Attribute.ctx);
10003
2.26k
        if (!value) goto failed;
10004
2.26k
        if (PyObject_SetAttr(result, state->ctx, value) == -1)
10005
0
            goto failed;
10006
2.26k
        Py_DECREF(value);
10007
2.26k
        break;
10008
602
    case Subscript_kind:
10009
602
        tp = (PyTypeObject *)state->Subscript_type;
10010
602
        result = PyType_GenericNew(tp, NULL, NULL);
10011
602
        if (!result) goto failed;
10012
602
        value = ast2obj_expr(state, o->v.Subscript.value);
10013
602
        if (!value) goto failed;
10014
602
        if (PyObject_SetAttr(result, state->value, value) == -1)
10015
0
            goto failed;
10016
602
        Py_DECREF(value);
10017
602
        value = ast2obj_expr(state, o->v.Subscript.slice);
10018
602
        if (!value) goto failed;
10019
602
        if (PyObject_SetAttr(result, state->slice, value) == -1)
10020
0
            goto failed;
10021
602
        Py_DECREF(value);
10022
602
        value = ast2obj_expr_context(state, o->v.Subscript.ctx);
10023
602
        if (!value) goto failed;
10024
602
        if (PyObject_SetAttr(result, state->ctx, value) == -1)
10025
0
            goto failed;
10026
602
        Py_DECREF(value);
10027
602
        break;
10028
439
    case Starred_kind:
10029
439
        tp = (PyTypeObject *)state->Starred_type;
10030
439
        result = PyType_GenericNew(tp, NULL, NULL);
10031
439
        if (!result) goto failed;
10032
439
        value = ast2obj_expr(state, o->v.Starred.value);
10033
439
        if (!value) goto failed;
10034
439
        if (PyObject_SetAttr(result, state->value, value) == -1)
10035
0
            goto failed;
10036
439
        Py_DECREF(value);
10037
439
        value = ast2obj_expr_context(state, o->v.Starred.ctx);
10038
439
        if (!value) goto failed;
10039
439
        if (PyObject_SetAttr(result, state->ctx, value) == -1)
10040
0
            goto failed;
10041
439
        Py_DECREF(value);
10042
439
        break;
10043
62.8k
    case Name_kind:
10044
62.8k
        tp = (PyTypeObject *)state->Name_type;
10045
62.8k
        result = PyType_GenericNew(tp, NULL, NULL);
10046
62.8k
        if (!result) goto failed;
10047
62.8k
        value = ast2obj_identifier(state, o->v.Name.id);
10048
62.8k
        if (!value) goto failed;
10049
62.8k
        if (PyObject_SetAttr(result, state->id, value) == -1)
10050
0
            goto failed;
10051
62.8k
        Py_DECREF(value);
10052
62.8k
        value = ast2obj_expr_context(state, o->v.Name.ctx);
10053
62.8k
        if (!value) goto failed;
10054
62.8k
        if (PyObject_SetAttr(result, state->ctx, value) == -1)
10055
0
            goto failed;
10056
62.8k
        Py_DECREF(value);
10057
62.8k
        break;
10058
1.82k
    case List_kind:
10059
1.82k
        tp = (PyTypeObject *)state->List_type;
10060
1.82k
        result = PyType_GenericNew(tp, NULL, NULL);
10061
1.82k
        if (!result) goto failed;
10062
1.82k
        value = ast2obj_list(state, (asdl_seq*)o->v.List.elts, ast2obj_expr);
10063
1.82k
        if (!value) goto failed;
10064
1.82k
        if (PyObject_SetAttr(result, state->elts, value) == -1)
10065
0
            goto failed;
10066
1.82k
        Py_DECREF(value);
10067
1.82k
        value = ast2obj_expr_context(state, o->v.List.ctx);
10068
1.82k
        if (!value) goto failed;
10069
1.82k
        if (PyObject_SetAttr(result, state->ctx, value) == -1)
10070
0
            goto failed;
10071
1.82k
        Py_DECREF(value);
10072
1.82k
        break;
10073
6.33k
    case Tuple_kind:
10074
6.33k
        tp = (PyTypeObject *)state->Tuple_type;
10075
6.33k
        result = PyType_GenericNew(tp, NULL, NULL);
10076
6.33k
        if (!result) goto failed;
10077
6.33k
        value = ast2obj_list(state, (asdl_seq*)o->v.Tuple.elts, ast2obj_expr);
10078
6.33k
        if (!value) goto failed;
10079
6.33k
        if (PyObject_SetAttr(result, state->elts, value) == -1)
10080
0
            goto failed;
10081
6.33k
        Py_DECREF(value);
10082
6.33k
        value = ast2obj_expr_context(state, o->v.Tuple.ctx);
10083
6.33k
        if (!value) goto failed;
10084
6.33k
        if (PyObject_SetAttr(result, state->ctx, value) == -1)
10085
0
            goto failed;
10086
6.33k
        Py_DECREF(value);
10087
6.33k
        break;
10088
3.05k
    case Slice_kind:
10089
3.05k
        tp = (PyTypeObject *)state->Slice_type;
10090
3.05k
        result = PyType_GenericNew(tp, NULL, NULL);
10091
3.05k
        if (!result) goto failed;
10092
3.05k
        value = ast2obj_expr(state, o->v.Slice.lower);
10093
3.05k
        if (!value) goto failed;
10094
3.05k
        if (PyObject_SetAttr(result, state->lower, value) == -1)
10095
0
            goto failed;
10096
3.05k
        Py_DECREF(value);
10097
3.05k
        value = ast2obj_expr(state, o->v.Slice.upper);
10098
3.05k
        if (!value) goto failed;
10099
3.05k
        if (PyObject_SetAttr(result, state->upper, value) == -1)
10100
0
            goto failed;
10101
3.05k
        Py_DECREF(value);
10102
3.05k
        value = ast2obj_expr(state, o->v.Slice.step);
10103
3.05k
        if (!value) goto failed;
10104
3.05k
        if (PyObject_SetAttr(result, state->step, value) == -1)
10105
0
            goto failed;
10106
3.05k
        Py_DECREF(value);
10107
3.05k
        break;
10108
395k
    }
10109
395k
    value = ast2obj_int(state, o->lineno);
10110
395k
    if (!value) goto failed;
10111
395k
    if (PyObject_SetAttr(result, state->lineno, value) < 0)
10112
0
        goto failed;
10113
395k
    Py_DECREF(value);
10114
395k
    value = ast2obj_int(state, o->col_offset);
10115
395k
    if (!value) goto failed;
10116
395k
    if (PyObject_SetAttr(result, state->col_offset, value) < 0)
10117
0
        goto failed;
10118
395k
    Py_DECREF(value);
10119
395k
    value = ast2obj_int(state, o->end_lineno);
10120
395k
    if (!value) goto failed;
10121
395k
    if (PyObject_SetAttr(result, state->end_lineno, value) < 0)
10122
0
        goto failed;
10123
395k
    Py_DECREF(value);
10124
395k
    value = ast2obj_int(state, o->end_col_offset);
10125
395k
    if (!value) goto failed;
10126
395k
    if (PyObject_SetAttr(result, state->end_col_offset, value) < 0)
10127
0
        goto failed;
10128
395k
    Py_DECREF(value);
10129
395k
    Py_LeaveRecursiveCall();
10130
395k
    return result;
10131
0
failed:
10132
0
    Py_LeaveRecursiveCall();
10133
0
    Py_XDECREF(value);
10134
0
    Py_XDECREF(result);
10135
0
    return NULL;
10136
395k
}
10137
10138
PyObject* ast2obj_expr_context(struct ast_state *state, expr_context_ty o)
10139
74.2k
{
10140
74.2k
    switch(o) {
10141
68.4k
        case Load:
10142
68.4k
            return Py_NewRef(state->Load_singleton);
10143
5.37k
        case Store:
10144
5.37k
            return Py_NewRef(state->Store_singleton);
10145
438
        case Del:
10146
438
            return Py_NewRef(state->Del_singleton);
10147
74.2k
    }
10148
74.2k
    Py_UNREACHABLE();
10149
74.2k
}
10150
PyObject* ast2obj_boolop(struct ast_state *state, boolop_ty o)
10151
364
{
10152
364
    switch(o) {
10153
117
        case And:
10154
117
            return Py_NewRef(state->And_singleton);
10155
247
        case Or:
10156
247
            return Py_NewRef(state->Or_singleton);
10157
364
    }
10158
364
    Py_UNREACHABLE();
10159
364
}
10160
PyObject* ast2obj_operator(struct ast_state *state, operator_ty o)
10161
32.9k
{
10162
32.9k
    switch(o) {
10163
4.60k
        case Add:
10164
4.60k
            return Py_NewRef(state->Add_singleton);
10165
6.83k
        case Sub:
10166
6.83k
            return Py_NewRef(state->Sub_singleton);
10167
11.8k
        case Mult:
10168
11.8k
            return Py_NewRef(state->Mult_singleton);
10169
774
        case MatMult:
10170
774
            return Py_NewRef(state->MatMult_singleton);
10171
2.34k
        case Div:
10172
2.34k
            return Py_NewRef(state->Div_singleton);
10173
1.07k
        case Mod:
10174
1.07k
            return Py_NewRef(state->Mod_singleton);
10175
1.62k
        case Pow:
10176
1.62k
            return Py_NewRef(state->Pow_singleton);
10177
261
        case LShift:
10178
261
            return Py_NewRef(state->LShift_singleton);
10179
251
        case RShift:
10180
251
            return Py_NewRef(state->RShift_singleton);
10181
802
        case BitOr:
10182
802
            return Py_NewRef(state->BitOr_singleton);
10183
1.30k
        case BitXor:
10184
1.30k
            return Py_NewRef(state->BitXor_singleton);
10185
799
        case BitAnd:
10186
799
            return Py_NewRef(state->BitAnd_singleton);
10187
479
        case FloorDiv:
10188
479
            return Py_NewRef(state->FloorDiv_singleton);
10189
32.9k
    }
10190
32.9k
    Py_UNREACHABLE();
10191
32.9k
}
10192
PyObject* ast2obj_unaryop(struct ast_state *state, unaryop_ty o)
10193
179k
{
10194
179k
    switch(o) {
10195
25.5k
        case Invert:
10196
25.5k
            return Py_NewRef(state->Invert_singleton);
10197
110
        case Not:
10198
110
            return Py_NewRef(state->Not_singleton);
10199
61.8k
        case UAdd:
10200
61.8k
            return Py_NewRef(state->UAdd_singleton);
10201
92.4k
        case USub:
10202
92.4k
            return Py_NewRef(state->USub_singleton);
10203
179k
    }
10204
179k
    Py_UNREACHABLE();
10205
179k
}
10206
PyObject* ast2obj_cmpop(struct ast_state *state, cmpop_ty o)
10207
6.36k
{
10208
6.36k
    switch(o) {
10209
398
        case Eq:
10210
398
            return Py_NewRef(state->Eq_singleton);
10211
214
        case NotEq:
10212
214
            return Py_NewRef(state->NotEq_singleton);
10213
2.35k
        case Lt:
10214
2.35k
            return Py_NewRef(state->Lt_singleton);
10215
75
        case LtE:
10216
75
            return Py_NewRef(state->LtE_singleton);
10217
2.66k
        case Gt:
10218
2.66k
            return Py_NewRef(state->Gt_singleton);
10219
213
        case GtE:
10220
213
            return Py_NewRef(state->GtE_singleton);
10221
133
        case Is:
10222
133
            return Py_NewRef(state->Is_singleton);
10223
86
        case IsNot:
10224
86
            return Py_NewRef(state->IsNot_singleton);
10225
172
        case In:
10226
172
            return Py_NewRef(state->In_singleton);
10227
54
        case NotIn:
10228
54
            return Py_NewRef(state->NotIn_singleton);
10229
6.36k
    }
10230
6.36k
    Py_UNREACHABLE();
10231
6.36k
}
10232
PyObject*
10233
ast2obj_comprehension(struct ast_state *state, void* _o)
10234
1.22k
{
10235
1.22k
    comprehension_ty o = (comprehension_ty)_o;
10236
1.22k
    PyObject *result = NULL, *value = NULL;
10237
1.22k
    PyTypeObject *tp;
10238
1.22k
    if (!o) {
10239
0
        Py_RETURN_NONE;
10240
0
    }
10241
1.22k
    if (Py_EnterRecursiveCall("during  ast construction")) {
10242
0
        return NULL;
10243
0
    }
10244
1.22k
    tp = (PyTypeObject *)state->comprehension_type;
10245
1.22k
    result = PyType_GenericNew(tp, NULL, NULL);
10246
1.22k
    if (!result) return NULL;
10247
1.22k
    value = ast2obj_expr(state, o->target);
10248
1.22k
    if (!value) goto failed;
10249
1.22k
    if (PyObject_SetAttr(result, state->target, value) == -1)
10250
0
        goto failed;
10251
1.22k
    Py_DECREF(value);
10252
1.22k
    value = ast2obj_expr(state, o->iter);
10253
1.22k
    if (!value) goto failed;
10254
1.22k
    if (PyObject_SetAttr(result, state->iter, value) == -1)
10255
0
        goto failed;
10256
1.22k
    Py_DECREF(value);
10257
1.22k
    value = ast2obj_list(state, (asdl_seq*)o->ifs, ast2obj_expr);
10258
1.22k
    if (!value) goto failed;
10259
1.22k
    if (PyObject_SetAttr(result, state->ifs, value) == -1)
10260
0
        goto failed;
10261
1.22k
    Py_DECREF(value);
10262
1.22k
    value = ast2obj_int(state, o->is_async);
10263
1.22k
    if (!value) goto failed;
10264
1.22k
    if (PyObject_SetAttr(result, state->is_async, value) == -1)
10265
0
        goto failed;
10266
1.22k
    Py_DECREF(value);
10267
1.22k
    Py_LeaveRecursiveCall();
10268
1.22k
    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.22k
}
10275
10276
PyObject*
10277
ast2obj_excepthandler(struct ast_state *state, void* _o)
10278
909
{
10279
909
    excepthandler_ty o = (excepthandler_ty)_o;
10280
909
    PyObject *result = NULL, *value = NULL;
10281
909
    PyTypeObject *tp;
10282
909
    if (!o) {
10283
0
        Py_RETURN_NONE;
10284
0
    }
10285
909
    if (Py_EnterRecursiveCall("during  ast construction")) {
10286
0
        return NULL;
10287
0
    }
10288
909
    switch (o->kind) {
10289
909
    case ExceptHandler_kind:
10290
909
        tp = (PyTypeObject *)state->ExceptHandler_type;
10291
909
        result = PyType_GenericNew(tp, NULL, NULL);
10292
909
        if (!result) goto failed;
10293
909
        value = ast2obj_expr(state, o->v.ExceptHandler.type);
10294
909
        if (!value) goto failed;
10295
909
        if (PyObject_SetAttr(result, state->type, value) == -1)
10296
0
            goto failed;
10297
909
        Py_DECREF(value);
10298
909
        value = ast2obj_identifier(state, o->v.ExceptHandler.name);
10299
909
        if (!value) goto failed;
10300
909
        if (PyObject_SetAttr(result, state->name, value) == -1)
10301
0
            goto failed;
10302
909
        Py_DECREF(value);
10303
909
        value = ast2obj_list(state, (asdl_seq*)o->v.ExceptHandler.body,
10304
909
                             ast2obj_stmt);
10305
909
        if (!value) goto failed;
10306
909
        if (PyObject_SetAttr(result, state->body, value) == -1)
10307
0
            goto failed;
10308
909
        Py_DECREF(value);
10309
909
        break;
10310
909
    }
10311
909
    value = ast2obj_int(state, o->lineno);
10312
909
    if (!value) goto failed;
10313
909
    if (PyObject_SetAttr(result, state->lineno, value) < 0)
10314
0
        goto failed;
10315
909
    Py_DECREF(value);
10316
909
    value = ast2obj_int(state, o->col_offset);
10317
909
    if (!value) goto failed;
10318
909
    if (PyObject_SetAttr(result, state->col_offset, value) < 0)
10319
0
        goto failed;
10320
909
    Py_DECREF(value);
10321
909
    value = ast2obj_int(state, o->end_lineno);
10322
909
    if (!value) goto failed;
10323
909
    if (PyObject_SetAttr(result, state->end_lineno, value) < 0)
10324
0
        goto failed;
10325
909
    Py_DECREF(value);
10326
909
    value = ast2obj_int(state, o->end_col_offset);
10327
909
    if (!value) goto failed;
10328
909
    if (PyObject_SetAttr(result, state->end_col_offset, value) < 0)
10329
0
        goto failed;
10330
909
    Py_DECREF(value);
10331
909
    Py_LeaveRecursiveCall();
10332
909
    return result;
10333
0
failed:
10334
0
    Py_LeaveRecursiveCall();
10335
0
    Py_XDECREF(value);
10336
0
    Py_XDECREF(result);
10337
0
    return NULL;
10338
909
}
10339
10340
PyObject*
10341
ast2obj_arguments(struct ast_state *state, void* _o)
10342
2.65k
{
10343
2.65k
    arguments_ty o = (arguments_ty)_o;
10344
2.65k
    PyObject *result = NULL, *value = NULL;
10345
2.65k
    PyTypeObject *tp;
10346
2.65k
    if (!o) {
10347
0
        Py_RETURN_NONE;
10348
0
    }
10349
2.65k
    if (Py_EnterRecursiveCall("during  ast construction")) {
10350
0
        return NULL;
10351
0
    }
10352
2.65k
    tp = (PyTypeObject *)state->arguments_type;
10353
2.65k
    result = PyType_GenericNew(tp, NULL, NULL);
10354
2.65k
    if (!result) return NULL;
10355
2.65k
    value = ast2obj_list(state, (asdl_seq*)o->posonlyargs, ast2obj_arg);
10356
2.65k
    if (!value) goto failed;
10357
2.65k
    if (PyObject_SetAttr(result, state->posonlyargs, value) == -1)
10358
0
        goto failed;
10359
2.65k
    Py_DECREF(value);
10360
2.65k
    value = ast2obj_list(state, (asdl_seq*)o->args, ast2obj_arg);
10361
2.65k
    if (!value) goto failed;
10362
2.65k
    if (PyObject_SetAttr(result, state->args, value) == -1)
10363
0
        goto failed;
10364
2.65k
    Py_DECREF(value);
10365
2.65k
    value = ast2obj_arg(state, o->vararg);
10366
2.65k
    if (!value) goto failed;
10367
2.65k
    if (PyObject_SetAttr(result, state->vararg, value) == -1)
10368
0
        goto failed;
10369
2.65k
    Py_DECREF(value);
10370
2.65k
    value = ast2obj_list(state, (asdl_seq*)o->kwonlyargs, ast2obj_arg);
10371
2.65k
    if (!value) goto failed;
10372
2.65k
    if (PyObject_SetAttr(result, state->kwonlyargs, value) == -1)
10373
0
        goto failed;
10374
2.65k
    Py_DECREF(value);
10375
2.65k
    value = ast2obj_list(state, (asdl_seq*)o->kw_defaults, ast2obj_expr);
10376
2.65k
    if (!value) goto failed;
10377
2.65k
    if (PyObject_SetAttr(result, state->kw_defaults, value) == -1)
10378
0
        goto failed;
10379
2.65k
    Py_DECREF(value);
10380
2.65k
    value = ast2obj_arg(state, o->kwarg);
10381
2.65k
    if (!value) goto failed;
10382
2.65k
    if (PyObject_SetAttr(result, state->kwarg, value) == -1)
10383
0
        goto failed;
10384
2.65k
    Py_DECREF(value);
10385
2.65k
    value = ast2obj_list(state, (asdl_seq*)o->defaults, ast2obj_expr);
10386
2.65k
    if (!value) goto failed;
10387
2.65k
    if (PyObject_SetAttr(result, state->defaults, value) == -1)
10388
0
        goto failed;
10389
2.65k
    Py_DECREF(value);
10390
2.65k
    Py_LeaveRecursiveCall();
10391
2.65k
    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.65k
}
10398
10399
PyObject*
10400
ast2obj_arg(struct ast_state *state, void* _o)
10401
18.9k
{
10402
18.9k
    arg_ty o = (arg_ty)_o;
10403
18.9k
    PyObject *result = NULL, *value = NULL;
10404
18.9k
    PyTypeObject *tp;
10405
18.9k
    if (!o) {
10406
4.65k
        Py_RETURN_NONE;
10407
4.65k
    }
10408
14.3k
    if (Py_EnterRecursiveCall("during  ast construction")) {
10409
0
        return NULL;
10410
0
    }
10411
14.3k
    tp = (PyTypeObject *)state->arg_type;
10412
14.3k
    result = PyType_GenericNew(tp, NULL, NULL);
10413
14.3k
    if (!result) return NULL;
10414
14.3k
    value = ast2obj_identifier(state, o->arg);
10415
14.3k
    if (!value) goto failed;
10416
14.3k
    if (PyObject_SetAttr(result, state->arg, value) == -1)
10417
0
        goto failed;
10418
14.3k
    Py_DECREF(value);
10419
14.3k
    value = ast2obj_expr(state, o->annotation);
10420
14.3k
    if (!value) goto failed;
10421
14.3k
    if (PyObject_SetAttr(result, state->annotation, value) == -1)
10422
0
        goto failed;
10423
14.3k
    Py_DECREF(value);
10424
14.3k
    value = ast2obj_string(state, o->type_comment);
10425
14.3k
    if (!value) goto failed;
10426
14.3k
    if (PyObject_SetAttr(result, state->type_comment, value) == -1)
10427
0
        goto failed;
10428
14.3k
    Py_DECREF(value);
10429
14.3k
    value = ast2obj_int(state, o->lineno);
10430
14.3k
    if (!value) goto failed;
10431
14.3k
    if (PyObject_SetAttr(result, state->lineno, value) < 0)
10432
0
        goto failed;
10433
14.3k
    Py_DECREF(value);
10434
14.3k
    value = ast2obj_int(state, o->col_offset);
10435
14.3k
    if (!value) goto failed;
10436
14.3k
    if (PyObject_SetAttr(result, state->col_offset, value) < 0)
10437
0
        goto failed;
10438
14.3k
    Py_DECREF(value);
10439
14.3k
    value = ast2obj_int(state, o->end_lineno);
10440
14.3k
    if (!value) goto failed;
10441
14.3k
    if (PyObject_SetAttr(result, state->end_lineno, value) < 0)
10442
0
        goto failed;
10443
14.3k
    Py_DECREF(value);
10444
14.3k
    value = ast2obj_int(state, o->end_col_offset);
10445
14.3k
    if (!value) goto failed;
10446
14.3k
    if (PyObject_SetAttr(result, state->end_col_offset, value) < 0)
10447
0
        goto failed;
10448
14.3k
    Py_DECREF(value);
10449
14.3k
    Py_LeaveRecursiveCall();
10450
14.3k
    return result;
10451
0
failed:
10452
0
    Py_LeaveRecursiveCall();
10453
0
    Py_XDECREF(value);
10454
0
    Py_XDECREF(result);
10455
0
    return NULL;
10456
14.3k
}
10457
10458
PyObject*
10459
ast2obj_keyword(struct ast_state *state, void* _o)
10460
2.57k
{
10461
2.57k
    keyword_ty o = (keyword_ty)_o;
10462
2.57k
    PyObject *result = NULL, *value = NULL;
10463
2.57k
    PyTypeObject *tp;
10464
2.57k
    if (!o) {
10465
0
        Py_RETURN_NONE;
10466
0
    }
10467
2.57k
    if (Py_EnterRecursiveCall("during  ast construction")) {
10468
0
        return NULL;
10469
0
    }
10470
2.57k
    tp = (PyTypeObject *)state->keyword_type;
10471
2.57k
    result = PyType_GenericNew(tp, NULL, NULL);
10472
2.57k
    if (!result) return NULL;
10473
2.57k
    value = ast2obj_identifier(state, o->arg);
10474
2.57k
    if (!value) goto failed;
10475
2.57k
    if (PyObject_SetAttr(result, state->arg, value) == -1)
10476
0
        goto failed;
10477
2.57k
    Py_DECREF(value);
10478
2.57k
    value = ast2obj_expr(state, o->value);
10479
2.57k
    if (!value) goto failed;
10480
2.57k
    if (PyObject_SetAttr(result, state->value, value) == -1)
10481
0
        goto failed;
10482
2.57k
    Py_DECREF(value);
10483
2.57k
    value = ast2obj_int(state, o->lineno);
10484
2.57k
    if (!value) goto failed;
10485
2.57k
    if (PyObject_SetAttr(result, state->lineno, value) < 0)
10486
0
        goto failed;
10487
2.57k
    Py_DECREF(value);
10488
2.57k
    value = ast2obj_int(state, o->col_offset);
10489
2.57k
    if (!value) goto failed;
10490
2.57k
    if (PyObject_SetAttr(result, state->col_offset, value) < 0)
10491
0
        goto failed;
10492
2.57k
    Py_DECREF(value);
10493
2.57k
    value = ast2obj_int(state, o->end_lineno);
10494
2.57k
    if (!value) goto failed;
10495
2.57k
    if (PyObject_SetAttr(result, state->end_lineno, value) < 0)
10496
0
        goto failed;
10497
2.57k
    Py_DECREF(value);
10498
2.57k
    value = ast2obj_int(state, o->end_col_offset);
10499
2.57k
    if (!value) goto failed;
10500
2.57k
    if (PyObject_SetAttr(result, state->end_col_offset, value) < 0)
10501
0
        goto failed;
10502
2.57k
    Py_DECREF(value);
10503
2.57k
    Py_LeaveRecursiveCall();
10504
2.57k
    return result;
10505
0
failed:
10506
0
    Py_LeaveRecursiveCall();
10507
0
    Py_XDECREF(value);
10508
0
    Py_XDECREF(result);
10509
0
    return NULL;
10510
2.57k
}
10511
10512
PyObject*
10513
ast2obj_alias(struct ast_state *state, void* _o)
10514
3.90k
{
10515
3.90k
    alias_ty o = (alias_ty)_o;
10516
3.90k
    PyObject *result = NULL, *value = NULL;
10517
3.90k
    PyTypeObject *tp;
10518
3.90k
    if (!o) {
10519
0
        Py_RETURN_NONE;
10520
0
    }
10521
3.90k
    if (Py_EnterRecursiveCall("during  ast construction")) {
10522
0
        return NULL;
10523
0
    }
10524
3.90k
    tp = (PyTypeObject *)state->alias_type;
10525
3.90k
    result = PyType_GenericNew(tp, NULL, NULL);
10526
3.90k
    if (!result) return NULL;
10527
3.90k
    value = ast2obj_identifier(state, o->name);
10528
3.90k
    if (!value) goto failed;
10529
3.90k
    if (PyObject_SetAttr(result, state->name, value) == -1)
10530
0
        goto failed;
10531
3.90k
    Py_DECREF(value);
10532
3.90k
    value = ast2obj_identifier(state, o->asname);
10533
3.90k
    if (!value) goto failed;
10534
3.90k
    if (PyObject_SetAttr(result, state->asname, value) == -1)
10535
0
        goto failed;
10536
3.90k
    Py_DECREF(value);
10537
3.90k
    value = ast2obj_int(state, o->lineno);
10538
3.90k
    if (!value) goto failed;
10539
3.90k
    if (PyObject_SetAttr(result, state->lineno, value) < 0)
10540
0
        goto failed;
10541
3.90k
    Py_DECREF(value);
10542
3.90k
    value = ast2obj_int(state, o->col_offset);
10543
3.90k
    if (!value) goto failed;
10544
3.90k
    if (PyObject_SetAttr(result, state->col_offset, value) < 0)
10545
0
        goto failed;
10546
3.90k
    Py_DECREF(value);
10547
3.90k
    value = ast2obj_int(state, o->end_lineno);
10548
3.90k
    if (!value) goto failed;
10549
3.90k
    if (PyObject_SetAttr(result, state->end_lineno, value) < 0)
10550
0
        goto failed;
10551
3.90k
    Py_DECREF(value);
10552
3.90k
    value = ast2obj_int(state, o->end_col_offset);
10553
3.90k
    if (!value) goto failed;
10554
3.90k
    if (PyObject_SetAttr(result, state->end_col_offset, value) < 0)
10555
0
        goto failed;
10556
3.90k
    Py_DECREF(value);
10557
3.90k
    Py_LeaveRecursiveCall();
10558
3.90k
    return result;
10559
0
failed:
10560
0
    Py_LeaveRecursiveCall();
10561
0
    Py_XDECREF(value);
10562
0
    Py_XDECREF(result);
10563
0
    return NULL;
10564
3.90k
}
10565
10566
PyObject*
10567
ast2obj_withitem(struct ast_state *state, void* _o)
10568
951
{
10569
951
    withitem_ty o = (withitem_ty)_o;
10570
951
    PyObject *result = NULL, *value = NULL;
10571
951
    PyTypeObject *tp;
10572
951
    if (!o) {
10573
0
        Py_RETURN_NONE;
10574
0
    }
10575
951
    if (Py_EnterRecursiveCall("during  ast construction")) {
10576
0
        return NULL;
10577
0
    }
10578
951
    tp = (PyTypeObject *)state->withitem_type;
10579
951
    result = PyType_GenericNew(tp, NULL, NULL);
10580
951
    if (!result) return NULL;
10581
951
    value = ast2obj_expr(state, o->context_expr);
10582
951
    if (!value) goto failed;
10583
951
    if (PyObject_SetAttr(result, state->context_expr, value) == -1)
10584
0
        goto failed;
10585
951
    Py_DECREF(value);
10586
951
    value = ast2obj_expr(state, o->optional_vars);
10587
951
    if (!value) goto failed;
10588
951
    if (PyObject_SetAttr(result, state->optional_vars, value) == -1)
10589
0
        goto failed;
10590
951
    Py_DECREF(value);
10591
951
    Py_LeaveRecursiveCall();
10592
951
    return result;
10593
0
failed:
10594
0
    Py_LeaveRecursiveCall();
10595
0
    Py_XDECREF(value);
10596
0
    Py_XDECREF(result);
10597
0
    return NULL;
10598
951
}
10599
10600
PyObject*
10601
ast2obj_match_case(struct ast_state *state, void* _o)
10602
634
{
10603
634
    match_case_ty o = (match_case_ty)_o;
10604
634
    PyObject *result = NULL, *value = NULL;
10605
634
    PyTypeObject *tp;
10606
634
    if (!o) {
10607
0
        Py_RETURN_NONE;
10608
0
    }
10609
634
    if (Py_EnterRecursiveCall("during  ast construction")) {
10610
0
        return NULL;
10611
0
    }
10612
634
    tp = (PyTypeObject *)state->match_case_type;
10613
634
    result = PyType_GenericNew(tp, NULL, NULL);
10614
634
    if (!result) return NULL;
10615
634
    value = ast2obj_pattern(state, o->pattern);
10616
634
    if (!value) goto failed;
10617
634
    if (PyObject_SetAttr(result, state->pattern, value) == -1)
10618
0
        goto failed;
10619
634
    Py_DECREF(value);
10620
634
    value = ast2obj_expr(state, o->guard);
10621
634
    if (!value) goto failed;
10622
634
    if (PyObject_SetAttr(result, state->guard, value) == -1)
10623
0
        goto failed;
10624
634
    Py_DECREF(value);
10625
634
    value = ast2obj_list(state, (asdl_seq*)o->body, ast2obj_stmt);
10626
634
    if (!value) goto failed;
10627
634
    if (PyObject_SetAttr(result, state->body, value) == -1)
10628
0
        goto failed;
10629
634
    Py_DECREF(value);
10630
634
    Py_LeaveRecursiveCall();
10631
634
    return result;
10632
0
failed:
10633
0
    Py_LeaveRecursiveCall();
10634
0
    Py_XDECREF(value);
10635
0
    Py_XDECREF(result);
10636
0
    return NULL;
10637
634
}
10638
10639
PyObject*
10640
ast2obj_pattern(struct ast_state *state, void* _o)
10641
25.3k
{
10642
25.3k
    pattern_ty o = (pattern_ty)_o;
10643
25.3k
    PyObject *result = NULL, *value = NULL;
10644
25.3k
    PyTypeObject *tp;
10645
25.3k
    if (!o) {
10646
9.64k
        Py_RETURN_NONE;
10647
9.64k
    }
10648
15.7k
    if (Py_EnterRecursiveCall("during  ast construction")) {
10649
0
        return NULL;
10650
0
    }
10651
15.7k
    switch (o->kind) {
10652
709
    case MatchValue_kind:
10653
709
        tp = (PyTypeObject *)state->MatchValue_type;
10654
709
        result = PyType_GenericNew(tp, NULL, NULL);
10655
709
        if (!result) goto failed;
10656
709
        value = ast2obj_expr(state, o->v.MatchValue.value);
10657
709
        if (!value) goto failed;
10658
709
        if (PyObject_SetAttr(result, state->value, value) == -1)
10659
0
            goto failed;
10660
709
        Py_DECREF(value);
10661
709
        break;
10662
423
    case MatchSingleton_kind:
10663
423
        tp = (PyTypeObject *)state->MatchSingleton_type;
10664
423
        result = PyType_GenericNew(tp, NULL, NULL);
10665
423
        if (!result) goto failed;
10666
423
        value = ast2obj_constant(state, o->v.MatchSingleton.value);
10667
423
        if (!value) goto failed;
10668
423
        if (PyObject_SetAttr(result, state->value, value) == -1)
10669
0
            goto failed;
10670
423
        Py_DECREF(value);
10671
423
        break;
10672
398
    case MatchSequence_kind:
10673
398
        tp = (PyTypeObject *)state->MatchSequence_type;
10674
398
        result = PyType_GenericNew(tp, NULL, NULL);
10675
398
        if (!result) goto failed;
10676
398
        value = ast2obj_list(state, (asdl_seq*)o->v.MatchSequence.patterns,
10677
398
                             ast2obj_pattern);
10678
398
        if (!value) goto failed;
10679
398
        if (PyObject_SetAttr(result, state->patterns, value) == -1)
10680
0
            goto failed;
10681
398
        Py_DECREF(value);
10682
398
        break;
10683
279
    case MatchMapping_kind:
10684
279
        tp = (PyTypeObject *)state->MatchMapping_type;
10685
279
        result = PyType_GenericNew(tp, NULL, NULL);
10686
279
        if (!result) goto failed;
10687
279
        value = ast2obj_list(state, (asdl_seq*)o->v.MatchMapping.keys,
10688
279
                             ast2obj_expr);
10689
279
        if (!value) goto failed;
10690
279
        if (PyObject_SetAttr(result, state->keys, value) == -1)
10691
0
            goto failed;
10692
279
        Py_DECREF(value);
10693
279
        value = ast2obj_list(state, (asdl_seq*)o->v.MatchMapping.patterns,
10694
279
                             ast2obj_pattern);
10695
279
        if (!value) goto failed;
10696
279
        if (PyObject_SetAttr(result, state->patterns, value) == -1)
10697
0
            goto failed;
10698
279
        Py_DECREF(value);
10699
279
        value = ast2obj_identifier(state, o->v.MatchMapping.rest);
10700
279
        if (!value) goto failed;
10701
279
        if (PyObject_SetAttr(result, state->rest, value) == -1)
10702
0
            goto failed;
10703
279
        Py_DECREF(value);
10704
279
        break;
10705
793
    case MatchClass_kind:
10706
793
        tp = (PyTypeObject *)state->MatchClass_type;
10707
793
        result = PyType_GenericNew(tp, NULL, NULL);
10708
793
        if (!result) goto failed;
10709
793
        value = ast2obj_expr(state, o->v.MatchClass.cls);
10710
793
        if (!value) goto failed;
10711
793
        if (PyObject_SetAttr(result, state->cls, value) == -1)
10712
0
            goto failed;
10713
793
        Py_DECREF(value);
10714
793
        value = ast2obj_list(state, (asdl_seq*)o->v.MatchClass.patterns,
10715
793
                             ast2obj_pattern);
10716
793
        if (!value) goto failed;
10717
793
        if (PyObject_SetAttr(result, state->patterns, value) == -1)
10718
0
            goto failed;
10719
793
        Py_DECREF(value);
10720
793
        value = ast2obj_list(state, (asdl_seq*)o->v.MatchClass.kwd_attrs,
10721
793
                             ast2obj_identifier);
10722
793
        if (!value) goto failed;
10723
793
        if (PyObject_SetAttr(result, state->kwd_attrs, value) == -1)
10724
0
            goto failed;
10725
793
        Py_DECREF(value);
10726
793
        value = ast2obj_list(state, (asdl_seq*)o->v.MatchClass.kwd_patterns,
10727
793
                             ast2obj_pattern);
10728
793
        if (!value) goto failed;
10729
793
        if (PyObject_SetAttr(result, state->kwd_patterns, value) == -1)
10730
0
            goto failed;
10731
793
        Py_DECREF(value);
10732
793
        break;
10733
190
    case MatchStar_kind:
10734
190
        tp = (PyTypeObject *)state->MatchStar_type;
10735
190
        result = PyType_GenericNew(tp, NULL, NULL);
10736
190
        if (!result) goto failed;
10737
190
        value = ast2obj_identifier(state, o->v.MatchStar.name);
10738
190
        if (!value) goto failed;
10739
190
        if (PyObject_SetAttr(result, state->name, value) == -1)
10740
0
            goto failed;
10741
190
        Py_DECREF(value);
10742
190
        break;
10743
9.73k
    case MatchAs_kind:
10744
9.73k
        tp = (PyTypeObject *)state->MatchAs_type;
10745
9.73k
        result = PyType_GenericNew(tp, NULL, NULL);
10746
9.73k
        if (!result) goto failed;
10747
9.73k
        value = ast2obj_pattern(state, o->v.MatchAs.pattern);
10748
9.73k
        if (!value) goto failed;
10749
9.73k
        if (PyObject_SetAttr(result, state->pattern, value) == -1)
10750
0
            goto failed;
10751
9.73k
        Py_DECREF(value);
10752
9.73k
        value = ast2obj_identifier(state, o->v.MatchAs.name);
10753
9.73k
        if (!value) goto failed;
10754
9.73k
        if (PyObject_SetAttr(result, state->name, value) == -1)
10755
0
            goto failed;
10756
9.73k
        Py_DECREF(value);
10757
9.73k
        break;
10758
3.22k
    case MatchOr_kind:
10759
3.22k
        tp = (PyTypeObject *)state->MatchOr_type;
10760
3.22k
        result = PyType_GenericNew(tp, NULL, NULL);
10761
3.22k
        if (!result) goto failed;
10762
3.22k
        value = ast2obj_list(state, (asdl_seq*)o->v.MatchOr.patterns,
10763
3.22k
                             ast2obj_pattern);
10764
3.22k
        if (!value) goto failed;
10765
3.22k
        if (PyObject_SetAttr(result, state->patterns, value) == -1)
10766
0
            goto failed;
10767
3.22k
        Py_DECREF(value);
10768
3.22k
        break;
10769
15.7k
    }
10770
15.7k
    value = ast2obj_int(state, o->lineno);
10771
15.7k
    if (!value) goto failed;
10772
15.7k
    if (PyObject_SetAttr(result, state->lineno, value) < 0)
10773
0
        goto failed;
10774
15.7k
    Py_DECREF(value);
10775
15.7k
    value = ast2obj_int(state, o->col_offset);
10776
15.7k
    if (!value) goto failed;
10777
15.7k
    if (PyObject_SetAttr(result, state->col_offset, value) < 0)
10778
0
        goto failed;
10779
15.7k
    Py_DECREF(value);
10780
15.7k
    value = ast2obj_int(state, o->end_lineno);
10781
15.7k
    if (!value) goto failed;
10782
15.7k
    if (PyObject_SetAttr(result, state->end_lineno, value) < 0)
10783
0
        goto failed;
10784
15.7k
    Py_DECREF(value);
10785
15.7k
    value = ast2obj_int(state, o->end_col_offset);
10786
15.7k
    if (!value) goto failed;
10787
15.7k
    if (PyObject_SetAttr(result, state->end_col_offset, value) < 0)
10788
0
        goto failed;
10789
15.7k
    Py_DECREF(value);
10790
15.7k
    Py_LeaveRecursiveCall();
10791
15.7k
    return result;
10792
0
failed:
10793
0
    Py_LeaveRecursiveCall();
10794
0
    Py_XDECREF(value);
10795
0
    Py_XDECREF(result);
10796
0
    return NULL;
10797
15.7k
}
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
5.65k
{
10840
5.65k
    type_param_ty o = (type_param_ty)_o;
10841
5.65k
    PyObject *result = NULL, *value = NULL;
10842
5.65k
    PyTypeObject *tp;
10843
5.65k
    if (!o) {
10844
0
        Py_RETURN_NONE;
10845
0
    }
10846
5.65k
    if (Py_EnterRecursiveCall("during  ast construction")) {
10847
0
        return NULL;
10848
0
    }
10849
5.65k
    switch (o->kind) {
10850
4.62k
    case TypeVar_kind:
10851
4.62k
        tp = (PyTypeObject *)state->TypeVar_type;
10852
4.62k
        result = PyType_GenericNew(tp, NULL, NULL);
10853
4.62k
        if (!result) goto failed;
10854
4.62k
        value = ast2obj_identifier(state, o->v.TypeVar.name);
10855
4.62k
        if (!value) goto failed;
10856
4.62k
        if (PyObject_SetAttr(result, state->name, value) == -1)
10857
0
            goto failed;
10858
4.62k
        Py_DECREF(value);
10859
4.62k
        value = ast2obj_expr(state, o->v.TypeVar.bound);
10860
4.62k
        if (!value) goto failed;
10861
4.62k
        if (PyObject_SetAttr(result, state->bound, value) == -1)
10862
0
            goto failed;
10863
4.62k
        Py_DECREF(value);
10864
4.62k
        value = ast2obj_expr(state, o->v.TypeVar.default_value);
10865
4.62k
        if (!value) goto failed;
10866
4.62k
        if (PyObject_SetAttr(result, state->default_value, value) == -1)
10867
0
            goto failed;
10868
4.62k
        Py_DECREF(value);
10869
4.62k
        break;
10870
326
    case ParamSpec_kind:
10871
326
        tp = (PyTypeObject *)state->ParamSpec_type;
10872
326
        result = PyType_GenericNew(tp, NULL, NULL);
10873
326
        if (!result) goto failed;
10874
326
        value = ast2obj_identifier(state, o->v.ParamSpec.name);
10875
326
        if (!value) goto failed;
10876
326
        if (PyObject_SetAttr(result, state->name, value) == -1)
10877
0
            goto failed;
10878
326
        Py_DECREF(value);
10879
326
        value = ast2obj_expr(state, o->v.ParamSpec.default_value);
10880
326
        if (!value) goto failed;
10881
326
        if (PyObject_SetAttr(result, state->default_value, value) == -1)
10882
0
            goto failed;
10883
326
        Py_DECREF(value);
10884
326
        break;
10885
706
    case TypeVarTuple_kind:
10886
706
        tp = (PyTypeObject *)state->TypeVarTuple_type;
10887
706
        result = PyType_GenericNew(tp, NULL, NULL);
10888
706
        if (!result) goto failed;
10889
706
        value = ast2obj_identifier(state, o->v.TypeVarTuple.name);
10890
706
        if (!value) goto failed;
10891
706
        if (PyObject_SetAttr(result, state->name, value) == -1)
10892
0
            goto failed;
10893
706
        Py_DECREF(value);
10894
706
        value = ast2obj_expr(state, o->v.TypeVarTuple.default_value);
10895
706
        if (!value) goto failed;
10896
706
        if (PyObject_SetAttr(result, state->default_value, value) == -1)
10897
0
            goto failed;
10898
706
        Py_DECREF(value);
10899
706
        break;
10900
5.65k
    }
10901
5.65k
    value = ast2obj_int(state, o->lineno);
10902
5.65k
    if (!value) goto failed;
10903
5.65k
    if (PyObject_SetAttr(result, state->lineno, value) < 0)
10904
0
        goto failed;
10905
5.65k
    Py_DECREF(value);
10906
5.65k
    value = ast2obj_int(state, o->col_offset);
10907
5.65k
    if (!value) goto failed;
10908
5.65k
    if (PyObject_SetAttr(result, state->col_offset, value) < 0)
10909
0
        goto failed;
10910
5.65k
    Py_DECREF(value);
10911
5.65k
    value = ast2obj_int(state, o->end_lineno);
10912
5.65k
    if (!value) goto failed;
10913
5.65k
    if (PyObject_SetAttr(result, state->end_lineno, value) < 0)
10914
0
        goto failed;
10915
5.65k
    Py_DECREF(value);
10916
5.65k
    value = ast2obj_int(state, o->end_col_offset);
10917
5.65k
    if (!value) goto failed;
10918
5.65k
    if (PyObject_SetAttr(result, state->end_col_offset, value) < 0)
10919
0
        goto failed;
10920
5.65k
    Py_DECREF(value);
10921
5.65k
    Py_LeaveRecursiveCall();
10922
5.65k
    return result;
10923
0
failed:
10924
0
    Py_LeaveRecursiveCall();
10925
0
    Py_XDECREF(value);
10926
0
    Py_XDECREF(result);
10927
0
    return NULL;
10928
5.65k
}
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
10
{
18072
10
    struct ast_state *state = get_ast_state();
18073
10
    if (state == NULL) {
18074
0
        return -1;
18075
0
    }
18076
10
    if (PyModule_AddObjectRef(m, "AST", state->AST_type) < 0) {
18077
0
        return -1;
18078
0
    }
18079
10
    if (PyModule_AddIntMacro(m, PyCF_ALLOW_TOP_LEVEL_AWAIT) < 0) {
18080
0
        return -1;
18081
0
    }
18082
10
    if (PyModule_AddIntMacro(m, PyCF_ONLY_AST) < 0) {
18083
0
        return -1;
18084
0
    }
18085
10
    if (PyModule_AddIntMacro(m, PyCF_TYPE_COMMENTS) < 0) {
18086
0
        return -1;
18087
0
    }
18088
10
    if (PyModule_AddIntMacro(m, PyCF_OPTIMIZED_AST) < 0) {
18089
0
        return -1;
18090
0
    }
18091
10
    if (PyModule_AddObjectRef(m, "mod", state->mod_type) < 0) {
18092
0
        return -1;
18093
0
    }
18094
10
    if (PyModule_AddObjectRef(m, "Module", state->Module_type) < 0) {
18095
0
        return -1;
18096
0
    }
18097
10
    if (PyModule_AddObjectRef(m, "Interactive", state->Interactive_type) < 0) {
18098
0
        return -1;
18099
0
    }
18100
10
    if (PyModule_AddObjectRef(m, "Expression", state->Expression_type) < 0) {
18101
0
        return -1;
18102
0
    }
18103
10
    if (PyModule_AddObjectRef(m, "FunctionType", state->FunctionType_type) < 0)
18104
0
        {
18105
0
        return -1;
18106
0
    }
18107
10
    if (PyModule_AddObjectRef(m, "stmt", state->stmt_type) < 0) {
18108
0
        return -1;
18109
0
    }
18110
10
    if (PyModule_AddObjectRef(m, "FunctionDef", state->FunctionDef_type) < 0) {
18111
0
        return -1;
18112
0
    }
18113
10
    if (PyModule_AddObjectRef(m, "AsyncFunctionDef",
18114
10
        state->AsyncFunctionDef_type) < 0) {
18115
0
        return -1;
18116
0
    }
18117
10
    if (PyModule_AddObjectRef(m, "ClassDef", state->ClassDef_type) < 0) {
18118
0
        return -1;
18119
0
    }
18120
10
    if (PyModule_AddObjectRef(m, "Return", state->Return_type) < 0) {
18121
0
        return -1;
18122
0
    }
18123
10
    if (PyModule_AddObjectRef(m, "Delete", state->Delete_type) < 0) {
18124
0
        return -1;
18125
0
    }
18126
10
    if (PyModule_AddObjectRef(m, "Assign", state->Assign_type) < 0) {
18127
0
        return -1;
18128
0
    }
18129
10
    if (PyModule_AddObjectRef(m, "TypeAlias", state->TypeAlias_type) < 0) {
18130
0
        return -1;
18131
0
    }
18132
10
    if (PyModule_AddObjectRef(m, "AugAssign", state->AugAssign_type) < 0) {
18133
0
        return -1;
18134
0
    }
18135
10
    if (PyModule_AddObjectRef(m, "AnnAssign", state->AnnAssign_type) < 0) {
18136
0
        return -1;
18137
0
    }
18138
10
    if (PyModule_AddObjectRef(m, "For", state->For_type) < 0) {
18139
0
        return -1;
18140
0
    }
18141
10
    if (PyModule_AddObjectRef(m, "AsyncFor", state->AsyncFor_type) < 0) {
18142
0
        return -1;
18143
0
    }
18144
10
    if (PyModule_AddObjectRef(m, "While", state->While_type) < 0) {
18145
0
        return -1;
18146
0
    }
18147
10
    if (PyModule_AddObjectRef(m, "If", state->If_type) < 0) {
18148
0
        return -1;
18149
0
    }
18150
10
    if (PyModule_AddObjectRef(m, "With", state->With_type) < 0) {
18151
0
        return -1;
18152
0
    }
18153
10
    if (PyModule_AddObjectRef(m, "AsyncWith", state->AsyncWith_type) < 0) {
18154
0
        return -1;
18155
0
    }
18156
10
    if (PyModule_AddObjectRef(m, "Match", state->Match_type) < 0) {
18157
0
        return -1;
18158
0
    }
18159
10
    if (PyModule_AddObjectRef(m, "Raise", state->Raise_type) < 0) {
18160
0
        return -1;
18161
0
    }
18162
10
    if (PyModule_AddObjectRef(m, "Try", state->Try_type) < 0) {
18163
0
        return -1;
18164
0
    }
18165
10
    if (PyModule_AddObjectRef(m, "TryStar", state->TryStar_type) < 0) {
18166
0
        return -1;
18167
0
    }
18168
10
    if (PyModule_AddObjectRef(m, "Assert", state->Assert_type) < 0) {
18169
0
        return -1;
18170
0
    }
18171
10
    if (PyModule_AddObjectRef(m, "Import", state->Import_type) < 0) {
18172
0
        return -1;
18173
0
    }
18174
10
    if (PyModule_AddObjectRef(m, "ImportFrom", state->ImportFrom_type) < 0) {
18175
0
        return -1;
18176
0
    }
18177
10
    if (PyModule_AddObjectRef(m, "Global", state->Global_type) < 0) {
18178
0
        return -1;
18179
0
    }
18180
10
    if (PyModule_AddObjectRef(m, "Nonlocal", state->Nonlocal_type) < 0) {
18181
0
        return -1;
18182
0
    }
18183
10
    if (PyModule_AddObjectRef(m, "Expr", state->Expr_type) < 0) {
18184
0
        return -1;
18185
0
    }
18186
10
    if (PyModule_AddObjectRef(m, "Pass", state->Pass_type) < 0) {
18187
0
        return -1;
18188
0
    }
18189
10
    if (PyModule_AddObjectRef(m, "Break", state->Break_type) < 0) {
18190
0
        return -1;
18191
0
    }
18192
10
    if (PyModule_AddObjectRef(m, "Continue", state->Continue_type) < 0) {
18193
0
        return -1;
18194
0
    }
18195
10
    if (PyModule_AddObjectRef(m, "expr", state->expr_type) < 0) {
18196
0
        return -1;
18197
0
    }
18198
10
    if (PyModule_AddObjectRef(m, "BoolOp", state->BoolOp_type) < 0) {
18199
0
        return -1;
18200
0
    }
18201
10
    if (PyModule_AddObjectRef(m, "NamedExpr", state->NamedExpr_type) < 0) {
18202
0
        return -1;
18203
0
    }
18204
10
    if (PyModule_AddObjectRef(m, "BinOp", state->BinOp_type) < 0) {
18205
0
        return -1;
18206
0
    }
18207
10
    if (PyModule_AddObjectRef(m, "UnaryOp", state->UnaryOp_type) < 0) {
18208
0
        return -1;
18209
0
    }
18210
10
    if (PyModule_AddObjectRef(m, "Lambda", state->Lambda_type) < 0) {
18211
0
        return -1;
18212
0
    }
18213
10
    if (PyModule_AddObjectRef(m, "IfExp", state->IfExp_type) < 0) {
18214
0
        return -1;
18215
0
    }
18216
10
    if (PyModule_AddObjectRef(m, "Dict", state->Dict_type) < 0) {
18217
0
        return -1;
18218
0
    }
18219
10
    if (PyModule_AddObjectRef(m, "Set", state->Set_type) < 0) {
18220
0
        return -1;
18221
0
    }
18222
10
    if (PyModule_AddObjectRef(m, "ListComp", state->ListComp_type) < 0) {
18223
0
        return -1;
18224
0
    }
18225
10
    if (PyModule_AddObjectRef(m, "SetComp", state->SetComp_type) < 0) {
18226
0
        return -1;
18227
0
    }
18228
10
    if (PyModule_AddObjectRef(m, "DictComp", state->DictComp_type) < 0) {
18229
0
        return -1;
18230
0
    }
18231
10
    if (PyModule_AddObjectRef(m, "GeneratorExp", state->GeneratorExp_type) < 0)
18232
0
        {
18233
0
        return -1;
18234
0
    }
18235
10
    if (PyModule_AddObjectRef(m, "Await", state->Await_type) < 0) {
18236
0
        return -1;
18237
0
    }
18238
10
    if (PyModule_AddObjectRef(m, "Yield", state->Yield_type) < 0) {
18239
0
        return -1;
18240
0
    }
18241
10
    if (PyModule_AddObjectRef(m, "YieldFrom", state->YieldFrom_type) < 0) {
18242
0
        return -1;
18243
0
    }
18244
10
    if (PyModule_AddObjectRef(m, "Compare", state->Compare_type) < 0) {
18245
0
        return -1;
18246
0
    }
18247
10
    if (PyModule_AddObjectRef(m, "Call", state->Call_type) < 0) {
18248
0
        return -1;
18249
0
    }
18250
10
    if (PyModule_AddObjectRef(m, "FormattedValue", state->FormattedValue_type)
18251
10
        < 0) {
18252
0
        return -1;
18253
0
    }
18254
10
    if (PyModule_AddObjectRef(m, "Interpolation", state->Interpolation_type) <
18255
10
        0) {
18256
0
        return -1;
18257
0
    }
18258
10
    if (PyModule_AddObjectRef(m, "JoinedStr", state->JoinedStr_type) < 0) {
18259
0
        return -1;
18260
0
    }
18261
10
    if (PyModule_AddObjectRef(m, "TemplateStr", state->TemplateStr_type) < 0) {
18262
0
        return -1;
18263
0
    }
18264
10
    if (PyModule_AddObjectRef(m, "Constant", state->Constant_type) < 0) {
18265
0
        return -1;
18266
0
    }
18267
10
    if (PyModule_AddObjectRef(m, "Attribute", state->Attribute_type) < 0) {
18268
0
        return -1;
18269
0
    }
18270
10
    if (PyModule_AddObjectRef(m, "Subscript", state->Subscript_type) < 0) {
18271
0
        return -1;
18272
0
    }
18273
10
    if (PyModule_AddObjectRef(m, "Starred", state->Starred_type) < 0) {
18274
0
        return -1;
18275
0
    }
18276
10
    if (PyModule_AddObjectRef(m, "Name", state->Name_type) < 0) {
18277
0
        return -1;
18278
0
    }
18279
10
    if (PyModule_AddObjectRef(m, "List", state->List_type) < 0) {
18280
0
        return -1;
18281
0
    }
18282
10
    if (PyModule_AddObjectRef(m, "Tuple", state->Tuple_type) < 0) {
18283
0
        return -1;
18284
0
    }
18285
10
    if (PyModule_AddObjectRef(m, "Slice", state->Slice_type) < 0) {
18286
0
        return -1;
18287
0
    }
18288
10
    if (PyModule_AddObjectRef(m, "expr_context", state->expr_context_type) < 0)
18289
0
        {
18290
0
        return -1;
18291
0
    }
18292
10
    if (PyModule_AddObjectRef(m, "Load", state->Load_type) < 0) {
18293
0
        return -1;
18294
0
    }
18295
10
    if (PyModule_AddObjectRef(m, "Store", state->Store_type) < 0) {
18296
0
        return -1;
18297
0
    }
18298
10
    if (PyModule_AddObjectRef(m, "Del", state->Del_type) < 0) {
18299
0
        return -1;
18300
0
    }
18301
10
    if (PyModule_AddObjectRef(m, "boolop", state->boolop_type) < 0) {
18302
0
        return -1;
18303
0
    }
18304
10
    if (PyModule_AddObjectRef(m, "And", state->And_type) < 0) {
18305
0
        return -1;
18306
0
    }
18307
10
    if (PyModule_AddObjectRef(m, "Or", state->Or_type) < 0) {
18308
0
        return -1;
18309
0
    }
18310
10
    if (PyModule_AddObjectRef(m, "operator", state->operator_type) < 0) {
18311
0
        return -1;
18312
0
    }
18313
10
    if (PyModule_AddObjectRef(m, "Add", state->Add_type) < 0) {
18314
0
        return -1;
18315
0
    }
18316
10
    if (PyModule_AddObjectRef(m, "Sub", state->Sub_type) < 0) {
18317
0
        return -1;
18318
0
    }
18319
10
    if (PyModule_AddObjectRef(m, "Mult", state->Mult_type) < 0) {
18320
0
        return -1;
18321
0
    }
18322
10
    if (PyModule_AddObjectRef(m, "MatMult", state->MatMult_type) < 0) {
18323
0
        return -1;
18324
0
    }
18325
10
    if (PyModule_AddObjectRef(m, "Div", state->Div_type) < 0) {
18326
0
        return -1;
18327
0
    }
18328
10
    if (PyModule_AddObjectRef(m, "Mod", state->Mod_type) < 0) {
18329
0
        return -1;
18330
0
    }
18331
10
    if (PyModule_AddObjectRef(m, "Pow", state->Pow_type) < 0) {
18332
0
        return -1;
18333
0
    }
18334
10
    if (PyModule_AddObjectRef(m, "LShift", state->LShift_type) < 0) {
18335
0
        return -1;
18336
0
    }
18337
10
    if (PyModule_AddObjectRef(m, "RShift", state->RShift_type) < 0) {
18338
0
        return -1;
18339
0
    }
18340
10
    if (PyModule_AddObjectRef(m, "BitOr", state->BitOr_type) < 0) {
18341
0
        return -1;
18342
0
    }
18343
10
    if (PyModule_AddObjectRef(m, "BitXor", state->BitXor_type) < 0) {
18344
0
        return -1;
18345
0
    }
18346
10
    if (PyModule_AddObjectRef(m, "BitAnd", state->BitAnd_type) < 0) {
18347
0
        return -1;
18348
0
    }
18349
10
    if (PyModule_AddObjectRef(m, "FloorDiv", state->FloorDiv_type) < 0) {
18350
0
        return -1;
18351
0
    }
18352
10
    if (PyModule_AddObjectRef(m, "unaryop", state->unaryop_type) < 0) {
18353
0
        return -1;
18354
0
    }
18355
10
    if (PyModule_AddObjectRef(m, "Invert", state->Invert_type) < 0) {
18356
0
        return -1;
18357
0
    }
18358
10
    if (PyModule_AddObjectRef(m, "Not", state->Not_type) < 0) {
18359
0
        return -1;
18360
0
    }
18361
10
    if (PyModule_AddObjectRef(m, "UAdd", state->UAdd_type) < 0) {
18362
0
        return -1;
18363
0
    }
18364
10
    if (PyModule_AddObjectRef(m, "USub", state->USub_type) < 0) {
18365
0
        return -1;
18366
0
    }
18367
10
    if (PyModule_AddObjectRef(m, "cmpop", state->cmpop_type) < 0) {
18368
0
        return -1;
18369
0
    }
18370
10
    if (PyModule_AddObjectRef(m, "Eq", state->Eq_type) < 0) {
18371
0
        return -1;
18372
0
    }
18373
10
    if (PyModule_AddObjectRef(m, "NotEq", state->NotEq_type) < 0) {
18374
0
        return -1;
18375
0
    }
18376
10
    if (PyModule_AddObjectRef(m, "Lt", state->Lt_type) < 0) {
18377
0
        return -1;
18378
0
    }
18379
10
    if (PyModule_AddObjectRef(m, "LtE", state->LtE_type) < 0) {
18380
0
        return -1;
18381
0
    }
18382
10
    if (PyModule_AddObjectRef(m, "Gt", state->Gt_type) < 0) {
18383
0
        return -1;
18384
0
    }
18385
10
    if (PyModule_AddObjectRef(m, "GtE", state->GtE_type) < 0) {
18386
0
        return -1;
18387
0
    }
18388
10
    if (PyModule_AddObjectRef(m, "Is", state->Is_type) < 0) {
18389
0
        return -1;
18390
0
    }
18391
10
    if (PyModule_AddObjectRef(m, "IsNot", state->IsNot_type) < 0) {
18392
0
        return -1;
18393
0
    }
18394
10
    if (PyModule_AddObjectRef(m, "In", state->In_type) < 0) {
18395
0
        return -1;
18396
0
    }
18397
10
    if (PyModule_AddObjectRef(m, "NotIn", state->NotIn_type) < 0) {
18398
0
        return -1;
18399
0
    }
18400
10
    if (PyModule_AddObjectRef(m, "comprehension", state->comprehension_type) <
18401
10
        0) {
18402
0
        return -1;
18403
0
    }
18404
10
    if (PyModule_AddObjectRef(m, "excepthandler", state->excepthandler_type) <
18405
10
        0) {
18406
0
        return -1;
18407
0
    }
18408
10
    if (PyModule_AddObjectRef(m, "ExceptHandler", state->ExceptHandler_type) <
18409
10
        0) {
18410
0
        return -1;
18411
0
    }
18412
10
    if (PyModule_AddObjectRef(m, "arguments", state->arguments_type) < 0) {
18413
0
        return -1;
18414
0
    }
18415
10
    if (PyModule_AddObjectRef(m, "arg", state->arg_type) < 0) {
18416
0
        return -1;
18417
0
    }
18418
10
    if (PyModule_AddObjectRef(m, "keyword", state->keyword_type) < 0) {
18419
0
        return -1;
18420
0
    }
18421
10
    if (PyModule_AddObjectRef(m, "alias", state->alias_type) < 0) {
18422
0
        return -1;
18423
0
    }
18424
10
    if (PyModule_AddObjectRef(m, "withitem", state->withitem_type) < 0) {
18425
0
        return -1;
18426
0
    }
18427
10
    if (PyModule_AddObjectRef(m, "match_case", state->match_case_type) < 0) {
18428
0
        return -1;
18429
0
    }
18430
10
    if (PyModule_AddObjectRef(m, "pattern", state->pattern_type) < 0) {
18431
0
        return -1;
18432
0
    }
18433
10
    if (PyModule_AddObjectRef(m, "MatchValue", state->MatchValue_type) < 0) {
18434
0
        return -1;
18435
0
    }
18436
10
    if (PyModule_AddObjectRef(m, "MatchSingleton", state->MatchSingleton_type)
18437
10
        < 0) {
18438
0
        return -1;
18439
0
    }
18440
10
    if (PyModule_AddObjectRef(m, "MatchSequence", state->MatchSequence_type) <
18441
10
        0) {
18442
0
        return -1;
18443
0
    }
18444
10
    if (PyModule_AddObjectRef(m, "MatchMapping", state->MatchMapping_type) < 0)
18445
0
        {
18446
0
        return -1;
18447
0
    }
18448
10
    if (PyModule_AddObjectRef(m, "MatchClass", state->MatchClass_type) < 0) {
18449
0
        return -1;
18450
0
    }
18451
10
    if (PyModule_AddObjectRef(m, "MatchStar", state->MatchStar_type) < 0) {
18452
0
        return -1;
18453
0
    }
18454
10
    if (PyModule_AddObjectRef(m, "MatchAs", state->MatchAs_type) < 0) {
18455
0
        return -1;
18456
0
    }
18457
10
    if (PyModule_AddObjectRef(m, "MatchOr", state->MatchOr_type) < 0) {
18458
0
        return -1;
18459
0
    }
18460
10
    if (PyModule_AddObjectRef(m, "type_ignore", state->type_ignore_type) < 0) {
18461
0
        return -1;
18462
0
    }
18463
10
    if (PyModule_AddObjectRef(m, "TypeIgnore", state->TypeIgnore_type) < 0) {
18464
0
        return -1;
18465
0
    }
18466
10
    if (PyModule_AddObjectRef(m, "type_param", state->type_param_type) < 0) {
18467
0
        return -1;
18468
0
    }
18469
10
    if (PyModule_AddObjectRef(m, "TypeVar", state->TypeVar_type) < 0) {
18470
0
        return -1;
18471
0
    }
18472
10
    if (PyModule_AddObjectRef(m, "ParamSpec", state->ParamSpec_type) < 0) {
18473
0
        return -1;
18474
0
    }
18475
10
    if (PyModule_AddObjectRef(m, "TypeVarTuple", state->TypeVarTuple_type) < 0)
18476
0
        {
18477
0
        return -1;
18478
0
    }
18479
10
    return 0;
18480
10
}
18481
18482
static PyModuleDef_Slot astmodule_slots[] = {
18483
    _Py_ABI_SLOT,
18484
    {Py_mod_exec, astmodule_exec},
18485
    {Py_mod_multiple_interpreters, Py_MOD_PER_INTERPRETER_GIL_SUPPORTED},
18486
    {Py_mod_gil, Py_MOD_GIL_NOT_USED},
18487
    {0, NULL}
18488
};
18489
18490
static struct PyModuleDef _astmodule = {
18491
    PyModuleDef_HEAD_INIT,
18492
    .m_name = "_ast",
18493
    // The _ast module uses a per-interpreter state (PyInterpreterState.ast)
18494
    .m_size = 0,
18495
    .m_slots = astmodule_slots,
18496
};
18497
18498
PyMODINIT_FUNC
18499
PyInit__ast(void)
18500
10
{
18501
10
    return PyModuleDef_Init(&_astmodule);
18502
10
}
18503
18504
18505
PyObject* PyAST_mod2obj(mod_ty t)
18506
6.10k
{
18507
6.10k
    struct ast_state *state = get_ast_state();
18508
6.10k
    if (state == NULL) {
18509
0
        return NULL;
18510
0
    }
18511
6.10k
    PyObject *result = ast2obj_mod(state, t);
18512
18513
6.10k
    return result;
18514
6.10k
}
18515
18516
/* mode is 0 for "exec", 1 for "eval" and 2 for "single" input */
18517
int PyAst_CheckMode(PyObject *ast, int mode)
18518
0
{
18519
0
    const char * const req_name[] = {"Module", "Expression", "Interactive"};
18520
18521
0
    struct ast_state *state = get_ast_state();
18522
0
    if (state == NULL) {
18523
0
        return -1;
18524
0
    }
18525
18526
0
    PyObject *req_type[3];
18527
0
    req_type[0] = state->Module_type;
18528
0
    req_type[1] = state->Expression_type;
18529
0
    req_type[2] = state->Interactive_type;
18530
18531
0
    assert(0 <= mode && mode <= 2);
18532
0
    int isinstance = PyObject_IsInstance(ast, req_type[mode]);
18533
0
    if (isinstance == -1) {
18534
0
        return -1;
18535
0
    }
18536
0
    if (!isinstance) {
18537
0
        PyErr_Format(PyExc_TypeError, "expected %s node, got %.400s",
18538
0
                     req_name[mode], _PyType_Name(Py_TYPE(ast)));
18539
0
        return -1;
18540
0
    }
18541
0
    return 0;
18542
0
}
18543
18544
mod_ty PyAST_obj2mod(PyObject* ast, PyArena* arena, int mode)
18545
0
{
18546
0
    if (PySys_Audit("compile", "OO", ast, Py_None) < 0) {
18547
0
        return NULL;
18548
0
    }
18549
18550
0
    struct ast_state *state = get_ast_state();
18551
0
    if (state == NULL) {
18552
0
        return NULL;
18553
0
    }
18554
18555
0
    if (PyAst_CheckMode(ast, mode) < 0) {
18556
0
        return NULL;
18557
0
    }
18558
18559
0
    mod_ty res = NULL;
18560
0
    if (obj2ast_mod(state, ast, &res, arena) != 0)
18561
0
        return NULL;
18562
0
    else
18563
0
        return res;
18564
0
}
18565
18566
int PyAST_Check(PyObject* obj)
18567
101k
{
18568
101k
    struct ast_state *state = get_ast_state();
18569
101k
    if (state == NULL) {
18570
0
        return -1;
18571
0
    }
18572
101k
    return PyObject_IsInstance(obj, state->AST_type);
18573
101k
}
18574
18575