/home/mdboom/Work/builds/cpython/Python/Python-ast.c
Line | Count | Source (jump to first uncovered line) |
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_interp.h" // _PyInterpreterState.ast |
8 | #include "pycore_pystate.h" // _PyInterpreterState_GET() |
9 | #include "structmember.h" |
10 | #include <stddef.h> |
11 | |
12 | // Forward declaration |
13 | static int init_types(struct ast_state *state); |
14 | |
15 | static struct ast_state* |
16 | get_ast_state(void) |
17 | { |
18 | PyInterpreterState *interp = _PyInterpreterState_GET(); |
19 | struct ast_state *state = &interp->ast; |
20 | if (!init_types(state)) { Branch (20:9): [True: 0, False: 32.5k]
|
21 | return NULL; |
22 | } |
23 | return state; |
24 | } |
25 | |
26 | void _PyAST_Fini(PyInterpreterState *interp) |
27 | { |
28 | struct ast_state *state = &interp->ast; |
29 | |
30 | Py_CLEAR(state->AST_type); |
31 | Py_CLEAR(state->Add_singleton); |
32 | Py_CLEAR(state->Add_type); |
33 | Py_CLEAR(state->And_singleton); |
34 | Py_CLEAR(state->And_type); |
35 | Py_CLEAR(state->AnnAssign_type); |
36 | Py_CLEAR(state->Assert_type); |
37 | Py_CLEAR(state->Assign_type); |
38 | Py_CLEAR(state->AsyncFor_type); |
39 | Py_CLEAR(state->AsyncFunctionDef_type); |
40 | Py_CLEAR(state->AsyncWith_type); |
41 | Py_CLEAR(state->Attribute_type); |
42 | Py_CLEAR(state->AugAssign_type); |
43 | Py_CLEAR(state->Await_type); |
44 | Py_CLEAR(state->BinOp_type); |
45 | Py_CLEAR(state->BitAnd_singleton); |
46 | Py_CLEAR(state->BitAnd_type); |
47 | Py_CLEAR(state->BitOr_singleton); |
48 | Py_CLEAR(state->BitOr_type); |
49 | Py_CLEAR(state->BitXor_singleton); |
50 | Py_CLEAR(state->BitXor_type); |
51 | Py_CLEAR(state->BoolOp_type); |
52 | Py_CLEAR(state->Break_type); |
53 | Py_CLEAR(state->Call_type); |
54 | Py_CLEAR(state->ClassDef_type); |
55 | Py_CLEAR(state->Compare_type); |
56 | Py_CLEAR(state->Constant_type); |
57 | Py_CLEAR(state->Continue_type); |
58 | Py_CLEAR(state->Del_singleton); |
59 | Py_CLEAR(state->Del_type); |
60 | Py_CLEAR(state->Delete_type); |
61 | Py_CLEAR(state->DictComp_type); |
62 | Py_CLEAR(state->Dict_type); |
63 | Py_CLEAR(state->Div_singleton); |
64 | Py_CLEAR(state->Div_type); |
65 | Py_CLEAR(state->Eq_singleton); |
66 | Py_CLEAR(state->Eq_type); |
67 | Py_CLEAR(state->ExceptHandler_type); |
68 | Py_CLEAR(state->Expr_type); |
69 | Py_CLEAR(state->Expression_type); |
70 | Py_CLEAR(state->FloorDiv_singleton); |
71 | Py_CLEAR(state->FloorDiv_type); |
72 | Py_CLEAR(state->For_type); |
73 | Py_CLEAR(state->FormattedValue_type); |
74 | Py_CLEAR(state->FunctionDef_type); |
75 | Py_CLEAR(state->FunctionType_type); |
76 | Py_CLEAR(state->GeneratorExp_type); |
77 | Py_CLEAR(state->Global_type); |
78 | Py_CLEAR(state->GtE_singleton); |
79 | Py_CLEAR(state->GtE_type); |
80 | Py_CLEAR(state->Gt_singleton); |
81 | Py_CLEAR(state->Gt_type); |
82 | Py_CLEAR(state->IfExp_type); |
83 | Py_CLEAR(state->If_type); |
84 | Py_CLEAR(state->ImportFrom_type); |
85 | Py_CLEAR(state->Import_type); |
86 | Py_CLEAR(state->In_singleton); |
87 | Py_CLEAR(state->In_type); |
88 | Py_CLEAR(state->Interactive_type); |
89 | Py_CLEAR(state->Invert_singleton); |
90 | Py_CLEAR(state->Invert_type); |
91 | Py_CLEAR(state->IsNot_singleton); |
92 | Py_CLEAR(state->IsNot_type); |
93 | Py_CLEAR(state->Is_singleton); |
94 | Py_CLEAR(state->Is_type); |
95 | Py_CLEAR(state->JoinedStr_type); |
96 | Py_CLEAR(state->LShift_singleton); |
97 | Py_CLEAR(state->LShift_type); |
98 | Py_CLEAR(state->Lambda_type); |
99 | Py_CLEAR(state->ListComp_type); |
100 | Py_CLEAR(state->List_type); |
101 | Py_CLEAR(state->Load_singleton); |
102 | Py_CLEAR(state->Load_type); |
103 | Py_CLEAR(state->LtE_singleton); |
104 | Py_CLEAR(state->LtE_type); |
105 | Py_CLEAR(state->Lt_singleton); |
106 | Py_CLEAR(state->Lt_type); |
107 | Py_CLEAR(state->MatMult_singleton); |
108 | Py_CLEAR(state->MatMult_type); |
109 | Py_CLEAR(state->MatchAs_type); |
110 | Py_CLEAR(state->MatchClass_type); |
111 | Py_CLEAR(state->MatchMapping_type); |
112 | Py_CLEAR(state->MatchOr_type); |
113 | Py_CLEAR(state->MatchSequence_type); |
114 | Py_CLEAR(state->MatchSingleton_type); |
115 | Py_CLEAR(state->MatchStar_type); |
116 | Py_CLEAR(state->MatchValue_type); |
117 | Py_CLEAR(state->Match_type); |
118 | Py_CLEAR(state->Mod_singleton); |
119 | Py_CLEAR(state->Mod_type); |
120 | Py_CLEAR(state->Module_type); |
121 | Py_CLEAR(state->Mult_singleton); |
122 | Py_CLEAR(state->Mult_type); |
123 | Py_CLEAR(state->Name_type); |
124 | Py_CLEAR(state->NamedExpr_type); |
125 | Py_CLEAR(state->Nonlocal_type); |
126 | Py_CLEAR(state->NotEq_singleton); |
127 | Py_CLEAR(state->NotEq_type); |
128 | Py_CLEAR(state->NotIn_singleton); |
129 | Py_CLEAR(state->NotIn_type); |
130 | Py_CLEAR(state->Not_singleton); |
131 | Py_CLEAR(state->Not_type); |
132 | Py_CLEAR(state->Or_singleton); |
133 | Py_CLEAR(state->Or_type); |
134 | Py_CLEAR(state->Pass_type); |
135 | Py_CLEAR(state->Pow_singleton); |
136 | Py_CLEAR(state->Pow_type); |
137 | Py_CLEAR(state->RShift_singleton); |
138 | Py_CLEAR(state->RShift_type); |
139 | Py_CLEAR(state->Raise_type); |
140 | Py_CLEAR(state->Return_type); |
141 | Py_CLEAR(state->SetComp_type); |
142 | Py_CLEAR(state->Set_type); |
143 | Py_CLEAR(state->Slice_type); |
144 | Py_CLEAR(state->Starred_type); |
145 | Py_CLEAR(state->Store_singleton); |
146 | Py_CLEAR(state->Store_type); |
147 | Py_CLEAR(state->Sub_singleton); |
148 | Py_CLEAR(state->Sub_type); |
149 | Py_CLEAR(state->Subscript_type); |
150 | Py_CLEAR(state->TryStar_type); |
151 | Py_CLEAR(state->Try_type); |
152 | Py_CLEAR(state->Tuple_type); |
153 | Py_CLEAR(state->TypeIgnore_type); |
154 | Py_CLEAR(state->UAdd_singleton); |
155 | Py_CLEAR(state->UAdd_type); |
156 | Py_CLEAR(state->USub_singleton); |
157 | Py_CLEAR(state->USub_type); |
158 | Py_CLEAR(state->UnaryOp_type); |
159 | Py_CLEAR(state->While_type); |
160 | Py_CLEAR(state->With_type); |
161 | Py_CLEAR(state->YieldFrom_type); |
162 | Py_CLEAR(state->Yield_type); |
163 | Py_CLEAR(state->__dict__); |
164 | Py_CLEAR(state->__doc__); |
165 | Py_CLEAR(state->__match_args__); |
166 | Py_CLEAR(state->__module__); |
167 | Py_CLEAR(state->_attributes); |
168 | Py_CLEAR(state->_fields); |
169 | Py_CLEAR(state->alias_type); |
170 | Py_CLEAR(state->annotation); |
171 | Py_CLEAR(state->arg); |
172 | Py_CLEAR(state->arg_type); |
173 | Py_CLEAR(state->args); |
174 | Py_CLEAR(state->argtypes); |
175 | Py_CLEAR(state->arguments_type); |
176 | Py_CLEAR(state->asname); |
177 | Py_CLEAR(state->ast); |
178 | Py_CLEAR(state->attr); |
179 | Py_CLEAR(state->bases); |
180 | Py_CLEAR(state->body); |
181 | Py_CLEAR(state->boolop_type); |
182 | Py_CLEAR(state->cases); |
183 | Py_CLEAR(state->cause); |
184 | Py_CLEAR(state->cls); |
185 | Py_CLEAR(state->cmpop_type); |
186 | Py_CLEAR(state->col_offset); |
187 | Py_CLEAR(state->comparators); |
188 | Py_CLEAR(state->comprehension_type); |
189 | Py_CLEAR(state->context_expr); |
190 | Py_CLEAR(state->conversion); |
191 | Py_CLEAR(state->ctx); |
192 | Py_CLEAR(state->decorator_list); |
193 | Py_CLEAR(state->defaults); |
194 | Py_CLEAR(state->elt); |
195 | Py_CLEAR(state->elts); |
196 | Py_CLEAR(state->end_col_offset); |
197 | Py_CLEAR(state->end_lineno); |
198 | Py_CLEAR(state->exc); |
199 | Py_CLEAR(state->excepthandler_type); |
200 | Py_CLEAR(state->expr_context_type); |
201 | Py_CLEAR(state->expr_type); |
202 | Py_CLEAR(state->finalbody); |
203 | Py_CLEAR(state->format_spec); |
204 | Py_CLEAR(state->func); |
205 | Py_CLEAR(state->generators); |
206 | Py_CLEAR(state->guard); |
207 | Py_CLEAR(state->handlers); |
208 | Py_CLEAR(state->id); |
209 | Py_CLEAR(state->ifs); |
210 | Py_CLEAR(state->is_async); |
211 | Py_CLEAR(state->items); |
212 | Py_CLEAR(state->iter); |
213 | Py_CLEAR(state->key); |
214 | Py_CLEAR(state->keys); |
215 | Py_CLEAR(state->keyword_type); |
216 | Py_CLEAR(state->keywords); |
217 | Py_CLEAR(state->kind); |
218 | Py_CLEAR(state->kw_defaults); |
219 | Py_CLEAR(state->kwarg); |
220 | Py_CLEAR(state->kwd_attrs); |
221 | Py_CLEAR(state->kwd_patterns); |
222 | Py_CLEAR(state->kwonlyargs); |
223 | Py_CLEAR(state->left); |
224 | Py_CLEAR(state->level); |
225 | Py_CLEAR(state->lineno); |
226 | Py_CLEAR(state->lower); |
227 | Py_CLEAR(state->match_case_type); |
228 | Py_CLEAR(state->mod_type); |
229 | Py_CLEAR(state->module); |
230 | Py_CLEAR(state->msg); |
231 | Py_CLEAR(state->name); |
232 | Py_CLEAR(state->names); |
233 | Py_CLEAR(state->op); |
234 | Py_CLEAR(state->operand); |
235 | Py_CLEAR(state->operator_type); |
236 | Py_CLEAR(state->ops); |
237 | Py_CLEAR(state->optional_vars); |
238 | Py_CLEAR(state->orelse); |
239 | Py_CLEAR(state->pattern); |
240 | Py_CLEAR(state->pattern_type); |
241 | Py_CLEAR(state->patterns); |
242 | Py_CLEAR(state->posonlyargs); |
243 | Py_CLEAR(state->rest); |
244 | Py_CLEAR(state->returns); |
245 | Py_CLEAR(state->right); |
246 | Py_CLEAR(state->simple); |
247 | Py_CLEAR(state->slice); |
248 | Py_CLEAR(state->step); |
249 | Py_CLEAR(state->stmt_type); |
250 | Py_CLEAR(state->subject); |
251 | Py_CLEAR(state->tag); |
252 | Py_CLEAR(state->target); |
253 | Py_CLEAR(state->targets); |
254 | Py_CLEAR(state->test); |
255 | Py_CLEAR(state->type); |
256 | Py_CLEAR(state->type_comment); |
257 | Py_CLEAR(state->type_ignore_type); |
258 | Py_CLEAR(state->type_ignores); |
259 | Py_CLEAR(state->unaryop_type); |
260 | Py_CLEAR(state->upper); |
261 | Py_CLEAR(state->value); |
262 | Py_CLEAR(state->values); |
263 | Py_CLEAR(state->vararg); |
264 | Py_CLEAR(state->withitem_type); |
265 | |
266 | #if !defined(NDEBUG) |
267 | state->initialized = -1; |
268 | #else |
269 | state->initialized = 0; |
270 | #endif |
271 | } |
272 | |
273 | static int init_identifiers(struct ast_state *state) |
274 | { |
275 | if ((state->__dict__ = PyUnicode_InternFromString("__dict__")) == NULL) return 00 ; Branch (275:9): [True: 0, False: 19]
|
276 | if ((state->__doc__ = PyUnicode_InternFromString("__doc__")) == NULL) return 00 ; Branch (276:9): [True: 0, False: 19]
|
277 | if ((state->__match_args__ = PyUnicode_InternFromString("__match_args__")) == NULL) return 00 ; Branch (277:9): [True: 0, False: 19]
|
278 | if ((state->__module__ = PyUnicode_InternFromString("__module__")) == NULL) return 00 ; Branch (278:9): [True: 0, False: 19]
|
279 | if ((state->_attributes = PyUnicode_InternFromString("_attributes")) == NULL) return 00 ; Branch (279:9): [True: 0, False: 19]
|
280 | if ((state->_fields = PyUnicode_InternFromString("_fields")) == NULL) return 00 ; Branch (280:9): [True: 0, False: 19]
|
281 | if ((state->annotation = PyUnicode_InternFromString("annotation")) == NULL) return 00 ; Branch (281:9): [True: 0, False: 19]
|
282 | if ((state->arg = PyUnicode_InternFromString("arg")) == NULL) return 00 ; Branch (282:9): [True: 0, False: 19]
|
283 | if ((state->args = PyUnicode_InternFromString("args")) == NULL) return 00 ; Branch (283:9): [True: 0, False: 19]
|
284 | if ((state->argtypes = PyUnicode_InternFromString("argtypes")) == NULL) return 00 ; Branch (284:9): [True: 0, False: 19]
|
285 | if ((state->asname = PyUnicode_InternFromString("asname")) == NULL) return 00 ; Branch (285:9): [True: 0, False: 19]
|
286 | if ((state->ast = PyUnicode_InternFromString("ast")) == NULL) return 00 ; Branch (286:9): [True: 0, False: 19]
|
287 | if ((state->attr = PyUnicode_InternFromString("attr")) == NULL) return 00 ; Branch (287:9): [True: 0, False: 19]
|
288 | if ((state->bases = PyUnicode_InternFromString("bases")) == NULL) return 00 ; Branch (288:9): [True: 0, False: 19]
|
289 | if ((state->body = PyUnicode_InternFromString("body")) == NULL) return 00 ; Branch (289:9): [True: 0, False: 19]
|
290 | if ((state->cases = PyUnicode_InternFromString("cases")) == NULL) return 00 ; Branch (290:9): [True: 0, False: 19]
|
291 | if ((state->cause = PyUnicode_InternFromString("cause")) == NULL) return 00 ; Branch (291:9): [True: 0, False: 19]
|
292 | if ((state->cls = PyUnicode_InternFromString("cls")) == NULL) return 00 ; Branch (292:9): [True: 0, False: 19]
|
293 | if ((state->col_offset = PyUnicode_InternFromString("col_offset")) == NULL) return 00 ; Branch (293:9): [True: 0, False: 19]
|
294 | if ((state->comparators = PyUnicode_InternFromString("comparators")) == NULL) return 00 ; Branch (294:9): [True: 0, False: 19]
|
295 | if ((state->context_expr = PyUnicode_InternFromString("context_expr")) == NULL) return 00 ; Branch (295:9): [True: 0, False: 19]
|
296 | if ((state->conversion = PyUnicode_InternFromString("conversion")) == NULL) return 00 ; Branch (296:9): [True: 0, False: 19]
|
297 | if ((state->ctx = PyUnicode_InternFromString("ctx")) == NULL) return 00 ; Branch (297:9): [True: 0, False: 19]
|
298 | if ((state->decorator_list = PyUnicode_InternFromString("decorator_list")) == NULL) return 00 ; Branch (298:9): [True: 0, False: 19]
|
299 | if ((state->defaults = PyUnicode_InternFromString("defaults")) == NULL) return 00 ; Branch (299:9): [True: 0, False: 19]
|
300 | if ((state->elt = PyUnicode_InternFromString("elt")) == NULL) return 00 ; Branch (300:9): [True: 0, False: 19]
|
301 | if ((state->elts = PyUnicode_InternFromString("elts")) == NULL) return 00 ; Branch (301:9): [True: 0, False: 19]
|
302 | if ((state->end_col_offset = PyUnicode_InternFromString("end_col_offset")) == NULL) return 00 ; Branch (302:9): [True: 0, False: 19]
|
303 | if ((state->end_lineno = PyUnicode_InternFromString("end_lineno")) == NULL) return 00 ; Branch (303:9): [True: 0, False: 19]
|
304 | if ((state->exc = PyUnicode_InternFromString("exc")) == NULL) return 00 ; Branch (304:9): [True: 0, False: 19]
|
305 | if ((state->finalbody = PyUnicode_InternFromString("finalbody")) == NULL) return 00 ; Branch (305:9): [True: 0, False: 19]
|
306 | if ((state->format_spec = PyUnicode_InternFromString("format_spec")) == NULL) return 00 ; Branch (306:9): [True: 0, False: 19]
|
307 | if ((state->func = PyUnicode_InternFromString("func")) == NULL) return 00 ; Branch (307:9): [True: 0, False: 19]
|
308 | if ((state->generators = PyUnicode_InternFromString("generators")) == NULL) return 00 ; Branch (308:9): [True: 0, False: 19]
|
309 | if ((state->guard = PyUnicode_InternFromString("guard")) == NULL) return 00 ; Branch (309:9): [True: 0, False: 19]
|
310 | if ((state->handlers = PyUnicode_InternFromString("handlers")) == NULL) return 00 ; Branch (310:9): [True: 0, False: 19]
|
311 | if ((state->id = PyUnicode_InternFromString("id")) == NULL) return 00 ; Branch (311:9): [True: 0, False: 19]
|
312 | if ((state->ifs = PyUnicode_InternFromString("ifs")) == NULL) return 00 ; Branch (312:9): [True: 0, False: 19]
|
313 | if ((state->is_async = PyUnicode_InternFromString("is_async")) == NULL) return 00 ; Branch (313:9): [True: 0, False: 19]
|
314 | if ((state->items = PyUnicode_InternFromString("items")) == NULL) return 00 ; Branch (314:9): [True: 0, False: 19]
|
315 | if ((state->iter = PyUnicode_InternFromString("iter")) == NULL) return 00 ; Branch (315:9): [True: 0, False: 19]
|
316 | if ((state->key = PyUnicode_InternFromString("key")) == NULL) return 00 ; Branch (316:9): [True: 0, False: 19]
|
317 | if ((state->keys = PyUnicode_InternFromString("keys")) == NULL) return 00 ; Branch (317:9): [True: 0, False: 19]
|
318 | if ((state->keywords = PyUnicode_InternFromString("keywords")) == NULL) return 00 ; Branch (318:9): [True: 0, False: 19]
|
319 | if ((state->kind = PyUnicode_InternFromString("kind")) == NULL) return 00 ; Branch (319:9): [True: 0, False: 19]
|
320 | if ((state->kw_defaults = PyUnicode_InternFromString("kw_defaults")) == NULL) return 00 ; Branch (320:9): [True: 0, False: 19]
|
321 | if ((state->kwarg = PyUnicode_InternFromString("kwarg")) == NULL) return 00 ; Branch (321:9): [True: 0, False: 19]
|
322 | if ((state->kwd_attrs = PyUnicode_InternFromString("kwd_attrs")) == NULL) return 00 ; Branch (322:9): [True: 0, False: 19]
|
323 | if ((state->kwd_patterns = PyUnicode_InternFromString("kwd_patterns")) == NULL) return 00 ; Branch (323:9): [True: 0, False: 19]
|
324 | if ((state->kwonlyargs = PyUnicode_InternFromString("kwonlyargs")) == NULL) return 00 ; Branch (324:9): [True: 0, False: 19]
|
325 | if ((state->left = PyUnicode_InternFromString("left")) == NULL) return 00 ; Branch (325:9): [True: 0, False: 19]
|
326 | if ((state->level = PyUnicode_InternFromString("level")) == NULL) return 00 ; Branch (326:9): [True: 0, False: 19]
|
327 | if ((state->lineno = PyUnicode_InternFromString("lineno")) == NULL) return 00 ; Branch (327:9): [True: 0, False: 19]
|
328 | if ((state->lower = PyUnicode_InternFromString("lower")) == NULL) return 00 ; Branch (328:9): [True: 0, False: 19]
|
329 | if ((state->module = PyUnicode_InternFromString("module")) == NULL) return 00 ; Branch (329:9): [True: 0, False: 19]
|
330 | if ((state->msg = PyUnicode_InternFromString("msg")) == NULL) return 00 ; Branch (330:9): [True: 0, False: 19]
|
331 | if ((state->name = PyUnicode_InternFromString("name")) == NULL) return 00 ; Branch (331:9): [True: 0, False: 19]
|
332 | if ((state->names = PyUnicode_InternFromString("names")) == NULL) return 00 ; Branch (332:9): [True: 0, False: 19]
|
333 | if ((state->op = PyUnicode_InternFromString("op")) == NULL) return 00 ; Branch (333:9): [True: 0, False: 19]
|
334 | if ((state->operand = PyUnicode_InternFromString("operand")) == NULL) return 00 ; Branch (334:9): [True: 0, False: 19]
|
335 | if ((state->ops = PyUnicode_InternFromString("ops")) == NULL) return 00 ; Branch (335:9): [True: 0, False: 19]
|
336 | if ((state->optional_vars = PyUnicode_InternFromString("optional_vars")) == NULL) return 00 ; Branch (336:9): [True: 0, False: 19]
|
337 | if ((state->orelse = PyUnicode_InternFromString("orelse")) == NULL) return 00 ; Branch (337:9): [True: 0, False: 19]
|
338 | if ((state->pattern = PyUnicode_InternFromString("pattern")) == NULL) return 00 ; Branch (338:9): [True: 0, False: 19]
|
339 | if ((state->patterns = PyUnicode_InternFromString("patterns")) == NULL) return 00 ; Branch (339:9): [True: 0, False: 19]
|
340 | if ((state->posonlyargs = PyUnicode_InternFromString("posonlyargs")) == NULL) return 00 ; Branch (340:9): [True: 0, False: 19]
|
341 | if ((state->rest = PyUnicode_InternFromString("rest")) == NULL) return 00 ; Branch (341:9): [True: 0, False: 19]
|
342 | if ((state->returns = PyUnicode_InternFromString("returns")) == NULL) return 00 ; Branch (342:9): [True: 0, False: 19]
|
343 | if ((state->right = PyUnicode_InternFromString("right")) == NULL) return 00 ; Branch (343:9): [True: 0, False: 19]
|
344 | if ((state->simple = PyUnicode_InternFromString("simple")) == NULL) return 00 ; Branch (344:9): [True: 0, False: 19]
|
345 | if ((state->slice = PyUnicode_InternFromString("slice")) == NULL) return 00 ; Branch (345:9): [True: 0, False: 19]
|
346 | if ((state->step = PyUnicode_InternFromString("step")) == NULL) return 00 ; Branch (346:9): [True: 0, False: 19]
|
347 | if ((state->subject = PyUnicode_InternFromString("subject")) == NULL) return 00 ; Branch (347:9): [True: 0, False: 19]
|
348 | if ((state->tag = PyUnicode_InternFromString("tag")) == NULL) return 00 ; Branch (348:9): [True: 0, False: 19]
|
349 | if ((state->target = PyUnicode_InternFromString("target")) == NULL) return 00 ; Branch (349:9): [True: 0, False: 19]
|
350 | if ((state->targets = PyUnicode_InternFromString("targets")) == NULL) return 00 ; Branch (350:9): [True: 0, False: 19]
|
351 | if ((state->test = PyUnicode_InternFromString("test")) == NULL) return 00 ; Branch (351:9): [True: 0, False: 19]
|
352 | if ((state->type = PyUnicode_InternFromString("type")) == NULL) return 00 ; Branch (352:9): [True: 0, False: 19]
|
353 | if ((state->type_comment = PyUnicode_InternFromString("type_comment")) == NULL) return 00 ; Branch (353:9): [True: 0, False: 19]
|
354 | if ((state->type_ignores = PyUnicode_InternFromString("type_ignores")) == NULL) return 00 ; Branch (354:9): [True: 0, False: 19]
|
355 | if ((state->upper = PyUnicode_InternFromString("upper")) == NULL) return 00 ; Branch (355:9): [True: 0, False: 19]
|
356 | if ((state->value = PyUnicode_InternFromString("value")) == NULL) return 00 ; Branch (356:9): [True: 0, False: 19]
|
357 | if ((state->values = PyUnicode_InternFromString("values")) == NULL) return 00 ; Branch (357:9): [True: 0, False: 19]
|
358 | if ((state->vararg = PyUnicode_InternFromString("vararg")) == NULL) return 00 ; Branch (358:9): [True: 0, False: 19]
|
359 | return 1; |
360 | }; |
361 | |
362 | GENERATE_ASDL_SEQ_CONSTRUCTOR(mod, mod_ty) |
363 | GENERATE_ASDL_SEQ_CONSTRUCTOR(stmt, stmt_ty) |
364 | GENERATE_ASDL_SEQ_CONSTRUCTOR(expr, expr_ty) |
365 | GENERATE_ASDL_SEQ_CONSTRUCTOR(comprehension, comprehension_ty) |
366 | GENERATE_ASDL_SEQ_CONSTRUCTOR(excepthandler, excepthandler_ty) |
367 | GENERATE_ASDL_SEQ_CONSTRUCTOR(arguments, arguments_ty) |
368 | GENERATE_ASDL_SEQ_CONSTRUCTOR(arg, arg_ty) |
369 | GENERATE_ASDL_SEQ_CONSTRUCTOR(keyword, keyword_ty) |
370 | GENERATE_ASDL_SEQ_CONSTRUCTOR(alias, alias_ty) |
371 | GENERATE_ASDL_SEQ_CONSTRUCTOR(withitem, withitem_ty) |
372 | GENERATE_ASDL_SEQ_CONSTRUCTOR(match_case, match_case_ty) |
373 | GENERATE_ASDL_SEQ_CONSTRUCTOR(pattern, pattern_ty) |
374 | GENERATE_ASDL_SEQ_CONSTRUCTOR(type_ignore, type_ignore_ty) |
375 | |
376 | static PyObject* ast2obj_mod(struct ast_state *state, void*); |
377 | static const char * const Module_fields[]={ |
378 | "body", |
379 | "type_ignores", |
380 | }; |
381 | static const char * const Interactive_fields[]={ |
382 | "body", |
383 | }; |
384 | static const char * const Expression_fields[]={ |
385 | "body", |
386 | }; |
387 | static const char * const FunctionType_fields[]={ |
388 | "argtypes", |
389 | "returns", |
390 | }; |
391 | static const char * const stmt_attributes[] = { |
392 | "lineno", |
393 | "col_offset", |
394 | "end_lineno", |
395 | "end_col_offset", |
396 | }; |
397 | static PyObject* ast2obj_stmt(struct ast_state *state, void*); |
398 | static const char * const FunctionDef_fields[]={ |
399 | "name", |
400 | "args", |
401 | "body", |
402 | "decorator_list", |
403 | "returns", |
404 | "type_comment", |
405 | }; |
406 | static const char * const AsyncFunctionDef_fields[]={ |
407 | "name", |
408 | "args", |
409 | "body", |
410 | "decorator_list", |
411 | "returns", |
412 | "type_comment", |
413 | }; |
414 | static const char * const ClassDef_fields[]={ |
415 | "name", |
416 | "bases", |
417 | "keywords", |
418 | "body", |
419 | "decorator_list", |
420 | }; |
421 | static const char * const Return_fields[]={ |
422 | "value", |
423 | }; |
424 | static const char * const Delete_fields[]={ |
425 | "targets", |
426 | }; |
427 | static const char * const Assign_fields[]={ |
428 | "targets", |
429 | "value", |
430 | "type_comment", |
431 | }; |
432 | static const char * const AugAssign_fields[]={ |
433 | "target", |
434 | "op", |
435 | "value", |
436 | }; |
437 | static const char * const AnnAssign_fields[]={ |
438 | "target", |
439 | "annotation", |
440 | "value", |
441 | "simple", |
442 | }; |
443 | static const char * const For_fields[]={ |
444 | "target", |
445 | "iter", |
446 | "body", |
447 | "orelse", |
448 | "type_comment", |
449 | }; |
450 | static const char * const AsyncFor_fields[]={ |
451 | "target", |
452 | "iter", |
453 | "body", |
454 | "orelse", |
455 | "type_comment", |
456 | }; |
457 | static const char * const While_fields[]={ |
458 | "test", |
459 | "body", |
460 | "orelse", |
461 | }; |
462 | static const char * const If_fields[]={ |
463 | "test", |
464 | "body", |
465 | "orelse", |
466 | }; |
467 | static const char * const With_fields[]={ |
468 | "items", |
469 | "body", |
470 | "type_comment", |
471 | }; |
472 | static const char * const AsyncWith_fields[]={ |
473 | "items", |
474 | "body", |
475 | "type_comment", |
476 | }; |
477 | static const char * const Match_fields[]={ |
478 | "subject", |
479 | "cases", |
480 | }; |
481 | static const char * const Raise_fields[]={ |
482 | "exc", |
483 | "cause", |
484 | }; |
485 | static const char * const Try_fields[]={ |
486 | "body", |
487 | "handlers", |
488 | "orelse", |
489 | "finalbody", |
490 | }; |
491 | static const char * const TryStar_fields[]={ |
492 | "body", |
493 | "handlers", |
494 | "orelse", |
495 | "finalbody", |
496 | }; |
497 | static const char * const Assert_fields[]={ |
498 | "test", |
499 | "msg", |
500 | }; |
501 | static const char * const Import_fields[]={ |
502 | "names", |
503 | }; |
504 | static const char * const ImportFrom_fields[]={ |
505 | "module", |
506 | "names", |
507 | "level", |
508 | }; |
509 | static const char * const Global_fields[]={ |
510 | "names", |
511 | }; |
512 | static const char * const Nonlocal_fields[]={ |
513 | "names", |
514 | }; |
515 | static const char * const Expr_fields[]={ |
516 | "value", |
517 | }; |
518 | static const char * const expr_attributes[] = { |
519 | "lineno", |
520 | "col_offset", |
521 | "end_lineno", |
522 | "end_col_offset", |
523 | }; |
524 | static PyObject* ast2obj_expr(struct ast_state *state, void*); |
525 | static const char * const BoolOp_fields[]={ |
526 | "op", |
527 | "values", |
528 | }; |
529 | static const char * const NamedExpr_fields[]={ |
530 | "target", |
531 | "value", |
532 | }; |
533 | static const char * const BinOp_fields[]={ |
534 | "left", |
535 | "op", |
536 | "right", |
537 | }; |
538 | static const char * const UnaryOp_fields[]={ |
539 | "op", |
540 | "operand", |
541 | }; |
542 | static const char * const Lambda_fields[]={ |
543 | "args", |
544 | "body", |
545 | }; |
546 | static const char * const IfExp_fields[]={ |
547 | "test", |
548 | "body", |
549 | "orelse", |
550 | }; |
551 | static const char * const Dict_fields[]={ |
552 | "keys", |
553 | "values", |
554 | }; |
555 | static const char * const Set_fields[]={ |
556 | "elts", |
557 | }; |
558 | static const char * const ListComp_fields[]={ |
559 | "elt", |
560 | "generators", |
561 | }; |
562 | static const char * const SetComp_fields[]={ |
563 | "elt", |
564 | "generators", |
565 | }; |
566 | static const char * const DictComp_fields[]={ |
567 | "key", |
568 | "value", |
569 | "generators", |
570 | }; |
571 | static const char * const GeneratorExp_fields[]={ |
572 | "elt", |
573 | "generators", |
574 | }; |
575 | static const char * const Await_fields[]={ |
576 | "value", |
577 | }; |
578 | static const char * const Yield_fields[]={ |
579 | "value", |
580 | }; |
581 | static const char * const YieldFrom_fields[]={ |
582 | "value", |
583 | }; |
584 | static const char * const Compare_fields[]={ |
585 | "left", |
586 | "ops", |
587 | "comparators", |
588 | }; |
589 | static const char * const Call_fields[]={ |
590 | "func", |
591 | "args", |
592 | "keywords", |
593 | }; |
594 | static const char * const FormattedValue_fields[]={ |
595 | "value", |
596 | "conversion", |
597 | "format_spec", |
598 | }; |
599 | static const char * const JoinedStr_fields[]={ |
600 | "values", |
601 | }; |
602 | static const char * const Constant_fields[]={ |
603 | "value", |
604 | "kind", |
605 | }; |
606 | static const char * const Attribute_fields[]={ |
607 | "value", |
608 | "attr", |
609 | "ctx", |
610 | }; |
611 | static const char * const Subscript_fields[]={ |
612 | "value", |
613 | "slice", |
614 | "ctx", |
615 | }; |
616 | static const char * const Starred_fields[]={ |
617 | "value", |
618 | "ctx", |
619 | }; |
620 | static const char * const Name_fields[]={ |
621 | "id", |
622 | "ctx", |
623 | }; |
624 | static const char * const List_fields[]={ |
625 | "elts", |
626 | "ctx", |
627 | }; |
628 | static const char * const Tuple_fields[]={ |
629 | "elts", |
630 | "ctx", |
631 | }; |
632 | static const char * const Slice_fields[]={ |
633 | "lower", |
634 | "upper", |
635 | "step", |
636 | }; |
637 | static PyObject* ast2obj_expr_context(struct ast_state *state, expr_context_ty); |
638 | static PyObject* ast2obj_boolop(struct ast_state *state, boolop_ty); |
639 | static PyObject* ast2obj_operator(struct ast_state *state, operator_ty); |
640 | static PyObject* ast2obj_unaryop(struct ast_state *state, unaryop_ty); |
641 | static PyObject* ast2obj_cmpop(struct ast_state *state, cmpop_ty); |
642 | static PyObject* ast2obj_comprehension(struct ast_state *state, void*); |
643 | static const char * const comprehension_fields[]={ |
644 | "target", |
645 | "iter", |
646 | "ifs", |
647 | "is_async", |
648 | }; |
649 | static const char * const excepthandler_attributes[] = { |
650 | "lineno", |
651 | "col_offset", |
652 | "end_lineno", |
653 | "end_col_offset", |
654 | }; |
655 | static PyObject* ast2obj_excepthandler(struct ast_state *state, void*); |
656 | static const char * const ExceptHandler_fields[]={ |
657 | "type", |
658 | "name", |
659 | "body", |
660 | }; |
661 | static PyObject* ast2obj_arguments(struct ast_state *state, void*); |
662 | static const char * const arguments_fields[]={ |
663 | "posonlyargs", |
664 | "args", |
665 | "vararg", |
666 | "kwonlyargs", |
667 | "kw_defaults", |
668 | "kwarg", |
669 | "defaults", |
670 | }; |
671 | static PyObject* ast2obj_arg(struct ast_state *state, void*); |
672 | static const char * const arg_attributes[] = { |
673 | "lineno", |
674 | "col_offset", |
675 | "end_lineno", |
676 | "end_col_offset", |
677 | }; |
678 | static const char * const arg_fields[]={ |
679 | "arg", |
680 | "annotation", |
681 | "type_comment", |
682 | }; |
683 | static PyObject* ast2obj_keyword(struct ast_state *state, void*); |
684 | static const char * const keyword_attributes[] = { |
685 | "lineno", |
686 | "col_offset", |
687 | "end_lineno", |
688 | "end_col_offset", |
689 | }; |
690 | static const char * const keyword_fields[]={ |
691 | "arg", |
692 | "value", |
693 | }; |
694 | static PyObject* ast2obj_alias(struct ast_state *state, void*); |
695 | static const char * const alias_attributes[] = { |
696 | "lineno", |
697 | "col_offset", |
698 | "end_lineno", |
699 | "end_col_offset", |
700 | }; |
701 | static const char * const alias_fields[]={ |
702 | "name", |
703 | "asname", |
704 | }; |
705 | static PyObject* ast2obj_withitem(struct ast_state *state, void*); |
706 | static const char * const withitem_fields[]={ |
707 | "context_expr", |
708 | "optional_vars", |
709 | }; |
710 | static PyObject* ast2obj_match_case(struct ast_state *state, void*); |
711 | static const char * const match_case_fields[]={ |
712 | "pattern", |
713 | "guard", |
714 | "body", |
715 | }; |
716 | static const char * const pattern_attributes[] = { |
717 | "lineno", |
718 | "col_offset", |
719 | "end_lineno", |
720 | "end_col_offset", |
721 | }; |
722 | static PyObject* ast2obj_pattern(struct ast_state *state, void*); |
723 | static const char * const MatchValue_fields[]={ |
724 | "value", |
725 | }; |
726 | static const char * const MatchSingleton_fields[]={ |
727 | "value", |
728 | }; |
729 | static const char * const MatchSequence_fields[]={ |
730 | "patterns", |
731 | }; |
732 | static const char * const MatchMapping_fields[]={ |
733 | "keys", |
734 | "patterns", |
735 | "rest", |
736 | }; |
737 | static const char * const MatchClass_fields[]={ |
738 | "cls", |
739 | "patterns", |
740 | "kwd_attrs", |
741 | "kwd_patterns", |
742 | }; |
743 | static const char * const MatchStar_fields[]={ |
744 | "name", |
745 | }; |
746 | static const char * const MatchAs_fields[]={ |
747 | "pattern", |
748 | "name", |
749 | }; |
750 | static const char * const MatchOr_fields[]={ |
751 | "patterns", |
752 | }; |
753 | static PyObject* ast2obj_type_ignore(struct ast_state *state, void*); |
754 | static const char * const TypeIgnore_fields[]={ |
755 | "lineno", |
756 | "tag", |
757 | }; |
758 | |
759 | |
760 | |
761 | typedef struct { |
762 | PyObject_HEAD |
763 | PyObject *dict; |
764 | } AST_object; |
765 | |
766 | static void |
767 | ast_dealloc(AST_object *self) |
768 | { |
769 | /* bpo-31095: UnTrack is needed before calling any callbacks */ |
770 | PyTypeObject *tp = Py_TYPE(self); |
771 | PyObject_GC_UnTrack(self); |
772 | Py_CLEAR(self->dict); |
773 | freefunc free_func = PyType_GetSlot(tp, Py_tp_free); |
774 | assert(free_func != NULL); |
775 | free_func(self); |
776 | Py_DECREF(tp); |
777 | } |
778 | |
779 | static int |
780 | ast_traverse(AST_object *self, visitproc visit, void *arg) |
781 | { |
782 | Py_VISIT(Py_TYPE(self)); |
783 | Py_VISIT(self->dict); |
784 | return 0; |
785 | } |
786 | |
787 | static int |
788 | ast_clear(AST_object *self) |
789 | { |
790 | Py_CLEAR(self->dict); |
791 | return 0; |
792 | } |
793 | |
794 | static int |
795 | ast_type_init(PyObject *self, PyObject *args, PyObject *kw) |
796 | { |
797 | struct ast_state *state = get_ast_state(); |
798 | if (state == NULL) { Branch (798:9): [True: 0, False: 3.25k]
|
799 | return -1; |
800 | } |
801 | |
802 | Py_ssize_t i, numfields = 0; |
803 | int res = -1; |
804 | PyObject *key, *value, *fields; |
805 | if (_PyObject_LookupAttr((PyObject*)Py_TYPE(self), state->_fields, &fields) < 0) { Branch (805:9): [True: 0, False: 3.25k]
|
806 | goto cleanup; |
807 | } |
808 | if (fields) { Branch (808:9): [True: 3.25k, False: 0]
|
809 | numfields = PySequence_Size(fields); |
810 | if (numfields == -1) { Branch (810:13): [True: 0, False: 3.25k]
|
811 | goto cleanup; |
812 | } |
813 | } |
814 | |
815 | res = 0; /* if no error occurs, this stays 0 to the end */ |
816 | if (numfields < PyTuple_GET_SIZE(args)) { Branch (816:9): [True: 5, False: 3.25k]
|
817 | PyErr_Format(PyExc_TypeError, "%.400s constructor takes at most " |
818 | "%zd positional argument%s", |
819 | _PyType_Name(Py_TYPE(self)), |
820 | numfields, numfields == 1 ? ""0 : "s"); Branch (820:33): [True: 0, False: 5]
|
821 | res = -1; |
822 | goto cleanup; |
823 | } |
824 | for (i = 0; 3.25k i < PyTuple_GET_SIZE(args); i++1.70k ) { Branch (824:17): [True: 1.70k, False: 3.25k]
|
825 | /* cannot be reached when fields is NULL */ |
826 | PyObject *name = PySequence_GetItem(fields, i); |
827 | if (!name) { Branch (827:13): [True: 0, False: 1.70k]
|
828 | res = -1; |
829 | goto cleanup; |
830 | } |
831 | res = PyObject_SetAttr(self, name, PyTuple_GET_ITEM(args, i)); |
832 | Py_DECREF(name); |
833 | if (res < 0) { Branch (833:13): [True: 0, False: 1.70k]
|
834 | goto cleanup; |
835 | } |
836 | } |
837 | if (kw) { Branch (837:9): [True: 237, False: 3.01k]
|
838 | i = 0; /* needed by PyDict_Next */ |
839 | while (PyDict_Next(kw, &i, &key, &value)) { Branch (839:16): [True: 322, False: 236]
|
840 | int contains = PySequence_Contains(fields, key); |
841 | if (contains == -1) { Branch (841:17): [True: 0, False: 322]
|
842 | res = -1; |
843 | goto cleanup; |
844 | } else if (contains == 1) { Branch (844:24): [True: 218, False: 104]
|
845 | Py_ssize_t p = PySequence_Index(fields, key); |
846 | if (p == -1) { Branch (846:21): [True: 0, False: 218]
|
847 | res = -1; |
848 | goto cleanup; |
849 | } |
850 | if (p < PyTuple_GET_SIZE(args)) { Branch (850:21): [True: 1, False: 217]
|
851 | PyErr_Format(PyExc_TypeError, |
852 | "%.400s got multiple values for argument '%U'", |
853 | Py_TYPE(self)->tp_name, key); |
854 | res = -1; |
855 | goto cleanup; |
856 | } |
857 | } |
858 | res = PyObject_SetAttr(self, key, value); |
859 | if (res < 0) { Branch (859:17): [True: 0, False: 321]
|
860 | goto cleanup; |
861 | } |
862 | } |
863 | } |
864 | cleanup: |
865 | Py_XDECREF(fields); |
866 | return res; |
867 | } |
868 | |
869 | /* Pickling support */ |
870 | static PyObject * |
871 | ast_type_reduce(PyObject *self, PyObject *unused) |
872 | { |
873 | struct ast_state *state = get_ast_state(); |
874 | if (state == NULL) { Branch (874:9): [True: 0, False: 1.85k]
|
875 | return NULL; |
876 | } |
877 | |
878 | PyObject *dict; |
879 | if (_PyObject_LookupAttr(self, state->__dict__, &dict) < 0) { Branch (879:9): [True: 0, False: 1.85k]
|
880 | return NULL; |
881 | } |
882 | if (dict) { Branch (882:9): [True: 1.85k, False: 0]
|
883 | return Py_BuildValue("O()N", Py_TYPE(self), dict); |
884 | } |
885 | return Py_BuildValue("O()", Py_TYPE(self)); |
886 | } |
887 | |
888 | static PyMemberDef ast_type_members[] = { |
889 | {"__dictoffset__", T_PYSSIZET, offsetof(AST_object, dict), READONLY}, |
890 | {NULL} /* Sentinel */ |
891 | }; |
892 | |
893 | static PyMethodDef ast_type_methods[] = { |
894 | {"__reduce__", ast_type_reduce, METH_NOARGS, NULL}, |
895 | {NULL} |
896 | }; |
897 | |
898 | static PyGetSetDef ast_type_getsets[] = { |
899 | {"__dict__", PyObject_GenericGetDict, PyObject_GenericSetDict}, |
900 | {NULL} |
901 | }; |
902 | |
903 | static PyType_Slot AST_type_slots[] = { |
904 | {Py_tp_dealloc, ast_dealloc}, |
905 | {Py_tp_getattro, PyObject_GenericGetAttr}, |
906 | {Py_tp_setattro, PyObject_GenericSetAttr}, |
907 | {Py_tp_traverse, ast_traverse}, |
908 | {Py_tp_clear, ast_clear}, |
909 | {Py_tp_members, ast_type_members}, |
910 | {Py_tp_methods, ast_type_methods}, |
911 | {Py_tp_getset, ast_type_getsets}, |
912 | {Py_tp_init, ast_type_init}, |
913 | {Py_tp_alloc, PyType_GenericAlloc}, |
914 | {Py_tp_new, PyType_GenericNew}, |
915 | {Py_tp_free, PyObject_GC_Del}, |
916 | {0, 0}, |
917 | }; |
918 | |
919 | static PyType_Spec AST_type_spec = { |
920 | "ast.AST", |
921 | sizeof(AST_object), |
922 | 0, |
923 | Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_HAVE_GC, |
924 | AST_type_slots |
925 | }; |
926 | |
927 | static PyObject * |
928 | make_type(struct ast_state *state, const char *type, PyObject* base, |
929 | const char* const* fields, int num_fields, const char *doc) |
930 | { |
931 | PyObject *fnames, *result; |
932 | int i; |
933 | fnames = PyTuple_New(num_fields); |
934 | if (!fnames) return NULL0 ; Branch (934:9): [True: 0, False: 2.24k]
|
935 | for (i = 0; 2.24k i < num_fields; i++3.38k ) { Branch (935:17): [True: 3.38k, False: 2.24k]
|
936 | PyObject *field = PyUnicode_InternFromString(fields[i]); |
937 | if (!field) { Branch (937:13): [True: 0, False: 3.38k]
|
938 | Py_DECREF(fnames); |
939 | return NULL; |
940 | } |
941 | PyTuple_SET_ITEM(fnames, i, field); |
942 | } |
943 | result = PyObject_CallFunction((PyObject*)&PyType_Type, "s(O){OOOOOOOs}", |
944 | type, base, |
945 | state->_fields, fnames, |
946 | state->__match_args__, fnames, |
947 | state->__module__, |
948 | state->ast, |
949 | state->__doc__, doc); |
950 | Py_DECREF(fnames); |
951 | return result; |
952 | } |
953 | |
954 | static int |
955 | add_attributes(struct ast_state *state, PyObject *type, const char * const *attrs, int num_fields) |
956 | { |
957 | int i, result; |
958 | PyObject *s, *l = PyTuple_New(num_fields); |
959 | if (!l) Branch (959:9): [True: 0, False: 342]
|
960 | return 0; |
961 | for (i = 0; 342 i < num_fields; i++532 ) { Branch (961:17): [True: 532, False: 342]
|
962 | s = PyUnicode_InternFromString(attrs[i]); |
963 | if (!s) { Branch (963:13): [True: 0, False: 532]
|
964 | Py_DECREF(l); |
965 | return 0; |
966 | } |
967 | PyTuple_SET_ITEM(l, i, s); |
968 | } |
969 | result = PyObject_SetAttr(type, state->_attributes, l) >= 0; |
970 | Py_DECREF(l); |
971 | return result; |
972 | } |
973 | |
974 | /* Conversion AST -> Python */ |
975 | |
976 | static PyObject* ast2obj_list(struct ast_state *state, asdl_seq *seq, PyObject* (*func)(struct ast_state *state, void*)) |
977 | { |
978 | Py_ssize_t i, n = asdl_seq_LEN(seq); |
979 | PyObject *result = PyList_New(n); |
980 | PyObject *value; |
981 | if (!result) Branch (981:9): [True: 0, False: 470k]
|
982 | return NULL; |
983 | for (i = 0; 470k i < n; i++445k ) { Branch (983:17): [True: 445k, False: 470k]
|
984 | value = func(state, asdl_seq_GET_UNTYPED(seq, i)); |
985 | if (!value) { Branch (985:13): [True: 0, False: 445k]
|
986 | Py_DECREF(result); |
987 | return NULL; |
988 | } |
989 | PyList_SET_ITEM(result, i, value); |
990 | } |
991 | return result; |
992 | } |
993 | |
994 | static PyObject* ast2obj_object(struct ast_state *Py_UNUSED(state), void *o) |
995 | { |
996 | if (!o) Branch (996:9): [True: 228k, False: 526k]
|
997 | o = Py_None; |
998 | Py_INCREF((PyObject*)o); |
999 | return (PyObject*)o; |
1000 | } |
1001 | #define ast2obj_constant ast2obj_object |
1002 | #define ast2obj_identifier ast2obj_object |
1003 | #define ast2obj_string ast2obj_object |
1004 | |
1005 | static PyObject* ast2obj_int(struct ast_state *Py_UNUSED(state), long b) |
1006 | { |
1007 | return PyLong_FromLong(b); |
1008 | } |
1009 | |
1010 | /* Conversion Python -> AST */ |
1011 | |
1012 | static int obj2ast_object(struct ast_state *Py_UNUSED(state), PyObject* obj, PyObject** out, PyArena* arena) |
1013 | { |
1014 | if (obj == Py_None) Branch (1014:9): [True: 0, False: 183k]
|
1015 | obj = NULL; |
1016 | if (obj) { Branch (1016:9): [True: 183k, False: 0]
|
1017 | if (_PyArena_AddPyObject(arena, obj) < 0) { Branch (1017:13): [True: 0, False: 183k]
|
1018 | *out = NULL; |
1019 | return -1; |
1020 | } |
1021 | Py_INCREF(obj); |
1022 | } |
1023 | *out = obj; |
1024 | return 0; |
1025 | } |
1026 | |
1027 | static int obj2ast_constant(struct ast_state *Py_UNUSED(state), PyObject* obj, PyObject** out, PyArena* arena) |
1028 | { |
1029 | if (_PyArena_AddPyObject(arena, obj) < 0) { Branch (1029:9): [True: 0, False: 46.6k]
|
1030 | *out = NULL; |
1031 | return -1; |
1032 | } |
1033 | Py_INCREF(obj); |
1034 | *out = obj; |
1035 | return 0; |
1036 | } |
1037 | |
1038 | static int obj2ast_identifier(struct ast_state *state, PyObject* obj, PyObject** out, PyArena* arena) |
1039 | { |
1040 | if (!PyUnicode_CheckExact(obj) && obj != 1 Py_None1 ) { Branch (1040:9): [True: 1, False: 183k]
Branch (1040:39): [True: 1, False: 0]
|
1041 | PyErr_SetString(PyExc_TypeError, "AST identifier must be of type str"); |
1042 | return 1; |
1043 | } |
1044 | return obj2ast_object(state, obj, out, arena); |
1045 | } |
1046 | |
1047 | static int obj2ast_string(struct ast_state *state, PyObject* obj, PyObject** out, PyArena* arena) |
1048 | { |
1049 | if (!PyUnicode_CheckExact(obj) && !PyBytes_CheckExact(obj)) { Branch (1049:9): [True: 0, False: 0]
Branch (1049:39): [True: 0, False: 0]
|
1050 | PyErr_SetString(PyExc_TypeError, "AST string must be of type str"); |
1051 | return 1; |
1052 | } |
1053 | return obj2ast_object(state, obj, out, arena); |
1054 | } |
1055 | |
1056 | static int obj2ast_int(struct ast_state* Py_UNUSED(state), PyObject* obj, int* out, PyArena* arena) |
1057 | { |
1058 | int i; |
1059 | if (!PyLong_Check(obj)) { Branch (1059:9): [True: 1, False: 1.43M]
|
1060 | PyErr_Format(PyExc_ValueError, "invalid integer value: %R", obj); |
1061 | return 1; |
1062 | } |
1063 | |
1064 | i = _PyLong_AsInt(obj); |
1065 | if (i == -1 && PyErr_Occurred()410 ) Branch (1065:9): [True: 410, False: 1.43M]
Branch (1065:20): [True: 0, False: 410]
|
1066 | return 1; |
1067 | *out = i; |
1068 | return 0; |
1069 | } |
1070 | |
1071 | static int add_ast_fields(struct ast_state *state) |
1072 | { |
1073 | PyObject *empty_tuple; |
1074 | empty_tuple = PyTuple_New(0); |
1075 | if (!empty_tuple || Branch (1075:9): [True: 0, False: 19]
|
1076 | PyObject_SetAttrString(state->AST_type, "_fields", empty_tuple) < 0 || Branch (1076:9): [True: 0, False: 19]
|
1077 | PyObject_SetAttrString(state->AST_type, "__match_args__", empty_tuple) < 0 || Branch (1077:9): [True: 0, False: 19]
|
1078 | PyObject_SetAttrString(state->AST_type, "_attributes", empty_tuple) < 0) { Branch (1078:9): [True: 0, False: 19]
|
1079 | Py_XDECREF(empty_tuple); |
1080 | return -1; |
1081 | } |
1082 | Py_DECREF(empty_tuple); |
1083 | return 0; |
1084 | } |
1085 | |
1086 | |
1087 | |
1088 | static int |
1089 | init_types(struct ast_state *state) |
1090 | { |
1091 | // init_types() must not be called after _PyAST_Fini() |
1092 | // has been called |
1093 | assert(state->initialized >= 0); |
1094 | |
1095 | if (state->initialized) { Branch (1095:9): [True: 32.5k, False: 19]
|
1096 | return 1; |
1097 | } |
1098 | if (init_identifiers(state) < 0) { Branch (1098:9): [True: 0, False: 19]
|
1099 | return 0; |
1100 | } |
1101 | state->AST_type = PyType_FromSpec(&AST_type_spec); |
1102 | if (!state->AST_type) { Branch (1102:9): [True: 0, False: 19]
|
1103 | return 0; |
1104 | } |
1105 | if (add_ast_fields(state) < 0) { Branch (1105:9): [True: 0, False: 19]
|
1106 | return 0; |
1107 | } |
1108 | state->mod_type = make_type(state, "mod", state->AST_type, NULL, 0, |
1109 | "mod = Module(stmt* body, type_ignore* type_ignores)\n" |
1110 | " | Interactive(stmt* body)\n" |
1111 | " | Expression(expr body)\n" |
1112 | " | FunctionType(expr* argtypes, expr returns)"); |
1113 | if (!state->mod_type) return 00 ; Branch (1113:9): [True: 0, False: 19]
|
1114 | if (!add_attributes(state, state->mod_type, NULL, 0)) return 00 ; Branch (1114:9): [True: 0, False: 19]
|
1115 | state->Module_type = make_type(state, "Module", state->mod_type, |
1116 | Module_fields, 2, |
1117 | "Module(stmt* body, type_ignore* type_ignores)"); |
1118 | if (!state->Module_type) return 00 ; Branch (1118:9): [True: 0, False: 19]
|
1119 | state->Interactive_type = make_type(state, "Interactive", state->mod_type, |
1120 | Interactive_fields, 1, |
1121 | "Interactive(stmt* body)"); |
1122 | if (!state->Interactive_type) return 00 ; Branch (1122:9): [True: 0, False: 19]
|
1123 | state->Expression_type = make_type(state, "Expression", state->mod_type, |
1124 | Expression_fields, 1, |
1125 | "Expression(expr body)"); |
1126 | if (!state->Expression_type) return 00 ; Branch (1126:9): [True: 0, False: 19]
|
1127 | state->FunctionType_type = make_type(state, "FunctionType", |
1128 | state->mod_type, FunctionType_fields, |
1129 | 2, |
1130 | "FunctionType(expr* argtypes, expr returns)"); |
1131 | if (!state->FunctionType_type) return 00 ; Branch (1131:9): [True: 0, False: 19]
|
1132 | state->stmt_type = make_type(state, "stmt", state->AST_type, NULL, 0, |
1133 | "stmt = FunctionDef(identifier name, arguments args, stmt* body, expr* decorator_list, expr? returns, string? type_comment)\n" |
1134 | " | AsyncFunctionDef(identifier name, arguments args, stmt* body, expr* decorator_list, expr? returns, string? type_comment)\n" |
1135 | " | ClassDef(identifier name, expr* bases, keyword* keywords, stmt* body, expr* decorator_list)\n" |
1136 | " | Return(expr? value)\n" |
1137 | " | Delete(expr* targets)\n" |
1138 | " | Assign(expr* targets, expr value, string? type_comment)\n" |
1139 | " | AugAssign(expr target, operator op, expr value)\n" |
1140 | " | AnnAssign(expr target, expr annotation, expr? value, int simple)\n" |
1141 | " | For(expr target, expr iter, stmt* body, stmt* orelse, string? type_comment)\n" |
1142 | " | AsyncFor(expr target, expr iter, stmt* body, stmt* orelse, string? type_comment)\n" |
1143 | " | While(expr test, stmt* body, stmt* orelse)\n" |
1144 | " | If(expr test, stmt* body, stmt* orelse)\n" |
1145 | " | With(withitem* items, stmt* body, string? type_comment)\n" |
1146 | " | AsyncWith(withitem* items, stmt* body, string? type_comment)\n" |
1147 | " | Match(expr subject, match_case* cases)\n" |
1148 | " | Raise(expr? exc, expr? cause)\n" |
1149 | " | Try(stmt* body, excepthandler* handlers, stmt* orelse, stmt* finalbody)\n" |
1150 | " | TryStar(stmt* body, excepthandler* handlers, stmt* orelse, stmt* finalbody)\n" |
1151 | " | Assert(expr test, expr? msg)\n" |
1152 | " | Import(alias* names)\n" |
1153 | " | ImportFrom(identifier? module, alias* names, int? level)\n" |
1154 | " | Global(identifier* names)\n" |
1155 | " | Nonlocal(identifier* names)\n" |
1156 | " | Expr(expr value)\n" |
1157 | " | Pass\n" |
1158 | " | Break\n" |
1159 | " | Continue"); |
1160 | if (!state->stmt_type) return 00 ; Branch (1160:9): [True: 0, False: 19]
|
1161 | if (!add_attributes(state, state->stmt_type, stmt_attributes, 4)) return 00 ; Branch (1161:9): [True: 0, False: 19]
|
1162 | if (PyObject_SetAttr(state->stmt_type, state->end_lineno, Py_None) == -1) Branch (1162:9): [True: 0, False: 19]
|
1163 | return 0; |
1164 | if (PyObject_SetAttr(state->stmt_type, state->end_col_offset, Py_None) == Branch (1164:9): [True: 0, False: 19]
|
1165 | -1) |
1166 | return 0; |
1167 | state->FunctionDef_type = make_type(state, "FunctionDef", state->stmt_type, |
1168 | FunctionDef_fields, 6, |
1169 | "FunctionDef(identifier name, arguments args, stmt* body, expr* decorator_list, expr? returns, string? type_comment)"); |
1170 | if (!state->FunctionDef_type) return 00 ; Branch (1170:9): [True: 0, False: 19]
|
1171 | if (PyObject_SetAttr(state->FunctionDef_type, state->returns, Py_None) == Branch (1171:9): [True: 0, False: 19]
|
1172 | -1) |
1173 | return 0; |
1174 | if (PyObject_SetAttr(state->FunctionDef_type, state->type_comment, Py_None) Branch (1174:9): [True: 0, False: 19]
|
1175 | == -1) |
1176 | return 0; |
1177 | state->AsyncFunctionDef_type = make_type(state, "AsyncFunctionDef", |
1178 | state->stmt_type, |
1179 | AsyncFunctionDef_fields, 6, |
1180 | "AsyncFunctionDef(identifier name, arguments args, stmt* body, expr* decorator_list, expr? returns, string? type_comment)"); |
1181 | if (!state->AsyncFunctionDef_type) return 00 ; Branch (1181:9): [True: 0, False: 19]
|
1182 | if (PyObject_SetAttr(state->AsyncFunctionDef_type, state->returns, Py_None) Branch (1182:9): [True: 0, False: 19]
|
1183 | == -1) |
1184 | return 0; |
1185 | if (PyObject_SetAttr(state->AsyncFunctionDef_type, state->type_comment, Branch (1185:9): [True: 0, False: 19]
|
1186 | Py_None) == -1) |
1187 | return 0; |
1188 | state->ClassDef_type = make_type(state, "ClassDef", state->stmt_type, |
1189 | ClassDef_fields, 5, |
1190 | "ClassDef(identifier name, expr* bases, keyword* keywords, stmt* body, expr* decorator_list)"); |
1191 | if (!state->ClassDef_type) return 00 ; Branch (1191:9): [True: 0, False: 19]
|
1192 | state->Return_type = make_type(state, "Return", state->stmt_type, |
1193 | Return_fields, 1, |
1194 | "Return(expr? value)"); |
1195 | if (!state->Return_type) return 00 ; Branch (1195:9): [True: 0, False: 19]
|
1196 | if (PyObject_SetAttr(state->Return_type, state->value, Py_None) == -1) Branch (1196:9): [True: 0, False: 19]
|
1197 | return 0; |
1198 | state->Delete_type = make_type(state, "Delete", state->stmt_type, |
1199 | Delete_fields, 1, |
1200 | "Delete(expr* targets)"); |
1201 | if (!state->Delete_type) return 00 ; Branch (1201:9): [True: 0, False: 19]
|
1202 | state->Assign_type = make_type(state, "Assign", state->stmt_type, |
1203 | Assign_fields, 3, |
1204 | "Assign(expr* targets, expr value, string? type_comment)"); |
1205 | if (!state->Assign_type) return 00 ; Branch (1205:9): [True: 0, False: 19]
|
1206 | if (PyObject_SetAttr(state->Assign_type, state->type_comment, Py_None) == Branch (1206:9): [True: 0, False: 19]
|
1207 | -1) |
1208 | return 0; |
1209 | state->AugAssign_type = make_type(state, "AugAssign", state->stmt_type, |
1210 | AugAssign_fields, 3, |
1211 | "AugAssign(expr target, operator op, expr value)"); |
1212 | if (!state->AugAssign_type) return 00 ; Branch (1212:9): [True: 0, False: 19]
|
1213 | state->AnnAssign_type = make_type(state, "AnnAssign", state->stmt_type, |
1214 | AnnAssign_fields, 4, |
1215 | "AnnAssign(expr target, expr annotation, expr? value, int simple)"); |
1216 | if (!state->AnnAssign_type) return 00 ; Branch (1216:9): [True: 0, False: 19]
|
1217 | if (PyObject_SetAttr(state->AnnAssign_type, state->value, Py_None) == -1) Branch (1217:9): [True: 0, False: 19]
|
1218 | return 0; |
1219 | state->For_type = make_type(state, "For", state->stmt_type, For_fields, 5, |
1220 | "For(expr target, expr iter, stmt* body, stmt* orelse, string? type_comment)"); |
1221 | if (!state->For_type) return 00 ; Branch (1221:9): [True: 0, False: 19]
|
1222 | if (PyObject_SetAttr(state->For_type, state->type_comment, Py_None) == -1) Branch (1222:9): [True: 0, False: 19]
|
1223 | return 0; |
1224 | state->AsyncFor_type = make_type(state, "AsyncFor", state->stmt_type, |
1225 | AsyncFor_fields, 5, |
1226 | "AsyncFor(expr target, expr iter, stmt* body, stmt* orelse, string? type_comment)"); |
1227 | if (!state->AsyncFor_type) return 00 ; Branch (1227:9): [True: 0, False: 19]
|
1228 | if (PyObject_SetAttr(state->AsyncFor_type, state->type_comment, Py_None) == Branch (1228:9): [True: 0, False: 19]
|
1229 | -1) |
1230 | return 0; |
1231 | state->While_type = make_type(state, "While", state->stmt_type, |
1232 | While_fields, 3, |
1233 | "While(expr test, stmt* body, stmt* orelse)"); |
1234 | if (!state->While_type) return 00 ; Branch (1234:9): [True: 0, False: 19]
|
1235 | state->If_type = make_type(state, "If", state->stmt_type, If_fields, 3, |
1236 | "If(expr test, stmt* body, stmt* orelse)"); |
1237 | if (!state->If_type) return 00 ; Branch (1237:9): [True: 0, False: 19]
|
1238 | state->With_type = make_type(state, "With", state->stmt_type, With_fields, |
1239 | 3, |
1240 | "With(withitem* items, stmt* body, string? type_comment)"); |
1241 | if (!state->With_type) return 00 ; Branch (1241:9): [True: 0, False: 19]
|
1242 | if (PyObject_SetAttr(state->With_type, state->type_comment, Py_None) == -1) Branch (1242:9): [True: 0, False: 19]
|
1243 | return 0; |
1244 | state->AsyncWith_type = make_type(state, "AsyncWith", state->stmt_type, |
1245 | AsyncWith_fields, 3, |
1246 | "AsyncWith(withitem* items, stmt* body, string? type_comment)"); |
1247 | if (!state->AsyncWith_type) return 00 ; Branch (1247:9): [True: 0, False: 19]
|
1248 | if (PyObject_SetAttr(state->AsyncWith_type, state->type_comment, Py_None) Branch (1248:9): [True: 0, False: 19]
|
1249 | == -1) |
1250 | return 0; |
1251 | state->Match_type = make_type(state, "Match", state->stmt_type, |
1252 | Match_fields, 2, |
1253 | "Match(expr subject, match_case* cases)"); |
1254 | if (!state->Match_type) return 00 ; Branch (1254:9): [True: 0, False: 19]
|
1255 | state->Raise_type = make_type(state, "Raise", state->stmt_type, |
1256 | Raise_fields, 2, |
1257 | "Raise(expr? exc, expr? cause)"); |
1258 | if (!state->Raise_type) return 00 ; Branch (1258:9): [True: 0, False: 19]
|
1259 | if (PyObject_SetAttr(state->Raise_type, state->exc, Py_None) == -1) Branch (1259:9): [True: 0, False: 19]
|
1260 | return 0; |
1261 | if (PyObject_SetAttr(state->Raise_type, state->cause, Py_None) == -1) Branch (1261:9): [True: 0, False: 19]
|
1262 | return 0; |
1263 | state->Try_type = make_type(state, "Try", state->stmt_type, Try_fields, 4, |
1264 | "Try(stmt* body, excepthandler* handlers, stmt* orelse, stmt* finalbody)"); |
1265 | if (!state->Try_type) return 00 ; Branch (1265:9): [True: 0, False: 19]
|
1266 | state->TryStar_type = make_type(state, "TryStar", state->stmt_type, |
1267 | TryStar_fields, 4, |
1268 | "TryStar(stmt* body, excepthandler* handlers, stmt* orelse, stmt* finalbody)"); |
1269 | if (!state->TryStar_type) return 00 ; Branch (1269:9): [True: 0, False: 19]
|
1270 | state->Assert_type = make_type(state, "Assert", state->stmt_type, |
1271 | Assert_fields, 2, |
1272 | "Assert(expr test, expr? msg)"); |
1273 | if (!state->Assert_type) return 00 ; Branch (1273:9): [True: 0, False: 19]
|
1274 | if (PyObject_SetAttr(state->Assert_type, state->msg, Py_None) == -1) Branch (1274:9): [True: 0, False: 19]
|
1275 | return 0; |
1276 | state->Import_type = make_type(state, "Import", state->stmt_type, |
1277 | Import_fields, 1, |
1278 | "Import(alias* names)"); |
1279 | if (!state->Import_type) return 00 ; Branch (1279:9): [True: 0, False: 19]
|
1280 | state->ImportFrom_type = make_type(state, "ImportFrom", state->stmt_type, |
1281 | ImportFrom_fields, 3, |
1282 | "ImportFrom(identifier? module, alias* names, int? level)"); |
1283 | if (!state->ImportFrom_type) return 00 ; Branch (1283:9): [True: 0, False: 19]
|
1284 | if (PyObject_SetAttr(state->ImportFrom_type, state->module, Py_None) == -1) Branch (1284:9): [True: 0, False: 19]
|
1285 | return 0; |
1286 | if (PyObject_SetAttr(state->ImportFrom_type, state->level, Py_None) == -1) Branch (1286:9): [True: 0, False: 19]
|
1287 | return 0; |
1288 | state->Global_type = make_type(state, "Global", state->stmt_type, |
1289 | Global_fields, 1, |
1290 | "Global(identifier* names)"); |
1291 | if (!state->Global_type) return 00 ; Branch (1291:9): [True: 0, False: 19]
|
1292 | state->Nonlocal_type = make_type(state, "Nonlocal", state->stmt_type, |
1293 | Nonlocal_fields, 1, |
1294 | "Nonlocal(identifier* names)"); |
1295 | if (!state->Nonlocal_type) return 00 ; Branch (1295:9): [True: 0, False: 19]
|
1296 | state->Expr_type = make_type(state, "Expr", state->stmt_type, Expr_fields, |
1297 | 1, |
1298 | "Expr(expr value)"); |
1299 | if (!state->Expr_type) return 00 ; Branch (1299:9): [True: 0, False: 19]
|
1300 | state->Pass_type = make_type(state, "Pass", state->stmt_type, NULL, 0, |
1301 | "Pass"); |
1302 | if (!state->Pass_type) return 00 ; Branch (1302:9): [True: 0, False: 19]
|
1303 | state->Break_type = make_type(state, "Break", state->stmt_type, NULL, 0, |
1304 | "Break"); |
1305 | if (!state->Break_type) return 00 ; Branch (1305:9): [True: 0, False: 19]
|
1306 | state->Continue_type = make_type(state, "Continue", state->stmt_type, NULL, |
1307 | 0, |
1308 | "Continue"); |
1309 | if (!state->Continue_type) return 00 ; Branch (1309:9): [True: 0, False: 19]
|
1310 | state->expr_type = make_type(state, "expr", state->AST_type, NULL, 0, |
1311 | "expr = BoolOp(boolop op, expr* values)\n" |
1312 | " | NamedExpr(expr target, expr value)\n" |
1313 | " | BinOp(expr left, operator op, expr right)\n" |
1314 | " | UnaryOp(unaryop op, expr operand)\n" |
1315 | " | Lambda(arguments args, expr body)\n" |
1316 | " | IfExp(expr test, expr body, expr orelse)\n" |
1317 | " | Dict(expr* keys, expr* values)\n" |
1318 | " | Set(expr* elts)\n" |
1319 | " | ListComp(expr elt, comprehension* generators)\n" |
1320 | " | SetComp(expr elt, comprehension* generators)\n" |
1321 | " | DictComp(expr key, expr value, comprehension* generators)\n" |
1322 | " | GeneratorExp(expr elt, comprehension* generators)\n" |
1323 | " | Await(expr value)\n" |
1324 | " | Yield(expr? value)\n" |
1325 | " | YieldFrom(expr value)\n" |
1326 | " | Compare(expr left, cmpop* ops, expr* comparators)\n" |
1327 | " | Call(expr func, expr* args, keyword* keywords)\n" |
1328 | " | FormattedValue(expr value, int conversion, expr? format_spec)\n" |
1329 | " | JoinedStr(expr* values)\n" |
1330 | " | Constant(constant value, string? kind)\n" |
1331 | " | Attribute(expr value, identifier attr, expr_context ctx)\n" |
1332 | " | Subscript(expr value, expr slice, expr_context ctx)\n" |
1333 | " | Starred(expr value, expr_context ctx)\n" |
1334 | " | Name(identifier id, expr_context ctx)\n" |
1335 | " | List(expr* elts, expr_context ctx)\n" |
1336 | " | Tuple(expr* elts, expr_context ctx)\n" |
1337 | " | Slice(expr? lower, expr? upper, expr? step)"); |
1338 | if (!state->expr_type) return 00 ; Branch (1338:9): [True: 0, False: 19]
|
1339 | if (!add_attributes(state, state->expr_type, expr_attributes, 4)) return 00 ; Branch (1339:9): [True: 0, False: 19]
|
1340 | if (PyObject_SetAttr(state->expr_type, state->end_lineno, Py_None) == -1) Branch (1340:9): [True: 0, False: 19]
|
1341 | return 0; |
1342 | if (PyObject_SetAttr(state->expr_type, state->end_col_offset, Py_None) == Branch (1342:9): [True: 0, False: 19]
|
1343 | -1) |
1344 | return 0; |
1345 | state->BoolOp_type = make_type(state, "BoolOp", state->expr_type, |
1346 | BoolOp_fields, 2, |
1347 | "BoolOp(boolop op, expr* values)"); |
1348 | if (!state->BoolOp_type) return 00 ; Branch (1348:9): [True: 0, False: 19]
|
1349 | state->NamedExpr_type = make_type(state, "NamedExpr", state->expr_type, |
1350 | NamedExpr_fields, 2, |
1351 | "NamedExpr(expr target, expr value)"); |
1352 | if (!state->NamedExpr_type) return 00 ; Branch (1352:9): [True: 0, False: 19]
|
1353 | state->BinOp_type = make_type(state, "BinOp", state->expr_type, |
1354 | BinOp_fields, 3, |
1355 | "BinOp(expr left, operator op, expr right)"); |
1356 | if (!state->BinOp_type) return 00 ; Branch (1356:9): [True: 0, False: 19]
|
1357 | state->UnaryOp_type = make_type(state, "UnaryOp", state->expr_type, |
1358 | UnaryOp_fields, 2, |
1359 | "UnaryOp(unaryop op, expr operand)"); |
1360 | if (!state->UnaryOp_type) return 00 ; Branch (1360:9): [True: 0, False: 19]
|
1361 | state->Lambda_type = make_type(state, "Lambda", state->expr_type, |
1362 | Lambda_fields, 2, |
1363 | "Lambda(arguments args, expr body)"); |
1364 | if (!state->Lambda_type) return 00 ; Branch (1364:9): [True: 0, False: 19]
|
1365 | state->IfExp_type = make_type(state, "IfExp", state->expr_type, |
1366 | IfExp_fields, 3, |
1367 | "IfExp(expr test, expr body, expr orelse)"); |
1368 | if (!state->IfExp_type) return 00 ; Branch (1368:9): [True: 0, False: 19]
|
1369 | state->Dict_type = make_type(state, "Dict", state->expr_type, Dict_fields, |
1370 | 2, |
1371 | "Dict(expr* keys, expr* values)"); |
1372 | if (!state->Dict_type) return 00 ; Branch (1372:9): [True: 0, False: 19]
|
1373 | state->Set_type = make_type(state, "Set", state->expr_type, Set_fields, 1, |
1374 | "Set(expr* elts)"); |
1375 | if (!state->Set_type) return 00 ; Branch (1375:9): [True: 0, False: 19]
|
1376 | state->ListComp_type = make_type(state, "ListComp", state->expr_type, |
1377 | ListComp_fields, 2, |
1378 | "ListComp(expr elt, comprehension* generators)"); |
1379 | if (!state->ListComp_type) return 00 ; Branch (1379:9): [True: 0, False: 19]
|
1380 | state->SetComp_type = make_type(state, "SetComp", state->expr_type, |
1381 | SetComp_fields, 2, |
1382 | "SetComp(expr elt, comprehension* generators)"); |
1383 | if (!state->SetComp_type) return 00 ; Branch (1383:9): [True: 0, False: 19]
|
1384 | state->DictComp_type = make_type(state, "DictComp", state->expr_type, |
1385 | DictComp_fields, 3, |
1386 | "DictComp(expr key, expr value, comprehension* generators)"); |
1387 | if (!state->DictComp_type) return 00 ; Branch (1387:9): [True: 0, False: 19]
|
1388 | state->GeneratorExp_type = make_type(state, "GeneratorExp", |
1389 | state->expr_type, GeneratorExp_fields, |
1390 | 2, |
1391 | "GeneratorExp(expr elt, comprehension* generators)"); |
1392 | if (!state->GeneratorExp_type) return 00 ; Branch (1392:9): [True: 0, False: 19]
|
1393 | state->Await_type = make_type(state, "Await", state->expr_type, |
1394 | Await_fields, 1, |
1395 | "Await(expr value)"); |
1396 | if (!state->Await_type) return 00 ; Branch (1396:9): [True: 0, False: 19]
|
1397 | state->Yield_type = make_type(state, "Yield", state->expr_type, |
1398 | Yield_fields, 1, |
1399 | "Yield(expr? value)"); |
1400 | if (!state->Yield_type) return 00 ; Branch (1400:9): [True: 0, False: 19]
|
1401 | if (PyObject_SetAttr(state->Yield_type, state->value, Py_None) == -1) Branch (1401:9): [True: 0, False: 19]
|
1402 | return 0; |
1403 | state->YieldFrom_type = make_type(state, "YieldFrom", state->expr_type, |
1404 | YieldFrom_fields, 1, |
1405 | "YieldFrom(expr value)"); |
1406 | if (!state->YieldFrom_type) return 00 ; Branch (1406:9): [True: 0, False: 19]
|
1407 | state->Compare_type = make_type(state, "Compare", state->expr_type, |
1408 | Compare_fields, 3, |
1409 | "Compare(expr left, cmpop* ops, expr* comparators)"); |
1410 | if (!state->Compare_type) return 00 ; Branch (1410:9): [True: 0, False: 19]
|
1411 | state->Call_type = make_type(state, "Call", state->expr_type, Call_fields, |
1412 | 3, |
1413 | "Call(expr func, expr* args, keyword* keywords)"); |
1414 | if (!state->Call_type) return 00 ; Branch (1414:9): [True: 0, False: 19]
|
1415 | state->FormattedValue_type = make_type(state, "FormattedValue", |
1416 | state->expr_type, |
1417 | FormattedValue_fields, 3, |
1418 | "FormattedValue(expr value, int conversion, expr? format_spec)"); |
1419 | if (!state->FormattedValue_type) return 00 ; Branch (1419:9): [True: 0, False: 19]
|
1420 | if (PyObject_SetAttr(state->FormattedValue_type, state->format_spec, Branch (1420:9): [True: 0, False: 19]
|
1421 | Py_None) == -1) |
1422 | return 0; |
1423 | state->JoinedStr_type = make_type(state, "JoinedStr", state->expr_type, |
1424 | JoinedStr_fields, 1, |
1425 | "JoinedStr(expr* values)"); |
1426 | if (!state->JoinedStr_type) return 00 ; Branch (1426:9): [True: 0, False: 19]
|
1427 | state->Constant_type = make_type(state, "Constant", state->expr_type, |
1428 | Constant_fields, 2, |
1429 | "Constant(constant value, string? kind)"); |
1430 | if (!state->Constant_type) return 00 ; Branch (1430:9): [True: 0, False: 19]
|
1431 | if (PyObject_SetAttr(state->Constant_type, state->kind, Py_None) == -1) Branch (1431:9): [True: 0, False: 19]
|
1432 | return 0; |
1433 | state->Attribute_type = make_type(state, "Attribute", state->expr_type, |
1434 | Attribute_fields, 3, |
1435 | "Attribute(expr value, identifier attr, expr_context ctx)"); |
1436 | if (!state->Attribute_type) return 00 ; Branch (1436:9): [True: 0, False: 19]
|
1437 | state->Subscript_type = make_type(state, "Subscript", state->expr_type, |
1438 | Subscript_fields, 3, |
1439 | "Subscript(expr value, expr slice, expr_context ctx)"); |
1440 | if (!state->Subscript_type) return 00 ; Branch (1440:9): [True: 0, False: 19]
|
1441 | state->Starred_type = make_type(state, "Starred", state->expr_type, |
1442 | Starred_fields, 2, |
1443 | "Starred(expr value, expr_context ctx)"); |
1444 | if (!state->Starred_type) return 00 ; Branch (1444:9): [True: 0, False: 19]
|
1445 | state->Name_type = make_type(state, "Name", state->expr_type, Name_fields, |
1446 | 2, |
1447 | "Name(identifier id, expr_context ctx)"); |
1448 | if (!state->Name_type) return 00 ; Branch (1448:9): [True: 0, False: 19]
|
1449 | state->List_type = make_type(state, "List", state->expr_type, List_fields, |
1450 | 2, |
1451 | "List(expr* elts, expr_context ctx)"); |
1452 | if (!state->List_type) return 00 ; Branch (1452:9): [True: 0, False: 19]
|
1453 | state->Tuple_type = make_type(state, "Tuple", state->expr_type, |
1454 | Tuple_fields, 2, |
1455 | "Tuple(expr* elts, expr_context ctx)"); |
1456 | if (!state->Tuple_type) return 00 ; Branch (1456:9): [True: 0, False: 19]
|
1457 | state->Slice_type = make_type(state, "Slice", state->expr_type, |
1458 | Slice_fields, 3, |
1459 | "Slice(expr? lower, expr? upper, expr? step)"); |
1460 | if (!state->Slice_type) return 00 ; Branch (1460:9): [True: 0, False: 19]
|
1461 | if (PyObject_SetAttr(state->Slice_type, state->lower, Py_None) == -1) Branch (1461:9): [True: 0, False: 19]
|
1462 | return 0; |
1463 | if (PyObject_SetAttr(state->Slice_type, state->upper, Py_None) == -1) Branch (1463:9): [True: 0, False: 19]
|
1464 | return 0; |
1465 | if (PyObject_SetAttr(state->Slice_type, state->step, Py_None) == -1) Branch (1465:9): [True: 0, False: 19]
|
1466 | return 0; |
1467 | state->expr_context_type = make_type(state, "expr_context", |
1468 | state->AST_type, NULL, 0, |
1469 | "expr_context = Load | Store | Del"); |
1470 | if (!state->expr_context_type) return 00 ; Branch (1470:9): [True: 0, False: 19]
|
1471 | if (!add_attributes(state, state->expr_context_type, NULL, 0)) return 00 ; Branch (1471:9): [True: 0, False: 19]
|
1472 | state->Load_type = make_type(state, "Load", state->expr_context_type, NULL, |
1473 | 0, |
1474 | "Load"); |
1475 | if (!state->Load_type) return 00 ; Branch (1475:9): [True: 0, False: 19]
|
1476 | state->Load_singleton = PyType_GenericNew((PyTypeObject *)state->Load_type, |
1477 | NULL, NULL); |
1478 | if (!state->Load_singleton) return 00 ; Branch (1478:9): [True: 0, False: 19]
|
1479 | state->Store_type = make_type(state, "Store", state->expr_context_type, |
1480 | NULL, 0, |
1481 | "Store"); |
1482 | if (!state->Store_type) return 00 ; Branch (1482:9): [True: 0, False: 19]
|
1483 | state->Store_singleton = PyType_GenericNew((PyTypeObject |
1484 | *)state->Store_type, NULL, NULL); |
1485 | if (!state->Store_singleton) return 00 ; Branch (1485:9): [True: 0, False: 19]
|
1486 | state->Del_type = make_type(state, "Del", state->expr_context_type, NULL, 0, |
1487 | "Del"); |
1488 | if (!state->Del_type) return 00 ; Branch (1488:9): [True: 0, False: 19]
|
1489 | state->Del_singleton = PyType_GenericNew((PyTypeObject *)state->Del_type, |
1490 | NULL, NULL); |
1491 | if (!state->Del_singleton) return 00 ; Branch (1491:9): [True: 0, False: 19]
|
1492 | state->boolop_type = make_type(state, "boolop", state->AST_type, NULL, 0, |
1493 | "boolop = And | Or"); |
1494 | if (!state->boolop_type) return 00 ; Branch (1494:9): [True: 0, False: 19]
|
1495 | if (!add_attributes(state, state->boolop_type, NULL, 0)) return 00 ; Branch (1495:9): [True: 0, False: 19]
|
1496 | state->And_type = make_type(state, "And", state->boolop_type, NULL, 0, |
1497 | "And"); |
1498 | if (!state->And_type) return 00 ; Branch (1498:9): [True: 0, False: 19]
|
1499 | state->And_singleton = PyType_GenericNew((PyTypeObject *)state->And_type, |
1500 | NULL, NULL); |
1501 | if (!state->And_singleton) return 00 ; Branch (1501:9): [True: 0, False: 19]
|
1502 | state->Or_type = make_type(state, "Or", state->boolop_type, NULL, 0, |
1503 | "Or"); |
1504 | if (!state->Or_type) return 00 ; Branch (1504:9): [True: 0, False: 19]
|
1505 | state->Or_singleton = PyType_GenericNew((PyTypeObject *)state->Or_type, |
1506 | NULL, NULL); |
1507 | if (!state->Or_singleton) return 00 ; Branch (1507:9): [True: 0, False: 19]
|
1508 | state->operator_type = make_type(state, "operator", state->AST_type, NULL, |
1509 | 0, |
1510 | "operator = Add | Sub | Mult | MatMult | Div | Mod | Pow | LShift | RShift | BitOr | BitXor | BitAnd | FloorDiv"); |
1511 | if (!state->operator_type) return 00 ; Branch (1511:9): [True: 0, False: 19]
|
1512 | if (!add_attributes(state, state->operator_type, NULL, 0)) return 00 ; Branch (1512:9): [True: 0, False: 19]
|
1513 | state->Add_type = make_type(state, "Add", state->operator_type, NULL, 0, |
1514 | "Add"); |
1515 | if (!state->Add_type) return 00 ; Branch (1515:9): [True: 0, False: 19]
|
1516 | state->Add_singleton = PyType_GenericNew((PyTypeObject *)state->Add_type, |
1517 | NULL, NULL); |
1518 | if (!state->Add_singleton) return 00 ; Branch (1518:9): [True: 0, False: 19]
|
1519 | state->Sub_type = make_type(state, "Sub", state->operator_type, NULL, 0, |
1520 | "Sub"); |
1521 | if (!state->Sub_type) return 00 ; Branch (1521:9): [True: 0, False: 19]
|
1522 | state->Sub_singleton = PyType_GenericNew((PyTypeObject *)state->Sub_type, |
1523 | NULL, NULL); |
1524 | if (!state->Sub_singleton) return 00 ; Branch (1524:9): [True: 0, False: 19]
|
1525 | state->Mult_type = make_type(state, "Mult", state->operator_type, NULL, 0, |
1526 | "Mult"); |
1527 | if (!state->Mult_type) return 00 ; Branch (1527:9): [True: 0, False: 19]
|
1528 | state->Mult_singleton = PyType_GenericNew((PyTypeObject *)state->Mult_type, |
1529 | NULL, NULL); |
1530 | if (!state->Mult_singleton) return 00 ; Branch (1530:9): [True: 0, False: 19]
|
1531 | state->MatMult_type = make_type(state, "MatMult", state->operator_type, |
1532 | NULL, 0, |
1533 | "MatMult"); |
1534 | if (!state->MatMult_type) return 00 ; Branch (1534:9): [True: 0, False: 19]
|
1535 | state->MatMult_singleton = PyType_GenericNew((PyTypeObject |
1536 | *)state->MatMult_type, NULL, |
1537 | NULL); |
1538 | if (!state->MatMult_singleton) return 00 ; Branch (1538:9): [True: 0, False: 19]
|
1539 | state->Div_type = make_type(state, "Div", state->operator_type, NULL, 0, |
1540 | "Div"); |
1541 | if (!state->Div_type) return 00 ; Branch (1541:9): [True: 0, False: 19]
|
1542 | state->Div_singleton = PyType_GenericNew((PyTypeObject *)state->Div_type, |
1543 | NULL, NULL); |
1544 | if (!state->Div_singleton) return 00 ; Branch (1544:9): [True: 0, False: 19]
|
1545 | state->Mod_type = make_type(state, "Mod", state->operator_type, NULL, 0, |
1546 | "Mod"); |
1547 | if (!state->Mod_type) return 00 ; Branch (1547:9): [True: 0, False: 19]
|
1548 | state->Mod_singleton = PyType_GenericNew((PyTypeObject *)state->Mod_type, |
1549 | NULL, NULL); |
1550 | if (!state->Mod_singleton) return 00 ; Branch (1550:9): [True: 0, False: 19]
|
1551 | state->Pow_type = make_type(state, "Pow", state->operator_type, NULL, 0, |
1552 | "Pow"); |
1553 | if (!state->Pow_type) return 00 ; Branch (1553:9): [True: 0, False: 19]
|
1554 | state->Pow_singleton = PyType_GenericNew((PyTypeObject *)state->Pow_type, |
1555 | NULL, NULL); |
1556 | if (!state->Pow_singleton) return 00 ; Branch (1556:9): [True: 0, False: 19]
|
1557 | state->LShift_type = make_type(state, "LShift", state->operator_type, NULL, |
1558 | 0, |
1559 | "LShift"); |
1560 | if (!state->LShift_type) return 00 ; Branch (1560:9): [True: 0, False: 19]
|
1561 | state->LShift_singleton = PyType_GenericNew((PyTypeObject |
1562 | *)state->LShift_type, NULL, |
1563 | NULL); |
1564 | if (!state->LShift_singleton) return 00 ; Branch (1564:9): [True: 0, False: 19]
|
1565 | state->RShift_type = make_type(state, "RShift", state->operator_type, NULL, |
1566 | 0, |
1567 | "RShift"); |
1568 | if (!state->RShift_type) return 00 ; Branch (1568:9): [True: 0, False: 19]
|
1569 | state->RShift_singleton = PyType_GenericNew((PyTypeObject |
1570 | *)state->RShift_type, NULL, |
1571 | NULL); |
1572 | if (!state->RShift_singleton) return 00 ; Branch (1572:9): [True: 0, False: 19]
|
1573 | state->BitOr_type = make_type(state, "BitOr", state->operator_type, NULL, 0, |
1574 | "BitOr"); |
1575 | if (!state->BitOr_type) return 00 ; Branch (1575:9): [True: 0, False: 19]
|
1576 | state->BitOr_singleton = PyType_GenericNew((PyTypeObject |
1577 | *)state->BitOr_type, NULL, NULL); |
1578 | if (!state->BitOr_singleton) return 00 ; Branch (1578:9): [True: 0, False: 19]
|
1579 | state->BitXor_type = make_type(state, "BitXor", state->operator_type, NULL, |
1580 | 0, |
1581 | "BitXor"); |
1582 | if (!state->BitXor_type) return 00 ; Branch (1582:9): [True: 0, False: 19]
|
1583 | state->BitXor_singleton = PyType_GenericNew((PyTypeObject |
1584 | *)state->BitXor_type, NULL, |
1585 | NULL); |
1586 | if (!state->BitXor_singleton) return 00 ; Branch (1586:9): [True: 0, False: 19]
|
1587 | state->BitAnd_type = make_type(state, "BitAnd", state->operator_type, NULL, |
1588 | 0, |
1589 | "BitAnd"); |
1590 | if (!state->BitAnd_type) return 00 ; Branch (1590:9): [True: 0, False: 19]
|
1591 | state->BitAnd_singleton = PyType_GenericNew((PyTypeObject |
1592 | *)state->BitAnd_type, NULL, |
1593 | NULL); |
1594 | if (!state->BitAnd_singleton) return 00 ; Branch (1594:9): [True: 0, False: 19]
|
1595 | state->FloorDiv_type = make_type(state, "FloorDiv", state->operator_type, |
1596 | NULL, 0, |
1597 | "FloorDiv"); |
1598 | if (!state->FloorDiv_type) return 00 ; Branch (1598:9): [True: 0, False: 19]
|
1599 | state->FloorDiv_singleton = PyType_GenericNew((PyTypeObject |
1600 | *)state->FloorDiv_type, NULL, |
1601 | NULL); |
1602 | if (!state->FloorDiv_singleton) return 00 ; Branch (1602:9): [True: 0, False: 19]
|
1603 | state->unaryop_type = make_type(state, "unaryop", state->AST_type, NULL, 0, |
1604 | "unaryop = Invert | Not | UAdd | USub"); |
1605 | if (!state->unaryop_type) return 00 ; Branch (1605:9): [True: 0, False: 19]
|
1606 | if (!add_attributes(state, state->unaryop_type, NULL, 0)) return 00 ; Branch (1606:9): [True: 0, False: 19]
|
1607 | state->Invert_type = make_type(state, "Invert", state->unaryop_type, NULL, |
1608 | 0, |
1609 | "Invert"); |
1610 | if (!state->Invert_type) return 00 ; Branch (1610:9): [True: 0, False: 19]
|
1611 | state->Invert_singleton = PyType_GenericNew((PyTypeObject |
1612 | *)state->Invert_type, NULL, |
1613 | NULL); |
1614 | if (!state->Invert_singleton) return 00 ; Branch (1614:9): [True: 0, False: 19]
|
1615 | state->Not_type = make_type(state, "Not", state->unaryop_type, NULL, 0, |
1616 | "Not"); |
1617 | if (!state->Not_type) return 00 ; Branch (1617:9): [True: 0, False: 19]
|
1618 | state->Not_singleton = PyType_GenericNew((PyTypeObject *)state->Not_type, |
1619 | NULL, NULL); |
1620 | if (!state->Not_singleton) return 00 ; Branch (1620:9): [True: 0, False: 19]
|
1621 | state->UAdd_type = make_type(state, "UAdd", state->unaryop_type, NULL, 0, |
1622 | "UAdd"); |
1623 | if (!state->UAdd_type) return 00 ; Branch (1623:9): [True: 0, False: 19]
|
1624 | state->UAdd_singleton = PyType_GenericNew((PyTypeObject *)state->UAdd_type, |
1625 | NULL, NULL); |
1626 | if (!state->UAdd_singleton) return 00 ; Branch (1626:9): [True: 0, False: 19]
|
1627 | state->USub_type = make_type(state, "USub", state->unaryop_type, NULL, 0, |
1628 | "USub"); |
1629 | if (!state->USub_type) return 00 ; Branch (1629:9): [True: 0, False: 19]
|
1630 | state->USub_singleton = PyType_GenericNew((PyTypeObject *)state->USub_type, |
1631 | NULL, NULL); |
1632 | if (!state->USub_singleton) return 00 ; Branch (1632:9): [True: 0, False: 19]
|
1633 | state->cmpop_type = make_type(state, "cmpop", state->AST_type, NULL, 0, |
1634 | "cmpop = Eq | NotEq | Lt | LtE | Gt | GtE | Is | IsNot | In | NotIn"); |
1635 | if (!state->cmpop_type) return 00 ; Branch (1635:9): [True: 0, False: 19]
|
1636 | if (!add_attributes(state, state->cmpop_type, NULL, 0)) return 00 ; Branch (1636:9): [True: 0, False: 19]
|
1637 | state->Eq_type = make_type(state, "Eq", state->cmpop_type, NULL, 0, |
1638 | "Eq"); |
1639 | if (!state->Eq_type) return 00 ; Branch (1639:9): [True: 0, False: 19]
|
1640 | state->Eq_singleton = PyType_GenericNew((PyTypeObject *)state->Eq_type, |
1641 | NULL, NULL); |
1642 | if (!state->Eq_singleton) return 00 ; Branch (1642:9): [True: 0, False: 19]
|
1643 | state->NotEq_type = make_type(state, "NotEq", state->cmpop_type, NULL, 0, |
1644 | "NotEq"); |
1645 | if (!state->NotEq_type) return 00 ; Branch (1645:9): [True: 0, False: 19]
|
1646 | state->NotEq_singleton = PyType_GenericNew((PyTypeObject |
1647 | *)state->NotEq_type, NULL, NULL); |
1648 | if (!state->NotEq_singleton) return 00 ; Branch (1648:9): [True: 0, False: 19]
|
1649 | state->Lt_type = make_type(state, "Lt", state->cmpop_type, NULL, 0, |
1650 | "Lt"); |
1651 | if (!state->Lt_type) return 00 ; Branch (1651:9): [True: 0, False: 19]
|
1652 | state->Lt_singleton = PyType_GenericNew((PyTypeObject *)state->Lt_type, |
1653 | NULL, NULL); |
1654 | if (!state->Lt_singleton) return 00 ; Branch (1654:9): [True: 0, False: 19]
|
1655 | state->LtE_type = make_type(state, "LtE", state->cmpop_type, NULL, 0, |
1656 | "LtE"); |
1657 | if (!state->LtE_type) return 00 ; Branch (1657:9): [True: 0, False: 19]
|
1658 | state->LtE_singleton = PyType_GenericNew((PyTypeObject *)state->LtE_type, |
1659 | NULL, NULL); |
1660 | if (!state->LtE_singleton) return 00 ; Branch (1660:9): [True: 0, False: 19]
|
1661 | state->Gt_type = make_type(state, "Gt", state->cmpop_type, NULL, 0, |
1662 | "Gt"); |
1663 | if (!state->Gt_type) return 00 ; Branch (1663:9): [True: 0, False: 19]
|
1664 | state->Gt_singleton = PyType_GenericNew((PyTypeObject *)state->Gt_type, |
1665 | NULL, NULL); |
1666 | if (!state->Gt_singleton) return 00 ; Branch (1666:9): [True: 0, False: 19]
|
1667 | state->GtE_type = make_type(state, "GtE", state->cmpop_type, NULL, 0, |
1668 | "GtE"); |
1669 | if (!state->GtE_type) return 00 ; Branch (1669:9): [True: 0, False: 19]
|
1670 | state->GtE_singleton = PyType_GenericNew((PyTypeObject *)state->GtE_type, |
1671 | NULL, NULL); |
1672 | if (!state->GtE_singleton) return 00 ; Branch (1672:9): [True: 0, False: 19]
|
1673 | state->Is_type = make_type(state, "Is", state->cmpop_type, NULL, 0, |
1674 | "Is"); |
1675 | if (!state->Is_type) return 00 ; Branch (1675:9): [True: 0, False: 19]
|
1676 | state->Is_singleton = PyType_GenericNew((PyTypeObject *)state->Is_type, |
1677 | NULL, NULL); |
1678 | if (!state->Is_singleton) return 00 ; Branch (1678:9): [True: 0, False: 19]
|
1679 | state->IsNot_type = make_type(state, "IsNot", state->cmpop_type, NULL, 0, |
1680 | "IsNot"); |
1681 | if (!state->IsNot_type) return 00 ; Branch (1681:9): [True: 0, False: 19]
|
1682 | state->IsNot_singleton = PyType_GenericNew((PyTypeObject |
1683 | *)state->IsNot_type, NULL, NULL); |
1684 | if (!state->IsNot_singleton) return 00 ; Branch (1684:9): [True: 0, False: 19]
|
1685 | state->In_type = make_type(state, "In", state->cmpop_type, NULL, 0, |
1686 | "In"); |
1687 | if (!state->In_type) return 00 ; Branch (1687:9): [True: 0, False: 19]
|
1688 | state->In_singleton = PyType_GenericNew((PyTypeObject *)state->In_type, |
1689 | NULL, NULL); |
1690 | if (!state->In_singleton) return 00 ; Branch (1690:9): [True: 0, False: 19]
|
1691 | state->NotIn_type = make_type(state, "NotIn", state->cmpop_type, NULL, 0, |
1692 | "NotIn"); |
1693 | if (!state->NotIn_type) return 00 ; Branch (1693:9): [True: 0, False: 19]
|
1694 | state->NotIn_singleton = PyType_GenericNew((PyTypeObject |
1695 | *)state->NotIn_type, NULL, NULL); |
1696 | if (!state->NotIn_singleton) return 00 ; Branch (1696:9): [True: 0, False: 19]
|
1697 | state->comprehension_type = make_type(state, "comprehension", |
1698 | state->AST_type, |
1699 | comprehension_fields, 4, |
1700 | "comprehension(expr target, expr iter, expr* ifs, int is_async)"); |
1701 | if (!state->comprehension_type) return 00 ; Branch (1701:9): [True: 0, False: 19]
|
1702 | if (!add_attributes(state, state->comprehension_type, NULL, 0)) return 00 ; Branch (1702:9): [True: 0, False: 19]
|
1703 | state->excepthandler_type = make_type(state, "excepthandler", |
1704 | state->AST_type, NULL, 0, |
1705 | "excepthandler = ExceptHandler(expr? type, identifier? name, stmt* body)"); |
1706 | if (!state->excepthandler_type) return 00 ; Branch (1706:9): [True: 0, False: 19]
|
1707 | if (!add_attributes(state, state->excepthandler_type, Branch (1707:9): [True: 0, False: 19]
|
1708 | excepthandler_attributes, 4)) return 00 ; |
1709 | if (PyObject_SetAttr(state->excepthandler_type, state->end_lineno, Py_None) Branch (1709:9): [True: 0, False: 19]
|
1710 | == -1) |
1711 | return 0; |
1712 | if (PyObject_SetAttr(state->excepthandler_type, state->end_col_offset, Branch (1712:9): [True: 0, False: 19]
|
1713 | Py_None) == -1) |
1714 | return 0; |
1715 | state->ExceptHandler_type = make_type(state, "ExceptHandler", |
1716 | state->excepthandler_type, |
1717 | ExceptHandler_fields, 3, |
1718 | "ExceptHandler(expr? type, identifier? name, stmt* body)"); |
1719 | if (!state->ExceptHandler_type) return 00 ; Branch (1719:9): [True: 0, False: 19]
|
1720 | if (PyObject_SetAttr(state->ExceptHandler_type, state->type, Py_None) == -1) Branch (1720:9): [True: 0, False: 19]
|
1721 | return 0; |
1722 | if (PyObject_SetAttr(state->ExceptHandler_type, state->name, Py_None) == -1) Branch (1722:9): [True: 0, False: 19]
|
1723 | return 0; |
1724 | state->arguments_type = make_type(state, "arguments", state->AST_type, |
1725 | arguments_fields, 7, |
1726 | "arguments(arg* posonlyargs, arg* args, arg? vararg, arg* kwonlyargs, expr* kw_defaults, arg? kwarg, expr* defaults)"); |
1727 | if (!state->arguments_type) return 00 ; Branch (1727:9): [True: 0, False: 19]
|
1728 | if (!add_attributes(state, state->arguments_type, NULL, 0)) return 00 ; Branch (1728:9): [True: 0, False: 19]
|
1729 | if (PyObject_SetAttr(state->arguments_type, state->vararg, Py_None) == -1) Branch (1729:9): [True: 0, False: 19]
|
1730 | return 0; |
1731 | if (PyObject_SetAttr(state->arguments_type, state->kwarg, Py_None) == -1) Branch (1731:9): [True: 0, False: 19]
|
1732 | return 0; |
1733 | state->arg_type = make_type(state, "arg", state->AST_type, arg_fields, 3, |
1734 | "arg(identifier arg, expr? annotation, string? type_comment)"); |
1735 | if (!state->arg_type) return 00 ; Branch (1735:9): [True: 0, False: 19]
|
1736 | if (!add_attributes(state, state->arg_type, arg_attributes, 4)) return 00 ; Branch (1736:9): [True: 0, False: 19]
|
1737 | if (PyObject_SetAttr(state->arg_type, state->annotation, Py_None) == -1) Branch (1737:9): [True: 0, False: 19]
|
1738 | return 0; |
1739 | if (PyObject_SetAttr(state->arg_type, state->type_comment, Py_None) == -1) Branch (1739:9): [True: 0, False: 19]
|
1740 | return 0; |
1741 | if (PyObject_SetAttr(state->arg_type, state->end_lineno, Py_None) == -1) Branch (1741:9): [True: 0, False: 19]
|
1742 | return 0; |
1743 | if (PyObject_SetAttr(state->arg_type, state->end_col_offset, Py_None) == -1) Branch (1743:9): [True: 0, False: 19]
|
1744 | return 0; |
1745 | state->keyword_type = make_type(state, "keyword", state->AST_type, |
1746 | keyword_fields, 2, |
1747 | "keyword(identifier? arg, expr value)"); |
1748 | if (!state->keyword_type) return 00 ; Branch (1748:9): [True: 0, False: 19]
|
1749 | if (!add_attributes(state, state->keyword_type, keyword_attributes, 4)) Branch (1749:9): [True: 0, False: 19]
|
1750 | return 0; |
1751 | if (PyObject_SetAttr(state->keyword_type, state->arg, Py_None) == -1) Branch (1751:9): [True: 0, False: 19]
|
1752 | return 0; |
1753 | if (PyObject_SetAttr(state->keyword_type, state->end_lineno, Py_None) == -1) Branch (1753:9): [True: 0, False: 19]
|
1754 | return 0; |
1755 | if (PyObject_SetAttr(state->keyword_type, state->end_col_offset, Py_None) Branch (1755:9): [True: 0, False: 19]
|
1756 | == -1) |
1757 | return 0; |
1758 | state->alias_type = make_type(state, "alias", state->AST_type, |
1759 | alias_fields, 2, |
1760 | "alias(identifier name, identifier? asname)"); |
1761 | if (!state->alias_type) return 00 ; Branch (1761:9): [True: 0, False: 19]
|
1762 | if (!add_attributes(state, state->alias_type, alias_attributes, 4)) return Branch (1762:9): [True: 0, False: 19]
|
1763 | 0; |
1764 | if (PyObject_SetAttr(state->alias_type, state->asname, Py_None) == -1) Branch (1764:9): [True: 0, False: 19]
|
1765 | return 0; |
1766 | if (PyObject_SetAttr(state->alias_type, state->end_lineno, Py_None) == -1) Branch (1766:9): [True: 0, False: 19]
|
1767 | return 0; |
1768 | if (PyObject_SetAttr(state->alias_type, state->end_col_offset, Py_None) == Branch (1768:9): [True: 0, False: 19]
|
1769 | -1) |
1770 | return 0; |
1771 | state->withitem_type = make_type(state, "withitem", state->AST_type, |
1772 | withitem_fields, 2, |
1773 | "withitem(expr context_expr, expr? optional_vars)"); |
1774 | if (!state->withitem_type) return 00 ; Branch (1774:9): [True: 0, False: 19]
|
1775 | if (!add_attributes(state, state->withitem_type, NULL, 0)) return 00 ; Branch (1775:9): [True: 0, False: 19]
|
1776 | if (PyObject_SetAttr(state->withitem_type, state->optional_vars, Py_None) Branch (1776:9): [True: 0, False: 19]
|
1777 | == -1) |
1778 | return 0; |
1779 | state->match_case_type = make_type(state, "match_case", state->AST_type, |
1780 | match_case_fields, 3, |
1781 | "match_case(pattern pattern, expr? guard, stmt* body)"); |
1782 | if (!state->match_case_type) return 00 ; Branch (1782:9): [True: 0, False: 19]
|
1783 | if (!add_attributes(state, state->match_case_type, NULL, 0)) return 00 ; Branch (1783:9): [True: 0, False: 19]
|
1784 | if (PyObject_SetAttr(state->match_case_type, state->guard, Py_None) == -1) Branch (1784:9): [True: 0, False: 19]
|
1785 | return 0; |
1786 | state->pattern_type = make_type(state, "pattern", state->AST_type, NULL, 0, |
1787 | "pattern = MatchValue(expr value)\n" |
1788 | " | MatchSingleton(constant value)\n" |
1789 | " | MatchSequence(pattern* patterns)\n" |
1790 | " | MatchMapping(expr* keys, pattern* patterns, identifier? rest)\n" |
1791 | " | MatchClass(expr cls, pattern* patterns, identifier* kwd_attrs, pattern* kwd_patterns)\n" |
1792 | " | MatchStar(identifier? name)\n" |
1793 | " | MatchAs(pattern? pattern, identifier? name)\n" |
1794 | " | MatchOr(pattern* patterns)"); |
1795 | if (!state->pattern_type) return 00 ; Branch (1795:9): [True: 0, False: 19]
|
1796 | if (!add_attributes(state, state->pattern_type, pattern_attributes, 4)) Branch (1796:9): [True: 0, False: 19]
|
1797 | return 0; |
1798 | state->MatchValue_type = make_type(state, "MatchValue", |
1799 | state->pattern_type, MatchValue_fields, |
1800 | 1, |
1801 | "MatchValue(expr value)"); |
1802 | if (!state->MatchValue_type) return 00 ; Branch (1802:9): [True: 0, False: 19]
|
1803 | state->MatchSingleton_type = make_type(state, "MatchSingleton", |
1804 | state->pattern_type, |
1805 | MatchSingleton_fields, 1, |
1806 | "MatchSingleton(constant value)"); |
1807 | if (!state->MatchSingleton_type) return 00 ; Branch (1807:9): [True: 0, False: 19]
|
1808 | state->MatchSequence_type = make_type(state, "MatchSequence", |
1809 | state->pattern_type, |
1810 | MatchSequence_fields, 1, |
1811 | "MatchSequence(pattern* patterns)"); |
1812 | if (!state->MatchSequence_type) return 00 ; Branch (1812:9): [True: 0, False: 19]
|
1813 | state->MatchMapping_type = make_type(state, "MatchMapping", |
1814 | state->pattern_type, |
1815 | MatchMapping_fields, 3, |
1816 | "MatchMapping(expr* keys, pattern* patterns, identifier? rest)"); |
1817 | if (!state->MatchMapping_type) return 00 ; Branch (1817:9): [True: 0, False: 19]
|
1818 | if (PyObject_SetAttr(state->MatchMapping_type, state->rest, Py_None) == -1) Branch (1818:9): [True: 0, False: 19]
|
1819 | return 0; |
1820 | state->MatchClass_type = make_type(state, "MatchClass", |
1821 | state->pattern_type, MatchClass_fields, |
1822 | 4, |
1823 | "MatchClass(expr cls, pattern* patterns, identifier* kwd_attrs, pattern* kwd_patterns)"); |
1824 | if (!state->MatchClass_type) return 00 ; Branch (1824:9): [True: 0, False: 19]
|
1825 | state->MatchStar_type = make_type(state, "MatchStar", state->pattern_type, |
1826 | MatchStar_fields, 1, |
1827 | "MatchStar(identifier? name)"); |
1828 | if (!state->MatchStar_type) return 00 ; Branch (1828:9): [True: 0, False: 19]
|
1829 | if (PyObject_SetAttr(state->MatchStar_type, state->name, Py_None) == -1) Branch (1829:9): [True: 0, False: 19]
|
1830 | return 0; |
1831 | state->MatchAs_type = make_type(state, "MatchAs", state->pattern_type, |
1832 | MatchAs_fields, 2, |
1833 | "MatchAs(pattern? pattern, identifier? name)"); |
1834 | if (!state->MatchAs_type) return 00 ; Branch (1834:9): [True: 0, False: 19]
|
1835 | if (PyObject_SetAttr(state->MatchAs_type, state->pattern, Py_None) == -1) Branch (1835:9): [True: 0, False: 19]
|
1836 | return 0; |
1837 | if (PyObject_SetAttr(state->MatchAs_type, state->name, Py_None) == -1) Branch (1837:9): [True: 0, False: 19]
|
1838 | return 0; |
1839 | state->MatchOr_type = make_type(state, "MatchOr", state->pattern_type, |
1840 | MatchOr_fields, 1, |
1841 | "MatchOr(pattern* patterns)"); |
1842 | if (!state->MatchOr_type) return 00 ; Branch (1842:9): [True: 0, False: 19]
|
1843 | state->type_ignore_type = make_type(state, "type_ignore", state->AST_type, |
1844 | NULL, 0, |
1845 | "type_ignore = TypeIgnore(int lineno, string tag)"); |
1846 | if (!state->type_ignore_type) return 00 ; Branch (1846:9): [True: 0, False: 19]
|
1847 | if (!add_attributes(state, state->type_ignore_type, NULL, 0)) return 00 ; Branch (1847:9): [True: 0, False: 19]
|
1848 | state->TypeIgnore_type = make_type(state, "TypeIgnore", |
1849 | state->type_ignore_type, |
1850 | TypeIgnore_fields, 2, |
1851 | "TypeIgnore(int lineno, string tag)"); |
1852 | if (!state->TypeIgnore_type) return 00 ; Branch (1852:9): [True: 0, False: 19]
|
1853 | |
1854 | state->initialized = 1; |
1855 | return 1; |
1856 | } |
1857 | |
1858 | static int obj2ast_mod(struct ast_state *state, PyObject* obj, mod_ty* out, |
1859 | PyArena* arena); |
1860 | static int obj2ast_stmt(struct ast_state *state, PyObject* obj, stmt_ty* out, |
1861 | PyArena* arena); |
1862 | static int obj2ast_expr(struct ast_state *state, PyObject* obj, expr_ty* out, |
1863 | PyArena* arena); |
1864 | static int obj2ast_expr_context(struct ast_state *state, PyObject* obj, |
1865 | expr_context_ty* out, PyArena* arena); |
1866 | static int obj2ast_boolop(struct ast_state *state, PyObject* obj, boolop_ty* |
1867 | out, PyArena* arena); |
1868 | static int obj2ast_operator(struct ast_state *state, PyObject* obj, |
1869 | operator_ty* out, PyArena* arena); |
1870 | static int obj2ast_unaryop(struct ast_state *state, PyObject* obj, unaryop_ty* |
1871 | out, PyArena* arena); |
1872 | static int obj2ast_cmpop(struct ast_state *state, PyObject* obj, cmpop_ty* out, |
1873 | PyArena* arena); |
1874 | static int obj2ast_comprehension(struct ast_state *state, PyObject* obj, |
1875 | comprehension_ty* out, PyArena* arena); |
1876 | static int obj2ast_excepthandler(struct ast_state *state, PyObject* obj, |
1877 | excepthandler_ty* out, PyArena* arena); |
1878 | static int obj2ast_arguments(struct ast_state *state, PyObject* obj, |
1879 | arguments_ty* out, PyArena* arena); |
1880 | static int obj2ast_arg(struct ast_state *state, PyObject* obj, arg_ty* out, |
1881 | PyArena* arena); |
1882 | static int obj2ast_keyword(struct ast_state *state, PyObject* obj, keyword_ty* |
1883 | out, PyArena* arena); |
1884 | static int obj2ast_alias(struct ast_state *state, PyObject* obj, alias_ty* out, |
1885 | PyArena* arena); |
1886 | static int obj2ast_withitem(struct ast_state *state, PyObject* obj, |
1887 | withitem_ty* out, PyArena* arena); |
1888 | static int obj2ast_match_case(struct ast_state *state, PyObject* obj, |
1889 | match_case_ty* out, PyArena* arena); |
1890 | static int obj2ast_pattern(struct ast_state *state, PyObject* obj, pattern_ty* |
1891 | out, PyArena* arena); |
1892 | static int obj2ast_type_ignore(struct ast_state *state, PyObject* obj, |
1893 | type_ignore_ty* out, PyArena* arena); |
1894 | |
1895 | mod_ty |
1896 | _PyAST_Module(asdl_stmt_seq * body, asdl_type_ignore_seq * type_ignores, |
1897 | PyArena *arena) |
1898 | { |
1899 | mod_ty p; |
1900 | p = (mod_ty)_PyArena_Malloc(arena, sizeof(*p)); |
1901 | if (!p) Branch (1901:9): [True: 0, False: 17.4k]
|
1902 | return NULL; |
1903 | p->kind = Module_kind; |
1904 | p->v.Module.body = body; |
1905 | p->v.Module.type_ignores = type_ignores; |
1906 | return p; |
1907 | } |
1908 | |
1909 | mod_ty |
1910 | _PyAST_Interactive(asdl_stmt_seq * body, PyArena *arena) |
1911 | { |
1912 | mod_ty p; |
1913 | p = (mod_ty)_PyArena_Malloc(arena, sizeof(*p)); |
1914 | if (!p) Branch (1914:9): [True: 0, False: 4.11k]
|
1915 | return NULL; |
1916 | p->kind = Interactive_kind; |
1917 | p->v.Interactive.body = body; |
1918 | return p; |
1919 | } |
1920 | |
1921 | mod_ty |
1922 | _PyAST_Expression(expr_ty body, PyArena *arena) |
1923 | { |
1924 | mod_ty p; |
1925 | if (!body) { Branch (1925:9): [True: 0, False: 36.5k]
|
1926 | PyErr_SetString(PyExc_ValueError, |
1927 | "field 'body' is required for Expression"); |
1928 | return NULL; |
1929 | } |
1930 | p = (mod_ty)_PyArena_Malloc(arena, sizeof(*p)); |
1931 | if (!p) Branch (1931:9): [True: 0, False: 36.5k]
|
1932 | return NULL; |
1933 | p->kind = Expression_kind; |
1934 | p->v.Expression.body = body; |
1935 | return p; |
1936 | } |
1937 | |
1938 | mod_ty |
1939 | _PyAST_FunctionType(asdl_expr_seq * argtypes, expr_ty returns, PyArena *arena) |
1940 | { |
1941 | mod_ty p; |
1942 | if (!returns) { Branch (1942:9): [True: 0, False: 12]
|
1943 | PyErr_SetString(PyExc_ValueError, |
1944 | "field 'returns' is required for FunctionType"); |
1945 | return NULL; |
1946 | } |
1947 | p = (mod_ty)_PyArena_Malloc(arena, sizeof(*p)); |
1948 | if (!p) Branch (1948:9): [True: 0, False: 12]
|
1949 | return NULL; |
1950 | p->kind = FunctionType_kind; |
1951 | p->v.FunctionType.argtypes = argtypes; |
1952 | p->v.FunctionType.returns = returns; |
1953 | return p; |
1954 | } |
1955 | |
1956 | stmt_ty |
1957 | _PyAST_FunctionDef(identifier name, arguments_ty args, asdl_stmt_seq * body, |
1958 | asdl_expr_seq * decorator_list, expr_ty returns, string |
1959 | type_comment, int lineno, int col_offset, int end_lineno, |
1960 | int end_col_offset, PyArena *arena) |
1961 | { |
1962 | stmt_ty p; |
1963 | if (!name) { Branch (1963:9): [True: 0, False: 41.8k]
|
1964 | PyErr_SetString(PyExc_ValueError, |
1965 | "field 'name' is required for FunctionDef"); |
1966 | return NULL; |
1967 | } |
1968 | if (!args) { Branch (1968:9): [True: 0, False: 41.8k]
|
1969 | PyErr_SetString(PyExc_ValueError, |
1970 | "field 'args' is required for FunctionDef"); |
1971 | return NULL; |
1972 | } |
1973 | p = (stmt_ty)_PyArena_Malloc(arena, sizeof(*p)); |
1974 | if (!p) Branch (1974:9): [True: 0, False: 41.8k]
|
1975 | return NULL; |
1976 | p->kind = FunctionDef_kind; |
1977 | p->v.FunctionDef.name = name; |
1978 | p->v.FunctionDef.args = args; |
1979 | p->v.FunctionDef.body = body; |
1980 | p->v.FunctionDef.decorator_list = decorator_list; |
1981 | p->v.FunctionDef.returns = returns; |
1982 | p->v.FunctionDef.type_comment = type_comment; |
1983 | p->lineno = lineno; |
1984 | p->col_offset = col_offset; |
1985 | p->end_lineno = end_lineno; |
1986 | p->end_col_offset = end_col_offset; |
1987 | return p; |
1988 | } |
1989 | |
1990 | stmt_ty |
1991 | _PyAST_AsyncFunctionDef(identifier name, arguments_ty args, asdl_stmt_seq * |
1992 | body, asdl_expr_seq * decorator_list, expr_ty returns, |
1993 | string type_comment, int lineno, int col_offset, int |
1994 | end_lineno, int end_col_offset, PyArena *arena) |
1995 | { |
1996 | stmt_ty p; |
1997 | if (!name) { Branch (1997:9): [True: 0, False: 724]
|
1998 | PyErr_SetString(PyExc_ValueError, |
1999 | "field 'name' is required for AsyncFunctionDef"); |
2000 | return NULL; |
2001 | } |
2002 | if (!args) { Branch (2002:9): [True: 0, False: 724]
|
2003 | PyErr_SetString(PyExc_ValueError, |
2004 | "field 'args' is required for AsyncFunctionDef"); |
2005 | return NULL; |
2006 | } |
2007 | p = (stmt_ty)_PyArena_Malloc(arena, sizeof(*p)); |
2008 | if (!p) Branch (2008:9): [True: 0, False: 724]
|
2009 | return NULL; |
2010 | p->kind = AsyncFunctionDef_kind; |
2011 | p->v.AsyncFunctionDef.name = name; |
2012 | p->v.AsyncFunctionDef.args = args; |
2013 | p->v.AsyncFunctionDef.body = body; |
2014 | p->v.AsyncFunctionDef.decorator_list = decorator_list; |
2015 | p->v.AsyncFunctionDef.returns = returns; |
2016 | p->v.AsyncFunctionDef.type_comment = type_comment; |
2017 | p->lineno = lineno; |
2018 | p->col_offset = col_offset; |
2019 | p->end_lineno = end_lineno; |
2020 | p->end_col_offset = end_col_offset; |
2021 | return p; |
2022 | } |
2023 | |
2024 | stmt_ty |
2025 | _PyAST_ClassDef(identifier name, asdl_expr_seq * bases, asdl_keyword_seq * |
2026 | keywords, asdl_stmt_seq * body, asdl_expr_seq * decorator_list, |
2027 | int lineno, int col_offset, int end_lineno, int end_col_offset, |
2028 | PyArena *arena) |
2029 | { |
2030 | stmt_ty p; |
2031 | if (!name) { Branch (2031:9): [True: 0, False: 5.52k]
|
2032 | PyErr_SetString(PyExc_ValueError, |
2033 | "field 'name' is required for ClassDef"); |
2034 | return NULL; |
2035 | } |
2036 | p = (stmt_ty)_PyArena_Malloc(arena, sizeof(*p)); |
2037 | if (!p) Branch (2037:9): [True: 0, False: 5.52k]
|
2038 | return NULL; |
2039 | p->kind = ClassDef_kind; |
2040 | p->v.ClassDef.name = name; |
2041 | p->v.ClassDef.bases = bases; |
2042 | p->v.ClassDef.keywords = keywords; |
2043 | p->v.ClassDef.body = body; |
2044 | p->v.ClassDef.decorator_list = decorator_list; |
2045 | p->lineno = lineno; |
2046 | p->col_offset = col_offset; |
2047 | p->end_lineno = end_lineno; |
2048 | p->end_col_offset = end_col_offset; |
2049 | return p; |
2050 | } |
2051 | |
2052 | stmt_ty |
2053 | _PyAST_Return(expr_ty value, int lineno, int col_offset, int end_lineno, int |
2054 | end_col_offset, PyArena *arena) |
2055 | { |
2056 | stmt_ty p; |
2057 | p = (stmt_ty)_PyArena_Malloc(arena, sizeof(*p)); |
2058 | if (!p) Branch (2058:9): [True: 0, False: 28.0k]
|
2059 | return NULL; |
2060 | p->kind = Return_kind; |
2061 | p->v.Return.value = value; |
2062 | p->lineno = lineno; |
2063 | p->col_offset = col_offset; |
2064 | p->end_lineno = end_lineno; |
2065 | p->end_col_offset = end_col_offset; |
2066 | return p; |
2067 | } |
2068 | |
2069 | stmt_ty |
2070 | _PyAST_Delete(asdl_expr_seq * targets, int lineno, int col_offset, int |
2071 | end_lineno, int end_col_offset, PyArena *arena) |
2072 | { |
2073 | stmt_ty p; |
2074 | p = (stmt_ty)_PyArena_Malloc(arena, sizeof(*p)); |
2075 | if (!p) Branch (2075:9): [True: 0, False: 971]
|
2076 | return NULL; |
2077 | p->kind = Delete_kind; |
2078 | p->v.Delete.targets = targets; |
2079 | p->lineno = lineno; |
2080 | p->col_offset = col_offset; |
2081 | p->end_lineno = end_lineno; |
2082 | p->end_col_offset = end_col_offset; |
2083 | return p; |
2084 | } |
2085 | |
2086 | stmt_ty |
2087 | _PyAST_Assign(asdl_expr_seq * targets, expr_ty value, string type_comment, int |
2088 | lineno, int col_offset, int end_lineno, int end_col_offset, |
2089 | PyArena *arena) |
2090 | { |
2091 | stmt_ty p; |
2092 | if (!value) { Branch (2092:9): [True: 0, False: 105k]
|
2093 | PyErr_SetString(PyExc_ValueError, |
2094 | "field 'value' is required for Assign"); |
2095 | return NULL; |
2096 | } |
2097 | p = (stmt_ty)_PyArena_Malloc(arena, sizeof(*p)); |
2098 | if (!p) Branch (2098:9): [True: 0, False: 105k]
|
2099 | return NULL; |
2100 | p->kind = Assign_kind; |
2101 | p->v.Assign.targets = targets; |
2102 | p->v.Assign.value = value; |
2103 | p->v.Assign.type_comment = type_comment; |
2104 | p->lineno = lineno; |
2105 | p->col_offset = col_offset; |
2106 | p->end_lineno = end_lineno; |
2107 | p->end_col_offset = end_col_offset; |
2108 | return p; |
2109 | } |
2110 | |
2111 | stmt_ty |
2112 | _PyAST_AugAssign(expr_ty target, operator_ty op, expr_ty value, int lineno, int |
2113 | col_offset, int end_lineno, int end_col_offset, PyArena *arena) |
2114 | { |
2115 | stmt_ty p; |
2116 | if (!target) { Branch (2116:9): [True: 0, False: 3.01k]
|
2117 | PyErr_SetString(PyExc_ValueError, |
2118 | "field 'target' is required for AugAssign"); |
2119 | return NULL; |
2120 | } |
2121 | if (!op) { Branch (2121:9): [True: 0, False: 3.01k]
|
2122 | PyErr_SetString(PyExc_ValueError, |
2123 | "field 'op' is required for AugAssign"); |
2124 | return NULL; |
2125 | } |
2126 | if (!value) { Branch (2126:9): [True: 0, False: 3.01k]
|
2127 | PyErr_SetString(PyExc_ValueError, |
2128 | "field 'value' is required for AugAssign"); |
2129 | return NULL; |
2130 | } |
2131 | p = (stmt_ty)_PyArena_Malloc(arena, sizeof(*p)); |
2132 | if (!p) Branch (2132:9): [True: 0, False: 3.01k]
|
2133 | return NULL; |
2134 | p->kind = AugAssign_kind; |
2135 | p->v.AugAssign.target = target; |
2136 | p->v.AugAssign.op = op; |
2137 | p->v.AugAssign.value = value; |
2138 | p->lineno = lineno; |
2139 | p->col_offset = col_offset; |
2140 | p->end_lineno = end_lineno; |
2141 | p->end_col_offset = end_col_offset; |
2142 | return p; |
2143 | } |
2144 | |
2145 | stmt_ty |
2146 | _PyAST_AnnAssign(expr_ty target, expr_ty annotation, expr_ty value, int simple, |
2147 | int lineno, int col_offset, int end_lineno, int |
2148 | end_col_offset, PyArena *arena) |
2149 | { |
2150 | stmt_ty p; |
2151 | if (!target) { Branch (2151:9): [True: 0, False: 1.08k]
|
2152 | PyErr_SetString(PyExc_ValueError, |
2153 | "field 'target' is required for AnnAssign"); |
2154 | return NULL; |
2155 | } |
2156 | if (!annotation) { Branch (2156:9): [True: 0, False: 1.08k]
|
2157 | PyErr_SetString(PyExc_ValueError, |
2158 | "field 'annotation' is required for AnnAssign"); |
2159 | return NULL; |
2160 | } |
2161 | p = (stmt_ty)_PyArena_Malloc(arena, sizeof(*p)); |
2162 | if (!p) Branch (2162:9): [True: 0, False: 1.08k]
|
2163 | return NULL; |
2164 | p->kind = AnnAssign_kind; |
2165 | p->v.AnnAssign.target = target; |
2166 | p->v.AnnAssign.annotation = annotation; |
2167 | p->v.AnnAssign.value = value; |
2168 | p->v.AnnAssign.simple = simple; |
2169 | p->lineno = lineno; |
2170 | p->col_offset = col_offset; |
2171 | p->end_lineno = end_lineno; |
2172 | p->end_col_offset = end_col_offset; |
2173 | return p; |
2174 | } |
2175 | |
2176 | stmt_ty |
2177 | _PyAST_For(expr_ty target, expr_ty iter, asdl_stmt_seq * body, asdl_stmt_seq * |
2178 | orelse, string type_comment, int lineno, int col_offset, int |
2179 | end_lineno, int end_col_offset, PyArena *arena) |
2180 | { |
2181 | stmt_ty p; |
2182 | if (!target) { Branch (2182:9): [True: 0, False: 5.66k]
|
2183 | PyErr_SetString(PyExc_ValueError, |
2184 | "field 'target' is required for For"); |
2185 | return NULL; |
2186 | } |
2187 | if (!iter) { Branch (2187:9): [True: 0, False: 5.66k]
|
2188 | PyErr_SetString(PyExc_ValueError, |
2189 | "field 'iter' is required for For"); |
2190 | return NULL; |
2191 | } |
2192 | p = (stmt_ty)_PyArena_Malloc(arena, sizeof(*p)); |
2193 | if (!p) Branch (2193:9): [True: 0, False: 5.66k]
|
2194 | return NULL; |
2195 | p->kind = For_kind; |
2196 | p->v.For.target = target; |
2197 | p->v.For.iter = iter; |
2198 | p->v.For.body = body; |
2199 | p->v.For.orelse = orelse; |
2200 | p->v.For.type_comment = type_comment; |
2201 | p->lineno = lineno; |
2202 | p->col_offset = col_offset; |
2203 | p->end_lineno = end_lineno; |
2204 | p->end_col_offset = end_col_offset; |
2205 | return p; |
2206 | } |
2207 | |
2208 | stmt_ty |
2209 | _PyAST_AsyncFor(expr_ty target, expr_ty iter, asdl_stmt_seq * body, |
2210 | asdl_stmt_seq * orelse, string type_comment, int lineno, int |
2211 | col_offset, int end_lineno, int end_col_offset, PyArena *arena) |
2212 | { |
2213 | stmt_ty p; |
2214 | if (!target) { Branch (2214:9): [True: 0, False: 76]
|
2215 | PyErr_SetString(PyExc_ValueError, |
2216 | "field 'target' is required for AsyncFor"); |
2217 | return NULL; |
2218 | } |
2219 | if (!iter) { Branch (2219:9): [True: 0, False: 76]
|
2220 | PyErr_SetString(PyExc_ValueError, |
2221 | "field 'iter' is required for AsyncFor"); |
2222 | return NULL; |
2223 | } |
2224 | p = (stmt_ty)_PyArena_Malloc(arena, sizeof(*p)); |
2225 | if (!p) Branch (2225:9): [True: 0, False: 76]
|
2226 | return NULL; |
2227 | p->kind = AsyncFor_kind; |
2228 | p->v.AsyncFor.target = target; |
2229 | p->v.AsyncFor.iter = iter; |
2230 | p->v.AsyncFor.body = body; |
2231 | p->v.AsyncFor.orelse = orelse; |
2232 | p->v.AsyncFor.type_comment = type_comment; |
2233 | p->lineno = lineno; |
2234 | p->col_offset = col_offset; |
2235 | p->end_lineno = end_lineno; |
2236 | p->end_col_offset = end_col_offset; |
2237 | return p; |
2238 | } |
2239 | |
2240 | stmt_ty |
2241 | _PyAST_While(expr_ty test, asdl_stmt_seq * body, asdl_stmt_seq * orelse, int |
2242 | lineno, int col_offset, int end_lineno, int end_col_offset, |
2243 | PyArena *arena) |
2244 | { |
2245 | stmt_ty p; |
2246 | if (!test) { Branch (2246:9): [True: 0, False: 1.50k]
|
2247 | PyErr_SetString(PyExc_ValueError, |
2248 | "field 'test' is required for While"); |
2249 | return NULL; |
2250 | } |
2251 | p = (stmt_ty)_PyArena_Malloc(arena, sizeof(*p)); |
2252 | if (!p) Branch (2252:9): [True: 0, False: 1.50k]
|
2253 | return NULL; |
2254 | p->kind = While_kind; |
2255 | p->v.While.test = test; |
2256 | p->v.While.body = body; |
2257 | p->v.While.orelse = orelse; |
2258 | p->lineno = lineno; |
2259 | p->col_offset = col_offset; |
2260 | p->end_lineno = end_lineno; |
2261 | p->end_col_offset = end_col_offset; |
2262 | return p; |
2263 | } |
2264 | |
2265 | stmt_ty |
2266 | _PyAST_If(expr_ty test, asdl_stmt_seq * body, asdl_stmt_seq * orelse, int |
2267 | lineno, int col_offset, int end_lineno, int end_col_offset, PyArena |
2268 | *arena) |
2269 | { |
2270 | stmt_ty p; |
2271 | if (!test) { Branch (2271:9): [True: 0, False: 237k]
|
2272 | PyErr_SetString(PyExc_ValueError, |
2273 | "field 'test' is required for If"); |
2274 | return NULL; |
2275 | } |
2276 | p = (stmt_ty)_PyArena_Malloc(arena, sizeof(*p)); |
2277 | if (!p) Branch (2277:9): [True: 0, False: 237k]
|
2278 | return NULL; |
2279 | p->kind = If_kind; |
2280 | p->v.If.test = test; |
2281 | p->v.If.body = body; |
2282 | p->v.If.orelse = orelse; |
2283 | p->lineno = lineno; |
2284 | p->col_offset = col_offset; |
2285 | p->end_lineno = end_lineno; |
2286 | p->end_col_offset = end_col_offset; |
2287 | return p; |
2288 | } |
2289 | |
2290 | stmt_ty |
2291 | _PyAST_With(asdl_withitem_seq * items, asdl_stmt_seq * body, string |
2292 | type_comment, int lineno, int col_offset, int end_lineno, int |
2293 | end_col_offset, PyArena *arena) |
2294 | { |
2295 | stmt_ty p; |
2296 | p = (stmt_ty)_PyArena_Malloc(arena, sizeof(*p)); |
2297 | if (!p) Branch (2297:9): [True: 0, False: 2.24k]
|
2298 | return NULL; |
2299 | p->kind = With_kind; |
2300 | p->v.With.items = items; |
2301 | p->v.With.body = body; |
2302 | p->v.With.type_comment = type_comment; |
2303 | p->lineno = lineno; |
2304 | p->col_offset = col_offset; |
2305 | p->end_lineno = end_lineno; |
2306 | p->end_col_offset = end_col_offset; |
2307 | return p; |
2308 | } |
2309 | |
2310 | stmt_ty |
2311 | _PyAST_AsyncWith(asdl_withitem_seq * items, asdl_stmt_seq * body, string |
2312 | type_comment, int lineno, int col_offset, int end_lineno, int |
2313 | end_col_offset, PyArena *arena) |
2314 | { |
2315 | stmt_ty p; |
2316 | p = (stmt_ty)_PyArena_Malloc(arena, sizeof(*p)); |
2317 | if (!p) Branch (2317:9): [True: 0, False: 76]
|
2318 | return NULL; |
2319 | p->kind = AsyncWith_kind; |
2320 | p->v.AsyncWith.items = items; |
2321 | p->v.AsyncWith.body = body; |
2322 | p->v.AsyncWith.type_comment = type_comment; |
2323 | p->lineno = lineno; |
2324 | p->col_offset = col_offset; |
2325 | p->end_lineno = end_lineno; |
2326 | p->end_col_offset = end_col_offset; |
2327 | return p; |
2328 | } |
2329 | |
2330 | stmt_ty |
2331 | _PyAST_Match(expr_ty subject, asdl_match_case_seq * cases, int lineno, int |
2332 | col_offset, int end_lineno, int end_col_offset, PyArena *arena) |
2333 | { |
2334 | stmt_ty p; |
2335 | if (!subject) { Branch (2335:9): [True: 0, False: 938]
|
2336 | PyErr_SetString(PyExc_ValueError, |
2337 | "field 'subject' is required for Match"); |
2338 | return NULL; |
2339 | } |
2340 | p = (stmt_ty)_PyArena_Malloc(arena, sizeof(*p)); |
2341 | if (!p) Branch (2341:9): [True: 0, False: 938]
|
2342 | return NULL; |
2343 | p->kind = Match_kind; |
2344 | p->v.Match.subject = subject; |
2345 | p->v.Match.cases = cases; |
2346 | p->lineno = lineno; |
2347 | p->col_offset = col_offset; |
2348 | p->end_lineno = end_lineno; |
2349 | p->end_col_offset = end_col_offset; |
2350 | return p; |
2351 | } |
2352 | |
2353 | stmt_ty |
2354 | _PyAST_Raise(expr_ty exc, expr_ty cause, int lineno, int col_offset, int |
2355 | end_lineno, int end_col_offset, PyArena *arena) |
2356 | { |
2357 | stmt_ty p; |
2358 | p = (stmt_ty)_PyArena_Malloc(arena, sizeof(*p)); |
2359 | if (!p) Branch (2359:9): [True: 0, False: 7.73k]
|
2360 | return NULL; |
2361 | p->kind = Raise_kind; |
2362 | p->v.Raise.exc = exc; |
2363 | p->v.Raise.cause = cause; |
2364 | p->lineno = lineno; |
2365 | p->col_offset = col_offset; |
2366 | p->end_lineno = end_lineno; |
2367 | p->end_col_offset = end_col_offset; |
2368 | return p; |
2369 | } |
2370 | |
2371 | stmt_ty |
2372 | _PyAST_Try(asdl_stmt_seq * body, asdl_excepthandler_seq * handlers, |
2373 | asdl_stmt_seq * orelse, asdl_stmt_seq * finalbody, int lineno, int |
2374 | col_offset, int end_lineno, int end_col_offset, PyArena *arena) |
2375 | { |
2376 | stmt_ty p; |
2377 | p = (stmt_ty)_PyArena_Malloc(arena, sizeof(*p)); |
2378 | if (!p) Branch (2378:9): [True: 0, False: 5.11k]
|
2379 | return NULL; |
2380 | p->kind = Try_kind; |
2381 | p->v.Try.body = body; |
2382 | p->v.Try.handlers = handlers; |
2383 | p->v.Try.orelse = orelse; |
2384 | p->v.Try.finalbody = finalbody; |
2385 | p->lineno = lineno; |
2386 | p->col_offset = col_offset; |
2387 | p->end_lineno = end_lineno; |
2388 | p->end_col_offset = end_col_offset; |
2389 | return p; |
2390 | } |
2391 | |
2392 | stmt_ty |
2393 | _PyAST_TryStar(asdl_stmt_seq * body, asdl_excepthandler_seq * handlers, |
2394 | asdl_stmt_seq * orelse, asdl_stmt_seq * finalbody, int lineno, |
2395 | int col_offset, int end_lineno, int end_col_offset, PyArena |
2396 | *arena) |
2397 | { |
2398 | stmt_ty p; |
2399 | p = (stmt_ty)_PyArena_Malloc(arena, sizeof(*p)); |
2400 | if (!p) Branch (2400:9): [True: 0, False: 76]
|
2401 | return NULL; |
2402 | p->kind = TryStar_kind; |
2403 | p->v.TryStar.body = body; |
2404 | p->v.TryStar.handlers = handlers; |
2405 | p->v.TryStar.orelse = orelse; |
2406 | p->v.TryStar.finalbody = finalbody; |
2407 | p->lineno = lineno; |
2408 | p->col_offset = col_offset; |
2409 | p->end_lineno = end_lineno; |
2410 | p->end_col_offset = end_col_offset; |
2411 | return p; |
2412 | } |
2413 | |
2414 | stmt_ty |
2415 | _PyAST_Assert(expr_ty test, expr_ty msg, int lineno, int col_offset, int |
2416 | end_lineno, int end_col_offset, PyArena *arena) |
2417 | { |
2418 | stmt_ty p; |
2419 | if (!test) { Branch (2419:9): [True: 0, False: 773]
|
2420 | PyErr_SetString(PyExc_ValueError, |
2421 | "field 'test' is required for Assert"); |
2422 | return NULL; |
2423 | } |
2424 | p = (stmt_ty)_PyArena_Malloc(arena, sizeof(*p)); |
2425 | if (!p) Branch (2425:9): [True: 0, False: 773]
|
2426 | return NULL; |
2427 | p->kind = Assert_kind; |
2428 | p->v.Assert.test = test; |
2429 | p->v.Assert.msg = msg; |
2430 | p->lineno = lineno; |
2431 | p->col_offset = col_offset; |
2432 | p->end_lineno = end_lineno; |
2433 | p->end_col_offset = end_col_offset; |
2434 | return p; |
2435 | } |
2436 | |
2437 | stmt_ty |
2438 | _PyAST_Import(asdl_alias_seq * names, int lineno, int col_offset, int |
2439 | end_lineno, int end_col_offset, PyArena *arena) |
2440 | { |
2441 | stmt_ty p; |
2442 | p = (stmt_ty)_PyArena_Malloc(arena, sizeof(*p)); |
2443 | if (!p) Branch (2443:9): [True: 0, False: 5.12k]
|
2444 | return NULL; |
2445 | p->kind = Import_kind; |
2446 | p->v.Import.names = names; |
2447 | p->lineno = lineno; |
2448 | p->col_offset = col_offset; |
2449 | p->end_lineno = end_lineno; |
2450 | p->end_col_offset = end_col_offset; |
2451 | return p; |
2452 | } |
2453 | |
2454 | stmt_ty |
2455 | _PyAST_ImportFrom(identifier module, asdl_alias_seq * names, int level, int |
2456 | lineno, int col_offset, int end_lineno, int end_col_offset, |
2457 | PyArena *arena) |
2458 | { |
2459 | stmt_ty p; |
2460 | p = (stmt_ty)_PyArena_Malloc(arena, sizeof(*p)); |
2461 | if (!p) Branch (2461:9): [True: 0, False: 2.41k]
|
2462 | return NULL; |
2463 | p->kind = ImportFrom_kind; |
2464 | p->v.ImportFrom.module = module; |
2465 | p->v.ImportFrom.names = names; |
2466 | p->v.ImportFrom.level = level; |
2467 | p->lineno = lineno; |
2468 | p->col_offset = col_offset; |
2469 | p->end_lineno = end_lineno; |
2470 | p->end_col_offset = end_col_offset; |
2471 | return p; |
2472 | } |
2473 | |
2474 | stmt_ty |
2475 | _PyAST_Global(asdl_identifier_seq * names, int lineno, int col_offset, int |
2476 | end_lineno, int end_col_offset, PyArena *arena) |
2477 | { |
2478 | stmt_ty p; |
2479 | p = (stmt_ty)_PyArena_Malloc(arena, sizeof(*p)); |
2480 | if (!p) Branch (2480:9): [True: 0, False: 232]
|
2481 | return NULL; |
2482 | p->kind = Global_kind; |
2483 | p->v.Global.names = names; |
2484 | p->lineno = lineno; |
2485 | p->col_offset = col_offset; |
2486 | p->end_lineno = end_lineno; |
2487 | p->end_col_offset = end_col_offset; |
2488 | return p; |
2489 | } |
2490 | |
2491 | stmt_ty |
2492 | _PyAST_Nonlocal(asdl_identifier_seq * names, int lineno, int col_offset, int |
2493 | end_lineno, int end_col_offset, PyArena *arena) |
2494 | { |
2495 | stmt_ty p; |
2496 | p = (stmt_ty)_PyArena_Malloc(arena, sizeof(*p)); |
2497 | if (!p) Branch (2497:9): [True: 0, False: 131]
|
2498 | return NULL; |
2499 | p->kind = Nonlocal_kind; |
2500 | p->v.Nonlocal.names = names; |
2501 | p->lineno = lineno; |
2502 | p->col_offset = col_offset; |
2503 | p->end_lineno = end_lineno; |
2504 | p->end_col_offset = end_col_offset; |
2505 | return p; |
2506 | } |
2507 | |
2508 | stmt_ty |
2509 | _PyAST_Expr(expr_ty value, int lineno, int col_offset, int end_lineno, int |
2510 | end_col_offset, PyArena *arena) |
2511 | { |
2512 | stmt_ty p; |
2513 | if (!value) { Branch (2513:9): [True: 0, False: 265k]
|
2514 | PyErr_SetString(PyExc_ValueError, |
2515 | "field 'value' is required for Expr"); |
2516 | return NULL; |
2517 | } |
2518 | p = (stmt_ty)_PyArena_Malloc(arena, sizeof(*p)); |
2519 | if (!p) Branch (2519:9): [True: 0, False: 265k]
|
2520 | return NULL; |
2521 | p->kind = Expr_kind; |
2522 | p->v.Expr.value = value; |
2523 | p->lineno = lineno; |
2524 | p->col_offset = col_offset; |
2525 | p->end_lineno = end_lineno; |
2526 | p->end_col_offset = end_col_offset; |
2527 | return p; |
2528 | } |
2529 | |
2530 | stmt_ty |
2531 | _PyAST_Pass(int lineno, int col_offset, int end_lineno, int end_col_offset, |
2532 | PyArena *arena) |
2533 | { |
2534 | stmt_ty p; |
2535 | p = (stmt_ty)_PyArena_Malloc(arena, sizeof(*p)); |
2536 | if (!p) Branch (2536:9): [True: 0, False: 7.37k]
|
2537 | return NULL; |
2538 | p->kind = Pass_kind; |
2539 | p->lineno = lineno; |
2540 | p->col_offset = col_offset; |
2541 | p->end_lineno = end_lineno; |
2542 | p->end_col_offset = end_col_offset; |
2543 | return p; |
2544 | } |
2545 | |
2546 | stmt_ty |
2547 | _PyAST_Break(int lineno, int col_offset, int end_lineno, int end_col_offset, |
2548 | PyArena *arena) |
2549 | { |
2550 | stmt_ty p; |
2551 | p = (stmt_ty)_PyArena_Malloc(arena, sizeof(*p)); |
2552 | if (!p) Branch (2552:9): [True: 0, False: 1.34k]
|
2553 | return NULL; |
2554 | p->kind = Break_kind; |
2555 | p->lineno = lineno; |
2556 | p->col_offset = col_offset; |
2557 | p->end_lineno = end_lineno; |
2558 | p->end_col_offset = end_col_offset; |
2559 | return p; |
2560 | } |
2561 | |
2562 | stmt_ty |
2563 | _PyAST_Continue(int lineno, int col_offset, int end_lineno, int end_col_offset, |
2564 | PyArena *arena) |
2565 | { |
2566 | stmt_ty p; |
2567 | p = (stmt_ty)_PyArena_Malloc(arena, sizeof(*p)); |
2568 | if (!p) Branch (2568:9): [True: 0, False: 1.04k]
|
2569 | return NULL; |
2570 | p->kind = Continue_kind; |
2571 | p->lineno = lineno; |
2572 | p->col_offset = col_offset; |
2573 | p->end_lineno = end_lineno; |
2574 | p->end_col_offset = end_col_offset; |
2575 | return p; |
2576 | } |
2577 | |
2578 | expr_ty |
2579 | _PyAST_BoolOp(boolop_ty op, asdl_expr_seq * values, int lineno, int col_offset, |
2580 | int end_lineno, int end_col_offset, PyArena *arena) |
2581 | { |
2582 | expr_ty p; |
2583 | if (!op) { Branch (2583:9): [True: 0, False: 8.28k]
|
2584 | PyErr_SetString(PyExc_ValueError, |
2585 | "field 'op' is required for BoolOp"); |
2586 | return NULL; |
2587 | } |
2588 | p = (expr_ty)_PyArena_Malloc(arena, sizeof(*p)); |
2589 | if (!p) Branch (2589:9): [True: 0, False: 8.28k]
|
2590 | return NULL; |
2591 | p->kind = BoolOp_kind; |
2592 | p->v.BoolOp.op = op; |
2593 | p->v.BoolOp.values = values; |
2594 | p->lineno = lineno; |
2595 | p->col_offset = col_offset; |
2596 | p->end_lineno = end_lineno; |
2597 | p->end_col_offset = end_col_offset; |
2598 | return p; |
2599 | } |
2600 | |
2601 | expr_ty |
2602 | _PyAST_NamedExpr(expr_ty target, expr_ty value, int lineno, int col_offset, int |
2603 | end_lineno, int end_col_offset, PyArena *arena) |
2604 | { |
2605 | expr_ty p; |
2606 | if (!target) { Branch (2606:9): [True: 0, False: 1.39k]
|
2607 | PyErr_SetString(PyExc_ValueError, |
2608 | "field 'target' is required for NamedExpr"); |
2609 | return NULL; |
2610 | } |
2611 | if (!value) { Branch (2611:9): [True: 0, False: 1.39k]
|
2612 | PyErr_SetString(PyExc_ValueError, |
2613 | "field 'value' is required for NamedExpr"); |
2614 | return NULL; |
2615 | } |
2616 | p = (expr_ty)_PyArena_Malloc(arena, sizeof(*p)); |
2617 | if (!p) Branch (2617:9): [True: 0, False: 1.39k]
|
2618 | return NULL; |
2619 | p->kind = NamedExpr_kind; |
2620 | p->v.NamedExpr.target = target; |
2621 | p->v.NamedExpr.value = value; |
2622 | p->lineno = lineno; |
2623 | p->col_offset = col_offset; |
2624 | p->end_lineno = end_lineno; |
2625 | p->end_col_offset = end_col_offset; |
2626 | return p; |
2627 | } |
2628 | |
2629 | expr_ty |
2630 | _PyAST_BinOp(expr_ty left, operator_ty op, expr_ty right, int lineno, int |
2631 | col_offset, int end_lineno, int end_col_offset, PyArena *arena) |
2632 | { |
2633 | expr_ty p; |
2634 | if (!left) { Branch (2634:9): [True: 0, False: 385k]
|
2635 | PyErr_SetString(PyExc_ValueError, |
2636 | "field 'left' is required for BinOp"); |
2637 | return NULL; |
2638 | } |
2639 | if (!op) { Branch (2639:9): [True: 0, False: 385k]
|
2640 | PyErr_SetString(PyExc_ValueError, |
2641 | "field 'op' is required for BinOp"); |
2642 | return NULL; |
2643 | } |
2644 | if (!right) { Branch (2644:9): [True: 0, False: 385k]
|
2645 | PyErr_SetString(PyExc_ValueError, |
2646 | "field 'right' is required for BinOp"); |
2647 | return NULL; |
2648 | } |
2649 | p = (expr_ty)_PyArena_Malloc(arena, sizeof(*p)); |
2650 | if (!p) Branch (2650:9): [True: 0, False: 385k]
|
2651 | return NULL; |
2652 | p->kind = BinOp_kind; |
2653 | p->v.BinOp.left = left; |
2654 | p->v.BinOp.op = op; |
2655 | p->v.BinOp.right = right; |
2656 | p->lineno = lineno; |
2657 | p->col_offset = col_offset; |
2658 | p->end_lineno = end_lineno; |
2659 | p->end_col_offset = end_col_offset; |
2660 | return p; |
2661 | } |
2662 | |
2663 | expr_ty |
2664 | _PyAST_UnaryOp(unaryop_ty op, expr_ty operand, int lineno, int col_offset, int |
2665 | end_lineno, int end_col_offset, PyArena *arena) |
2666 | { |
2667 | expr_ty p; |
2668 | if (!op) { Branch (2668:9): [True: 0, False: 12.6k]
|
2669 | PyErr_SetString(PyExc_ValueError, |
2670 | "field 'op' is required for UnaryOp"); |
2671 | return NULL; |
2672 | } |
2673 | if (!operand) { Branch (2673:9): [True: 0, False: 12.6k]
|
2674 | PyErr_SetString(PyExc_ValueError, |
2675 | "field 'operand' is required for UnaryOp"); |
2676 | return NULL; |
2677 | } |
2678 | p = (expr_ty)_PyArena_Malloc(arena, sizeof(*p)); |
2679 | if (!p) Branch (2679:9): [True: 0, False: 12.6k]
|
2680 | return NULL; |
2681 | p->kind = UnaryOp_kind; |
2682 | p->v.UnaryOp.op = op; |
2683 | p->v.UnaryOp.operand = operand; |
2684 | p->lineno = lineno; |
2685 | p->col_offset = col_offset; |
2686 | p->end_lineno = end_lineno; |
2687 | p->end_col_offset = end_col_offset; |
2688 | return p; |
2689 | } |
2690 | |
2691 | expr_ty |
2692 | _PyAST_Lambda(arguments_ty args, expr_ty body, int lineno, int col_offset, int |
2693 | end_lineno, int end_col_offset, PyArena *arena) |
2694 | { |
2695 | expr_ty p; |
2696 | if (!args) { Branch (2696:9): [True: 0, False: 1.67k]
|
2697 | PyErr_SetString(PyExc_ValueError, |
2698 | "field 'args' is required for Lambda"); |
2699 | return NULL; |
2700 | } |
2701 | if (!body) { Branch (2701:9): [True: 0, False: 1.67k]
|
2702 | PyErr_SetString(PyExc_ValueError, |
2703 | "field 'body' is required for Lambda"); |
2704 | return NULL; |
2705 | } |
2706 | p = (expr_ty)_PyArena_Malloc(arena, sizeof(*p)); |
2707 | if (!p) Branch (2707:9): [True: 0, False: 1.67k]
|
2708 | return NULL; |
2709 | p->kind = Lambda_kind; |
2710 | p->v.Lambda.args = args; |
2711 | p->v.Lambda.body = body; |
2712 | p->lineno = lineno; |
2713 | p->col_offset = col_offset; |
2714 | p->end_lineno = end_lineno; |
2715 | p->end_col_offset = end_col_offset; |
2716 | return p; |
2717 | } |
2718 | |
2719 | expr_ty |
2720 | _PyAST_IfExp(expr_ty test, expr_ty body, expr_ty orelse, int lineno, int |
2721 | col_offset, int end_lineno, int end_col_offset, PyArena *arena) |
2722 | { |
2723 | expr_ty p; |
2724 | if (!test) { Branch (2724:9): [True: 0, False: 1.14k]
|
2725 | PyErr_SetString(PyExc_ValueError, |
2726 | "field 'test' is required for IfExp"); |
2727 | return NULL; |
2728 | } |
2729 | if (!body) { Branch (2729:9): [True: 0, False: 1.14k]
|
2730 | PyErr_SetString(PyExc_ValueError, |
2731 | "field 'body' is required for IfExp"); |
2732 | return NULL; |
2733 | } |
2734 | if (!orelse) { Branch (2734:9): [True: 0, False: 1.14k]
|
2735 | PyErr_SetString(PyExc_ValueError, |
2736 | "field 'orelse' is required for IfExp"); |
2737 | return NULL; |
2738 | } |
2739 | p = (expr_ty)_PyArena_Malloc(arena, sizeof(*p)); |
2740 | if (!p) Branch (2740:9): [True: 0, False: 1.14k]
|
2741 | return NULL; |
2742 | p->kind = IfExp_kind; |
2743 | p->v.IfExp.test = test; |
2744 | p->v.IfExp.body = body; |
2745 | p->v.IfExp.orelse = orelse; |
2746 | p->lineno = lineno; |
2747 | p->col_offset = col_offset; |
2748 | p->end_lineno = end_lineno; |
2749 | p->end_col_offset = end_col_offset; |
2750 | return p; |
2751 | } |
2752 | |
2753 | expr_ty |
2754 | _PyAST_Dict(asdl_expr_seq * keys, asdl_expr_seq * values, int lineno, int |
2755 | col_offset, int end_lineno, int end_col_offset, PyArena *arena) |
2756 | { |
2757 | expr_ty p; |
2758 | p = (expr_ty)_PyArena_Malloc(arena, sizeof(*p)); |
2759 | if (!p) Branch (2759:9): [True: 0, False: 9.19k]
|
2760 | return NULL; |
2761 | p->kind = Dict_kind; |
2762 | p->v.Dict.keys = keys; |
2763 | p->v.Dict.values = values; |
2764 | p->lineno = lineno; |
2765 | p->col_offset = col_offset; |
2766 | p->end_lineno = end_lineno; |
2767 | p->end_col_offset = end_col_offset; |
2768 | return p; |
2769 | } |
2770 | |
2771 | expr_ty |
2772 | _PyAST_Set(asdl_expr_seq * elts, int lineno, int col_offset, int end_lineno, |
2773 | int end_col_offset, PyArena *arena) |
2774 | { |
2775 | expr_ty p; |
2776 | p = (expr_ty)_PyArena_Malloc(arena, sizeof(*p)); |
2777 | if (!p) Branch (2777:9): [True: 0, False: 1.04k]
|
2778 | return NULL; |
2779 | p->kind = Set_kind; |
2780 | p->v.Set.elts = elts; |
2781 | p->lineno = lineno; |
2782 | p->col_offset = col_offset; |
2783 | p->end_lineno = end_lineno; |
2784 | p->end_col_offset = end_col_offset; |
2785 | return p; |
2786 | } |
2787 | |
2788 | expr_ty |
2789 | _PyAST_ListComp(expr_ty elt, asdl_comprehension_seq * generators, int lineno, |
2790 | int col_offset, int end_lineno, int end_col_offset, PyArena |
2791 | *arena) |
2792 | { |
2793 | expr_ty p; |
2794 | if (!elt) { Branch (2794:9): [True: 0, False: 3.05k]
|
2795 | PyErr_SetString(PyExc_ValueError, |
2796 | "field 'elt' is required for ListComp"); |
2797 | return NULL; |
2798 | } |
2799 | p = (expr_ty)_PyArena_Malloc(arena, sizeof(*p)); |
2800 | if (!p) Branch (2800:9): [True: 0, False: 3.05k]
|
2801 | return NULL; |
2802 | p->kind = ListComp_kind; |
2803 | p->v.ListComp.elt = elt; |
2804 | p->v.ListComp.generators = generators; |
2805 | p->lineno = lineno; |
2806 | p->col_offset = col_offset; |
2807 | p->end_lineno = end_lineno; |
2808 | p->end_col_offset = end_col_offset; |
2809 | return p; |
2810 | } |
2811 | |
2812 | expr_ty |
2813 | _PyAST_SetComp(expr_ty elt, asdl_comprehension_seq * generators, int lineno, |
2814 | int col_offset, int end_lineno, int end_col_offset, PyArena |
2815 | *arena) |
2816 | { |
2817 | expr_ty p; |
2818 | if (!elt) { Branch (2818:9): [True: 0, False: 476]
|
2819 | PyErr_SetString(PyExc_ValueError, |
2820 | "field 'elt' is required for SetComp"); |
2821 | return NULL; |
2822 | } |
2823 | p = (expr_ty)_PyArena_Malloc(arena, sizeof(*p)); |
2824 | if (!p) Branch (2824:9): [True: 0, False: 476]
|
2825 | return NULL; |
2826 | p->kind = SetComp_kind; |
2827 | p->v.SetComp.elt = elt; |
2828 | p->v.SetComp.generators = generators; |
2829 | p->lineno = lineno; |
2830 | p->col_offset = col_offset; |
2831 | p->end_lineno = end_lineno; |
2832 | p->end_col_offset = end_col_offset; |
2833 | return p; |
2834 | } |
2835 | |
2836 | expr_ty |
2837 | _PyAST_DictComp(expr_ty key, expr_ty value, asdl_comprehension_seq * |
2838 | generators, int lineno, int col_offset, int end_lineno, int |
2839 | end_col_offset, PyArena *arena) |
2840 | { |
2841 | expr_ty p; |
2842 | if (!key) { Branch (2842:9): [True: 0, False: 402]
|
2843 | PyErr_SetString(PyExc_ValueError, |
2844 | "field 'key' is required for DictComp"); |
2845 | return NULL; |
2846 | } |
2847 | if (!value) { Branch (2847:9): [True: 0, False: 402]
|
2848 | PyErr_SetString(PyExc_ValueError, |
2849 | "field 'value' is required for DictComp"); |
2850 | return NULL; |
2851 | } |
2852 | p = (expr_ty)_PyArena_Malloc(arena, sizeof(*p)); |
2853 | if (!p) Branch (2853:9): [True: 0, False: 402]
|
2854 | return NULL; |
2855 | p->kind = DictComp_kind; |
2856 | p->v.DictComp.key = key; |
2857 | p->v.DictComp.value = value; |
2858 | p->v.DictComp.generators = generators; |
2859 | p->lineno = lineno; |
2860 | p->col_offset = col_offset; |
2861 | p->end_lineno = end_lineno; |
2862 | p->end_col_offset = end_col_offset; |
2863 | return p; |
2864 | } |
2865 | |
2866 | expr_ty |
2867 | _PyAST_GeneratorExp(expr_ty elt, asdl_comprehension_seq * generators, int |
2868 | lineno, int col_offset, int end_lineno, int end_col_offset, |
2869 | PyArena *arena) |
2870 | { |
2871 | expr_ty p; |
2872 | if (!elt) { Branch (2872:9): [True: 0, False: 1.62k]
|
2873 | PyErr_SetString(PyExc_ValueError, |
2874 | "field 'elt' is required for GeneratorExp"); |
2875 | return NULL; |
2876 | } |
2877 | p = (expr_ty)_PyArena_Malloc(arena, sizeof(*p)); |
2878 | if (!p) Branch (2878:9): [True: 0, False: 1.62k]
|
2879 | return NULL; |
2880 | p->kind = GeneratorExp_kind; |
2881 | p->v.GeneratorExp.elt = elt; |
2882 | p->v.GeneratorExp.generators = generators; |
2883 | p->lineno = lineno; |
2884 | p->col_offset = col_offset; |
2885 | p->end_lineno = end_lineno; |
2886 | p->end_col_offset = end_col_offset; |
2887 | return p; |
2888 | } |
2889 | |
2890 | expr_ty |
2891 | _PyAST_Await(expr_ty value, int lineno, int col_offset, int end_lineno, int |
2892 | end_col_offset, PyArena *arena) |
2893 | { |
2894 | expr_ty p; |
2895 | if (!value) { Branch (2895:9): [True: 0, False: 181]
|
2896 | PyErr_SetString(PyExc_ValueError, |
2897 | "field 'value' is required for Await"); |
2898 | return NULL; |
2899 | } |
2900 | p = (expr_ty)_PyArena_Malloc(arena, sizeof(*p)); |
2901 | if (!p) Branch (2901:9): [True: 0, False: 181]
|
2902 | return NULL; |
2903 | p->kind = Await_kind; |
2904 | p->v.Await.value = value; |
2905 | p->lineno = lineno; |
2906 | p->col_offset = col_offset; |
2907 | p->end_lineno = end_lineno; |
2908 | p->end_col_offset = end_col_offset; |
2909 | return p; |
2910 | } |
2911 | |
2912 | expr_ty |
2913 | _PyAST_Yield(expr_ty value, int lineno, int col_offset, int end_lineno, int |
2914 | end_col_offset, PyArena *arena) |
2915 | { |
2916 | expr_ty p; |
2917 | p = (expr_ty)_PyArena_Malloc(arena, sizeof(*p)); |
2918 | if (!p) Branch (2918:9): [True: 0, False: 1.21k]
|
2919 | return NULL; |
2920 | p->kind = Yield_kind; |
2921 | p->v.Yield.value = value; |
2922 | p->lineno = lineno; |
2923 | p->col_offset = col_offset; |
2924 | p->end_lineno = end_lineno; |
2925 | p->end_col_offset = end_col_offset; |
2926 | return p; |
2927 | } |
2928 | |
2929 | expr_ty |
2930 | _PyAST_YieldFrom(expr_ty value, int lineno, int col_offset, int end_lineno, int |
2931 | end_col_offset, PyArena *arena) |
2932 | { |
2933 | expr_ty p; |
2934 | if (!value) { Branch (2934:9): [True: 1, False: 245]
|
2935 | PyErr_SetString(PyExc_ValueError, |
2936 | "field 'value' is required for YieldFrom"); |
2937 | return NULL; |
2938 | } |
2939 | p = (expr_ty)_PyArena_Malloc(arena, sizeof(*p)); |
2940 | if (!p) Branch (2940:9): [True: 0, False: 245]
|
2941 | return NULL; |
2942 | p->kind = YieldFrom_kind; |
2943 | p->v.YieldFrom.value = value; |
2944 | p->lineno = lineno; |
2945 | p->col_offset = col_offset; |
2946 | p->end_lineno = end_lineno; |
2947 | p->end_col_offset = end_col_offset; |
2948 | return p; |
2949 | } |
2950 | |
2951 | expr_ty |
2952 | _PyAST_Compare(expr_ty left, asdl_int_seq * ops, asdl_expr_seq * comparators, |
2953 | int lineno, int col_offset, int end_lineno, int end_col_offset, |
2954 | PyArena *arena) |
2955 | { |
2956 | expr_ty p; |
2957 | if (!left) { Branch (2957:9): [True: 0, False: 30.0k]
|
2958 | PyErr_SetString(PyExc_ValueError, |
2959 | "field 'left' is required for Compare"); |
2960 | return NULL; |
2961 | } |
2962 | p = (expr_ty)_PyArena_Malloc(arena, sizeof(*p)); |
2963 | if (!p) Branch (2963:9): [True: 0, False: 30.0k]
|
2964 | return NULL; |
2965 | p->kind = Compare_kind; |
2966 | p->v.Compare.left = left; |
2967 | p->v.Compare.ops = ops; |
2968 | p->v.Compare.comparators = comparators; |
2969 | p->lineno = lineno; |
2970 | p->col_offset = col_offset; |
2971 | p->end_lineno = end_lineno; |
2972 | p->end_col_offset = end_col_offset; |
2973 | return p; |
2974 | } |
2975 | |
2976 | expr_ty |
2977 | _PyAST_Call(expr_ty func, asdl_expr_seq * args, asdl_keyword_seq * keywords, |
2978 | int lineno, int col_offset, int end_lineno, int end_col_offset, |
2979 | PyArena *arena) |
2980 | { |
2981 | expr_ty p; |
2982 | if (!func) { Branch (2982:9): [True: 0, False: 844k]
|
2983 | PyErr_SetString(PyExc_ValueError, |
2984 | "field 'func' is required for Call"); |
2985 | return NULL; |
2986 | } |
2987 | p = (expr_ty)_PyArena_Malloc(arena, sizeof(*p)); |
2988 | if (!p) Branch (2988:9): [True: 0, False: 844k]
|
2989 | return NULL; |
2990 | p->kind = Call_kind; |
2991 | p->v.Call.func = func; |
2992 | p->v.Call.args = args; |
2993 | p->v.Call.keywords = keywords; |
2994 | p->lineno = lineno; |
2995 | p->col_offset = col_offset; |
2996 | p->end_lineno = end_lineno; |
2997 | p->end_col_offset = end_col_offset; |
2998 | return p; |
2999 | } |
3000 | |
3001 | expr_ty |
3002 | _PyAST_FormattedValue(expr_ty value, int conversion, expr_ty format_spec, int |
3003 | lineno, int col_offset, int end_lineno, int |
3004 | end_col_offset, PyArena *arena) |
3005 | { |
3006 | expr_ty p; |
3007 | if (!value) { Branch (3007:9): [True: 0, False: 79.5k]
|
3008 | PyErr_SetString(PyExc_ValueError, |
3009 | "field 'value' is required for FormattedValue"); |
3010 | return NULL; |
3011 | } |
3012 | p = (expr_ty)_PyArena_Malloc(arena, sizeof(*p)); |
3013 | if (!p) Branch (3013:9): [True: 0, False: 79.5k]
|
3014 | return NULL; |
3015 | p->kind = FormattedValue_kind; |
3016 | p->v.FormattedValue.value = value; |
3017 | p->v.FormattedValue.conversion = conversion; |
3018 | p->v.FormattedValue.format_spec = format_spec; |
3019 | p->lineno = lineno; |
3020 | p->col_offset = col_offset; |
3021 | p->end_lineno = end_lineno; |
3022 | p->end_col_offset = end_col_offset; |
3023 | return p; |
3024 | } |
3025 | |
3026 | expr_ty |
3027 | _PyAST_JoinedStr(asdl_expr_seq * values, int lineno, int col_offset, int |
3028 | end_lineno, int end_col_offset, PyArena *arena) |
3029 | { |
3030 | expr_ty p; |
3031 | p = (expr_ty)_PyArena_Malloc(arena, sizeof(*p)); |
3032 | if (!p) Branch (3032:9): [True: 0, False: 8.38k]
|
3033 | return NULL; |
3034 | p->kind = JoinedStr_kind; |
3035 | p->v.JoinedStr.values = values; |
3036 | p->lineno = lineno; |
3037 | p->col_offset = col_offset; |
3038 | p->end_lineno = end_lineno; |
3039 | p->end_col_offset = end_col_offset; |
3040 | return p; |
3041 | } |
3042 | |
3043 | expr_ty |
3044 | _PyAST_Constant(constant value, string kind, int lineno, int col_offset, int |
3045 | end_lineno, int end_col_offset, PyArena *arena) |
3046 | { |
3047 | expr_ty p; |
3048 | if (!value) { Branch (3048:9): [True: 0, False: 1.65M]
|
3049 | PyErr_SetString(PyExc_ValueError, |
3050 | "field 'value' is required for Constant"); |
3051 | return NULL; |
3052 | } |
3053 | p = (expr_ty)_PyArena_Malloc(arena, sizeof(*p)); |
3054 | if (!p) Branch (3054:9): [True: 0, False: 1.65M]
|
3055 | return NULL; |
3056 | p->kind = Constant_kind; |
3057 | p->v.Constant.value = value; |
3058 | p->v.Constant.kind = kind; |
3059 | p->lineno = lineno; |
3060 | p->col_offset = col_offset; |
3061 | p->end_lineno = end_lineno; |
3062 | p->end_col_offset = end_col_offset; |
3063 | return p; |
3064 | } |
3065 | |
3066 | expr_ty |
3067 | _PyAST_Attribute(expr_ty value, identifier attr, expr_context_ty ctx, int |
3068 | lineno, int col_offset, int end_lineno, int end_col_offset, |
3069 | PyArena *arena) |
3070 | { |
3071 | expr_ty p; |
3072 | if (!value) { Branch (3072:9): [True: 0, False: 821k]
|
3073 | PyErr_SetString(PyExc_ValueError, |
3074 | "field 'value' is required for Attribute"); |
3075 | return NULL; |
3076 | } |
3077 | if (!attr) { Branch (3077:9): [True: 0, False: 821k]
|
3078 | PyErr_SetString(PyExc_ValueError, |
3079 | "field 'attr' is required for Attribute"); |
3080 | return NULL; |
3081 | } |
3082 | if (!ctx) { Branch (3082:9): [True: 0, False: 821k]
|
3083 | PyErr_SetString(PyExc_ValueError, |
3084 | "field 'ctx' is required for Attribute"); |
3085 | return NULL; |
3086 | } |
3087 | p = (expr_ty)_PyArena_Malloc(arena, sizeof(*p)); |
3088 | if (!p) Branch (3088:9): [True: 0, False: 821k]
|
3089 | return NULL; |
3090 | p->kind = Attribute_kind; |
3091 | p->v.Attribute.value = value; |
3092 | p->v.Attribute.attr = attr; |
3093 | p->v.Attribute.ctx = ctx; |
3094 | p->lineno = lineno; |
3095 | p->col_offset = col_offset; |
3096 | p->end_lineno = end_lineno; |
3097 | p->end_col_offset = end_col_offset; |
3098 | return p; |
3099 | } |
3100 | |
3101 | expr_ty |
3102 | _PyAST_Subscript(expr_ty value, expr_ty slice, expr_context_ty ctx, int lineno, |
3103 | int col_offset, int end_lineno, int end_col_offset, PyArena |
3104 | *arena) |
3105 | { |
3106 | expr_ty p; |
3107 | if (!value) { Branch (3107:9): [True: 0, False: 640k]
|
3108 | PyErr_SetString(PyExc_ValueError, |
3109 | "field 'value' is required for Subscript"); |
3110 | return NULL; |
3111 | } |
3112 | if (!slice) { Branch (3112:9): [True: 0, False: 640k]
|
3113 | PyErr_SetString(PyExc_ValueError, |
3114 | "field 'slice' is required for Subscript"); |
3115 | return NULL; |
3116 | } |
3117 | if (!ctx) { Branch (3117:9): [True: 0, False: 640k]
|
3118 | PyErr_SetString(PyExc_ValueError, |
3119 | "field 'ctx' is required for Subscript"); |
3120 | return NULL; |
3121 | } |
3122 | p = (expr_ty)_PyArena_Malloc(arena, sizeof(*p)); |
3123 | if (!p) Branch (3123:9): [True: 0, False: 640k]
|
3124 | return NULL; |
3125 | p->kind = Subscript_kind; |
3126 | p->v.Subscript.value = value; |
3127 | p->v.Subscript.slice = slice; |
3128 | p->v.Subscript.ctx = ctx; |
3129 | p->lineno = lineno; |
3130 | p->col_offset = col_offset; |
3131 | p->end_lineno = end_lineno; |
3132 | p->end_col_offset = end_col_offset; |
3133 | return p; |
3134 | } |
3135 | |
3136 | expr_ty |
3137 | _PyAST_Starred(expr_ty value, expr_context_ty ctx, int lineno, int col_offset, |
3138 | int end_lineno, int end_col_offset, PyArena *arena) |
3139 | { |
3140 | expr_ty p; |
3141 | if (!value) { Branch (3141:9): [True: 0, False: 3.70k]
|
3142 | PyErr_SetString(PyExc_ValueError, |
3143 | "field 'value' is required for Starred"); |
3144 | return NULL; |
3145 | } |
3146 | if (!ctx) { Branch (3146:9): [True: 0, False: 3.70k]
|
3147 | PyErr_SetString(PyExc_ValueError, |
3148 | "field 'ctx' is required for Starred"); |
3149 | return NULL; |
3150 | } |
3151 | p = (expr_ty)_PyArena_Malloc(arena, sizeof(*p)); |
3152 | if (!p) Branch (3152:9): [True: 0, False: 3.70k]
|
3153 | return NULL; |
3154 | p->kind = Starred_kind; |
3155 | p->v.Starred.value = value; |
3156 | p->v.Starred.ctx = ctx; |
3157 | p->lineno = lineno; |
3158 | p->col_offset = col_offset; |
3159 | p->end_lineno = end_lineno; |
3160 | p->end_col_offset = end_col_offset; |
3161 | return p; |
3162 | } |
3163 | |
3164 | expr_ty |
3165 | _PyAST_Name(identifier id, expr_context_ty ctx, int lineno, int col_offset, int |
3166 | end_lineno, int end_col_offset, PyArena *arena) |
3167 | { |
3168 | expr_ty p; |
3169 | if (!id) { Branch (3169:9): [True: 0, False: 6.93M]
|
3170 | PyErr_SetString(PyExc_ValueError, |
3171 | "field 'id' is required for Name"); |
3172 | return NULL; |
3173 | } |
3174 | if (!ctx) { Branch (3174:9): [True: 0, False: 6.93M]
|
3175 | PyErr_SetString(PyExc_ValueError, |
3176 | "field 'ctx' is required for Name"); |
3177 | return NULL; |
3178 | } |
3179 | p = (expr_ty)_PyArena_Malloc(arena, sizeof(*p)); |
3180 | if (!p) Branch (3180:9): [True: 0, False: 6.93M]
|
3181 | return NULL; |
3182 | p->kind = Name_kind; |
3183 | p->v.Name.id = id; |
3184 | p->v.Name.ctx = ctx; |
3185 | p->lineno = lineno; |
3186 | p->col_offset = col_offset; |
3187 | p->end_lineno = end_lineno; |
3188 | p->end_col_offset = end_col_offset; |
3189 | return p; |
3190 | } |
3191 | |
3192 | expr_ty |
3193 | _PyAST_List(asdl_expr_seq * elts, expr_context_ty ctx, int lineno, int |
3194 | col_offset, int end_lineno, int end_col_offset, PyArena *arena) |
3195 | { |
3196 | expr_ty p; |
3197 | if (!ctx) { Branch (3197:9): [True: 0, False: 21.7k]
|
3198 | PyErr_SetString(PyExc_ValueError, |
3199 | "field 'ctx' is required for List"); |
3200 | return NULL; |
3201 | } |
3202 | p = (expr_ty)_PyArena_Malloc(arena, sizeof(*p)); |
3203 | if (!p) Branch (3203:9): [True: 0, False: 21.7k]
|
3204 | return NULL; |
3205 | p->kind = List_kind; |
3206 | p->v.List.elts = elts; |
3207 | p->v.List.ctx = ctx; |
3208 | p->lineno = lineno; |
3209 | p->col_offset = col_offset; |
3210 | p->end_lineno = end_lineno; |
3211 | p->end_col_offset = end_col_offset; |
3212 | return p; |
3213 | } |
3214 | |
3215 | expr_ty |
3216 | _PyAST_Tuple(asdl_expr_seq * elts, expr_context_ty ctx, int lineno, int |
3217 | col_offset, int end_lineno, int end_col_offset, PyArena *arena) |
3218 | { |
3219 | expr_ty p; |
3220 | if (!ctx) { Branch (3220:9): [True: 0, False: 91.3k]
|
3221 | PyErr_SetString(PyExc_ValueError, |
3222 | "field 'ctx' is required for Tuple"); |
3223 | return NULL; |
3224 | } |
3225 | p = (expr_ty)_PyArena_Malloc(arena, sizeof(*p)); |
3226 | if (!p) Branch (3226:9): [True: 0, False: 91.3k]
|
3227 | return NULL; |
3228 | p->kind = Tuple_kind; |
3229 | p->v.Tuple.elts = elts; |
3230 | p->v.Tuple.ctx = ctx; |
3231 | p->lineno = lineno; |
3232 | p->col_offset = col_offset; |
3233 | p->end_lineno = end_lineno; |
3234 | p->end_col_offset = end_col_offset; |
3235 | return p; |
3236 | } |
3237 | |
3238 | expr_ty |
3239 | _PyAST_Slice(expr_ty lower, expr_ty upper, expr_ty step, int lineno, int |
3240 | col_offset, int end_lineno, int end_col_offset, PyArena *arena) |
3241 | { |
3242 | expr_ty p; |
3243 | p = (expr_ty)_PyArena_Malloc(arena, sizeof(*p)); |
3244 | if (!p) Branch (3244:9): [True: 0, False: 6.65k]
|
3245 | return NULL; |
3246 | p->kind = Slice_kind; |
3247 | p->v.Slice.lower = lower; |
3248 | p->v.Slice.upper = upper; |
3249 | p->v.Slice.step = step; |
3250 | p->lineno = lineno; |
3251 | p->col_offset = col_offset; |
3252 | p->end_lineno = end_lineno; |
3253 | p->end_col_offset = end_col_offset; |
3254 | return p; |
3255 | } |
3256 | |
3257 | comprehension_ty |
3258 | _PyAST_comprehension(expr_ty target, expr_ty iter, asdl_expr_seq * ifs, int |
3259 | is_async, PyArena *arena) |
3260 | { |
3261 | comprehension_ty p; |
3262 | if (!target) { Branch (3262:9): [True: 0, False: 6.03k]
|
3263 | PyErr_SetString(PyExc_ValueError, |
3264 | "field 'target' is required for comprehension"); |
3265 | return NULL; |
3266 | } |
3267 | if (!iter) { Branch (3267:9): [True: 0, False: 6.03k]
|
3268 | PyErr_SetString(PyExc_ValueError, |
3269 | "field 'iter' is required for comprehension"); |
3270 | return NULL; |
3271 | } |
3272 | p = (comprehension_ty)_PyArena_Malloc(arena, sizeof(*p)); |
3273 | if (!p) Branch (3273:9): [True: 0, False: 6.03k]
|
3274 | return NULL; |
3275 | p->target = target; |
3276 | p->iter = iter; |
3277 | p->ifs = ifs; |
3278 | p->is_async = is_async; |
3279 | return p; |
3280 | } |
3281 | |
3282 | excepthandler_ty |
3283 | _PyAST_ExceptHandler(expr_ty type, identifier name, asdl_stmt_seq * body, int |
3284 | lineno, int col_offset, int end_lineno, int |
3285 | end_col_offset, PyArena *arena) |
3286 | { |
3287 | excepthandler_ty p; |
3288 | p = (excepthandler_ty)_PyArena_Malloc(arena, sizeof(*p)); |
3289 | if (!p) Branch (3289:9): [True: 0, False: 4.83k]
|
3290 | return NULL; |
3291 | p->kind = ExceptHandler_kind; |
3292 | p->v.ExceptHandler.type = type; |
3293 | p->v.ExceptHandler.name = name; |
3294 | p->v.ExceptHandler.body = body; |
3295 | p->lineno = lineno; |
3296 | p->col_offset = col_offset; |
3297 | p->end_lineno = end_lineno; |
3298 | p->end_col_offset = end_col_offset; |
3299 | return p; |
3300 | } |
3301 | |
3302 | arguments_ty |
3303 | _PyAST_arguments(asdl_arg_seq * posonlyargs, asdl_arg_seq * args, arg_ty |
3304 | vararg, asdl_arg_seq * kwonlyargs, asdl_expr_seq * |
3305 | kw_defaults, arg_ty kwarg, asdl_expr_seq * defaults, PyArena |
3306 | *arena) |
3307 | { |
3308 | arguments_ty p; |
3309 | p = (arguments_ty)_PyArena_Malloc(arena, sizeof(*p)); |
3310 | if (!p) Branch (3310:9): [True: 0, False: 42.1k]
|
3311 | return NULL; |
3312 | p->posonlyargs = posonlyargs; |
3313 | p->args = args; |
3314 | p->vararg = vararg; |
3315 | p->kwonlyargs = kwonlyargs; |
3316 | p->kw_defaults = kw_defaults; |
3317 | p->kwarg = kwarg; |
3318 | p->defaults = defaults; |
3319 | return p; |
3320 | } |
3321 | |
3322 | arg_ty |
3323 | _PyAST_arg(identifier arg, expr_ty annotation, string type_comment, int lineno, |
3324 | int col_offset, int end_lineno, int end_col_offset, PyArena *arena) |
3325 | { |
3326 | arg_ty p; |
3327 | if (!arg) { Branch (3327:9): [True: 0, False: 453k]
|
3328 | PyErr_SetString(PyExc_ValueError, |
3329 | "field 'arg' is required for arg"); |
3330 | return NULL; |
3331 | } |
3332 | p = (arg_ty)_PyArena_Malloc(arena, sizeof(*p)); |
3333 | if (!p) Branch (3333:9): [True: 0, False: 453k]
|
3334 | return NULL; |
3335 | p->arg = arg; |
3336 | p->annotation = annotation; |
3337 | p->type_comment = type_comment; |
3338 | p->lineno = lineno; |
3339 | p->col_offset = col_offset; |
3340 | p->end_lineno = end_lineno; |
3341 | p->end_col_offset = end_col_offset; |
3342 | return p; |
3343 | } |
3344 | |
3345 | keyword_ty |
3346 | _PyAST_keyword(identifier arg, expr_ty value, int lineno, int col_offset, int |
3347 | end_lineno, int end_col_offset, PyArena *arena) |
3348 | { |
3349 | keyword_ty p; |
3350 | if (!value) { Branch (3350:9): [True: 0, False: 22.2k]
|
3351 | PyErr_SetString(PyExc_ValueError, |
3352 | "field 'value' is required for keyword"); |
3353 | return NULL; |
3354 | } |
3355 | p = (keyword_ty)_PyArena_Malloc(arena, sizeof(*p)); |
3356 | if (!p) Branch (3356:9): [True: 0, False: 22.2k]
|
3357 | return NULL; |
3358 | p->arg = arg; |
3359 | p->value = value; |
3360 | p->lineno = lineno; |
3361 | p->col_offset = col_offset; |
3362 | p->end_lineno = end_lineno; |
3363 | p->end_col_offset = end_col_offset; |
3364 | return p; |
3365 | } |
3366 | |
3367 | alias_ty |
3368 | _PyAST_alias(identifier name, identifier asname, int lineno, int col_offset, |
3369 | int end_lineno, int end_col_offset, PyArena *arena) |
3370 | { |
3371 | alias_ty p; |
3372 | if (!name) { Branch (3372:9): [True: 0, False: 8.74k]
|
3373 | PyErr_SetString(PyExc_ValueError, |
3374 | "field 'name' is required for alias"); |
3375 | return NULL; |
3376 | } |
3377 | p = (alias_ty)_PyArena_Malloc(arena, sizeof(*p)); |
3378 | if (!p) Branch (3378:9): [True: 0, False: 8.74k]
|
3379 | return NULL; |
3380 | p->name = name; |
3381 | p->asname = asname; |
3382 | p->lineno = lineno; |
3383 | p->col_offset = col_offset; |
3384 | p->end_lineno = end_lineno; |
3385 | p->end_col_offset = end_col_offset; |
3386 | return p; |
3387 | } |
3388 | |
3389 | withitem_ty |
3390 | _PyAST_withitem(expr_ty context_expr, expr_ty optional_vars, PyArena *arena) |
3391 | { |
3392 | withitem_ty p; |
3393 | if (!context_expr) { Branch (3393:9): [True: 0, False: 2.50k]
|
3394 | PyErr_SetString(PyExc_ValueError, |
3395 | "field 'context_expr' is required for withitem"); |
3396 | return NULL; |
3397 | } |
3398 | p = (withitem_ty)_PyArena_Malloc(arena, sizeof(*p)); |
3399 | if (!p) Branch (3399:9): [True: 0, False: 2.50k]
|
3400 | return NULL; |
3401 | p->context_expr = context_expr; |
3402 | p->optional_vars = optional_vars; |
3403 | return p; |
3404 | } |
3405 | |
3406 | match_case_ty |
3407 | _PyAST_match_case(pattern_ty pattern, expr_ty guard, asdl_stmt_seq * body, |
3408 | PyArena *arena) |
3409 | { |
3410 | match_case_ty p; |
3411 | if (!pattern) { Branch (3411:9): [True: 0, False: 1.31k]
|
3412 | PyErr_SetString(PyExc_ValueError, |
3413 | "field 'pattern' is required for match_case"); |
3414 | return NULL; |
3415 | } |
3416 | p = (match_case_ty)_PyArena_Malloc(arena, sizeof(*p)); |
3417 | if (!p) Branch (3417:9): [True: 0, False: 1.31k]
|
3418 | return NULL; |
3419 | p->pattern = pattern; |
3420 | p->guard = guard; |
3421 | p->body = body; |
3422 | return p; |
3423 | } |
3424 | |
3425 | pattern_ty |
3426 | _PyAST_MatchValue(expr_ty value, int lineno, int col_offset, int end_lineno, |
3427 | int end_col_offset, PyArena *arena) |
3428 | { |
3429 | pattern_ty p; |
3430 | if (!value) { Branch (3430:9): [True: 0, False: 1.17k]
|
3431 | PyErr_SetString(PyExc_ValueError, |
3432 | "field 'value' is required for MatchValue"); |
3433 | return NULL; |
3434 | } |
3435 | p = (pattern_ty)_PyArena_Malloc(arena, sizeof(*p)); |
3436 | if (!p) Branch (3436:9): [True: 0, False: 1.17k]
|
3437 | return NULL; |
3438 | p->kind = MatchValue_kind; |
3439 | p->v.MatchValue.value = value; |
3440 | p->lineno = lineno; |
3441 | p->col_offset = col_offset; |
3442 | p->end_lineno = end_lineno; |
3443 | p->end_col_offset = end_col_offset; |
3444 | return p; |
3445 | } |
3446 | |
3447 | pattern_ty |
3448 | _PyAST_MatchSingleton(constant value, int lineno, int col_offset, int |
3449 | end_lineno, int end_col_offset, PyArena *arena) |
3450 | { |
3451 | pattern_ty p; |
3452 | if (!value) { Branch (3452:9): [True: 0, False: 43]
|
3453 | PyErr_SetString(PyExc_ValueError, |
3454 | "field 'value' is required for MatchSingleton"); |
3455 | return NULL; |
3456 | } |
3457 | p = (pattern_ty)_PyArena_Malloc(arena, sizeof(*p)); |
3458 | if (!p) Branch (3458:9): [True: 0, False: 43]
|
3459 | return NULL; |
3460 | p->kind = MatchSingleton_kind; |
3461 | p->v.MatchSingleton.value = value; |
3462 | p->lineno = lineno; |
3463 | p->col_offset = col_offset; |
3464 | p->end_lineno = end_lineno; |
3465 | p->end_col_offset = end_col_offset; |
3466 | return p; |
3467 | } |
3468 | |
3469 | pattern_ty |
3470 | _PyAST_MatchSequence(asdl_pattern_seq * patterns, int lineno, int col_offset, |
3471 | int end_lineno, int end_col_offset, PyArena *arena) |
3472 | { |
3473 | pattern_ty p; |
3474 | p = (pattern_ty)_PyArena_Malloc(arena, sizeof(*p)); |
3475 | if (!p) Branch (3475:9): [True: 0, False: 607]
|
3476 | return NULL; |
3477 | p->kind = MatchSequence_kind; |
3478 | p->v.MatchSequence.patterns = patterns; |
3479 | p->lineno = lineno; |
3480 | p->col_offset = col_offset; |
3481 | p->end_lineno = end_lineno; |
3482 | p->end_col_offset = end_col_offset; |
3483 | return p; |
3484 | } |
3485 | |
3486 | pattern_ty |
3487 | _PyAST_MatchMapping(asdl_expr_seq * keys, asdl_pattern_seq * patterns, |
3488 | identifier rest, int lineno, int col_offset, int |
3489 | end_lineno, int end_col_offset, PyArena *arena) |
3490 | { |
3491 | pattern_ty p; |
3492 | p = (pattern_ty)_PyArena_Malloc(arena, sizeof(*p)); |
3493 | if (!p) Branch (3493:9): [True: 0, False: 355]
|
3494 | return NULL; |
3495 | p->kind = MatchMapping_kind; |
3496 | p->v.MatchMapping.keys = keys; |
3497 | p->v.MatchMapping.patterns = patterns; |
3498 | p->v.MatchMapping.rest = rest; |
3499 | p->lineno = lineno; |
3500 | p->col_offset = col_offset; |
3501 | p->end_lineno = end_lineno; |
3502 | p->end_col_offset = end_col_offset; |
3503 | return p; |
3504 | } |
3505 | |
3506 | pattern_ty |
3507 | _PyAST_MatchClass(expr_ty cls, asdl_pattern_seq * patterns, asdl_identifier_seq |
3508 | * kwd_attrs, asdl_pattern_seq * kwd_patterns, int lineno, int |
3509 | col_offset, int end_lineno, int end_col_offset, PyArena |
3510 | *arena) |
3511 | { |
3512 | pattern_ty p; |
3513 | if (!cls) { Branch (3513:9): [True: 0, False: 196]
|
3514 | PyErr_SetString(PyExc_ValueError, |
3515 | "field 'cls' is required for MatchClass"); |
3516 | return NULL; |
3517 | } |
3518 | p = (pattern_ty)_PyArena_Malloc(arena, sizeof(*p)); |
3519 | if (!p) Branch (3519:9): [True: 0, False: 196]
|
3520 | return NULL; |
3521 | p->kind = MatchClass_kind; |
3522 | p->v.MatchClass.cls = cls; |
3523 | p->v.MatchClass.patterns = patterns; |
3524 | p->v.MatchClass.kwd_attrs = kwd_attrs; |
3525 | p->v.MatchClass.kwd_patterns = kwd_patterns; |
3526 | p->lineno = lineno; |
3527 | p->col_offset = col_offset; |
3528 | p->end_lineno = end_lineno; |
3529 | p->end_col_offset = end_col_offset; |
3530 | return p; |
3531 | } |
3532 | |
3533 | pattern_ty |
3534 | _PyAST_MatchStar(identifier name, int lineno, int col_offset, int end_lineno, |
3535 | int end_col_offset, PyArena *arena) |
3536 | { |
3537 | pattern_ty p; |
3538 | p = (pattern_ty)_PyArena_Malloc(arena, sizeof(*p)); |
3539 | if (!p) Branch (3539:9): [True: 0, False: 142]
|
3540 | return NULL; |
3541 | p->kind = MatchStar_kind; |
3542 | p->v.MatchStar.name = name; |
3543 | p->lineno = lineno; |
3544 | p->col_offset = col_offset; |
3545 | p->end_lineno = end_lineno; |
3546 | p->end_col_offset = end_col_offset; |
3547 | return p; |
3548 | } |
3549 | |
3550 | pattern_ty |
3551 | _PyAST_MatchAs(pattern_ty pattern, identifier name, int lineno, int col_offset, |
3552 | int end_lineno, int end_col_offset, PyArena *arena) |
3553 | { |
3554 | pattern_ty p; |
3555 | p = (pattern_ty)_PyArena_Malloc(arena, sizeof(*p)); |
3556 | if (!p) Branch (3556:9): [True: 0, False: 1.18k]
|
3557 | return NULL; |
3558 | p->kind = MatchAs_kind; |
3559 | p->v.MatchAs.pattern = pattern; |
3560 | p->v.MatchAs.name = name; |
3561 | p->lineno = lineno; |
3562 | p->col_offset = col_offset; |
3563 | p->end_lineno = end_lineno; |
3564 | p->end_col_offset = end_col_offset; |
3565 | return p; |
3566 | } |
3567 | |
3568 | pattern_ty |
3569 | _PyAST_MatchOr(asdl_pattern_seq * patterns, int lineno, int col_offset, int |
3570 | end_lineno, int end_col_offset, PyArena *arena) |
3571 | { |
3572 | pattern_ty p; |
3573 | p = (pattern_ty)_PyArena_Malloc(arena, sizeof(*p)); |
3574 | if (!p) Branch (3574:9): [True: 0, False: 532]
|
3575 | return NULL; |
3576 | p->kind = MatchOr_kind; |
3577 | p->v.MatchOr.patterns = patterns; |
3578 | p->lineno = lineno; |
3579 | p->col_offset = col_offset; |
3580 | p->end_lineno = end_lineno; |
3581 | p->end_col_offset = end_col_offset; |
3582 | return p; |
3583 | } |
3584 | |
3585 | type_ignore_ty |
3586 | _PyAST_TypeIgnore(int lineno, string tag, PyArena *arena) |
3587 | { |
3588 | type_ignore_ty p; |
3589 | if (!tag) { Branch (3589:9): [True: 0, False: 74]
|
3590 | PyErr_SetString(PyExc_ValueError, |
3591 | "field 'tag' is required for TypeIgnore"); |
3592 | return NULL; |
3593 | } |
3594 | p = (type_ignore_ty)_PyArena_Malloc(arena, sizeof(*p)); |
3595 | if (!p) Branch (3595:9): [True: 0, False: 74]
|
3596 | return NULL; |
3597 | p->kind = TypeIgnore_kind; |
3598 | p->v.TypeIgnore.lineno = lineno; |
3599 | p->v.TypeIgnore.tag = tag; |
3600 | return p; |
3601 | } |
3602 | |
3603 | |
3604 | PyObject* |
3605 | ast2obj_mod(struct ast_state *state, void* _o) |
3606 | { |
3607 | mod_ty o = (mod_ty)_o; |
3608 | PyObject *result = NULL, *value = NULL; |
3609 | PyTypeObject *tp; |
3610 | if (!o) { Branch (3610:9): [True: 0, False: 8.94k]
|
3611 | Py_RETURN_NONE; |
3612 | } |
3613 | switch (o->kind) { Branch (3613:13): [True: 0, False: 8.94k]
|
3614 | case Module_kind: Branch (3614:5): [True: 8.28k, False: 659]
|
3615 | tp = (PyTypeObject *)state->Module_type; |
3616 | result = PyType_GenericNew(tp, NULL, NULL); |
3617 | if (!result) goto failed0 ; Branch (3617:13): [True: 0, False: 8.28k]
|
3618 | value = ast2obj_list(state, (asdl_seq*)o->v.Module.body, ast2obj_stmt); |
3619 | if (!value) goto failed0 ; Branch (3619:13): [True: 0, False: 8.28k]
|
3620 | if (PyObject_SetAttr(result, state->body, value) == -1) Branch (3620:13): [True: 0, False: 8.28k]
|
3621 | goto failed; |
3622 | Py_DECREF(value); |
3623 | value = ast2obj_list(state, (asdl_seq*)o->v.Module.type_ignores, |
3624 | ast2obj_type_ignore); |
3625 | if (!value) goto failed0 ; Branch (3625:13): [True: 0, False: 8.28k]
|
3626 | if (PyObject_SetAttr(result, state->type_ignores, value) == -1) Branch (3626:13): [True: 0, False: 8.28k]
|
3627 | goto failed; |
3628 | Py_DECREF(value); |
3629 | break; |
3630 | case Interactive_kind: Branch (3630:5): [True: 1, False: 8.94k]
|
3631 | tp = (PyTypeObject *)state->Interactive_type; |
3632 | result = PyType_GenericNew(tp, NULL, NULL); |
3633 | if (!result) goto failed0 ; Branch (3633:13): [True: 0, False: 1]
|
3634 | value = ast2obj_list(state, (asdl_seq*)o->v.Interactive.body, |
3635 | ast2obj_stmt); |
3636 | if (!value) goto failed0 ; Branch (3636:13): [True: 0, False: 1]
|
3637 | if (PyObject_SetAttr(result, state->body, value) == -1) Branch (3637:13): [True: 0, False: 1]
|
3638 | goto failed; |
3639 | Py_DECREF(value); |
3640 | break; |
3641 | case Expression_kind: Branch (3641:5): [True: 646, False: 8.30k]
|
3642 | tp = (PyTypeObject *)state->Expression_type; |
3643 | result = PyType_GenericNew(tp, NULL, NULL); |
3644 | if (!result) goto failed0 ; Branch (3644:13): [True: 0, False: 646]
|
3645 | value = ast2obj_expr(state, o->v.Expression.body); |
3646 | if (!value) goto failed0 ; Branch (3646:13): [True: 0, False: 646]
|
3647 | if (PyObject_SetAttr(result, state->body, value) == -1) Branch (3647:13): [True: 0, False: 646]
|
3648 | goto failed; |
3649 | Py_DECREF(value); |
3650 | break; |
3651 | case FunctionType_kind: Branch (3651:5): [True: 12, False: 8.93k]
|
3652 | tp = (PyTypeObject *)state->FunctionType_type; |
3653 | result = PyType_GenericNew(tp, NULL, NULL); |
3654 | if (!result) goto failed0 ; Branch (3654:13): [True: 0, False: 12]
|
3655 | value = ast2obj_list(state, (asdl_seq*)o->v.FunctionType.argtypes, |
3656 | ast2obj_expr); |
3657 | if (!value) goto failed0 ; Branch (3657:13): [True: 0, False: 12]
|
3658 | if (PyObject_SetAttr(result, state->argtypes, value) == -1) Branch (3658:13): [True: 0, False: 12]
|
3659 | goto failed; |
3660 | Py_DECREF(value); |
3661 | value = ast2obj_expr(state, o->v.FunctionType.returns); |
3662 | if (!value) goto failed0 ; Branch (3662:13): [True: 0, False: 12]
|
3663 | if (PyObject_SetAttr(result, state->returns, value) == -1) Branch (3663:13): [True: 0, False: 12]
|
3664 | goto failed; |
3665 | Py_DECREF(value); |
3666 | break; |
3667 | } |
3668 | return result; |
3669 | failed: |
3670 | Py_XDECREF(value); |
3671 | Py_XDECREF(result); |
3672 | return NULL; |
3673 | } |
3674 | |
3675 | PyObject* |
3676 | ast2obj_stmt(struct ast_state *state, void* _o) |
3677 | { |
3678 | stmt_ty o = (stmt_ty)_o; |
3679 | PyObject *result = NULL, *value = NULL; |
3680 | PyTypeObject *tp; |
3681 | if (!o) { Branch (3681:9): [True: 0, False: 159k]
|
3682 | Py_RETURN_NONE; |
3683 | } |
3684 | switch (o->kind) { Branch (3684:13): [True: 0, False: 159k]
|
3685 | case FunctionDef_kind: Branch (3685:5): [True: 19.1k, False: 140k]
|
3686 | tp = (PyTypeObject *)state->FunctionDef_type; |
3687 | result = PyType_GenericNew(tp, NULL, NULL); |
3688 | if (!result) goto failed0 ; Branch (3688:13): [True: 0, False: 19.1k]
|
3689 | value = ast2obj_identifier(state, o->v.FunctionDef.name); |
3690 | if (!value) goto failed0 ; Branch (3690:13): [True: 0, False: 19.1k]
|
3691 | if (PyObject_SetAttr(result, state->name, value) == -1) Branch (3691:13): [True: 0, False: 19.1k]
|
3692 | goto failed; |
3693 | Py_DECREF(value); |
3694 | value = ast2obj_arguments(state, o->v.FunctionDef.args); |
3695 | if (!value) goto failed0 ; Branch (3695:13): [True: 0, False: 19.1k]
|
3696 | if (PyObject_SetAttr(result, state->args, value) == -1) Branch (3696:13): [True: 0, False: 19.1k]
|
3697 | goto failed; |
3698 | Py_DECREF(value); |
3699 | value = ast2obj_list(state, (asdl_seq*)o->v.FunctionDef.body, |
3700 | ast2obj_stmt); |
3701 | if (!value) goto failed0 ; Branch (3701:13): [True: 0, False: 19.1k]
|
3702 | if (PyObject_SetAttr(result, state->body, value) == -1) Branch (3702:13): [True: 0, False: 19.1k]
|
3703 | goto failed; |
3704 | Py_DECREF(value); |
3705 | value = ast2obj_list(state, (asdl_seq*)o->v.FunctionDef.decorator_list, |
3706 | ast2obj_expr); |
3707 | if (!value) goto failed0 ; Branch (3707:13): [True: 0, False: 19.1k]
|
3708 | if (PyObject_SetAttr(result, state->decorator_list, value) == -1) Branch (3708:13): [True: 0, False: 19.1k]
|
3709 | goto failed; |
3710 | Py_DECREF(value); |
3711 | value = ast2obj_expr(state, o->v.FunctionDef.returns); |
3712 | if (!value) goto failed0 ; Branch (3712:13): [True: 0, False: 19.1k]
|
3713 | if (PyObject_SetAttr(result, state->returns, value) == -1) Branch (3713:13): [True: 0, False: 19.1k]
|
3714 | goto failed; |
3715 | Py_DECREF(value); |
3716 | value = ast2obj_string(state, o->v.FunctionDef.type_comment); |
3717 | if (!value) goto failed0 ; Branch (3717:13): [True: 0, False: 19.1k]
|
3718 | if (PyObject_SetAttr(result, state->type_comment, value) == -1) Branch (3718:13): [True: 0, False: 19.1k]
|
3719 | goto failed; |
3720 | Py_DECREF(value); |
3721 | break; |
3722 | case AsyncFunctionDef_kind: Branch (3722:5): [True: 230, False: 159k]
|
3723 | tp = (PyTypeObject *)state->AsyncFunctionDef_type; |
3724 | result = PyType_GenericNew(tp, NULL, NULL); |
3725 | if (!result) goto failed0 ; Branch (3725:13): [True: 0, False: 230]
|
3726 | value = ast2obj_identifier(state, o->v.AsyncFunctionDef.name); |
3727 | if (!value) goto failed0 ; Branch (3727:13): [True: 0, False: 230]
|
3728 | if (PyObject_SetAttr(result, state->name, value) == -1) Branch (3728:13): [True: 0, False: 230]
|
3729 | goto failed; |
3730 | Py_DECREF(value); |
3731 | value = ast2obj_arguments(state, o->v.AsyncFunctionDef.args); |
3732 | if (!value) goto failed0 ; Branch (3732:13): [True: 0, False: 230]
|
3733 | if (PyObject_SetAttr(result, state->args, value) == -1) Branch (3733:13): [True: 0, False: 230]
|
3734 | goto failed; |
3735 | Py_DECREF(value); |
3736 | value = ast2obj_list(state, (asdl_seq*)o->v.AsyncFunctionDef.body, |
3737 | ast2obj_stmt); |
3738 | if (!value) goto failed0 ; Branch (3738:13): [True: 0, False: 230]
|
3739 | if (PyObject_SetAttr(result, state->body, value) == -1) Branch (3739:13): [True: 0, False: 230]
|
3740 | goto failed; |
3741 | Py_DECREF(value); |
3742 | value = ast2obj_list(state, |
3743 | (asdl_seq*)o->v.AsyncFunctionDef.decorator_list, |
3744 | ast2obj_expr); |
3745 | if (!value) goto failed0 ; Branch (3745:13): [True: 0, False: 230]
|
3746 | if (PyObject_SetAttr(result, state->decorator_list, value) == -1) Branch (3746:13): [True: 0, False: 230]
|
3747 | goto failed; |
3748 | Py_DECREF(value); |
3749 | value = ast2obj_expr(state, o->v.AsyncFunctionDef.returns); |
3750 | if (!value) goto failed0 ; Branch (3750:13): [True: 0, False: 230]
|
3751 | if (PyObject_SetAttr(result, state->returns, value) == -1) Branch (3751:13): [True: 0, False: 230]
|
3752 | goto failed; |
3753 | Py_DECREF(value); |
3754 | value = ast2obj_string(state, o->v.AsyncFunctionDef.type_comment); |
3755 | if (!value) goto failed0 ; Branch (3755:13): [True: 0, False: 230]
|
3756 | if (PyObject_SetAttr(result, state->type_comment, value) == -1) Branch (3756:13): [True: 0, False: 230]
|
3757 | goto failed; |
3758 | Py_DECREF(value); |
3759 | break; |
3760 | case ClassDef_kind: Branch (3760:5): [True: 3.48k, False: 156k]
|
3761 | tp = (PyTypeObject *)state->ClassDef_type; |
3762 | result = PyType_GenericNew(tp, NULL, NULL); |
3763 | if (!result) goto failed0 ; Branch (3763:13): [True: 0, False: 3.48k]
|
3764 | value = ast2obj_identifier(state, o->v.ClassDef.name); |
3765 | if (!value) goto failed0 ; Branch (3765:13): [True: 0, False: 3.48k]
|
3766 | if (PyObject_SetAttr(result, state->name, value) == -1) Branch (3766:13): [True: 0, False: 3.48k]
|
3767 | goto failed; |
3768 | Py_DECREF(value); |
3769 | value = ast2obj_list(state, (asdl_seq*)o->v.ClassDef.bases, |
3770 | ast2obj_expr); |
3771 | if (!value) goto failed0 ; Branch (3771:13): [True: 0, False: 3.48k]
|
3772 | if (PyObject_SetAttr(result, state->bases, value) == -1) Branch (3772:13): [True: 0, False: 3.48k]
|
3773 | goto failed; |
3774 | Py_DECREF(value); |
3775 | value = ast2obj_list(state, (asdl_seq*)o->v.ClassDef.keywords, |
3776 | ast2obj_keyword); |
3777 | if (!value) goto failed0 ; Branch (3777:13): [True: 0, False: 3.48k]
|
3778 | if (PyObject_SetAttr(result, state->keywords, value) == -1) Branch (3778:13): [True: 0, False: 3.48k]
|
3779 | goto failed; |
3780 | Py_DECREF(value); |
3781 | value = ast2obj_list(state, (asdl_seq*)o->v.ClassDef.body, |
3782 | ast2obj_stmt); |
3783 | if (!value) goto failed0 ; Branch (3783:13): [True: 0, False: 3.48k]
|
3784 | if (PyObject_SetAttr(result, state->body, value) == -1) Branch (3784:13): [True: 0, False: 3.48k]
|
3785 | goto failed; |
3786 | Py_DECREF(value); |
3787 | value = ast2obj_list(state, (asdl_seq*)o->v.ClassDef.decorator_list, |
3788 | ast2obj_expr); |
3789 | if (!value) goto failed0 ; Branch (3789:13): [True: 0, False: 3.48k]
|
3790 | if (PyObject_SetAttr(result, state->decorator_list, value) == -1) Branch (3790:13): [True: 0, False: 3.48k]
|
3791 | goto failed; |
3792 | Py_DECREF(value); |
3793 | break; |
3794 | case Return_kind: Branch (3794:5): [True: 12.0k, False: 147k]
|
3795 | tp = (PyTypeObject *)state->Return_type; |
3796 | result = PyType_GenericNew(tp, NULL, NULL); |
3797 | if (!result) goto failed0 ; Branch (3797:13): [True: 0, False: 12.0k]
|
3798 | value = ast2obj_expr(state, o->v.Return.value); |
3799 | if (!value) goto failed0 ; Branch (3799:13): [True: 0, False: 12.0k]
|
3800 | if (PyObject_SetAttr(result, state->value, value) == -1) Branch (3800:13): [True: 0, False: 12.0k]
|
3801 | goto failed; |
3802 | Py_DECREF(value); |
3803 | break; |
3804 | case Delete_kind: Branch (3804:5): [True: 497, False: 159k]
|
3805 | tp = (PyTypeObject *)state->Delete_type; |
3806 | result = PyType_GenericNew(tp, NULL, NULL); |
3807 | if (!result) goto failed0 ; Branch (3807:13): [True: 0, False: 497]
|
3808 | value = ast2obj_list(state, (asdl_seq*)o->v.Delete.targets, |
3809 | ast2obj_expr); |
3810 | if (!value) goto failed0 ; Branch (3810:13): [True: 0, False: 497]
|
3811 | if (PyObject_SetAttr(result, state->targets, value) == -1) Branch (3811:13): [True: 0, False: 497]
|
3812 | goto failed; |
3813 | Py_DECREF(value); |
3814 | break; |
3815 | case Assign_kind: Branch (3815:5): [True: 50.1k, False: 109k]
|
3816 | tp = (PyTypeObject *)state->Assign_type; |
3817 | result = PyType_GenericNew(tp, NULL, NULL); |
3818 | if (!result) goto failed0 ; Branch (3818:13): [True: 0, False: 50.1k]
|
3819 | value = ast2obj_list(state, (asdl_seq*)o->v.Assign.targets, |
3820 | ast2obj_expr); |
3821 | if (!value) goto failed0 ; Branch (3821:13): [True: 0, False: 50.1k]
|
3822 | if (PyObject_SetAttr(result, state->targets, value) == -1) Branch (3822:13): [True: 0, False: 50.1k]
|
3823 | goto failed; |
3824 | Py_DECREF(value); |
3825 | value = ast2obj_expr(state, o->v.Assign.value); |
3826 | if (!value) goto failed0 ; Branch (3826:13): [True: 0, False: 50.1k]
|
3827 | if (PyObject_SetAttr(result, state->value, value) == -1) Branch (3827:13): [True: 0, False: 50.1k]
|
3828 | goto failed; |
3829 | Py_DECREF(value); |
3830 | value = ast2obj_string(state, o->v.Assign.type_comment); |
3831 | if (!value) goto failed0 ; Branch (3831:13): [True: 0, False: 50.1k]
|
3832 | if (PyObject_SetAttr(result, state->type_comment, value) == -1) Branch (3832:13): [True: 0, False: 50.1k]
|
3833 | goto failed; |
3834 | Py_DECREF(value); |
3835 | break; |
3836 | case AugAssign_kind: Branch (3836:5): [True: 1.26k, False: 158k]
|
3837 | tp = (PyTypeObject *)state->AugAssign_type; |
3838 | result = PyType_GenericNew(tp, NULL, NULL); |
3839 | if (!result) goto failed0 ; Branch (3839:13): [True: 0, False: 1.26k]
|
3840 | value = ast2obj_expr(state, o->v.AugAssign.target); |
3841 | if (!value) goto failed0 ; Branch (3841:13): [True: 0, False: 1.26k]
|
3842 | if (PyObject_SetAttr(result, state->target, value) == -1) Branch (3842:13): [True: 0, False: 1.26k]
|
3843 | goto failed; |
3844 | Py_DECREF(value); |
3845 | value = ast2obj_operator(state, o->v.AugAssign.op); |
3846 | if (!value) goto failed0 ; Branch (3846:13): [True: 0, False: 1.26k]
|
3847 | if (PyObject_SetAttr(result, state->op, value) == -1) Branch (3847:13): [True: 0, False: 1.26k]
|
3848 | goto failed; |
3849 | Py_DECREF(value); |
3850 | value = ast2obj_expr(state, o->v.AugAssign.value); |
3851 | if (!value) goto failed0 ; Branch (3851:13): [True: 0, False: 1.26k]
|
3852 | if (PyObject_SetAttr(result, state->value, value) == -1) Branch (3852:13): [True: 0, False: 1.26k]
|
3853 | goto failed; |
3854 | Py_DECREF(value); |
3855 | break; |
3856 | case AnnAssign_kind: Branch (3856:5): [True: 132, False: 159k]
|
3857 | tp = (PyTypeObject *)state->AnnAssign_type; |
3858 | result = PyType_GenericNew(tp, NULL, NULL); |
3859 | if (!result) goto failed0 ; Branch (3859:13): [True: 0, False: 132]
|
3860 | value = ast2obj_expr(state, o->v.AnnAssign.target); |
3861 | if (!value) goto failed0 ; Branch (3861:13): [True: 0, False: 132]
|
3862 | if (PyObject_SetAttr(result, state->target, value) == -1) Branch (3862:13): [True: 0, False: 132]
|
3863 | goto failed; |
3864 | Py_DECREF(value); |
3865 | value = ast2obj_expr(state, o->v.AnnAssign.annotation); |
3866 | if (!value) goto failed0 ; Branch (3866:13): [True: 0, False: 132]
|
3867 | if (PyObject_SetAttr(result, state->annotation, value) == -1) Branch (3867:13): [True: 0, False: 132]
|
3868 | goto failed; |
3869 | Py_DECREF(value); |
3870 | value = ast2obj_expr(state, o->v.AnnAssign.value); |
3871 | if (!value) goto failed0 ; Branch (3871:13): [True: 0, False: 132]
|
3872 | if (PyObject_SetAttr(result, state->value, value) == -1) Branch (3872:13): [True: 0, False: 132]
|
3873 | goto failed; |
3874 | Py_DECREF(value); |
3875 | value = ast2obj_int(state, o->v.AnnAssign.simple); |
3876 | if (!value) goto failed0 ; Branch (3876:13): [True: 0, False: 132]
|
3877 | if (PyObject_SetAttr(result, state->simple, value) == -1) Branch (3877:13): [True: 0, False: 132]
|
3878 | goto failed; |
3879 | Py_DECREF(value); |
3880 | break; |
3881 | case For_kind: Branch (3881:5): [True: 2.72k, False: 156k]
|
3882 | tp = (PyTypeObject *)state->For_type; |
3883 | result = PyType_GenericNew(tp, NULL, NULL); |
3884 | if (!result) goto failed0 ; Branch (3884:13): [True: 0, False: 2.72k]
|
3885 | value = ast2obj_expr(state, o->v.For.target); |
3886 | if (!value) goto failed0 ; Branch (3886:13): [True: 0, False: 2.72k]
|
3887 | if (PyObject_SetAttr(result, state->target, value) == -1) Branch (3887:13): [True: 0, False: 2.72k]
|
3888 | goto failed; |
3889 | Py_DECREF(value); |
3890 | value = ast2obj_expr(state, o->v.For.iter); |
3891 | if (!value) goto failed0 ; Branch (3891:13): [True: 0, False: 2.72k]
|
3892 | if (PyObject_SetAttr(result, state->iter, value) == -1) Branch (3892:13): [True: 0, False: 2.72k]
|
3893 | goto failed; |
3894 | Py_DECREF(value); |
3895 | value = ast2obj_list(state, (asdl_seq*)o->v.For.body, ast2obj_stmt); |
3896 | if (!value) goto failed0 ; Branch (3896:13): [True: 0, False: 2.72k]
|
3897 | if (PyObject_SetAttr(result, state->body, value) == -1) Branch (3897:13): [True: 0, False: 2.72k]
|
3898 | goto failed; |
3899 | Py_DECREF(value); |
3900 | value = ast2obj_list(state, (asdl_seq*)o->v.For.orelse, ast2obj_stmt); |
3901 | if (!value) goto failed0 ; Branch (3901:13): [True: 0, False: 2.72k]
|
3902 | if (PyObject_SetAttr(result, state->orelse, value) == -1) Branch (3902:13): [True: 0, False: 2.72k]
|
3903 | goto failed; |
3904 | Py_DECREF(value); |
3905 | value = ast2obj_string(state, o->v.For.type_comment); |
3906 | if (!value) goto failed0 ; Branch (3906:13): [True: 0, False: 2.72k]
|
3907 | if (PyObject_SetAttr(result, state->type_comment, value) == -1) Branch (3907:13): [True: 0, False: 2.72k]
|
3908 | goto failed; |
3909 | Py_DECREF(value); |
3910 | break; |
3911 | case AsyncFor_kind: Branch (3911:5): [True: 39, False: 159k]
|
3912 | tp = (PyTypeObject *)state->AsyncFor_type; |
3913 | result = PyType_GenericNew(tp, NULL, NULL); |
3914 | if (!result) goto failed0 ; Branch (3914:13): [True: 0, False: 39]
|
3915 | value = ast2obj_expr(state, o->v.AsyncFor.target); |
3916 | if (!value) goto failed0 ; Branch (3916:13): [True: 0, False: 39]
|
3917 | if (PyObject_SetAttr(result, state->target, value) == -1) Branch (3917:13): [True: 0, False: 39]
|
3918 | goto failed; |
3919 | Py_DECREF(value); |
3920 | value = ast2obj_expr(state, o->v.AsyncFor.iter); |
3921 | if (!value) goto failed0 ; Branch (3921:13): [True: 0, False: 39]
|
3922 | if (PyObject_SetAttr(result, state->iter, value) == -1) Branch (3922:13): [True: 0, False: 39]
|
3923 | goto failed; |
3924 | Py_DECREF(value); |
3925 | value = ast2obj_list(state, (asdl_seq*)o->v.AsyncFor.body, |
3926 | ast2obj_stmt); |
3927 | if (!value) goto failed0 ; Branch (3927:13): [True: 0, False: 39]
|
3928 | if (PyObject_SetAttr(result, state->body, value) == -1) Branch (3928:13): [True: 0, False: 39]
|
3929 | goto failed; |
3930 | Py_DECREF(value); |
3931 | value = ast2obj_list(state, (asdl_seq*)o->v.AsyncFor.orelse, |
3932 | ast2obj_stmt); |
3933 | if (!value) goto failed0 ; Branch (3933:13): [True: 0, False: 39]
|
3934 | if (PyObject_SetAttr(result, state->orelse, value) == -1) Branch (3934:13): [True: 0, False: 39]
|
3935 | goto failed; |
3936 | Py_DECREF(value); |
3937 | value = ast2obj_string(state, o->v.AsyncFor.type_comment); |
3938 | if (!value) goto failed0 ; Branch (3938:13): [True: 0, False: 39]
|
3939 | if (PyObject_SetAttr(result, state->type_comment, value) == -1) Branch (3939:13): [True: 0, False: 39]
|
3940 | goto failed; |
3941 | Py_DECREF(value); |
3942 | break; |
3943 | case While_kind: Branch (3943:5): [True: 689, False: 158k]
|
3944 | tp = (PyTypeObject *)state->While_type; |
3945 | result = PyType_GenericNew(tp, NULL, NULL); |
3946 | if (!result) goto failed0 ; Branch (3946:13): [True: 0, False: 689]
|
3947 | value = ast2obj_expr(state, o->v.While.test); |
3948 | if (!value) goto failed0 ; Branch (3948:13): [True: 0, False: 689]
|
3949 | if (PyObject_SetAttr(result, state->test, value) == -1) Branch (3949:13): [True: 0, False: 689]
|
3950 | goto failed; |
3951 | Py_DECREF(value); |
3952 | value = ast2obj_list(state, (asdl_seq*)o->v.While.body, ast2obj_stmt); |
3953 | if (!value) goto failed0 ; Branch (3953:13): [True: 0, False: 689]
|
3954 | if (PyObject_SetAttr(result, state->body, value) == -1) Branch (3954:13): [True: 0, False: 689]
|
3955 | goto failed; |
3956 | Py_DECREF(value); |
3957 | value = ast2obj_list(state, (asdl_seq*)o->v.While.orelse, ast2obj_stmt); |
3958 | if (!value) goto failed0 ; Branch (3958:13): [True: 0, False: 689]
|
3959 | if (PyObject_SetAttr(result, state->orelse, value) == -1) Branch (3959:13): [True: 0, False: 689]
|
3960 | goto failed; |
3961 | Py_DECREF(value); |
3962 | break; |
3963 | case If_kind: Branch (3963:5): [True: 16.4k, False: 143k]
|
3964 | tp = (PyTypeObject *)state->If_type; |
3965 | result = PyType_GenericNew(tp, NULL, NULL); |
3966 | if (!result) goto failed0 ; Branch (3966:13): [True: 0, False: 16.4k]
|
3967 | value = ast2obj_expr(state, o->v.If.test); |
3968 | if (!value) goto failed0 ; Branch (3968:13): [True: 0, False: 16.4k]
|
3969 | if (PyObject_SetAttr(result, state->test, value) == -1) Branch (3969:13): [True: 0, False: 16.4k]
|
3970 | goto failed; |
3971 | Py_DECREF(value); |
3972 | value = ast2obj_list(state, (asdl_seq*)o->v.If.body, ast2obj_stmt); |
3973 | if (!value) goto failed0 ; Branch (3973:13): [True: 0, False: 16.4k]
|
3974 | if (PyObject_SetAttr(result, state->body, value) == -1) Branch (3974:13): [True: 0, False: 16.4k]
|
3975 | goto failed; |
3976 | Py_DECREF(value); |
3977 | value = ast2obj_list(state, (asdl_seq*)o->v.If.orelse, ast2obj_stmt); |
3978 | if (!value) goto failed0 ; Branch (3978:13): [True: 0, False: 16.4k]
|
3979 | if (PyObject_SetAttr(result, state->orelse, value) == -1) Branch (3979:13): [True: 0, False: 16.4k]
|
3980 | goto failed; |
3981 | Py_DECREF(value); |
3982 | break; |
3983 | case With_kind: Branch (3983:5): [True: 1.43k, False: 158k]
|
3984 | tp = (PyTypeObject *)state->With_type; |
3985 | result = PyType_GenericNew(tp, NULL, NULL); |
3986 | if (!result) goto failed0 ; Branch (3986:13): [True: 0, False: 1.43k]
|
3987 | value = ast2obj_list(state, (asdl_seq*)o->v.With.items, |
3988 | ast2obj_withitem); |
3989 | if (!value) goto failed0 ; Branch (3989:13): [True: 0, False: 1.43k]
|
3990 | if (PyObject_SetAttr(result, state->items, value) == -1) Branch (3990:13): [True: 0, False: 1.43k]
|
3991 | goto failed; |
3992 | Py_DECREF(value); |
3993 | value = ast2obj_list(state, (asdl_seq*)o->v.With.body, ast2obj_stmt); |
3994 | if (!value) goto failed0 ; Branch (3994:13): [True: 0, False: 1.43k]
|
3995 | if (PyObject_SetAttr(result, state->body, value) == -1) Branch (3995:13): [True: 0, False: 1.43k]
|
3996 | goto failed; |
3997 | Py_DECREF(value); |
3998 | value = ast2obj_string(state, o->v.With.type_comment); |
3999 | if (!value) goto failed0 ; Branch (3999:13): [True: 0, False: 1.43k]
|
4000 | if (PyObject_SetAttr(result, state->type_comment, value) == -1) Branch (4000:13): [True: 0, False: 1.43k]
|
4001 | goto failed; |
4002 | Py_DECREF(value); |
4003 | break; |
4004 | case AsyncWith_kind: Branch (4004:5): [True: 29, False: 159k]
|
4005 | tp = (PyTypeObject *)state->AsyncWith_type; |
4006 | result = PyType_GenericNew(tp, NULL, NULL); |
4007 | if (!result) goto failed0 ; Branch (4007:13): [True: 0, False: 29]
|
4008 | value = ast2obj_list(state, (asdl_seq*)o->v.AsyncWith.items, |
4009 | ast2obj_withitem); |
4010 | if (!value) goto failed0 ; Branch (4010:13): [True: 0, False: 29]
|
4011 | if (PyObject_SetAttr(result, state->items, value) == -1) Branch (4011:13): [True: 0, False: 29]
|
4012 | goto failed; |
4013 | Py_DECREF(value); |
4014 | value = ast2obj_list(state, (asdl_seq*)o->v.AsyncWith.body, |
4015 | ast2obj_stmt); |
4016 | if (!value) goto failed0 ; Branch (4016:13): [True: 0, False: 29]
|
4017 | if (PyObject_SetAttr(result, state->body, value) == -1) Branch (4017:13): [True: 0, False: 29]
|
4018 | goto failed; |
4019 | Py_DECREF(value); |
4020 | value = ast2obj_string(state, o->v.AsyncWith.type_comment); |
4021 | if (!value) goto failed0 ; Branch (4021:13): [True: 0, False: 29]
|
4022 | if (PyObject_SetAttr(result, state->type_comment, value) == -1) Branch (4022:13): [True: 0, False: 29]
|
4023 | goto failed; |
4024 | Py_DECREF(value); |
4025 | break; |
4026 | case Match_kind: Branch (4026:5): [True: 536, False: 158k]
|
4027 | tp = (PyTypeObject *)state->Match_type; |
4028 | result = PyType_GenericNew(tp, NULL, NULL); |
4029 | if (!result) goto failed0 ; Branch (4029:13): [True: 0, False: 536]
|
4030 | value = ast2obj_expr(state, o->v.Match.subject); |
4031 | if (!value) goto failed0 ; Branch (4031:13): [True: 0, False: 536]
|
4032 | if (PyObject_SetAttr(result, state->subject, value) == -1) Branch (4032:13): [True: 0, False: 536]
|
4033 | goto failed; |
4034 | Py_DECREF(value); |
4035 | value = ast2obj_list(state, (asdl_seq*)o->v.Match.cases, |
4036 | ast2obj_match_case); |
4037 | if (!value) goto failed0 ; Branch (4037:13): [True: 0, False: 536]
|
4038 | if (PyObject_SetAttr(result, state->cases, value) == -1) Branch (4038:13): [True: 0, False: 536]
|
4039 | goto failed; |
4040 | Py_DECREF(value); |
4041 | break; |
4042 | case Raise_kind: Branch (4042:5): [True: 3.59k, False: 155k]
|
4043 | tp = (PyTypeObject *)state->Raise_type; |
4044 | result = PyType_GenericNew(tp, NULL, NULL); |
4045 | if (!result) goto failed0 ; Branch (4045:13): [True: 0, False: 3.59k]
|
4046 | value = ast2obj_expr(state, o->v.Raise.exc); |
4047 | if (!value) goto failed0 ; Branch (4047:13): [True: 0, False: 3.59k]
|
4048 | if (PyObject_SetAttr(result, state->exc, value) == -1) Branch (4048:13): [True: 0, False: 3.59k]
|
4049 | goto failed; |
4050 | Py_DECREF(value); |
4051 | value = ast2obj_expr(state, o->v.Raise.cause); |
4052 | if (!value) goto failed0 ; Branch (4052:13): [True: 0, False: 3.59k]
|
4053 | if (PyObject_SetAttr(result, state->cause, value) == -1) Branch (4053:13): [True: 0, False: 3.59k]
|
4054 | goto failed; |
4055 | Py_DECREF(value); |
4056 | break; |
4057 | case Try_kind: Branch (4057:5): [True: 2.40k, False: 157k]
|
4058 | tp = (PyTypeObject *)state->Try_type; |
4059 | result = PyType_GenericNew(tp, NULL, NULL); |
4060 | if (!result) goto failed0 ; Branch (4060:13): [True: 0, False: 2.40k]
|
4061 | value = ast2obj_list(state, (asdl_seq*)o->v.Try.body, ast2obj_stmt); |
4062 | if (!value) goto failed0 ; Branch (4062:13): [True: 0, False: 2.40k]
|
4063 | if (PyObject_SetAttr(result, state->body, value) == -1) Branch (4063:13): [True: 0, False: 2.40k]
|
4064 | goto failed; |
4065 | Py_DECREF(value); |
4066 | value = ast2obj_list(state, (asdl_seq*)o->v.Try.handlers, |
4067 | ast2obj_excepthandler); |
4068 | if (!value) goto failed0 ; Branch (4068:13): [True: 0, False: 2.40k]
|
4069 | if (PyObject_SetAttr(result, state->handlers, value) == -1) Branch (4069:13): [True: 0, False: 2.40k]
|
4070 | goto failed; |
4071 | Py_DECREF(value); |
4072 | value = ast2obj_list(state, (asdl_seq*)o->v.Try.orelse, ast2obj_stmt); |
4073 | if (!value) goto failed0 ; Branch (4073:13): [True: 0, False: 2.40k]
|
4074 | if (PyObject_SetAttr(result, state->orelse, value) == -1) Branch (4074:13): [True: 0, False: 2.40k]
|
4075 | goto failed; |
4076 | Py_DECREF(value); |
4077 | value = ast2obj_list(state, (asdl_seq*)o->v.Try.finalbody, |
4078 | ast2obj_stmt); |
4079 | if (!value) goto failed0 ; Branch (4079:13): [True: 0, False: 2.40k]
|
4080 | if (PyObject_SetAttr(result, state->finalbody, value) == -1) Branch (4080:13): [True: 0, False: 2.40k]
|
4081 | goto failed; |
4082 | Py_DECREF(value); |
4083 | break; |
4084 | case TryStar_kind: Branch (4084:5): [True: 19, False: 159k]
|
4085 | tp = (PyTypeObject *)state->TryStar_type; |
4086 | result = PyType_GenericNew(tp, NULL, NULL); |
4087 | if (!result) goto failed0 ; Branch (4087:13): [True: 0, False: 19]
|
4088 | value = ast2obj_list(state, (asdl_seq*)o->v.TryStar.body, ast2obj_stmt); |
4089 | if (!value) goto failed0 ; Branch (4089:13): [True: 0, False: 19]
|
4090 | if (PyObject_SetAttr(result, state->body, value) == -1) Branch (4090:13): [True: 0, False: 19]
|
4091 | goto failed; |
4092 | Py_DECREF(value); |
4093 | value = ast2obj_list(state, (asdl_seq*)o->v.TryStar.handlers, |
4094 | ast2obj_excepthandler); |
4095 | if (!value) goto failed0 ; Branch (4095:13): [True: 0, False: 19]
|
4096 | if (PyObject_SetAttr(result, state->handlers, value) == -1) Branch (4096:13): [True: 0, False: 19]
|
4097 | goto failed; |
4098 | Py_DECREF(value); |
4099 | value = ast2obj_list(state, (asdl_seq*)o->v.TryStar.orelse, |
4100 | ast2obj_stmt); |
4101 | if (!value) goto failed0 ; Branch (4101:13): [True: 0, False: 19]
|
4102 | if (PyObject_SetAttr(result, state->orelse, value) == -1) Branch (4102:13): [True: 0, False: 19]
|
4103 | goto failed; |
4104 | Py_DECREF(value); |
4105 | value = ast2obj_list(state, (asdl_seq*)o->v.TryStar.finalbody, |
4106 | ast2obj_stmt); |
4107 | if (!value) goto failed0 ; Branch (4107:13): [True: 0, False: 19]
|
4108 | if (PyObject_SetAttr(result, state->finalbody, value) == -1) Branch (4108:13): [True: 0, False: 19]
|
4109 | goto failed; |
4110 | Py_DECREF(value); |
4111 | break; |
4112 | case Assert_kind: Branch (4112:5): [True: 339, False: 159k]
|
4113 | tp = (PyTypeObject *)state->Assert_type; |
4114 | result = PyType_GenericNew(tp, NULL, NULL); |
4115 | if (!result) goto failed0 ; Branch (4115:13): [True: 0, False: 339]
|
4116 | value = ast2obj_expr(state, o->v.Assert.test); |
4117 | if (!value) goto failed0 ; Branch (4117:13): [True: 0, False: 339]
|
4118 | if (PyObject_SetAttr(result, state->test, value) == -1) Branch (4118:13): [True: 0, False: 339]
|
4119 | goto failed; |
4120 | Py_DECREF(value); |
4121 | value = ast2obj_expr(state, o->v.Assert.msg); |
4122 | if (!value) goto failed0 ; Branch (4122:13): [True: 0, False: 339]
|
4123 | if (PyObject_SetAttr(result, state->msg, value) == -1) Branch (4123:13): [True: 0, False: 339]
|
4124 | goto failed; |
4125 | Py_DECREF(value); |
4126 | break; |
4127 | case Import_kind: Branch (4127:5): [True: 1.93k, False: 157k]
|
4128 | tp = (PyTypeObject *)state->Import_type; |
4129 | result = PyType_GenericNew(tp, NULL, NULL); |
4130 | if (!result) goto failed0 ; Branch (4130:13): [True: 0, False: 1.93k]
|
4131 | value = ast2obj_list(state, (asdl_seq*)o->v.Import.names, |
4132 | ast2obj_alias); |
4133 | if (!value) goto failed0 ; Branch (4133:13): [True: 0, False: 1.93k]
|
4134 | if (PyObject_SetAttr(result, state->names, value) == -1) Branch (4134:13): [True: 0, False: 1.93k]
|
4135 | goto failed; |
4136 | Py_DECREF(value); |
4137 | break; |
4138 | case ImportFrom_kind: Branch (4138:5): [True: 893, False: 158k]
|
4139 | tp = (PyTypeObject *)state->ImportFrom_type; |
4140 | result = PyType_GenericNew(tp, NULL, NULL); |
4141 | if (!result) goto failed0 ; Branch (4141:13): [True: 0, False: 893]
|
4142 | value = ast2obj_identifier(state, o->v.ImportFrom.module); |
4143 | if (!value) goto failed0 ; Branch (4143:13): [True: 0, False: 893]
|
4144 | if (PyObject_SetAttr(result, state->module, value) == -1) Branch (4144:13): [True: 0, False: 893]
|
4145 | goto failed; |
4146 | Py_DECREF(value); |
4147 | value = ast2obj_list(state, (asdl_seq*)o->v.ImportFrom.names, |
4148 | ast2obj_alias); |
4149 | if (!value) goto failed0 ; Branch (4149:13): [True: 0, False: 893]
|
4150 | if (PyObject_SetAttr(result, state->names, value) == -1) Branch (4150:13): [True: 0, False: 893]
|
4151 | goto failed; |
4152 | Py_DECREF(value); |
4153 | value = ast2obj_int(state, o->v.ImportFrom.level); |
4154 | if (!value) goto failed0 ; Branch (4154:13): [True: 0, False: 893]
|
4155 | if (PyObject_SetAttr(result, state->level, value) == -1) Branch (4155:13): [True: 0, False: 893]
|
4156 | goto failed; |
4157 | Py_DECREF(value); |
4158 | break; |
4159 | case Global_kind: Branch (4159:5): [True: 105, False: 159k]
|
4160 | tp = (PyTypeObject *)state->Global_type; |
4161 | result = PyType_GenericNew(tp, NULL, NULL); |
4162 | if (!result) goto failed0 ; Branch (4162:13): [True: 0, False: 105]
|
4163 | value = ast2obj_list(state, (asdl_seq*)o->v.Global.names, |
4164 | ast2obj_identifier); |
4165 | if (!value) goto failed0 ; Branch (4165:13): [True: 0, False: 105]
|
4166 | if (PyObject_SetAttr(result, state->names, value) == -1) Branch (4166:13): [True: 0, False: 105]
|
4167 | goto failed; |
4168 | Py_DECREF(value); |
4169 | break; |
4170 | case Nonlocal_kind: Branch (4170:5): [True: 54, False: 159k]
|
4171 | tp = (PyTypeObject *)state->Nonlocal_type; |
4172 | result = PyType_GenericNew(tp, NULL, NULL); |
4173 | if (!result) goto failed0 ; Branch (4173:13): [True: 0, False: 54]
|
4174 | value = ast2obj_list(state, (asdl_seq*)o->v.Nonlocal.names, |
4175 | ast2obj_identifier); |
4176 | if (!value) goto failed0 ; Branch (4176:13): [True: 0, False: 54]
|
4177 | if (PyObject_SetAttr(result, state->names, value) == -1) Branch (4177:13): [True: 0, False: 54]
|
4178 | goto failed; |
4179 | Py_DECREF(value); |
4180 | break; |
4181 | case Expr_kind: Branch (4181:5): [True: 35.7k, False: 123k]
|
4182 | tp = (PyTypeObject *)state->Expr_type; |
4183 | result = PyType_GenericNew(tp, NULL, NULL); |
4184 | if (!result) goto failed0 ; Branch (4184:13): [True: 0, False: 35.7k]
|
4185 | value = ast2obj_expr(state, o->v.Expr.value); |
4186 | if (!value) goto failed0 ; Branch (4186:13): [True: 0, False: 35.7k]
|
4187 | if (PyObject_SetAttr(result, state->value, value) == -1) Branch (4187:13): [True: 0, False: 35.7k]
|
4188 | goto failed; |
4189 | Py_DECREF(value); |
4190 | break; |
4191 | case Pass_kind: Branch (4191:5): [True: 4.66k, False: 154k]
|
4192 | tp = (PyTypeObject *)state->Pass_type; |
4193 | result = PyType_GenericNew(tp, NULL, NULL); |
4194 | if (!result) goto failed0 ; Branch (4194:13): [True: 0, False: 4.66k]
|
4195 | break; |
4196 | case Break_kind: Branch (4196:5): [True: 543, False: 158k]
|
4197 | tp = (PyTypeObject *)state->Break_type; |
4198 | result = PyType_GenericNew(tp, NULL, NULL); |
4199 | if (!result) goto failed0 ; Branch (4199:13): [True: 0, False: 543]
|
4200 | break; |
4201 | case Continue_kind: Branch (4201:5): [True: 452, False: 159k]
|
4202 | tp = (PyTypeObject *)state->Continue_type; |
4203 | result = PyType_GenericNew(tp, NULL, NULL); |
4204 | if (!result) goto failed0 ; Branch (4204:13): [True: 0, False: 452]
|
4205 | break; |
4206 | } |
4207 | value = ast2obj_int(state, o->lineno); |
4208 | if (!value) goto failed0 ; Branch (4208:9): [True: 0, False: 159k]
|
4209 | if (PyObject_SetAttr(result, state->lineno, value) < 0) Branch (4209:9): [True: 0, False: 159k]
|
4210 | goto failed; |
4211 | Py_DECREF(value); |
4212 | value = ast2obj_int(state, o->col_offset); |
4213 | if (!value) goto failed0 ; Branch (4213:9): [True: 0, False: 159k]
|
4214 | if (PyObject_SetAttr(result, state->col_offset, value) < 0) Branch (4214:9): [True: 0, False: 159k]
|
4215 | goto failed; |
4216 | Py_DECREF(value); |
4217 | value = ast2obj_int(state, o->end_lineno); |
4218 | if (!value) goto failed0 ; Branch (4218:9): [True: 0, False: 159k]
|
4219 | if (PyObject_SetAttr(result, state->end_lineno, value) < 0) Branch (4219:9): [True: 0, False: 159k]
|
4220 | goto failed; |
4221 | Py_DECREF(value); |
4222 | value = ast2obj_int(state, o->end_col_offset); |
4223 | if (!value) goto failed0 ; Branch (4223:9): [True: 0, False: 159k]
|
4224 | if (PyObject_SetAttr(result, state->end_col_offset, value) < 0) Branch (4224:9): [True: 0, False: 159k]
|
4225 | goto failed; |
4226 | Py_DECREF(value); |
4227 | return result; |
4228 | failed: |
4229 | Py_XDECREF(value); |
4230 | Py_XDECREF(result); |
4231 | return NULL; |
4232 | } |
4233 | |
4234 | PyObject* |
4235 | ast2obj_expr(struct ast_state *state, void* _o) |
4236 | { |
4237 | expr_ty o = (expr_ty)_o; |
4238 | PyObject *result = NULL, *value = NULL; |
4239 | PyTypeObject *tp; |
4240 | if (!o) { Branch (4240:9): [True: 64.8k, False: 603k]
|
4241 | Py_RETURN_NONE; |
4242 | } |
4243 | switch (o->kind) { Branch (4243:13): [True: 0, False: 603k]
|
4244 | case BoolOp_kind: Branch (4244:5): [True: 3.45k, False: 599k]
|
4245 | tp = (PyTypeObject *)state->BoolOp_type; |
4246 | result = PyType_GenericNew(tp, NULL, NULL); |
4247 | if (!result) goto failed0 ; Branch (4247:13): [True: 0, False: 3.45k]
|
4248 | value = ast2obj_boolop(state, o->v.BoolOp.op); |
4249 | if (!value) goto failed0 ; Branch (4249:13): [True: 0, False: 3.45k]
|
4250 | if (PyObject_SetAttr(result, state->op, value) == -1) Branch (4250:13): [True: 0, False: 3.45k]
|
4251 | goto failed; |
4252 | Py_DECREF(value); |
4253 | value = ast2obj_list(state, (asdl_seq*)o->v.BoolOp.values, |
4254 | ast2obj_expr); |
4255 | if (!value) goto failed0 ; Branch (4255:13): [True: 0, False: 3.45k]
|
4256 | if (PyObject_SetAttr(result, state->values, value) == -1) Branch (4256:13): [True: 0, False: 3.45k]
|
4257 | goto failed; |
4258 | Py_DECREF(value); |
4259 | break; |
4260 | case NamedExpr_kind: Branch (4260:5): [True: 60, False: 602k]
|
4261 | tp = (PyTypeObject *)state->NamedExpr_type; |
4262 | result = PyType_GenericNew(tp, NULL, NULL); |
4263 | if (!result) goto failed0 ; Branch (4263:13): [True: 0, False: 60]
|
4264 | value = ast2obj_expr(state, o->v.NamedExpr.target); |
4265 | if (!value) goto failed0 ; Branch (4265:13): [True: 0, False: 60]
|
4266 | if (PyObject_SetAttr(result, state->target, value) == -1) Branch (4266:13): [True: 0, False: 60]
|
4267 | goto failed; |
4268 | Py_DECREF(value); |
4269 | value = ast2obj_expr(state, o->v.NamedExpr.value); |
4270 | if (!value) goto failed0 ; Branch (4270:13): [True: 0, False: 60]
|
4271 | if (PyObject_SetAttr(result, state->value, value) == -1) Branch (4271:13): [True: 0, False: 60]
|
4272 | goto failed; |
4273 | Py_DECREF(value); |
4274 | break; |
4275 | case BinOp_kind: Branch (4275:5): [True: 12.2k, False: 590k]
|
4276 | tp = (PyTypeObject *)state->BinOp_type; |
4277 | result = PyType_GenericNew(tp, NULL, NULL); |
4278 | if (!result) goto failed0 ; Branch (4278:13): [True: 0, False: 12.2k]
|
4279 | value = ast2obj_expr(state, o->v.BinOp.left); |
4280 | if (!value) goto failed0 ; Branch (4280:13): [True: 0, False: 12.2k]
|
4281 | if (PyObject_SetAttr(result, state->left, value) == -1) Branch (4281:13): [True: 0, False: 12.2k]
|
4282 | goto failed; |
4283 | Py_DECREF(value); |
4284 | value = ast2obj_operator(state, o->v.BinOp.op); |
4285 | if (!value) goto failed0 ; Branch (4285:13): [True: 0, False: 12.2k]
|
4286 | if (PyObject_SetAttr(result, state->op, value) == -1) Branch (4286:13): [True: 0, False: 12.2k]
|
4287 | goto failed; |
4288 | Py_DECREF(value); |
4289 | value = ast2obj_expr(state, o->v.BinOp.right); |
4290 | if (!value) goto failed0 ; Branch (4290:13): [True: 0, False: 12.2k]
|
4291 | if (PyObject_SetAttr(result, state->right, value) == -1) Branch (4291:13): [True: 0, False: 12.2k]
|
4292 | goto failed; |
4293 | Py_DECREF(value); |
4294 | break; |
4295 | case UnaryOp_kind: Branch (4295:5): [True: 4.67k, False: 598k]
|
4296 | tp = (PyTypeObject *)state->UnaryOp_type; |
4297 | result = PyType_GenericNew(tp, NULL, NULL); |
4298 | if (!result) goto failed0 ; Branch (4298:13): [True: 0, False: 4.67k]
|
4299 | value = ast2obj_unaryop(state, o->v.UnaryOp.op); |
4300 | if (!value) goto failed0 ; Branch (4300:13): [True: 0, False: 4.67k]
|
4301 | if (PyObject_SetAttr(result, state->op, value) == -1) Branch (4301:13): [True: 0, False: 4.67k]
|
4302 | goto failed; |
4303 | Py_DECREF(value); |
4304 | value = ast2obj_expr(state, o->v.UnaryOp.operand); |
4305 | if (!value) goto failed0 ; Branch (4305:13): [True: 0, False: 4.67k]
|
4306 | if (PyObject_SetAttr(result, state->operand, value) == -1) Branch (4306:13): [True: 0, False: 4.67k]
|
4307 | goto failed; |
4308 | Py_DECREF(value); |
4309 | break; |
4310 | case Lambda_kind: Branch (4310:5): [True: 579, False: 602k]
|
4311 | tp = (PyTypeObject *)state->Lambda_type; |
4312 | result = PyType_GenericNew(tp, NULL, NULL); |
4313 | if (!result) goto failed0 ; Branch (4313:13): [True: 0, False: 579]
|
4314 | value = ast2obj_arguments(state, o->v.Lambda.args); |
4315 | if (!value) goto failed0 ; Branch (4315:13): [True: 0, False: 579]
|
4316 | if (PyObject_SetAttr(result, state->args, value) == -1) Branch (4316:13): [True: 0, False: 579]
|
4317 | goto failed; |
4318 | Py_DECREF(value); |
4319 | value = ast2obj_expr(state, o->v.Lambda.body); |
4320 | if (!value) goto failed0 ; Branch (4320:13): [True: 0, False: 579]
|
4321 | if (PyObject_SetAttr(result, state->body, value) == -1) Branch (4321:13): [True: 0, False: 579]
|
4322 | goto failed; |
4323 | Py_DECREF(value); |
4324 | break; |
4325 | case IfExp_kind: Branch (4325:5): [True: 449, False: 602k]
|
4326 | tp = (PyTypeObject *)state->IfExp_type; |
4327 | result = PyType_GenericNew(tp, NULL, NULL); |
4328 | if (!result) goto failed0 ; Branch (4328:13): [True: 0, False: 449]
|
4329 | value = ast2obj_expr(state, o->v.IfExp.test); |
4330 | if (!value) goto failed0 ; Branch (4330:13): [True: 0, False: 449]
|
4331 | if (PyObject_SetAttr(result, state->test, value) == -1) Branch (4331:13): [True: 0, False: 449]
|
4332 | goto failed; |
4333 | Py_DECREF(value); |
4334 | value = ast2obj_expr(state, o->v.IfExp.body); |
4335 | if (!value) goto failed0 ; Branch (4335:13): [True: 0, False: 449]
|
4336 | if (PyObject_SetAttr(result, state->body, value) == -1) Branch (4336:13): [True: 0, False: 449]
|
4337 | goto failed; |
4338 | Py_DECREF(value); |
4339 | value = ast2obj_expr(state, o->v.IfExp.orelse); |
4340 | if (!value) goto failed0 ; Branch (4340:13): [True: 0, False: 449]
|
4341 | if (PyObject_SetAttr(result, state->orelse, value) == -1) Branch (4341:13): [True: 0, False: 449]
|
4342 | goto failed; |
4343 | Py_DECREF(value); |
4344 | break; |
4345 | case Dict_kind: Branch (4345:5): [True: 1.78k, False: 601k]
|
4346 | tp = (PyTypeObject *)state->Dict_type; |
4347 | result = PyType_GenericNew(tp, NULL, NULL); |
4348 | if (!result) goto failed0 ; Branch (4348:13): [True: 0, False: 1.78k]
|
4349 | value = ast2obj_list(state, (asdl_seq*)o->v.Dict.keys, ast2obj_expr); |
4350 | if (!value) goto failed0 ; Branch (4350:13): [True: 0, False: 1.78k]
|
4351 | if (PyObject_SetAttr(result, state->keys, value) == -1) Branch (4351:13): [True: 0, False: 1.78k]
|
4352 | goto failed; |
4353 | Py_DECREF(value); |
4354 | value = ast2obj_list(state, (asdl_seq*)o->v.Dict.values, ast2obj_expr); |
4355 | if (!value) goto failed0 ; Branch (4355:13): [True: 0, False: 1.78k]
|
4356 | if (PyObject_SetAttr(result, state->values, value) == -1) Branch (4356:13): [True: 0, False: 1.78k]
|
4357 | goto failed; |
4358 | Py_DECREF(value); |
4359 | break; |
4360 | case Set_kind: Branch (4360:5): [True: 264, False: 602k]
|
4361 | tp = (PyTypeObject *)state->Set_type; |
4362 | result = PyType_GenericNew(tp, NULL, NULL); |
4363 | if (!result) goto failed0 ; Branch (4363:13): [True: 0, False: 264]
|
4364 | value = ast2obj_list(state, (asdl_seq*)o->v.Set.elts, ast2obj_expr); |
4365 | if (!value) goto failed0 ; Branch (4365:13): [True: 0, False: 264]
|
4366 | if (PyObject_SetAttr(result, state->elts, value) == -1) Branch (4366:13): [True: 0, False: 264]
|
4367 | goto failed; |
4368 | Py_DECREF(value); |
4369 | break; |
4370 | case ListComp_kind: Branch (4370:5): [True: 626, False: 602k]
|
4371 | tp = (PyTypeObject *)state->ListComp_type; |
4372 | result = PyType_GenericNew(tp, NULL, NULL); |
4373 | if (!result) goto failed0 ; Branch (4373:13): [True: 0, False: 626]
|
4374 | value = ast2obj_expr(state, o->v.ListComp.elt); |
4375 | if (!value) goto failed0 ; Branch (4375:13): [True: 0, False: 626]
|
4376 | if (PyObject_SetAttr(result, state->elt, value) == -1) Branch (4376:13): [True: 0, False: 626]
|
4377 | goto failed; |
4378 | Py_DECREF(value); |
4379 | value = ast2obj_list(state, (asdl_seq*)o->v.ListComp.generators, |
4380 | ast2obj_comprehension); |
4381 | if (!value) goto failed0 ; Branch (4381:13): [True: 0, False: 626]
|
4382 | if (PyObject_SetAttr(result, state->generators, value) == -1) Branch (4382:13): [True: 0, False: 626]
|
4383 | goto failed; |
4384 | Py_DECREF(value); |
4385 | break; |
4386 | case SetComp_kind: Branch (4386:5): [True: 29, False: 602k]
|
4387 | tp = (PyTypeObject *)state->SetComp_type; |
4388 | result = PyType_GenericNew(tp, NULL, NULL); |
4389 | if (!result) goto failed0 ; Branch (4389:13): [True: 0, False: 29]
|
4390 | value = ast2obj_expr(state, o->v.SetComp.elt); |
4391 | if (!value) goto failed0 ; Branch (4391:13): [True: 0, False: 29]
|
4392 | if (PyObject_SetAttr(result, state->elt, value) == -1) Branch (4392:13): [True: 0, False: 29]
|
4393 | goto failed; |
4394 | Py_DECREF(value); |
4395 | value = ast2obj_list(state, (asdl_seq*)o->v.SetComp.generators, |
4396 | ast2obj_comprehension); |
4397 | if (!value) goto failed0 ; Branch (4397:13): [True: 0, False: 29]
|
4398 | if (PyObject_SetAttr(result, state->generators, value) == -1) Branch (4398:13): [True: 0, False: 29]
|
4399 | goto failed; |
4400 | Py_DECREF(value); |
4401 | break; |
4402 | case DictComp_kind: Branch (4402:5): [True: 79, False: 602k]
|
4403 | tp = (PyTypeObject *)state->DictComp_type; |
4404 | result = PyType_GenericNew(tp, NULL, NULL); |
4405 | if (!result) goto failed0 ; Branch (4405:13): [True: 0, False: 79]
|
4406 | value = ast2obj_expr(state, o->v.DictComp.key); |
4407 | if (!value) goto failed0 ; Branch (4407:13): [True: 0, False: 79]
|
4408 | if (PyObject_SetAttr(result, state->key, value) == -1) Branch (4408:13): [True: 0, False: 79]
|
4409 | goto failed; |
4410 | Py_DECREF(value); |
4411 | value = ast2obj_expr(state, o->v.DictComp.value); |
4412 | if (!value) goto failed0 ; Branch (4412:13): [True: 0, False: 79]
|
4413 | if (PyObject_SetAttr(result, state->value, value) == -1) Branch (4413:13): [True: 0, False: 79]
|
4414 | goto failed; |
4415 | Py_DECREF(value); |
4416 | value = ast2obj_list(state, (asdl_seq*)o->v.DictComp.generators, |
4417 | ast2obj_comprehension); |
4418 | if (!value) goto failed0 ; Branch (4418:13): [True: 0, False: 79]
|
4419 | if (PyObject_SetAttr(result, state->generators, value) == -1) Branch (4419:13): [True: 0, False: 79]
|
4420 | goto failed; |
4421 | Py_DECREF(value); |
4422 | break; |
4423 | case GeneratorExp_kind: Branch (4423:5): [True: 459, False: 602k]
|
4424 | tp = (PyTypeObject *)state->GeneratorExp_type; |
4425 | result = PyType_GenericNew(tp, NULL, NULL); |
4426 | if (!result) goto failed0 ; Branch (4426:13): [True: 0, False: 459]
|
4427 | value = ast2obj_expr(state, o->v.GeneratorExp.elt); |
4428 | if (!value) goto failed0 ; Branch (4428:13): [True: 0, False: 459]
|
4429 | if (PyObject_SetAttr(result, state->elt, value) == -1) Branch (4429:13): [True: 0, False: 459]
|
4430 | goto failed; |
4431 | Py_DECREF(value); |
4432 | value = ast2obj_list(state, (asdl_seq*)o->v.GeneratorExp.generators, |
4433 | ast2obj_comprehension); |
4434 | if (!value) goto failed0 ; Branch (4434:13): [True: 0, False: 459]
|
4435 | if (PyObject_SetAttr(result, state->generators, value) == -1) Branch (4435:13): [True: 0, False: 459]
|
4436 | goto failed; |
4437 | Py_DECREF(value); |
4438 | break; |
4439 | case Await_kind: Branch (4439:5): [True: 93, False: 602k]
|
4440 | tp = (PyTypeObject *)state->Await_type; |
4441 | result = PyType_GenericNew(tp, NULL, NULL); |
4442 | if (!result) goto failed0 ; Branch (4442:13): [True: 0, False: 93]
|
4443 | value = ast2obj_expr(state, o->v.Await.value); |
4444 | if (!value) goto failed0 ; Branch (4444:13): [True: 0, False: 93]
|
4445 | if (PyObject_SetAttr(result, state->value, value) == -1) Branch (4445:13): [True: 0, False: 93]
|
4446 | goto failed; |
4447 | Py_DECREF(value); |
4448 | break; |
4449 | case Yield_kind: Branch (4449:5): [True: 474, False: 602k]
|
4450 | tp = (PyTypeObject *)state->Yield_type; |
4451 | result = PyType_GenericNew(tp, NULL, NULL); |
4452 | if (!result) goto failed0 ; Branch (4452:13): [True: 0, False: 474]
|
4453 | value = ast2obj_expr(state, o->v.Yield.value); |
4454 | if (!value) goto failed0 ; Branch (4454:13): [True: 0, False: 474]
|
4455 | if (PyObject_SetAttr(result, state->value, value) == -1) Branch (4455:13): [True: 0, False: 474]
|
4456 | goto failed; |
4457 | Py_DECREF(value); |
4458 | break; |
4459 | case YieldFrom_kind: Branch (4459:5): [True: 101, False: 602k]
|
4460 | tp = (PyTypeObject *)state->YieldFrom_type; |
4461 | result = PyType_GenericNew(tp, NULL, NULL); |
4462 | if (!result) goto failed0 ; Branch (4462:13): [True: 0, False: 101]
|
4463 | value = ast2obj_expr(state, o->v.YieldFrom.value); |
4464 | if (!value) goto failed0 ; Branch (4464:13): [True: 0, False: 101]
|
4465 | if (PyObject_SetAttr(result, state->value, value) == -1) Branch (4465:13): [True: 0, False: 101]
|
4466 | goto failed; |
4467 | Py_DECREF(value); |
4468 | break; |
4469 | case Compare_kind: Branch (4469:5): [True: 12.3k, False: 590k]
|
4470 | tp = (PyTypeObject *)state->Compare_type; |
4471 | result = PyType_GenericNew(tp, NULL, NULL); |
4472 | if (!result) goto failed0 ; Branch (4472:13): [True: 0, False: 12.3k]
|
4473 | value = ast2obj_expr(state, o->v.Compare.left); |
4474 | if (!value) goto failed0 ; Branch (4474:13): [True: 0, False: 12.3k]
|
4475 | if (PyObject_SetAttr(result, state->left, value) == -1) Branch (4475:13): [True: 0, False: 12.3k]
|
4476 | goto failed; |
4477 | Py_DECREF(value); |
4478 | { |
4479 | Py_ssize_t i, n = asdl_seq_LEN(o->v.Compare.ops); |
4480 | value = PyList_New(n); |
4481 | if (!value) goto failed0 ; Branch (4481:17): [True: 0, False: 12.3k]
|
4482 | for(i = 0; 12.3k i < n; i++12.5k ) Branch (4482:24): [True: 12.5k, False: 12.3k]
|
4483 | PyList_SET_ITEM(value, i, ast2obj_cmpop(state, (cmpop_ty)asdl_seq_GET(o->v.Compare.ops, i))); |
4484 | } |
4485 | if (!value) goto failed0 ; Branch (4485:13): [True: 0, False: 12.3k]
|
4486 | if (PyObject_SetAttr(result, state->ops, value) == -1) Branch (4486:13): [True: 0, False: 12.3k]
|
4487 | goto failed; |
4488 | Py_DECREF(value); |
4489 | value = ast2obj_list(state, (asdl_seq*)o->v.Compare.comparators, |
4490 | ast2obj_expr); |
4491 | if (!value) goto failed0 ; Branch (4491:13): [True: 0, False: 12.3k]
|
4492 | if (PyObject_SetAttr(result, state->comparators, value) == -1) Branch (4492:13): [True: 0, False: 12.3k]
|
4493 | goto failed; |
4494 | Py_DECREF(value); |
4495 | break; |
4496 | case Call_kind: Branch (4496:5): [True: 73.6k, False: 529k]
|
4497 | tp = (PyTypeObject *)state->Call_type; |
4498 | result = PyType_GenericNew(tp, NULL, NULL); |
4499 | if (!result) goto failed0 ; Branch (4499:13): [True: 0, False: 73.6k]
|
4500 | value = ast2obj_expr(state, o->v.Call.func); |
4501 | if (!value) goto failed0 ; Branch (4501:13): [True: 0, False: 73.6k]
|
4502 | if (PyObject_SetAttr(result, state->func, value) == -1) Branch (4502:13): [True: 0, False: 73.6k]
|
4503 | goto failed; |
4504 | Py_DECREF(value); |
4505 | value = ast2obj_list(state, (asdl_seq*)o->v.Call.args, ast2obj_expr); |
4506 | if (!value) goto failed0 ; Branch (4506:13): [True: 0, False: 73.6k]
|
4507 | if (PyObject_SetAttr(result, state->args, value) == -1) Branch (4507:13): [True: 0, False: 73.6k]
|
4508 | goto failed; |
4509 | Py_DECREF(value); |
4510 | value = ast2obj_list(state, (asdl_seq*)o->v.Call.keywords, |
4511 | ast2obj_keyword); |
4512 | if (!value) goto failed0 ; Branch (4512:13): [True: 0, False: 73.6k]
|
4513 | if (PyObject_SetAttr(result, state->keywords, value) == -1) Branch (4513:13): [True: 0, False: 73.6k]
|
4514 | goto failed; |
4515 | Py_DECREF(value); |
4516 | break; |
4517 | case FormattedValue_kind: Branch (4517:5): [True: 1.73k, False: 601k]
|
4518 | tp = (PyTypeObject *)state->FormattedValue_type; |
4519 | result = PyType_GenericNew(tp, NULL, NULL); |
4520 | if (!result) goto failed0 ; Branch (4520:13): [True: 0, False: 1.73k]
|
4521 | value = ast2obj_expr(state, o->v.FormattedValue.value); |
4522 | if (!value) goto failed0 ; Branch (4522:13): [True: 0, False: 1.73k]
|
4523 | if (PyObject_SetAttr(result, state->value, value) == -1) Branch (4523:13): [True: 0, False: 1.73k]
|
4524 | goto failed; |
4525 | Py_DECREF(value); |
4526 | value = ast2obj_int(state, o->v.FormattedValue.conversion); |
4527 | if (!value) goto failed0 ; Branch (4527:13): [True: 0, False: 1.73k]
|
4528 | if (PyObject_SetAttr(result, state->conversion, value) == -1) Branch (4528:13): [True: 0, False: 1.73k]
|
4529 | goto failed; |
4530 | Py_DECREF(value); |
4531 | value = ast2obj_expr(state, o->v.FormattedValue.format_spec); |
4532 | if (!value) goto failed0 ; Branch (4532:13): [True: 0, False: 1.73k]
|
4533 | if (PyObject_SetAttr(result, state->format_spec, value) == -1) Branch (4533:13): [True: 0, False: 1.73k]
|
4534 | goto failed; |
4535 | Py_DECREF(value); |
4536 | break; |
4537 | case JoinedStr_kind: Branch (4537:5): [True: 1.53k, False: 601k]
|
4538 | tp = (PyTypeObject *)state->JoinedStr_type; |
4539 | result = PyType_GenericNew(tp, NULL, NULL); |
4540 | if (!result) goto failed0 ; Branch (4540:13): [True: 0, False: 1.53k]
|
4541 | value = ast2obj_list(state, (asdl_seq*)o->v.JoinedStr.values, |
4542 | ast2obj_expr); |
4543 | if (!value) goto failed0 ; Branch (4543:13): [True: 0, False: 1.53k]
|
4544 | if (PyObject_SetAttr(result, state->values, value) == -1) Branch (4544:13): [True: 0, False: 1.53k]
|
4545 | goto failed; |
4546 | Py_DECREF(value); |
4547 | break; |
4548 | case Constant_kind: Branch (4548:5): [True: 114k, False: 488k]
|
4549 | tp = (PyTypeObject *)state->Constant_type; |
4550 | result = PyType_GenericNew(tp, NULL, NULL); |
4551 | if (!result) goto failed0 ; Branch (4551:13): [True: 0, False: 114k]
|
4552 | value = ast2obj_constant(state, o->v.Constant.value); |
4553 | if (!value) goto failed0 ; Branch (4553:13): [True: 0, False: 114k]
|
4554 | if (PyObject_SetAttr(result, state->value, value) == -1) Branch (4554:13): [True: 0, False: 114k]
|
4555 | goto failed; |
4556 | Py_DECREF(value); |
4557 | value = ast2obj_string(state, o->v.Constant.kind); |
4558 | if (!value) goto failed0 ; Branch (4558:13): [True: 0, False: 114k]
|
4559 | if (PyObject_SetAttr(result, state->kind, value) == -1) Branch (4559:13): [True: 0, False: 114k]
|
4560 | goto failed; |
4561 | Py_DECREF(value); |
4562 | break; |
4563 | case Attribute_kind: Branch (4563:5): [True: 79.8k, False: 523k]
|
4564 | tp = (PyTypeObject *)state->Attribute_type; |
4565 | result = PyType_GenericNew(tp, NULL, NULL); |
4566 | if (!result) goto failed0 ; Branch (4566:13): [True: 0, False: 79.8k]
|
4567 | value = ast2obj_expr(state, o->v.Attribute.value); |
4568 | if (!value) goto failed0 ; Branch (4568:13): [True: 0, False: 79.8k]
|
4569 | if (PyObject_SetAttr(result, state->value, value) == -1) Branch (4569:13): [True: 0, False: 79.8k]
|
4570 | goto failed; |
4571 | Py_DECREF(value); |
4572 | value = ast2obj_identifier(state, o->v.Attribute.attr); |
4573 | if (!value) goto failed0 ; Branch (4573:13): [True: 0, False: 79.8k]
|
4574 | if (PyObject_SetAttr(result, state->attr, value) == -1) Branch (4574:13): [True: 0, False: 79.8k]
|
4575 | goto failed; |
4576 | Py_DECREF(value); |
4577 | value = ast2obj_expr_context(state, o->v.Attribute.ctx); |
4578 | if (!value) goto failed0 ; Branch (4578:13): [True: 0, False: 79.8k]
|
4579 | if (PyObject_SetAttr(result, state->ctx, value) == -1) Branch (4579:13): [True: 0, False: 79.8k]
|
4580 | goto failed; |
4581 | Py_DECREF(value); |
4582 | break; |
4583 | case Subscript_kind: Branch (4583:5): [True: 9.27k, False: 593k]
|
4584 | tp = (PyTypeObject *)state->Subscript_type; |
4585 | result = PyType_GenericNew(tp, NULL, NULL); |
4586 | if (!result) goto failed0 ; Branch (4586:13): [True: 0, False: 9.27k]
|
4587 | value = ast2obj_expr(state, o->v.Subscript.value); |
4588 | if (!value) goto failed0 ; Branch (4588:13): [True: 0, False: 9.27k]
|
4589 | if (PyObject_SetAttr(result, state->value, value) == -1) Branch (4589:13): [True: 0, False: 9.27k]
|
4590 | goto failed; |
4591 | Py_DECREF(value); |
4592 | value = ast2obj_expr(state, o->v.Subscript.slice); |
4593 | if (!value) goto failed0 ; Branch (4593:13): [True: 0, False: 9.27k]
|
4594 | if (PyObject_SetAttr(result, state->slice, value) == -1) Branch (4594:13): [True: 0, False: 9.27k]
|
4595 | goto failed; |
4596 | Py_DECREF(value); |
4597 | value = ast2obj_expr_context(state, o->v.Subscript.ctx); |
4598 | if (!value) goto failed0 ; Branch (4598:13): [True: 0, False: 9.27k]
|
4599 | if (PyObject_SetAttr(result, state->ctx, value) == -1) Branch (4599:13): [True: 0, False: 9.27k]
|
4600 | goto failed; |
4601 | Py_DECREF(value); |
4602 | break; |
4603 | case Starred_kind: Branch (4603:5): [True: 791, False: 602k]
|
4604 | tp = (PyTypeObject *)state->Starred_type; |
4605 | result = PyType_GenericNew(tp, NULL, NULL); |
4606 | if (!result) goto failed0 ; Branch (4606:13): [True: 0, False: 791]
|
4607 | value = ast2obj_expr(state, o->v.Starred.value); |
4608 | if (!value) goto failed0 ; Branch (4608:13): [True: 0, False: 791]
|
4609 | if (PyObject_SetAttr(result, state->value, value) == -1) Branch (4609:13): [True: 0, False: 791]
|
4610 | goto failed; |
4611 | Py_DECREF(value); |
4612 | value = ast2obj_expr_context(state, o->v.Starred.ctx); |
4613 | if (!value) goto failed0 ; Branch (4613:13): [True: 0, False: 791]
|
4614 | if (PyObject_SetAttr(result, state->ctx, value) == -1) Branch (4614:13): [True: 0, False: 791]
|
4615 | goto failed; |
4616 | Py_DECREF(value); |
4617 | break; |
4618 | case Name_kind: Branch (4618:5): [True: 262k, False: 340k]
|
4619 | tp = (PyTypeObject *)state->Name_type; |
4620 | result = PyType_GenericNew(tp, NULL, NULL); |
4621 | if (!result) goto failed0 ; Branch (4621:13): [True: 0, False: 262k]
|
4622 | value = ast2obj_identifier(state, o->v.Name.id); |
4623 | if (!value) goto failed0 ; Branch (4623:13): [True: 0, False: 262k]
|
4624 | if (PyObject_SetAttr(result, state->id, value) == -1) Branch (4624:13): [True: 0, False: 262k]
|
4625 | goto failed; |
4626 | Py_DECREF(value); |
4627 | value = ast2obj_expr_context(state, o->v.Name.ctx); |
4628 | if (!value) goto failed0 ; Branch (4628:13): [True: 0, False: 262k]
|
4629 | if (PyObject_SetAttr(result, state->ctx, value) == -1) Branch (4629:13): [True: 0, False: 262k]
|
4630 | goto failed; |
4631 | Py_DECREF(value); |
4632 | break; |
4633 | case List_kind: Branch (4633:5): [True: 5.24k, False: 597k]
|
4634 | tp = (PyTypeObject *)state->List_type; |
4635 | result = PyType_GenericNew(tp, NULL, NULL); |
4636 | if (!result) goto failed0 ; Branch (4636:13): [True: 0, False: 5.24k]
|
4637 | value = ast2obj_list(state, (asdl_seq*)o->v.List.elts, ast2obj_expr); |
4638 | if (!value) goto failed0 ; Branch (4638:13): [True: 0, False: 5.24k]
|
4639 | if (PyObject_SetAttr(result, state->elts, value) == -1) Branch (4639:13): [True: 0, False: 5.24k]
|
4640 | goto failed; |
4641 | Py_DECREF(value); |
4642 | value = ast2obj_expr_context(state, o->v.List.ctx); |
4643 | if (!value) goto failed0 ; Branch (4643:13): [True: 0, False: 5.24k]
|
4644 | if (PyObject_SetAttr(result, state->ctx, value) == -1) Branch (4644:13): [True: 0, False: 5.24k]
|
4645 | goto failed; |
4646 | Py_DECREF(value); |
4647 | break; |
4648 | case Tuple_kind: Branch (4648:5): [True: 13.9k, False: 589k]
|
4649 | tp = (PyTypeObject *)state->Tuple_type; |
4650 | result = PyType_GenericNew(tp, NULL, NULL); |
4651 | if (!result) goto failed0 ; Branch (4651:13): [True: 0, False: 13.9k]
|
4652 | value = ast2obj_list(state, (asdl_seq*)o->v.Tuple.elts, ast2obj_expr); |
4653 | if (!value) goto failed0 ; Branch (4653:13): [True: 0, False: 13.9k]
|
4654 | if (PyObject_SetAttr(result, state->elts, value) == -1) Branch (4654:13): [True: 0, False: 13.9k]
|
4655 | goto failed; |
4656 | Py_DECREF(value); |
4657 | value = ast2obj_expr_context(state, o->v.Tuple.ctx); |
4658 | if (!value) goto failed0 ; Branch (4658:13): [True: 0, False: 13.9k]
|
4659 | if (PyObject_SetAttr(result, state->ctx, value) == -1) Branch (4659:13): [True: 0, False: 13.9k]
|
4660 | goto failed; |
4661 | Py_DECREF(value); |
4662 | break; |
4663 | case Slice_kind: Branch (4663:5): [True: 1.93k, False: 601k]
|
4664 | tp = (PyTypeObject *)state->Slice_type; |
4665 | result = PyType_GenericNew(tp, NULL, NULL); |
4666 | if (!result) goto failed0 ; Branch (4666:13): [True: 0, False: 1.93k]
|
4667 | value = ast2obj_expr(state, o->v.Slice.lower); |
4668 | if (!value) goto failed0 ; Branch (4668:13): [True: 0, False: 1.93k]
|
4669 | if (PyObject_SetAttr(result, state->lower, value) == -1) Branch (4669:13): [True: 0, False: 1.93k]
|
4670 | goto failed; |
4671 | Py_DECREF(value); |
4672 | value = ast2obj_expr(state, o->v.Slice.upper); |
4673 | if (!value) goto failed0 ; Branch (4673:13): [True: 0, False: 1.93k]
|
4674 | if (PyObject_SetAttr(result, state->upper, value) == -1) Branch (4674:13): [True: 0, False: 1.93k]
|
4675 | goto failed; |
4676 | Py_DECREF(value); |
4677 | value = ast2obj_expr(state, o->v.Slice.step); |
4678 | if (!value) goto failed0 ; Branch (4678:13): [True: 0, False: 1.93k]
|
4679 | if (PyObject_SetAttr(result, state->step, value) == -1) Branch (4679:13): [True: 0, False: 1.93k]
|
4680 | goto failed; |
4681 | Py_DECREF(value); |
4682 | break; |
4683 | } |
4684 | value = ast2obj_int(state, o->lineno); |
4685 | if (!value) goto failed0 ; Branch (4685:9): [True: 0, False: 603k]
|
4686 | if (PyObject_SetAttr(result, state->lineno, value) < 0) Branch (4686:9): [True: 0, False: 603k]
|
4687 | goto failed; |
4688 | Py_DECREF(value); |
4689 | value = ast2obj_int(state, o->col_offset); |
4690 | if (!value) goto failed0 ; Branch (4690:9): [True: 0, False: 603k]
|
4691 | if (PyObject_SetAttr(result, state->col_offset, value) < 0) Branch (4691:9): [True: 0, False: 603k]
|
4692 | goto failed; |
4693 | Py_DECREF(value); |
4694 | value = ast2obj_int(state, o->end_lineno); |
4695 | if (!value) goto failed0 ; Branch (4695:9): [True: 0, False: 603k]
|
4696 | if (PyObject_SetAttr(result, state->end_lineno, value) < 0) Branch (4696:9): [True: 0, False: 603k]
|
4697 | goto failed; |
4698 | Py_DECREF(value); |
4699 | value = ast2obj_int(state, o->end_col_offset); |
4700 | if (!value) goto failed0 ; Branch (4700:9): [True: 0, False: 603k]
|
4701 | if (PyObject_SetAttr(result, state->end_col_offset, value) < 0) Branch (4701:9): [True: 0, False: 603k]
|
4702 | goto failed; |
4703 | Py_DECREF(value); |
4704 | return result; |
4705 | failed: |
4706 | Py_XDECREF(value); |
4707 | Py_XDECREF(result); |
4708 | return NULL; |
4709 | } |
4710 | |
4711 | PyObject* ast2obj_expr_context(struct ast_state *state, expr_context_ty o) |
4712 | { |
4713 | switch(o) { Branch (4713:12): [True: 0, False: 371k]
|
4714 | case Load: Branch (4714:9): [True: 307k, False: 64.6k]
|
4715 | Py_INCREF(state->Load_singleton); |
4716 | return state->Load_singleton; |
4717 | case Store: Branch (4717:9): [True: 63.9k, False: 307k]
|
4718 | Py_INCREF(state->Store_singleton); |
4719 | return state->Store_singleton; |
4720 | case Del: Branch (4720:9): [True: 671, False: 371k]
|
4721 | Py_INCREF(state->Del_singleton); |
4722 | return state->Del_singleton; |
4723 | } |
4724 | Py_UNREACHABLE0 (); |
4725 | } |
4726 | PyObject* ast2obj_boolop(struct ast_state *state, boolop_ty o) |
4727 | { |
4728 | switch(o) { Branch (4728:12): [True: 0, False: 3.45k]
|
4729 | case And: Branch (4729:9): [True: 2.17k, False: 1.28k]
|
4730 | Py_INCREF(state->And_singleton); |
4731 | return state->And_singleton; |
4732 | case Or: Branch (4732:9): [True: 1.28k, False: 2.17k]
|
4733 | Py_INCREF(state->Or_singleton); |
4734 | return state->Or_singleton; |
4735 | } |
4736 | Py_UNREACHABLE0 (); |
4737 | } |
4738 | PyObject* ast2obj_operator(struct ast_state *state, operator_ty o) |
4739 | { |
4740 | switch(o) { Branch (4740:12): [True: 0, False: 13.5k]
|
4741 | case Add: Branch (4741:9): [True: 5.46k, False: 8.09k]
|
4742 | Py_INCREF(state->Add_singleton); |
4743 | return state->Add_singleton; |
4744 | case Sub: Branch (4744:9): [True: 1.44k, False: 12.1k]
|
4745 | Py_INCREF(state->Sub_singleton); |
4746 | return state->Sub_singleton; |
4747 | case Mult: Branch (4747:9): [True: 1.21k, False: 12.3k]
|
4748 | Py_INCREF(state->Mult_singleton); |
4749 | return state->Mult_singleton; |
4750 | case MatMult: Branch (4750:9): [True: 19, False: 13.5k]
|
4751 | Py_INCREF(state->MatMult_singleton); |
4752 | return state->MatMult_singleton; |
4753 | case Div: Branch (4753:9): [True: 1.27k, False: 12.2k]
|
4754 | Py_INCREF(state->Div_singleton); |
4755 | return state->Div_singleton; |
4756 | case Mod: Branch (4756:9): [True: 2.43k, False: 11.1k]
|
4757 | Py_INCREF(state->Mod_singleton); |
4758 | return state->Mod_singleton; |
4759 | case Pow: Branch (4759:9): [True: 189, False: 13.3k]
|
4760 | Py_INCREF(state->Pow_singleton); |
4761 | return state->Pow_singleton; |
4762 | case LShift: Branch (4762:9): [True: 206, False: 13.3k]
|
4763 | Py_INCREF(state->LShift_singleton); |
4764 | return state->LShift_singleton; |
4765 | case RShift: Branch (4765:9): [True: 101, False: 13.4k]
|
4766 | Py_INCREF(state->RShift_singleton); |
4767 | return state->RShift_singleton; |
4768 | case BitOr: Branch (4768:9): [True: 452, False: 13.1k]
|
4769 | Py_INCREF(state->BitOr_singleton); |
4770 | return state->BitOr_singleton; |
4771 | case BitXor: Branch (4771:9): [True: 105, False: 13.4k]
|
4772 | Py_INCREF(state->BitXor_singleton); |
4773 | return state->BitXor_singleton; |
4774 | case BitAnd: Branch (4774:9): [True: 417, False: 13.1k]
|
4775 | Py_INCREF(state->BitAnd_singleton); |
4776 | return state->BitAnd_singleton; |
4777 | case FloorDiv: Branch (4777:9): [True: 237, False: 13.3k]
|
4778 | Py_INCREF(state->FloorDiv_singleton); |
4779 | return state->FloorDiv_singleton; |
4780 | } |
4781 | Py_UNREACHABLE0 (); |
4782 | } |
4783 | PyObject* ast2obj_unaryop(struct ast_state *state, unaryop_ty o) |
4784 | { |
4785 | switch(o) { Branch (4785:12): [True: 0, False: 4.67k]
|
4786 | case Invert: Branch (4786:9): [True: 87, False: 4.58k]
|
4787 | Py_INCREF(state->Invert_singleton); |
4788 | return state->Invert_singleton; |
4789 | case Not: Branch (4789:9): [True: 2.68k, False: 1.98k]
|
4790 | Py_INCREF(state->Not_singleton); |
4791 | return state->Not_singleton; |
4792 | case UAdd: Branch (4792:9): [True: 44, False: 4.62k]
|
4793 | Py_INCREF(state->UAdd_singleton); |
4794 | return state->UAdd_singleton; |
4795 | case USub: Branch (4795:9): [True: 1.85k, False: 2.81k]
|
4796 | Py_INCREF(state->USub_singleton); |
4797 | return state->USub_singleton; |
4798 | } |
4799 | Py_UNREACHABLE0 (); |
4800 | } |
4801 | PyObject* ast2obj_cmpop(struct ast_state *state, cmpop_ty o) |
4802 | { |
4803 | switch(o) { Branch (4803:12): [True: 0, False: 12.5k]
|
4804 | case Eq: Branch (4804:9): [True: 3.36k, False: 9.20k]
|
4805 | Py_INCREF(state->Eq_singleton); |
4806 | return state->Eq_singleton; |
4807 | case NotEq: Branch (4807:9): [True: 885, False: 11.6k]
|
4808 | Py_INCREF(state->NotEq_singleton); |
4809 | return state->NotEq_singleton; |
4810 | case Lt: Branch (4810:9): [True: 846, False: 11.7k]
|
4811 | Py_INCREF(state->Lt_singleton); |
4812 | return state->Lt_singleton; |
4813 | case LtE: Branch (4813:9): [True: 464, False: 12.1k]
|
4814 | Py_INCREF(state->LtE_singleton); |
4815 | return state->LtE_singleton; |
4816 | case Gt: Branch (4816:9): [True: 715, False: 11.8k]
|
4817 | Py_INCREF(state->Gt_singleton); |
4818 | return state->Gt_singleton; |
4819 | case GtE: Branch (4819:9): [True: 419, False: 12.1k]
|
4820 | Py_INCREF(state->GtE_singleton); |
4821 | return state->GtE_singleton; |
4822 | case Is: Branch (4822:9): [True: 2.25k, False: 10.3k]
|
4823 | Py_INCREF(state->Is_singleton); |
4824 | return state->Is_singleton; |
4825 | case IsNot: Branch (4825:9): [True: 1.49k, False: 11.0k]
|
4826 | Py_INCREF(state->IsNot_singleton); |
4827 | return state->IsNot_singleton; |
4828 | case In: Branch (4828:9): [True: 1.63k, False: 10.9k]
|
4829 | Py_INCREF(state->In_singleton); |
4830 | return state->In_singleton; |
4831 | case NotIn: Branch (4831:9): [True: 492, False: 12.0k]
|
4832 | Py_INCREF(state->NotIn_singleton); |
4833 | return state->NotIn_singleton; |
4834 | } |
4835 | Py_UNREACHABLE0 (); |
4836 | } |
4837 | PyObject* |
4838 | ast2obj_comprehension(struct ast_state *state, void* _o) |
4839 | { |
4840 | comprehension_ty o = (comprehension_ty)_o; |
4841 | PyObject *result = NULL, *value = NULL; |
4842 | PyTypeObject *tp; |
4843 | if (!o) { Branch (4843:9): [True: 0, False: 1.25k]
|
4844 | Py_RETURN_NONE; |
4845 | } |
4846 | tp = (PyTypeObject *)state->comprehension_type; |
4847 | result = PyType_GenericNew(tp, NULL, NULL); |
4848 | if (!result) return NULL0 ; Branch (4848:9): [True: 0, False: 1.25k]
|
4849 | value = ast2obj_expr(state, o->target); |
4850 | if (!value) goto failed0 ; Branch (4850:9): [True: 0, False: 1.25k]
|
4851 | if (PyObject_SetAttr(result, state->target, value) == -1) Branch (4851:9): [True: 0, False: 1.25k]
|
4852 | goto failed; |
4853 | Py_DECREF(value); |
4854 | value = ast2obj_expr(state, o->iter); |
4855 | if (!value) goto failed0 ; Branch (4855:9): [True: 0, False: 1.25k]
|
4856 | if (PyObject_SetAttr(result, state->iter, value) == -1) Branch (4856:9): [True: 0, False: 1.25k]
|
4857 | goto failed; |
4858 | Py_DECREF(value); |
4859 | value = ast2obj_list(state, (asdl_seq*)o->ifs, ast2obj_expr); |
4860 | if (!value) goto failed0 ; Branch (4860:9): [True: 0, False: 1.25k]
|
4861 | if (PyObject_SetAttr(result, state->ifs, value) == -1) Branch (4861:9): [True: 0, False: 1.25k]
|
4862 | goto failed; |
4863 | Py_DECREF(value); |
4864 | value = ast2obj_int(state, o->is_async); |
4865 | if (!value) goto failed0 ; Branch (4865:9): [True: 0, False: 1.25k]
|
4866 | if (PyObject_SetAttr(result, state->is_async, value) == -1) Branch (4866:9): [True: 0, False: 1.25k]
|
4867 | goto failed; |
4868 | Py_DECREF(value); |
4869 | return result; |
4870 | failed: |
4871 | Py_XDECREF(value); |
4872 | Py_XDECREF(result); |
4873 | return NULL; |
4874 | } |
4875 | |
4876 | PyObject* |
4877 | ast2obj_excepthandler(struct ast_state *state, void* _o) |
4878 | { |
4879 | excepthandler_ty o = (excepthandler_ty)_o; |
4880 | PyObject *result = NULL, *value = NULL; |
4881 | PyTypeObject *tp; |
4882 | if (!o) { Branch (4882:9): [True: 0, False: 2.21k]
|
4883 | Py_RETURN_NONE; |
4884 | } |
4885 | switch (o->kind) { Branch (4885:13): [True: 0, False: 2.21k]
|
4886 | case ExceptHandler_kind: Branch (4886:5): [True: 2.21k, False: 0]
|
4887 | tp = (PyTypeObject *)state->ExceptHandler_type; |
4888 | result = PyType_GenericNew(tp, NULL, NULL); |
4889 | if (!result) goto failed0 ; Branch (4889:13): [True: 0, False: 2.21k]
|
4890 | value = ast2obj_expr(state, o->v.ExceptHandler.type); |
4891 | if (!value) goto failed0 ; Branch (4891:13): [True: 0, False: 2.21k]
|
4892 | if (PyObject_SetAttr(result, state->type, value) == -1) Branch (4892:13): [True: 0, False: 2.21k]
|
4893 | goto failed; |
4894 | Py_DECREF(value); |
4895 | value = ast2obj_identifier(state, o->v.ExceptHandler.name); |
4896 | if (!value) goto failed0 ; Branch (4896:13): [True: 0, False: 2.21k]
|
4897 | if (PyObject_SetAttr(result, state->name, value) == -1) Branch (4897:13): [True: 0, False: 2.21k]
|
4898 | goto failed; |
4899 | Py_DECREF(value); |
4900 | value = ast2obj_list(state, (asdl_seq*)o->v.ExceptHandler.body, |
4901 | ast2obj_stmt); |
4902 | if (!value) goto failed0 ; Branch (4902:13): [True: 0, False: 2.21k]
|
4903 | if (PyObject_SetAttr(result, state->body, value) == -1) Branch (4903:13): [True: 0, False: 2.21k]
|
4904 | goto failed; |
4905 | Py_DECREF(value); |
4906 | break; |
4907 | } |
4908 | value = ast2obj_int(state, o->lineno); |
4909 | if (!value) goto failed0 ; Branch (4909:9): [True: 0, False: 2.21k]
|
4910 | if (PyObject_SetAttr(result, state->lineno, value) < 0) Branch (4910:9): [True: 0, False: 2.21k]
|
4911 | goto failed; |
4912 | Py_DECREF(value); |
4913 | value = ast2obj_int(state, o->col_offset); |
4914 | if (!value) goto failed0 ; Branch (4914:9): [True: 0, False: 2.21k]
|
4915 | if (PyObject_SetAttr(result, state->col_offset, value) < 0) Branch (4915:9): [True: 0, False: 2.21k]
|
4916 | goto failed; |
4917 | Py_DECREF(value); |
4918 | value = ast2obj_int(state, o->end_lineno); |
4919 | if (!value) goto failed0 ; Branch (4919:9): [True: 0, False: 2.21k]
|
4920 | if (PyObject_SetAttr(result, state->end_lineno, value) < 0) Branch (4920:9): [True: 0, False: 2.21k]
|
4921 | goto failed; |
4922 | Py_DECREF(value); |
4923 | value = ast2obj_int(state, o->end_col_offset); |
4924 | if (!value) goto failed0 ; Branch (4924:9): [True: 0, False: 2.21k]
|
4925 | if (PyObject_SetAttr(result, state->end_col_offset, value) < 0) Branch (4925:9): [True: 0, False: 2.21k]
|
4926 | goto failed; |
4927 | Py_DECREF(value); |
4928 | return result; |
4929 | failed: |
4930 | Py_XDECREF(value); |
4931 | Py_XDECREF(result); |
4932 | return NULL; |
4933 | } |
4934 | |
4935 | PyObject* |
4936 | ast2obj_arguments(struct ast_state *state, void* _o) |
4937 | { |
4938 | arguments_ty o = (arguments_ty)_o; |
4939 | PyObject *result = NULL, *value = NULL; |
4940 | PyTypeObject *tp; |
4941 | if (!o) { Branch (4941:9): [True: 0, False: 19.9k]
|
4942 | Py_RETURN_NONE; |
4943 | } |
4944 | tp = (PyTypeObject *)state->arguments_type; |
4945 | result = PyType_GenericNew(tp, NULL, NULL); |
4946 | if (!result) return NULL0 ; Branch (4946:9): [True: 0, False: 19.9k]
|
4947 | value = ast2obj_list(state, (asdl_seq*)o->posonlyargs, ast2obj_arg); |
4948 | if (!value) goto failed0 ; Branch (4948:9): [True: 0, False: 19.9k]
|
4949 | if (PyObject_SetAttr(result, state->posonlyargs, value) == -1) Branch (4949:9): [True: 0, False: 19.9k]
|
4950 | goto failed; |
4951 | Py_DECREF(value); |
4952 | value = ast2obj_list(state, (asdl_seq*)o->args, ast2obj_arg); |
4953 | if (!value) goto failed0 ; Branch (4953:9): [True: 0, False: 19.9k]
|
4954 | if (PyObject_SetAttr(result, state->args, value) == -1) Branch (4954:9): [True: 0, False: 19.9k]
|
4955 | goto failed; |
4956 | Py_DECREF(value); |
4957 | value = ast2obj_arg(state, o->vararg); |
4958 | if (!value) goto failed0 ; Branch (4958:9): [True: 0, False: 19.9k]
|
4959 | if (PyObject_SetAttr(result, state->vararg, value) == -1) Branch (4959:9): [True: 0, False: 19.9k]
|
4960 | goto failed; |
4961 | Py_DECREF(value); |
4962 | value = ast2obj_list(state, (asdl_seq*)o->kwonlyargs, ast2obj_arg); |
4963 | if (!value) goto failed0 ; Branch (4963:9): [True: 0, False: 19.9k]
|
4964 | if (PyObject_SetAttr(result, state->kwonlyargs, value) == -1) Branch (4964:9): [True: 0, False: 19.9k]
|
4965 | goto failed; |
4966 | Py_DECREF(value); |
4967 | value = ast2obj_list(state, (asdl_seq*)o->kw_defaults, ast2obj_expr); |
4968 | if (!value) goto failed0 ; Branch (4968:9): [True: 0, False: 19.9k]
|
4969 | if (PyObject_SetAttr(result, state->kw_defaults, value) == -1) Branch (4969:9): [True: 0, False: 19.9k]
|
4970 | goto failed; |
4971 | Py_DECREF(value); |
4972 | value = ast2obj_arg(state, o->kwarg); |
4973 | if (!value) goto failed0 ; Branch (4973:9): [True: 0, False: 19.9k]
|
4974 | if (PyObject_SetAttr(result, state->kwarg, value) == -1) Branch (4974:9): [True: 0, False: 19.9k]
|
4975 | goto failed; |
4976 | Py_DECREF(value); |
4977 | value = ast2obj_list(state, (asdl_seq*)o->defaults, ast2obj_expr); |
4978 | if (!value) goto failed0 ; Branch (4978:9): [True: 0, False: 19.9k]
|
4979 | if (PyObject_SetAttr(result, state->defaults, value) == -1) Branch (4979:9): [True: 0, False: 19.9k]
|
4980 | goto failed; |
4981 | Py_DECREF(value); |
4982 | return result; |
4983 | failed: |
4984 | Py_XDECREF(value); |
4985 | Py_XDECREF(result); |
4986 | return NULL; |
4987 | } |
4988 | |
4989 | PyObject* |
4990 | ast2obj_arg(struct ast_state *state, void* _o) |
4991 | { |
4992 | arg_ty o = (arg_ty)_o; |
4993 | PyObject *result = NULL, *value = NULL; |
4994 | PyTypeObject *tp; |
4995 | if (!o) { Branch (4995:9): [True: 36.9k, False: 34.5k]
|
4996 | Py_RETURN_NONE; |
4997 | } |
4998 | tp = (PyTypeObject *)state->arg_type; |
4999 | result = PyType_GenericNew(tp, NULL, NULL); |
5000 | if (!result) return NULL0 ; Branch (5000:9): [True: 0, False: 34.5k]
|
5001 | value = ast2obj_identifier(state, o->arg); |
5002 | if (!value) goto failed0 ; Branch (5002:9): [True: 0, False: 34.5k]
|
5003 | if (PyObject_SetAttr(result, state->arg, value) == -1) Branch (5003:9): [True: 0, False: 34.5k]
|
5004 | goto failed; |
5005 | Py_DECREF(value); |
5006 | value = ast2obj_expr(state, o->annotation); |
5007 | if (!value) goto failed0 ; Branch (5007:9): [True: 0, False: 34.5k]
|
5008 | if (PyObject_SetAttr(result, state->annotation, value) == -1) Branch (5008:9): [True: 0, False: 34.5k]
|
5009 | goto failed; |
5010 | Py_DECREF(value); |
5011 | value = ast2obj_string(state, o->type_comment); |
5012 | if (!value) goto failed0 ; Branch (5012:9): [True: 0, False: 34.5k]
|
5013 | if (PyObject_SetAttr(result, state->type_comment, value) == -1) Branch (5013:9): [True: 0, False: 34.5k]
|
5014 | goto failed; |
5015 | Py_DECREF(value); |
5016 | value = ast2obj_int(state, o->lineno); |
5017 | if (!value) goto failed0 ; Branch (5017:9): [True: 0, False: 34.5k]
|
5018 | if (PyObject_SetAttr(result, state->lineno, value) < 0) Branch (5018:9): [True: 0, False: 34.5k]
|
5019 | goto failed; |
5020 | Py_DECREF(value); |
5021 | value = ast2obj_int(state, o->col_offset); |
5022 | if (!value) goto failed0 ; Branch (5022:9): [True: 0, False: 34.5k]
|
5023 | if (PyObject_SetAttr(result, state->col_offset, value) < 0) Branch (5023:9): [True: 0, False: 34.5k]
|
5024 | goto failed; |
5025 | Py_DECREF(value); |
5026 | value = ast2obj_int(state, o->end_lineno); |
5027 | if (!value) goto failed0 ; Branch (5027:9): [True: 0, False: 34.5k]
|
5028 | if (PyObject_SetAttr(result, state->end_lineno, value) < 0) Branch (5028:9): [True: 0, False: 34.5k]
|
5029 | goto failed; |
5030 | Py_DECREF(value); |
5031 | value = ast2obj_int(state, o->end_col_offset); |
5032 | if (!value) goto failed0 ; Branch (5032:9): [True: 0, False: 34.5k]
|
5033 | if (PyObject_SetAttr(result, state->end_col_offset, value) < 0) Branch (5033:9): [True: 0, False: 34.5k]
|
5034 | goto failed; |
5035 | Py_DECREF(value); |
5036 | return result; |
5037 | failed: |
5038 | Py_XDECREF(value); |
5039 | Py_XDECREF(result); |
5040 | return NULL; |
5041 | } |
5042 | |
5043 | PyObject* |
5044 | ast2obj_keyword(struct ast_state *state, void* _o) |
5045 | { |
5046 | keyword_ty o = (keyword_ty)_o; |
5047 | PyObject *result = NULL, *value = NULL; |
5048 | PyTypeObject *tp; |
5049 | if (!o) { Branch (5049:9): [True: 0, False: 6.27k]
|
5050 | Py_RETURN_NONE; |
5051 | } |
5052 | tp = (PyTypeObject *)state->keyword_type; |
5053 | result = PyType_GenericNew(tp, NULL, NULL); |
5054 | if (!result) return NULL0 ; Branch (5054:9): [True: 0, False: 6.27k]
|
5055 | value = ast2obj_identifier(state, o->arg); |
5056 | if (!value) goto failed0 ; Branch (5056:9): [True: 0, False: 6.27k]
|
5057 | if (PyObject_SetAttr(result, state->arg, value) == -1) Branch (5057:9): [True: 0, False: 6.27k]
|
5058 | goto failed; |
5059 | Py_DECREF(value); |
5060 | value = ast2obj_expr(state, o->value); |
5061 | if (!value) goto failed0 ; Branch (5061:9): [True: 0, False: 6.27k]
|
5062 | if (PyObject_SetAttr(result, state->value, value) == -1) Branch (5062:9): [True: 0, False: 6.27k]
|
5063 | goto failed; |
5064 | Py_DECREF(value); |
5065 | value = ast2obj_int(state, o->lineno); |
5066 | if (!value) goto failed0 ; Branch (5066:9): [True: 0, False: 6.27k]
|
5067 | if (PyObject_SetAttr(result, state->lineno, value) < 0) Branch (5067:9): [True: 0, False: 6.27k]
|
5068 | goto failed; |
5069 | Py_DECREF(value); |
5070 | value = ast2obj_int(state, o->col_offset); |
5071 | if (!value) goto failed0 ; Branch (5071:9): [True: 0, False: 6.27k]
|
5072 | if (PyObject_SetAttr(result, state->col_offset, value) < 0) Branch (5072:9): [True: 0, False: 6.27k]
|
5073 | goto failed; |
5074 | Py_DECREF(value); |
5075 | value = ast2obj_int(state, o->end_lineno); |
5076 | if (!value) goto failed0 ; Branch (5076:9): [True: 0, False: 6.27k]
|
5077 | if (PyObject_SetAttr(result, state->end_lineno, value) < 0) Branch (5077:9): [True: 0, False: 6.27k]
|
5078 | goto failed; |
5079 | Py_DECREF(value); |
5080 | value = ast2obj_int(state, o->end_col_offset); |
5081 | if (!value) goto failed0 ; Branch (5081:9): [True: 0, False: 6.27k]
|
5082 | if (PyObject_SetAttr(result, state->end_col_offset, value) < 0) Branch (5082:9): [True: 0, False: 6.27k]
|
5083 | goto failed; |
5084 | Py_DECREF(value); |
5085 | return result; |
5086 | failed: |
5087 | Py_XDECREF(value); |
5088 | Py_XDECREF(result); |
5089 | return NULL; |
5090 | } |
5091 | |
5092 | PyObject* |
5093 | ast2obj_alias(struct ast_state *state, void* _o) |
5094 | { |
5095 | alias_ty o = (alias_ty)_o; |
5096 | PyObject *result = NULL, *value = NULL; |
5097 | PyTypeObject *tp; |
5098 | if (!o) { Branch (5098:9): [True: 0, False: 3.42k]
|
5099 | Py_RETURN_NONE; |
5100 | } |
5101 | tp = (PyTypeObject *)state->alias_type; |
5102 | result = PyType_GenericNew(tp, NULL, NULL); |
5103 | if (!result) return NULL0 ; Branch (5103:9): [True: 0, False: 3.42k]
|
5104 | value = ast2obj_identifier(state, o->name); |
5105 | if (!value) goto failed0 ; Branch (5105:9): [True: 0, False: 3.42k]
|
5106 | if (PyObject_SetAttr(result, state->name, value) == -1) Branch (5106:9): [True: 0, False: 3.42k]
|
5107 | goto failed; |
5108 | Py_DECREF(value); |
5109 | value = ast2obj_identifier(state, o->asname); |
5110 | if (!value) goto failed0 ; Branch (5110:9): [True: 0, False: 3.42k]
|
5111 | if (PyObject_SetAttr(result, state->asname, value) == -1) Branch (5111:9): [True: 0, False: 3.42k]
|
5112 | goto failed; |
5113 | Py_DECREF(value); |
5114 | value = ast2obj_int(state, o->lineno); |
5115 | if (!value) goto failed0 ; Branch (5115:9): [True: 0, False: 3.42k]
|
5116 | if (PyObject_SetAttr(result, state->lineno, value) < 0) Branch (5116:9): [True: 0, False: 3.42k]
|
5117 | goto failed; |
5118 | Py_DECREF(value); |
5119 | value = ast2obj_int(state, o->col_offset); |
5120 | if (!value) goto failed0 ; Branch (5120:9): [True: 0, False: 3.42k]
|
5121 | if (PyObject_SetAttr(result, state->col_offset, value) < 0) Branch (5121:9): [True: 0, False: 3.42k]
|
5122 | goto failed; |
5123 | Py_DECREF(value); |
5124 | value = ast2obj_int(state, o->end_lineno); |
5125 | if (!value) goto failed0 ; Branch (5125:9): [True: 0, False: 3.42k]
|
5126 | if (PyObject_SetAttr(result, state->end_lineno, value) < 0) Branch (5126:9): [True: 0, False: 3.42k]
|
5127 | goto failed; |
5128 | Py_DECREF(value); |
5129 | value = ast2obj_int(state, o->end_col_offset); |
5130 | if (!value) goto failed0 ; Branch (5130:9): [True: 0, False: 3.42k]
|
5131 | if (PyObject_SetAttr(result, state->end_col_offset, value) < 0) Branch (5131:9): [True: 0, False: 3.42k]
|
5132 | goto failed; |
5133 | Py_DECREF(value); |
5134 | return result; |
5135 | failed: |
5136 | Py_XDECREF(value); |
5137 | Py_XDECREF(result); |
5138 | return NULL; |
5139 | } |
5140 | |
5141 | PyObject* |
5142 | ast2obj_withitem(struct ast_state *state, void* _o) |
5143 | { |
5144 | withitem_ty o = (withitem_ty)_o; |
5145 | PyObject *result = NULL, *value = NULL; |
5146 | PyTypeObject *tp; |
5147 | if (!o) { Branch (5147:9): [True: 0, False: 1.56k]
|
5148 | Py_RETURN_NONE; |
5149 | } |
5150 | tp = (PyTypeObject *)state->withitem_type; |
5151 | result = PyType_GenericNew(tp, NULL, NULL); |
5152 | if (!result) return NULL0 ; Branch (5152:9): [True: 0, False: 1.56k]
|
5153 | value = ast2obj_expr(state, o->context_expr); |
5154 | if (!value) goto failed0 ; Branch (5154:9): [True: 0, False: 1.56k]
|
5155 | if (PyObject_SetAttr(result, state->context_expr, value) == -1) Branch (5155:9): [True: 0, False: 1.56k]
|
5156 | goto failed; |
5157 | Py_DECREF(value); |
5158 | value = ast2obj_expr(state, o->optional_vars); |
5159 | if (!value) goto failed0 ; Branch (5159:9): [True: 0, False: 1.56k]
|
5160 | if (PyObject_SetAttr(result, state->optional_vars, value) == -1) Branch (5160:9): [True: 0, False: 1.56k]
|
5161 | goto failed; |
5162 | Py_DECREF(value); |
5163 | return result; |
5164 | failed: |
5165 | Py_XDECREF(value); |
5166 | Py_XDECREF(result); |
5167 | return NULL; |
5168 | } |
5169 | |
5170 | PyObject* |
5171 | ast2obj_match_case(struct ast_state *state, void* _o) |
5172 | { |
5173 | match_case_ty o = (match_case_ty)_o; |
5174 | PyObject *result = NULL, *value = NULL; |
5175 | PyTypeObject *tp; |
5176 | if (!o) { Branch (5176:9): [True: 0, False: 782]
|
5177 | Py_RETURN_NONE; |
5178 | } |
5179 | tp = (PyTypeObject *)state->match_case_type; |
5180 | result = PyType_GenericNew(tp, NULL, NULL); |
5181 | if (!result) return NULL0 ; Branch (5181:9): [True: 0, False: 782]
|
5182 | value = ast2obj_pattern(state, o->pattern); |
5183 | if (!value) goto failed0 ; Branch (5183:9): [True: 0, False: 782]
|
5184 | if (PyObject_SetAttr(result, state->pattern, value) == -1) Branch (5184:9): [True: 0, False: 782]
|
5185 | goto failed; |
5186 | Py_DECREF(value); |
5187 | value = ast2obj_expr(state, o->guard); |
5188 | if (!value) goto failed0 ; Branch (5188:9): [True: 0, False: 782]
|
5189 | if (PyObject_SetAttr(result, state->guard, value) == -1) Branch (5189:9): [True: 0, False: 782]
|
5190 | goto failed; |
5191 | Py_DECREF(value); |
5192 | value = ast2obj_list(state, (asdl_seq*)o->body, ast2obj_stmt); |
5193 | if (!value) goto failed0 ; Branch (5193:9): [True: 0, False: 782]
|
5194 | if (PyObject_SetAttr(result, state->body, value) == -1) Branch (5194:9): [True: 0, False: 782]
|
5195 | goto failed; |
5196 | Py_DECREF(value); |
5197 | return result; |
5198 | failed: |
5199 | Py_XDECREF(value); |
5200 | Py_XDECREF(result); |
5201 | return NULL; |
5202 | } |
5203 | |
5204 | PyObject* |
5205 | ast2obj_pattern(struct ast_state *state, void* _o) |
5206 | { |
5207 | pattern_ty o = (pattern_ty)_o; |
5208 | PyObject *result = NULL, *value = NULL; |
5209 | PyTypeObject *tp; |
5210 | if (!o) { Branch (5210:9): [True: 464, False: 2.06k]
|
5211 | Py_RETURN_NONE; |
5212 | } |
5213 | switch (o->kind) { Branch (5213:13): [True: 0, False: 2.06k]
|
5214 | case MatchValue_kind: Branch (5214:5): [True: 760, False: 1.30k]
|
5215 | tp = (PyTypeObject *)state->MatchValue_type; |
5216 | result = PyType_GenericNew(tp, NULL, NULL); |
5217 | if (!result) goto failed0 ; Branch (5217:13): [True: 0, False: 760]
|
5218 | value = ast2obj_expr(state, o->v.MatchValue.value); |
5219 | if (!value) goto failed0 ; Branch (5219:13): [True: 0, False: 760]
|
5220 | if (PyObject_SetAttr(result, state->value, value) == -1) Branch (5220:13): [True: 0, False: 760]
|
5221 | goto failed; |
5222 | Py_DECREF(value); |
5223 | break; |
5224 | case MatchSingleton_kind: Branch (5224:5): [True: 22, False: 2.04k]
|
5225 | tp = (PyTypeObject *)state->MatchSingleton_type; |
5226 | result = PyType_GenericNew(tp, NULL, NULL); |
5227 | if (!result) goto failed0 ; Branch (5227:13): [True: 0, False: 22]
|
5228 | value = ast2obj_constant(state, o->v.MatchSingleton.value); |
5229 | if (!value) goto failed0 ; Branch (5229:13): [True: 0, False: 22]
|
5230 | if (PyObject_SetAttr(result, state->value, value) == -1) Branch (5230:13): [True: 0, False: 22]
|
5231 | goto failed; |
5232 | Py_DECREF(value); |
5233 | break; |
5234 | case MatchSequence_kind: Branch (5234:5): [True: 302, False: 1.76k]
|
5235 | tp = (PyTypeObject *)state->MatchSequence_type; |
5236 | result = PyType_GenericNew(tp, NULL, NULL); |
5237 | if (!result) goto failed0 ; Branch (5237:13): [True: 0, False: 302]
|
5238 | value = ast2obj_list(state, (asdl_seq*)o->v.MatchSequence.patterns, |
5239 | ast2obj_pattern); |
5240 | if (!value) goto failed0 ; Branch (5240:13): [True: 0, False: 302]
|
5241 | if (PyObject_SetAttr(result, state->patterns, value) == -1) Branch (5241:13): [True: 0, False: 302]
|
5242 | goto failed; |
5243 | Py_DECREF(value); |
5244 | break; |
5245 | case MatchMapping_kind: Branch (5245:5): [True: 156, False: 1.90k]
|
5246 | tp = (PyTypeObject *)state->MatchMapping_type; |
5247 | result = PyType_GenericNew(tp, NULL, NULL); |
5248 | if (!result) goto failed0 ; Branch (5248:13): [True: 0, False: 156]
|
5249 | value = ast2obj_list(state, (asdl_seq*)o->v.MatchMapping.keys, |
5250 | ast2obj_expr); |
5251 | if (!value) goto failed0 ; Branch (5251:13): [True: 0, False: 156]
|
5252 | if (PyObject_SetAttr(result, state->keys, value) == -1) Branch (5252:13): [True: 0, False: 156]
|
5253 | goto failed; |
5254 | Py_DECREF(value); |
5255 | value = ast2obj_list(state, (asdl_seq*)o->v.MatchMapping.patterns, |
5256 | ast2obj_pattern); |
5257 | if (!value) goto failed0 ; Branch (5257:13): [True: 0, False: 156]
|
5258 | if (PyObject_SetAttr(result, state->patterns, value) == -1) Branch (5258:13): [True: 0, False: 156]
|
5259 | goto failed; |
5260 | Py_DECREF(value); |
5261 | value = ast2obj_identifier(state, o->v.MatchMapping.rest); |
5262 | if (!value) goto failed0 ; Branch (5262:13): [True: 0, False: 156]
|
5263 | if (PyObject_SetAttr(result, state->rest, value) == -1) Branch (5263:13): [True: 0, False: 156]
|
5264 | goto failed; |
5265 | Py_DECREF(value); |
5266 | break; |
5267 | case MatchClass_kind: Branch (5267:5): [True: 98, False: 1.96k]
|
5268 | tp = (PyTypeObject *)state->MatchClass_type; |
5269 | result = PyType_GenericNew(tp, NULL, NULL); |
5270 | if (!result) goto failed0 ; Branch (5270:13): [True: 0, False: 98]
|
5271 | value = ast2obj_expr(state, o->v.MatchClass.cls); |
5272 | if (!value) goto failed0 ; Branch (5272:13): [True: 0, False: 98]
|
5273 | if (PyObject_SetAttr(result, state->cls, value) == -1) Branch (5273:13): [True: 0, False: 98]
|
5274 | goto failed; |
5275 | Py_DECREF(value); |
5276 | value = ast2obj_list(state, (asdl_seq*)o->v.MatchClass.patterns, |
5277 | ast2obj_pattern); |
5278 | if (!value) goto failed0 ; Branch (5278:13): [True: 0, False: 98]
|
5279 | if (PyObject_SetAttr(result, state->patterns, value) == -1) Branch (5279:13): [True: 0, False: 98]
|
5280 | goto failed; |
5281 | Py_DECREF(value); |
5282 | value = ast2obj_list(state, (asdl_seq*)o->v.MatchClass.kwd_attrs, |
5283 | ast2obj_identifier); |
5284 | if (!value) goto failed0 ; Branch (5284:13): [True: 0, False: 98]
|
5285 | if (PyObject_SetAttr(result, state->kwd_attrs, value) == -1) Branch (5285:13): [True: 0, False: 98]
|
5286 | goto failed; |
5287 | Py_DECREF(value); |
5288 | value = ast2obj_list(state, (asdl_seq*)o->v.MatchClass.kwd_patterns, |
5289 | ast2obj_pattern); |
5290 | if (!value) goto failed0 ; Branch (5290:13): [True: 0, False: 98]
|
5291 | if (PyObject_SetAttr(result, state->kwd_patterns, value) == -1) Branch (5291:13): [True: 0, False: 98]
|
5292 | goto failed; |
5293 | Py_DECREF(value); |
5294 | break; |
5295 | case MatchStar_kind: Branch (5295:5): [True: 72, False: 1.99k]
|
5296 | tp = (PyTypeObject *)state->MatchStar_type; |
5297 | result = PyType_GenericNew(tp, NULL, NULL); |
5298 | if (!result) goto failed0 ; Branch (5298:13): [True: 0, False: 72]
|
5299 | value = ast2obj_identifier(state, o->v.MatchStar.name); |
5300 | if (!value) goto failed0 ; Branch (5300:13): [True: 0, False: 72]
|
5301 | if (PyObject_SetAttr(result, state->name, value) == -1) Branch (5301:13): [True: 0, False: 72]
|
5302 | goto failed; |
5303 | Py_DECREF(value); |
5304 | break; |
5305 | case MatchAs_kind: Branch (5305:5): [True: 554, False: 1.51k]
|
5306 | tp = (PyTypeObject *)state->MatchAs_type; |
5307 | result = PyType_GenericNew(tp, NULL, NULL); |
5308 | if (!result) goto failed0 ; Branch (5308:13): [True: 0, False: 554]
|
5309 | value = ast2obj_pattern(state, o->v.MatchAs.pattern); |
5310 | if (!value) goto failed0 ; Branch (5310:13): [True: 0, False: 554]
|
5311 | if (PyObject_SetAttr(result, state->pattern, value) == -1) Branch (5311:13): [True: 0, False: 554]
|
5312 | goto failed; |
5313 | Py_DECREF(value); |
5314 | value = ast2obj_identifier(state, o->v.MatchAs.name); |
5315 | if (!value) goto failed0 ; Branch (5315:13): [True: 0, False: 554]
|
5316 | if (PyObject_SetAttr(result, state->name, value) == -1) Branch (5316:13): [True: 0, False: 554]
|
5317 | goto failed; |
5318 | Py_DECREF(value); |
5319 | break; |
5320 | case MatchOr_kind: Branch (5320:5): [True: 100, False: 1.96k]
|
5321 | tp = (PyTypeObject *)state->MatchOr_type; |
5322 | result = PyType_GenericNew(tp, NULL, NULL); |
5323 | if (!result) goto failed0 ; Branch (5323:13): [True: 0, False: 100]
|
5324 | value = ast2obj_list(state, (asdl_seq*)o->v.MatchOr.patterns, |
5325 | ast2obj_pattern); |
5326 | if (!value) goto failed0 ; Branch (5326:13): [True: 0, False: 100]
|
5327 | if (PyObject_SetAttr(result, state->patterns, value) == -1) Branch (5327:13): [True: 0, False: 100]
|
5328 | goto failed; |
5329 | Py_DECREF(value); |
5330 | break; |
5331 | } |
5332 | value = ast2obj_int(state, o->lineno); |
5333 | if (!value) goto failed0 ; Branch (5333:9): [True: 0, False: 2.06k]
|
5334 | if (PyObject_SetAttr(result, state->lineno, value) < 0) Branch (5334:9): [True: 0, False: 2.06k]
|
5335 | goto failed; |
5336 | Py_DECREF(value); |
5337 | value = ast2obj_int(state, o->col_offset); |
5338 | if (!value) goto failed0 ; Branch (5338:9): [True: 0, False: 2.06k]
|
5339 | if (PyObject_SetAttr(result, state->col_offset, value) < 0) Branch (5339:9): [True: 0, False: 2.06k]
|
5340 | goto failed; |
5341 | Py_DECREF(value); |
5342 | value = ast2obj_int(state, o->end_lineno); |
5343 | if (!value) goto failed0 ; Branch (5343:9): [True: 0, False: 2.06k]
|
5344 | if (PyObject_SetAttr(result, state->end_lineno, value) < 0) Branch (5344:9): [True: 0, False: 2.06k]
|
5345 | goto failed; |
5346 | Py_DECREF(value); |
5347 | value = ast2obj_int(state, o->end_col_offset); |
5348 | if (!value) goto failed0 ; Branch (5348:9): [True: 0, False: 2.06k]
|
5349 | if (PyObject_SetAttr(result, state->end_col_offset, value) < 0) Branch (5349:9): [True: 0, False: 2.06k]
|
5350 | goto failed; |
5351 | Py_DECREF(value); |
5352 | return result; |
5353 | failed: |
5354 | Py_XDECREF(value); |
5355 | Py_XDECREF(result); |
5356 | return NULL; |
5357 | } |
5358 | |
5359 | PyObject* |
5360 | ast2obj_type_ignore(struct ast_state *state, void* _o) |
5361 | { |
5362 | type_ignore_ty o = (type_ignore_ty)_o; |
5363 | PyObject *result = NULL, *value = NULL; |
5364 | PyTypeObject *tp; |
5365 | if (!o) { Branch (5365:9): [True: 0, False: 74]
|
5366 | Py_RETURN_NONE; |
5367 | } |
5368 | switch (o->kind) { Branch (5368:13): [True: 0, False: 74]
|
5369 | case TypeIgnore_kind: Branch (5369:5): [True: 74, False: 0]
|
5370 | tp = (PyTypeObject *)state->TypeIgnore_type; |
5371 | result = PyType_GenericNew(tp, NULL, NULL); |
5372 | if (!result) goto failed0 ; Branch (5372:13): [True: 0, False: 74]
|
5373 | value = ast2obj_int(state, o->v.TypeIgnore.lineno); |
5374 | if (!value) goto failed0 ; Branch (5374:13): [True: 0, False: 74]
|
5375 | if (PyObject_SetAttr(result, state->lineno, value) == -1) Branch (5375:13): [True: 0, False: 74]
|
5376 | goto failed; |
5377 | Py_DECREF(value); |
5378 | value = ast2obj_string(state, o->v.TypeIgnore.tag); |
5379 | if (!value) goto failed0 ; Branch (5379:13): [True: 0, False: 74]
|
5380 | if (PyObject_SetAttr(result, state->tag, value) == -1) Branch (5380:13): [True: 0, False: 74]
|
5381 | goto failed; |
5382 | Py_DECREF(value); |
5383 | break; |
5384 | } |
5385 | return result; |
5386 | failed: |
5387 | Py_XDECREF(value); |
5388 | Py_XDECREF(result); |
5389 | return NULL; |
5390 | } |
5391 | |
5392 | |
5393 | int |
5394 | obj2ast_mod(struct ast_state *state, PyObject* obj, mod_ty* out, PyArena* arena) |
5395 | { |
5396 | int isinstance; |
5397 | |
5398 | PyObject *tmp = NULL; |
5399 | PyObject *tp; |
5400 | |
5401 | if (obj == Py_None) { Branch (5401:9): [True: 0, False: 686]
|
5402 | *out = NULL; |
5403 | return 0; |
5404 | } |
5405 | tp = state->Module_type; |
5406 | isinstance = PyObject_IsInstance(obj, tp); |
5407 | if (isinstance == -1) { Branch (5407:9): [True: 0, False: 686]
|
5408 | return 1; |
5409 | } |
5410 | if (isinstance) { Branch (5410:9): [True: 573, False: 113]
|
5411 | asdl_stmt_seq* body; |
5412 | asdl_type_ignore_seq* type_ignores; |
5413 | |
5414 | if (_PyObject_LookupAttr(obj, state->body, &tmp) < 0) { Branch (5414:13): [True: 0, False: 573]
|
5415 | return 1; |
5416 | } |
5417 | if (tmp == NULL) { Branch (5417:13): [True: 0, False: 573]
|
5418 | PyErr_SetString(PyExc_TypeError, "required field \"body\" missing from Module"); |
5419 | return 1; |
5420 | } |
5421 | else { |
5422 | int res; |
5423 | Py_ssize_t len; |
5424 | Py_ssize_t i; |
5425 | if (!PyList_Check(tmp)) { Branch (5425:17): [True: 0, False: 573]
|
5426 | PyErr_Format(PyExc_TypeError, "Module field \"body\" must be a list, not a %.200s", _PyType_Name(Py_TYPE(tmp))); |
5427 | goto failed; |
5428 | } |
5429 | len = PyList_GET_SIZE(tmp); |
5430 | body = _Py_asdl_stmt_seq_new(len, arena); |
5431 | if (body == NULL) goto failed0 ; Branch (5431:17): [True: 0, False: 573]
|
5432 | for (i = 0; 573 i < len; i++6.10k ) { Branch (5432:25): [True: 6.10k, False: 568]
|
5433 | stmt_ty val; |
5434 | PyObject *tmp2 = PyList_GET_ITEM(tmp, i); |
5435 | Py_INCREF(tmp2); |
5436 | if (_Py_EnterRecursiveCall(" while traversing 'Module' node")) { Branch (5436:21): [True: 0, False: 6.10k]
|
5437 | goto failed; |
5438 | } |
5439 | res = obj2ast_stmt(state, tmp2, &val, arena); |
5440 | _Py_LeaveRecursiveCall(); |
5441 | Py_DECREF(tmp2); |
5442 | if (res != 0) goto failed5 ; Branch (5442:21): [True: 5, False: 6.10k]
|
5443 | if (len != PyList_GET_SIZE(tmp)) { Branch (5443:21): [True: 0, False: 6.10k]
|
5444 | PyErr_SetString(PyExc_RuntimeError, "Module field \"body\" changed size during iteration"); |
5445 | goto failed; |
5446 | } |
5447 | asdl_seq_SET(body, i, val); |
5448 | } |
5449 | Py_CLEAR(tmp); |
5450 | } |
5451 | if (_PyObject_LookupAttr(obj, state->type_ignores, &tmp) < 0) { Branch (5451:13): [True: 0, False: 568]
|
5452 | return 1; |
5453 | } |
5454 | if (tmp == NULL) { Branch (5454:13): [True: 0, False: 568]
|
5455 | PyErr_SetString(PyExc_TypeError, "required field \"type_ignores\" missing from Module"); |
5456 | return 1; |
5457 | } |
5458 | else { |
5459 | int res; |
5460 | Py_ssize_t len; |
5461 | Py_ssize_t i; |
5462 | if (!PyList_Check(tmp)) { Branch (5462:17): [True: 0, False: 568]
|
5463 | PyErr_Format(PyExc_TypeError, "Module field \"type_ignores\" must be a list, not a %.200s", _PyType_Name(Py_TYPE(tmp))); |
5464 | goto failed; |
5465 | } |
5466 | len = PyList_GET_SIZE(tmp); |
5467 | type_ignores = _Py_asdl_type_ignore_seq_new(len, arena); |
5468 | if (type_ignores == NULL) goto failed0 ; Branch (5468:17): [True: 0, False: 568]
|
5469 | for (i = 0; i < len; i++0 ) { Branch (5469:25): [True: 0, False: 568]
|
5470 | type_ignore_ty val; |
5471 | PyObject *tmp2 = PyList_GET_ITEM(tmp, i); |
5472 | Py_INCREF(tmp2); |
5473 | if (_Py_EnterRecursiveCall(" while traversing 'Module' node")) { Branch (5473:21): [True: 0, False: 0]
|
5474 | goto failed; |
5475 | } |
5476 | res = obj2ast_type_ignore(state, tmp2, &val, arena); |
5477 | _Py_LeaveRecursiveCall(); |
5478 | Py_DECREF(tmp2); |
5479 | if (res != 0) goto failed; Branch (5479:21): [True: 0, False: 0]
|
5480 | if (len != PyList_GET_SIZE(tmp)) { Branch (5480:21): [True: 0, False: 0]
|
5481 | PyErr_SetString(PyExc_RuntimeError, "Module field \"type_ignores\" changed size during iteration"); |
5482 | goto failed; |
5483 | } |
5484 | asdl_seq_SET(type_ignores, i, val); |
5485 | } |
5486 | Py_CLEAR(tmp); |
5487 | } |
5488 | *out = _PyAST_Module(body, type_ignores, arena); |
5489 | if (*out == NULL) goto failed0 ; Branch (5489:13): [True: 0, False: 568]
|
5490 | return 0; |
5491 | } |
5492 | tp = state->Interactive_type; |
5493 | isinstance = PyObject_IsInstance(obj, tp); |
5494 | if (isinstance == -1) { Branch (5494:9): [True: 0, False: 113]
|
5495 | return 1; |
5496 | } |
5497 | if (isinstance) { Branch (5497:9): [True: 2, False: 111]
|
5498 | asdl_stmt_seq* body; |
5499 | |
5500 | if (_PyObject_LookupAttr(obj, state->body, &tmp) < 0) { Branch (5500:13): [True: 0, False: 2]
|
5501 | return 1; |
5502 | } |
5503 | if (tmp == NULL) { Branch (5503:13): [True: 0, False: 2]
|
5504 | PyErr_SetString(PyExc_TypeError, "required field \"body\" missing from Interactive"); |
5505 | return 1; |
5506 | } |
5507 | else { |
5508 | int res; |
5509 | Py_ssize_t len; |
5510 | Py_ssize_t i; |
5511 | if (!PyList_Check(tmp)) { Branch (5511:17): [True: 0, False: 2]
|
5512 | PyErr_Format(PyExc_TypeError, "Interactive field \"body\" must be a list, not a %.200s", _PyType_Name(Py_TYPE(tmp))); |
5513 | goto failed; |
5514 | } |
5515 | len = PyList_GET_SIZE(tmp); |
5516 | body = _Py_asdl_stmt_seq_new(len, arena); |
5517 | if (body == NULL) goto failed0 ; Branch (5517:17): [True: 0, False: 2]
|
5518 | for (i = 0; 2 i < len; i++2 ) { Branch (5518:25): [True: 2, False: 2]
|
5519 | stmt_ty val; |
5520 | PyObject *tmp2 = PyList_GET_ITEM(tmp, i); |
5521 | Py_INCREF(tmp2); |
5522 | if (_Py_EnterRecursiveCall(" while traversing 'Interactive' node")) { Branch (5522:21): [True: 0, False: 2]
|
5523 | goto failed; |
5524 | } |
5525 | res = obj2ast_stmt(state, tmp2, &val, arena); |
5526 | _Py_LeaveRecursiveCall(); |
5527 | Py_DECREF(tmp2); |
5528 | if (res != 0) goto failed0 ; Branch (5528:21): [True: 0, False: 2]
|
5529 | if (len != PyList_GET_SIZE(tmp)) { Branch (5529:21): [True: 0, False: 2]
|
5530 | PyErr_SetString(PyExc_RuntimeError, "Interactive field \"body\" changed size during iteration"); |
5531 | goto failed; |
5532 | } |
5533 | asdl_seq_SET(body, i, val); |
5534 | } |
5535 | Py_CLEAR(tmp); |
5536 | } |
5537 | *out = _PyAST_Interactive(body, arena); |
5538 | if (*out == NULL) goto failed0 ; Branch (5538:13): [True: 0, False: 2]
|
5539 | return 0; |
5540 | } |
5541 | tp = state->Expression_type; |
5542 | isinstance = PyObject_IsInstance(obj, tp); |
5543 | if (isinstance == -1) { Branch (5543:9): [True: 0, False: 111]
|
5544 | return 1; |
5545 | } |
5546 | if (isinstance) { Branch (5546:9): [True: 111, False: 0]
|
5547 | expr_ty body; |
5548 | |
5549 | if (_PyObject_LookupAttr(obj, state->body, &tmp) < 0) { Branch (5549:13): [True: 0, False: 111]
|
5550 | return 1; |
5551 | } |
5552 | if (tmp == NULL) { Branch (5552:13): [True: 0, False: 111]
|
5553 | PyErr_SetString(PyExc_TypeError, "required field \"body\" missing from Expression"); |
5554 | return 1; |
5555 | } |
5556 | else { |
5557 | int res; |
5558 | if (_Py_EnterRecursiveCall(" while traversing 'Expression' node")) { Branch (5558:17): [True: 0, False: 111]
|
5559 | goto failed; |
5560 | } |
5561 | res = obj2ast_expr(state, tmp, &body, arena); |
5562 | _Py_LeaveRecursiveCall(); |
5563 | if (res != 0) goto failed2 ; Branch (5563:17): [True: 2, False: 109]
|
5564 | Py_CLEAR(tmp); |
5565 | } |
5566 | *out = _PyAST_Expression(body, arena); |
5567 | if (*out == NULL) goto failed0 ; Branch (5567:13): [True: 0, False: 109]
|
5568 | return 0; |
5569 | } |
5570 | tp = state->FunctionType_type; |
5571 | isinstance = PyObject_IsInstance(obj, tp); |
5572 | if (isinstance == -1) { Branch (5572:9): [True: 0, False: 0]
|
5573 | return 1; |
5574 | } |
5575 | if (isinstance) { Branch (5575:9): [True: 0, False: 0]
|
5576 | asdl_expr_seq* argtypes; |
5577 | expr_ty returns; |
5578 |
|
5579 | if (_PyObject_LookupAttr(obj, state->argtypes, &tmp) < 0) { Branch (5579:13): [True: 0, False: 0]
|
5580 | return 1; |
5581 | } |
5582 | if (tmp == NULL) { Branch (5582:13): [True: 0, False: 0]
|
5583 | PyErr_SetString(PyExc_TypeError, "required field \"argtypes\" missing from FunctionType"); |
5584 | return 1; |
5585 | } |
5586 | else { |
5587 | int res; |
5588 | Py_ssize_t len; |
5589 | Py_ssize_t i; |
5590 | if (!PyList_Check(tmp)) { Branch (5590:17): [True: 0, False: 0]
|
5591 | PyErr_Format(PyExc_TypeError, "FunctionType field \"argtypes\" must be a list, not a %.200s", _PyType_Name(Py_TYPE(tmp))); |
5592 | goto failed; |
5593 | } |
5594 | len = PyList_GET_SIZE(tmp); |
5595 | argtypes = _Py_asdl_expr_seq_new(len, arena); |
5596 | if (argtypes == NULL) goto failed; Branch (5596:17): [True: 0, False: 0]
|
5597 | for (i = 0; i < len; i++) { Branch (5597:25): [True: 0, False: 0]
|
5598 | expr_ty val; |
5599 | PyObject *tmp2 = PyList_GET_ITEM(tmp, i); |
5600 | Py_INCREF(tmp2); |
5601 | if (_Py_EnterRecursiveCall(" while traversing 'FunctionType' node")) { Branch (5601:21): [True: 0, False: 0]
|
5602 | goto failed; |
5603 | } |
5604 | res = obj2ast_expr(state, tmp2, &val, arena); |
5605 | _Py_LeaveRecursiveCall(); |
5606 | Py_DECREF(tmp2); |
5607 | if (res != 0) goto failed; Branch (5607:21): [True: 0, False: 0]
|
5608 | if (len != PyList_GET_SIZE(tmp)) { Branch (5608:21): [True: 0, False: 0]
|
5609 | PyErr_SetString(PyExc_RuntimeError, "FunctionType field \"argtypes\" changed size during iteration"); |
5610 | goto failed; |
5611 | } |
5612 | asdl_seq_SET(argtypes, i, val); |
5613 | } |
5614 | Py_CLEAR(tmp); |
5615 | } |
5616 | if (_PyObject_LookupAttr(obj, state->returns, &tmp) < 0) { Branch (5616:13): [True: 0, False: 0]
|
5617 | return 1; |
5618 | } |
5619 | if (tmp == NULL) { Branch (5619:13): [True: 0, False: 0]
|
5620 | PyErr_SetString(PyExc_TypeError, "required field \"returns\" missing from FunctionType"); |
5621 | return 1; |
5622 | } |
5623 | else { |
5624 | int res; |
5625 | if (_Py_EnterRecursiveCall(" while traversing 'FunctionType' node")) { Branch (5625:17): [True: 0, False: 0]
|
5626 | goto failed; |
5627 | } |
5628 | res = obj2ast_expr(state, tmp, &returns, arena); |
5629 | _Py_LeaveRecursiveCall(); |
5630 | if (res != 0) goto failed; Branch (5630:17): [True: 0, False: 0]
|
5631 | Py_CLEAR(tmp); |
5632 | } |
5633 | *out = _PyAST_FunctionType(argtypes, returns, arena); |
5634 | if (*out == NULL) goto failed; Branch (5634:13): [True: 0, False: 0]
|
5635 | return 0; |
5636 | } |
5637 | |
5638 | PyErr_Format(PyExc_TypeError, "expected some sort of mod, but got %R", obj); |
5639 | failed: |
5640 | Py_XDECREF(tmp); |
5641 | return 1; |
5642 | } |
5643 | |
5644 | int |
5645 | obj2ast_stmt(struct ast_state *state, PyObject* obj, stmt_ty* out, PyArena* |
5646 | arena) |
5647 | { |
5648 | int isinstance; |
5649 | |
5650 | PyObject *tmp = NULL; |
5651 | PyObject *tp; |
5652 | int lineno; |
5653 | int col_offset; |
5654 | int end_lineno; |
5655 | int end_col_offset; |
5656 | |
5657 | if (obj == Py_None) { Branch (5657:9): [True: 1, False: 69.9k]
|
5658 | *out = NULL; |
5659 | return 0; |
5660 | } |
5661 | if (_PyObject_LookupAttr(obj, state->lineno, &tmp) < 0) { Branch (5661:9): [True: 0, False: 69.9k]
|
5662 | return 1; |
5663 | } |
5664 | if (tmp == NULL) { Branch (5664:9): [True: 1, False: 69.9k]
|
5665 | PyErr_SetString(PyExc_TypeError, "required field \"lineno\" missing from stmt"); |
5666 | return 1; |
5667 | } |
5668 | else { |
5669 | int res; |
5670 | if (_Py_EnterRecursiveCall(" while traversing 'stmt' node")) { Branch (5670:13): [True: 0, False: 69.9k]
|
5671 | goto failed; |
5672 | } |
5673 | res = obj2ast_int(state, tmp, &lineno, arena); |
5674 | _Py_LeaveRecursiveCall(); |
5675 | if (res != 0) goto failed1 ; Branch (5675:13): [True: 1, False: 69.9k]
|
5676 | Py_CLEAR(tmp); |
5677 | } |
5678 | if (_PyObject_LookupAttr(obj, state->col_offset, &tmp) < 0) { Branch (5678:9): [True: 0, False: 69.9k]
|
5679 | return 1; |
5680 | } |
5681 | if (tmp == NULL) { Branch (5681:9): [True: 0, False: 69.9k]
|
5682 | PyErr_SetString(PyExc_TypeError, "required field \"col_offset\" missing from stmt"); |
5683 | return 1; |
5684 | } |
5685 | else { |
5686 | int res; |
5687 | if (_Py_EnterRecursiveCall(" while traversing 'stmt' node")) { Branch (5687:13): [True: 0, False: 69.9k]
|
5688 | goto failed; |
5689 | } |
5690 | res = obj2ast_int(state, tmp, &col_offset, arena); |
5691 | _Py_LeaveRecursiveCall(); |
5692 | if (res != 0) goto failed0 ; Branch (5692:13): [True: 0, False: 69.9k]
|
5693 | Py_CLEAR(tmp); |
5694 | } |
5695 | if (_PyObject_LookupAttr(obj, state->end_lineno, &tmp) < 0) { Branch (5695:9): [True: 0, False: 69.9k]
|
5696 | return 1; |
5697 | } |
5698 | if (tmp == NULL || tmp == Py_None) { Branch (5698:9): [True: 0, False: 69.9k]
Branch (5698:24): [True: 4, False: 69.9k]
|
5699 | Py_CLEAR(tmp); |
5700 | end_lineno = lineno; |
5701 | } |
5702 | else { |
5703 | int res; |
5704 | if (_Py_EnterRecursiveCall(" while traversing 'stmt' node")) { Branch (5704:13): [True: 0, False: 69.9k]
|
5705 | goto failed; |
5706 | } |
5707 | res = obj2ast_int(state, tmp, &end_lineno, arena); |
5708 | _Py_LeaveRecursiveCall(); |
5709 | if (res != 0) goto failed0 ; Branch (5709:13): [True: 0, False: 69.9k]
|
5710 | Py_CLEAR(tmp); |
5711 | } |
5712 | if (_PyObject_LookupAttr(obj, state->end_col_offset, &tmp) < 0) { Branch (5712:9): [True: 0, False: 69.9k]
|
5713 | return 1; |
5714 | } |
5715 | if (tmp == NULL || tmp == Py_None) { Branch (5715:9): [True: 0, False: 69.9k]
Branch (5715:24): [True: 4, False: 69.9k]
|
5716 | Py_CLEAR(tmp); |
5717 | end_col_offset = col_offset; |
5718 | } |
5719 | else { |
5720 | int res; |
5721 | if (_Py_EnterRecursiveCall(" while traversing 'stmt' node")) { Branch (5721:13): [True: 0, False: 69.9k]
|
5722 | goto failed; |
5723 | } |
5724 | res = obj2ast_int(state, tmp, &end_col_offset, arena); |
5725 | _Py_LeaveRecursiveCall(); |
5726 | if (res != 0) goto failed0 ; Branch (5726:13): [True: 0, False: 69.9k]
|
5727 | Py_CLEAR(tmp); |
5728 | } |
5729 | tp = state->FunctionDef_type; |
5730 | isinstance = PyObject_IsInstance(obj, tp); |
5731 | if (isinstance == -1) { Branch (5731:9): [True: 0, False: 69.9k]
|
5732 | return 1; |
5733 | } |
5734 | if (isinstance) { Branch (5734:9): [True: 7.39k, False: 62.6k]
|
5735 | identifier name; |
5736 | arguments_ty args; |
5737 | asdl_stmt_seq* body; |
5738 | asdl_expr_seq* decorator_list; |
5739 | expr_ty returns; |
5740 | string type_comment; |
5741 | |
5742 | if (_PyObject_LookupAttr(obj, state->name, &tmp) < 0) { Branch (5742:13): [True: 0, False: 7.39k]
|
5743 | return 1; |
5744 | } |
5745 | if (tmp == NULL) { Branch (5745:13): [True: 0, False: 7.39k]
|
5746 | PyErr_SetString(PyExc_TypeError, "required field \"name\" missing from FunctionDef"); |
5747 | return 1; |
5748 | } |
5749 | else { |
5750 | int res; |
5751 | if (_Py_EnterRecursiveCall(" while traversing 'FunctionDef' node")) { Branch (5751:17): [True: 0, False: 7.39k]
|
5752 | goto failed; |
5753 | } |
5754 | res = obj2ast_identifier(state, tmp, &name, arena); |
5755 | _Py_LeaveRecursiveCall(); |
5756 | if (res != 0) goto failed0 ; Branch (5756:17): [True: 0, False: 7.39k]
|
5757 | Py_CLEAR(tmp); |
5758 | } |
5759 | if (_PyObject_LookupAttr(obj, state->args, &tmp) < 0) { Branch (5759:13): [True: 0, False: 7.39k]
|
5760 | return 1; |
5761 | } |
5762 | if (tmp == NULL) { Branch (5762:13): [True: 0, False: 7.39k]
|
5763 | PyErr_SetString(PyExc_TypeError, "required field \"args\" missing from FunctionDef"); |
5764 | return 1; |
5765 | } |
5766 | else { |
5767 | int res; |
5768 | if (_Py_EnterRecursiveCall(" while traversing 'FunctionDef' node")) { Branch (5768:17): [True: 0, False: 7.39k]
|
5769 | goto failed; |
5770 | } |
5771 | res = obj2ast_arguments(state, tmp, &args, arena); |
5772 | _Py_LeaveRecursiveCall(); |
5773 | if (res != 0) goto failed0 ; Branch (5773:17): [True: 0, False: 7.39k]
|
5774 | Py_CLEAR(tmp); |
5775 | } |
5776 | if (_PyObject_LookupAttr(obj, state->body, &tmp) < 0) { Branch (5776:13): [True: 0, False: 7.39k]
|
5777 | return 1; |
5778 | } |
5779 | if (tmp == NULL) { Branch (5779:13): [True: 0, False: 7.39k]
|
5780 | PyErr_SetString(PyExc_TypeError, "required field \"body\" missing from FunctionDef"); |
5781 | return 1; |
5782 | } |
5783 | else { |
5784 | int res; |
5785 | Py_ssize_t len; |
5786 | Py_ssize_t i; |
5787 | if (!PyList_Check(tmp)) { Branch (5787:17): [True: 0, False: 7.39k]
|
5788 | PyErr_Format(PyExc_TypeError, "FunctionDef field \"body\" must be a list, not a %.200s", _PyType_Name(Py_TYPE(tmp))); |
5789 | goto failed; |
5790 | } |
5791 | len = PyList_GET_SIZE(tmp); |
5792 | body = _Py_asdl_stmt_seq_new(len, arena); |
5793 | if (body == NULL) goto failed0 ; Branch (5793:17): [True: 0, False: 7.39k]
|
5794 | for (i = 0; 7.39k i < len; i++27.0k ) { Branch (5794:25): [True: 27.0k, False: 7.39k]
|
5795 | stmt_ty val; |
5796 | PyObject *tmp2 = PyList_GET_ITEM(tmp, i); |
5797 | Py_INCREF(tmp2); |
5798 | if (_Py_EnterRecursiveCall(" while traversing 'FunctionDef' node")) { Branch (5798:21): [True: 0, False: 27.0k]
|
5799 | goto failed; |
5800 | } |
5801 | res = obj2ast_stmt(state, tmp2, &val, arena); |
5802 | _Py_LeaveRecursiveCall(); |
5803 | Py_DECREF(tmp2); |
5804 | if (res != 0) goto failed1 ; Branch (5804:21): [True: 1, False: 27.0k]
|
5805 | if (len != PyList_GET_SIZE(tmp)) { Branch (5805:21): [True: 0, False: 27.0k]
|
5806 | PyErr_SetString(PyExc_RuntimeError, "FunctionDef field \"body\" changed size during iteration"); |
5807 | goto failed; |
5808 | } |
5809 | asdl_seq_SET(body, i, val); |
5810 | } |
5811 | Py_CLEAR(tmp); |
5812 | } |
5813 | if (_PyObject_LookupAttr(obj, state->decorator_list, &tmp) < 0) { Branch (5813:13): [True: 0, False: 7.39k]
|
5814 | return 1; |
5815 | } |
5816 | if (tmp == NULL) { Branch (5816:13): [True: 0, False: 7.39k]
|
5817 | PyErr_SetString(PyExc_TypeError, "required field \"decorator_list\" missing from FunctionDef"); |
5818 | return 1; |
5819 | } |
5820 | else { |
5821 | int res; |
5822 | Py_ssize_t len; |
5823 | Py_ssize_t i; |
5824 | if (!PyList_Check(tmp)) { Branch (5824:17): [True: 0, False: 7.39k]
|
5825 | PyErr_Format(PyExc_TypeError, "FunctionDef field \"decorator_list\" must be a list, not a %.200s", _PyType_Name(Py_TYPE(tmp))); |
5826 | goto failed; |
5827 | } |
5828 | len = PyList_GET_SIZE(tmp); |
5829 | decorator_list = _Py_asdl_expr_seq_new(len, arena); |
5830 | if (decorator_list == NULL) goto failed0 ; Branch (5830:17): [True: 0, False: 7.39k]
|
5831 | for (i = 0; 7.39k i < len; i++620 ) { Branch (5831:25): [True: 620, False: 7.39k]
|
5832 | expr_ty val; |
5833 | PyObject *tmp2 = PyList_GET_ITEM(tmp, i); |
5834 | Py_INCREF(tmp2); |
5835 | if (_Py_EnterRecursiveCall(" while traversing 'FunctionDef' node")) { Branch (5835:21): [True: 0, False: 620]
|
5836 | goto failed; |
5837 | } |
5838 | res = obj2ast_expr(state, tmp2, &val, arena); |
5839 | _Py_LeaveRecursiveCall(); |
5840 | Py_DECREF(tmp2); |
5841 | if (res != 0) goto failed0 ; Branch (5841:21): [True: 0, False: 620]
|
5842 | if (len != PyList_GET_SIZE(tmp)) { Branch (5842:21): [True: 0, False: 620]
|
5843 | PyErr_SetString(PyExc_RuntimeError, "FunctionDef field \"decorator_list\" changed size during iteration"); |
5844 | goto failed; |
5845 | } |
5846 | asdl_seq_SET(decorator_list, i, val); |
5847 | } |
5848 | Py_CLEAR(tmp); |
5849 | } |
5850 | if (_PyObject_LookupAttr(obj, state->returns, &tmp) < 0) { Branch (5850:13): [True: 0, False: 7.39k]
|
5851 | return 1; |
5852 | } |
5853 | if (tmp == NULL || tmp == Py_None) { Branch (5853:13): [True: 0, False: 7.39k]
Branch (5853:28): [True: 7.33k, False: 56]
|
5854 | Py_CLEAR(tmp); |
5855 | returns = NULL; |
5856 | } |
5857 | else { |
5858 | int res; |
5859 | if (_Py_EnterRecursiveCall(" while traversing 'FunctionDef' node")) { Branch (5859:17): [True: 0, False: 56]
|
5860 | goto failed; |
5861 | } |
5862 | res = obj2ast_expr(state, tmp, &returns, arena); |
5863 | _Py_LeaveRecursiveCall(); |
5864 | if (res != 0) goto failed0 ; Branch (5864:17): [True: 0, False: 56]
|
5865 | Py_CLEAR(tmp); |
5866 | } |
5867 | if (_PyObject_LookupAttr(obj, state->type_comment, &tmp) < 0) { Branch (5867:13): [True: 0, False: 7.39k]
|
5868 | return 1; |
5869 | } |
5870 | if (tmp == NULL || tmp == Py_None) { Branch (5870:13): [True: 0, False: 7.39k]
Branch (5870:28): [True: 7.39k, False: 0]
|
5871 | Py_CLEAR(tmp); |
5872 | type_comment = NULL; |
5873 | } |
5874 | else { |
5875 | int res; |
5876 | if (_Py_EnterRecursiveCall(" while traversing 'FunctionDef' node")) { Branch (5876:17): [True: 0, False: 0]
|
5877 | goto failed; |
5878 | } |
5879 | res = obj2ast_string(state, tmp, &type_comment, arena); |
5880 | _Py_LeaveRecursiveCall(); |
5881 | if (res != 0) goto failed; Branch (5881:17): [True: 0, False: 0]
|
5882 | Py_CLEAR(tmp); |
5883 | } |
5884 | *out = _PyAST_FunctionDef(name, args, body, decorator_list, returns, |
5885 | type_comment, lineno, col_offset, end_lineno, |
5886 | end_col_offset, arena); |
5887 | if (*out == NULL) goto failed0 ; Branch (5887:13): [True: 0, False: 7.39k]
|
5888 | return 0; |
5889 | } |
5890 | tp = state->AsyncFunctionDef_type; |
5891 | isinstance = PyObject_IsInstance(obj, tp); |
5892 | if (isinstance == -1) { Branch (5892:9): [True: 0, False: 62.6k]
|
5893 | return 1; |
5894 | } |
5895 | if (isinstance) { Branch (5895:9): [True: 41, False: 62.5k]
|
5896 | identifier name; |
5897 | arguments_ty args; |
5898 | asdl_stmt_seq* body; |
5899 | asdl_expr_seq* decorator_list; |
5900 | expr_ty returns; |
5901 | string type_comment; |
5902 | |
5903 | if (_PyObject_LookupAttr(obj, state->name, &tmp) < 0) { Branch (5903:13): [True: 0, False: 41]
|
5904 | return 1; |
5905 | } |
5906 | if (tmp == NULL) { Branch (5906:13): [True: 0, False: 41]
|
5907 | PyErr_SetString(PyExc_TypeError, "required field \"name\" missing from AsyncFunctionDef"); |
5908 | return 1; |
5909 | } |
5910 | else { |
5911 | int res; |
5912 | if (_Py_EnterRecursiveCall(" while traversing 'AsyncFunctionDef' node")) { Branch (5912:17): [True: 0, False: 41]
|
5913 | goto failed; |
5914 | } |
5915 | res = obj2ast_identifier(state, tmp, &name, arena); |
5916 | _Py_LeaveRecursiveCall(); |
5917 | if (res != 0) goto failed0 ; Branch (5917:17): [True: 0, False: 41]
|
5918 | Py_CLEAR(tmp); |
5919 | } |
5920 | if (_PyObject_LookupAttr(obj, state->args, &tmp) < 0) { Branch (5920:13): [True: 0, False: 41]
|
5921 | return 1; |
5922 | } |
5923 | if (tmp == NULL) { Branch (5923:13): [True: 0, False: 41]
|
5924 | PyErr_SetString(PyExc_TypeError, "required field \"args\" missing from AsyncFunctionDef"); |
5925 | return 1; |
5926 | } |
5927 | else { |
5928 | int res; |
5929 | if (_Py_EnterRecursiveCall(" while traversing 'AsyncFunctionDef' node")) { Branch (5929:17): [True: 0, False: 41]
|
5930 | goto failed; |
5931 | } |
5932 | res = obj2ast_arguments(state, tmp, &args, arena); |
5933 | _Py_LeaveRecursiveCall(); |
5934 | if (res != 0) goto failed0 ; Branch (5934:17): [True: 0, False: 41]
|
5935 | Py_CLEAR(tmp); |
5936 | } |
5937 | if (_PyObject_LookupAttr(obj, state->body, &tmp) < 0) { Branch (5937:13): [True: 0, False: 41]
|
5938 | return 1; |
5939 | } |
5940 | if (tmp == NULL) { Branch (5940:13): [True: 0, False: 41]
|
5941 | PyErr_SetString(PyExc_TypeError, "required field \"body\" missing from AsyncFunctionDef"); |
5942 | return 1; |
5943 | } |
5944 | else { |
5945 | int res; |
5946 | Py_ssize_t len; |
5947 | Py_ssize_t i; |
5948 | if (!PyList_Check(tmp)) { Branch (5948:17): [True: 0, False: 41]
|
5949 | PyErr_Format(PyExc_TypeError, "AsyncFunctionDef field \"body\" must be a list, not a %.200s", _PyType_Name(Py_TYPE(tmp))); |
5950 | goto failed; |
5951 | } |
5952 | len = PyList_GET_SIZE(tmp); |
5953 | body = _Py_asdl_stmt_seq_new(len, arena); |
5954 | if (body == NULL) goto failed0 ; Branch (5954:17): [True: 0, False: 41]
|
5955 | for (i = 0; 41 i < len; i++76 ) { Branch (5955:25): [True: 76, False: 41]
|
5956 | stmt_ty val; |
5957 | PyObject *tmp2 = PyList_GET_ITEM(tmp, i); |
5958 | Py_INCREF(tmp2); |
5959 | if (_Py_EnterRecursiveCall(" while traversing 'AsyncFunctionDef' node")) { Branch (5959:21): [True: 0, False: 76]
|
5960 | goto failed; |
5961 | } |
5962 | res = obj2ast_stmt(state, tmp2, &val, arena); |
5963 | _Py_LeaveRecursiveCall(); |
5964 | Py_DECREF(tmp2); |
5965 | if (res != 0) goto failed0 ; Branch (5965:21): [True: 0, False: 76]
|
5966 | if (len != PyList_GET_SIZE(tmp)) { Branch (5966:21): [True: 0, False: 76]
|
5967 | PyErr_SetString(PyExc_RuntimeError, "AsyncFunctionDef field \"body\" changed size during iteration"); |
5968 | goto failed; |
5969 | } |
5970 | asdl_seq_SET(body, i, val); |
5971 | } |
5972 | Py_CLEAR(tmp); |
5973 | } |
5974 | if (_PyObject_LookupAttr(obj, state->decorator_list, &tmp) < 0) { Branch (5974:13): [True: 0, False: 41]
|
5975 | return 1; |
5976 | } |
5977 | if (tmp == NULL) { Branch (5977:13): [True: 0, False: 41]
|
5978 | PyErr_SetString(PyExc_TypeError, "required field \"decorator_list\" missing from AsyncFunctionDef"); |
5979 | return 1; |
5980 | } |
5981 | else { |
5982 | int res; |
5983 | Py_ssize_t len; |
5984 | Py_ssize_t i; |
5985 | if (!PyList_Check(tmp)) { Branch (5985:17): [True: 0, False: 41]
|
5986 | PyErr_Format(PyExc_TypeError, "AsyncFunctionDef field \"decorator_list\" must be a list, not a %.200s", _PyType_Name(Py_TYPE(tmp))); |
5987 | goto failed; |
5988 | } |
5989 | len = PyList_GET_SIZE(tmp); |
5990 | decorator_list = _Py_asdl_expr_seq_new(len, arena); |
5991 | if (decorator_list == NULL) goto failed0 ; Branch (5991:17): [True: 0, False: 41]
|
5992 | for (i = 0; 41 i < len; i++12 ) { Branch (5992:25): [True: 12, False: 41]
|
5993 | expr_ty val; |
5994 | PyObject *tmp2 = PyList_GET_ITEM(tmp, i); |
5995 | Py_INCREF(tmp2); |
5996 | if (_Py_EnterRecursiveCall(" while traversing 'AsyncFunctionDef' node")) { Branch (5996:21): [True: 0, False: 12]
|
5997 | goto failed; |
5998 | } |
5999 | res = obj2ast_expr(state, tmp2, &val, arena); |
6000 | _Py_LeaveRecursiveCall(); |
6001 | Py_DECREF(tmp2); |
6002 | if (res != 0) goto failed0 ; Branch (6002:21): [True: 0, False: 12]
|
6003 | if (len != PyList_GET_SIZE(tmp)) { Branch (6003:21): [True: 0, False: 12]
|
6004 | PyErr_SetString(PyExc_RuntimeError, "AsyncFunctionDef field \"decorator_list\" changed size during iteration"); |
6005 | goto failed; |
6006 | } |
6007 | asdl_seq_SET(decorator_list, i, val); |
6008 | } |
6009 | Py_CLEAR(tmp); |
6010 | } |
6011 | if (_PyObject_LookupAttr(obj, state->returns, &tmp) < 0) { Branch (6011:13): [True: 0, False: 41]
|
6012 | return 1; |
6013 | } |
6014 | if (tmp == NULL || tmp == Py_None) { Branch (6014:13): [True: 0, False: 41]
Branch (6014:28): [True: 41, False: 0]
|
6015 | Py_CLEAR(tmp); |
6016 | returns = NULL; |
6017 | } |
6018 | else { |
6019 | int res; |
6020 | if (_Py_EnterRecursiveCall(" while traversing 'AsyncFunctionDef' node")) { Branch (6020:17): [True: 0, False: 0]
|
6021 | goto failed; |
6022 | } |
6023 | res = obj2ast_expr(state, tmp, &returns, arena); |
6024 | _Py_LeaveRecursiveCall(); |
6025 | if (res != 0) goto failed; Branch (6025:17): [True: 0, False: 0]
|
6026 | Py_CLEAR(tmp); |
6027 | } |
6028 | if (_PyObject_LookupAttr(obj, state->type_comment, &tmp) < 0) { Branch (6028:13): [True: 0, False: 41]
|
6029 | return 1; |
6030 | } |
6031 | if (tmp == NULL || tmp == Py_None) { Branch (6031:13): [True: 0, False: 41]
Branch (6031:28): [True: 41, False: 0]
|
6032 | Py_CLEAR(tmp); |
6033 | type_comment = NULL; |
6034 | } |
6035 | else { |
6036 | int res; |
6037 | if (_Py_EnterRecursiveCall(" while traversing 'AsyncFunctionDef' node")) { Branch (6037:17): [True: 0, False: 0]
|
6038 | goto failed; |
6039 | } |
6040 | res = obj2ast_string(state, tmp, &type_comment, arena); |
6041 | _Py_LeaveRecursiveCall(); |
6042 | if (res != 0) goto failed; Branch (6042:17): [True: 0, False: 0]
|
6043 | Py_CLEAR(tmp); |
6044 | } |
6045 | *out = _PyAST_AsyncFunctionDef(name, args, body, decorator_list, |
6046 | returns, type_comment, lineno, |
6047 | col_offset, end_lineno, end_col_offset, |
6048 | arena); |
6049 | if (*out == NULL) goto failed0 ; Branch (6049:13): [True: 0, False: 41]
|
6050 | return 0; |
6051 | } |
6052 | tp = state->ClassDef_type; |
6053 | isinstance = PyObject_IsInstance(obj, tp); |
6054 | if (isinstance == -1) { Branch (6054:9): [True: 0, False: 62.5k]
|
6055 | return 1; |
6056 | } |
6057 | if (isinstance) { Branch (6057:9): [True: 830, False: 61.7k]
|
6058 | identifier name; |
6059 | asdl_expr_seq* bases; |
6060 | asdl_keyword_seq* keywords; |
6061 | asdl_stmt_seq* body; |
6062 | asdl_expr_seq* decorator_list; |
6063 | |
6064 | if (_PyObject_LookupAttr(obj, state->name, &tmp) < 0) { Branch (6064:13): [True: 0, False: 830]
|
6065 | return 1; |
6066 | } |
6067 | if (tmp == NULL) { Branch (6067:13): [True: 0, False: 830]
|
6068 | PyErr_SetString(PyExc_TypeError, "required field \"name\" missing from ClassDef"); |
6069 | return 1; |
6070 | } |
6071 | else { |
6072 | int res; |
6073 | if (_Py_EnterRecursiveCall(" while traversing 'ClassDef' node")) { Branch (6073:17): [True: 0, False: 830]
|
6074 | goto failed; |
6075 | } |
6076 | res = obj2ast_identifier(state, tmp, &name, arena); |
6077 | _Py_LeaveRecursiveCall(); |
6078 | if (res != 0) goto failed0 ; Branch (6078:17): [True: 0, False: 830]
|
6079 | Py_CLEAR(tmp); |
6080 | } |
6081 | if (_PyObject_LookupAttr(obj, state->bases, &tmp) < 0) { Branch (6081:13): [True: 0, False: 830]
|
6082 | return 1; |
6083 | } |
6084 | if (tmp == NULL) { Branch (6084:13): [True: 0, False: 830]
|
6085 | PyErr_SetString(PyExc_TypeError, "required field \"bases\" missing from ClassDef"); |
6086 | return 1; |
6087 | } |
6088 | else { |
6089 | int res; |
6090 | Py_ssize_t len; |
6091 | Py_ssize_t i; |
6092 | if (!PyList_Check(tmp)) { Branch (6092:17): [True: 0, False: 830]
|
6093 | PyErr_Format(PyExc_TypeError, "ClassDef field \"bases\" must be a list, not a %.200s", _PyType_Name(Py_TYPE(tmp))); |
6094 | goto failed; |
6095 | } |
6096 | len = PyList_GET_SIZE(tmp); |
6097 | bases = _Py_asdl_expr_seq_new(len, arena); |
6098 | if (bases == NULL) goto failed0 ; Branch (6098:17): [True: 0, False: 830]
|
6099 | for (i = 0; 830 i < len; i++615 ) { Branch (6099:25): [True: 615, False: 830]
|
6100 | expr_ty val; |
6101 | PyObject *tmp2 = PyList_GET_ITEM(tmp, i); |
6102 | Py_INCREF(tmp2); |
6103 | if (_Py_EnterRecursiveCall(" while traversing 'ClassDef' node")) { Branch (6103:21): [True: 0, False: 615]
|
6104 | goto failed; |
6105 | } |
6106 | res = obj2ast_expr(state, tmp2, &val, arena); |
6107 | _Py_LeaveRecursiveCall(); |
6108 | Py_DECREF(tmp2); |
6109 | if (res != 0) goto failed0 ; Branch (6109:21): [True: 0, False: 615]
|
6110 | if (len != PyList_GET_SIZE(tmp)) { Branch (6110:21): [True: 0, False: 615]
|
6111 | PyErr_SetString(PyExc_RuntimeError, "ClassDef field \"bases\" changed size during iteration"); |
6112 | goto failed; |
6113 | } |
6114 | asdl_seq_SET(bases, i, val); |
6115 | } |
6116 | Py_CLEAR(tmp); |
6117 | } |
6118 | if (_PyObject_LookupAttr(obj, state->keywords, &tmp) < 0) { Branch (6118:13): [True: 0, False: 830]
|
6119 | return 1; |
6120 | } |
6121 | if (tmp == NULL) { Branch (6121:13): [True: 0, False: 830]
|
6122 | PyErr_SetString(PyExc_TypeError, "required field \"keywords\" missing from ClassDef"); |
6123 | return 1; |
6124 | } |
6125 | else { |
6126 | int res; |
6127 | Py_ssize_t len; |
6128 | Py_ssize_t i; |
6129 | if (!PyList_Check(tmp)) { Branch (6129:17): [True: 0, False: 830]
|
6130 | PyErr_Format(PyExc_TypeError, "ClassDef field \"keywords\" must be a list, not a %.200s", _PyType_Name(Py_TYPE(tmp))); |
6131 | goto failed; |
6132 | } |
6133 | len = PyList_GET_SIZE(tmp); |
6134 | keywords = _Py_asdl_keyword_seq_new(len, arena); |
6135 | if (keywords == NULL) goto failed0 ; Branch (6135:17): [True: 0, False: 830]
|
6136 | for (i = 0; 830 i < len; i++45 ) { Branch (6136:25): [True: 45, False: 830]
|
6137 | keyword_ty val; |
6138 | PyObject *tmp2 = PyList_GET_ITEM(tmp, i); |
6139 | Py_INCREF(tmp2); |
6140 | if (_Py_EnterRecursiveCall(" while traversing 'ClassDef' node")) { Branch (6140:21): [True: 0, False: 45]
|
6141 | goto failed; |
6142 | } |
6143 | res = obj2ast_keyword(state, tmp2, &val, arena); |
6144 | _Py_LeaveRecursiveCall(); |
6145 | Py_DECREF(tmp2); |
6146 | if (res != 0) goto failed0 ; Branch (6146:21): [True: 0, False: 45]
|
6147 | if (len != PyList_GET_SIZE(tmp)) { Branch (6147:21): [True: 0, False: 45]
|
6148 | PyErr_SetString(PyExc_RuntimeError, "ClassDef field \"keywords\" changed size during iteration"); |
6149 | goto failed; |
6150 | } |
6151 | asdl_seq_SET(keywords, i, val); |
6152 | } |
6153 | Py_CLEAR(tmp); |
6154 | } |
6155 | if (_PyObject_LookupAttr(obj, state->body, &tmp) < 0) { Branch (6155:13): [True: 0, False: 830]
|
6156 | return 1; |
6157 | } |
6158 | if (tmp == NULL) { Branch (6158:13): [True: 0, False: 830]
|
6159 | PyErr_SetString(PyExc_TypeError, "required field \"body\" missing from ClassDef"); |
6160 | return 1; |
6161 | } |
6162 | else { |
6163 | int res; |
6164 | Py_ssize_t len; |
6165 | Py_ssize_t i; |
6166 | if (!PyList_Check(tmp)) { Branch (6166:17): [True: 0, False: 830]
|
6167 | PyErr_Format(PyExc_TypeError, "ClassDef field \"body\" must be a list, not a %.200s", _PyType_Name(Py_TYPE(tmp))); |
6168 | goto failed; |
6169 | } |
6170 | len = PyList_GET_SIZE(tmp); |
6171 | body = _Py_asdl_stmt_seq_new(len, arena); |
6172 | if (body == NULL) goto failed0 ; Branch (6172:17): [True: 0, False: 830]
|
6173 | for (i = 0; 830 i < len; i++6.87k ) { Branch (6173:25): [True: 6.87k, False: 830]
|
6174 | stmt_ty val; |
6175 | PyObject *tmp2 = PyList_GET_ITEM(tmp, i); |
6176 | Py_INCREF(tmp2); |
6177 | if (_Py_EnterRecursiveCall(" while traversing 'ClassDef' node")) { Branch (6177:21): [True: 0, False: 6.87k]
|
6178 | goto failed; |
6179 | } |
6180 | res = obj2ast_stmt(state, tmp2, &val, arena); |
6181 | _Py_LeaveRecursiveCall(); |
6182 | Py_DECREF(tmp2); |
6183 | if (res != 0) goto failed0 ; Branch (6183:21): [True: 0, False: 6.87k]
|
6184 | if (len != PyList_GET_SIZE(tmp)) { Branch (6184:21): [True: 0, False: 6.87k]
|
6185 | PyErr_SetString(PyExc_RuntimeError, "ClassDef field \"body\" changed size during iteration"); |
6186 | goto failed; |
6187 | } |
6188 | asdl_seq_SET(body, i, val); |
6189 | } |
6190 | Py_CLEAR(tmp); |
6191 | } |
6192 | if (_PyObject_LookupAttr(obj, state->decorator_list, &tmp) < 0) { Branch (6192:13): [True: 0, False: 830]
|
6193 | return 1; |
6194 | } |
6195 | if (tmp == NULL) { Branch (6195:13): [True: 0, False: 830]
|
6196 | PyErr_SetString(PyExc_TypeError, "required field \"decorator_list\" missing from ClassDef"); |
6197 | return 1; |
6198 | } |
6199 | else { |
6200 | int res; |
6201 | Py_ssize_t len; |
6202 | Py_ssize_t i; |
6203 | if (!PyList_Check(tmp)) { Branch (6203:17): [True: 0, False: 830]
|
6204 | PyErr_Format(PyExc_TypeError, "ClassDef field \"decorator_list\" must be a list, not a %.200s", _PyType_Name(Py_TYPE(tmp))); |
6205 | goto failed; |
6206 | } |
6207 | len = PyList_GET_SIZE(tmp); |
6208 | decorator_list = _Py_asdl_expr_seq_new(len, arena); |
6209 | if (decorator_list == NULL) goto failed0 ; Branch (6209:17): [True: 0, False: 830]
|
6210 | for (i = 0; 830 i < len; i++36 ) { Branch (6210:25): [True: 36, False: 830]
|
6211 | expr_ty val; |
6212 | PyObject *tmp2 = PyList_GET_ITEM(tmp, i); |
6213 | Py_INCREF(tmp2); |
6214 | if (_Py_EnterRecursiveCall(" while traversing 'ClassDef' node")) { Branch (6214:21): [True: 0, False: 36]
|
6215 | goto failed; |
6216 | } |
6217 | res = obj2ast_expr(state, tmp2, &val, arena); |
6218 | _Py_LeaveRecursiveCall(); |
6219 | Py_DECREF(tmp2); |
6220 | if (res != 0) goto failed0 ; Branch (6220:21): [True: 0, False: 36]
|
6221 | if (len != PyList_GET_SIZE(tmp)) { Branch (6221:21): [True: 0, False: 36]
|
6222 | PyErr_SetString(PyExc_RuntimeError, "ClassDef field \"decorator_list\" changed size during iteration"); |
6223 | goto failed; |
6224 | } |
6225 | asdl_seq_SET(decorator_list, i, val); |
6226 | } |
6227 | Py_CLEAR(tmp); |
6228 | } |
6229 | *out = _PyAST_ClassDef(name, bases, keywords, body, decorator_list, |
6230 | lineno, col_offset, end_lineno, end_col_offset, |
6231 | arena); |
6232 | if (*out == NULL) goto failed0 ; Branch (6232:13): [True: 0, False: 830]
|
6233 | return 0; |
6234 | } |
6235 | tp = state->Return_type; |
6236 | isinstance = PyObject_IsInstance(obj, tp); |
6237 | if (isinstance == -1) { Branch (6237:9): [True: 0, False: 61.7k]
|
6238 | return 1; |
6239 | } |
6240 | if (isinstance) { Branch (6240:9): [True: 7.06k, False: 54.6k]
|
6241 | expr_ty value; |
6242 | |
6243 | if (_PyObject_LookupAttr(obj, state->value, &tmp) < 0) { Branch (6243:13): [True: 0, False: 7.06k]
|
6244 | return 1; |
6245 | } |
6246 | if (tmp == NULL || tmp == Py_None) { Branch (6246:13): [True: 0, False: 7.06k]
Branch (6246:28): [True: 340, False: 6.72k]
|
6247 | Py_CLEAR(tmp); |
6248 | value = NULL; |
6249 | } |
6250 | else { |
6251 | int res; |
6252 | if (_Py_EnterRecursiveCall(" while traversing 'Return' node")) { Branch (6252:17): [True: 0, False: 6.72k]
|
6253 | goto failed; |
6254 | } |
6255 | res = obj2ast_expr(state, tmp, &value, arena); |
6256 | _Py_LeaveRecursiveCall(); |
6257 | if (res != 0) goto failed0 ; Branch (6257:17): [True: 0, False: 6.72k]
|
6258 | Py_CLEAR(tmp); |
6259 | } |
6260 | *out = _PyAST_Return(value, lineno, col_offset, end_lineno, |
6261 | end_col_offset, arena); |
6262 | if (*out == NULL) goto failed0 ; Branch (6262:13): [True: 0, False: 7.06k]
|
6263 | return 0; |
6264 | } |
6265 | tp = state->Delete_type; |
6266 | isinstance = PyObject_IsInstance(obj, tp); |
6267 | if (isinstance == -1) { Branch (6267:9): [True: 0, False: 54.6k]
|
6268 | return 1; |
6269 | } |
6270 | if (isinstance) { Branch (6270:9): [True: 223, False: 54.4k]
|
6271 | asdl_expr_seq* targets; |
6272 | |
6273 | if (_PyObject_LookupAttr(obj, state->targets, &tmp) < 0) { Branch (6273:13): [True: 0, False: 223]
|
6274 | return 1; |
6275 | } |
6276 | if (tmp == NULL) { Branch (6276:13): [True: 0, False: 223]
|
6277 | PyErr_SetString(PyExc_TypeError, "required field \"targets\" missing from Delete"); |
6278 | return 1; |
6279 | } |
6280 | else { |
6281 | int res; |
6282 | Py_ssize_t len; |
6283 | Py_ssize_t i; |
6284 | if (!PyList_Check(tmp)) { Branch (6284:17): [True: 0, False: 223]
|
6285 | PyErr_Format(PyExc_TypeError, "Delete field \"targets\" must be a list, not a %.200s", _PyType_Name(Py_TYPE(tmp))); |
6286 | goto failed; |
6287 | } |
6288 | len = PyList_GET_SIZE(tmp); |
6289 | targets = _Py_asdl_expr_seq_new(len, arena); |
6290 | if (targets == NULL) goto failed0 ; Branch (6290:17): [True: 0, False: 223]
|
6291 | for (i = 0; 223 i < len; i++266 ) { Branch (6291:25): [True: 266, False: 223]
|
6292 | expr_ty val; |
6293 | PyObject *tmp2 = PyList_GET_ITEM(tmp, i); |
6294 | Py_INCREF(tmp2); |
6295 | if (_Py_EnterRecursiveCall(" while traversing 'Delete' node")) { Branch (6295:21): [True: 0, False: 266]
|
6296 | goto failed; |
6297 | } |
6298 | res = obj2ast_expr(state, tmp2, &val, arena); |
6299 | _Py_LeaveRecursiveCall(); |
6300 | Py_DECREF(tmp2); |
6301 | if (res != 0) goto failed0 ; Branch (6301:21): [True: 0, False: 266]
|
6302 | if (len != PyList_GET_SIZE(tmp)) { Branch (6302:21): [True: 0, False: 266]
|
6303 | PyErr_SetString(PyExc_RuntimeError, "Delete field \"targets\" changed size during iteration"); |
6304 | goto failed; |
6305 | } |
6306 | asdl_seq_SET(targets, i, val); |
6307 | } |
6308 | Py_CLEAR(tmp); |
6309 | } |
6310 | *out = _PyAST_Delete(targets, lineno, col_offset, end_lineno, |
6311 | end_col_offset, arena); |
6312 | if (*out == NULL) goto failed0 ; Branch (6312:13): [True: 0, False: 223]
|
6313 | return 0; |
6314 | } |
6315 | tp = state->Assign_type; |
6316 | isinstance = PyObject_IsInstance(obj, tp); |
6317 | if (isinstance == -1) { Branch (6317:9): [True: 0, False: 54.4k]
|
6318 | return 1; |
6319 | } |
6320 | if (isinstance) { Branch (6320:9): [True: 20.8k, False: 33.5k]
|
6321 | asdl_expr_seq* targets; |
6322 | expr_ty value; |
6323 | string type_comment; |
6324 | |
6325 | if (_PyObject_LookupAttr(obj, state->targets, &tmp) < 0) { Branch (6325:13): [True: 0, False: 20.8k]
|
6326 | return 1; |
6327 | } |
6328 | if (tmp == NULL) { Branch (6328:13): [True: 0, False: 20.8k]
|
6329 | PyErr_SetString(PyExc_TypeError, "required field \"targets\" missing from Assign"); |
6330 | return 1; |
6331 | } |
6332 | else { |
6333 | int res; |
6334 | Py_ssize_t len; |
6335 | Py_ssize_t i; |
6336 | if (!PyList_Check(tmp)) { Branch (6336:17): [True: 0, False: 20.8k]
|
6337 | PyErr_Format(PyExc_TypeError, "Assign field \"targets\" must be a list, not a %.200s", _PyType_Name(Py_TYPE(tmp))); |
6338 | goto failed; |
6339 | } |
6340 | len = PyList_GET_SIZE(tmp); |
6341 | targets = _Py_asdl_expr_seq_new(len, arena); |
6342 | if (targets == NULL) goto failed0 ; Branch (6342:17): [True: 0, False: 20.8k]
|
6343 | for (i = 0; 20.8k i < len; i++21.0k ) { Branch (6343:25): [True: 21.0k, False: 20.8k]
|
6344 | expr_ty val; |
6345 | PyObject *tmp2 = PyList_GET_ITEM(tmp, i); |
6346 | Py_INCREF(tmp2); |
6347 | if (_Py_EnterRecursiveCall(" while traversing 'Assign' node")) { Branch (6347:21): [True: 0, False: 21.0k]
|
6348 | goto failed; |
6349 | } |
6350 | res = obj2ast_expr(state, tmp2, &val, arena); |
6351 | _Py_LeaveRecursiveCall(); |
6352 | Py_DECREF(tmp2); |
6353 | if (res != 0) goto failed0 ; Branch (6353:21): [True: 0, False: 21.0k]
|
6354 | if (len != PyList_GET_SIZE(tmp)) { Branch (6354:21): [True: 0, False: 21.0k]
|
6355 | PyErr_SetString(PyExc_RuntimeError, "Assign field \"targets\" changed size during iteration"); |
6356 | goto failed; |
6357 | } |
6358 | asdl_seq_SET(targets, i, val); |
6359 | } |
6360 | Py_CLEAR(tmp); |
6361 | } |
6362 | if (_PyObject_LookupAttr(obj, state->value, &tmp) < 0) { Branch (6362:13): [True: 0, False: 20.8k]
|
6363 | return 1; |
6364 | } |
6365 | if (tmp == NULL) { Branch (6365:13): [True: 0, False: 20.8k]
|
6366 | PyErr_SetString(PyExc_TypeError, "required field \"value\" missing from Assign"); |
6367 | return 1; |
6368 | } |
6369 | else { |
6370 | int res; |
6371 | if (_Py_EnterRecursiveCall(" while traversing 'Assign' node")) { Branch (6371:17): [True: 0, False: 20.8k]
|
6372 | goto failed; |
6373 | } |
6374 | res = obj2ast_expr(state, tmp, &value, arena); |
6375 | _Py_LeaveRecursiveCall(); |
6376 | if (res != 0) goto failed0 ; Branch (6376:17): [True: 0, False: 20.8k]
|
6377 | Py_CLEAR(tmp); |
6378 | } |
6379 | if (_PyObject_LookupAttr(obj, state->type_comment, &tmp) < 0) { Branch (6379:13): [True: 0, False: 20.8k]
|
6380 | return 1; |
6381 | } |
6382 | if (tmp == NULL || tmp == Py_None) { Branch (6382:13): [True: 0, False: 20.8k]
Branch (6382:28): [True: 20.8k, False: 0]
|
6383 | Py_CLEAR(tmp); |
6384 | type_comment = NULL; |
6385 | } |
6386 | else { |
6387 | int res; |
6388 | if (_Py_EnterRecursiveCall(" while traversing 'Assign' node")) { Branch (6388:17): [True: 0, False: 0]
|
6389 | goto failed; |
6390 | } |
6391 | res = obj2ast_string(state, tmp, &type_comment, arena); |
6392 | _Py_LeaveRecursiveCall(); |
6393 | if (res != 0) goto failed; Branch (6393:17): [True: 0, False: 0]
|
6394 | Py_CLEAR(tmp); |
6395 | } |
6396 | *out = _PyAST_Assign(targets, value, type_comment, lineno, col_offset, |
6397 | end_lineno, end_col_offset, arena); |
6398 | if (*out == NULL) goto failed0 ; Branch (6398:13): [True: 0, False: 20.8k]
|
6399 | return 0; |
6400 | } |
6401 | tp = state->AugAssign_type; |
6402 | isinstance = PyObject_IsInstance(obj, tp); |
6403 | if (isinstance == -1) { Branch (6403:9): [True: 0, False: 33.5k]
|
6404 | return 1; |
6405 | } |
6406 | if (isinstance) { Branch (6406:9): [True: 856, False: 32.7k]
|
6407 | expr_ty target; |
6408 | operator_ty op; |
6409 | expr_ty value; |
6410 | |
6411 | if (_PyObject_LookupAttr(obj, state->target, &tmp) < 0) { Branch (6411:13): [True: 0, False: 856]
|
6412 | return 1; |
6413 | } |
6414 | if (tmp == NULL) { Branch (6414:13): [True: 0, False: 856]
|
6415 | PyErr_SetString(PyExc_TypeError, "required field \"target\" missing from AugAssign"); |
6416 | return 1; |
6417 | } |
6418 | else { |
6419 | int res; |
6420 | if (_Py_EnterRecursiveCall(" while traversing 'AugAssign' node")) { Branch (6420:17): [True: 0, False: 856]
|
6421 | goto failed; |
6422 | } |
6423 | res = obj2ast_expr(state, tmp, &target, arena); |
6424 | _Py_LeaveRecursiveCall(); |
6425 | if (res != 0) goto failed0 ; Branch (6425:17): [True: 0, False: 856]
|
6426 | Py_CLEAR(tmp); |
6427 | } |
6428 | if (_PyObject_LookupAttr(obj, state->op, &tmp) < 0) { Branch (6428:13): [True: 0, False: 856]
|
6429 | return 1; |
6430 | } |
6431 | if (tmp == NULL) { Branch (6431:13): [True: 0, False: 856]
|
6432 | PyErr_SetString(PyExc_TypeError, "required field \"op\" missing from AugAssign"); |
6433 | return 1; |
6434 | } |
6435 | else { |
6436 | int res; |
6437 | if (_Py_EnterRecursiveCall(" while traversing 'AugAssign' node")) { Branch (6437:17): [True: 0, False: 856]
|
6438 | goto failed; |
6439 | } |
6440 | res = obj2ast_operator(state, tmp, &op, arena); |
6441 | _Py_LeaveRecursiveCall(); |
6442 | if (res != 0) goto failed0 ; Branch (6442:17): [True: 0, False: 856]
|
6443 | Py_CLEAR(tmp); |
6444 | } |
6445 | if (_PyObject_LookupAttr(obj, state->value, &tmp) < 0) { Branch (6445:13): [True: 0, False: 856]
|
6446 | return 1; |
6447 | } |
6448 | if (tmp == NULL) { Branch (6448:13): [True: 0, False: 856]
|
6449 | PyErr_SetString(PyExc_TypeError, "required field \"value\" missing from AugAssign"); |
6450 | return 1; |
6451 | } |
6452 | else { |
6453 | int res; |
6454 | if (_Py_EnterRecursiveCall(" while traversing 'AugAssign' node")) { Branch (6454:17): [True: 0, False: 856]
|
6455 | goto failed; |
6456 | } |
6457 | res = obj2ast_expr(state, tmp, &value, arena); |
6458 | _Py_LeaveRecursiveCall(); |
6459 | if (res != 0) goto failed0 ; Branch (6459:17): [True: 0, False: 856]
|
6460 | Py_CLEAR(tmp); |
6461 | } |
6462 | *out = _PyAST_AugAssign(target, op, value, lineno, col_offset, |
6463 | end_lineno, end_col_offset, arena); |
6464 | if (*out == NULL) goto failed0 ; Branch (6464:13): [True: 0, False: 856]
|
6465 | return 0; |
6466 | } |
6467 | tp = state->AnnAssign_type; |
6468 | isinstance = PyObject_IsInstance(obj, tp); |
6469 | if (isinstance == -1) { Branch (6469:9): [True: 0, False: 32.7k]
|
6470 | return 1; |
6471 | } |
6472 | if (isinstance) { Branch (6472:9): [True: 37, False: 32.6k]
|
6473 | expr_ty target; |
6474 | expr_ty annotation; |
6475 | expr_ty value; |
6476 | int simple; |
6477 | |
6478 | if (_PyObject_LookupAttr(obj, state->target, &tmp) < 0) { Branch (6478:13): [True: 0, False: 37]
|
6479 | return 1; |
6480 | } |
6481 | if (tmp == NULL) { Branch (6481:13): [True: 0, False: 37]
|
6482 | PyErr_SetString(PyExc_TypeError, "required field \"target\" missing from AnnAssign"); |
6483 | return 1; |
6484 | } |
6485 | else { |
6486 | int res; |
6487 | if (_Py_EnterRecursiveCall(" while traversing 'AnnAssign' node")) { Branch (6487:17): [True: 0, False: 37]
|
6488 | goto failed; |
6489 | } |
6490 | res = obj2ast_expr(state, tmp, &target, arena); |
6491 | _Py_LeaveRecursiveCall(); |
6492 | if (res != 0) goto failed0 ; Branch (6492:17): [True: 0, False: 37]
|
6493 | Py_CLEAR(tmp); |
6494 | } |
6495 | if (_PyObject_LookupAttr(obj, state->annotation, &tmp) < 0) { Branch (6495:13): [True: 0, False: 37]
|
6496 | return 1; |
6497 | } |
6498 | if (tmp == NULL) { Branch (6498:13): [True: 0, False: 37]
|
6499 | PyErr_SetString(PyExc_TypeError, "required field \"annotation\" missing from AnnAssign"); |
6500 | return 1; |
6501 | } |
6502 | else { |
6503 | int res; |
6504 | if (_Py_EnterRecursiveCall(" while traversing 'AnnAssign' node")) { Branch (6504:17): [True: 0, False: 37]
|
6505 | goto failed; |
6506 | } |
6507 | res = obj2ast_expr(state, tmp, &annotation, arena); |
6508 | _Py_LeaveRecursiveCall(); |
6509 | if (res != 0) goto failed0 ; Branch (6509:17): [True: 0, False: 37]
|
6510 | Py_CLEAR(tmp); |
6511 | } |
6512 | if (_PyObject_LookupAttr(obj, state->value, &tmp) < 0) { Branch (6512:13): [True: 0, False: 37]
|
6513 | return 1; |
6514 | } |
6515 | if (tmp == NULL || tmp == Py_None) { Branch (6515:13): [True: 0, False: 37]
Branch (6515:28): [True: 26, False: 11]
|
6516 | Py_CLEAR(tmp); |
6517 | value = NULL; |
6518 | } |
6519 | else { |
6520 | int res; |
6521 | if (_Py_EnterRecursiveCall(" while traversing 'AnnAssign' node")) { Branch (6521:17): [True: 0, False: 11]
|
6522 | goto failed; |
6523 | } |
6524 | res = obj2ast_expr(state, tmp, &value, arena); |
6525 | _Py_LeaveRecursiveCall(); |
6526 | if (res != 0) goto failed0 ; Branch (6526:17): [True: 0, False: 11]
|
6527 | Py_CLEAR(tmp); |
6528 | } |
6529 | if (_PyObject_LookupAttr(obj, state->simple, &tmp) < 0) { Branch (6529:13): [True: 0, False: 37]
|
6530 | return 1; |
6531 | } |
6532 | if (tmp == NULL) { Branch (6532:13): [True: 0, False: 37]
|
6533 | PyErr_SetString(PyExc_TypeError, "required field \"simple\" missing from AnnAssign"); |
6534 | return 1; |
6535 | } |
6536 | else { |
6537 | int res; |
6538 | if (_Py_EnterRecursiveCall(" while traversing 'AnnAssign' node")) { Branch (6538:17): [True: 0, False: 37]
|
6539 | goto failed; |
6540 | } |
6541 | res = obj2ast_int(state, tmp, &simple, arena); |
6542 | _Py_LeaveRecursiveCall(); |
6543 | if (res != 0) goto failed0 ; Branch (6543:17): [True: 0, False: 37]
|
6544 | Py_CLEAR(tmp); |
6545 | } |
6546 | *out = _PyAST_AnnAssign(target, annotation, value, simple, lineno, |
6547 | col_offset, end_lineno, end_col_offset, arena); |
6548 | if (*out == NULL) goto failed0 ; Branch (6548:13): [True: 0, False: 37]
|
6549 | return 0; |
6550 | } |
6551 | tp = state->For_type; |
6552 | isinstance = PyObject_IsInstance(obj, tp); |
6553 | if (isinstance == -1) { Branch (6553:9): [True: 0, False: 32.6k]
|
6554 | return 1; |
6555 | } |
6556 | if (isinstance) { Branch (6556:9): [True: 1.39k, False: 31.2k]
|
6557 | expr_ty target; |
6558 | expr_ty iter; |
6559 | asdl_stmt_seq* body; |
6560 | asdl_stmt_seq* orelse; |
6561 | string type_comment; |
6562 | |
6563 | if (_PyObject_LookupAttr(obj, state->target, &tmp) < 0) { Branch (6563:13): [True: 0, False: 1.39k]
|
6564 | return 1; |
6565 | } |
6566 | if (tmp == NULL) { Branch (6566:13): [True: 0, False: 1.39k]
|
6567 | PyErr_SetString(PyExc_TypeError, "required field \"target\" missing from For"); |
6568 | return 1; |
6569 | } |
6570 | else { |
6571 | int res; |
6572 | if (_Py_EnterRecursiveCall(" while traversing 'For' node")) { Branch (6572:17): [True: 0, False: 1.39k]
|
6573 | goto failed; |
6574 | } |
6575 | res = obj2ast_expr(state, tmp, &target, arena); |
6576 | _Py_LeaveRecursiveCall(); |
6577 | if (res != 0) goto failed0 ; Branch (6577:17): [True: 0, False: 1.39k]
|
6578 | Py_CLEAR(tmp); |
6579 | } |
6580 | if (_PyObject_LookupAttr(obj, state->iter, &tmp) < 0) { Branch (6580:13): [True: 0, False: 1.39k]
|
6581 | return 1; |
6582 | } |
6583 | if (tmp == NULL) { Branch (6583:13): [True: 0, False: 1.39k]
|
6584 | PyErr_SetString(PyExc_TypeError, "required field \"iter\" missing from For"); |
6585 | return 1; |
6586 | } |
6587 | else { |
6588 | int res; |
6589 | if (_Py_EnterRecursiveCall(" while traversing 'For' node")) { Branch (6589:17): [True: 0, False: 1.39k]
|
6590 | goto failed; |
6591 | } |
6592 | res = obj2ast_expr(state, tmp, &iter, arena); |
6593 | _Py_LeaveRecursiveCall(); |
6594 | if (res != 0) goto failed0 ; Branch (6594:17): [True: 0, False: 1.39k]
|
6595 | Py_CLEAR(tmp); |
6596 | } |
6597 | if (_PyObject_LookupAttr(obj, state->body, &tmp) < 0) { Branch (6597:13): [True: 0, False: 1.39k]
|
6598 | return 1; |
6599 | } |
6600 | if (tmp == NULL) { Branch (6600:13): [True: 0, False: 1.39k]
|
6601 | PyErr_SetString(PyExc_TypeError, "required field \"body\" missing from For"); |
6602 | return 1; |
6603 | } |
6604 | else { |
6605 | int res; |
6606 | Py_ssize_t len; |
6607 | Py_ssize_t i; |
6608 | if (!PyList_Check(tmp)) { Branch (6608:17): [True: 0, False: 1.39k]
|
6609 | PyErr_Format(PyExc_TypeError, "For field \"body\" must be a list, not a %.200s", _PyType_Name(Py_TYPE(tmp))); |
6610 | goto failed; |
6611 | } |
6612 | len = PyList_GET_SIZE(tmp); |
6613 | body = _Py_asdl_stmt_seq_new(len, arena); |
6614 | if (body == NULL) goto failed0 ; Branch (6614:17): [True: 0, False: 1.39k]
|
6615 | for (i = 0; 1.39k i < len; i++2.77k ) { Branch (6615:25): [True: 2.77k, False: 1.39k]
|
6616 | stmt_ty val; |
6617 | PyObject *tmp2 = PyList_GET_ITEM(tmp, i); |
6618 | Py_INCREF(tmp2); |
6619 | if (_Py_EnterRecursiveCall(" while traversing 'For' node")) { Branch (6619:21): [True: 0, False: 2.77k]
|
6620 | goto failed; |
6621 | } |
6622 | res = obj2ast_stmt(state, tmp2, &val, arena); |
6623 | _Py_LeaveRecursiveCall(); |
6624 | Py_DECREF(tmp2); |
6625 | if (res != 0) goto failed0 ; Branch (6625:21): [True: 0, False: 2.77k]
|
6626 | if (len != PyList_GET_SIZE(tmp)) { Branch (6626:21): [True: 0, False: 2.77k]
|
6627 | PyErr_SetString(PyExc_RuntimeError, "For field \"body\" changed size during iteration"); |
6628 | goto failed; |
6629 | } |
6630 | asdl_seq_SET(body, i, val); |
6631 | } |
6632 | Py_CLEAR(tmp); |
6633 | } |
6634 | if (_PyObject_LookupAttr(obj, state->orelse, &tmp) < 0) { Branch (6634:13): [True: 0, False: 1.39k]
|
6635 | return 1; |
6636 | } |
6637 | if (tmp == NULL) { Branch (6637:13): [True: 0, False: 1.39k]
|
6638 | PyErr_SetString(PyExc_TypeError, "required field \"orelse\" missing from For"); |
6639 | return 1; |
6640 | } |
6641 | else { |
6642 | int res; |
6643 | Py_ssize_t len; |
6644 | Py_ssize_t i; |
6645 | if (!PyList_Check(tmp)) { Branch (6645:17): [True: 0, False: 1.39k]
|
6646 | PyErr_Format(PyExc_TypeError, "For field \"orelse\" must be a list, not a %.200s", _PyType_Name(Py_TYPE(tmp))); |
6647 | goto failed; |
6648 | } |
6649 | len = PyList_GET_SIZE(tmp); |
6650 | orelse = _Py_asdl_stmt_seq_new(len, arena); |
6651 | if (orelse == NULL) goto failed0 ; Branch (6651:17): [True: 0, False: 1.39k]
|
6652 | for (i = 0; 1.39k i < len; i++52 ) { Branch (6652:25): [True: 52, False: 1.39k]
|
6653 | stmt_ty val; |
6654 | PyObject *tmp2 = PyList_GET_ITEM(tmp, i); |
6655 | Py_INCREF(tmp2); |
6656 | if (_Py_EnterRecursiveCall(" while traversing 'For' node")) { Branch (6656:21): [True: 0, False: 52]
|
6657 | goto failed; |
6658 | } |
6659 | res = obj2ast_stmt(state, tmp2, &val, arena); |
6660 | _Py_LeaveRecursiveCall(); |
6661 | Py_DECREF(tmp2); |
6662 | if (res != 0) goto failed0 ; Branch (6662:21): [True: 0, False: 52]
|
6663 | if (len != PyList_GET_SIZE(tmp)) { Branch (6663:21): [True: 0, False: 52]
|
6664 | PyErr_SetString(PyExc_RuntimeError, "For field \"orelse\" changed size during iteration"); |
6665 | goto failed; |
6666 | } |
6667 | asdl_seq_SET(orelse, i, val); |
6668 | } |
6669 | Py_CLEAR(tmp); |
6670 | } |
6671 | if (_PyObject_LookupAttr(obj, state->type_comment, &tmp) < 0) { Branch (6671:13): [True: 0, False: 1.39k]
|
6672 | return 1; |
6673 | } |
6674 | if (tmp == NULL || tmp == Py_None) { Branch (6674:13): [True: 0, False: 1.39k]
Branch (6674:28): [True: 1.39k, False: 0]
|
6675 | Py_CLEAR(tmp); |
6676 | type_comment = NULL; |
6677 | } |
6678 | else { |
6679 | int res; |
6680 | if (_Py_EnterRecursiveCall(" while traversing 'For' node")) { Branch (6680:17): [True: 0, False: 0]
|
6681 | goto failed; |
6682 | } |
6683 | res = obj2ast_string(state, tmp, &type_comment, arena); |
6684 | _Py_LeaveRecursiveCall(); |
6685 | if (res != 0) goto failed; Branch (6685:17): [True: 0, False: 0]
|
6686 | Py_CLEAR(tmp); |
6687 | } |
6688 | *out = _PyAST_For(target, iter, body, orelse, type_comment, lineno, |
6689 | col_offset, end_lineno, end_col_offset, arena); |
6690 | if (*out == NULL) goto failed0 ; Branch (6690:13): [True: 0, False: 1.39k]
|
6691 | return 0; |
6692 | } |
6693 | tp = state->AsyncFor_type; |
6694 | isinstance = PyObject_IsInstance(obj, tp); |
6695 | if (isinstance == -1) { Branch (6695:9): [True: 0, False: 31.2k]
|
6696 | return 1; |
6697 | } |
6698 | if (isinstance) { Branch (6698:9): [True: 6, False: 31.2k]
|
6699 | expr_ty target; |
6700 | expr_ty iter; |
6701 | asdl_stmt_seq* body; |
6702 | asdl_stmt_seq* orelse; |
6703 | string type_comment; |
6704 | |
6705 | if (_PyObject_LookupAttr(obj, state->target, &tmp) < 0) { Branch (6705:13): [True: 0, False: 6]
|
6706 | return 1; |
6707 | } |
6708 | if (tmp == NULL) { Branch (6708:13): [True: 0, False: 6]
|
6709 | PyErr_SetString(PyExc_TypeError, "required field \"target\" missing from AsyncFor"); |
6710 | return 1; |
6711 | } |
6712 | else { |
6713 | int res; |
6714 | if (_Py_EnterRecursiveCall(" while traversing 'AsyncFor' node")) { Branch (6714:17): [True: 0, False: 6]
|
6715 | goto failed; |
6716 | } |
6717 | res = obj2ast_expr(state, tmp, &target, arena); |
6718 | _Py_LeaveRecursiveCall(); |
6719 | if (res != 0) goto failed0 ; Branch (6719:17): [True: 0, False: 6]
|
6720 | Py_CLEAR(tmp); |
6721 | } |
6722 | if (_PyObject_LookupAttr(obj, state->iter, &tmp) < 0) { Branch (6722:13): [True: 0, False: 6]
|
6723 | return 1; |
6724 | } |
6725 | if (tmp == NULL) { Branch (6725:13): [True: 0, False: 6]
|
6726 | PyErr_SetString(PyExc_TypeError, "required field \"iter\" missing from AsyncFor"); |
6727 | return 1; |
6728 | } |
6729 | else { |
6730 | int res; |
6731 | if (_Py_EnterRecursiveCall(" while traversing 'AsyncFor' node")) { Branch (6731:17): [True: 0, False: 6]
|
6732 | goto failed; |
6733 | } |
6734 | res = obj2ast_expr(state, tmp, &iter, arena); |
6735 | _Py_LeaveRecursiveCall(); |
6736 | if (res != 0) goto failed0 ; Branch (6736:17): [True: 0, False: 6]
|
6737 | Py_CLEAR(tmp); |
6738 | } |
6739 | if (_PyObject_LookupAttr(obj, state->body, &tmp) < 0) { Branch (6739:13): [True: 0, False: 6]
|
6740 | return 1; |
6741 | } |
6742 | if (tmp == NULL) { Branch (6742:13): [True: 0, False: 6]
|
6743 | PyErr_SetString(PyExc_TypeError, "required field \"body\" missing from AsyncFor"); |
6744 | return 1; |
6745 | } |
6746 | else { |
6747 | int res; |
6748 | Py_ssize_t len; |
6749 | Py_ssize_t i; |
6750 | if (!PyList_Check(tmp)) { Branch (6750:17): [True: 0, False: 6]
|
6751 | PyErr_Format(PyExc_TypeError, "AsyncFor field \"body\" must be a list, not a %.200s", _PyType_Name(Py_TYPE(tmp))); |
6752 | goto failed; |
6753 | } |
6754 | len = PyList_GET_SIZE(tmp); |
6755 | body = _Py_asdl_stmt_seq_new(len, arena); |
6756 | if (body == NULL) goto failed0 ; Branch (6756:17): [True: 0, False: 6]
|
6757 | for (i = 0; 6 i < len; i++6 ) { Branch (6757:25): [True: 6, False: 6]
|
6758 | stmt_ty val; |
6759 | PyObject *tmp2 = PyList_GET_ITEM(tmp, i); |
6760 | Py_INCREF(tmp2); |
6761 | if (_Py_EnterRecursiveCall(" while traversing 'AsyncFor' node")) { Branch (6761:21): [True: 0, False: 6]
|
6762 | goto failed; |
6763 | } |
6764 | res = obj2ast_stmt(state, tmp2, &val, arena); |
6765 | _Py_LeaveRecursiveCall(); |
6766 | Py_DECREF(tmp2); |
6767 | if (res != 0) goto failed0 ; Branch (6767:21): [True: 0, False: 6]
|
6768 | if (len != PyList_GET_SIZE(tmp)) { Branch (6768:21): [True: 0, False: 6]
|
6769 | PyErr_SetString(PyExc_RuntimeError, "AsyncFor field \"body\" changed size during iteration"); |
6770 | goto failed; |
6771 | } |
6772 | asdl_seq_SET(body, i, val); |
6773 | } |
6774 | Py_CLEAR(tmp); |
6775 | } |
6776 | if (_PyObject_LookupAttr(obj, state->orelse, &tmp) < 0) { Branch (6776:13): [True: 0, False: 6]
|
6777 | return 1; |
6778 | } |
6779 | if (tmp == NULL) { Branch (6779:13): [True: 0, False: 6]
|
6780 | PyErr_SetString(PyExc_TypeError, "required field \"orelse\" missing from AsyncFor"); |
6781 | return 1; |
6782 | } |
6783 | else { |
6784 | int res; |
6785 | Py_ssize_t len; |
6786 | Py_ssize_t i; |
6787 | if (!PyList_Check(tmp)) { Branch (6787:17): [True: 0, False: 6]
|
6788 | PyErr_Format(PyExc_TypeError, "AsyncFor field \"orelse\" must be a list, not a %.200s", _PyType_Name(Py_TYPE(tmp))); |
6789 | goto failed; |
6790 | } |
6791 | len = PyList_GET_SIZE(tmp); |
6792 | orelse = _Py_asdl_stmt_seq_new(len, arena); |
6793 | if (orelse == NULL) goto failed0 ; Branch (6793:17): [True: 0, False: 6]
|
6794 | for (i = 0; 6 i < len; i++3 ) { Branch (6794:25): [True: 3, False: 6]
|
6795 | stmt_ty val; |
6796 | PyObject *tmp2 = PyList_GET_ITEM(tmp, i); |
6797 | Py_INCREF(tmp2); |
6798 | if (_Py_EnterRecursiveCall(" while traversing 'AsyncFor' node")) { Branch (6798:21): [True: 0, False: 3]
|
6799 | goto failed; |
6800 | } |
6801 | res = obj2ast_stmt(state, tmp2, &val, arena); |
6802 | _Py_LeaveRecursiveCall(); |
6803 | Py_DECREF(tmp2); |
6804 | if (res != 0) goto failed0 ; Branch (6804:21): [True: 0, False: 3]
|
6805 | if (len != PyList_GET_SIZE(tmp)) { Branch (6805:21): [True: 0, False: 3]
|
6806 | PyErr_SetString(PyExc_RuntimeError, "AsyncFor field \"orelse\" changed size during iteration"); |
6807 | goto failed; |
6808 | } |
6809 | asdl_seq_SET(orelse, i, val); |
6810 | } |
6811 | Py_CLEAR(tmp); |
6812 | } |
6813 | if (_PyObject_LookupAttr(obj, state->type_comment, &tmp) < 0) { Branch (6813:13): [True: 0, False: 6]
|
6814 | return 1; |
6815 | } |
6816 | if (tmp == NULL || tmp == Py_None) { Branch (6816:13): [True: 0, False: 6]
Branch (6816:28): [True: 6, False: 0]
|
6817 | Py_CLEAR(tmp); |
6818 | type_comment = NULL; |
6819 | } |
6820 | else { |
6821 | int res; |
6822 | if (_Py_EnterRecursiveCall(" while traversing 'AsyncFor' node")) { Branch (6822:17): [True: 0, False: 0]
|
6823 | goto failed; |
6824 | } |
6825 | res = obj2ast_string(state, tmp, &type_comment, arena); |
6826 | _Py_LeaveRecursiveCall(); |
6827 | if (res != 0) goto failed; Branch (6827:17): [True: 0, False: 0]
|
6828 | Py_CLEAR(tmp); |
6829 | } |
6830 | *out = _PyAST_AsyncFor(target, iter, body, orelse, type_comment, |
6831 | lineno, col_offset, end_lineno, end_col_offset, |
6832 | arena); |
6833 | if (*out == NULL) goto failed0 ; Branch (6833:13): [True: 0, False: 6]
|
6834 | return 0; |
6835 | } |
6836 | tp = state->While_type; |
6837 | isinstance = PyObject_IsInstance(obj, tp); |
6838 | if (isinstance == -1) { Branch (6838:9): [True: 0, False: 31.2k]
|
6839 | return 1; |
6840 | } |
6841 | if (isinstance) { Branch (6841:9): [True: 443, False: 30.8k]
|
6842 | expr_ty test; |
6843 | asdl_stmt_seq* body; |
6844 | asdl_stmt_seq* orelse; |
6845 | |
6846 | if (_PyObject_LookupAttr(obj, state->test, &tmp) < 0) { Branch (6846:13): [True: 0, False: 443]
|
6847 | return 1; |
6848 | } |
6849 | if (tmp == NULL) { Branch (6849:13): [True: 0, False: 443]
|
6850 | PyErr_SetString(PyExc_TypeError, "required field \"test\" missing from While"); |
6851 | return 1; |
6852 | } |
6853 | else { |
6854 | int res; |
6855 | if (_Py_EnterRecursiveCall(" while traversing 'While' node")) { Branch (6855:17): [True: 0, False: 443]
|
6856 | goto failed; |
6857 | } |
6858 | res = obj2ast_expr(state, tmp, &test, arena); |
6859 | _Py_LeaveRecursiveCall(); |
6860 | if (res != 0) goto failed0 ; Branch (6860:17): [True: 0, False: 443]
|
6861 | Py_CLEAR(tmp); |
6862 | } |
6863 | if (_PyObject_LookupAttr(obj, state->body, &tmp) < 0) { Branch (6863:13): [True: 0, False: 443]
|
6864 | return 1; |
6865 | } |
6866 | if (tmp == NULL) { Branch (6866:13): [True: 0, False: 443]
|
6867 | PyErr_SetString(PyExc_TypeError, "required field \"body\" missing from While"); |
6868 | return 1; |
6869 | } |
6870 | else { |
6871 | int res; |
6872 | Py_ssize_t len; |
6873 | Py_ssize_t i; |
6874 | if (!PyList_Check(tmp)) { Branch (6874:17): [True: 0, False: 443]
|
6875 | PyErr_Format(PyExc_TypeError, "While field \"body\" must be a list, not a %.200s", _PyType_Name(Py_TYPE(tmp))); |
6876 | goto failed; |
6877 | } |
6878 | len = PyList_GET_SIZE(tmp); |
6879 | body = _Py_asdl_stmt_seq_new(len, arena); |
6880 | if (body == NULL) goto failed0 ; Branch (6880:17): [True: 0, False: 443]
|
6881 | for (i = 0; 443 i < len; i++1.40k ) { Branch (6881:25): [True: 1.40k, False: 443]
|
6882 | stmt_ty val; |
6883 | PyObject *tmp2 = PyList_GET_ITEM(tmp, i); |
6884 | Py_INCREF(tmp2); |
6885 | if (_Py_EnterRecursiveCall(" while traversing 'While' node")) { Branch (6885:21): [True: 0, False: 1.40k]
|
6886 | goto failed; |
6887 | } |
6888 | res = obj2ast_stmt(state, tmp2, &val, arena); |
6889 | _Py_LeaveRecursiveCall(); |
6890 | Py_DECREF(tmp2); |
6891 | if (res != 0) goto failed0 ; Branch (6891:21): [True: 0, False: 1.40k]
|
6892 | if (len != PyList_GET_SIZE(tmp)) { Branch (6892:21): [True: 0, False: 1.40k]
|
6893 | PyErr_SetString(PyExc_RuntimeError, "While field \"body\" changed size during iteration"); |
6894 | goto failed; |
6895 | } |
6896 | asdl_seq_SET(body, i, val); |
6897 | } |
6898 | Py_CLEAR(tmp); |
6899 | } |
6900 | if (_PyObject_LookupAttr(obj, state->orelse, &tmp) < 0) { Branch (6900:13): [True: 0, False: 443]
|
6901 | return 1; |
6902 | } |
6903 | if (tmp == NULL) { Branch (6903:13): [True: 0, False: 443]
|
6904 | PyErr_SetString(PyExc_TypeError, "required field \"orelse\" missing from While"); |
6905 | return 1; |
6906 | } |
6907 | else { |
6908 | int res; |
6909 | Py_ssize_t len; |
6910 | Py_ssize_t i; |
6911 | if (!PyList_Check(tmp)) { Branch (6911:17): [True: 0, False: 443]
|
6912 | PyErr_Format(PyExc_TypeError, "While field \"orelse\" must be a list, not a %.200s", _PyType_Name(Py_TYPE(tmp))); |
6913 | goto failed; |
6914 | } |
6915 | len = PyList_GET_SIZE(tmp); |
6916 | orelse = _Py_asdl_stmt_seq_new(len, arena); |
6917 | if (orelse == NULL) goto failed0 ; Branch (6917:17): [True: 0, False: 443]
|
6918 | for (i = 0; 443 i < len; i++11 ) { Branch (6918:25): [True: 11, False: 443]
|
6919 | stmt_ty val; |
6920 | PyObject *tmp2 = PyList_GET_ITEM(tmp, i); |
6921 | Py_INCREF(tmp2); |
6922 | if (_Py_EnterRecursiveCall(" while traversing 'While' node")) { Branch (6922:21): [True: 0, False: 11]
|
6923 | goto failed; |
6924 | } |
6925 | res = obj2ast_stmt(state, tmp2, &val, arena); |
6926 | _Py_LeaveRecursiveCall(); |
6927 | Py_DECREF(tmp2); |
6928 | if (res != 0) goto failed0 ; Branch (6928:21): [True: 0, False: 11]
|
6929 | if (len != PyList_GET_SIZE(tmp)) { Branch (6929:21): [True: 0, False: 11]
|
6930 | PyErr_SetString(PyExc_RuntimeError, "While field \"orelse\" changed size during iteration"); |
6931 | goto failed; |
6932 | } |
6933 | asdl_seq_SET(orelse, i, val); |
6934 | } |
6935 | Py_CLEAR(tmp); |
6936 | } |
6937 | *out = _PyAST_While(test, body, orelse, lineno, col_offset, end_lineno, |
6938 | end_col_offset, arena); |
6939 | if (*out == NULL) goto failed0 ; Branch (6939:13): [True: 0, False: 443]
|
6940 | return 0; |
6941 | } |
6942 | tp = state->If_type; |
6943 | isinstance = PyObject_IsInstance(obj, tp); |
6944 | if (isinstance == -1) { Branch (6944:9): [True: 0, False: 30.8k]
|
6945 | return 1; |
6946 | } |
6947 | if (isinstance) { Branch (6947:9): [True: 11.1k, False: 19.6k]
|
6948 | expr_ty test; |
6949 | asdl_stmt_seq* body; |
6950 | asdl_stmt_seq* orelse; |
6951 | |
6952 | if (_PyObject_LookupAttr(obj, state->test, &tmp) < 0) { Branch (6952:13): [True: 0, False: 11.1k]
|
6953 | return 1; |
6954 | } |
6955 | if (tmp == NULL) { Branch (6955:13): [True: 0, False: 11.1k]
|
6956 | PyErr_SetString(PyExc_TypeError, "required field \"test\" missing from If"); |
6957 | return 1; |
6958 | } |
6959 | else { |
6960 | int res; |
6961 | if (_Py_EnterRecursiveCall(" while traversing 'If' node")) { Branch (6961:17): [True: 0, False: 11.1k]
|
6962 | goto failed; |
6963 | } |
6964 | res = obj2ast_expr(state, tmp, &test, arena); |
6965 | _Py_LeaveRecursiveCall(); |
6966 | if (res != 0) goto failed0 ; Branch (6966:17): [True: 0, False: 11.1k]
|
6967 | Py_CLEAR(tmp); |
6968 | } |
6969 | if (_PyObject_LookupAttr(obj, state->body, &tmp) < 0) { Branch (6969:13): [True: 0, False: 11.1k]
|
6970 | return 1; |
6971 | } |
6972 | if (tmp == NULL) { Branch (6972:13): [True: 0, False: 11.1k]
|
6973 | PyErr_SetString(PyExc_TypeError, "required field \"body\" missing from If"); |
6974 | return 1; |
6975 | } |
6976 | else { |
6977 | int res; |
6978 | Py_ssize_t len; |
6979 | Py_ssize_t i; |
6980 | if (!PyList_Check(tmp)) { Branch (6980:17): [True: 0, False: 11.1k]
|
6981 | PyErr_Format(PyExc_TypeError, "If field \"body\" must be a list, not a %.200s", _PyType_Name(Py_TYPE(tmp))); |
6982 | goto failed; |
6983 | } |
6984 | len = PyList_GET_SIZE(tmp); |
6985 | body = _Py_asdl_stmt_seq_new(len, arena); |
6986 | if (body == NULL) goto failed0 ; Branch (6986:17): [True: 0, False: 11.1k]
|
6987 | for (i = 0; 11.1k i < len; i++16.2k ) { Branch (6987:25): [True: 16.2k, False: 11.1k]
|
6988 | stmt_ty val; |
6989 | PyObject *tmp2 = PyList_GET_ITEM(tmp, i); |
6990 | Py_INCREF(tmp2); |
6991 | if (_Py_EnterRecursiveCall(" while traversing 'If' node")) { Branch (6991:21): [True: 0, False: 16.2k]
|
6992 | goto failed; |
6993 | } |
6994 | res = obj2ast_stmt(state, tmp2, &val, arena); |
6995 | _Py_LeaveRecursiveCall(); |
6996 | Py_DECREF(tmp2); |
6997 | if (res != 0) goto failed0 ; Branch (6997:21): [True: 0, False: 16.2k]
|
6998 | if (len != PyList_GET_SIZE(tmp)) { Branch (6998:21): [True: 0, False: 16.2k]
|
6999 | PyErr_SetString(PyExc_RuntimeError, "If field \"body\" changed size during iteration"); |
7000 | goto failed; |
7001 | } |
7002 | asdl_seq_SET(body, i, val); |
7003 | } |
7004 | Py_CLEAR(tmp); |
7005 | } |
7006 | if (_PyObject_LookupAttr(obj, state->orelse, &tmp) < 0) { Branch (7006:13): [True: 0, False: 11.1k]
|
7007 | return 1; |
7008 | } |
7009 | if (tmp == NULL) { Branch (7009:13): [True: 0, False: 11.1k]
|
7010 | PyErr_SetString(PyExc_TypeError, "required field \"orelse\" missing from If"); |
7011 | return 1; |
7012 | } |
7013 | else { |
7014 | int res; |
7015 | Py_ssize_t len; |
7016 | Py_ssize_t i; |
7017 | if (!PyList_Check(tmp)) { Branch (7017:17): [True: 0, False: 11.1k]
|
7018 | PyErr_Format(PyExc_TypeError, "If field \"orelse\" must be a list, not a %.200s", _PyType_Name(Py_TYPE(tmp))); |
7019 | goto failed; |
7020 | } |
7021 | len = PyList_GET_SIZE(tmp); |
7022 | orelse = _Py_asdl_stmt_seq_new(len, arena); |
7023 | if (orelse == NULL) goto failed0 ; Branch (7023:17): [True: 0, False: 11.1k]
|
7024 | for (i = 0; 11.1k i < len; i++4.15k ) { Branch (7024:25): [True: 4.15k, False: 11.1k]
|
7025 | stmt_ty val; |
7026 | PyObject *tmp2 = PyList_GET_ITEM(tmp, i); |
7027 | Py_INCREF(tmp2); |
7028 | if (_Py_EnterRecursiveCall(" while traversing 'If' node")) { Branch (7028:21): [True: 0, False: 4.15k]
|
7029 | goto failed; |
7030 | } |
7031 | res = obj2ast_stmt(state, tmp2, &val, arena); |
7032 | _Py_LeaveRecursiveCall(); |
7033 | Py_DECREF(tmp2); |
7034 | if (res != 0) goto failed0 ; Branch (7034:21): [True: 0, False: 4.15k]
|
7035 | if (len != PyList_GET_SIZE(tmp)) { Branch (7035:21): [True: 0, False: 4.15k]
|
7036 | PyErr_SetString(PyExc_RuntimeError, "If field \"orelse\" changed size during iteration"); |
7037 | goto failed; |
7038 | } |
7039 | asdl_seq_SET(orelse, i, val); |
7040 | } |
7041 | Py_CLEAR(tmp); |
7042 | } |
7043 | *out = _PyAST_If(test, body, orelse, lineno, col_offset, end_lineno, |
7044 | end_col_offset, arena); |
7045 | if (*out == NULL) goto failed0 ; Branch (7045:13): [True: 0, False: 11.1k]
|
7046 | return 0; |
7047 | } |
7048 | tp = state->With_type; |
7049 | isinstance = PyObject_IsInstance(obj, tp); |
7050 | if (isinstance == -1) { Branch (7050:9): [True: 0, False: 19.6k]
|
7051 | return 1; |
7052 | } |
7053 | if (isinstance) { Branch (7053:9): [True: 385, False: 19.3k]
|
7054 | asdl_withitem_seq* items; |
7055 | asdl_stmt_seq* body; |
7056 | string type_comment; |
7057 | |
7058 | if (_PyObject_LookupAttr(obj, state->items, &tmp) < 0) { Branch (7058:13): [True: 0, False: 385]
|
7059 | return 1; |
7060 | } |
7061 | if (tmp == NULL) { Branch (7061:13): [True: 0, False: 385]
|
7062 | PyErr_SetString(PyExc_TypeError, "required field \"items\" missing from With"); |
7063 | return 1; |
7064 | } |
7065 | else { |
7066 | int res; |
7067 | Py_ssize_t len; |
7068 | Py_ssize_t i; |
7069 | if (!PyList_Check(tmp)) { Branch (7069:17): [True: 0, False: 385]
|
7070 | PyErr_Format(PyExc_TypeError, "With field \"items\" must be a list, not a %.200s", _PyType_Name(Py_TYPE(tmp))); |
7071 | goto failed; |
7072 | } |
7073 | len = PyList_GET_SIZE(tmp); |
7074 | items = _Py_asdl_withitem_seq_new(len, arena); |
7075 | if (items == NULL) goto failed0 ; Branch (7075:17): [True: 0, False: 385]
|
7076 | for (i = 0; 385 i < len; i++406 ) { Branch (7076:25): [True: 406, False: 385]
|
7077 | withitem_ty val; |
7078 | PyObject *tmp2 = PyList_GET_ITEM(tmp, i); |
7079 | Py_INCREF(tmp2); |
7080 | if (_Py_EnterRecursiveCall(" while traversing 'With' node")) { Branch (7080:21): [True: 0, False: 406]
|
7081 | goto failed; |
7082 | } |
7083 | res = obj2ast_withitem(state, tmp2, &val, arena); |
7084 | _Py_LeaveRecursiveCall(); |
7085 | Py_DECREF(tmp2); |
7086 | if (res != 0) goto failed0 ; Branch (7086:21): [True: 0, False: 406]
|
7087 | if (len != PyList_GET_SIZE(tmp)) { Branch (7087:21): [True: 0, False: 406]
|
7088 | PyErr_SetString(PyExc_RuntimeError, "With field \"items\" changed size during iteration"); |
7089 | goto failed; |
7090 | } |
7091 | asdl_seq_SET(items, i, val); |
7092 | } |
7093 | Py_CLEAR(tmp); |
7094 | } |
7095 | if (_PyObject_LookupAttr(obj, state->body, &tmp) < 0) { Branch (7095:13): [True: 0, False: 385]
|
7096 | return 1; |
7097 | } |
7098 | if (tmp == NULL) { Branch (7098:13): [True: 0, False: 385]
|
7099 | PyErr_SetString(PyExc_TypeError, "required field \"body\" missing from With"); |
7100 | return 1; |
7101 | } |
7102 | else { |
7103 | int res; |
7104 | Py_ssize_t len; |
7105 | Py_ssize_t i; |
7106 | if (!PyList_Check(tmp)) { Branch (7106:17): [True: 0, False: 385]
|
7107 | PyErr_Format(PyExc_TypeError, "With field \"body\" must be a list, not a %.200s", _PyType_Name(Py_TYPE(tmp))); |
7108 | goto failed; |
7109 | } |
7110 | len = PyList_GET_SIZE(tmp); |
7111 | body = _Py_asdl_stmt_seq_new(len, arena); |
7112 | if (body == NULL) goto failed0 ; Branch (7112:17): [True: 0, False: 385]
|
7113 | for (i = 0; 385 i < len; i++693 ) { Branch (7113:25): [True: 693, False: 385]
|
7114 | stmt_ty val; |
7115 | PyObject *tmp2 = PyList_GET_ITEM(tmp, i); |
7116 | Py_INCREF(tmp2); |
7117 | if (_Py_EnterRecursiveCall(" while traversing 'With' node")) { Branch (7117:21): [True: 0, False: 693]
|
7118 | goto failed; |
7119 | } |
7120 | res = obj2ast_stmt(state, tmp2, &val, arena); |
7121 | _Py_LeaveRecursiveCall(); |
7122 | Py_DECREF(tmp2); |
7123 | if (res != 0) goto failed0 ; Branch (7123:21): [True: 0, False: 693]
|
7124 | if (len != PyList_GET_SIZE(tmp)) { Branch (7124:21): [True: 0, False: 693]
|
7125 | PyErr_SetString(PyExc_RuntimeError, "With field \"body\" changed size during iteration"); |
7126 | goto failed; |
7127 | } |
7128 | asdl_seq_SET(body, i, val); |
7129 | } |
7130 | Py_CLEAR(tmp); |
7131 | } |
7132 | if (_PyObject_LookupAttr(obj, state->type_comment, &tmp) < 0) { Branch (7132:13): [True: 0, False: 385]
|
7133 | return 1; |
7134 | } |
7135 | if (tmp == NULL || tmp == Py_None) { Branch (7135:13): [True: 0, False: 385]
Branch (7135:28): [True: 385, False: 0]
|
7136 | Py_CLEAR(tmp); |
7137 | type_comment = NULL; |
7138 | } |
7139 | else { |
7140 | int res; |
7141 | if (_Py_EnterRecursiveCall(" while traversing 'With' node")) { Branch (7141:17): [True: 0, False: 0]
|
7142 | goto failed; |
7143 | } |
7144 | res = obj2ast_string(state, tmp, &type_comment, arena); |
7145 | _Py_LeaveRecursiveCall(); |
7146 | if (res != 0) goto failed; Branch (7146:17): [True: 0, False: 0]
|
7147 | Py_CLEAR(tmp); |
7148 | } |
7149 | *out = _PyAST_With(items, body, type_comment, lineno, col_offset, |
7150 | end_lineno, end_col_offset, arena); |
7151 | if (*out == NULL) goto failed0 ; Branch (7151:13): [True: 0, False: 385]
|
7152 | return 0; |
7153 | } |
7154 | tp = state->AsyncWith_type; |
7155 | isinstance = PyObject_IsInstance(obj, tp); |
7156 | if (isinstance == -1) { Branch (7156:9): [True: 0, False: 19.3k]
|
7157 | return 1; |
7158 | } |
7159 | if (isinstance) { Branch (7159:9): [True: 9, False: 19.2k]
|
7160 | asdl_withitem_seq* items; |
7161 | asdl_stmt_seq* body; |
7162 | string type_comment; |
7163 | |
7164 | if (_PyObject_LookupAttr(obj, state->items, &tmp) < 0) { Branch (7164:13): [True: 0, False: 9]
|
7165 | return 1; |
7166 | } |
7167 | if (tmp == NULL) { Branch (7167:13): [True: 0, False: 9]
|
7168 | PyErr_SetString(PyExc_TypeError, "required field \"items\" missing from AsyncWith"); |
7169 | return 1; |
7170 | } |
7171 | else { |
7172 | int res; |
7173 | Py_ssize_t len; |
7174 | Py_ssize_t i; |
7175 | if (!PyList_Check(tmp)) { Branch (7175:17): [True: 0, False: 9]
|
7176 | PyErr_Format(PyExc_TypeError, "AsyncWith field \"items\" must be a list, not a %.200s", _PyType_Name(Py_TYPE(tmp))); |
7177 | goto failed; |
7178 | } |
7179 | len = PyList_GET_SIZE(tmp); |
7180 | items = _Py_asdl_withitem_seq_new(len, arena); |
7181 | if (items == NULL) goto failed0 ; Branch (7181:17): [True: 0, False: 9]
|
7182 | for (i = 0; 9 i < len; i++12 ) { Branch (7182:25): [True: 12, False: 9]
|
7183 | withitem_ty val; |
7184 | PyObject *tmp2 = PyList_GET_ITEM(tmp, i); |
7185 | Py_INCREF(tmp2); |
7186 | if (_Py_EnterRecursiveCall(" while traversing 'AsyncWith' node")) { Branch (7186:21): [True: 0, False: 12]
|
7187 | goto failed; |
7188 | } |
7189 | res = obj2ast_withitem(state, tmp2, &val, arena); |
7190 | _Py_LeaveRecursiveCall(); |
7191 | Py_DECREF(tmp2); |
7192 | if (res != 0) goto failed0 ; Branch (7192:21): [True: 0, False: 12]
|
7193 | if (len != PyList_GET_SIZE(tmp)) { Branch (7193:21): [True: 0, False: 12]
|
7194 | PyErr_SetString(PyExc_RuntimeError, "AsyncWith field \"items\" changed size during iteration"); |
7195 | goto failed; |
7196 | } |
7197 | asdl_seq_SET(items, i, val); |
7198 | } |
7199 | Py_CLEAR(tmp); |
7200 | } |
7201 | if (_PyObject_LookupAttr(obj, state->body, &tmp) < 0) { Branch (7201:13): [True: 0, False: 9]
|
7202 | return 1; |
7203 | } |
7204 | if (tmp == NULL) { Branch (7204:13): [True: 0, False: 9]
|
7205 | PyErr_SetString(PyExc_TypeError, "required field \"body\" missing from AsyncWith"); |
7206 | return 1; |
7207 | } |
7208 | else { |
7209 | int res; |
7210 | Py_ssize_t len; |
7211 | Py_ssize_t i; |
7212 | if (!PyList_Check(tmp)) { Branch (7212:17): [True: 0, False: 9]
|
7213 | PyErr_Format(PyExc_TypeError, "AsyncWith field \"body\" must be a list, not a %.200s", _PyType_Name(Py_TYPE(tmp))); |
7214 | goto failed; |
7215 | } |
7216 | len = PyList_GET_SIZE(tmp); |
7217 | body = _Py_asdl_stmt_seq_new(len, arena); |
7218 | if (body == NULL) goto failed0 ; Branch (7218:17): [True: 0, False: 9]
|
7219 | for (i = 0; 9 i < len; i++9 ) { Branch (7219:25): [True: 9, False: 9]
|
7220 | stmt_ty val; |
7221 | PyObject *tmp2 = PyList_GET_ITEM(tmp, i); |
7222 | Py_INCREF(tmp2); |
7223 | if (_Py_EnterRecursiveCall(" while traversing 'AsyncWith' node")) { Branch (7223:21): [True: 0, False: 9]
|
7224 | goto failed; |
7225 | } |
7226 | res = obj2ast_stmt(state, tmp2, &val, arena); |
7227 | _Py_LeaveRecursiveCall(); |
7228 | Py_DECREF(tmp2); |
7229 | if (res != 0) goto failed0 ; Branch (7229:21): [True: 0, False: 9]
|
7230 | if (len != PyList_GET_SIZE(tmp)) { Branch (7230:21): [True: 0, False: 9]
|
7231 | PyErr_SetString(PyExc_RuntimeError, "AsyncWith field \"body\" changed size during iteration"); |
7232 | goto failed; |
7233 | } |
7234 | asdl_seq_SET(body, i, val); |
7235 | } |
7236 | Py_CLEAR(tmp); |
7237 | } |
7238 | if (_PyObject_LookupAttr(obj, state->type_comment, &tmp) < 0) { Branch (7238:13): [True: 0, False: 9]
|
7239 | return 1; |
7240 | } |
7241 | if (tmp == NULL || tmp == Py_None) { Branch (7241:13): [True: 0, False: 9]
Branch (7241:28): [True: 9, False: 0]
|
7242 | Py_CLEAR(tmp); |
7243 | type_comment = NULL; |
7244 | } |
7245 | else { |
7246 | int res; |
7247 | if (_Py_EnterRecursiveCall(" while traversing 'AsyncWith' node")) { Branch (7247:17): [True: 0, False: 0]
|
7248 | goto failed; |
7249 | } |
7250 | res = obj2ast_string(state, tmp, &type_comment, arena); |
7251 | _Py_LeaveRecursiveCall(); |
7252 | if (res != 0) goto failed; Branch (7252:17): [True: 0, False: 0]
|
7253 | Py_CLEAR(tmp); |
7254 | } |
7255 | *out = _PyAST_AsyncWith(items, body, type_comment, lineno, col_offset, |
7256 | end_lineno, end_col_offset, arena); |
7257 | if (*out == NULL) goto failed0 ; Branch (7257:13): [True: 0, False: 9]
|
7258 | return 0; |
7259 | } |
7260 | tp = state->Match_type; |
7261 | isinstance = PyObject_IsInstance(obj, tp); |
7262 | if (isinstance == -1) { Branch (7262:9): [True: 0, False: 19.2k]
|
7263 | return 1; |
7264 | } |
7265 | if (isinstance) { Branch (7265:9): [True: 29, False: 19.2k]
|
7266 | expr_ty subject; |
7267 | asdl_match_case_seq* cases; |
7268 | |
7269 | if (_PyObject_LookupAttr(obj, state->subject, &tmp) < 0) { Branch (7269:13): [True: 0, False: 29]
|
7270 | return 1; |
7271 | } |
7272 | if (tmp == NULL) { Branch (7272:13): [True: 0, False: 29]
|
7273 | PyErr_SetString(PyExc_TypeError, "required field \"subject\" missing from Match"); |
7274 | return 1; |
7275 | } |
7276 | else { |
7277 | int res; |
7278 | if (_Py_EnterRecursiveCall(" while traversing 'Match' node")) { Branch (7278:17): [True: 0, False: 29]
|
7279 | goto failed; |
7280 | } |
7281 | res = obj2ast_expr(state, tmp, &subject, arena); |
7282 | _Py_LeaveRecursiveCall(); |
7283 | if (res != 0) goto failed0 ; Branch (7283:17): [True: 0, False: 29]
|
7284 | Py_CLEAR(tmp); |
7285 | } |
7286 | if (_PyObject_LookupAttr(obj, state->cases, &tmp) < 0) { Branch (7286:13): [True: 0, False: 29]
|
7287 | return 1; |
7288 | } |
7289 | if (tmp == NULL) { Branch (7289:13): [True: 0, False: 29]
|
7290 | PyErr_SetString(PyExc_TypeError, "required field \"cases\" missing from Match"); |
7291 | return 1; |
7292 | } |
7293 | else { |
7294 | int res; |
7295 | Py_ssize_t len; |
7296 | Py_ssize_t i; |
7297 | if (!PyList_Check(tmp)) { Branch (7297:17): [True: 0, False: 29]
|
7298 | PyErr_Format(PyExc_TypeError, "Match field \"cases\" must be a list, not a %.200s", _PyType_Name(Py_TYPE(tmp))); |
7299 | goto failed; |
7300 | } |
7301 | len = PyList_GET_SIZE(tmp); |
7302 | cases = _Py_asdl_match_case_seq_new(len, arena); |
7303 | if (cases == NULL) goto failed0 ; Branch (7303:17): [True: 0, False: 29]
|
7304 | for (i = 0; 29 i < len; i++33 ) { Branch (7304:25): [True: 33, False: 29]
|
7305 | match_case_ty val; |
7306 | PyObject *tmp2 = PyList_GET_ITEM(tmp, i); |
7307 | Py_INCREF(tmp2); |
7308 | if (_Py_EnterRecursiveCall(" while traversing 'Match' node")) { Branch (7308:21): [True: 0, False: 33]
|
7309 | goto failed; |
7310 | } |
7311 | res = obj2ast_match_case(state, tmp2, &val, arena); |
7312 | _Py_LeaveRecursiveCall(); |
7313 | Py_DECREF(tmp2); |
7314 | if (res != 0) goto failed0 ; Branch (7314:21): [True: 0, False: 33]
|
7315 | if (len != PyList_GET_SIZE(tmp)) { Branch (7315:21): [True: 0, False: 33]
|
7316 | PyErr_SetString(PyExc_RuntimeError, "Match field \"cases\" changed size during iteration"); |
7317 | goto failed; |
7318 | } |
7319 | asdl_seq_SET(cases, i, val); |
7320 | } |
7321 | Py_CLEAR(tmp); |
7322 | } |
7323 | *out = _PyAST_Match(subject, cases, lineno, col_offset, end_lineno, |
7324 | end_col_offset, arena); |
7325 | if (*out == NULL) goto failed0 ; Branch (7325:13): [True: 0, False: 29]
|
7326 | return 0; |
7327 | } |
7328 | tp = state->Raise_type; |
7329 | isinstance = PyObject_IsInstance(obj, tp); |
7330 | if (isinstance == -1) { Branch (7330:9): [True: 0, False: 19.2k]
|
7331 | return 1; |
7332 | } |
7333 | if (isinstance) { Branch (7333:9): [True: 2.31k, False: 16.9k]
|
7334 | expr_ty exc; |
7335 | expr_ty cause; |
7336 | |
7337 | if (_PyObject_LookupAttr(obj, state->exc, &tmp) < 0) { Branch (7337:13): [True: 0, False: 2.31k]
|
7338 | return 1; |
7339 | } |
7340 | if (tmp == NULL || tmp == Py_None) { Branch (7340:13): [True: 0, False: 2.31k]
Branch (7340:28): [True: 164, False: 2.14k]
|
7341 | Py_CLEAR(tmp); |
7342 | exc = NULL; |
7343 | } |
7344 | else { |
7345 | int res; |
7346 | if (_Py_EnterRecursiveCall(" while traversing 'Raise' node")) { Branch (7346:17): [True: 0, False: 2.14k]
|
7347 | goto failed; |
7348 | } |
7349 | res = obj2ast_expr(state, tmp, &exc, arena); |
7350 | _Py_LeaveRecursiveCall(); |
7351 | if (res != 0) goto failed0 ; Branch (7351:17): [True: 0, False: 2.14k]
|
7352 | Py_CLEAR(tmp); |
7353 | } |
7354 | if (_PyObject_LookupAttr(obj, state->cause, &tmp) < 0) { Branch (7354:13): [True: 0, False: 2.31k]
|
7355 | return 1; |
7356 | } |
7357 | if (tmp == NULL || tmp == Py_None) { Branch (7357:13): [True: 0, False: 2.31k]
Branch (7357:28): [True: 2.18k, False: 133]
|
7358 | Py_CLEAR(tmp); |
7359 | cause = NULL; |
7360 | } |
7361 | else { |
7362 | int res; |
7363 | if (_Py_EnterRecursiveCall(" while traversing 'Raise' node")) { Branch (7363:17): [True: 0, False: 133]
|
7364 | goto failed; |
7365 | } |
7366 | res = obj2ast_expr(state, tmp, &cause, arena); |
7367 | _Py_LeaveRecursiveCall(); |
7368 | if (res != 0) goto failed0 ; Branch (7368:17): [True: 0, False: 133]
|
7369 | Py_CLEAR(tmp); |
7370 | } |
7371 | *out = _PyAST_Raise(exc, cause, lineno, col_offset, end_lineno, |
7372 | end_col_offset, arena); |
7373 | if (*out == NULL) goto failed0 ; Branch (7373:13): [True: 0, False: 2.31k]
|
7374 | return 0; |
7375 | } |
7376 | tp = state->Try_type; |
7377 | isinstance = PyObject_IsInstance(obj, tp); |
7378 | if (isinstance == -1) { Branch (7378:9): [True: 0, False: 16.9k]
|
7379 | return 1; |
7380 | } |
7381 | if (isinstance) { Branch (7381:9): [True: 1.47k, False: 15.4k]
|
7382 | asdl_stmt_seq* body; |
7383 | asdl_excepthandler_seq* handlers; |
7384 | asdl_stmt_seq* orelse; |
7385 | asdl_stmt_seq* finalbody; |
7386 | |
7387 | if (_PyObject_LookupAttr(obj, state->body, &tmp) < 0) { Branch (7387:13): [True: 0, False: 1.47k]
|
7388 | return 1; |
7389 | } |
7390 | if (tmp == NULL) { Branch (7390:13): [True: 0, False: 1.47k]
|
7391 | PyErr_SetString(PyExc_TypeError, "required field \"body\" missing from Try"); |
7392 | return 1; |
7393 | } |
7394 | else { |
7395 | int res; |
7396 | Py_ssize_t len; |
7397 | Py_ssize_t i; |
7398 | if (!PyList_Check(tmp)) { Branch (7398:17): [True: 0, False: 1.47k]
|
7399 | PyErr_Format(PyExc_TypeError, "Try field \"body\" must be a list, not a %.200s", _PyType_Name(Py_TYPE(tmp))); |
7400 | goto failed; |
7401 | } |
7402 | len = PyList_GET_SIZE(tmp); |
7403 | body = _Py_asdl_stmt_seq_new(len, arena); |
7404 | if (body == NULL) goto failed0 ; Branch (7404:17): [True: 0, False: 1.47k]
|
7405 | for (i = 0; 1.47k i < len; i++2.11k ) { Branch (7405:25): [True: 2.11k, False: 1.47k]
|
7406 | stmt_ty val; |
7407 | PyObject *tmp2 = PyList_GET_ITEM(tmp, i); |
7408 | Py_INCREF(tmp2); |
7409 | if (_Py_EnterRecursiveCall(" while traversing 'Try' node")) { Branch (7409:21): [True: 0, False: 2.11k]
|
7410 | goto failed; |
7411 | } |
7412 | res = obj2ast_stmt(state, tmp2, &val, arena); |
7413 | _Py_LeaveRecursiveCall(); |
7414 | Py_DECREF(tmp2); |
7415 | if (res != 0) goto failed0 ; Branch (7415:21): [True: 0, False: 2.11k]
|
7416 | if (len != PyList_GET_SIZE(tmp)) { Branch (7416:21): [True: 0, False: 2.11k]
|
7417 | PyErr_SetString(PyExc_RuntimeError, "Try field \"body\" changed size during iteration"); |
7418 | goto failed; |
7419 | } |
7420 | asdl_seq_SET(body, i, val); |
7421 | } |
7422 | Py_CLEAR(tmp); |
7423 | } |
7424 | if (_PyObject_LookupAttr(obj, state->handlers, &tmp) < 0) { Branch (7424:13): [True: 0, False: 1.47k]
|
7425 | return 1; |
7426 | } |
7427 | if (tmp == NULL) { Branch (7427:13): [True: 0, False: 1.47k]
|
7428 | PyErr_SetString(PyExc_TypeError, "required field \"handlers\" missing from Try"); |
7429 | return 1; |
7430 | } |
7431 | else { |
7432 | int res; |
7433 | Py_ssize_t len; |
7434 | Py_ssize_t i; |
7435 | if (!PyList_Check(tmp)) { Branch (7435:17): [True: 0, False: 1.47k]
|
7436 | PyErr_Format(PyExc_TypeError, "Try field \"handlers\" must be a list, not a %.200s", _PyType_Name(Py_TYPE(tmp))); |
7437 | goto failed; |
7438 | } |
7439 | len = PyList_GET_SIZE(tmp); |
7440 | handlers = _Py_asdl_excepthandler_seq_new(len, arena); |
7441 | if (handlers == NULL) goto failed0 ; Branch (7441:17): [True: 0, False: 1.47k]
|
7442 | for (i = 0; 1.47k i < len; i++1.39k ) { Branch (7442:25): [True: 1.39k, False: 1.47k]
|
7443 | excepthandler_ty val; |
7444 | PyObject *tmp2 = PyList_GET_ITEM(tmp, i); |
7445 | Py_INCREF(tmp2); |
7446 | if (_Py_EnterRecursiveCall(" while traversing 'Try' node")) { Branch (7446:21): [True: 0, False: 1.39k]
|
7447 | goto failed; |
7448 | } |
7449 | res = obj2ast_excepthandler(state, tmp2, &val, arena); |
7450 | _Py_LeaveRecursiveCall(); |
7451 | Py_DECREF(tmp2); |
7452 | if (res != 0) goto failed0 ; Branch (7452:21): [True: 0, False: 1.39k]
|
7453 | if (len != PyList_GET_SIZE(tmp)) { Branch (7453:21): [True: 0, False: 1.39k]
|
7454 | PyErr_SetString(PyExc_RuntimeError, "Try field \"handlers\" changed size during iteration"); |
7455 | goto failed; |
7456 | } |
7457 | asdl_seq_SET(handlers, i, val); |
7458 | } |
7459 | Py_CLEAR(tmp); |
7460 | } |
7461 | if (_PyObject_LookupAttr(obj, state->orelse, &tmp) < 0) { Branch (7461:13): [True: 0, False: 1.47k]
|
7462 | return 1; |
7463 | } |
7464 | if (tmp == NULL) { Branch (7464:13): [True: 0, False: 1.47k]
|
7465 | PyErr_SetString(PyExc_TypeError, "required field \"orelse\" missing from Try"); |
7466 | return 1; |
7467 | } |
7468 | else { |
7469 | int res; |
7470 | Py_ssize_t len; |
7471 | Py_ssize_t i; |
7472 | if (!PyList_Check(tmp)) { Branch (7472:17): [True: 0, False: 1.47k]
|
7473 | PyErr_Format(PyExc_TypeError, "Try field \"orelse\" must be a list, not a %.200s", _PyType_Name(Py_TYPE(tmp))); |
7474 | goto failed; |
7475 | } |
7476 | len = PyList_GET_SIZE(tmp); |
7477 | orelse = _Py_asdl_stmt_seq_new(len, arena); |
7478 | if (orelse == NULL) goto failed0 ; Branch (7478:17): [True: 0, False: 1.47k]
|
7479 | for (i = 0; 1.47k i < len; i++280 ) { Branch (7479:25): [True: 280, False: 1.47k]
|
7480 | stmt_ty val; |
7481 | PyObject *tmp2 = PyList_GET_ITEM(tmp, i); |
7482 | Py_INCREF(tmp2); |
7483 | if (_Py_EnterRecursiveCall(" while traversing 'Try' node")) { Branch (7483:21): [True: 0, False: 280]
|
7484 | goto failed; |
7485 | } |
7486 | res = obj2ast_stmt(state, tmp2, &val, arena); |
7487 | _Py_LeaveRecursiveCall(); |
7488 | Py_DECREF(tmp2); |
7489 | if (res != 0) goto failed0 ; Branch (7489:21): [True: 0, False: 280]
|
7490 | if (len != PyList_GET_SIZE(tmp)) { Branch (7490:21): [True: 0, False: 280]
|
7491 | PyErr_SetString(PyExc_RuntimeError, "Try field \"orelse\" changed size during iteration"); |
7492 | goto failed; |
7493 | } |
7494 | asdl_seq_SET(orelse, i, val); |
7495 | } |
7496 | Py_CLEAR(tmp); |
7497 | } |
7498 | if (_PyObject_LookupAttr(obj, state->finalbody, &tmp) < 0) { Branch (7498:13): [True: 0, False: 1.47k]
|
7499 | return 1; |
7500 | } |
7501 | if (tmp == NULL) { Branch (7501:13): [True: 0, False: 1.47k]
|
7502 | PyErr_SetString(PyExc_TypeError, "required field \"finalbody\" missing from Try"); |
7503 | return 1; |
7504 | } |
7505 | else { |
7506 | int res; |
7507 | Py_ssize_t len; |
7508 | Py_ssize_t i; |
7509 | if (!PyList_Check(tmp)) { Branch (7509:17): [True: 0, False: 1.47k]
|
7510 | PyErr_Format(PyExc_TypeError, "Try field \"finalbody\" must be a list, not a %.200s", _PyType_Name(Py_TYPE(tmp))); |
7511 | goto failed; |
7512 | } |
7513 | len = PyList_GET_SIZE(tmp); |
7514 | finalbody = _Py_asdl_stmt_seq_new(len, arena); |
7515 | if (finalbody == NULL) goto failed0 ; Branch (7515:17): [True: 0, False: 1.47k]
|
7516 | for (i = 0; 1.47k i < len; i++221 ) { Branch (7516:25): [True: 221, False: 1.47k]
|
7517 | stmt_ty val; |
7518 | PyObject *tmp2 = PyList_GET_ITEM(tmp, i); |
7519 | Py_INCREF(tmp2); |
7520 | if (_Py_EnterRecursiveCall(" while traversing 'Try' node")) { Branch (7520:21): [True: 0, False: 221]
|
7521 | goto failed; |
7522 | } |
7523 | res = obj2ast_stmt(state, tmp2, &val, arena); |
7524 | _Py_LeaveRecursiveCall(); |
7525 | Py_DECREF(tmp2); |
7526 | if (res != 0) goto failed0 ; Branch (7526:21): [True: 0, False: 221]
|
7527 | if (len != PyList_GET_SIZE(tmp)) { Branch (7527:21): [True: 0, False: 221]
|
7528 | PyErr_SetString(PyExc_RuntimeError, "Try field \"finalbody\" changed size during iteration"); |
7529 | goto failed; |
7530 | } |
7531 | asdl_seq_SET(finalbody, i, val); |
7532 | } |
7533 | Py_CLEAR(tmp); |
7534 | } |
7535 | *out = _PyAST_Try(body, handlers, orelse, finalbody, lineno, |
7536 | col_offset, end_lineno, end_col_offset, arena); |
7537 | if (*out == NULL) goto failed0 ; Branch (7537:13): [True: 0, False: 1.47k]
|
7538 | return 0; |
7539 | } |
7540 | tp = state->TryStar_type; |
7541 | isinstance = PyObject_IsInstance(obj, tp); |
7542 | if (isinstance == -1) { Branch (7542:9): [True: 0, False: 15.4k]
|
7543 | return 1; |
7544 | } |
7545 | if (isinstance) { Branch (7545:9): [True: 14, False: 15.4k]
|
7546 | asdl_stmt_seq* body; |
7547 | asdl_excepthandler_seq* handlers; |
7548 | asdl_stmt_seq* orelse; |
7549 | asdl_stmt_seq* finalbody; |
7550 | |
7551 | if (_PyObject_LookupAttr(obj, state->body, &tmp) < 0) { Branch (7551:13): [True: 0, False: 14]
|
7552 | return 1; |
7553 | } |
7554 | if (tmp == NULL) { Branch (7554:13): [True: 0, False: 14]
|
7555 | PyErr_SetString(PyExc_TypeError, "required field \"body\" missing from TryStar"); |
7556 | return 1; |
7557 | } |
7558 | else { |
7559 | int res; |
7560 | Py_ssize_t len; |
7561 | Py_ssize_t i; |
7562 | if (!PyList_Check(tmp)) { Branch (7562:17): [True: 0, False: 14]
|
7563 | PyErr_Format(PyExc_TypeError, "TryStar field \"body\" must be a list, not a %.200s", _PyType_Name(Py_TYPE(tmp))); |
7564 | goto failed; |
7565 | } |
7566 | len = PyList_GET_SIZE(tmp); |
7567 | body = _Py_asdl_stmt_seq_new(len, arena); |
7568 | if (body == NULL) goto failed0 ; Branch (7568:17): [True: 0, False: 14]
|
7569 | for (i = 0; 14 i < len; i++13 ) { Branch (7569:25): [True: 13, False: 14]
|
7570 | stmt_ty val; |
7571 | PyObject *tmp2 = PyList_GET_ITEM(tmp, i); |
7572 | Py_INCREF(tmp2); |
7573 | if (_Py_EnterRecursiveCall(" while traversing 'TryStar' node")) { Branch (7573:21): [True: 0, False: 13]
|
7574 | goto failed; |
7575 | } |
7576 | res = obj2ast_stmt(state, tmp2, &val, arena); |
7577 | _Py_LeaveRecursiveCall(); |
7578 | Py_DECREF(tmp2); |
7579 | if (res != 0) goto failed0 ; Branch (7579:21): [True: 0, False: 13]
|
7580 | if (len != PyList_GET_SIZE(tmp)) { Branch (7580:21): [True: 0, False: 13]
|
7581 | PyErr_SetString(PyExc_RuntimeError, "TryStar field \"body\" changed size during iteration"); |
7582 | goto failed; |
7583 | } |
7584 | asdl_seq_SET(body, i, val); |
7585 | } |
7586 | Py_CLEAR(tmp); |
7587 | } |
7588 | if (_PyObject_LookupAttr(obj, state->handlers, &tmp) < 0) { Branch (7588:13): [True: 0, False: 14]
|
7589 | return 1; |
7590 | } |
7591 | if (tmp == NULL) { Branch (7591:13): [True: 0, False: 14]
|
7592 | PyErr_SetString(PyExc_TypeError, "required field \"handlers\" missing from TryStar"); |
7593 | return 1; |
7594 | } |
7595 | else { |
7596 | int res; |
7597 | Py_ssize_t len; |
7598 | Py_ssize_t i; |
7599 | if (!PyList_Check(tmp)) { Branch (7599:17): [True: 0, False: 14]
|
7600 | PyErr_Format(PyExc_TypeError, "TryStar field \"handlers\" must be a list, not a %.200s", _PyType_Name(Py_TYPE(tmp))); |
7601 | goto failed; |
7602 | } |
7603 | len = PyList_GET_SIZE(tmp); |
7604 | handlers = _Py_asdl_excepthandler_seq_new(len, arena); |
7605 | if (handlers == NULL) goto failed0 ; Branch (7605:17): [True: 0, False: 14]
|
7606 | for (i = 0; 14 i < len; i++11 ) { Branch (7606:25): [True: 11, False: 14]
|
7607 | excepthandler_ty val; |
7608 | PyObject *tmp2 = PyList_GET_ITEM(tmp, i); |
7609 | Py_INCREF(tmp2); |
7610 | if (_Py_EnterRecursiveCall(" while traversing 'TryStar' node")) { Branch (7610:21): [True: 0, False: 11]
|
7611 | goto failed; |
7612 | } |
7613 | res = obj2ast_excepthandler(state, tmp2, &val, arena); |
7614 | _Py_LeaveRecursiveCall(); |
7615 | Py_DECREF(tmp2); |
7616 | if (res != 0) goto failed0 ; Branch (7616:21): [True: 0, False: 11]
|
7617 | if (len != PyList_GET_SIZE(tmp)) { Branch (7617:21): [True: 0, False: 11]
|
7618 | PyErr_SetString(PyExc_RuntimeError, "TryStar field \"handlers\" changed size during iteration"); |
7619 | goto failed; |
7620 | } |
7621 | asdl_seq_SET(handlers, i, val); |
7622 | } |
7623 | Py_CLEAR(tmp); |
7624 | } |
7625 | if (_PyObject_LookupAttr(obj, state->orelse, &tmp) < 0) { Branch (7625:13): [True: 0, False: 14]
|
7626 | return 1; |
7627 | } |
7628 | if (tmp == NULL) { Branch (7628:13): [True: 0, False: 14]
|
7629 | PyErr_SetString(PyExc_TypeError, "required field \"orelse\" missing from TryStar"); |
7630 | return 1; |
7631 | } |
7632 | else { |
7633 | int res; |
7634 | Py_ssize_t len; |
7635 | Py_ssize_t i; |
7636 | if (!PyList_Check(tmp)) { Branch (7636:17): [True: 0, False: 14]
|
7637 | PyErr_Format(PyExc_TypeError, "TryStar field \"orelse\" must be a list, not a %.200s", _PyType_Name(Py_TYPE(tmp))); |
7638 | goto failed; |
7639 | } |
7640 | len = PyList_GET_SIZE(tmp); |
7641 | orelse = _Py_asdl_stmt_seq_new(len, arena); |
7642 | if (orelse == NULL) goto failed0 ; Branch (7642:17): [True: 0, False: 14]
|
7643 | for (i = 0; 14 i < len; i++5 ) { Branch (7643:25): [True: 5, False: 14]
|
7644 | stmt_ty val; |
7645 | PyObject *tmp2 = PyList_GET_ITEM(tmp, i); |
7646 | Py_INCREF(tmp2); |
7647 | if (_Py_EnterRecursiveCall(" while traversing 'TryStar' node")) { Branch (7647:21): [True: 0, False: 5]
|
7648 | goto failed; |
7649 | } |
7650 | res = obj2ast_stmt(state, tmp2, &val, arena); |
7651 | _Py_LeaveRecursiveCall(); |
7652 | Py_DECREF(tmp2); |
7653 | if (res != 0) goto failed0 ; Branch (7653:21): [True: 0, False: 5]
|
7654 | if (len != PyList_GET_SIZE(tmp)) { Branch (7654:21): [True: 0, False: 5]
|
7655 | PyErr_SetString(PyExc_RuntimeError, "TryStar field \"orelse\" changed size during iteration"); |
7656 | goto failed; |
7657 | } |
7658 | asdl_seq_SET(orelse, i, val); |
7659 | } |
7660 | Py_CLEAR(tmp); |
7661 | } |
7662 | if (_PyObject_LookupAttr(obj, state->finalbody, &tmp) < 0) { Branch (7662:13): [True: 0, False: 14]
|
7663 | return 1; |
7664 | } |
7665 | if (tmp == NULL) { Branch (7665:13): [True: 0, False: 14]
|
7666 | PyErr_SetString(PyExc_TypeError, "required field \"finalbody\" missing from TryStar"); |
7667 | return 1; |
7668 | } |
7669 | else { |
7670 | int res; |
7671 | Py_ssize_t len; |
7672 | Py_ssize_t i; |
7673 | if (!PyList_Check(tmp)) { Branch (7673:17): [True: 0, False: 14]
|
7674 | PyErr_Format(PyExc_TypeError, "TryStar field \"finalbody\" must be a list, not a %.200s", _PyType_Name(Py_TYPE(tmp))); |
7675 | goto failed; |
7676 | } |
7677 | len = PyList_GET_SIZE(tmp); |
7678 | finalbody = _Py_asdl_stmt_seq_new(len, arena); |
7679 | if (finalbody == NULL) goto failed0 ; Branch (7679:17): [True: 0, False: 14]
|
7680 | for (i = 0; 14 i < len; i++5 ) { Branch (7680:25): [True: 5, False: 14]
|
7681 | stmt_ty val; |
7682 | PyObject *tmp2 = PyList_GET_ITEM(tmp, i); |
7683 | Py_INCREF(tmp2); |
7684 | if (_Py_EnterRecursiveCall(" while traversing 'TryStar' node")) { Branch (7684:21): [True: 0, False: 5]
|
7685 | goto failed; |
7686 | } |
7687 | res = obj2ast_stmt(state, tmp2, &val, arena); |
7688 | _Py_LeaveRecursiveCall(); |
7689 | Py_DECREF(tmp2); |
7690 | if (res != 0) goto failed0 ; Branch (7690:21): [True: 0, False: 5]
|
7691 | if (len != PyList_GET_SIZE(tmp)) { Branch (7691:21): [True: 0, False: 5]
|
7692 | PyErr_SetString(PyExc_RuntimeError, "TryStar field \"finalbody\" changed size during iteration"); |
7693 | goto failed; |
7694 | } |
7695 | asdl_seq_SET(finalbody, i, val); |
7696 | } |
7697 | Py_CLEAR(tmp); |
7698 | } |
7699 | *out = _PyAST_TryStar(body, handlers, orelse, finalbody, lineno, |
7700 | col_offset, end_lineno, end_col_offset, arena); |
7701 | if (*out == NULL) goto failed0 ; Branch (7701:13): [True: 0, False: 14]
|
7702 | return 0; |
7703 | } |
7704 | tp = state->Assert_type; |
7705 | isinstance = PyObject_IsInstance(obj, tp); |
7706 | if (isinstance == -1) { Branch (7706:9): [True: 0, False: 15.4k]
|
7707 | return 1; |
7708 | } |
7709 | if (isinstance) { Branch (7709:9): [True: 223, False: 15.2k]
|
7710 | expr_ty test; |
7711 | expr_ty msg; |
7712 | |
7713 | if (_PyObject_LookupAttr(obj, state->test, &tmp) < 0) { Branch (7713:13): [True: 0, False: 223]
|
7714 | return 1; |
7715 | } |
7716 | if (tmp == NULL) { Branch (7716:13): [True: 0, False: 223]
|
7717 | PyErr_SetString(PyExc_TypeError, "required field \"test\" missing from Assert"); |
7718 | return 1; |
7719 | } |
7720 | else { |
7721 | int res; |
7722 | if (_Py_EnterRecursiveCall(" while traversing 'Assert' node")) { Branch (7722:17): [True: 0, False: 223]
|
7723 | goto failed; |
7724 | } |
7725 | res = obj2ast_expr(state, tmp, &test, arena); |
7726 | _Py_LeaveRecursiveCall(); |
7727 | if (res != 0) goto failed0 ; Branch (7727:17): [True: 0, False: 223]
|
7728 | Py_CLEAR(tmp); |
7729 | } |
7730 | if (_PyObject_LookupAttr(obj, state->msg, &tmp) < 0) { Branch (7730:13): [True: 0, False: 223]
|
7731 | return 1; |
7732 | } |
7733 | if (tmp == NULL || tmp == Py_None) { Branch (7733:13): [True: 0, False: 223]
Branch (7733:28): [True: 173, False: 50]
|
7734 | Py_CLEAR(tmp); |
7735 | msg = NULL; |
7736 | } |
7737 | else { |
7738 | int res; |
7739 | if (_Py_EnterRecursiveCall(" while traversing 'Assert' node")) { Branch (7739:17): [True: 0, False: 50]
|
7740 | goto failed; |
7741 | } |
7742 | res = obj2ast_expr(state, tmp, &msg, arena); |
7743 | _Py_LeaveRecursiveCall(); |
7744 | if (res != 0) goto failed0 ; Branch (7744:17): [True: 0, False: 50]
|
7745 | Py_CLEAR(tmp); |
7746 | } |
7747 | *out = _PyAST_Assert(test, msg, lineno, col_offset, end_lineno, |
7748 | end_col_offset, arena); |
7749 | if (*out == NULL) goto failed0 ; Branch (7749:13): [True: 0, False: 223]
|
7750 | return 0; |
7751 | } |
7752 | tp = state->Import_type; |
7753 | isinstance = PyObject_IsInstance(obj, tp); |
7754 | if (isinstance == -1) { Branch (7754:9): [True: 0, False: 15.2k]
|
7755 | return 1; |
7756 | } |
7757 | if (isinstance) { Branch (7757:9): [True: 963, False: 14.2k]
|
7758 | asdl_alias_seq* names; |
7759 | |
7760 | if (_PyObject_LookupAttr(obj, state->names, &tmp) < 0) { Branch (7760:13): [True: 0, False: 963]
|
7761 | return 1; |
7762 | } |
7763 | if (tmp == NULL) { Branch (7763:13): [True: 0, False: 963]
|
7764 | PyErr_SetString(PyExc_TypeError, "required field \"names\" missing from Import"); |
7765 | return 1; |
7766 | } |
7767 | else { |
7768 | int res; |
7769 | Py_ssize_t len; |
7770 | Py_ssize_t i; |
7771 | if (!PyList_Check(tmp)) { Branch (7771:17): [True: 0, False: 963]
|
7772 | PyErr_Format(PyExc_TypeError, "Import field \"names\" must be a list, not a %.200s", _PyType_Name(Py_TYPE(tmp))); |
7773 | goto failed; |
7774 | } |
7775 | len = PyList_GET_SIZE(tmp); |
7776 | names = _Py_asdl_alias_seq_new(len, arena); |
7777 | if (names == NULL) goto failed0 ; Branch (7777:17): [True: 0, False: 963]
|
7778 | for (i = 0; 963 i < len; i++997 ) { Branch (7778:25): [True: 997, False: 963]
|
7779 | alias_ty val; |
7780 | PyObject *tmp2 = PyList_GET_ITEM(tmp, i); |
7781 | Py_INCREF(tmp2); |
7782 | if (_Py_EnterRecursiveCall(" while traversing 'Import' node")) { Branch (7782:21): [True: 0, False: 997]
|
7783 | goto failed; |
7784 | } |
7785 | res = obj2ast_alias(state, tmp2, &val, arena); |
7786 | _Py_LeaveRecursiveCall(); |
7787 | Py_DECREF(tmp2); |
7788 | if (res != 0) goto failed0 ; Branch (7788:21): [True: 0, False: 997]
|
7789 | if (len != PyList_GET_SIZE(tmp)) { Branch (7789:21): [True: 0, False: 997]
|
7790 | PyErr_SetString(PyExc_RuntimeError, "Import field \"names\" changed size during iteration"); |
7791 | goto failed; |
7792 | } |
7793 | asdl_seq_SET(names, i, val); |
7794 | } |
7795 | Py_CLEAR(tmp); |
7796 | } |
7797 | *out = _PyAST_Import(names, lineno, col_offset, end_lineno, |
7798 | end_col_offset, arena); |
7799 | if (*out == NULL) goto failed0 ; Branch (7799:13): [True: 0, False: 963]
|
7800 | return 0; |
7801 | } |
7802 | tp = state->ImportFrom_type; |
7803 | isinstance = PyObject_IsInstance(obj, tp); |
7804 | if (isinstance == -1) { Branch (7804:9): [True: 0, False: 14.2k]
|
7805 | return 1; |
7806 | } |
7807 | if (isinstance) { Branch (7807:9): [True: 370, False: 13.9k]
|
7808 | identifier module; |
7809 | asdl_alias_seq* names; |
7810 | int level; |
7811 | |
7812 | if (_PyObject_LookupAttr(obj, state->module, &tmp) < 0) { Branch (7812:13): [True: 0, False: 370]
|
7813 | return 1; |
7814 | } |
7815 | if (tmp == NULL || tmp == Py_None) { Branch (7815:13): [True: 0, False: 370]
Branch (7815:28): [True: 2, False: 368]
|
7816 | Py_CLEAR(tmp); |
7817 | module = NULL; |
7818 | } |
7819 | else { |
7820 | int res; |
7821 | if (_Py_EnterRecursiveCall(" while traversing 'ImportFrom' node")) { Branch (7821:17): [True: 0, False: 368]
|
7822 | goto failed; |
7823 | } |
7824 | res = obj2ast_identifier(state, tmp, &module, arena); |
7825 | _Py_LeaveRecursiveCall(); |
7826 | if (res != 0) goto failed0 ; Branch (7826:17): [True: 0, False: 368]
|
7827 | Py_CLEAR(tmp); |
7828 | } |
7829 | if (_PyObject_LookupAttr(obj, state->names, &tmp) < 0) { Branch (7829:13): [True: 0, False: 370]
|
7830 | return 1; |
7831 | } |
7832 | if (tmp == NULL) { Branch (7832:13): [True: 0, False: 370]
|
7833 | PyErr_SetString(PyExc_TypeError, "required field \"names\" missing from ImportFrom"); |
7834 | return 1; |
7835 | } |
7836 | else { |
7837 | int res; |
7838 | Py_ssize_t len; |
7839 | Py_ssize_t i; |
7840 | if (!PyList_Check(tmp)) { Branch (7840:17): [True: 0, False: 370]
|
7841 | PyErr_Format(PyExc_TypeError, "ImportFrom field \"names\" must be a list, not a %.200s", _PyType_Name(Py_TYPE(tmp))); |
7842 | goto failed; |
7843 | } |
7844 | len = PyList_GET_SIZE(tmp); |
7845 | names = _Py_asdl_alias_seq_new(len, arena); |
7846 | if (names == NULL) goto failed0 ; Branch (7846:17): [True: 0, False: 370]
|
7847 | for (i = 0; 370 i < len; i++623 ) { Branch (7847:25): [True: 623, False: 370]
|
7848 | alias_ty val; |
7849 | PyObject *tmp2 = PyList_GET_ITEM(tmp, i); |
7850 | Py_INCREF(tmp2); |
7851 | if (_Py_EnterRecursiveCall(" while traversing 'ImportFrom' node")) { Branch (7851:21): [True: 0, False: 623]
|
7852 | goto failed; |
7853 | } |
7854 | res = obj2ast_alias(state, tmp2, &val, arena); |
7855 | _Py_LeaveRecursiveCall(); |
7856 | Py_DECREF(tmp2); |
7857 | if (res != 0) goto failed0 ; Branch (7857:21): [True: 0, False: 623]
|
7858 | if (len != PyList_GET_SIZE(tmp)) { Branch (7858:21): [True: 0, False: 623]
|
7859 | PyErr_SetString(PyExc_RuntimeError, "ImportFrom field \"names\" changed size during iteration"); |
7860 | goto failed; |
7861 | } |
7862 | asdl_seq_SET(names, i, val); |
7863 | } |
7864 | Py_CLEAR(tmp); |
7865 | } |
7866 | if (_PyObject_LookupAttr(obj, state->level, &tmp) < 0) { Branch (7866:13): [True: 0, False: 370]
|
7867 | return 1; |
7868 | } |
7869 | if (tmp == NULL || tmp == Py_None) { Branch (7869:13): [True: 0, False: 370]
Branch (7869:28): [True: 1, False: 369]
|
7870 | Py_CLEAR(tmp); |
7871 | level = 0; |
7872 | } |
7873 | else { |
7874 | int res; |
7875 | if (_Py_EnterRecursiveCall(" while traversing 'ImportFrom' node")) { Branch (7875:17): [True: 0, False: 369]
|
7876 | goto failed; |
7877 | } |
7878 | res = obj2ast_int(state, tmp, &level, arena); |
7879 | _Py_LeaveRecursiveCall(); |
7880 | if (res != 0) goto failed0 ; Branch (7880:17): [True: 0, False: 369]
|
7881 | Py_CLEAR(tmp); |
7882 | } |
7883 | *out = _PyAST_ImportFrom(module, names, level, lineno, col_offset, |
7884 | end_lineno, end_col_offset, arena); |
7885 | if (*out == NULL) goto failed0 ; Branch (7885:13): [True: 0, False: 370]
|
7886 | return 0; |
7887 | } |
7888 | tp = state->Global_type; |
7889 | isinstance = PyObject_IsInstance(obj, tp); |
7890 | if (isinstance == -1) { Branch (7890:9): [True: 0, False: 13.9k]
|
7891 | return 1; |
7892 | } |
7893 | if (isinstance) { Branch (7893:9): [True: 66, False: 13.8k]
|
7894 | asdl_identifier_seq* names; |
7895 | |
7896 | if (_PyObject_LookupAttr(obj, state->names, &tmp) < 0) { Branch (7896:13): [True: 0, False: 66]
|
7897 | return 1; |
7898 | } |
7899 | if (tmp == NULL) { Branch (7899:13): [True: 0, False: 66]
|
7900 | PyErr_SetString(PyExc_TypeError, "required field \"names\" missing from Global"); |
7901 | return 1; |
7902 | } |
7903 | else { |
7904 | int res; |
7905 | Py_ssize_t len; |
7906 | Py_ssize_t i; |
7907 | if (!PyList_Check(tmp)) { Branch (7907:17): [True: 0, False: 66]
|
7908 | PyErr_Format(PyExc_TypeError, "Global field \"names\" must be a list, not a %.200s", _PyType_Name(Py_TYPE(tmp))); |
7909 | goto failed; |
7910 | } |
7911 | len = PyList_GET_SIZE(tmp); |
7912 | names = _Py_asdl_identifier_seq_new(len, arena); |
7913 | if (names == NULL) goto failed0 ; Branch (7913:17): [True: 0, False: 66]
|
7914 | for (i = 0; 66 i < len; i++96 ) { Branch (7914:25): [True: 96, False: 66]
|
7915 | identifier val; |
7916 | PyObject *tmp2 = PyList_GET_ITEM(tmp, i); |
7917 | Py_INCREF(tmp2); |
7918 | if (_Py_EnterRecursiveCall(" while traversing 'Global' node")) { Branch (7918:21): [True: 0, False: 96]
|
7919 | goto failed; |
7920 | } |
7921 | res = obj2ast_identifier(state, tmp2, &val, arena); |
7922 | _Py_LeaveRecursiveCall(); |
7923 | Py_DECREF(tmp2); |
7924 | if (res != 0) goto failed0 ; Branch (7924:21): [True: 0, False: 96]
|
7925 | if (len != PyList_GET_SIZE(tmp)) { Branch (7925:21): [True: 0, False: 96]
|
7926 | PyErr_SetString(PyExc_RuntimeError, "Global field \"names\" changed size during iteration"); |
7927 | goto failed; |
7928 | } |
7929 | asdl_seq_SET(names, i, val); |
7930 | } |
7931 | Py_CLEAR(tmp); |
7932 | } |
7933 | *out = _PyAST_Global(names, lineno, col_offset, end_lineno, |
7934 | end_col_offset, arena); |
7935 | if (*out == NULL) goto failed0 ; Branch (7935:13): [True: 0, False: 66]
|
7936 | return 0; |
7937 | } |
7938 | tp = state->Nonlocal_type; |
7939 | isinstance = PyObject_IsInstance(obj, tp); |
7940 | if (isinstance == -1) { Branch (7940:9): [True: 0, False: 13.8k]
|
7941 | return 1; |
7942 | } |
7943 | if (isinstance) { Branch (7943:9): [True: 21, False: 13.8k]
|
7944 | asdl_identifier_seq* names; |
7945 | |
7946 | if (_PyObject_LookupAttr(obj, state->names, &tmp) < 0) { Branch (7946:13): [True: 0, False: 21]
|
7947 | return 1; |
7948 | } |
7949 | if (tmp == NULL) { Branch (7949:13): [True: 0, False: 21]
|
7950 | PyErr_SetString(PyExc_TypeError, "required field \"names\" missing from Nonlocal"); |
7951 | return 1; |
7952 | } |
7953 | else { |
7954 | int res; |
7955 | Py_ssize_t len; |
7956 | Py_ssize_t i; |
7957 | if (!PyList_Check(tmp)) { Branch (7957:17): [True: 0, False: 21]
|
7958 | PyErr_Format(PyExc_TypeError, "Nonlocal field \"names\" must be a list, not a %.200s", _PyType_Name(Py_TYPE(tmp))); |
7959 | goto failed; |
7960 | } |
7961 | len = PyList_GET_SIZE(tmp); |
7962 | names = _Py_asdl_identifier_seq_new(len, arena); |
7963 | if (names == NULL) goto failed0 ; Branch (7963:17): [True: 0, False: 21]
|
7964 | for (i = 0; 21 i < len; i++29 ) { Branch (7964:25): [True: 29, False: 21]
|
7965 | identifier val; |
7966 | PyObject *tmp2 = PyList_GET_ITEM(tmp, i); |
7967 | Py_INCREF(tmp2); |
7968 | if (_Py_EnterRecursiveCall(" while traversing 'Nonlocal' node")) { Branch (7968:21): [True: 0, False: 29]
|
7969 | goto failed; |
7970 | } |
7971 | res = obj2ast_identifier(state, tmp2, &val, arena); |
7972 | _Py_LeaveRecursiveCall(); |
7973 | Py_DECREF(tmp2); |
7974 | if (res != 0) goto failed0 ; Branch (7974:21): [True: 0, False: 29]
|
7975 | if (len != PyList_GET_SIZE(tmp)) { Branch (7975:21): [True: 0, False: 29]
|
7976 | PyErr_SetString(PyExc_RuntimeError, "Nonlocal field \"names\" changed size during iteration"); |
7977 | goto failed; |
7978 | } |
7979 | asdl_seq_SET(names, i, val); |
7980 | } |
7981 | Py_CLEAR(tmp); |
7982 | } |
7983 | *out = _PyAST_Nonlocal(names, lineno, col_offset, end_lineno, |
7984 | end_col_offset, arena); |
7985 | if (*out == NULL) goto failed0 ; Branch (7985:13): [True: 0, False: 21]
|
7986 | return 0; |
7987 | } |
7988 | tp = state->Expr_type; |
7989 | isinstance = PyObject_IsInstance(obj, tp); |
7990 | if (isinstance == -1) { Branch (7990:9): [True: 0, False: 13.8k]
|
7991 | return 1; |
7992 | } |
7993 | if (isinstance) { Branch (7993:9): [True: 12.3k, False: 1.44k]
|
7994 | expr_ty value; |
7995 | |
7996 | if (_PyObject_LookupAttr(obj, state->value, &tmp) < 0) { Branch (7996:13): [True: 0, False: 12.3k]
|
7997 | return 1; |
7998 | } |
7999 | if (tmp == NULL) { Branch (7999:13): [True: 0, False: 12.3k]
|
8000 | PyErr_SetString(PyExc_TypeError, "required field \"value\" missing from Expr"); |
8001 | return 1; |
8002 | } |
8003 | else { |
8004 | int res; |
8005 | if (_Py_EnterRecursiveCall(" while traversing 'Expr' node")) { Branch (8005:17): [True: 0, False: 12.3k]
|
8006 | goto failed; |
8007 | } |
8008 | res = obj2ast_expr(state, tmp, &value, arena); |
8009 | _Py_LeaveRecursiveCall(); |
8010 | if (res != 0) goto failed3 ; Branch (8010:17): [True: 3, False: 12.3k]
|
8011 | Py_CLEAR(tmp); |
8012 | } |
8013 | *out = _PyAST_Expr(value, lineno, col_offset, end_lineno, |
8014 | end_col_offset, arena); |
8015 | if (*out == NULL) goto failed0 ; Branch (8015:13): [True: 0, False: 12.3k]
|
8016 | return 0; |
8017 | } |
8018 | tp = state->Pass_type; |
8019 | isinstance = PyObject_IsInstance(obj, tp); |
8020 | if (isinstance == -1) { Branch (8020:9): [True: 0, False: 1.44k]
|
8021 | return 1; |
8022 | } |
8023 | if (isinstance) { Branch (8023:9): [True: 821, False: 624]
|
8024 | |
8025 | *out = _PyAST_Pass(lineno, col_offset, end_lineno, end_col_offset, |
8026 | arena); |
8027 | if (*out == NULL) goto failed0 ; Branch (8027:13): [True: 0, False: 821]
|
8028 | return 0; |
8029 | } |
8030 | tp = state->Break_type; |
8031 | isinstance = PyObject_IsInstance(obj, tp); |
8032 | if (isinstance == -1) { Branch (8032:9): [True: 0, False: 624]
|
8033 | return 1; |
8034 | } |
8035 | if (isinstance) { Branch (8035:9): [True: 358, False: 266]
|
8036 | |
8037 | *out = _PyAST_Break(lineno, col_offset, end_lineno, end_col_offset, |
8038 | arena); |
8039 | if (*out == NULL) goto failed0 ; Branch (8039:13): [True: 0, False: 358]
|
8040 | return 0; |
8041 | } |
8042 | tp = state->Continue_type; |
8043 | isinstance = PyObject_IsInstance(obj, tp); |
8044 | if (isinstance == -1) { Branch (8044:9): [True: 0, False: 266]
|
8045 | return 1; |
8046 | } |
8047 | if (isinstance) { Branch (8047:9): [True: 266, False: 0]
|
8048 | |
8049 | *out = _PyAST_Continue(lineno, col_offset, end_lineno, end_col_offset, |
8050 | arena); |
8051 | if (*out == NULL) goto failed0 ; Branch (8051:13): [True: 0, False: 266]
|
8052 | return 0; |
8053 | } |
8054 | |
8055 | PyErr_Format(PyExc_TypeError, "expected some sort of stmt, but got %R", obj); |
8056 | failed: |
8057 | Py_XDECREF(tmp); |
8058 | return 1; |
8059 | } |
8060 | |
8061 | int |
8062 | obj2ast_expr(struct ast_state *state, PyObject* obj, expr_ty* out, PyArena* |
8063 | arena) |
8064 | { |
8065 | int isinstance; |
8066 | |
8067 | PyObject *tmp = NULL; |
8068 | PyObject *tp; |
8069 | int lineno; |
8070 | int col_offset; |
8071 | int end_lineno; |
8072 | int end_col_offset; |
8073 | |
8074 | if (obj == Py_None) { Branch (8074:9): [True: 66, False: 267k]
|
8075 | *out = NULL; |
8076 | return 0; |
8077 | } |
8078 | if (_PyObject_LookupAttr(obj, state->lineno, &tmp) < 0) { Branch (8078:9): [True: 0, False: 267k]
|
8079 | return 1; |
8080 | } |
8081 | if (tmp == NULL) { Branch (8081:9): [True: 0, False: 267k]
|
8082 | PyErr_SetString(PyExc_TypeError, "required field \"lineno\" missing from expr"); |
8083 | return 1; |
8084 | } |
8085 | else { |
8086 | int res; |
8087 | if (_Py_EnterRecursiveCall(" while traversing 'expr' node")) { Branch (8087:13): [True: 2, False: 267k]
|
8088 | goto failed; |
8089 | } |
8090 | res = obj2ast_int(state, tmp, &lineno, arena); |
8091 | _Py_LeaveRecursiveCall(); |
8092 | if (res != 0) goto failed0 ; Branch (8092:13): [True: 0, False: 267k]
|
8093 | Py_CLEAR(tmp); |
8094 | } |
8095 | if (_PyObject_LookupAttr(obj, state->col_offset, &tmp) < 0) { Branch (8095:9): [True: 0, False: 267k]
|
8096 | return 1; |
8097 | } |
8098 | if (tmp == NULL) { Branch (8098:9): [True: 0, False: 267k]
|
8099 | PyErr_SetString(PyExc_TypeError, "required field \"col_offset\" missing from expr"); |
8100 | return 1; |
8101 | } |
8102 | else { |
8103 | int res; |
8104 | if (_Py_EnterRecursiveCall(" while traversing 'expr' node")) { Branch (8104:13): [True: 0, False: 267k]
|
8105 | goto failed; |
8106 | } |
8107 | res = obj2ast_int(state, tmp, &col_offset, arena); |
8108 | _Py_LeaveRecursiveCall(); |
8109 | if (res != 0) goto failed0 ; Branch (8109:13): [True: 0, False: 267k]
|
8110 | Py_CLEAR(tmp); |
8111 | } |
8112 | if (_PyObject_LookupAttr(obj, state->end_lineno, &tmp) < 0) { Branch (8112:9): [True: 0, False: 267k]
|
8113 | return 1; |
8114 | } |
8115 | if (tmp == NULL || tmp == Py_None) { Branch (8115:9): [True: 0, False: 267k]
Branch (8115:24): [True: 85, False: 267k]
|
8116 | Py_CLEAR(tmp); |
8117 | end_lineno = lineno; |
8118 | } |
8119 | else { |
8120 | int res; |
8121 | if (_Py_EnterRecursiveCall(" while traversing 'expr' node")) { Branch (8121:13): [True: 0, False: 267k]
|
8122 | goto failed; |
8123 | } |
8124 | res = obj2ast_int(state, tmp, &end_lineno, arena); |
8125 | _Py_LeaveRecursiveCall(); |
8126 | if (res != 0) goto failed0 ; Branch (8126:13): [True: 0, False: 267k]
|
8127 | Py_CLEAR(tmp); |
8128 | } |
8129 | if (_PyObject_LookupAttr(obj, state->end_col_offset, &tmp) < 0) { Branch (8129:9): [True: 0, False: 267k]
|
8130 | return 1; |
8131 | } |
8132 | if (tmp == NULL || tmp == Py_None) { Branch (8132:9): [True: 0, False: 267k]
Branch (8132:24): [True: 85, False: 267k]
|
8133 | Py_CLEAR(tmp); |
8134 | end_col_offset = col_offset; |
8135 | } |
8136 | else { |
8137 | int res; |
8138 | if (_Py_EnterRecursiveCall(" while traversing 'expr' node")) { Branch (8138:13): [True: 0, False: 267k]
|
8139 | goto failed; |
8140 | } |
8141 | res = obj2ast_int(state, tmp, &end_col_offset, arena); |
8142 | _Py_LeaveRecursiveCall(); |
8143 | if (res != 0) goto failed0 ; Branch (8143:13): [True: 0, False: 267k]
|
8144 | Py_CLEAR(tmp); |
8145 | } |
8146 | tp = state->BoolOp_type; |
8147 | isinstance = PyObject_IsInstance(obj, tp); |
8148 | if (isinstance == -1) { Branch (8148:9): [True: 0, False: 267k]
|
8149 | return 1; |
8150 | } |
8151 | if (isinstance) { Branch (8151:9): [True: 2.06k, False: 265k]
|
8152 | boolop_ty op; |
8153 | asdl_expr_seq* values; |
8154 | |
8155 | if (_PyObject_LookupAttr(obj, state->op, &tmp) < 0) { Branch (8155:13): [True: 0, False: 2.06k]
|
8156 | return 1; |
8157 | } |
8158 | if (tmp == NULL) { Branch (8158:13): [True: 0, False: 2.06k]
|
8159 | PyErr_SetString(PyExc_TypeError, "required field \"op\" missing from BoolOp"); |
8160 | return 1; |
8161 | } |
8162 | else { |
8163 | int res; |
8164 | if (_Py_EnterRecursiveCall(" while traversing 'BoolOp' node")) { Branch (8164:17): [True: 0, False: 2.06k]
|
8165 | goto failed; |
8166 | } |
8167 | res = obj2ast_boolop(state, tmp, &op, arena); |
8168 | _Py_LeaveRecursiveCall(); |
8169 | if (res != 0) goto failed0 ; Branch (8169:17): [True: 0, False: 2.06k]
|
8170 | Py_CLEAR(tmp); |
8171 | } |
8172 | if (_PyObject_LookupAttr(obj, state->values, &tmp) < 0) { Branch (8172:13): [True: 0, False: 2.06k]
|
8173 | return 1; |
8174 | } |
8175 | if (tmp == NULL) { Branch (8175:13): [True: 0, False: 2.06k]
|
8176 | PyErr_SetString(PyExc_TypeError, "required field \"values\" missing from BoolOp"); |
8177 | return 1; |
8178 | } |
8179 | else { |
8180 | int res; |
8181 | Py_ssize_t len; |
8182 | Py_ssize_t i; |
8183 | if (!PyList_Check(tmp)) { Branch (8183:17): [True: 0, False: 2.06k]
|
8184 | PyErr_Format(PyExc_TypeError, "BoolOp field \"values\" must be a list, not a %.200s", _PyType_Name(Py_TYPE(tmp))); |
8185 | goto failed; |
8186 | } |
8187 | len = PyList_GET_SIZE(tmp); |
8188 | values = _Py_asdl_expr_seq_new(len, arena); |
8189 | if (values == NULL) goto failed0 ; Branch (8189:17): [True: 0, False: 2.06k]
|
8190 | for (i = 0; 2.06k i < len; i++4.39k ) { Branch (8190:25): [True: 4.39k, False: 2.06k]
|
8191 | expr_ty val; |
8192 | PyObject *tmp2 = PyList_GET_ITEM(tmp, i); |
8193 | Py_INCREF(tmp2); |
8194 | if (_Py_EnterRecursiveCall(" while traversing 'BoolOp' node")) { Branch (8194:21): [True: 0, False: 4.39k]
|
8195 | goto failed; |
8196 | } |
8197 | res = obj2ast_expr(state, tmp2, &val, arena); |
8198 | _Py_LeaveRecursiveCall(); |
8199 | Py_DECREF(tmp2); |
8200 | if (res != 0) goto failed0 ; Branch (8200:21): [True: 0, False: 4.39k]
|
8201 | if (len != PyList_GET_SIZE(tmp)) { Branch (8201:21): [True: 0, False: 4.39k]
|
8202 | PyErr_SetString(PyExc_RuntimeError, "BoolOp field \"values\" changed size during iteration"); |
8203 | goto failed; |
8204 | } |
8205 | asdl_seq_SET(values, i, val); |
8206 | } |
8207 | Py_CLEAR(tmp); |
8208 | } |
8209 | *out = _PyAST_BoolOp(op, values, lineno, col_offset, end_lineno, |
8210 | end_col_offset, arena); |
8211 | if (*out == NULL) goto failed0 ; Branch (8211:13): [True: 0, False: 2.06k]
|
8212 | return 0; |
8213 | } |
8214 | tp = state->NamedExpr_type; |
8215 | isinstance = PyObject_IsInstance(obj, tp); |
8216 | if (isinstance == -1) { Branch (8216:9): [True: 0, False: 265k]
|
8217 | return 1; |
8218 | } |
8219 | if (isinstance) { Branch (8219:9): [True: 22, False: 265k]
|
8220 | expr_ty target; |
8221 | expr_ty value; |
8222 | |
8223 | if (_PyObject_LookupAttr(obj, state->target, &tmp) < 0) { Branch (8223:13): [True: 0, False: 22]
|
8224 | return 1; |
8225 | } |
8226 | if (tmp == NULL) { Branch (8226:13): [True: 0, False: 22]
|
8227 | PyErr_SetString(PyExc_TypeError, "required field \"target\" missing from NamedExpr"); |
8228 | return 1; |
8229 | } |
8230 | else { |
8231 | int res; |
8232 | if (_Py_EnterRecursiveCall(" while traversing 'NamedExpr' node")) { Branch (8232:17): [True: 0, False: 22]
|
8233 | goto failed; |
8234 | } |
8235 | res = obj2ast_expr(state, tmp, &target, arena); |
8236 | _Py_LeaveRecursiveCall(); |
8237 | if (res != 0) goto failed0 ; Branch (8237:17): [True: 0, False: 22]
|
8238 | Py_CLEAR(tmp); |
8239 | } |
8240 | if (_PyObject_LookupAttr(obj, state->value, &tmp) < 0) { Branch (8240:13): [True: 0, False: 22]
|
8241 | return 1; |
8242 | } |
8243 | if (tmp == NULL) { Branch (8243:13): [True: 0, False: 22]
|
8244 | PyErr_SetString(PyExc_TypeError, "required field \"value\" missing from NamedExpr"); |
8245 | return 1; |
8246 | } |
8247 | else { |
8248 | int res; |
8249 | if (_Py_EnterRecursiveCall(" while traversing 'NamedExpr' node")) { Branch (8249:17): [True: 0, False: 22]
|
8250 | goto failed; |
8251 | } |
8252 | res = obj2ast_expr(state, tmp, &value, arena); |
8253 | _Py_LeaveRecursiveCall(); |
8254 | if (res != 0) goto failed0 ; Branch (8254:17): [True: 0, False: 22]
|
8255 | Py_CLEAR(tmp); |
8256 | } |
8257 | *out = _PyAST_NamedExpr(target, value, lineno, col_offset, end_lineno, |
8258 | end_col_offset, arena); |
8259 | if (*out == NULL) goto failed0 ; Branch (8259:13): [True: 0, False: 22]
|
8260 | return 0; |
8261 | } |
8262 | tp = state->BinOp_type; |
8263 | isinstance = PyObject_IsInstance(obj, tp); |
8264 | if (isinstance == -1) { Branch (8264:9): [True: 0, False: 265k]
|
8265 | return 1; |
8266 | } |
8267 | if (isinstance) { Branch (8267:9): [True: 6.63k, False: 258k]
|
8268 | expr_ty left; |
8269 | operator_ty op; |
8270 | expr_ty right; |
8271 | |
8272 | if (_PyObject_LookupAttr(obj, state->left, &tmp) < 0) { Branch (8272:13): [True: 0, False: 6.63k]
|
8273 | return 1; |
8274 | } |
8275 | if (tmp == NULL) { Branch (8275:13): [True: 0, False: 6.63k]
|
8276 | PyErr_SetString(PyExc_TypeError, "required field \"left\" missing from BinOp"); |
8277 | return 1; |
8278 | } |
8279 | else { |
8280 | int res; |
8281 | if (_Py_EnterRecursiveCall(" while traversing 'BinOp' node")) { Branch (8281:17): [True: 0, False: 6.63k]
|
8282 | goto failed; |
8283 | } |
8284 | res = obj2ast_expr(state, tmp, &left, arena); |
8285 | _Py_LeaveRecursiveCall(); |
8286 | if (res != 0) goto failed0 ; Branch (8286:17): [True: 0, False: 6.63k]
|
8287 | Py_CLEAR(tmp); |
8288 | } |
8289 | if (_PyObject_LookupAttr(obj, state->op, &tmp) < 0) { Branch (8289:13): [True: 0, False: 6.63k]
|
8290 | return 1; |
8291 | } |
8292 | if (tmp == NULL) { Branch (8292:13): [True: 0, False: 6.63k]
|
8293 | PyErr_SetString(PyExc_TypeError, "required field \"op\" missing from BinOp"); |
8294 | return 1; |
8295 | } |
8296 | else { |
8297 | int res; |
8298 | if (_Py_EnterRecursiveCall(" while traversing 'BinOp' node")) { Branch (8298:17): [True: 0, False: 6.63k]
|
8299 | goto failed; |
8300 | } |
8301 | res = obj2ast_operator(state, tmp, &op, arena); |
8302 | _Py_LeaveRecursiveCall(); |
8303 | if (res != 0) goto failed0 ; Branch (8303:17): [True: 0, False: 6.63k]
|
8304 | Py_CLEAR(tmp); |
8305 | } |
8306 | if (_PyObject_LookupAttr(obj, state->right, &tmp) < 0) { Branch (8306:13): [True: 0, False: 6.63k]
|
8307 | return 1; |
8308 | } |
8309 | if (tmp == NULL) { Branch (8309:13): [True: 0, False: 6.63k]
|
8310 | PyErr_SetString(PyExc_TypeError, "required field \"right\" missing from BinOp"); |
8311 | return 1; |
8312 | } |
8313 | else { |
8314 | int res; |
8315 | if (_Py_EnterRecursiveCall(" while traversing 'BinOp' node")) { Branch (8315:17): [True: 0, False: 6.63k]
|
8316 | goto failed; |
8317 | } |
8318 | res = obj2ast_expr(state, tmp, &right, arena); |
8319 | _Py_LeaveRecursiveCall(); |
8320 | if (res != 0) goto failed0 ; Branch (8320:17): [True: 0, False: 6.63k]
|
8321 | Py_CLEAR(tmp); |
8322 | } |
8323 | *out = _PyAST_BinOp(left, op, right, lineno, col_offset, end_lineno, |
8324 | end_col_offset, arena); |
8325 | if (*out == NULL) goto failed0 ; Branch (8325:13): [True: 0, False: 6.63k]
|
8326 | return 0; |
8327 | } |
8328 | tp = state->UnaryOp_type; |
8329 | isinstance = PyObject_IsInstance(obj, tp); |
8330 | if (isinstance == -1) { Branch (8330:9): [True: 0, False: 258k]
|
8331 | return 1; |
8332 | } |
8333 | if (isinstance) { Branch (8333:9): [True: 3.08k, False: 255k]
|
8334 | unaryop_ty op; |
8335 | expr_ty operand; |
8336 | |
8337 | if (_PyObject_LookupAttr(obj, state->op, &tmp) < 0) { Branch (8337:13): [True: 0, False: 3.08k]
|
8338 | return 1; |
8339 | } |
8340 | if (tmp == NULL) { Branch (8340:13): [True: 0, False: 3.08k]
|
8341 | PyErr_SetString(PyExc_TypeError, "required field \"op\" missing from UnaryOp"); |
8342 | return 1; |
8343 | } |
8344 | else { |
8345 | int res; |
8346 | if (_Py_EnterRecursiveCall(" while traversing 'UnaryOp' node")) { Branch (8346:17): [True: 0, False: 3.08k]
|
8347 | goto failed; |
8348 | } |
8349 | res = obj2ast_unaryop(state, tmp, &op, arena); |
8350 | _Py_LeaveRecursiveCall(); |
8351 | if (res != 0) goto failed0 ; Branch (8351:17): [True: 0, False: 3.08k]
|
8352 | Py_CLEAR(tmp); |
8353 | } |
8354 | if (_PyObject_LookupAttr(obj, state->operand, &tmp) < 0) { Branch (8354:13): [True: 0, False: 3.08k]
|
8355 | return 1; |
8356 | } |
8357 | if (tmp == NULL) { Branch (8357:13): [True: 0, False: 3.08k]
|
8358 | PyErr_SetString(PyExc_TypeError, "required field \"operand\" missing from UnaryOp"); |
8359 | return 1; |
8360 | } |
8361 | else { |
8362 | int res; |
8363 | if (_Py_EnterRecursiveCall(" while traversing 'UnaryOp' node")) { Branch (8363:17): [True: 0, False: 3.08k]
|
8364 | goto failed; |
8365 | } |
8366 | res = obj2ast_expr(state, tmp, &operand, arena); |
8367 | _Py_LeaveRecursiveCall(); |
8368 | if (res != 0) goto failed84 ; Branch (8368:17): [True: 84, False: 3.00k]
|
8369 | Py_CLEAR(tmp); |
8370 | } |
8371 | *out = _PyAST_UnaryOp(op, operand, lineno, col_offset, end_lineno, |
8372 | end_col_offset, arena); |
8373 | if (*out == NULL) goto failed0 ; Branch (8373:13): [True: 0, False: 3.00k]
|
8374 | return 0; |
8375 | } |
8376 | tp = state->Lambda_type; |
8377 | isinstance = PyObject_IsInstance(obj, tp); |
8378 | if (isinstance == -1) { Branch (8378:9): [True: 0, False: 255k]
|
8379 | return 1; |
8380 | } |
8381 | if (isinstance) { Branch (8381:9): [True: 168, False: 255k]
|
8382 | arguments_ty args; |
8383 | expr_ty body; |
8384 | |
8385 | if (_PyObject_LookupAttr(obj, state->args, &tmp) < 0) { Branch (8385:13): [True: 0, False: 168]
|
8386 | return 1; |
8387 | } |
8388 | if (tmp == NULL) { Branch (8388:13): [True: 0, False: 168]
|
8389 | PyErr_SetString(PyExc_TypeError, "required field \"args\" missing from Lambda"); |
8390 | return 1; |
8391 | } |
8392 | else { |
8393 | int res; |
8394 | if (_Py_EnterRecursiveCall(" while traversing 'Lambda' node")) { Branch (8394:17): [True: 0, False: 168]
|
8395 | goto failed; |
8396 | } |
8397 | res = obj2ast_arguments(state, tmp, &args, arena); |
8398 | _Py_LeaveRecursiveCall(); |
8399 | if (res != 0) goto failed0 ; Branch (8399:17): [True: 0, False: 168]
|
8400 | Py_CLEAR(tmp); |
8401 | } |
8402 | if (_PyObject_LookupAttr(obj, state->body, &tmp) < 0) { Branch (8402:13): [True: 0, False: 168]
|
8403 | return 1; |
8404 | } |
8405 | if (tmp == NULL) { Branch (8405:13): [True: 0, False: 168]
|
8406 | PyErr_SetString(PyExc_TypeError, "required field \"body\" missing from Lambda"); |
8407 | return 1; |
8408 | } |
8409 | else { |
8410 | int res; |
8411 | if (_Py_EnterRecursiveCall(" while traversing 'Lambda' node")) { Branch (8411:17): [True: 0, False: 168]
|
8412 | goto failed; |
8413 | } |
8414 | res = obj2ast_expr(state, tmp, &body, arena); |
8415 | _Py_LeaveRecursiveCall(); |
8416 | if (res != 0) goto failed0 ; Branch (8416:17): [True: 0, False: 168]
|
8417 | Py_CLEAR(tmp); |
8418 | } |
8419 | *out = _PyAST_Lambda(args, body, lineno, col_offset, end_lineno, |
8420 | end_col_offset, arena); |
8421 | if (*out == NULL) goto failed0 ; Branch (8421:13): [True: 0, False: 168]
|
8422 | return 0; |
8423 | } |
8424 | tp = state->IfExp_type; |
8425 | isinstance = PyObject_IsInstance(obj, tp); |
8426 | if (isinstance == -1) { Branch (8426:9): [True: 0, False: 255k]
|
8427 | return 1; |
8428 | } |
8429 | if (isinstance) { Branch (8429:9): [True: 238, False: 255k]
|
8430 | expr_ty test; |
8431 | expr_ty body; |
8432 | expr_ty orelse; |
8433 | |
8434 | if (_PyObject_LookupAttr(obj, state->test, &tmp) < 0) { Branch (8434:13): [True: 0, False: 238]
|
8435 | return 1; |
8436 | } |
8437 | if (tmp == NULL) { Branch (8437:13): [True: 0, False: 238]
|
8438 | PyErr_SetString(PyExc_TypeError, "required field \"test\" missing from IfExp"); |
8439 | return 1; |
8440 | } |
8441 | else { |
8442 | int res; |
8443 | if (_Py_EnterRecursiveCall(" while traversing 'IfExp' node")) { Branch (8443:17): [True: 0, False: 238]
|
8444 | goto failed; |
8445 | } |
8446 | res = obj2ast_expr(state, tmp, &test, arena); |
8447 | _Py_LeaveRecursiveCall(); |
8448 | if (res != 0) goto failed0 ; Branch (8448:17): [True: 0, False: 238]
|
8449 | Py_CLEAR(tmp); |
8450 | } |
8451 | if (_PyObject_LookupAttr(obj, state->body, &tmp) < 0) { Branch (8451:13): [True: 0, False: 238]
|
8452 | return 1; |
8453 | } |
8454 | if (tmp == NULL) { Branch (8454:13): [True: 0, False: 238]
|
8455 | PyErr_SetString(PyExc_TypeError, "required field \"body\" missing from IfExp"); |
8456 | return 1; |
8457 | } |
8458 | else { |
8459 | int res; |
8460 | if (_Py_EnterRecursiveCall(" while traversing 'IfExp' node")) { Branch (8460:17): [True: 0, False: 238]
|
8461 | goto failed; |
8462 | } |
8463 | res = obj2ast_expr(state, tmp, &body, arena); |
8464 | _Py_LeaveRecursiveCall(); |
8465 | if (res != 0) goto failed0 ; Branch (8465:17): [True: 0, False: 238]
|
8466 | Py_CLEAR(tmp); |
8467 | } |
8468 | if (_PyObject_LookupAttr(obj, state->orelse, &tmp) < 0) { Branch (8468:13): [True: 0, False: 238]
|
8469 | return 1; |
8470 | } |
8471 | if (tmp == NULL) { Branch (8471:13): [True: 0, False: 238]
|
8472 | PyErr_SetString(PyExc_TypeError, "required field \"orelse\" missing from IfExp"); |
8473 | return 1; |
8474 | } |
8475 | else { |
8476 | int res; |
8477 | if (_Py_EnterRecursiveCall(" while traversing 'IfExp' node")) { Branch (8477:17): [True: 0, False: 238]
|
8478 | goto failed; |
8479 | } |
8480 | res = obj2ast_expr(state, tmp, &orelse, arena); |
8481 | _Py_LeaveRecursiveCall(); |
8482 | if (res != 0) goto failed0 ; Branch (8482:17): [True: 0, False: 238]
|
8483 | Py_CLEAR(tmp); |
8484 | } |
8485 | *out = _PyAST_IfExp(test, body, orelse, lineno, col_offset, end_lineno, |
8486 | end_col_offset, arena); |
8487 | if (*out == NULL) goto failed0 ; Branch (8487:13): [True: 0, False: 238]
|
8488 | return 0; |
8489 | } |
8490 | tp = state->Dict_type; |
8491 | isinstance = PyObject_IsInstance(obj, tp); |
8492 | if (isinstance == -1) { Branch (8492:9): [True: 0, False: 255k]
|
8493 | return 1; |
8494 | } |
8495 | if (isinstance) { Branch (8495:9): [True: 625, False: 254k]
|
8496 | asdl_expr_seq* keys; |
8497 | asdl_expr_seq* values; |
8498 | |
8499 | if (_PyObject_LookupAttr(obj, state->keys, &tmp) < 0) { Branch (8499:13): [True: 0, False: 625]
|
8500 | return 1; |
8501 | } |
8502 | if (tmp == NULL) { Branch (8502:13): [True: 0, False: 625]
|
8503 | PyErr_SetString(PyExc_TypeError, "required field \"keys\" missing from Dict"); |
8504 | return 1; |
8505 | } |
8506 | else { |
8507 | int res; |
8508 | Py_ssize_t len; |
8509 | Py_ssize_t i; |
8510 | if (!PyList_Check(tmp)) { Branch (8510:17): [True: 0, False: 625]
|
8511 | PyErr_Format(PyExc_TypeError, "Dict field \"keys\" must be a list, not a %.200s", _PyType_Name(Py_TYPE(tmp))); |
8512 | goto failed; |
8513 | } |
8514 | len = PyList_GET_SIZE(tmp); |
8515 | keys = _Py_asdl_expr_seq_new(len, arena); |
8516 | if (keys == NULL) goto failed0 ; Branch (8516:17): [True: 0, False: 625]
|
8517 | for (i = 0; 625 i < len; i++2.72k ) { Branch (8517:25): [True: 2.72k, False: 625]
|
8518 | expr_ty val; |
8519 | PyObject *tmp2 = PyList_GET_ITEM(tmp, i); |
8520 | Py_INCREF(tmp2); |
8521 | if (_Py_EnterRecursiveCall(" while traversing 'Dict' node")) { Branch (8521:21): [True: 0, False: 2.72k]
|
8522 | goto failed; |
8523 | } |
8524 | res = obj2ast_expr(state, tmp2, &val, arena); |
8525 | _Py_LeaveRecursiveCall(); |
8526 | Py_DECREF(tmp2); |
8527 | if (res != 0) goto failed0 ; Branch (8527:21): [True: 0, False: 2.72k]
|
8528 | if (len != PyList_GET_SIZE(tmp)) { Branch (8528:21): [True: 0, False: 2.72k]
|
8529 | PyErr_SetString(PyExc_RuntimeError, "Dict field \"keys\" changed size during iteration"); |
8530 | goto failed; |
8531 | } |
8532 | asdl_seq_SET(keys, i, val); |
8533 | } |
8534 | Py_CLEAR(tmp); |
8535 | } |
8536 | if (_PyObject_LookupAttr(obj, state->values, &tmp) < 0) { Branch (8536:13): [True: 0, False: 625]
|
8537 | return 1; |
8538 | } |
8539 | if (tmp == NULL) { Branch (8539:13): [True: 0, False: 625]
|
8540 | PyErr_SetString(PyExc_TypeError, "required field \"values\" missing from Dict"); |
8541 | return 1; |
8542 | } |
8543 | else { |
8544 | int res; |
8545 | Py_ssize_t len; |
8546 | Py_ssize_t i; |
8547 | if (!PyList_Check(tmp)) { Branch (8547:17): [True: 0, False: 625]
|
8548 | PyErr_Format(PyExc_TypeError, "Dict field \"values\" must be a list, not a %.200s", _PyType_Name(Py_TYPE(tmp))); |
8549 | goto failed; |
8550 | } |
8551 | len = PyList_GET_SIZE(tmp); |
8552 | values = _Py_asdl_expr_seq_new(len, arena); |
8553 | if (values == NULL) goto failed0 ; Branch (8553:17): [True: 0, False: 625]
|
8554 | for (i = 0; 625 i < len; i++2.72k ) { Branch (8554:25): [True: 2.72k, False: 625]
|
8555 | expr_ty val; |
8556 | PyObject *tmp2 = PyList_GET_ITEM(tmp, i); |
8557 | Py_INCREF(tmp2); |
8558 | if (_Py_EnterRecursiveCall(" while traversing 'Dict' node")) { Branch (8558:21): [True: 0, False: 2.72k]
|
8559 | goto failed; |
8560 | } |
8561 | res = obj2ast_expr(state, tmp2, &val, arena); |
8562 | _Py_LeaveRecursiveCall(); |
8563 | Py_DECREF(tmp2); |
8564 | if (res != 0) goto failed0 ; Branch (8564:21): [True: 0, False: 2.72k]
|
8565 | if (len != PyList_GET_SIZE(tmp)) { Branch (8565:21): [True: 0, False: 2.72k]
|
8566 | PyErr_SetString(PyExc_RuntimeError, "Dict field \"values\" changed size during iteration"); |
8567 | goto failed; |
8568 | } |
8569 | asdl_seq_SET(values, i, val); |
8570 | } |
8571 | Py_CLEAR(tmp); |
8572 | } |
8573 | *out = _PyAST_Dict(keys, values, lineno, col_offset, end_lineno, |
8574 | end_col_offset, arena); |
8575 | if (*out == NULL) goto failed0 ; Branch (8575:13): [True: 0, False: 625]
|
8576 | return 0; |
8577 | } |
8578 | tp = state->Set_type; |
8579 | isinstance = PyObject_IsInstance(obj, tp); |
8580 | if (isinstance == -1) { Branch (8580:9): [True: 0, False: 254k]
|
8581 | return 1; |
8582 | } |
8583 | if (isinstance) { Branch (8583:9): [True: 114, False: 254k]
|
8584 | asdl_expr_seq* elts; |
8585 | |
8586 | if (_PyObject_LookupAttr(obj, state->elts, &tmp) < 0) { Branch (8586:13): [True: 0, False: 114]
|
8587 | return 1; |
8588 | } |
8589 | if (tmp == NULL) { Branch (8589:13): [True: 0, False: 114]
|
8590 | PyErr_SetString(PyExc_TypeError, "required field \"elts\" missing from Set"); |
8591 | return 1; |
8592 | } |
8593 | else { |
8594 | int res; |
8595 | Py_ssize_t len; |
8596 | Py_ssize_t i; |
8597 | if (!PyList_Check(tmp)) { Branch (8597:17): [True: 0, False: 114]
|
8598 | PyErr_Format(PyExc_TypeError, "Set field \"elts\" must be a list, not a %.200s", _PyType_Name(Py_TYPE(tmp))); |
8599 | goto failed; |
8600 | } |
8601 | len = PyList_GET_SIZE(tmp); |
8602 | elts = _Py_asdl_expr_seq_new(len, arena); |
8603 | if (elts == NULL) goto failed0 ; Branch (8603:17): [True: 0, False: 114]
|
8604 | for (i = 0; 114 i < len; i++297 ) { Branch (8604:25): [True: 297, False: 114]
|
8605 | expr_ty val; |
8606 | PyObject *tmp2 = PyList_GET_ITEM(tmp, i); |
8607 | Py_INCREF(tmp2); |
8608 | if (_Py_EnterRecursiveCall(" while traversing 'Set' node")) { Branch (8608:21): [True: 0, False: 297]
|
8609 | goto failed; |
8610 | } |
8611 | res = obj2ast_expr(state, tmp2, &val, arena); |
8612 | _Py_LeaveRecursiveCall(); |
8613 | Py_DECREF(tmp2); |
8614 | if (res != 0) goto failed0 ; Branch (8614:21): [True: 0, False: 297]
|
8615 | if (len != PyList_GET_SIZE(tmp)) { Branch (8615:21): [True: 0, False: 297]
|
8616 | PyErr_SetString(PyExc_RuntimeError, "Set field \"elts\" changed size during iteration"); |
8617 | goto failed; |
8618 | } |
8619 | asdl_seq_SET(elts, i, val); |
8620 | } |
8621 | Py_CLEAR(tmp); |
8622 | } |
8623 | *out = _PyAST_Set(elts, lineno, col_offset, end_lineno, end_col_offset, |
8624 | arena); |
8625 | if (*out == NULL) goto failed0 ; Branch (8625:13): [True: 0, False: 114]
|
8626 | return 0; |
8627 | } |
8628 | tp = state->ListComp_type; |
8629 | isinstance = PyObject_IsInstance(obj, tp); |
8630 | if (isinstance == -1) { Branch (8630:9): [True: 0, False: 254k]
|
8631 | return 1; |
8632 | } |
8633 | if (isinstance) { Branch (8633:9): [True: 320, False: 254k]
|
8634 | expr_ty elt; |
8635 | asdl_comprehension_seq* generators; |
8636 | |
8637 | if (_PyObject_LookupAttr(obj, state->elt, &tmp) < 0) { Branch (8637:13): [True: 0, False: 320]
|
8638 | return 1; |
8639 | } |
8640 | if (tmp == NULL) { Branch (8640:13): [True: 0, False: 320]
|
8641 | PyErr_SetString(PyExc_TypeError, "required field \"elt\" missing from ListComp"); |
8642 | return 1; |
8643 | } |
8644 | else { |
8645 | int res; |
8646 | if (_Py_EnterRecursiveCall(" while traversing 'ListComp' node")) { Branch (8646:17): [True: 0, False: 320]
|
8647 | goto failed; |
8648 | } |
8649 | res = obj2ast_expr(state, tmp, &elt, arena); |
8650 | _Py_LeaveRecursiveCall(); |
8651 | if (res != 0) goto failed0 ; Branch (8651:17): [True: 0, False: 320]
|
8652 | Py_CLEAR(tmp); |
8653 | } |
8654 | if (_PyObject_LookupAttr(obj, state->generators, &tmp) < 0) { Branch (8654:13): [True: 0, False: 320]
|
8655 | return 1; |
8656 | } |
8657 | if (tmp == NULL) { Branch (8657:13): [True: 0, False: 320]
|
8658 | PyErr_SetString(PyExc_TypeError, "required field \"generators\" missing from ListComp"); |
8659 | return 1; |
8660 | } |
8661 | else { |
8662 | int res; |
8663 | Py_ssize_t len; |
8664 | Py_ssize_t i; |
8665 | if (!PyList_Check(tmp)) { Branch (8665:17): [True: 0, False: 320]
|
8666 | PyErr_Format(PyExc_TypeError, "ListComp field \"generators\" must be a list, not a %.200s", _PyType_Name(Py_TYPE(tmp))); |
8667 | goto failed; |
8668 | } |
8669 | len = PyList_GET_SIZE(tmp); |
8670 | generators = _Py_asdl_comprehension_seq_new(len, arena); |
8671 | if (generators == NULL) goto failed0 ; Branch (8671:17): [True: 0, False: 320]
|
8672 | for (i = 0; 320 i < len; i++336 ) { Branch (8672:25): [True: 336, False: 320]
|
8673 | comprehension_ty val; |
8674 | PyObject *tmp2 = PyList_GET_ITEM(tmp, i); |
8675 | Py_INCREF(tmp2); |
8676 | if (_Py_EnterRecursiveCall(" while traversing 'ListComp' node")) { Branch (8676:21): [True: 0, False: 336]
|
8677 | goto failed; |
8678 | } |
8679 | res = obj2ast_comprehension(state, tmp2, &val, arena); |
8680 | _Py_LeaveRecursiveCall(); |
8681 | Py_DECREF(tmp2); |
8682 | if (res != 0) goto failed0 ; Branch (8682:21): [True: 0, False: 336]
|
8683 | if (len != PyList_GET_SIZE(tmp)) { Branch (8683:21): [True: 0, False: 336]
|
8684 | PyErr_SetString(PyExc_RuntimeError, "ListComp field \"generators\" changed size during iteration"); |
8685 | goto failed; |
8686 | } |
8687 | asdl_seq_SET(generators, i, val); |
8688 | } |
8689 | Py_CLEAR(tmp); |
8690 | } |
8691 | *out = _PyAST_ListComp(elt, generators, lineno, col_offset, end_lineno, |
8692 | end_col_offset, arena); |
8693 | if (*out == NULL) goto failed0 ; Branch (8693:13): [True: 0, False: 320]
|
8694 | return 0; |
8695 | } |
8696 | tp = state->SetComp_type; |
8697 | isinstance = PyObject_IsInstance(obj, tp); |
8698 | if (isinstance == -1) { Branch (8698:9): [True: 0, False: 254k]
|
8699 | return 1; |
8700 | } |
8701 | if (isinstance) { Branch (8701:9): [True: 23, False: 254k]
|
8702 | expr_ty elt; |
8703 | asdl_comprehension_seq* generators; |
8704 | |
8705 | if (_PyObject_LookupAttr(obj, state->elt, &tmp) < 0) { Branch (8705:13): [True: 0, False: 23]
|
8706 | return 1; |
8707 | } |
8708 | if (tmp == NULL) { Branch (8708:13): [True: 0, False: 23]
|
8709 | PyErr_SetString(PyExc_TypeError, "required field \"elt\" missing from SetComp"); |
8710 | return 1; |
8711 | } |
8712 | else { |
8713 | int res; |
8714 | if (_Py_EnterRecursiveCall(" while traversing 'SetComp' node")) { Branch (8714:17): [True: 0, False: 23]
|
8715 | goto failed; |
8716 | } |
8717 | res = obj2ast_expr(state, tmp, &elt, arena); |
8718 | _Py_LeaveRecursiveCall(); |
8719 | if (res != 0) goto failed0 ; Branch (8719:17): [True: 0, False: 23]
|
8720 | Py_CLEAR(tmp); |
8721 | } |
8722 | if (_PyObject_LookupAttr(obj, state->generators, &tmp) < 0) { Branch (8722:13): [True: 0, False: 23]
|
8723 | return 1; |
8724 | } |
8725 | if (tmp == NULL) { Branch (8725:13): [True: 0, False: 23]
|
8726 | PyErr_SetString(PyExc_TypeError, "required field \"generators\" missing from SetComp"); |
8727 | return 1; |
8728 | } |
8729 | else { |
8730 | int res; |
8731 | Py_ssize_t len; |
8732 | Py_ssize_t i; |
8733 | if (!PyList_Check(tmp)) { Branch (8733:17): [True: 0, False: 23]
|
8734 | PyErr_Format(PyExc_TypeError, "SetComp field \"generators\" must be a list, not a %.200s", _PyType_Name(Py_TYPE(tmp))); |
8735 | goto failed; |
8736 | } |
8737 | len = PyList_GET_SIZE(tmp); |
8738 | generators = _Py_asdl_comprehension_seq_new(len, arena); |
8739 | if (generators == NULL) goto failed0 ; Branch (8739:17): [True: 0, False: 23]
|
8740 | for (i = 0; 23 i < len; i++22 ) { Branch (8740:25): [True: 22, False: 23]
|
8741 | comprehension_ty val; |
8742 | PyObject *tmp2 = PyList_GET_ITEM(tmp, i); |
8743 | Py_INCREF(tmp2); |
8744 | if (_Py_EnterRecursiveCall(" while traversing 'SetComp' node")) { Branch (8744:21): [True: 0, False: 22]
|
8745 | goto failed; |
8746 | } |
8747 | res = obj2ast_comprehension(state, tmp2, &val, arena); |
8748 | _Py_LeaveRecursiveCall(); |
8749 | Py_DECREF(tmp2); |
8750 | if (res != 0) goto failed0 ; Branch (8750:21): [True: 0, False: 22]
|
8751 | if (len != PyList_GET_SIZE(tmp)) { Branch (8751:21): [True: 0, False: 22]
|
8752 | PyErr_SetString(PyExc_RuntimeError, "SetComp field \"generators\" changed size during iteration"); |
8753 | goto failed; |
8754 | } |
8755 | asdl_seq_SET(generators, i, val); |
8756 | } |
8757 | Py_CLEAR(tmp); |
8758 | } |
8759 | *out = _PyAST_SetComp(elt, generators, lineno, col_offset, end_lineno, |
8760 | end_col_offset, arena); |
8761 | if (*out == NULL) goto failed0 ; Branch (8761:13): [True: 0, False: 23]
|
8762 | return 0; |
8763 | } |
8764 | tp = state->DictComp_type; |
8765 | isinstance = PyObject_IsInstance(obj, tp); |
8766 | if (isinstance == -1) { Branch (8766:9): [True: 0, False: 254k]
|
8767 | return 1; |
8768 | } |
8769 | if (isinstance) { Branch (8769:9): [True: 37, False: 254k]
|
8770 | expr_ty key; |
8771 | expr_ty value; |
8772 | asdl_comprehension_seq* generators; |
8773 | |
8774 | if (_PyObject_LookupAttr(obj, state->key, &tmp) < 0) { Branch (8774:13): [True: 0, False: 37]
|
8775 | return 1; |
8776 | } |
8777 | if (tmp == NULL) { Branch (8777:13): [True: 0, False: 37]
|
8778 | PyErr_SetString(PyExc_TypeError, "required field \"key\" missing from DictComp"); |
8779 | return 1; |
8780 | } |
8781 | else { |
8782 | int res; |
8783 | if (_Py_EnterRecursiveCall(" while traversing 'DictComp' node")) { Branch (8783:17): [True: 0, False: 37]
|
8784 | goto failed; |
8785 | } |
8786 | res = obj2ast_expr(state, tmp, &key, arena); |
8787 | _Py_LeaveRecursiveCall(); |
8788 | if (res != 0) goto failed0 ; Branch (8788:17): [True: 0, False: 37]
|
8789 | Py_CLEAR(tmp); |
8790 | } |
8791 | if (_PyObject_LookupAttr(obj, state->value, &tmp) < 0) { Branch (8791:13): [True: 0, False: 37]
|
8792 | return 1; |
8793 | } |
8794 | if (tmp == NULL) { Branch (8794:13): [True: 0, False: 37]
|
8795 | PyErr_SetString(PyExc_TypeError, "required field \"value\" missing from DictComp"); |
8796 | return 1; |
8797 | } |
8798 | else { |
8799 | int res; |
8800 | if (_Py_EnterRecursiveCall(" while traversing 'DictComp' node")) { Branch (8800:17): [True: 0, False: 37]
|
8801 | goto failed; |
8802 | } |
8803 | res = obj2ast_expr(state, tmp, &value, arena); |
8804 | _Py_LeaveRecursiveCall(); |
8805 | if (res != 0) goto failed0 ; Branch (8805:17): [True: 0, False: 37]
|
8806 | Py_CLEAR(tmp); |
8807 | } |
8808 | if (_PyObject_LookupAttr(obj, state->generators, &tmp) < 0) { Branch (8808:13): [True: 0, False: 37]
|
8809 | return 1; |
8810 | } |
8811 | if (tmp == NULL) { Branch (8811:13): [True: 0, False: 37]
|
8812 | PyErr_SetString(PyExc_TypeError, "required field \"generators\" missing from DictComp"); |
8813 | return 1; |
8814 | } |
8815 | else { |
8816 | int res; |
8817 | Py_ssize_t len; |
8818 | Py_ssize_t i; |
8819 | if (!PyList_Check(tmp)) { Branch (8819:17): [True: 0, False: 37]
|
8820 | PyErr_Format(PyExc_TypeError, "DictComp field \"generators\" must be a list, not a %.200s", _PyType_Name(Py_TYPE(tmp))); |
8821 | goto failed; |
8822 | } |
8823 | len = PyList_GET_SIZE(tmp); |
8824 | generators = _Py_asdl_comprehension_seq_new(len, arena); |
8825 | if (generators == NULL) goto failed0 ; Branch (8825:17): [True: 0, False: 37]
|
8826 | for (i = 0; 37 i < len; i++40 ) { Branch (8826:25): [True: 40, False: 37]
|
8827 | comprehension_ty val; |
8828 | PyObject *tmp2 = PyList_GET_ITEM(tmp, i); |
8829 | Py_INCREF(tmp2); |
8830 | if (_Py_EnterRecursiveCall(" while traversing 'DictComp' node")) { Branch (8830:21): [True: 0, False: 40]
|
8831 | goto failed; |
8832 | } |
8833 | res = obj2ast_comprehension(state, tmp2, &val, arena); |
8834 | _Py_LeaveRecursiveCall(); |
8835 | Py_DECREF(tmp2); |
8836 | if (res != 0) goto failed0 ; Branch (8836:21): [True: 0, False: 40]
|
8837 | if (len != PyList_GET_SIZE(tmp)) { Branch (8837:21): [True: 0, False: 40]
|
8838 | PyErr_SetString(PyExc_RuntimeError, "DictComp field \"generators\" changed size during iteration"); |
8839 | goto failed; |
8840 | } |
8841 | asdl_seq_SET(generators, i, val); |
8842 | } |
8843 | Py_CLEAR(tmp); |
8844 | } |
8845 | *out = _PyAST_DictComp(key, value, generators, lineno, col_offset, |
8846 | end_lineno, end_col_offset, arena); |
8847 | if (*out == NULL) goto failed0 ; Branch (8847:13): [True: 0, False: 37]
|
8848 | return 0; |
8849 | } |
8850 | tp = state->GeneratorExp_type; |
8851 | isinstance = PyObject_IsInstance(obj, tp); |
8852 | if (isinstance == -1) { Branch (8852:9): [True: 0, False: 254k]
|
8853 | return 1; |
8854 | } |
8855 | if (isinstance) { Branch (8855:9): [True: 232, False: 253k]
|
8856 | expr_ty elt; |
8857 | asdl_comprehension_seq* generators; |
8858 | |
8859 | if (_PyObject_LookupAttr(obj, state->elt, &tmp) < 0) { Branch (8859:13): [True: 0, False: 232]
|
8860 | return 1; |
8861 | } |
8862 | if (tmp == NULL) { Branch (8862:13): [True: 0, False: 232]
|
8863 | PyErr_SetString(PyExc_TypeError, "required field \"elt\" missing from GeneratorExp"); |
8864 | return 1; |
8865 | } |
8866 | else { |
8867 | int res; |
8868 | if (_Py_EnterRecursiveCall(" while traversing 'GeneratorExp' node")) { Branch (8868:17): [True: 0, False: 232]
|
8869 | goto failed; |
8870 | } |
8871 | res = obj2ast_expr(state, tmp, &elt, arena); |
8872 | _Py_LeaveRecursiveCall(); |
8873 | if (res != 0) goto failed0 ; Branch (8873:17): [True: 0, False: 232]
|
8874 | Py_CLEAR(tmp); |
8875 | } |
8876 | if (_PyObject_LookupAttr(obj, state->generators, &tmp) < 0) { Branch (8876:13): [True: 0, False: 232]
|
8877 | return 1; |
8878 | } |
8879 | if (tmp == NULL) { Branch (8879:13): [True: 0, False: 232]
|
8880 | PyErr_SetString(PyExc_TypeError, "required field \"generators\" missing from GeneratorExp"); |
8881 | return 1; |
8882 | } |
8883 | else { |
8884 | int res; |
8885 | Py_ssize_t len; |
8886 | Py_ssize_t i; |
8887 | if (!PyList_Check(tmp)) { Branch (8887:17): [True: 0, False: 232]
|
8888 | PyErr_Format(PyExc_TypeError, "GeneratorExp field \"generators\" must be a list, not a %.200s", _PyType_Name(Py_TYPE(tmp))); |
8889 | goto failed; |
8890 | } |
8891 | len = PyList_GET_SIZE(tmp); |
8892 | generators = _Py_asdl_comprehension_seq_new(len, arena); |
8893 | if (generators == NULL) goto failed0 ; Branch (8893:17): [True: 0, False: 232]
|
8894 | for (i = 0; 232 i < len; i++237 ) { Branch (8894:25): [True: 237, False: 232]
|
8895 | comprehension_ty val; |
8896 | PyObject *tmp2 = PyList_GET_ITEM(tmp, i); |
8897 | Py_INCREF(tmp2); |
8898 | if (_Py_EnterRecursiveCall(" while traversing 'GeneratorExp' node")) { Branch (8898:21): [True: 0, False: 237]
|
8899 | goto failed; |
8900 | } |
8901 | res = obj2ast_comprehension(state, tmp2, &val, arena); |
8902 | _Py_LeaveRecursiveCall(); |
8903 | Py_DECREF(tmp2); |
8904 | if (res != 0) goto failed0 ; Branch (8904:21): [True: 0, False: 237]
|
8905 | if (len != PyList_GET_SIZE(tmp)) { Branch (8905:21): [True: 0, False: 237]
|
8906 | PyErr_SetString(PyExc_RuntimeError, "GeneratorExp field \"generators\" changed size during iteration"); |
8907 | goto failed; |
8908 | } |
8909 | asdl_seq_SET(generators, i, val); |
8910 | } |
8911 | Py_CLEAR(tmp); |
8912 | } |
8913 | *out = _PyAST_GeneratorExp(elt, generators, lineno, col_offset, |
8914 | end_lineno, end_col_offset, arena); |
8915 | if (*out == NULL) goto failed0 ; Branch (8915:13): [True: 0, False: 232]
|
8916 | return 0; |
8917 | } |
8918 | tp = state->Await_type; |
8919 | isinstance = PyObject_IsInstance(obj, tp); |
8920 | if (isinstance == -1) { Branch (8920:9): [True: 0, False: 253k]
|
8921 | return 1; |
8922 | } |
8923 | if (isinstance) { Branch (8923:9): [True: 14, False: 253k]
|
8924 | expr_ty value; |
8925 | |
8926 | if (_PyObject_LookupAttr(obj, state->value, &tmp) < 0) { Branch (8926:13): [True: 0, False: 14]
|
8927 | return 1; |
8928 | } |
8929 | if (tmp == NULL) { Branch (8929:13): [True: 0, False: 14]
|
8930 | PyErr_SetString(PyExc_TypeError, "required field \"value\" missing from Await"); |
8931 | return 1; |
8932 | } |
8933 | else { |
8934 | int res; |
8935 | if (_Py_EnterRecursiveCall(" while traversing 'Await' node")) { Branch (8935:17): [True: 0, False: 14]
|
8936 | goto failed; |
8937 | } |
8938 | res = obj2ast_expr(state, tmp, &value, arena); |
8939 | _Py_LeaveRecursiveCall(); |
8940 | if (res != 0) goto failed0 ; Branch (8940:17): [True: 0, False: 14]
|
8941 | Py_CLEAR(tmp); |
8942 | } |
8943 | *out = _PyAST_Await(value, lineno, col_offset, end_lineno, |
8944 | end_col_offset, arena); |
8945 | if (*out == NULL) goto failed0 ; Branch (8945:13): [True: 0, False: 14]
|
8946 | return 0; |
8947 | } |
8948 | tp = state->Yield_type; |
8949 | isinstance = PyObject_IsInstance(obj, tp); |
8950 | if (isinstance == -1) { Branch (8950:9): [True: 0, False: 253k]
|
8951 | return 1; |
8952 | } |
8953 | if (isinstance) { Branch (8953:9): [True: 210, False: 253k]
|
8954 | expr_ty value; |
8955 | |
8956 | if (_PyObject_LookupAttr(obj, state->value, &tmp) < 0) { Branch (8956:13): [True: 0, False: 210]
|
8957 | return 1; |
8958 | } |
8959 | if (tmp == NULL || tmp == Py_None) { Branch (8959:13): [True: 0, False: 210]
Branch (8959:28): [True: 7, False: 203]
|
8960 | Py_CLEAR(tmp); |
8961 | value = NULL; |
8962 | } |
8963 | else { |
8964 | int res; |
8965 | if (_Py_EnterRecursiveCall(" while traversing 'Yield' node")) { Branch (8965:17): [True: 0, False: 203]
|
8966 | goto failed; |
8967 | } |
8968 | res = obj2ast_expr(state, tmp, &value, arena); |
8969 | _Py_LeaveRecursiveCall(); |
8970 | if (res != 0) goto failed0 ; Branch (8970:17): [True: 0, False: 203]
|
8971 | Py_CLEAR(tmp); |
8972 | } |
8973 | *out = _PyAST_Yield(value, lineno, col_offset, end_lineno, |
8974 | end_col_offset, arena); |
8975 | if (*out == NULL) goto failed0 ; Branch (8975:13): [True: 0, False: 210]
|
8976 | return 0; |
8977 | } |
8978 | tp = state->YieldFrom_type; |
8979 | isinstance = PyObject_IsInstance(obj, tp); |
8980 | if (isinstance == -1) { Branch (8980:9): [True: 0, False: 253k]
|
8981 | return 1; |
8982 | } |
8983 | if (isinstance) { Branch (8983:9): [True: 52, False: 253k]
|
8984 | expr_ty value; |
8985 | |
8986 | if (_PyObject_LookupAttr(obj, state->value, &tmp) < 0) { Branch (8986:13): [True: 0, False: 52]
|
8987 | return 1; |
8988 | } |
8989 | if (tmp == NULL) { Branch (8989:13): [True: 0, False: 52]
|
8990 | PyErr_SetString(PyExc_TypeError, "required field \"value\" missing from YieldFrom"); |
8991 | return 1; |
8992 | } |
8993 | else { |
8994 | int res; |
8995 | if (_Py_EnterRecursiveCall(" while traversing 'YieldFrom' node")) { Branch (8995:17): [True: 0, False: 52]
|
8996 | goto failed; |
8997 | } |
8998 | res = obj2ast_expr(state, tmp, &value, arena); |
8999 | _Py_LeaveRecursiveCall(); |
9000 | if (res != 0) goto failed0 ; Branch (9000:17): [True: 0, False: 52]
|
9001 | Py_CLEAR(tmp); |
9002 | } |
9003 | *out = _PyAST_YieldFrom(value, lineno, col_offset, end_lineno, |
9004 | end_col_offset, arena); |
9005 | if (*out == NULL) goto failed1 ; Branch (9005:13): [True: 1, False: 51]
|
9006 | return 0; |
9007 | } |
9008 | tp = state->Compare_type; |
9009 | isinstance = PyObject_IsInstance(obj, tp); |
9010 | if (isinstance == -1) { Branch (9010:9): [True: 0, False: 253k]
|
9011 | return 1; |
9012 | } |
9013 | if (isinstance) { Branch (9013:9): [True: 8.17k, False: 245k]
|
9014 | expr_ty left; |
9015 | asdl_int_seq* ops; |
9016 | asdl_expr_seq* comparators; |
9017 | |
9018 | if (_PyObject_LookupAttr(obj, state->left, &tmp) < 0) { Branch (9018:13): [True: 0, False: 8.17k]
|
9019 | return 1; |
9020 | } |
9021 | if (tmp == NULL) { Branch (9021:13): [True: 0, False: 8.17k]
|
9022 | PyErr_SetString(PyExc_TypeError, "required field \"left\" missing from Compare"); |
9023 | return 1; |
9024 | } |
9025 | else { |
9026 | int res; |
9027 | if (_Py_EnterRecursiveCall(" while traversing 'Compare' node")) { Branch (9027:17): [True: 0, False: 8.17k]
|
9028 | goto failed; |
9029 | } |
9030 | res = obj2ast_expr(state, tmp, &left, arena); |
9031 | _Py_LeaveRecursiveCall(); |
9032 | if (res != 0) goto failed0 ; Branch (9032:17): [True: 0, False: 8.17k]
|
9033 | Py_CLEAR(tmp); |
9034 | } |
9035 | if (_PyObject_LookupAttr(obj, state->ops, &tmp) < 0) { Branch (9035:13): [True: 0, False: 8.17k]
|
9036 | return 1; |
9037 | } |
9038 | if (tmp == NULL) { Branch (9038:13): [True: 0, False: 8.17k]
|
9039 | PyErr_SetString(PyExc_TypeError, "required field \"ops\" missing from Compare"); |
9040 | return 1; |
9041 | } |
9042 | else { |
9043 | int res; |
9044 | Py_ssize_t len; |
9045 | Py_ssize_t i; |
9046 | if (!PyList_Check(tmp)) { Branch (9046:17): [True: 0, False: 8.17k]
|
9047 | PyErr_Format(PyExc_TypeError, "Compare field \"ops\" must be a list, not a %.200s", _PyType_Name(Py_TYPE(tmp))); |
9048 | goto failed; |
9049 | } |
9050 | len = PyList_GET_SIZE(tmp); |
9051 | ops = _Py_asdl_int_seq_new(len, arena); |
9052 | if (ops == NULL) goto failed0 ; Branch (9052:17): [True: 0, False: 8.17k]
|
9053 | for (i = 0; 8.17k i < len; i++8.31k ) { Branch (9053:25): [True: 8.31k, False: 8.17k]
|
9054 | cmpop_ty val; |
9055 | PyObject *tmp2 = PyList_GET_ITEM(tmp, i); |
9056 | Py_INCREF(tmp2); |
9057 | if (_Py_EnterRecursiveCall(" while traversing 'Compare' node")) { Branch (9057:21): [True: 0, False: 8.31k]
|
9058 | goto failed; |
9059 | } |
9060 | res = obj2ast_cmpop(state, tmp2, &val, arena); |
9061 | _Py_LeaveRecursiveCall(); |
9062 | Py_DECREF(tmp2); |
9063 | if (res != 0) goto failed0 ; Branch (9063:21): [True: 0, False: 8.31k]
|
9064 | if (len != PyList_GET_SIZE(tmp)) { Branch (9064:21): [True: 0, False: 8.31k]
|
9065 | PyErr_SetString(PyExc_RuntimeError, "Compare field \"ops\" changed size during iteration"); |
9066 | goto failed; |
9067 | } |
9068 | asdl_seq_SET(ops, i, val); |
9069 | } |
9070 | Py_CLEAR(tmp); |
9071 | } |
9072 | if (_PyObject_LookupAttr(obj, state->comparators, &tmp) < 0) { Branch (9072:13): [True: 0, False: 8.17k]
|
9073 | return 1; |
9074 | } |
9075 | if (tmp == NULL) { Branch (9075:13): [True: 0, False: 8.17k]
|
9076 | PyErr_SetString(PyExc_TypeError, "required field \"comparators\" missing from Compare"); |
9077 | return 1; |
9078 | } |
9079 | else { |
9080 | int res; |
9081 | Py_ssize_t len; |
9082 | Py_ssize_t i; |
9083 | if (!PyList_Check(tmp)) { Branch (9083:17): [True: 0, False: 8.17k]
|
9084 | PyErr_Format(PyExc_TypeError, "Compare field \"comparators\" must be a list, not a %.200s", _PyType_Name(Py_TYPE(tmp))); |
9085 | goto failed; |
9086 | } |
9087 | len = PyList_GET_SIZE(tmp); |
9088 | comparators = _Py_asdl_expr_seq_new(len, arena); |
9089 | if (comparators == NULL) goto failed0 ; Branch (9089:17): [True: 0, False: 8.17k]
|
9090 | for (i = 0; 8.17k i < len; i++8.31k ) { Branch (9090:25): [True: 8.31k, False: 8.17k]
|
9091 | expr_ty val; |
9092 | PyObject *tmp2 = PyList_GET_ITEM(tmp, i); |
9093 | Py_INCREF(tmp2); |
9094 | if (_Py_EnterRecursiveCall(" while traversing 'Compare' node")) { Branch (9094:21): [True: 0, False: 8.31k]
|
9095 | goto failed; |
9096 | } |
9097 | res = obj2ast_expr(state, tmp2, &val, arena); |
9098 | _Py_LeaveRecursiveCall(); |
9099 | Py_DECREF(tmp2); |
9100 | if (res != 0) goto failed0 ; Branch (9100:21): [True: 0, False: 8.31k]
|
9101 | if (len != PyList_GET_SIZE(tmp)) { Branch (9101:21): [True: 0, False: 8.31k]
|
9102 | PyErr_SetString(PyExc_RuntimeError, "Compare field \"comparators\" changed size during iteration"); |
9103 | goto failed; |
9104 | } |
9105 | asdl_seq_SET(comparators, i, val); |
9106 | } |
9107 | Py_CLEAR(tmp); |
9108 | } |
9109 | *out = _PyAST_Compare(left, ops, comparators, lineno, col_offset, |
9110 | end_lineno, end_col_offset, arena); |
9111 | if (*out == NULL) goto failed0 ; Branch (9111:13): [True: 0, False: 8.17k]
|
9112 | return 0; |
9113 | } |
9114 | tp = state->Call_type; |
9115 | isinstance = PyObject_IsInstance(obj, tp); |
9116 | if (isinstance == -1) { Branch (9116:9): [True: 0, False: 245k]
|
9117 | return 1; |
9118 | } |
9119 | if (isinstance) { Branch (9119:9): [True: 30.1k, False: 215k]
|
9120 | expr_ty func; |
9121 | asdl_expr_seq* args; |
9122 | asdl_keyword_seq* keywords; |
9123 | |
9124 | if (_PyObject_LookupAttr(obj, state->func, &tmp) < 0) { Branch (9124:13): [True: 0, False: 30.1k]
|
9125 | return 1; |
9126 | } |
9127 | if (tmp == NULL) { Branch (9127:13): [True: 0, False: 30.1k]
|
9128 | PyErr_SetString(PyExc_TypeError, "required field \"func\" missing from Call"); |
9129 | return 1; |
9130 | } |
9131 | else { |
9132 | int res; |
9133 | if (_Py_EnterRecursiveCall(" while traversing 'Call' node")) { Branch (9133:17): [True: 0, False: 30.1k]
|
9134 | goto failed; |
9135 | } |
9136 | res = obj2ast_expr(state, tmp, &func, arena); |
9137 | _Py_LeaveRecursiveCall(); |
9138 | if (res != 0) goto failed0 ; Branch (9138:17): [True: 0, False: 30.1k]
|
9139 | Py_CLEAR(tmp); |
9140 | } |
9141 | if (_PyObject_LookupAttr(obj, state->args, &tmp) < 0) { Branch (9141:13): [True: 0, False: 30.1k]
|
9142 | return 1; |
9143 | } |
9144 | if (tmp == NULL) { Branch (9144:13): [True: 0, False: 30.1k]
|
9145 | PyErr_SetString(PyExc_TypeError, "required field \"args\" missing from Call"); |
9146 | return 1; |
9147 | } |
9148 | else { |
9149 | int res; |
9150 | Py_ssize_t len; |
9151 | Py_ssize_t i; |
9152 | if (!PyList_Check(tmp)) { Branch (9152:17): [True: 0, False: 30.1k]
|
9153 | PyErr_Format(PyExc_TypeError, "Call field \"args\" must be a list, not a %.200s", _PyType_Name(Py_TYPE(tmp))); |
9154 | goto failed; |
9155 | } |
9156 | len = PyList_GET_SIZE(tmp); |
9157 | args = _Py_asdl_expr_seq_new(len, arena); |
9158 | if (args == NULL) goto failed0 ; Branch (9158:17): [True: 0, False: 30.1k]
|
9159 | for (i = 0; 30.1k i < len; i++36.9k ) { Branch (9159:25): [True: 36.9k, False: 30.1k]
|
9160 | expr_ty val; |
9161 | PyObject *tmp2 = PyList_GET_ITEM(tmp, i); |
9162 | Py_INCREF(tmp2); |
9163 | if (_Py_EnterRecursiveCall(" while traversing 'Call' node")) { Branch (9163:21): [True: 0, False: 36.9k]
|
9164 | goto failed; |
9165 | } |
9166 | res = obj2ast_expr(state, tmp2, &val, arena); |
9167 | _Py_LeaveRecursiveCall(); |
9168 | Py_DECREF(tmp2); |
9169 | if (res != 0) goto failed0 ; Branch (9169:21): [True: 0, False: 36.9k]
|
9170 | if (len != PyList_GET_SIZE(tmp)) { Branch (9170:21): [True: 0, False: 36.9k]
|
9171 | PyErr_SetString(PyExc_RuntimeError, "Call field \"args\" changed size during iteration"); |
9172 | goto failed; |
9173 | } |
9174 | asdl_seq_SET(args, i, val); |
9175 | } |
9176 | Py_CLEAR(tmp); |
9177 | } |
9178 | if (_PyObject_LookupAttr(obj, state->keywords, &tmp) < 0) { Branch (9178:13): [True: 0, False: 30.1k]
|
9179 | return 1; |
9180 | } |
9181 | if (tmp == NULL) { Branch (9181:13): [True: 0, False: 30.1k]
|
9182 | PyErr_SetString(PyExc_TypeError, "required field \"keywords\" missing from Call"); |
9183 | return 1; |
9184 | } |
9185 | else { |
9186 | int res; |
9187 | Py_ssize_t len; |
9188 | Py_ssize_t i; |
9189 | if (!PyList_Check(tmp)) { Branch (9189:17): [True: 0, False: 30.1k]
|
9190 | PyErr_Format(PyExc_TypeError, "Call field \"keywords\" must be a list, not a %.200s", _PyType_Name(Py_TYPE(tmp))); |
9191 | goto failed; |
9192 | } |
9193 | len = PyList_GET_SIZE(tmp); |
9194 | keywords = _Py_asdl_keyword_seq_new(len, arena); |
9195 | if (keywords == NULL) goto failed0 ; Branch (9195:17): [True: 0, False: 30.1k]
|
9196 | for (i = 0; 30.1k i < len; i++3.26k ) { Branch (9196:25): [True: 3.26k, False: 30.1k]
|
9197 | keyword_ty val; |
9198 | PyObject *tmp2 = PyList_GET_ITEM(tmp, i); |
9199 | Py_INCREF(tmp2); |
9200 | if (_Py_EnterRecursiveCall(" while traversing 'Call' node")) { Branch (9200:21): [True: 0, False: 3.26k]
|
9201 | goto failed; |
9202 | } |
9203 | res = obj2ast_keyword(state, tmp2, &val, arena); |
9204 | _Py_LeaveRecursiveCall(); |
9205 | Py_DECREF(tmp2); |
9206 | if (res != 0) goto failed0 ; Branch (9206:21): [True: 0, False: 3.26k]
|
9207 | if (len != PyList_GET_SIZE(tmp)) { Branch (9207:21): [True: 0, False: 3.26k]
|
9208 | PyErr_SetString(PyExc_RuntimeError, "Call field \"keywords\" changed size during iteration"); |
9209 | goto failed; |
9210 | } |
9211 | asdl_seq_SET(keywords, i, val); |
9212 | } |
9213 | Py_CLEAR(tmp); |
9214 | } |
9215 | *out = _PyAST_Call(func, args, keywords, lineno, col_offset, |
9216 | end_lineno, end_col_offset, arena); |
9217 | if (*out == NULL) goto failed0 ; Branch (9217:13): [True: 0, False: 30.1k]
|
9218 | return 0; |
9219 | } |
9220 | tp = state->FormattedValue_type; |
9221 | isinstance = PyObject_IsInstance(obj, tp); |
9222 | if (isinstance == -1) { Branch (9222:9): [True: 0, False: 215k]
|
9223 | return 1; |
9224 | } |
9225 | if (isinstance) { Branch (9225:9): [True: 555, False: 214k]
|
9226 | expr_ty value; |
9227 | int conversion; |
9228 | expr_ty format_spec; |
9229 | |
9230 | if (_PyObject_LookupAttr(obj, state->value, &tmp) < 0) { Branch (9230:13): [True: 0, False: 555]
|
9231 | return 1; |
9232 | } |
9233 | if (tmp == NULL) { Branch (9233:13): [True: 0, False: 555]
|
9234 | PyErr_SetString(PyExc_TypeError, "required field \"value\" missing from FormattedValue"); |
9235 | return 1; |
9236 | } |
9237 | else { |
9238 | int res; |
9239 | if (_Py_EnterRecursiveCall(" while traversing 'FormattedValue' node")) { Branch (9239:17): [True: 0, False: 555]
|
9240 | goto failed; |
9241 | } |
9242 | res = obj2ast_expr(state, tmp, &value, arena); |
9243 | _Py_LeaveRecursiveCall(); |
9244 | if (res != 0) goto failed0 ; Branch (9244:17): [True: 0, False: 555]
|
9245 | Py_CLEAR(tmp); |
9246 | } |
9247 | if (_PyObject_LookupAttr(obj, state->conversion, &tmp) < 0) { Branch (9247:13): [True: 0, False: 555]
|
9248 | return 1; |
9249 | } |
9250 | if (tmp == NULL) { Branch (9250:13): [True: 0, False: 555]
|
9251 | PyErr_SetString(PyExc_TypeError, "required field \"conversion\" missing from FormattedValue"); |
9252 | return 1; |
9253 | } |
9254 | else { |
9255 | int res; |
9256 | if (_Py_EnterRecursiveCall(" while traversing 'FormattedValue' node")) { Branch (9256:17): [True: 0, False: 555]
|
9257 | goto failed; |
9258 | } |
9259 | res = obj2ast_int(state, tmp, &conversion, arena); |
9260 | _Py_LeaveRecursiveCall(); |
9261 | if (res != 0) goto failed0 ; Branch (9261:17): [True: 0, False: 555]
|
9262 | Py_CLEAR(tmp); |
9263 | } |
9264 | if (_PyObject_LookupAttr(obj, state->format_spec, &tmp) < 0) { Branch (9264:13): [True: 0, False: 555]
|
9265 | return 1; |
9266 | } |
9267 | if (tmp == NULL || tmp == Py_None) { Branch (9267:13): [True: 0, False: 555]
Branch (9267:28): [True: 536, False: 19]
|
9268 | Py_CLEAR(tmp); |
9269 | format_spec = NULL; |
9270 | } |
9271 | else { |
9272 | int res; |
9273 | if (_Py_EnterRecursiveCall(" while traversing 'FormattedValue' node")) { Branch (9273:17): [True: 0, False: 19]
|
9274 | goto failed; |
9275 | } |
9276 | res = obj2ast_expr(state, tmp, &format_spec, arena); |
9277 | _Py_LeaveRecursiveCall(); |
9278 | if (res != 0) goto failed0 ; Branch (9278:17): [True: 0, False: 19]
|
9279 | Py_CLEAR(tmp); |
9280 | } |
9281 | *out = _PyAST_FormattedValue(value, conversion, format_spec, lineno, |
9282 | col_offset, end_lineno, end_col_offset, |
9283 | arena); |
9284 | if (*out == NULL) goto failed0 ; Branch (9284:13): [True: 0, False: 555]
|
9285 | return 0; |
9286 | } |
9287 | tp = state->JoinedStr_type; |
9288 | isinstance = PyObject_IsInstance(obj, tp); |
9289 | if (isinstance == -1) { Branch (9289:9): [True: 0, False: 214k]
|
9290 | return 1; |
9291 | } |
9292 | if (isinstance) { Branch (9292:9): [True: 391, False: 214k]
|
9293 | asdl_expr_seq* values; |
9294 | |
9295 | if (_PyObject_LookupAttr(obj, state->values, &tmp) < 0) { Branch (9295:13): [True: 0, False: 391]
|
9296 | return 1; |
9297 | } |
9298 | if (tmp == NULL) { Branch (9298:13): [True: 0, False: 391]
|
9299 | PyErr_SetString(PyExc_TypeError, "required field \"values\" missing from JoinedStr"); |
9300 | return 1; |
9301 | } |
9302 | else { |
9303 | int res; |
9304 | Py_ssize_t len; |
9305 | Py_ssize_t i; |
9306 | if (!PyList_Check(tmp)) { Branch (9306:17): [True: 0, False: 391]
|
9307 | PyErr_Format(PyExc_TypeError, "JoinedStr field \"values\" must be a list, not a %.200s", _PyType_Name(Py_TYPE(tmp))); |
9308 | goto failed; |
9309 | } |
9310 | len = PyList_GET_SIZE(tmp); |
9311 | values = _Py_asdl_expr_seq_new(len, arena); |
9312 | if (values == NULL) goto failed0 ; Branch (9312:17): [True: 0, False: 391]
|
9313 | for (i = 0; 391 i < len; i++1.19k ) { Branch (9313:25): [True: 1.19k, False: 391]
|
9314 | expr_ty val; |
9315 | PyObject *tmp2 = PyList_GET_ITEM(tmp, i); |
9316 | Py_INCREF(tmp2); |
9317 | if (_Py_EnterRecursiveCall(" while traversing 'JoinedStr' node")) { Branch (9317:21): [True: 0, False: 1.19k]
|
9318 | goto failed; |
9319 | } |
9320 | res = obj2ast_expr(state, tmp2, &val, arena); |
9321 | _Py_LeaveRecursiveCall(); |
9322 | Py_DECREF(tmp2); |
9323 | if (res != 0) goto failed0 ; Branch (9323:21): [True: 0, False: 1.19k]
|
9324 | if (len != PyList_GET_SIZE(tmp)) { Branch (9324:21): [True: 0, False: 1.19k]
|
9325 | PyErr_SetString(PyExc_RuntimeError, "JoinedStr field \"values\" changed size during iteration"); |
9326 | goto failed; |
9327 | } |
9328 | asdl_seq_SET(values, i, val); |
9329 | } |
9330 | Py_CLEAR(tmp); |
9331 | } |
9332 | *out = _PyAST_JoinedStr(values, lineno, col_offset, end_lineno, |
9333 | end_col_offset, arena); |
9334 | if (*out == NULL) goto failed0 ; Branch (9334:13): [True: 0, False: 391]
|
9335 | return 0; |
9336 | } |
9337 | tp = state->Constant_type; |
9338 | isinstance = PyObject_IsInstance(obj, tp); |
9339 | if (isinstance == -1) { Branch (9339:9): [True: 0, False: 214k]
|
9340 | return 1; |
9341 | } |
9342 | if (isinstance) { Branch (9342:9): [True: 46.6k, False: 167k]
|
9343 | constant value; |
9344 | string kind; |
9345 | |
9346 | if (_PyObject_LookupAttr(obj, state->value, &tmp) < 0) { Branch (9346:13): [True: 0, False: 46.6k]
|
9347 | return 1; |
9348 | } |
9349 | if (tmp == NULL) { Branch (9349:13): [True: 0, False: 46.6k]
|
9350 | PyErr_SetString(PyExc_TypeError, "required field \"value\" missing from Constant"); |
9351 | return 1; |
9352 | } |
9353 | else { |
9354 | int res; |
9355 | if (_Py_EnterRecursiveCall(" while traversing 'Constant' node")) { Branch (9355:17): [True: 0, False: 46.6k]
|
9356 | goto failed; |
9357 | } |
9358 | res = obj2ast_constant(state, tmp, &value, arena); |
9359 | _Py_LeaveRecursiveCall(); |
9360 | if (res != 0) goto failed0 ; Branch (9360:17): [True: 0, False: 46.6k]
|
9361 | Py_CLEAR(tmp); |
9362 | } |
9363 | if (_PyObject_LookupAttr(obj, state->kind, &tmp) < 0) { Branch (9363:13): [True: 0, False: 46.6k]
|
9364 | return 1; |
9365 | } |
9366 | if (tmp == NULL || tmp == Py_None) { Branch (9366:13): [True: 0, False: 46.6k]
Branch (9366:28): [True: 46.6k, False: 0]
|
9367 | Py_CLEAR(tmp); |
9368 | kind = NULL; |
9369 | } |
9370 | else { |
9371 | int res; |
9372 | if (_Py_EnterRecursiveCall(" while traversing 'Constant' node")) { Branch (9372:17): [True: 0, False: 0]
|
9373 | goto failed; |
9374 | } |
9375 | res = obj2ast_string(state, tmp, &kind, arena); |
9376 | _Py_LeaveRecursiveCall(); |
9377 | if (res != 0) goto failed; Branch (9377:17): [True: 0, False: 0]
|
9378 | Py_CLEAR(tmp); |
9379 | } |
9380 | *out = _PyAST_Constant(value, kind, lineno, col_offset, end_lineno, |
9381 | end_col_offset, arena); |
9382 | if (*out == NULL) goto failed0 ; Branch (9382:13): [True: 0, False: 46.6k]
|
9383 | return 0; |
9384 | } |
9385 | tp = state->Attribute_type; |
9386 | isinstance = PyObject_IsInstance(obj, tp); |
9387 | if (isinstance == -1) { Branch (9387:9): [True: 0, False: 167k]
|
9388 | return 1; |
9389 | } |
9390 | if (isinstance) { Branch (9390:9): [True: 35.1k, False: 132k]
|
9391 | expr_ty value; |
9392 | identifier attr; |
9393 | expr_context_ty ctx; |
9394 | |
9395 | if (_PyObject_LookupAttr(obj, state->value, &tmp) < 0) { Branch (9395:13): [True: 0, False: 35.1k]
|
9396 | return 1; |
9397 | } |
9398 | if (tmp == NULL) { Branch (9398:13): [True: 0, False: 35.1k]
|
9399 | PyErr_SetString(PyExc_TypeError, "required field \"value\" missing from Attribute"); |
9400 | return 1; |
9401 | } |
9402 | else { |
9403 | int res; |
9404 | if (_Py_EnterRecursiveCall(" while traversing 'Attribute' node")) { Branch (9404:17): [True: 0, False: 35.1k]
|
9405 | goto failed; |
9406 | } |
9407 | res = obj2ast_expr(state, tmp, &value, arena); |
9408 | _Py_LeaveRecursiveCall(); |
9409 | if (res != 0) goto failed0 ; Branch (9409:17): [True: 0, False: 35.1k]
|
9410 | Py_CLEAR(tmp); |
9411 | } |
9412 | if (_PyObject_LookupAttr(obj, state->attr, &tmp) < 0) { Branch (9412:13): [True: 0, False: 35.1k]
|
9413 | return 1; |
9414 | } |
9415 | if (tmp == NULL) { Branch (9415:13): [True: 0, False: 35.1k]
|
9416 | PyErr_SetString(PyExc_TypeError, "required field \"attr\" missing from Attribute"); |
9417 | return 1; |
9418 | } |
9419 | else { |
9420 | int res; |
9421 | if (_Py_EnterRecursiveCall(" while traversing 'Attribute' node")) { Branch (9421:17): [True: 0, False: 35.1k]
|
9422 | goto failed; |
9423 | } |
9424 | res = obj2ast_identifier(state, tmp, &attr, arena); |
9425 | _Py_LeaveRecursiveCall(); |
9426 | if (res != 0) goto failed0 ; Branch (9426:17): [True: 0, False: 35.1k]
|
9427 | Py_CLEAR(tmp); |
9428 | } |
9429 | if (_PyObject_LookupAttr(obj, state->ctx, &tmp) < 0) { Branch (9429:13): [True: 0, False: 35.1k]
|
9430 | return 1; |
9431 | } |
9432 | if (tmp == NULL) { Branch (9432:13): [True: 0, False: 35.1k]
|
9433 | PyErr_SetString(PyExc_TypeError, "required field \"ctx\" missing from Attribute"); |
9434 | return 1; |
9435 | } |
9436 | else { |
9437 | int res; |
9438 | if (_Py_EnterRecursiveCall(" while traversing 'Attribute' node")) { Branch (9438:17): [True: 0, False: 35.1k]
|
9439 | goto failed; |
9440 | } |
9441 | res = obj2ast_expr_context(state, tmp, &ctx, arena); |
9442 | _Py_LeaveRecursiveCall(); |
9443 | if (res != 0) goto failed0 ; Branch (9443:17): [True: 0, False: 35.1k]
|
9444 | Py_CLEAR(tmp); |
9445 | } |
9446 | *out = _PyAST_Attribute(value, attr, ctx, lineno, col_offset, |
9447 | end_lineno, end_col_offset, arena); |
9448 | if (*out == NULL) goto failed0 ; Branch (9448:13): [True: 0, False: 35.1k]
|
9449 | return 0; |
9450 | } |
9451 | tp = state->Subscript_type; |
9452 | isinstance = PyObject_IsInstance(obj, tp); |
9453 | if (isinstance == -1) { Branch (9453:9): [True: 0, False: 132k]
|
9454 | return 1; |
9455 | } |
9456 | if (isinstance) { Branch (9456:9): [True: 4.94k, False: 127k]
|
9457 | expr_ty value; |
9458 | expr_ty slice; |
9459 | expr_context_ty ctx; |
9460 | |
9461 | if (_PyObject_LookupAttr(obj, state->value, &tmp) < 0) { Branch (9461:13): [True: 0, False: 4.94k]
|
9462 | return 1; |
9463 | } |
9464 | if (tmp == NULL) { Branch (9464:13): [True: 0, False: 4.94k]
|
9465 | PyErr_SetString(PyExc_TypeError, "required field \"value\" missing from Subscript"); |
9466 | return 1; |
9467 | } |
9468 | else { |
9469 | int res; |
9470 | if (_Py_EnterRecursiveCall(" while traversing 'Subscript' node")) { Branch (9470:17): [True: 0, False: 4.94k]
|
9471 | goto failed; |
9472 | } |
9473 | res = obj2ast_expr(state, tmp, &value, arena); |
9474 | _Py_LeaveRecursiveCall(); |
9475 | if (res != 0) goto failed0 ; Branch (9475:17): [True: 0, False: 4.94k]
|
9476 | Py_CLEAR(tmp); |
9477 | } |
9478 | if (_PyObject_LookupAttr(obj, state->slice, &tmp) < 0) { Branch (9478:13): [True: 0, False: 4.94k]
|
9479 | return 1; |
9480 | } |
9481 | if (tmp == NULL) { Branch (9481:13): [True: 0, False: 4.94k]
|
9482 | PyErr_SetString(PyExc_TypeError, "required field \"slice\" missing from Subscript"); |
9483 | return 1; |
9484 | } |
9485 | else { |
9486 | int res; |
9487 | if (_Py_EnterRecursiveCall(" while traversing 'Subscript' node")) { Branch (9487:17): [True: 0, False: 4.94k]
|
9488 | goto failed; |
9489 | } |
9490 | res = obj2ast_expr(state, tmp, &slice, arena); |
9491 | _Py_LeaveRecursiveCall(); |
9492 | if (res != 0) goto failed0 ; Branch (9492:17): [True: 0, False: 4.94k]
|
9493 | Py_CLEAR(tmp); |
9494 | } |
9495 | if (_PyObject_LookupAttr(obj, state->ctx, &tmp) < 0) { Branch (9495:13): [True: 0, False: 4.94k]
|
9496 | return 1; |
9497 | } |
9498 | if (tmp == NULL) { Branch (9498:13): [True: 0, False: 4.94k]
|
9499 | PyErr_SetString(PyExc_TypeError, "required field \"ctx\" missing from Subscript"); |
9500 | return 1; |
9501 | } |
9502 | else { |
9503 | int res; |
9504 | if (_Py_EnterRecursiveCall(" while traversing 'Subscript' node")) { Branch (9504:17): [True: 0, False: 4.94k]
|
9505 | goto failed; |
9506 | } |
9507 | res = obj2ast_expr_context(state, tmp, &ctx, arena); |
9508 | _Py_LeaveRecursiveCall(); |
9509 | if (res != 0) goto failed0 ; Branch (9509:17): [True: 0, False: 4.94k]
|
9510 | Py_CLEAR(tmp); |
9511 | } |
9512 | *out = _PyAST_Subscript(value, slice, ctx, lineno, col_offset, |
9513 | end_lineno, end_col_offset, arena); |
9514 | if (*out == NULL) goto failed0 ; Branch (9514:13): [True: 0, False: 4.94k]
|
9515 | return 0; |
9516 | } |
9517 | tp = state->Starred_type; |
9518 | isinstance = PyObject_IsInstance(obj, tp); |
9519 | if (isinstance == -1) { Branch (9519:9): [True: 0, False: 127k]
|
9520 | return 1; |
9521 | } |
9522 | if (isinstance) { Branch (9522:9): [True: 315, False: 127k]
|
9523 | expr_ty value; |
9524 | expr_context_ty ctx; |
9525 | |
9526 | if (_PyObject_LookupAttr(obj, state->value, &tmp) < 0) { Branch (9526:13): [True: 0, False: 315]
|
9527 | return 1; |
9528 | } |
9529 | if (tmp == NULL) { Branch (9529:13): [True: 0, False: 315]
|
9530 | PyErr_SetString(PyExc_TypeError, "required field \"value\" missing from Starred"); |
9531 | return 1; |
9532 | } |
9533 | else { |
9534 | int res; |
9535 | if (_Py_EnterRecursiveCall(" while traversing 'Starred' node")) { Branch (9535:17): [True: 0, False: 315]
|
9536 | goto failed; |
9537 | } |
9538 | res = obj2ast_expr(state, tmp, &value, arena); |
9539 | _Py_LeaveRecursiveCall(); |
9540 | if (res != 0) goto failed0 ; Branch (9540:17): [True: 0, False: 315]
|
9541 | Py_CLEAR(tmp); |
9542 | } |
9543 | if (_PyObject_LookupAttr(obj, state->ctx, &tmp) < 0) { Branch (9543:13): [True: 0, False: 315]
|
9544 | return 1; |
9545 | } |
9546 | if (tmp == NULL) { Branch (9546:13): [True: 0, False: 315]
|
9547 | PyErr_SetString(PyExc_TypeError, "required field \"ctx\" missing from Starred"); |
9548 | return 1; |
9549 | } |
9550 | else { |
9551 | int res; |
9552 | if (_Py_EnterRecursiveCall(" while traversing 'Starred' node")) { Branch (9552:17): [True: 0, False: 315]
|
9553 | goto failed; |
9554 | } |
9555 | res = obj2ast_expr_context(state, tmp, &ctx, arena); |
9556 | _Py_LeaveRecursiveCall(); |
9557 | if (res != 0) goto failed0 ; Branch (9557:17): [True: 0, False: 315]
|
9558 | Py_CLEAR(tmp); |
9559 | } |
9560 | *out = _PyAST_Starred(value, ctx, lineno, col_offset, end_lineno, |
9561 | end_col_offset, arena); |
9562 | if (*out == NULL) goto failed0 ; Branch (9562:13): [True: 0, False: 315]
|
9563 | return 0; |
9564 | } |
9565 | tp = state->Name_type; |
9566 | isinstance = PyObject_IsInstance(obj, tp); |
9567 | if (isinstance == -1) { Branch (9567:9): [True: 0, False: 127k]
|
9568 | return 1; |
9569 | } |
9570 | if (isinstance) { Branch (9570:9): [True: 119k, False: 8.03k]
|
9571 | identifier id; |
9572 | expr_context_ty ctx; |
9573 | |
9574 | if (_PyObject_LookupAttr(obj, state->id, &tmp) < 0) { Branch (9574:13): [True: 0, False: 119k]
|
9575 | return 1; |
9576 | } |
9577 | if (tmp == NULL) { Branch (9577:13): [True: 0, False: 119k]
|
9578 | PyErr_SetString(PyExc_TypeError, "required field \"id\" missing from Name"); |
9579 | return 1; |
9580 | } |
9581 | else { |
9582 | int res; |
9583 | if (_Py_EnterRecursiveCall(" while traversing 'Name' node")) { Branch (9583:17): [True: 0, False: 119k]
|
9584 | goto failed; |
9585 | } |
9586 | res = obj2ast_identifier(state, tmp, &id, arena); |
9587 | _Py_LeaveRecursiveCall(); |
9588 | if (res != 0) goto failed1 ; Branch (9588:17): [True: 1, False: 119k]
|
9589 | Py_CLEAR(tmp); |
9590 | } |
9591 | if (_PyObject_LookupAttr(obj, state->ctx, &tmp) < 0) { Branch (9591:13): [True: 0, False: 119k]
|
9592 | return 1; |
9593 | } |
9594 | if (tmp == NULL) { Branch (9594:13): [True: 0, False: 119k]
|
9595 | PyErr_SetString(PyExc_TypeError, "required field \"ctx\" missing from Name"); |
9596 | return 1; |
9597 | } |
9598 | else { |
9599 | int res; |
9600 | if (_Py_EnterRecursiveCall(" while traversing 'Name' node")) { Branch (9600:17): [True: 0, False: 119k]
|
9601 | goto failed; |
9602 | } |
9603 | res = obj2ast_expr_context(state, tmp, &ctx, arena); |
9604 | _Py_LeaveRecursiveCall(); |
9605 | if (res != 0) goto failed0 ; Branch (9605:17): [True: 0, False: 119k]
|
9606 | Py_CLEAR(tmp); |
9607 | } |
9608 | *out = _PyAST_Name(id, ctx, lineno, col_offset, end_lineno, |
9609 | end_col_offset, arena); |
9610 | if (*out == NULL) goto failed0 ; Branch (9610:13): [True: 0, False: 119k]
|
9611 | return 0; |
9612 | } |
9613 | tp = state->List_type; |
9614 | isinstance = PyObject_IsInstance(obj, tp); |
9615 | if (isinstance == -1) { Branch (9615:9): [True: 0, False: 8.03k]
|
9616 | return 1; |
9617 | } |
9618 | if (isinstance) { Branch (9618:9): [True: 1.48k, False: 6.54k]
|
9619 | asdl_expr_seq* elts; |
9620 | expr_context_ty ctx; |
9621 | |
9622 | if (_PyObject_LookupAttr(obj, state->elts, &tmp) < 0) { Branch (9622:13): [True: 0, False: 1.48k]
|
9623 | return 1; |
9624 | } |
9625 | if (tmp == NULL) { Branch (9625:13): [True: 0, False: 1.48k]
|
9626 | PyErr_SetString(PyExc_TypeError, "required field \"elts\" missing from List"); |
9627 | return 1; |
9628 | } |
9629 | else { |
9630 | int res; |
9631 | Py_ssize_t len; |
9632 | Py_ssize_t i; |
9633 | if (!PyList_Check(tmp)) { Branch (9633:17): [True: 0, False: 1.48k]
|
9634 | PyErr_Format(PyExc_TypeError, "List field \"elts\" must be a list, not a %.200s", _PyType_Name(Py_TYPE(tmp))); |
9635 | goto failed; |
9636 | } |
9637 | len = PyList_GET_SIZE(tmp); |
9638 | elts = _Py_asdl_expr_seq_new(len, arena); |
9639 | if (elts == NULL) goto failed0 ; Branch (9639:17): [True: 0, False: 1.48k]
|
9640 | for (i = 0; 1.48k i < len; i++3.45k ) { Branch (9640:25): [True: 3.45k, False: 1.48k]
|
9641 | expr_ty val; |
9642 | PyObject *tmp2 = PyList_GET_ITEM(tmp, i); |
9643 | Py_INCREF(tmp2); |
9644 | if (_Py_EnterRecursiveCall(" while traversing 'List' node")) { Branch (9644:21): [True: 0, False: 3.45k]
|
9645 | goto failed; |
9646 | } |
9647 | res = obj2ast_expr(state, tmp2, &val, arena); |
9648 | _Py_LeaveRecursiveCall(); |
9649 | Py_DECREF(tmp2); |
9650 | if (res != 0) goto failed0 ; Branch (9650:21): [True: 0, False: 3.45k]
|
9651 | if (len != PyList_GET_SIZE(tmp)) { Branch (9651:21): [True: 0, False: 3.45k]
|
9652 | PyErr_SetString(PyExc_RuntimeError, "List field \"elts\" changed size during iteration"); |
9653 | goto failed; |
9654 | } |
9655 | asdl_seq_SET(elts, i, val); |
9656 | } |
9657 | Py_CLEAR(tmp); |
9658 | } |
9659 | if (_PyObject_LookupAttr(obj, state->ctx, &tmp) < 0) { Branch (9659:13): [True: 0, False: 1.48k]
|
9660 | return 1; |
9661 | } |
9662 | if (tmp == NULL) { Branch (9662:13): [True: 0, False: 1.48k]
|
9663 | PyErr_SetString(PyExc_TypeError, "required field \"ctx\" missing from List"); |
9664 | return 1; |
9665 | } |
9666 | else { |
9667 | int res; |
9668 | if (_Py_EnterRecursiveCall(" while traversing 'List' node")) { Branch (9668:17): [True: 0, False: 1.48k]
|
9669 | goto failed; |
9670 | } |
9671 | res = obj2ast_expr_context(state, tmp, &ctx, arena); |
9672 | _Py_LeaveRecursiveCall(); |
9673 | if (res != 0) goto failed0 ; Branch (9673:17): [True: 0, False: 1.48k]
|
9674 | Py_CLEAR(tmp); |
9675 | } |
9676 | *out = _PyAST_List(elts, ctx, lineno, col_offset, end_lineno, |
9677 | end_col_offset, arena); |
9678 | if (*out == NULL) goto failed0 ; Branch (9678:13): [True: 0, False: 1.48k]
|
9679 | return 0; |
9680 | } |
9681 | tp = state->Tuple_type; |
9682 | isinstance = PyObject_IsInstance(obj, tp); |
9683 | if (isinstance == -1) { Branch (9683:9): [True: 0, False: 6.54k]
|
9684 | return 1; |
9685 | } |
9686 | if (isinstance) { Branch (9686:9): [True: 5.24k, False: 1.29k]
|
9687 | asdl_expr_seq* elts; |
9688 | expr_context_ty ctx; |
9689 | |
9690 | if (_PyObject_LookupAttr(obj, state->elts, &tmp) < 0) { Branch (9690:13): [True: 0, False: 5.24k]
|
9691 | return 1; |
9692 | } |
9693 | if (tmp == NULL) { Branch (9693:13): [True: 0, False: 5.24k]
|
9694 | PyErr_SetString(PyExc_TypeError, "required field \"elts\" missing from Tuple"); |
9695 | return 1; |
9696 | } |
9697 | else { |
9698 | int res; |
9699 | Py_ssize_t len; |
9700 | Py_ssize_t i; |
9701 | if (!PyList_Check(tmp)) { Branch (9701:17): [True: 0, False: 5.24k]
|
9702 | PyErr_Format(PyExc_TypeError, "Tuple field \"elts\" must be a list, not a %.200s", _PyType_Name(Py_TYPE(tmp))); |
9703 | goto failed; |
9704 | } |
9705 | len = PyList_GET_SIZE(tmp); |
9706 | elts = _Py_asdl_expr_seq_new(len, arena); |
9707 | if (elts == NULL) goto failed0 ; Branch (9707:17): [True: 0, False: 5.24k]
|
9708 | for (i = 0; 5.24k i < len; i++12.3k ) { Branch (9708:25): [True: 12.3k, False: 5.24k]
|
9709 | expr_ty val; |
9710 | PyObject *tmp2 = PyList_GET_ITEM(tmp, i); |
9711 | Py_INCREF(tmp2); |
9712 | if (_Py_EnterRecursiveCall(" while traversing 'Tuple' node")) { Branch (9712:21): [True: 0, False: 12.3k]
|
9713 | goto failed; |
9714 | } |
9715 | res = obj2ast_expr(state, tmp2, &val, arena); |
9716 | _Py_LeaveRecursiveCall(); |
9717 | Py_DECREF(tmp2); |
9718 | if (res != 0) goto failed0 ; Branch (9718:21): [True: 0, False: 12.3k]
|
9719 | if (len != PyList_GET_SIZE(tmp)) { Branch (9719:21): [True: 0, False: 12.3k]
|
9720 | PyErr_SetString(PyExc_RuntimeError, "Tuple field \"elts\" changed size during iteration"); |
9721 | goto failed; |
9722 | } |
9723 | asdl_seq_SET(elts, i, val); |
9724 | } |
9725 | Py_CLEAR(tmp); |
9726 | } |
9727 | if (_PyObject_LookupAttr(obj, state->ctx, &tmp) < 0) { Branch (9727:13): [True: 0, False: 5.24k]
|
9728 | return 1; |
9729 | } |
9730 | if (tmp == NULL) { Branch (9730:13): [True: 0, False: 5.24k]
|
9731 | PyErr_SetString(PyExc_TypeError, "required field \"ctx\" missing from Tuple"); |
9732 | return 1; |
9733 | } |
9734 | else { |
9735 | int res; |
9736 | if (_Py_EnterRecursiveCall(" while traversing 'Tuple' node")) { Branch (9736:17): [True: 0, False: 5.24k]
|
9737 | goto failed; |
9738 | } |
9739 | res = obj2ast_expr_context(state, tmp, &ctx, arena); |
9740 | _Py_LeaveRecursiveCall(); |
9741 | if (res != 0) goto failed0 ; Branch (9741:17): [True: 0, False: 5.24k]
|
9742 | Py_CLEAR(tmp); |
9743 | } |
9744 | *out = _PyAST_Tuple(elts, ctx, lineno, col_offset, end_lineno, |
9745 | end_col_offset, arena); |
9746 | if (*out == NULL) goto failed0 ; Branch (9746:13): [True: 0, False: 5.24k]
|
9747 | return 0; |
9748 | } |
9749 | tp = state->Slice_type; |
9750 | isinstance = PyObject_IsInstance(obj, tp); |
9751 | if (isinstance == -1) { Branch (9751:9): [True: 0, False: 1.29k]
|
9752 | return 1; |
9753 | } |
9754 | if (isinstance) { Branch (9754:9): [True: 1.29k, False: 1]
|
9755 | expr_ty lower; |
9756 | expr_ty upper; |
9757 | expr_ty step; |
9758 | |
9759 | if (_PyObject_LookupAttr(obj, state->lower, &tmp) < 0) { Branch (9759:13): [True: 0, False: 1.29k]
|
9760 | return 1; |
9761 | } |
9762 | if (tmp == NULL || tmp == Py_None) { Branch (9762:13): [True: 0, False: 1.29k]
Branch (9762:28): [True: 520, False: 774]
|
9763 | Py_CLEAR(tmp); |
9764 | lower = NULL; |
9765 | } |
9766 | else { |
9767 | int res; |
9768 | if (_Py_EnterRecursiveCall(" while traversing 'Slice' node")) { Branch (9768:17): [True: 0, False: 774]
|
9769 | goto failed; |
9770 | } |
9771 | res = obj2ast_expr(state, tmp, &lower, arena); |
9772 | _Py_LeaveRecursiveCall(); |
9773 | if (res != 0) goto failed0 ; Branch (9773:17): [True: 0, False: 774]
|
9774 | Py_CLEAR(tmp); |
9775 | } |
9776 | if (_PyObject_LookupAttr(obj, state->upper, &tmp) < 0) { Branch (9776:13): [True: 0, False: 1.29k]
|
9777 | return 1; |
9778 | } |
9779 | if (tmp == NULL || tmp == Py_None) { Branch (9779:13): [True: 0, False: 1.29k]
Branch (9779:28): [True: 498, False: 796]
|
9780 | Py_CLEAR(tmp); |
9781 | upper = NULL; |
9782 | } |
9783 | else { |
9784 | int res; |
9785 | if (_Py_EnterRecursiveCall(" while traversing 'Slice' node")) { Branch (9785:17): [True: 0, False: 796]
|
9786 | goto failed; |
9787 | } |
9788 | res = obj2ast_expr(state, tmp, &upper, arena); |
9789 | _Py_LeaveRecursiveCall(); |
9790 | if (res != 0) goto failed0 ; Branch (9790:17): [True: 0, False: 796]
|
9791 | Py_CLEAR(tmp); |
9792 | } |
9793 | if (_PyObject_LookupAttr(obj, state->step, &tmp) < 0) { Branch (9793:13): [True: 0, False: 1.29k]
|
9794 | return 1; |
9795 | } |
9796 | if (tmp == NULL || tmp == Py_None) { Branch (9796:13): [True: 0, False: 1.29k]
Branch (9796:28): [True: 1.26k, False: 31]
|
9797 | Py_CLEAR(tmp); |
9798 | step = NULL; |
9799 | } |
9800 | else { |
9801 | int res; |
9802 | if (_Py_EnterRecursiveCall(" while traversing 'Slice' node")) { Branch (9802:17): [True: 0, False: 31]
|
9803 | goto failed; |
9804 | } |
9805 | res = obj2ast_expr(state, tmp, &step, arena); |
9806 | _Py_LeaveRecursiveCall(); |
9807 | if (res != 0) goto failed0 ; Branch (9807:17): [True: 0, False: 31]
|
9808 | Py_CLEAR(tmp); |
9809 | } |
9810 | *out = _PyAST_Slice(lower, upper, step, lineno, col_offset, end_lineno, |
9811 | end_col_offset, arena); |
9812 | if (*out == NULL) goto failed0 ; Branch (9812:13): [True: 0, False: 1.29k]
|
9813 | return 0; |
9814 | } |
9815 | |
9816 | PyErr_Format(PyExc_TypeError, "expected some sort of expr, but got %R", obj); |
9817 | failed: |
9818 | Py_XDECREF(tmp); |
9819 | return 1; |
9820 | } |
9821 | |
9822 | int |
9823 | obj2ast_expr_context(struct ast_state *state, PyObject* obj, expr_context_ty* |
9824 | out, PyArena* arena) |
9825 | { |
9826 | int isinstance; |
9827 | |
9828 | isinstance = PyObject_IsInstance(obj, state->Load_type); |
9829 | if (isinstance == -1) { Branch (9829:9): [True: 0, False: 166k]
|
9830 | return 1; |
9831 | } |
9832 | if (isinstance) { Branch (9832:9): [True: 138k, False: 28.3k]
|
9833 | *out = Load; |
9834 | return 0; |
9835 | } |
9836 | isinstance = PyObject_IsInstance(obj, state->Store_type); |
9837 | if (isinstance == -1) { Branch (9837:9): [True: 0, False: 28.3k]
|
9838 | return 1; |
9839 | } |
9840 | if (isinstance) { Branch (9840:9): [True: 28.0k, False: 320]
|
9841 | *out = Store; |
9842 | return 0; |
9843 | } |
9844 | isinstance = PyObject_IsInstance(obj, state->Del_type); |
9845 | if (isinstance == -1) { Branch (9845:9): [True: 0, False: 320]
|
9846 | return 1; |
9847 | } |
9848 | if (isinstance) { Branch (9848:9): [True: 320, False: 0]
|
9849 | *out = Del; |
9850 | return 0; |
9851 | } |
9852 | |
9853 | PyErr_Format(PyExc_TypeError, "expected some sort of expr_context, but got %R", obj); |
9854 | return 1; |
9855 | } |
9856 | |
9857 | int |
9858 | obj2ast_boolop(struct ast_state *state, PyObject* obj, boolop_ty* out, PyArena* |
9859 | arena) |
9860 | { |
9861 | int isinstance; |
9862 | |
9863 | isinstance = PyObject_IsInstance(obj, state->And_type); |
9864 | if (isinstance == -1) { Branch (9864:9): [True: 0, False: 2.06k]
|
9865 | return 1; |
9866 | } |
9867 | if (isinstance) { Branch (9867:9): [True: 1.27k, False: 793]
|
9868 | *out = And; |
9869 | return 0; |
9870 | } |
9871 | isinstance = PyObject_IsInstance(obj, state->Or_type); |
9872 | if (isinstance == -1) { Branch (9872:9): [True: 0, False: 793]
|
9873 | return 1; |
9874 | } |
9875 | if (isinstance) { Branch (9875:9): [True: 793, False: 0]
|
9876 | *out = Or; |
9877 | return 0; |
9878 | } |
9879 | |
9880 | PyErr_Format(PyExc_TypeError, "expected some sort of boolop, but got %R", obj); |
9881 | return 1; |
9882 | } |
9883 | |
9884 | int |
9885 | obj2ast_operator(struct ast_state *state, PyObject* obj, operator_ty* out, |
9886 | PyArena* arena) |
9887 | { |
9888 | int isinstance; |
9889 | |
9890 | isinstance = PyObject_IsInstance(obj, state->Add_type); |
9891 | if (isinstance == -1) { Branch (9891:9): [True: 0, False: 7.48k]
|
9892 | return 1; |
9893 | } |
9894 | if (isinstance) { Branch (9894:9): [True: 3.09k, False: 4.39k]
|
9895 | *out = Add; |
9896 | return 0; |
9897 | } |
9898 | isinstance = PyObject_IsInstance(obj, state->Sub_type); |
9899 | if (isinstance == -1) { Branch (9899:9): [True: 0, False: 4.39k]
|
9900 | return 1; |
9901 | } |
9902 | if (isinstance) { Branch (9902:9): [True: 966, False: 3.43k]
|
9903 | *out = Sub; |
9904 | return 0; |
9905 | } |
9906 | isinstance = PyObject_IsInstance(obj, state->Mult_type); |
9907 | if (isinstance == -1) { Branch (9907:9): [True: 0, False: 3.43k]
|
9908 | return 1; |
9909 | } |
9910 | if (isinstance) { Branch (9910:9): [True: 797, False: 2.63k]
|
9911 | *out = Mult; |
9912 | return 0; |
9913 | } |
9914 | isinstance = PyObject_IsInstance(obj, state->MatMult_type); |
9915 | if (isinstance == -1) { Branch (9915:9): [True: 0, False: 2.63k]
|
9916 | return 1; |
9917 | } |
9918 | if (isinstance) { Branch (9918:9): [True: 4, False: 2.62k]
|
9919 | *out = MatMult; |
9920 | return 0; |
9921 | } |
9922 | isinstance = PyObject_IsInstance(obj, state->Div_type); |
9923 | if (isinstance == -1) { Branch (9923:9): [True: 0, False: 2.62k]
|
9924 | return 1; |
9925 | } |
9926 | if (isinstance) { Branch (9926:9): [True: 174, False: 2.45k]
|
9927 | *out = Div; |
9928 | return 0; |
9929 | } |
9930 | isinstance = PyObject_IsInstance(obj, state->Mod_type); |
9931 | if (isinstance == -1) { Branch (9931:9): [True: 0, False: 2.45k]
|
9932 | return 1; |
9933 | } |
9934 | if (isinstance) { Branch (9934:9): [True: 1.45k, False: 1.00k]
|
9935 | *out = Mod; |
9936 | return 0; |
9937 | } |
9938 | isinstance = PyObject_IsInstance(obj, state->Pow_type); |
9939 | if (isinstance == -1) { Branch (9939:9): [True: 0, False: 1.00k]
|
9940 | return 1; |
9941 | } |
9942 | if (isinstance) { Branch (9942:9): [True: 133, False: 869]
|
9943 | *out = Pow; |
9944 | return 0; |
9945 | } |
9946 | isinstance = PyObject_IsInstance(obj, state->LShift_type); |
9947 | if (isinstance == -1) { Branch (9947:9): [True: 0, False: 869]
|
9948 | return 1; |
9949 | } |
9950 | if (isinstance) { Branch (9950:9): [True: 143, False: 726]
|
9951 | *out = LShift; |
9952 | return 0; |
9953 | } |
9954 | isinstance = PyObject_IsInstance(obj, state->RShift_type); |
9955 | if (isinstance == -1) { Branch (9955:9): [True: 0, False: 726]
|
9956 | return 1; |
9957 | } |
9958 | if (isinstance) { Branch (9958:9): [True: 66, False: 660]
|
9959 | *out = RShift; |
9960 | return 0; |
9961 | } |
9962 | isinstance = PyObject_IsInstance(obj, state->BitOr_type); |
9963 | if (isinstance == -1) { Branch (9963:9): [True: 0, False: 660]
|
9964 | return 1; |
9965 | } |
9966 | if (isinstance) { Branch (9966:9): [True: 201, False: 459]
|
9967 | *out = BitOr; |
9968 | return 0; |
9969 | } |
9970 | isinstance = PyObject_IsInstance(obj, state->BitXor_type); |
9971 | if (isinstance == -1) { Branch (9971:9): [True: 0, False: 459]
|
9972 | return 1; |
9973 | } |
9974 | if (isinstance) { Branch (9974:9): [True: 41, False: 418]
|
9975 | *out = BitXor; |
9976 | return 0; |
9977 | } |
9978 | isinstance = PyObject_IsInstance(obj, state->BitAnd_type); |
9979 | if (isinstance == -1) { Branch (9979:9): [True: 0, False: 418]
|
9980 | return 1; |
9981 | } |
9982 | if (isinstance) { Branch (9982:9): [True: 253, False: 165]
|
9983 | *out = BitAnd; |
9984 | return 0; |
9985 | } |
9986 | isinstance = PyObject_IsInstance(obj, state->FloorDiv_type); |
9987 | if (isinstance == -1) { Branch (9987:9): [True: 0, False: 165]
|
9988 | return 1; |
9989 | } |
9990 | if (isinstance) { Branch (9990:9): [True: 165, False: 0]
|
9991 | *out = FloorDiv; |
9992 | return 0; |
9993 | } |
9994 | |
9995 | PyErr_Format(PyExc_TypeError, "expected some sort of operator, but got %R", obj); |
9996 | return 1; |
9997 | } |
9998 | |
9999 | int |
10000 | obj2ast_unaryop(struct ast_state *state, PyObject* obj, unaryop_ty* out, |
10001 | PyArena* arena) |
10002 | { |
10003 | int isinstance; |
10004 | |
10005 | isinstance = PyObject_IsInstance(obj, state->Invert_type); |
10006 | if (isinstance == -1) { Branch (10006:9): [True: 0, False: 3.08k]
|
10007 | return 1; |
10008 | } |
10009 | if (isinstance) { Branch (10009:9): [True: 32, False: 3.05k]
|
10010 | *out = Invert; |
10011 | return 0; |
10012 | } |
10013 | isinstance = PyObject_IsInstance(obj, state->Not_type); |
10014 | if (isinstance == -1) { Branch (10014:9): [True: 0, False: 3.05k]
|
10015 | return 1; |
10016 | } |
10017 | if (isinstance) { Branch (10017:9): [True: 1.91k, False: 1.14k]
|
10018 | *out = Not; |
10019 | return 0; |
10020 | } |
10021 | isinstance = PyObject_IsInstance(obj, state->UAdd_type); |
10022 | if (isinstance == -1) { Branch (10022:9): [True: 0, False: 1.14k]
|
10023 | return 1; |
10024 | } |
10025 | if (isinstance) { Branch (10025:9): [True: 14, False: 1.12k]
|
10026 | *out = UAdd; |
10027 | return 0; |
10028 | } |
10029 | isinstance = PyObject_IsInstance(obj, state->USub_type); |
10030 | if (isinstance == -1) { Branch (10030:9): [True: 0, False: 1.12k]
|
10031 | return 1; |
10032 | } |
10033 | if (isinstance) { Branch (10033:9): [True: 1.12k, False: 0]
|
10034 | *out = USub; |
10035 | return 0; |
10036 | } |
10037 | |
10038 | PyErr_Format(PyExc_TypeError, "expected some sort of unaryop, but got %R", obj); |
10039 | return 1; |
10040 | } |
10041 | |
10042 | int |
10043 | obj2ast_cmpop(struct ast_state *state, PyObject* obj, cmpop_ty* out, PyArena* |
10044 | arena) |
10045 | { |
10046 | int isinstance; |
10047 | |
10048 | isinstance = PyObject_IsInstance(obj, state->Eq_type); |
10049 | if (isinstance == -1) { Branch (10049:9): [True: 0, False: 8.31k]
|
10050 | return 1; |
10051 | } |
10052 | if (isinstance) { Branch (10052:9): [True: 2.29k, False: 6.02k]
|
10053 | *out = Eq; |
10054 | return 0; |
10055 | } |
10056 | isinstance = PyObject_IsInstance(obj, state->NotEq_type); |
10057 | if (isinstance == -1) { Branch (10057:9): [True: 0, False: 6.02k]
|
10058 | return 1; |
10059 | } |
10060 | if (isinstance) { Branch (10060:9): [True: 599, False: 5.42k]
|
10061 | *out = NotEq; |
10062 | return 0; |
10063 | } |
10064 | isinstance = PyObject_IsInstance(obj, state->Lt_type); |
10065 | if (isinstance == -1) { Branch (10065:9): [True: 0, False: 5.42k]
|
10066 | return 1; |
10067 | } |
10068 | if (isinstance) { Branch (10068:9): [True: 583, False: 4.84k]
|
10069 | *out = Lt; |
10070 | return 0; |
10071 | } |
10072 | isinstance = PyObject_IsInstance(obj, state->LtE_type); |
10073 | if (isinstance == -1) { Branch (10073:9): [True: 0, False: 4.84k]
|
10074 | return 1; |
10075 | } |
10076 | if (isinstance) { Branch (10076:9): [True: 321, False: 4.51k]
|
10077 | *out = LtE; |
10078 | return 0; |
10079 | } |
10080 | isinstance = PyObject_IsInstance(obj, state->Gt_type); |
10081 | if (isinstance == -1) { Branch (10081:9): [True: 0, False: 4.51k]
|
10082 | return 1; |
10083 | } |
10084 | if (isinstance) { Branch (10084:9): [True: 485, False: 4.03k]
|
10085 | *out = Gt; |
10086 | return 0; |
10087 | } |
10088 | isinstance = PyObject_IsInstance(obj, state->GtE_type); |
10089 | if (isinstance == -1) { Branch (10089:9): [True: 0, False: 4.03k]
|
10090 | return 1; |
10091 | } |
10092 | if (isinstance) { Branch (10092:9): [True: 278, False: 3.75k]
|
10093 | *out = GtE; |
10094 | return 0; |
10095 | } |
10096 | isinstance = PyObject_IsInstance(obj, state->Is_type); |
10097 | if (isinstance == -1) { Branch (10097:9): [True: 0, False: 3.75k]
|
10098 | return 1; |
10099 | } |
10100 | if (isinstance) { Branch (10100:9): [True: 1.41k, False: 2.34k]
|
10101 | *out = Is; |
10102 | return 0; |
10103 | } |
10104 | isinstance = PyObject_IsInstance(obj, state->IsNot_type); |
10105 | if (isinstance == -1) { Branch (10105:9): [True: 0, False: 2.34k]
|
10106 | return 1; |
10107 | } |
10108 | if (isinstance) { Branch (10108:9): [True: 963, False: 1.38k]
|
10109 | *out = IsNot; |
10110 | return 0; |
10111 | } |
10112 | isinstance = PyObject_IsInstance(obj, state->In_type); |
10113 | if (isinstance == -1) { Branch (10113:9): [True: 0, False: 1.38k]
|
10114 | return 1; |
10115 | } |
10116 | if (isinstance) { Branch (10116:9): [True: 1.06k, False: 314]
|
10117 | *out = In; |
10118 | return 0; |
10119 | } |
10120 | isinstance = PyObject_IsInstance(obj, state->NotIn_type); |
10121 | if (isinstance == -1) { Branch (10121:9): [True: 0, False: 314]
|
10122 | return 1; |
10123 | } |
10124 | if (isinstance) { Branch (10124:9): [True: 314, False: 0]
|
10125 | *out = NotIn; |
10126 | return 0; |
10127 | } |
10128 | |
10129 | PyErr_Format(PyExc_TypeError, "expected some sort of cmpop, but got %R", obj); |
10130 | return 1; |
10131 | } |
10132 | |
10133 | int |
10134 | obj2ast_comprehension(struct ast_state *state, PyObject* obj, comprehension_ty* |
10135 | out, PyArena* arena) |
10136 | { |
10137 | PyObject* tmp = NULL; |
10138 | expr_ty target; |
10139 | expr_ty iter; |
10140 | asdl_expr_seq* ifs; |
10141 | int is_async; |
10142 | |
10143 | if (_PyObject_LookupAttr(obj, state->target, &tmp) < 0) { Branch (10143:9): [True: 0, False: 635]
|
10144 | return 1; |
10145 | } |
10146 | if (tmp == NULL) { Branch (10146:9): [True: 0, False: 635]
|
10147 | PyErr_SetString(PyExc_TypeError, "required field \"target\" missing from comprehension"); |
10148 | return 1; |
10149 | } |
10150 | else { |
10151 | int res; |
10152 | if (_Py_EnterRecursiveCall(" while traversing 'comprehension' node")) { Branch (10152:13): [True: 0, False: 635]
|
10153 | goto failed; |
10154 | } |
10155 | res = obj2ast_expr(state, tmp, &target, arena); |
10156 | _Py_LeaveRecursiveCall(); |
10157 | if (res != 0) goto failed0 ; Branch (10157:13): [True: 0, False: 635]
|
10158 | Py_CLEAR(tmp); |
10159 | } |
10160 | if (_PyObject_LookupAttr(obj, state->iter, &tmp) < 0) { Branch (10160:9): [True: 0, False: 635]
|
10161 | return 1; |
10162 | } |
10163 | if (tmp == NULL) { Branch (10163:9): [True: 0, False: 635]
|
10164 | PyErr_SetString(PyExc_TypeError, "required field \"iter\" missing from comprehension"); |
10165 | return 1; |
10166 | } |
10167 | else { |
10168 | int res; |
10169 | if (_Py_EnterRecursiveCall(" while traversing 'comprehension' node")) { Branch (10169:13): [True: 0, False: 635]
|
10170 | goto failed; |
10171 | } |
10172 | res = obj2ast_expr(state, tmp, &iter, arena); |
10173 | _Py_LeaveRecursiveCall(); |
10174 | if (res != 0) goto failed0 ; Branch (10174:13): [True: 0, False: 635]
|
10175 | Py_CLEAR(tmp); |
10176 | } |
10177 | if (_PyObject_LookupAttr(obj, state->ifs, &tmp) < 0) { Branch (10177:9): [True: 0, False: 635]
|
10178 | return 1; |
10179 | } |
10180 | if (tmp == NULL) { Branch (10180:9): [True: 0, False: 635]
|
10181 | PyErr_SetString(PyExc_TypeError, "required field \"ifs\" missing from comprehension"); |
10182 | return 1; |
10183 | } |
10184 | else { |
10185 | int res; |
10186 | Py_ssize_t len; |
10187 | Py_ssize_t i; |
10188 | if (!PyList_Check(tmp)) { Branch (10188:13): [True: 0, False: 635]
|
10189 | PyErr_Format(PyExc_TypeError, "comprehension field \"ifs\" must be a list, not a %.200s", _PyType_Name(Py_TYPE(tmp))); |
10190 | goto failed; |
10191 | } |
10192 | len = PyList_GET_SIZE(tmp); |
10193 | ifs = _Py_asdl_expr_seq_new(len, arena); |
10194 | if (ifs == NULL) goto failed0 ; Branch (10194:13): [True: 0, False: 635]
|
10195 | for (i = 0; 635 i < len; i++161 ) { Branch (10195:21): [True: 161, False: 635]
|
10196 | expr_ty val; |
10197 | PyObject *tmp2 = PyList_GET_ITEM(tmp, i); |
10198 | Py_INCREF(tmp2); |
10199 | if (_Py_EnterRecursiveCall(" while traversing 'comprehension' node")) { Branch (10199:17): [True: 0, False: 161]
|
10200 | goto failed; |
10201 | } |
10202 | res = obj2ast_expr(state, tmp2, &val, arena); |
10203 | _Py_LeaveRecursiveCall(); |
10204 | Py_DECREF(tmp2); |
10205 | if (res != 0) goto failed0 ; Branch (10205:17): [True: 0, False: 161]
|
10206 | if (len != PyList_GET_SIZE(tmp)) { Branch (10206:17): [True: 0, False: 161]
|
10207 | PyErr_SetString(PyExc_RuntimeError, "comprehension field \"ifs\" changed size during iteration"); |
10208 | goto failed; |
10209 | } |
10210 | asdl_seq_SET(ifs, i, val); |
10211 | } |
10212 | Py_CLEAR(tmp); |
10213 | } |
10214 | if (_PyObject_LookupAttr(obj, state->is_async, &tmp) < 0) { Branch (10214:9): [True: 0, False: 635]
|
10215 | return 1; |
10216 | } |
10217 | if (tmp == NULL) { Branch (10217:9): [True: 0, False: 635]
|
10218 | PyErr_SetString(PyExc_TypeError, "required field \"is_async\" missing from comprehension"); |
10219 | return 1; |
10220 | } |
10221 | else { |
10222 | int res; |
10223 | if (_Py_EnterRecursiveCall(" while traversing 'comprehension' node")) { Branch (10223:13): [True: 0, False: 635]
|
10224 | goto failed; |
10225 | } |
10226 | res = obj2ast_int(state, tmp, &is_async, arena); |
10227 | _Py_LeaveRecursiveCall(); |
10228 | if (res != 0) goto failed0 ; Branch (10228:13): [True: 0, False: 635]
|
10229 | Py_CLEAR(tmp); |
10230 | } |
10231 | *out = _PyAST_comprehension(target, iter, ifs, is_async, arena); |
10232 | return 0; |
10233 | failed: |
10234 | Py_XDECREF(tmp); |
10235 | return 1; |
10236 | } |
10237 | |
10238 | int |
10239 | obj2ast_excepthandler(struct ast_state *state, PyObject* obj, excepthandler_ty* |
10240 | out, PyArena* arena) |
10241 | { |
10242 | int isinstance; |
10243 | |
10244 | PyObject *tmp = NULL; |
10245 | PyObject *tp; |
10246 | int lineno; |
10247 | int col_offset; |
10248 | int end_lineno; |
10249 | int end_col_offset; |
10250 | |
10251 | if (obj == Py_None) { Branch (10251:9): [True: 0, False: 1.41k]
|
10252 | *out = NULL; |
10253 | return 0; |
10254 | } |
10255 | if (_PyObject_LookupAttr(obj, state->lineno, &tmp) < 0) { Branch (10255:9): [True: 0, False: 1.41k]
|
10256 | return 1; |
10257 | } |
10258 | if (tmp == NULL) { Branch (10258:9): [True: 0, False: 1.41k]
|
10259 | PyErr_SetString(PyExc_TypeError, "required field \"lineno\" missing from excepthandler"); |
10260 | return 1; |
10261 | } |
10262 | else { |
10263 | int res; |
10264 | if (_Py_EnterRecursiveCall(" while traversing 'excepthandler' node")) { Branch (10264:13): [True: 0, False: 1.41k]
|
10265 | goto failed; |
10266 | } |
10267 | res = obj2ast_int(state, tmp, &lineno, arena); |
10268 | _Py_LeaveRecursiveCall(); |
10269 | if (res != 0) goto failed0 ; Branch (10269:13): [True: 0, False: 1.41k]
|
10270 | Py_CLEAR(tmp); |
10271 | } |
10272 | if (_PyObject_LookupAttr(obj, state->col_offset, &tmp) < 0) { Branch (10272:9): [True: 0, False: 1.41k]
|
10273 | return 1; |
10274 | } |
10275 | if (tmp == NULL) { Branch (10275:9): [True: 0, False: 1.41k]
|
10276 | PyErr_SetString(PyExc_TypeError, "required field \"col_offset\" missing from excepthandler"); |
10277 | return 1; |
10278 | } |
10279 | else { |
10280 | int res; |
10281 | if (_Py_EnterRecursiveCall(" while traversing 'excepthandler' node")) { Branch (10281:13): [True: 0, False: 1.41k]
|
10282 | goto failed; |
10283 | } |
10284 | res = obj2ast_int(state, tmp, &col_offset, arena); |
10285 | _Py_LeaveRecursiveCall(); |
10286 | if (res != 0) goto failed0 ; Branch (10286:13): [True: 0, False: 1.41k]
|
10287 | Py_CLEAR(tmp); |
10288 | } |
10289 | if (_PyObject_LookupAttr(obj, state->end_lineno, &tmp) < 0) { Branch (10289:9): [True: 0, False: 1.41k]
|
10290 | return 1; |
10291 | } |
10292 | if (tmp == NULL || tmp == Py_None) { Branch (10292:9): [True: 0, False: 1.41k]
Branch (10292:24): [True: 0, False: 1.41k]
|
10293 | Py_CLEAR(tmp); |
10294 | end_lineno = lineno; |
10295 | } |
10296 | else { |
10297 | int res; |
10298 | if (_Py_EnterRecursiveCall(" while traversing 'excepthandler' node")) { Branch (10298:13): [True: 0, False: 1.41k]
|
10299 | goto failed; |
10300 | } |
10301 | res = obj2ast_int(state, tmp, &end_lineno, arena); |
10302 | _Py_LeaveRecursiveCall(); |
10303 | if (res != 0) goto failed0 ; Branch (10303:13): [True: 0, False: 1.41k]
|
10304 | Py_CLEAR(tmp); |
10305 | } |
10306 | if (_PyObject_LookupAttr(obj, state->end_col_offset, &tmp) < 0) { Branch (10306:9): [True: 0, False: 1.41k]
|
10307 | return 1; |
10308 | } |
10309 | if (tmp == NULL || tmp == Py_None) { Branch (10309:9): [True: 0, False: 1.41k]
Branch (10309:24): [True: 0, False: 1.41k]
|
10310 | Py_CLEAR(tmp); |
10311 | end_col_offset = col_offset; |
10312 | } |
10313 | else { |
10314 | int res; |
10315 | if (_Py_EnterRecursiveCall(" while traversing 'excepthandler' node")) { Branch (10315:13): [True: 0, False: 1.41k]
|
10316 | goto failed; |
10317 | } |
10318 | res = obj2ast_int(state, tmp, &end_col_offset, arena); |
10319 | _Py_LeaveRecursiveCall(); |
10320 | if (res != 0) goto failed0 ; Branch (10320:13): [True: 0, False: 1.41k]
|
10321 | Py_CLEAR(tmp); |
10322 | } |
10323 | tp = state->ExceptHandler_type; |
10324 | isinstance = PyObject_IsInstance(obj, tp); |
10325 | if (isinstance == -1) { Branch (10325:9): [True: 0, False: 1.41k]
|
10326 | return 1; |
10327 | } |
10328 | if (isinstance) { Branch (10328:9): [True: 1.41k, False: 0]
|
10329 | expr_ty type; |
10330 | identifier name; |
10331 | asdl_stmt_seq* body; |
10332 | |
10333 | if (_PyObject_LookupAttr(obj, state->type, &tmp) < 0) { Branch (10333:13): [True: 0, False: 1.41k]
|
10334 | return 1; |
10335 | } |
10336 | if (tmp == NULL || tmp == Py_None) { Branch (10336:13): [True: 0, False: 1.41k]
Branch (10336:28): [True: 96, False: 1.31k]
|
10337 | Py_CLEAR(tmp); |
10338 | type = NULL; |
10339 | } |
10340 | else { |
10341 | int res; |
10342 | if (_Py_EnterRecursiveCall(" while traversing 'ExceptHandler' node")) { Branch (10342:17): [True: 0, False: 1.31k]
|
10343 | goto failed; |
10344 | } |
10345 | res = obj2ast_expr(state, tmp, &type, arena); |
10346 | _Py_LeaveRecursiveCall(); |
10347 | if (res != 0) goto failed0 ; Branch (10347:17): [True: 0, False: 1.31k]
|
10348 | Py_CLEAR(tmp); |
10349 | } |
10350 | if (_PyObject_LookupAttr(obj, state->name, &tmp) < 0) { Branch (10350:13): [True: 0, False: 1.41k]
|
10351 | return 1; |
10352 | } |
10353 | if (tmp == NULL || tmp == Py_None) { Branch (10353:13): [True: 0, False: 1.41k]
Branch (10353:28): [True: 1.17k, False: 234]
|
10354 | Py_CLEAR(tmp); |
10355 | name = NULL; |
10356 | } |
10357 | else { |
10358 | int res; |
10359 | if (_Py_EnterRecursiveCall(" while traversing 'ExceptHandler' node")) { Branch (10359:17): [True: 0, False: 234]
|
10360 | goto failed; |
10361 | } |
10362 | res = obj2ast_identifier(state, tmp, &name, arena); |
10363 | _Py_LeaveRecursiveCall(); |
10364 | if (res != 0) goto failed0 ; Branch (10364:17): [True: 0, False: 234]
|
10365 | Py_CLEAR(tmp); |
10366 | } |
10367 | if (_PyObject_LookupAttr(obj, state->body, &tmp) < 0) { Branch (10367:13): [True: 0, False: 1.41k]
|
10368 | return 1; |
10369 | } |
10370 | if (tmp == NULL) { Branch (10370:13): [True: 0, False: 1.41k]
|
10371 | PyErr_SetString(PyExc_TypeError, "required field \"body\" missing from ExceptHandler"); |
10372 | return 1; |
10373 | } |
10374 | else { |
10375 | int res; |
10376 | Py_ssize_t len; |
10377 | Py_ssize_t i; |
10378 | if (!PyList_Check(tmp)) { Branch (10378:17): [True: 0, False: 1.41k]
|
10379 | PyErr_Format(PyExc_TypeError, "ExceptHandler field \"body\" must be a list, not a %.200s", _PyType_Name(Py_TYPE(tmp))); |
10380 | goto failed; |
10381 | } |
10382 | len = PyList_GET_SIZE(tmp); |
10383 | body = _Py_asdl_stmt_seq_new(len, arena); |
10384 | if (body == NULL) goto failed0 ; Branch (10384:17): [True: 0, False: 1.41k]
|
10385 | for (i = 0; 1.41k i < len; i++1.87k ) { Branch (10385:25): [True: 1.87k, False: 1.41k]
|
10386 | stmt_ty val; |
10387 | PyObject *tmp2 = PyList_GET_ITEM(tmp, i); |
10388 | Py_INCREF(tmp2); |
10389 | if (_Py_EnterRecursiveCall(" while traversing 'ExceptHandler' node")) { Branch (10389:21): [True: 0, False: 1.87k]
|
10390 | goto failed; |
10391 | } |
10392 | res = obj2ast_stmt(state, tmp2, &val, arena); |
10393 | _Py_LeaveRecursiveCall(); |
10394 | Py_DECREF(tmp2); |
10395 | if (res != 0) goto failed0 ; Branch (10395:21): [True: 0, False: 1.87k]
|
10396 | if (len != PyList_GET_SIZE(tmp)) { Branch (10396:21): [True: 0, False: 1.87k]
|
10397 | PyErr_SetString(PyExc_RuntimeError, "ExceptHandler field \"body\" changed size during iteration"); |
10398 | goto failed; |
10399 | } |
10400 | asdl_seq_SET(body, i, val); |
10401 | } |
10402 | Py_CLEAR(tmp); |
10403 | } |
10404 | *out = _PyAST_ExceptHandler(type, name, body, lineno, col_offset, |
10405 | end_lineno, end_col_offset, arena); |
10406 | if (*out == NULL) goto failed0 ; Branch (10406:13): [True: 0, False: 1.41k]
|
10407 | return 0; |
10408 | } |
10409 | |
10410 | PyErr_Format(PyExc_TypeError, "expected some sort of excepthandler, but got %R", obj); |
10411 | failed: |
10412 | Py_XDECREF(tmp); |
10413 | return 1; |
10414 | } |
10415 | |
10416 | int |
10417 | obj2ast_arguments(struct ast_state *state, PyObject* obj, arguments_ty* out, |
10418 | PyArena* arena) |
10419 | { |
10420 | PyObject* tmp = NULL; |
10421 | asdl_arg_seq* posonlyargs; |
10422 | asdl_arg_seq* args; |
10423 | arg_ty vararg; |
10424 | asdl_arg_seq* kwonlyargs; |
10425 | asdl_expr_seq* kw_defaults; |
10426 | arg_ty kwarg; |
10427 | asdl_expr_seq* defaults; |
10428 | |
10429 | if (_PyObject_LookupAttr(obj, state->posonlyargs, &tmp) < 0) { Branch (10429:9): [True: 0, False: 7.60k]
|
10430 | return 1; |
10431 | } |
10432 | if (tmp == NULL) { Branch (10432:9): [True: 0, False: 7.60k]
|
10433 | PyErr_SetString(PyExc_TypeError, "required field \"posonlyargs\" missing from arguments"); |
10434 | return 1; |
10435 | } |
10436 | else { |
10437 | int res; |
10438 | Py_ssize_t len; |
10439 | Py_ssize_t i; |
10440 | if (!PyList_Check(tmp)) { Branch (10440:13): [True: 0, False: 7.60k]
|
10441 | PyErr_Format(PyExc_TypeError, "arguments field \"posonlyargs\" must be a list, not a %.200s", _PyType_Name(Py_TYPE(tmp))); |
10442 | goto failed; |
10443 | } |
10444 | len = PyList_GET_SIZE(tmp); |
10445 | posonlyargs = _Py_asdl_arg_seq_new(len, arena); |
10446 | if (posonlyargs == NULL) goto failed0 ; Branch (10446:13): [True: 0, False: 7.60k]
|
10447 | for (i = 0; 7.60k i < len; i++119 ) { Branch (10447:21): [True: 119, False: 7.60k]
|
10448 | arg_ty val; |
10449 | PyObject *tmp2 = PyList_GET_ITEM(tmp, i); |
10450 | Py_INCREF(tmp2); |
10451 | if (_Py_EnterRecursiveCall(" while traversing 'arguments' node")) { Branch (10451:17): [True: 0, False: 119]
|
10452 | goto failed; |
10453 | } |
10454 | res = obj2ast_arg(state, tmp2, &val, arena); |
10455 | _Py_LeaveRecursiveCall(); |
10456 | Py_DECREF(tmp2); |
10457 | if (res != 0) goto failed0 ; Branch (10457:17): [True: 0, False: 119]
|
10458 | if (len != PyList_GET_SIZE(tmp)) { Branch (10458:17): [True: 0, False: 119]
|
10459 | PyErr_SetString(PyExc_RuntimeError, "arguments field \"posonlyargs\" changed size during iteration"); |
10460 | goto failed; |
10461 | } |
10462 | asdl_seq_SET(posonlyargs, i, val); |
10463 | } |
10464 | Py_CLEAR(tmp); |
10465 | } |
10466 | if (_PyObject_LookupAttr(obj, state->args, &tmp) < 0) { Branch (10466:9): [True: 0, False: 7.60k]
|
10467 | return 1; |
10468 | } |
10469 | if (tmp == NULL) { Branch (10469:9): [True: 0, False: 7.60k]
|
10470 | PyErr_SetString(PyExc_TypeError, "required field \"args\" missing from arguments"); |
10471 | return 1; |
10472 | } |
10473 | else { |
10474 | int res; |
10475 | Py_ssize_t len; |
10476 | Py_ssize_t i; |
10477 | if (!PyList_Check(tmp)) { Branch (10477:13): [True: 0, False: 7.60k]
|
10478 | PyErr_Format(PyExc_TypeError, "arguments field \"args\" must be a list, not a %.200s", _PyType_Name(Py_TYPE(tmp))); |
10479 | goto failed; |
10480 | } |
10481 | len = PyList_GET_SIZE(tmp); |
10482 | args = _Py_asdl_arg_seq_new(len, arena); |
10483 | if (args == NULL) goto failed0 ; Branch (10483:13): [True: 0, False: 7.60k]
|
10484 | for (i = 0; 7.60k i < len; i++14.1k ) { Branch (10484:21): [True: 14.1k, False: 7.60k]
|
10485 | arg_ty val; |
10486 | PyObject *tmp2 = PyList_GET_ITEM(tmp, i); |
10487 | Py_INCREF(tmp2); |
10488 | if (_Py_EnterRecursiveCall(" while traversing 'arguments' node")) { Branch (10488:17): [True: 0, False: 14.1k]
|
10489 | goto failed; |
10490 | } |
10491 | res = obj2ast_arg(state, tmp2, &val, arena); |
10492 | _Py_LeaveRecursiveCall(); |
10493 | Py_DECREF(tmp2); |
10494 | if (res != 0) goto failed0 ; Branch (10494:17): [True: 0, False: 14.1k]
|
10495 | if (len != PyList_GET_SIZE(tmp)) { Branch (10495:17): [True: 0, False: 14.1k]
|
10496 | PyErr_SetString(PyExc_RuntimeError, "arguments field \"args\" changed size during iteration"); |
10497 | goto failed; |
10498 | } |
10499 | asdl_seq_SET(args, i, val); |
10500 | } |
10501 | Py_CLEAR(tmp); |
10502 | } |
10503 | if (_PyObject_LookupAttr(obj, state->vararg, &tmp) < 0) { Branch (10503:9): [True: 0, False: 7.60k]
|
10504 | return 1; |
10505 | } |
10506 | if (tmp == NULL || tmp == Py_None) { Branch (10506:9): [True: 0, False: 7.60k]
Branch (10506:24): [True: 7.32k, False: 283]
|
10507 | Py_CLEAR(tmp); |
10508 | vararg = NULL; |
10509 | } |
10510 | else { |
10511 | int res; |
10512 | if (_Py_EnterRecursiveCall(" while traversing 'arguments' node")) { Branch (10512:13): [True: 0, False: 283]
|
10513 | goto failed; |
10514 | } |
10515 | res = obj2ast_arg(state, tmp, &vararg, arena); |
10516 | _Py_LeaveRecursiveCall(); |
10517 | if (res != 0) goto failed0 ; Branch (10517:13): [True: 0, False: 283]
|
10518 | Py_CLEAR(tmp); |
10519 | } |
10520 | if (_PyObject_LookupAttr(obj, state->kwonlyargs, &tmp) < 0) { Branch (10520:9): [True: 0, False: 7.60k]
|
10521 | return 1; |
10522 | } |
10523 | if (tmp == NULL) { Branch (10523:9): [True: 0, False: 7.60k]
|
10524 | PyErr_SetString(PyExc_TypeError, "required field \"kwonlyargs\" missing from arguments"); |
10525 | return 1; |
10526 | } |
10527 | else { |
10528 | int res; |
10529 | Py_ssize_t len; |
10530 | Py_ssize_t i; |
10531 | if (!PyList_Check(tmp)) { Branch (10531:13): [True: 0, False: 7.60k]
|
10532 | PyErr_Format(PyExc_TypeError, "arguments field \"kwonlyargs\" must be a list, not a %.200s", _PyType_Name(Py_TYPE(tmp))); |
10533 | goto failed; |
10534 | } |
10535 | len = PyList_GET_SIZE(tmp); |
10536 | kwonlyargs = _Py_asdl_arg_seq_new(len, arena); |
10537 | if (kwonlyargs == NULL) goto failed0 ; Branch (10537:13): [True: 0, False: 7.60k]
|
10538 | for (i = 0; 7.60k i < len; i++475 ) { Branch (10538:21): [True: 475, False: 7.60k]
|
10539 | arg_ty val; |
10540 | PyObject *tmp2 = PyList_GET_ITEM(tmp, i); |
10541 | Py_INCREF(tmp2); |
10542 | if (_Py_EnterRecursiveCall(" while traversing 'arguments' node")) { Branch (10542:17): [True: 0, False: 475]
|
10543 | goto failed; |
10544 | } |
10545 | res = obj2ast_arg(state, tmp2, &val, arena); |
10546 | _Py_LeaveRecursiveCall(); |
10547 | Py_DECREF(tmp2); |
10548 | if (res != 0) goto failed0 ; Branch (10548:17): [True: 0, False: 475]
|
10549 | if (len != PyList_GET_SIZE(tmp)) { Branch (10549:17): [True: 0, False: 475]
|
10550 | PyErr_SetString(PyExc_RuntimeError, "arguments field \"kwonlyargs\" changed size during iteration"); |
10551 | goto failed; |
10552 | } |
10553 | asdl_seq_SET(kwonlyargs, i, val); |
10554 | } |
10555 | Py_CLEAR(tmp); |
10556 | } |
10557 | if (_PyObject_LookupAttr(obj, state->kw_defaults, &tmp) < 0) { Branch (10557:9): [True: 0, False: 7.60k]
|
10558 | return 1; |
10559 | } |
10560 | if (tmp == NULL) { Branch (10560:9): [True: 0, False: 7.60k]
|
10561 | PyErr_SetString(PyExc_TypeError, "required field \"kw_defaults\" missing from arguments"); |
10562 | return 1; |
10563 | } |
10564 | else { |
10565 | int res; |
10566 | Py_ssize_t len; |
10567 | Py_ssize_t i; |
10568 | if (!PyList_Check(tmp)) { Branch (10568:13): [True: 0, False: 7.60k]
|
10569 | PyErr_Format(PyExc_TypeError, "arguments field \"kw_defaults\" must be a list, not a %.200s", _PyType_Name(Py_TYPE(tmp))); |
10570 | goto failed; |
10571 | } |
10572 | len = PyList_GET_SIZE(tmp); |
10573 | kw_defaults = _Py_asdl_expr_seq_new(len, arena); |
10574 | if (kw_defaults == NULL) goto failed0 ; Branch (10574:13): [True: 0, False: 7.60k]
|
10575 | for (i = 0; 7.60k i < len; i++475 ) { Branch (10575:21): [True: 475, False: 7.60k]
|
10576 | expr_ty val; |
10577 | PyObject *tmp2 = PyList_GET_ITEM(tmp, i); |
10578 | Py_INCREF(tmp2); |
10579 | if (_Py_EnterRecursiveCall(" while traversing 'arguments' node")) { Branch (10579:17): [True: 0, False: 475]
|
10580 | goto failed; |
10581 | } |
10582 | res = obj2ast_expr(state, tmp2, &val, arena); |
10583 | _Py_LeaveRecursiveCall(); |
10584 | Py_DECREF(tmp2); |
10585 | if (res != 0) goto failed0 ; Branch (10585:17): [True: 0, False: 475]
|
10586 | if (len != PyList_GET_SIZE(tmp)) { Branch (10586:17): [True: 0, False: 475]
|
10587 | PyErr_SetString(PyExc_RuntimeError, "arguments field \"kw_defaults\" changed size during iteration"); |
10588 | goto failed; |
10589 | } |
10590 | asdl_seq_SET(kw_defaults, i, val); |
10591 | } |
10592 | Py_CLEAR(tmp); |
10593 | } |
10594 | if (_PyObject_LookupAttr(obj, state->kwarg, &tmp) < 0) { Branch (10594:9): [True: 0, False: 7.60k]
|
10595 | return 1; |
10596 | } |
10597 | if (tmp == NULL || tmp == Py_None) { Branch (10597:9): [True: 0, False: 7.60k]
Branch (10597:24): [True: 7.43k, False: 173]
|
10598 | Py_CLEAR(tmp); |
10599 | kwarg = NULL; |
10600 | } |
10601 | else { |
10602 | int res; |
10603 | if (_Py_EnterRecursiveCall(" while traversing 'arguments' node")) { Branch (10603:13): [True: 0, False: 173]
|
10604 | goto failed; |
10605 | } |
10606 | res = obj2ast_arg(state, tmp, &kwarg, arena); |
10607 | _Py_LeaveRecursiveCall(); |
10608 | if (res != 0) goto failed0 ; Branch (10608:13): [True: 0, False: 173]
|
10609 | Py_CLEAR(tmp); |
10610 | } |
10611 | if (_PyObject_LookupAttr(obj, state->defaults, &tmp) < 0) { Branch (10611:9): [True: 0, False: 7.60k]
|
10612 | return 1; |
10613 | } |
10614 | if (tmp == NULL) { Branch (10614:9): [True: 0, False: 7.60k]
|
10615 | PyErr_SetString(PyExc_TypeError, "required field \"defaults\" missing from arguments"); |
10616 | return 1; |
10617 | } |
10618 | else { |
10619 | int res; |
10620 | Py_ssize_t len; |
10621 | Py_ssize_t i; |
10622 | if (!PyList_Check(tmp)) { Branch (10622:13): [True: 0, False: 7.60k]
|
10623 | PyErr_Format(PyExc_TypeError, "arguments field \"defaults\" must be a list, not a %.200s", _PyType_Name(Py_TYPE(tmp))); |
10624 | goto failed; |
10625 | } |
10626 | len = PyList_GET_SIZE(tmp); |
10627 | defaults = _Py_asdl_expr_seq_new(len, arena); |
10628 | if (defaults == NULL) goto failed0 ; Branch (10628:13): [True: 0, False: 7.60k]
|
10629 | for (i = 0; 7.60k i < len; i++2.42k ) { Branch (10629:21): [True: 2.42k, False: 7.60k]
|
10630 | expr_ty val; |
10631 | PyObject *tmp2 = PyList_GET_ITEM(tmp, i); |
10632 | Py_INCREF(tmp2); |
10633 | if (_Py_EnterRecursiveCall(" while traversing 'arguments' node")) { Branch (10633:17): [True: 0, False: 2.42k]
|
10634 | goto failed; |
10635 | } |
10636 | res = obj2ast_expr(state, tmp2, &val, arena); |
10637 | _Py_LeaveRecursiveCall(); |
10638 | Py_DECREF(tmp2); |
10639 | if (res != 0) goto failed0 ; Branch (10639:17): [True: 0, False: 2.42k]
|
10640 | if (len != PyList_GET_SIZE(tmp)) { Branch (10640:17): [True: 0, False: 2.42k]
|
10641 | PyErr_SetString(PyExc_RuntimeError, "arguments field \"defaults\" changed size during iteration"); |
10642 | goto failed; |
10643 | } |
10644 | asdl_seq_SET(defaults, i, val); |
10645 | } |
10646 | Py_CLEAR(tmp); |
10647 | } |
10648 | *out = _PyAST_arguments(posonlyargs, args, vararg, kwonlyargs, kw_defaults, |
10649 | kwarg, defaults, arena); |
10650 | return 0; |
10651 | failed: |
10652 | Py_XDECREF(tmp); |
10653 | return 1; |
10654 | } |
10655 | |
10656 | int |
10657 | obj2ast_arg(struct ast_state *state, PyObject* obj, arg_ty* out, PyArena* arena) |
10658 | { |
10659 | PyObject* tmp = NULL; |
10660 | identifier arg; |
10661 | expr_ty annotation; |
10662 | string type_comment; |
10663 | int lineno; |
10664 | int col_offset; |
10665 | int end_lineno; |
10666 | int end_col_offset; |
10667 | |
10668 | if (_PyObject_LookupAttr(obj, state->arg, &tmp) < 0) { Branch (10668:9): [True: 0, False: 15.1k]
|
10669 | return 1; |
10670 | } |
10671 | if (tmp == NULL) { Branch (10671:9): [True: 0, False: 15.1k]
|
10672 | PyErr_SetString(PyExc_TypeError, "required field \"arg\" missing from arg"); |
10673 | return 1; |
10674 | } |
10675 | else { |
10676 | int res; |
10677 | if (_Py_EnterRecursiveCall(" while traversing 'arg' node")) { Branch (10677:13): [True: 0, False: 15.1k]
|
10678 | goto failed; |
10679 | } |
10680 | res = obj2ast_identifier(state, tmp, &arg, arena); |
10681 | _Py_LeaveRecursiveCall(); |
10682 | if (res != 0) goto failed0 ; Branch (10682:13): [True: 0, False: 15.1k]
|
10683 | Py_CLEAR(tmp); |
10684 | } |
10685 | if (_PyObject_LookupAttr(obj, state->annotation, &tmp) < 0) { Branch (10685:9): [True: 0, False: 15.1k]
|
10686 | return 1; |
10687 | } |
10688 | if (tmp == NULL || tmp == Py_None) { Branch (10688:9): [True: 0, False: 15.1k]
Branch (10688:24): [True: 15.1k, False: 76]
|
10689 | Py_CLEAR(tmp); |
10690 | annotation = NULL; |
10691 | } |
10692 | else { |
10693 | int res; |
10694 | if (_Py_EnterRecursiveCall(" while traversing 'arg' node")) { |
10695 | goto failed; |
10696 | } |
10697 | res = obj2ast_expr(state, tmp, &annotation, arena); |
10698 | _Py_LeaveRecursiveCall(); |
10699 | if (res != 0) goto failed0 ; |
10700 | Py_CLEAR(tmp); |
10701 | } |
10702 | if (_PyObject_LookupAttr(obj, state->type_comment, &tmp) < 0) { Branch (10702:9): [True: 0, False: 15.1k]
|
10703 | return 1; |
10704 | } |
10705 | if (tmp == NULL || tmp == Py_None) { Branch (10705:9): [True: 0, False: 15.1k]
Branch (10705:24): [True: 15.1k, False: 0]
|
10706 | Py_CLEAR(tmp); |
10707 | type_comment = NULL; |
10708 | } |
10709 | else { |
10710 | int res; |
10711 | if (_Py_EnterRecursiveCall(" while traversing 'arg' node")) { |
10712 | goto failed; |
10713 | } |
10714 | res = obj2ast_string(state, tmp, &type_comment, arena); |
10715 | _Py_LeaveRecursiveCall(); |
10716 | if (res != 0) goto failed; |
10717 | Py_CLEAR(tmp); |
10718 | } |
10719 | if (_PyObject_LookupAttr(obj, state->lineno, &tmp) < 0) { Branch (10719:9): [True: 0, False: 15.1k]
|
10720 | return 1; |
10721 | } |
10722 | if (tmp == NULL) { Branch (10722:9): [True: 0, False: 15.1k]
|
10723 | PyErr_SetString(PyExc_TypeError, "required field \"lineno\" missing from arg"); |
10724 | return 1; |
10725 | } |
10726 | else { |
10727 | int res; |
10728 | if (_Py_EnterRecursiveCall(" while traversing 'arg' node")) { Branch (10728:13): [True: 0, False: 15.1k]
|
10729 | goto failed; |
10730 | } |
10731 | res = obj2ast_int(state, tmp, &lineno, arena); |
10732 | _Py_LeaveRecursiveCall(); |
10733 | if (res != 0) goto failed0 ; Branch (10733:13): [True: 0, False: 15.1k]
|
10734 | Py_CLEAR(tmp); |
10735 | } |
10736 | if (_PyObject_LookupAttr(obj, state->col_offset, &tmp) < 0) { Branch (10736:9): [True: 0, False: 15.1k]
|
10737 | return 1; |
10738 | } |
10739 | if (tmp == NULL) { Branch (10739:9): [True: 0, False: 15.1k]
|
10740 | PyErr_SetString(PyExc_TypeError, "required field \"col_offset\" missing from arg"); |
10741 | return 1; |
10742 | } |
10743 | else { |
10744 | int res; |
10745 | if (_Py_EnterRecursiveCall(" while traversing 'arg' node")) { Branch (10745:13): [True: 0, False: 15.1k]
|
10746 | goto failed; |
10747 | } |
10748 | res = obj2ast_int(state, tmp, &col_offset, arena); |
10749 | _Py_LeaveRecursiveCall(); |
10750 | if (res != 0) goto failed0 ; Branch (10750:13): [True: 0, False: 15.1k]
|
10751 | Py_CLEAR(tmp); |
10752 | } |
10753 | if (_PyObject_LookupAttr(obj, state->end_lineno, &tmp) < 0) { Branch (10753:9): [True: 0, False: 15.1k]
|
10754 | return 1; |
10755 | } |
10756 | if (tmp == NULL || tmp == Py_None) { Branch (10756:9): [True: 0, False: 15.1k]
Branch (10756:24): [True: 0, False: 15.1k]
|
10757 | Py_CLEAR(tmp); |
10758 | end_lineno = lineno; |
10759 | } |
10760 | else { |
10761 | int res; |
10762 | if (_Py_EnterRecursiveCall(" while traversing 'arg' node")) { Branch (10762:13): [True: 0, False: 15.1k]
|
10763 | goto failed; |
10764 | } |
10765 | res = obj2ast_int(state, tmp, &end_lineno, arena); |
10766 | _Py_LeaveRecursiveCall(); |
10767 | if (res != 0) goto failed0 ; Branch (10767:13): [True: 0, False: 15.1k]
|
10768 | Py_CLEAR(tmp); |
10769 | } |
10770 | if (_PyObject_LookupAttr(obj, state->end_col_offset, &tmp) < 0) { Branch (10770:9): [True: 0, False: 15.1k]
|
10771 | return 1; |
10772 | } |
10773 | if (tmp == NULL || tmp == Py_None) { Branch (10773:9): [True: 0, False: 15.1k]
Branch (10773:24): [True: 0, False: 15.1k]
|
10774 | Py_CLEAR(tmp); |
10775 | end_col_offset = col_offset; |
10776 | } |
10777 | else { |
10778 | int res; |
10779 | if (_Py_EnterRecursiveCall(" while traversing 'arg' node")) { Branch (10779:13): [True: 0, False: 15.1k]
|
10780 | goto failed; |
10781 | } |
10782 | res = obj2ast_int(state, tmp, &end_col_offset, arena); |
10783 | _Py_LeaveRecursiveCall(); |
10784 | if (res != 0) goto failed0 ; Branch (10784:13): [True: 0, False: 15.1k]
|
10785 | Py_CLEAR(tmp); |
10786 | } |
10787 | *out = _PyAST_arg(arg, annotation, type_comment, lineno, col_offset, |
10788 | end_lineno, end_col_offset, arena); |
10789 | return 0; |
10790 | failed: |
10791 | Py_XDECREF(tmp); |
10792 | return 1; |
10793 | } |
10794 | |
10795 | int |
10796 | obj2ast_keyword(struct ast_state *state, PyObject* obj, keyword_ty* out, |
10797 | PyArena* arena) |
10798 | { |
10799 | PyObject* tmp = NULL; |
10800 | identifier arg; |
10801 | expr_ty value; |
10802 | int lineno; |
10803 | int col_offset; |
10804 | int end_lineno; |
10805 | int end_col_offset; |
10806 | |
10807 | if (_PyObject_LookupAttr(obj, state->arg, &tmp) < 0) { Branch (10807:9): [True: 0, False: 3.31k]
|
10808 | return 1; |
10809 | } |
10810 | if (tmp == NULL || tmp == Py_None) { Branch (10810:9): [True: 0, False: 3.31k]
Branch (10810:24): [True: 154, False: 3.15k]
|
10811 | Py_CLEAR(tmp); |
10812 | arg = NULL; |
10813 | } |
10814 | else { |
10815 | int res; |
10816 | if (_Py_EnterRecursiveCall(" while traversing 'keyword' node")) { Branch (10816:13): [True: 0, False: 3.15k]
|
10817 | goto failed; |
10818 | } |
10819 | res = obj2ast_identifier(state, tmp, &arg, arena); |
10820 | _Py_LeaveRecursiveCall(); |
10821 | if (res != 0) goto failed0 ; Branch (10821:13): [True: 0, False: 3.15k]
|
10822 | Py_CLEAR(tmp); |
10823 | } |
10824 | if (_PyObject_LookupAttr(obj, state->value, &tmp) < 0) { Branch (10824:9): [True: 0, False: 3.31k]
|
10825 | return 1; |
10826 | } |
10827 | if (tmp == NULL) { Branch (10827:9): [True: 0, False: 3.31k]
|
10828 | PyErr_SetString(PyExc_TypeError, "required field \"value\" missing from keyword"); |
10829 | return 1; |
10830 | } |
10831 | else { |
10832 | int res; |
10833 | if (_Py_EnterRecursiveCall(" while traversing 'keyword' node")) { Branch (10833:13): [True: 0, False: 3.31k]
|
10834 | goto failed; |
10835 | } |
10836 | res = obj2ast_expr(state, tmp, &value, arena); |
10837 | _Py_LeaveRecursiveCall(); |
10838 | if (res != 0) goto failed0 ; Branch (10838:13): [True: 0, False: 3.31k]
|
10839 | Py_CLEAR(tmp); |
10840 | } |
10841 | if (_PyObject_LookupAttr(obj, state->lineno, &tmp) < 0) { Branch (10841:9): [True: 0, False: 3.31k]
|
10842 | return 1; |
10843 | } |
10844 | if (tmp == NULL) { Branch (10844:9): [True: 0, False: 3.31k]
|
10845 | PyErr_SetString(PyExc_TypeError, "required field \"lineno\" missing from keyword"); |
10846 | return 1; |
10847 | } |
10848 | else { |
10849 | int res; |
10850 | if (_Py_EnterRecursiveCall(" while traversing 'keyword' node")) { Branch (10850:13): [True: 0, False: 3.31k]
|
10851 | goto failed; |
10852 | } |
10853 | res = obj2ast_int(state, tmp, &lineno, arena); |
10854 | _Py_LeaveRecursiveCall(); |
10855 | if (res != 0) goto failed0 ; Branch (10855:13): [True: 0, False: 3.31k]
|
10856 | Py_CLEAR(tmp); |
10857 | } |
10858 | if (_PyObject_LookupAttr(obj, state->col_offset, &tmp) < 0) { Branch (10858:9): [True: 0, False: 3.31k]
|
10859 | return 1; |
10860 | } |
10861 | if (tmp == NULL) { Branch (10861:9): [True: 0, False: 3.31k]
|
10862 | PyErr_SetString(PyExc_TypeError, "required field \"col_offset\" missing from keyword"); |
10863 | return 1; |
10864 | } |
10865 | else { |
10866 | int res; |
10867 | if (_Py_EnterRecursiveCall(" while traversing 'keyword' node")) { Branch (10867:13): [True: 0, False: 3.31k]
|
10868 | goto failed; |
10869 | } |
10870 | res = obj2ast_int(state, tmp, &col_offset, arena); |
10871 | _Py_LeaveRecursiveCall(); |
10872 | if (res != 0) goto failed0 ; Branch (10872:13): [True: 0, False: 3.31k]
|
10873 | Py_CLEAR(tmp); |
10874 | } |
10875 | if (_PyObject_LookupAttr(obj, state->end_lineno, &tmp) < 0) { Branch (10875:9): [True: 0, False: 3.31k]
|
10876 | return 1; |
10877 | } |
10878 | if (tmp == NULL || tmp == Py_None) { Branch (10878:9): [True: 0, False: 3.31k]
Branch (10878:24): [True: 0, False: 3.31k]
|
10879 | Py_CLEAR(tmp); |
10880 | end_lineno = lineno; |
10881 | } |
10882 | else { |
10883 | int res; |
10884 | if (_Py_EnterRecursiveCall(" while traversing 'keyword' node")) { Branch (10884:13): [True: 0, False: 3.31k]
|
10885 | goto failed; |
10886 | } |
10887 | res = obj2ast_int(state, tmp, &end_lineno, arena); |
10888 | _Py_LeaveRecursiveCall(); |
10889 | if (res != 0) goto failed0 ; Branch (10889:13): [True: 0, False: 3.31k]
|
10890 | Py_CLEAR(tmp); |
10891 | } |
10892 | if (_PyObject_LookupAttr(obj, state->end_col_offset, &tmp) < 0) { Branch (10892:9): [True: 0, False: 3.31k]
|
10893 | return 1; |
10894 | } |
10895 | if (tmp == NULL || tmp == Py_None) { Branch (10895:9): [True: 0, False: 3.31k]
Branch (10895:24): [True: 0, False: 3.31k]
|
10896 | Py_CLEAR(tmp); |
10897 | end_col_offset = col_offset; |
10898 | } |
10899 | else { |
10900 | int res; |
10901 | if (_Py_EnterRecursiveCall(" while traversing 'keyword' node")) { Branch (10901:13): [True: 0, False: 3.31k]
|
10902 | goto failed; |
10903 | } |
10904 | res = obj2ast_int(state, tmp, &end_col_offset, arena); |
10905 | _Py_LeaveRecursiveCall(); |
10906 | if (res != 0) goto failed0 ; Branch (10906:13): [True: 0, False: 3.31k]
|
10907 | Py_CLEAR(tmp); |
10908 | } |
10909 | *out = _PyAST_keyword(arg, value, lineno, col_offset, end_lineno, |
10910 | end_col_offset, arena); |
10911 | return 0; |
10912 | failed: |
10913 | Py_XDECREF(tmp); |
10914 | return 1; |
10915 | } |
10916 | |
10917 | int |
10918 | obj2ast_alias(struct ast_state *state, PyObject* obj, alias_ty* out, PyArena* |
10919 | arena) |
10920 | { |
10921 | PyObject* tmp = NULL; |
10922 | identifier name; |
10923 | identifier asname; |
10924 | int lineno; |
10925 | int col_offset; |
10926 | int end_lineno; |
10927 | int end_col_offset; |
10928 | |
10929 | if (_PyObject_LookupAttr(obj, state->name, &tmp) < 0) { Branch (10929:9): [True: 0, False: 1.62k]
|
10930 | return 1; |
10931 | } |
10932 | if (tmp == NULL) { Branch (10932:9): [True: 0, False: 1.62k]
|
10933 | PyErr_SetString(PyExc_TypeError, "required field \"name\" missing from alias"); |
10934 | return 1; |
10935 | } |
10936 | else { |
10937 | int res; |
10938 | if (_Py_EnterRecursiveCall(" while traversing 'alias' node")) { Branch (10938:13): [True: 0, False: 1.62k]
|
10939 | goto failed; |
10940 | } |
10941 | res = obj2ast_identifier(state, tmp, &name, arena); |
10942 | _Py_LeaveRecursiveCall(); |
10943 | if (res != 0) goto failed0 ; Branch (10943:13): [True: 0, False: 1.62k]
|
10944 | Py_CLEAR(tmp); |
10945 | } |
10946 | if (_PyObject_LookupAttr(obj, state->asname, &tmp) < 0) { Branch (10946:9): [True: 0, False: 1.62k]
|
10947 | return 1; |
10948 | } |
10949 | if (tmp == NULL || tmp == Py_None) { Branch (10949:9): [True: 0, False: 1.62k]
Branch (10949:24): [True: 1.48k, False: 137]
|
10950 | Py_CLEAR(tmp); |
10951 | asname = NULL; |
10952 | } |
10953 | else { |
10954 | int res; |
10955 | if (_Py_EnterRecursiveCall(" while traversing 'alias' node")) { Branch (10955:13): [True: 0, False: 137]
|
10956 | goto failed; |
10957 | } |
10958 | res = obj2ast_identifier(state, tmp, &asname, arena); |
10959 | _Py_LeaveRecursiveCall(); |
10960 | if (res != 0) goto failed0 ; Branch (10960:13): [True: 0, False: 137]
|
10961 | Py_CLEAR(tmp); |
10962 | } |
10963 | if (_PyObject_LookupAttr(obj, state->lineno, &tmp) < 0) { Branch (10963:9): [True: 0, False: 1.62k]
|
10964 | return 1; |
10965 | } |
10966 | if (tmp == NULL) { Branch (10966:9): [True: 0, False: 1.62k]
|
10967 | PyErr_SetString(PyExc_TypeError, "required field \"lineno\" missing from alias"); |
10968 | return 1; |
10969 | } |
10970 | else { |
10971 | int res; |
10972 | if (_Py_EnterRecursiveCall(" while traversing 'alias' node")) { Branch (10972:13): [True: 0, False: 1.62k]
|
10973 | goto failed; |
10974 | } |
10975 | res = obj2ast_int(state, tmp, &lineno, arena); |
10976 | _Py_LeaveRecursiveCall(); |
10977 | if (res != 0) goto failed0 ; Branch (10977:13): [True: 0, False: 1.62k]
|
10978 | Py_CLEAR(tmp); |
10979 | } |
10980 | if (_PyObject_LookupAttr(obj, state->col_offset, &tmp) < 0) { Branch (10980:9): [True: 0, False: 1.62k]
|
10981 | return 1; |
10982 | } |
10983 | if (tmp == NULL) { Branch (10983:9): [True: 0, False: 1.62k]
|
10984 | PyErr_SetString(PyExc_TypeError, "required field \"col_offset\" missing from alias"); |
10985 | return 1; |
10986 | } |
10987 | else { |
10988 | int res; |
10989 | if (_Py_EnterRecursiveCall(" while traversing 'alias' node")) { Branch (10989:13): [True: 0, False: 1.62k]
|
10990 | goto failed; |
10991 | } |
10992 | res = obj2ast_int(state, tmp, &col_offset, arena); |
10993 | _Py_LeaveRecursiveCall(); |
10994 | if (res != 0) goto failed0 ; Branch (10994:13): [True: 0, False: 1.62k]
|
10995 | Py_CLEAR(tmp); |
10996 | } |
10997 | if (_PyObject_LookupAttr(obj, state->end_lineno, &tmp) < 0) { Branch (10997:9): [True: 0, False: 1.62k]
|
10998 | return 1; |
10999 | } |
11000 | if (tmp == NULL || tmp == Py_None) { Branch (11000:9): [True: 0, False: 1.62k]
Branch (11000:24): [True: 3, False: 1.61k]
|
11001 | Py_CLEAR(tmp); |
11002 | end_lineno = lineno; |
11003 | } |
11004 | else { |
11005 | int res; |
11006 | if (_Py_EnterRecursiveCall(" while traversing 'alias' node")) { Branch (11006:13): [True: 0, False: 1.61k]
|
11007 | goto failed; |
11008 | } |
11009 | res = obj2ast_int(state, tmp, &end_lineno, arena); |
11010 | _Py_LeaveRecursiveCall(); |
11011 | if (res != 0) goto failed0 ; Branch (11011:13): [True: 0, False: 1.61k]
|
11012 | Py_CLEAR(tmp); |
11013 | } |
11014 | if (_PyObject_LookupAttr(obj, state->end_col_offset, &tmp) < 0) { Branch (11014:9): [True: 0, False: 1.62k]
|
11015 | return 1; |
11016 | } |
11017 | if (tmp == NULL || tmp == Py_None) { Branch (11017:9): [True: 0, False: 1.62k]
Branch (11017:24): [True: 3, False: 1.61k]
|
11018 | Py_CLEAR(tmp); |
11019 | end_col_offset = col_offset; |
11020 | } |
11021 | else { |
11022 | int res; |
11023 | if (_Py_EnterRecursiveCall(" while traversing 'alias' node")) { Branch (11023:13): [True: 0, False: 1.61k]
|
11024 | goto failed; |
11025 | } |
11026 | res = obj2ast_int(state, tmp, &end_col_offset, arena); |
11027 | _Py_LeaveRecursiveCall(); |
11028 | if (res != 0) goto failed0 ; Branch (11028:13): [True: 0, False: 1.61k]
|
11029 | Py_CLEAR(tmp); |
11030 | } |
11031 | *out = _PyAST_alias(name, asname, lineno, col_offset, end_lineno, |
11032 | end_col_offset, arena); |
11033 | return 0; |
11034 | failed: |
11035 | Py_XDECREF(tmp); |
11036 | return 1; |
11037 | } |
11038 | |
11039 | int |
11040 | obj2ast_withitem(struct ast_state *state, PyObject* obj, withitem_ty* out, |
11041 | PyArena* arena) |
11042 | { |
11043 | PyObject* tmp = NULL; |
11044 | expr_ty context_expr; |
11045 | expr_ty optional_vars; |
11046 | |
11047 | if (_PyObject_LookupAttr(obj, state->context_expr, &tmp) < 0) { Branch (11047:9): [True: 0, False: 418]
|
11048 | return 1; |
11049 | } |
11050 | if (tmp == NULL) { Branch (11050:9): [True: 0, False: 418]
|
11051 | PyErr_SetString(PyExc_TypeError, "required field \"context_expr\" missing from withitem"); |
11052 | return 1; |
11053 | } |
11054 | else { |
11055 | int res; |
11056 | if (_Py_EnterRecursiveCall(" while traversing 'withitem' node")) { Branch (11056:13): [True: 0, False: 418]
|
11057 | goto failed; |
11058 | } |
11059 | res = obj2ast_expr(state, tmp, &context_expr, arena); |
11060 | _Py_LeaveRecursiveCall(); |
11061 | if (res != 0) goto failed0 ; Branch (11061:13): [True: 0, False: 418]
|
11062 | Py_CLEAR(tmp); |
11063 | } |
11064 | if (_PyObject_LookupAttr(obj, state->optional_vars, &tmp) < 0) { Branch (11064:9): [True: 0, False: 418]
|
11065 | return 1; |
11066 | } |
11067 | if (tmp == NULL || tmp == Py_None) { Branch (11067:9): [True: 0, False: 418]
Branch (11067:24): [True: 225, False: 193]
|
11068 | Py_CLEAR(tmp); |
11069 | optional_vars = NULL; |
11070 | } |
11071 | else { |
11072 | int res; |
11073 | if (_Py_EnterRecursiveCall(" while traversing 'withitem' node")) { Branch (11073:13): [True: 0, False: 193]
|
11074 | goto failed; |
11075 | } |
11076 | res = obj2ast_expr(state, tmp, &optional_vars, arena); |
11077 | _Py_LeaveRecursiveCall(); |
11078 | if (res != 0) goto failed0 ; Branch (11078:13): [True: 0, False: 193]
|
11079 | Py_CLEAR(tmp); |
11080 | } |
11081 | *out = _PyAST_withitem(context_expr, optional_vars, arena); |
11082 | return 0; |
11083 | failed: |
11084 | Py_XDECREF(tmp); |
11085 | return 1; |
11086 | } |
11087 | |
11088 | int |
11089 | obj2ast_match_case(struct ast_state *state, PyObject* obj, match_case_ty* out, |
11090 | PyArena* arena) |
11091 | { |
11092 | PyObject* tmp = NULL; |
11093 | pattern_ty pattern; |
11094 | expr_ty guard; |
11095 | asdl_stmt_seq* body; |
11096 | |
11097 | if (_PyObject_LookupAttr(obj, state->pattern, &tmp) < 0) { Branch (11097:9): [True: 0, False: 33]
|
11098 | return 1; |
11099 | } |
11100 | if (tmp == NULL) { Branch (11100:9): [True: 0, False: 33]
|
11101 | PyErr_SetString(PyExc_TypeError, "required field \"pattern\" missing from match_case"); |
11102 | return 1; |
11103 | } |
11104 | else { |
11105 | int res; |
11106 | if (_Py_EnterRecursiveCall(" while traversing 'match_case' node")) { |
11107 | goto failed; |
11108 | } |
11109 | res = obj2ast_pattern(state, tmp, &pattern, arena); |
11110 | _Py_LeaveRecursiveCall(); |
11111 | if (res != 0) goto failed0 ; |
11112 | Py_CLEAR(tmp); |
11113 | } |
11114 | if (_PyObject_LookupAttr(obj, state->guard, &tmp) < 0) { Branch (11114:9): [True: 0, False: 33]
|
11115 | return 1; |
11116 | } |
11117 | if (tmp == NULL || tmp == Py_None) { Branch (11117:9): [True: 0, False: 33]
Branch (11117:24): [True: 32, False: 1]
|
11118 | Py_CLEAR(tmp); |
11119 | guard = NULL; |
11120 | } |
11121 | else { |
11122 | int res; |
11123 | if (_Py_EnterRecursiveCall(" while traversing 'match_case' node")) { |
11124 | goto failed; |
11125 | } |
11126 | res = obj2ast_expr(state, tmp, &guard, arena); |
11127 | _Py_LeaveRecursiveCall(); |
11128 | if (res != 0) goto failed0 ; |
11129 | Py_CLEAR(tmp); |
11130 | } |
11131 | if (_PyObject_LookupAttr(obj, state->body, &tmp) < 0) { Branch (11131:9): [True: 0, False: 33]
|
11132 | return 1; |
11133 | } |
11134 | if (tmp == NULL) { Branch (11134:9): [True: 0, False: 33]
|
11135 | PyErr_SetString(PyExc_TypeError, "required field \"body\" missing from match_case"); |
11136 | return 1; |
11137 | } |
11138 | else { |
11139 | int res; |
11140 | Py_ssize_t len; |
11141 | Py_ssize_t i; |
11142 | if (!PyList_Check(tmp)) { |
11143 | PyErr_Format(PyExc_TypeError, "match_case field \"body\" must be a list, not a %.200s", _PyType_Name(Py_TYPE(tmp))); |
11144 | goto failed; |
11145 | } |
11146 | len = PyList_GET_SIZE(tmp); |
11147 | body = _Py_asdl_stmt_seq_new(len, arena); |
11148 | if (body == NULL) goto failed0 ; |
11149 | for (i = 0; 33 i < len; i++38 ) { Branch (11149:21): [True: 38, False: 33]
|
11150 | stmt_ty val; |
11151 | PyObject *tmp2 = PyList_GET_ITEM(tmp, i); |
11152 | Py_INCREF(tmp2); |
11153 | if (_Py_EnterRecursiveCall(" while traversing 'match_case' node")) { |
11154 | goto failed; |
11155 | } |
11156 | res = obj2ast_stmt(state, tmp2, &val, arena); |
11157 | _Py_LeaveRecursiveCall(); |
11158 | Py_DECREF(tmp2); |
11159 | if (res != 0) goto failed0 ; |
11160 | if (len != PyList_GET_SIZE(tmp)) { |
11161 | PyErr_SetString(PyExc_RuntimeError, "match_case field \"body\" changed size during iteration"); |
11162 | goto failed; |
11163 | } |
11164 | asdl_seq_SET(body, i, val); |
11165 | } |
11166 | Py_CLEAR(tmp); |
11167 | } |
11168 | *out = _PyAST_match_case(pattern, guard, body, arena); |
11169 | return 0; |
11170 | failed: |
11171 | Py_XDECREF(tmp); |
11172 | return 1; |
11173 | } |
11174 | |
11175 | int |
11176 | obj2ast_pattern(struct ast_state *state, PyObject* obj, pattern_ty* out, |
11177 | PyArena* arena) |
11178 | { |
11179 | int isinstance; |
11180 | |
11181 | PyObject *tmp = NULL; |
11182 | PyObject *tp; |
11183 | int lineno; |
11184 | int col_offset; |
11185 | int end_lineno; |
11186 | int end_col_offset; |
11187 | |
11188 | if (obj == Py_None) { Branch (11188:9): [True: 0, False: 54]
|
11189 | *out = NULL; |
11190 | return 0; |
11191 | } |
11192 | if (_PyObject_LookupAttr(obj, state->lineno, &tmp) < 0) { Branch (11192:9): [True: 0, False: 54]
|
11193 | return 1; |
11194 | } |
11195 | if (tmp == NULL) { Branch (11195:9): [True: 0, False: 54]
|
11196 | PyErr_SetString(PyExc_TypeError, "required field \"lineno\" missing from pattern"); |
11197 | return 1; |
11198 | } |
11199 | else { |
11200 | int res; |
11201 | if (_Py_EnterRecursiveCall(" while traversing 'pattern' node")) { |
11202 | goto failed; |
11203 | } |
11204 | res = obj2ast_int(state, tmp, &lineno, arena); |
11205 | _Py_LeaveRecursiveCall(); |
11206 | if (res != 0) goto failed0 ; |
11207 | Py_CLEAR(tmp); |
11208 | } |
11209 | if (_PyObject_LookupAttr(obj, state->col_offset, &tmp) < 0) { Branch (11209:9): [True: 0, False: 54]
|
11210 | return 1; |
11211 | } |
11212 | if (tmp == NULL) { Branch (11212:9): [True: 0, False: 54]
|
11213 | PyErr_SetString(PyExc_TypeError, "required field \"col_offset\" missing from pattern"); |
11214 | return 1; |
11215 | } |
11216 | else { |
11217 | int res; |
11218 | if (_Py_EnterRecursiveCall(" while traversing 'pattern' node")) { |
11219 | goto failed; |
11220 | } |
11221 | res = obj2ast_int(state, tmp, &col_offset, arena); |
11222 | _Py_LeaveRecursiveCall(); |
11223 | if (res != 0) goto failed0 ; |
11224 | Py_CLEAR(tmp); |
11225 | } |
11226 | if (_PyObject_LookupAttr(obj, state->end_lineno, &tmp) < 0) { Branch (11226:9): [True: 0, False: 54]
|
11227 | return 1; |
11228 | } |
11229 | if (tmp == NULL) { Branch (11229:9): [True: 0, False: 54]
|
11230 | PyErr_SetString(PyExc_TypeError, "required field \"end_lineno\" missing from pattern"); |
11231 | return 1; |
11232 | } |
11233 | else { |
11234 | int res; |
11235 | if (_Py_EnterRecursiveCall(" while traversing 'pattern' node")) { |
11236 | goto failed; |
11237 | } |
11238 | res = obj2ast_int(state, tmp, &end_lineno, arena); |
11239 | _Py_LeaveRecursiveCall(); |
11240 | if (res != 0) goto failed0 ; |
11241 | Py_CLEAR(tmp); |
11242 | } |
11243 | if (_PyObject_LookupAttr(obj, state->end_col_offset, &tmp) < 0) { Branch (11243:9): [True: 0, False: 54]
|
11244 | return 1; |
11245 | } |
11246 | if (tmp == NULL) { Branch (11246:9): [True: 0, False: 54]
|
11247 | PyErr_SetString(PyExc_TypeError, "required field \"end_col_offset\" missing from pattern"); |
11248 | return 1; |
11249 | } |
11250 | else { |
11251 | int res; |
11252 | if (_Py_EnterRecursiveCall(" while traversing 'pattern' node")) { |
11253 | goto failed; |
11254 | } |
11255 | res = obj2ast_int(state, tmp, &end_col_offset, arena); |
11256 | _Py_LeaveRecursiveCall(); |
11257 | if (res != 0) goto failed0 ; |
11258 | Py_CLEAR(tmp); |
11259 | } |
11260 | tp = state->MatchValue_type; |
11261 | isinstance = PyObject_IsInstance(obj, tp); |
11262 | if (isinstance == -1) { Branch (11262:9): [True: 0, False: 54]
|
11263 | return 1; |
11264 | } |
11265 | if (isinstance) { Branch (11265:9): [True: 15, False: 39]
|
11266 | expr_ty value; |
11267 | |
11268 | if (_PyObject_LookupAttr(obj, state->value, &tmp) < 0) { |
11269 | return 1; |
11270 | } |
11271 | if (tmp == NULL) { |
11272 | PyErr_SetString(PyExc_TypeError, "required field \"value\" missing from MatchValue"); |
11273 | return 1; |
11274 | } |
11275 | else { |
11276 | int res; |
11277 | if (_Py_EnterRecursiveCall(" while traversing 'MatchValue' node")) { |
11278 | goto failed; |
11279 | } |
11280 | res = obj2ast_expr(state, tmp, &value, arena); |
11281 | _Py_LeaveRecursiveCall(); |
11282 | if (res != 0) goto failed0 ; |
11283 | Py_CLEAR(tmp); |
11284 | } |
11285 | *out = _PyAST_MatchValue(value, lineno, col_offset, end_lineno, |
11286 | end_col_offset, arena); |
11287 | if (*out == NULL) goto failed0 ; |
11288 | return 0; |
11289 | } |
11290 | tp = state->MatchSingleton_type; |
11291 | isinstance = PyObject_IsInstance(obj, tp); |
11292 | if (isinstance == -1) { Branch (11292:9): [True: 0, False: 39]
|
11293 | return 1; |
11294 | } |
11295 | if (isinstance) { Branch (11295:9): [True: 6, False: 33]
|
11296 | constant value; |
11297 | |
11298 | if (_PyObject_LookupAttr(obj, state->value, &tmp) < 0) { |
11299 | return 1; |
11300 | } |
11301 | if (tmp == NULL) { |
11302 | PyErr_SetString(PyExc_TypeError, "required field \"value\" missing from MatchSingleton"); |
11303 | return 1; |
11304 | } |
11305 | else { |
11306 | int res; |
11307 | if (_Py_EnterRecursiveCall(" while traversing 'MatchSingleton' node")) { |
11308 | goto failed; |
11309 | } |
11310 | res = obj2ast_constant(state, tmp, &value, arena); |
11311 | _Py_LeaveRecursiveCall(); |
11312 | if (res != 0) goto failed0 ; |
11313 | Py_CLEAR(tmp); |
11314 | } |
11315 | *out = _PyAST_MatchSingleton(value, lineno, col_offset, end_lineno, |
11316 | end_col_offset, arena); |
11317 | if (*out == NULL) goto failed0 ; |
11318 | return 0; |
11319 | } |
11320 | tp = state->MatchSequence_type; |
11321 | isinstance = PyObject_IsInstance(obj, tp); |
11322 | if (isinstance == -1) { Branch (11322:9): [True: 0, False: 33]
|
11323 | return 1; |
11324 | } |
11325 | if (isinstance) { Branch (11325:9): [True: 5, False: 28]
|
11326 | asdl_pattern_seq* patterns; |
11327 | |
11328 | if (_PyObject_LookupAttr(obj, state->patterns, &tmp) < 0) { |
11329 | return 1; |
11330 | } |
11331 | if (tmp == NULL) { |
11332 | PyErr_SetString(PyExc_TypeError, "required field \"patterns\" missing from MatchSequence"); |
11333 | return 1; |
11334 | } |
11335 | else { |
11336 | int res; |
11337 | Py_ssize_t len; |
11338 | Py_ssize_t i; |
11339 | if (!PyList_Check(tmp)) { |
11340 | PyErr_Format(PyExc_TypeError, "MatchSequence field \"patterns\" must be a list, not a %.200s", _PyType_Name(Py_TYPE(tmp))); |
11341 | goto failed; |
11342 | } |
11343 | len = PyList_GET_SIZE(tmp); |
11344 | patterns = _Py_asdl_pattern_seq_new(len, arena); |
11345 | if (patterns == NULL) goto failed0 ; |
11346 | for (i = 0; 5 i < len; i++5 ) { |
11347 | pattern_ty val; |
11348 | PyObject *tmp2 = PyList_GET_ITEM(tmp, i); |
11349 | Py_INCREF(tmp2); |
11350 | if (_Py_EnterRecursiveCall(" while traversing 'MatchSequence' node")) { |
11351 | goto failed; |
11352 | } |
11353 | res = obj2ast_pattern(state, tmp2, &val, arena); |
11354 | _Py_LeaveRecursiveCall(); |
11355 | Py_DECREF(tmp2); |
11356 | if (res != 0) goto failed0 ; |
11357 | if (len != PyList_GET_SIZE(tmp)) { |
11358 | PyErr_SetString(PyExc_RuntimeError, "MatchSequence field \"patterns\" changed size during iteration"); |
11359 | goto failed; |
11360 | } |
11361 | asdl_seq_SET(patterns, i, val); |
11362 | } |
11363 | Py_CLEAR(tmp); |
11364 | } |
11365 | *out = _PyAST_MatchSequence(patterns, lineno, col_offset, end_lineno, |
11366 | end_col_offset, arena); |
11367 | if (*out == NULL) goto failed0 ; |
11368 | return 0; |
11369 | } |
11370 | tp = state->MatchMapping_type; |
11371 | isinstance = PyObject_IsInstance(obj, tp); |
11372 | if (isinstance == -1) { Branch (11372:9): [True: 0, False: 28]
|
11373 | return 1; |
11374 | } |
11375 | if (isinstance) { Branch (11375:9): [True: 4, False: 24]
|
11376 | asdl_expr_seq* keys; |
11377 | asdl_pattern_seq* patterns; |
11378 | identifier rest; |
11379 | |
11380 | if (_PyObject_LookupAttr(obj, state->keys, &tmp) < 0) { |
11381 | return 1; |
11382 | } |
11383 | if (tmp == NULL) { |
11384 | PyErr_SetString(PyExc_TypeError, "required field \"keys\" missing from MatchMapping"); |
11385 | return 1; |
11386 | } |
11387 | else { |
11388 | int res; |
11389 | Py_ssize_t len; |
11390 | Py_ssize_t i; |
11391 | if (!PyList_Check(tmp)) { |
11392 | PyErr_Format(PyExc_TypeError, "MatchMapping field \"keys\" must be a list, not a %.200s", _PyType_Name(Py_TYPE(tmp))); |
11393 | goto failed; |
11394 | } |
11395 | len = PyList_GET_SIZE(tmp); |
11396 | keys = _Py_asdl_expr_seq_new(len, arena); |
11397 | if (keys == NULL) goto failed0 ; |
11398 | for (i = 0; 4 i < len; i++6 ) { |
11399 | expr_ty val; |
11400 | PyObject *tmp2 = PyList_GET_ITEM(tmp, i); |
11401 | Py_INCREF(tmp2); |
11402 | if (_Py_EnterRecursiveCall(" while traversing 'MatchMapping' node")) { |
11403 | goto failed; |
11404 | } |
11405 | res = obj2ast_expr(state, tmp2, &val, arena); |
11406 | _Py_LeaveRecursiveCall(); |
11407 | Py_DECREF(tmp2); |
11408 | if (res != 0) goto failed0 ; |
11409 | if (len != PyList_GET_SIZE(tmp)) { |
11410 | PyErr_SetString(PyExc_RuntimeError, "MatchMapping field \"keys\" changed size during iteration"); |
11411 | goto failed; |
11412 | } |
11413 | asdl_seq_SET(keys, i, val); |
11414 | } |
11415 | Py_CLEAR(tmp); |
11416 | } |
11417 | if (_PyObject_LookupAttr(obj, state->patterns, &tmp) < 0) { |
11418 | return 1; |
11419 | } |
11420 | if (tmp == NULL) { |
11421 | PyErr_SetString(PyExc_TypeError, "required field \"patterns\" missing from MatchMapping"); |
11422 | return 1; |
11423 | } |
11424 | else { |
11425 | int res; |
11426 | Py_ssize_t len; |
11427 | Py_ssize_t i; |
11428 | if (!PyList_Check(tmp)) { |
11429 | PyErr_Format(PyExc_TypeError, "MatchMapping field \"patterns\" must be a list, not a %.200s", _PyType_Name(Py_TYPE(tmp))); |
11430 | goto failed; |
11431 | } |
11432 | len = PyList_GET_SIZE(tmp); |
11433 | patterns = _Py_asdl_pattern_seq_new(len, arena); |
11434 | if (patterns == NULL) goto failed0 ; |
11435 | for (i = 0; 4 i < len; i++5 ) { |
11436 | pattern_ty val; |
11437 | PyObject *tmp2 = PyList_GET_ITEM(tmp, i); |
11438 | Py_INCREF(tmp2); |
11439 | if (_Py_EnterRecursiveCall(" while traversing 'MatchMapping' node")) { |
11440 | goto failed; |
11441 | } |
11442 | res = obj2ast_pattern(state, tmp2, &val, arena); |
11443 | _Py_LeaveRecursiveCall(); |
11444 | Py_DECREF(tmp2); |
11445 | if (res != 0) goto failed0 ; |
11446 | if (len != PyList_GET_SIZE(tmp)) { |
11447 | PyErr_SetString(PyExc_RuntimeError, "MatchMapping field \"patterns\" changed size during iteration"); |
11448 | goto failed; |
11449 | } |
11450 | asdl_seq_SET(patterns, i, val); |
11451 | } |
11452 | Py_CLEAR(tmp); |
11453 | } |
11454 | if (_PyObject_LookupAttr(obj, state->rest, &tmp) < 0) { |
11455 | return 1; |
11456 | } |
11457 | if (tmp == NULL || tmp == Py_None) { |
11458 | Py_CLEAR(tmp); |
11459 | rest = NULL; |
11460 | } |
11461 | else { |
11462 | int res; |
11463 | if (_Py_EnterRecursiveCall(" while traversing 'MatchMapping' node")) { |
11464 | goto failed; |
11465 | } |
11466 | res = obj2ast_identifier(state, tmp, &rest, arena); |
11467 | _Py_LeaveRecursiveCall(); |
11468 | if (res != 0) goto failed0 ; |
11469 | Py_CLEAR(tmp); |
11470 | } |
11471 | *out = _PyAST_MatchMapping(keys, patterns, rest, lineno, col_offset, |
11472 | end_lineno, end_col_offset, arena); |
11473 | if (*out == NULL) goto failed0 ; |
11474 | return 0; |
11475 | } |
11476 | tp = state->MatchClass_type; |
11477 | isinstance = PyObject_IsInstance(obj, tp); |
11478 | if (isinstance == -1) { Branch (11478:9): [True: 0, False: 24]
|
11479 | return 1; |
11480 | } |
11481 | if (isinstance) { Branch (11481:9): [True: 10, False: 14]
|
11482 | expr_ty cls; |
11483 | asdl_pattern_seq* patterns; |
11484 | asdl_identifier_seq* kwd_attrs; |
11485 | asdl_pattern_seq* kwd_patterns; |
11486 | |
11487 | if (_PyObject_LookupAttr(obj, state->cls, &tmp) < 0) { |
11488 | return 1; |
11489 | } |
11490 | if (tmp == NULL) { |
11491 | PyErr_SetString(PyExc_TypeError, "required field \"cls\" missing from MatchClass"); |
11492 | return 1; |
11493 | } |
11494 | else { |
11495 | int res; |
11496 | if (_Py_EnterRecursiveCall(" while traversing 'MatchClass' node")) { |
11497 | goto failed; |
11498 | } |
11499 | res = obj2ast_expr(state, tmp, &cls, arena); |
11500 | _Py_LeaveRecursiveCall(); |
11501 | if (res != 0) goto failed0 ; |
11502 | Py_CLEAR(tmp); |
11503 | } |
11504 | if (_PyObject_LookupAttr(obj, state->patterns, &tmp) < 0) { |
11505 | return 1; |
11506 | } |
11507 | if (tmp == NULL) { |
11508 | PyErr_SetString(PyExc_TypeError, "required field \"patterns\" missing from MatchClass"); |
11509 | return 1; |
11510 | } |
11511 | else { |
11512 | int res; |
11513 | Py_ssize_t len; |
11514 | Py_ssize_t i; |
11515 | if (!PyList_Check(tmp)) { |
11516 | PyErr_Format(PyExc_TypeError, "MatchClass field \"patterns\" must be a list, not a %.200s", _PyType_Name(Py_TYPE(tmp))); |
11517 | goto failed; |
11518 | } |
11519 | len = PyList_GET_SIZE(tmp); |
11520 | patterns = _Py_asdl_pattern_seq_new(len, arena); |
11521 | if (patterns == NULL) goto failed0 ; |
11522 | for (i = 0; 10 i < len; i++4 ) { |
11523 | pattern_ty val; |
11524 | PyObject *tmp2 = PyList_GET_ITEM(tmp, i); |
11525 | Py_INCREF(tmp2); |
11526 | if (_Py_EnterRecursiveCall(" while traversing 'MatchClass' node")) { |
11527 | goto failed; |
11528 | } |
11529 | res = obj2ast_pattern(state, tmp2, &val, arena); |
11530 | _Py_LeaveRecursiveCall(); |
11531 | Py_DECREF(tmp2); |
11532 | if (res != 0) goto failed0 ; |
11533 | if (len != PyList_GET_SIZE(tmp)) { |
11534 | PyErr_SetString(PyExc_RuntimeError, "MatchClass field \"patterns\" changed size during iteration"); |
11535 | goto failed; |
11536 | } |
11537 | asdl_seq_SET(patterns, i, val); |
11538 | } |
11539 | Py_CLEAR(tmp); |
11540 | } |
11541 | if (_PyObject_LookupAttr(obj, state->kwd_attrs, &tmp) < 0) { |
11542 | return 1; |
11543 | } |
11544 | if (tmp == NULL) { |
11545 | PyErr_SetString(PyExc_TypeError, "required field \"kwd_attrs\" missing from MatchClass"); |
11546 | return 1; |
11547 | } |
11548 | else { |
11549 | int res; |
11550 | Py_ssize_t len; |
11551 | Py_ssize_t i; |
11552 | if (!PyList_Check(tmp)) { |
11553 | PyErr_Format(PyExc_TypeError, "MatchClass field \"kwd_attrs\" must be a list, not a %.200s", _PyType_Name(Py_TYPE(tmp))); |
11554 | goto failed; |
11555 | } |
11556 | len = PyList_GET_SIZE(tmp); |
11557 | kwd_attrs = _Py_asdl_identifier_seq_new(len, arena); |
11558 | if (kwd_attrs == NULL) goto failed0 ; |
11559 | for (i = 0; 10 i < len; i++1 ) { |
11560 | identifier val; |
11561 | PyObject *tmp2 = PyList_GET_ITEM(tmp, i); |
11562 | Py_INCREF(tmp2); |
11563 | if (_Py_EnterRecursiveCall(" while traversing 'MatchClass' node")) { |
11564 | goto failed; |
11565 | } |
11566 | res = obj2ast_identifier(state, tmp2, &val, arena); |
11567 | _Py_LeaveRecursiveCall(); |
11568 | Py_DECREF(tmp2); |
11569 | if (res != 0) goto failed0 ; |
11570 | if (len != PyList_GET_SIZE(tmp)) { |
11571 | PyErr_SetString(PyExc_RuntimeError, "MatchClass field \"kwd_attrs\" changed size during iteration"); |
11572 | goto failed; |
11573 | } |
11574 | asdl_seq_SET(kwd_attrs, i, val); |
11575 | } |
11576 | Py_CLEAR(tmp); |
11577 | } |
11578 | if (_PyObject_LookupAttr(obj, state->kwd_patterns, &tmp) < 0) { |
11579 | return 1; |
11580 | } |
11581 | if (tmp == NULL) { |
11582 | PyErr_SetString(PyExc_TypeError, "required field \"kwd_patterns\" missing from MatchClass"); |
11583 | return 1; |
11584 | } |
11585 | else { |
11586 | int res; |
11587 | Py_ssize_t len; |
11588 | Py_ssize_t i; |
11589 | if (!PyList_Check(tmp)) { |
11590 | PyErr_Format(PyExc_TypeError, "MatchClass field \"kwd_patterns\" must be a list, not a %.200s", _PyType_Name(Py_TYPE(tmp))); |
11591 | goto failed; |
11592 | } |
11593 | len = PyList_GET_SIZE(tmp); |
11594 | kwd_patterns = _Py_asdl_pattern_seq_new(len, arena); |
11595 | if (kwd_patterns == NULL) goto failed0 ; |
11596 | for (i = 0; 10 i < len; i++3 ) { |
11597 | pattern_ty val; |
11598 | PyObject *tmp2 = PyList_GET_ITEM(tmp, i); |
11599 | Py_INCREF(tmp2); |
11600 | if (_Py_EnterRecursiveCall(" while traversing 'MatchClass' node")) { |
11601 | goto failed; |
11602 | } |
11603 | res = obj2ast_pattern(state, tmp2, &val, arena); |
11604 | _Py_LeaveRecursiveCall(); |
11605 | Py_DECREF(tmp2); |
11606 | if (res != 0) goto failed0 ; |
11607 | if (len != PyList_GET_SIZE(tmp)) { |
11608 | PyErr_SetString(PyExc_RuntimeError, "MatchClass field \"kwd_patterns\" changed size during iteration"); |
11609 | goto failed; |
11610 | } |
11611 | asdl_seq_SET(kwd_patterns, i, val); |
11612 | } |
11613 | Py_CLEAR(tmp); |
11614 | } |
11615 | *out = _PyAST_MatchClass(cls, patterns, kwd_attrs, kwd_patterns, |
11616 | lineno, col_offset, end_lineno, |
11617 | end_col_offset, arena); |
11618 | if (*out == NULL) goto failed0 ; |
11619 | return 0; |
11620 | } |
11621 | tp = state->MatchStar_type; |
11622 | isinstance = PyObject_IsInstance(obj, tp); |
11623 | if (isinstance == -1) { Branch (11623:9): [True: 0, False: 14]
|
11624 | return 1; |
11625 | } |
11626 | if (isinstance) { Branch (11626:9): [True: 5, False: 9]
|
11627 | identifier name; |
11628 | |
11629 | if (_PyObject_LookupAttr(obj, state->name, &tmp) < 0) { |
11630 | return 1; |
11631 | } |
11632 | if (tmp == NULL || tmp == Py_None) { |
11633 | Py_CLEAR(tmp); |
11634 | name = NULL; |
11635 | } |
11636 | else { |
11637 | int res; |
11638 | if (_Py_EnterRecursiveCall(" while traversing 'MatchStar' node")) { |
11639 | goto failed; |
11640 | } |
11641 | res = obj2ast_identifier(state, tmp, &name, arena); |
11642 | _Py_LeaveRecursiveCall(); |
11643 | if (res != 0) goto failed0 ; |
11644 | Py_CLEAR(tmp); |
11645 | } |
11646 | *out = _PyAST_MatchStar(name, lineno, col_offset, end_lineno, |
11647 | end_col_offset, arena); |
11648 | if (*out == NULL) goto failed0 ; |
11649 | return 0; |
11650 | } |
11651 | tp = state->MatchAs_type; |
11652 | isinstance = PyObject_IsInstance(obj, tp); |
11653 | if (isinstance == -1) { Branch (11653:9): [True: 0, False: 9]
|
11654 | return 1; |
11655 | } |
11656 | if (isinstance) { Branch (11656:9): [True: 6, False: 3]
|
11657 | pattern_ty pattern; |
11658 | identifier name; |
11659 | |
11660 | if (_PyObject_LookupAttr(obj, state->pattern, &tmp) < 0) { |
11661 | return 1; |
11662 | } |
11663 | if (tmp == NULL || tmp == Py_None) { |
11664 | Py_CLEAR(tmp); |
11665 | pattern = NULL; |
11666 | } |
11667 | else { |
11668 | int res; |
11669 | if (_Py_EnterRecursiveCall(" while traversing 'MatchAs' node")) { |
11670 | goto failed; |
11671 | } |
11672 | res = obj2ast_pattern(state, tmp, &pattern, arena); |
11673 | _Py_LeaveRecursiveCall(); |
11674 | if (res != 0) goto failed; |
11675 | Py_CLEAR(tmp); |
11676 | } |
11677 | if (_PyObject_LookupAttr(obj, state->name, &tmp) < 0) { |
11678 | return 1; |
11679 | } |
11680 | if (tmp == NULL || tmp == Py_None) { |
11681 | Py_CLEAR(tmp); |
11682 | name = NULL; |
11683 | } |
11684 | else { |
11685 | int res; |
11686 | if (_Py_EnterRecursiveCall(" while traversing 'MatchAs' node")) { |
11687 | goto failed; |
11688 | } |
11689 | res = obj2ast_identifier(state, tmp, &name, arena); |
11690 | _Py_LeaveRecursiveCall(); |
11691 | if (res != 0) goto failed0 ; |
11692 | Py_CLEAR(tmp); |
11693 | } |
11694 | *out = _PyAST_MatchAs(pattern, name, lineno, col_offset, end_lineno, |
11695 | end_col_offset, arena); |
11696 | if (*out == NULL) goto failed0 ; |
11697 | return 0; |
11698 | } |
11699 | tp = state->MatchOr_type; |
11700 | isinstance = PyObject_IsInstance(obj, tp); |
11701 | if (isinstance == -1) { Branch (11701:9): [True: 0, False: 3]
|
11702 | return 1; |
11703 | } |
11704 | if (isinstance) { Branch (11704:9): [True: 3, False: 0]
|
11705 | asdl_pattern_seq* patterns; |
11706 | |
11707 | if (_PyObject_LookupAttr(obj, state->patterns, &tmp) < 0) { |
11708 | return 1; |
11709 | } |
11710 | if (tmp == NULL) { |
11711 | PyErr_SetString(PyExc_TypeError, "required field \"patterns\" missing from MatchOr"); |
11712 | return 1; |
11713 | } |
11714 | else { |
11715 | int res; |
11716 | Py_ssize_t len; |
11717 | Py_ssize_t i; |
11718 | if (!PyList_Check(tmp)) { |
11719 | PyErr_Format(PyExc_TypeError, "MatchOr field \"patterns\" must be a list, not a %.200s", _PyType_Name(Py_TYPE(tmp))); |
11720 | goto failed; |
11721 | } |
11722 | len = PyList_GET_SIZE(tmp); |
11723 | patterns = _Py_asdl_pattern_seq_new(len, arena); |
11724 | if (patterns == NULL) goto failed0 ; |
11725 | for (i = 0; 3 i < len; i++4 ) { |
11726 | pattern_ty val; |
11727 | PyObject *tmp2 = PyList_GET_ITEM(tmp, i); |
11728 | Py_INCREF(tmp2); |
11729 | if (_Py_EnterRecursiveCall(" while traversing 'MatchOr' node")) { |
11730 | goto failed; |
11731 | } |
11732 | res = obj2ast_pattern(state, tmp2, &val, arena); |
11733 | _Py_LeaveRecursiveCall(); |
11734 | Py_DECREF(tmp2); |
11735 | if (res != 0) goto failed0 ; |
11736 | if (len != PyList_GET_SIZE(tmp)) { |
11737 | PyErr_SetString(PyExc_RuntimeError, "MatchOr field \"patterns\" changed size during iteration"); |
11738 | goto failed; |
11739 | } |
11740 | asdl_seq_SET(patterns, i, val); |
11741 | } |
11742 | Py_CLEAR(tmp); |
11743 | } |
11744 | *out = _PyAST_MatchOr(patterns, lineno, col_offset, end_lineno, |
11745 | end_col_offset, arena); |
11746 | if (*out == NULL) goto failed0 ; |
11747 | return 0; |
11748 | } |
11749 | |
11750 | PyErr_Format(PyExc_TypeError, "expected some sort of pattern, but got %R", obj); |
11751 | failed: |
11752 | Py_XDECREF(tmp); |
11753 | return 1; |
11754 | } |
11755 | |
11756 | int |
11757 | obj2ast_type_ignore(struct ast_state *state, PyObject* obj, type_ignore_ty* |
11758 | out, PyArena* arena) |
11759 | { |
11760 | int isinstance; |
11761 |
|
11762 | PyObject *tmp = NULL; |
11763 | PyObject *tp; |
11764 |
|
11765 | if (obj == Py_None) { Branch (11765:9): [True: 0, False: 0]
|
11766 | *out = NULL; |
11767 | return 0; |
11768 | } |
11769 | tp = state->TypeIgnore_type; |
11770 | isinstance = PyObject_IsInstance(obj, tp); |
11771 | if (isinstance == -1) { Branch (11771:9): [True: 0, False: 0]
|
11772 | return 1; |
11773 | } |
11774 | if (isinstance) { Branch (11774:9): [True: 0, False: 0]
|
11775 | int lineno; |
11776 | string tag; |
11777 |
|
11778 | if (_PyObject_LookupAttr(obj, state->lineno, &tmp) < 0) { |
11779 | return 1; |
11780 | } |
11781 | if (tmp == NULL) { |
11782 | PyErr_SetString(PyExc_TypeError, "required field \"lineno\" missing from TypeIgnore"); |
11783 | return 1; |
11784 | } |
11785 | else { |
11786 | int res; |
11787 | if (_Py_EnterRecursiveCall(" while traversing 'TypeIgnore' node")) { |
11788 | goto failed; |
11789 | } |
11790 | res = obj2ast_int(state, tmp, &lineno, arena); |
11791 | _Py_LeaveRecursiveCall(); |
11792 | if (res != 0) goto failed; |
11793 | Py_CLEAR(tmp); |
11794 | } |
11795 | if (_PyObject_LookupAttr(obj, state->tag, &tmp) < 0) { |
11796 | return 1; |
11797 | } |
11798 | if (tmp == NULL) { |
11799 | PyErr_SetString(PyExc_TypeError, "required field \"tag\" missing from TypeIgnore"); |
11800 | return 1; |
11801 | } |
11802 | else { |
11803 | int res; |
11804 | if (_Py_EnterRecursiveCall(" while traversing 'TypeIgnore' node")) { |
11805 | goto failed; |
11806 | } |
11807 | res = obj2ast_string(state, tmp, &tag, arena); |
11808 | _Py_LeaveRecursiveCall(); |
11809 | if (res != 0) goto failed; |
11810 | Py_CLEAR(tmp); |
11811 | } |
11812 | *out = _PyAST_TypeIgnore(lineno, tag, arena); |
11813 | if (*out == NULL) goto failed; |
11814 | return 0; |
11815 | } |
11816 | |
11817 | PyErr_Format(PyExc_TypeError, "expected some sort of type_ignore, but got %R", obj); |
11818 | failed: |
11819 | Py_XDECREF(tmp); |
11820 | return 1; |
11821 | } |
11822 | |
11823 | |
11824 | static int |
11825 | astmodule_exec(PyObject *m) |
11826 | { |
11827 | struct ast_state *state = get_ast_state(); |
11828 | if (state == NULL) { Branch (11828:9): [True: 0, False: 17]
|
11829 | return -1; |
11830 | } |
11831 | if (PyModule_AddObjectRef(m, "AST", state->AST_type) < 0) { Branch (11831:9): [True: 0, False: 17]
|
11832 | return -1; |
11833 | } |
11834 | if (PyModule_AddIntMacro(m, PyCF_ALLOW_TOP_LEVEL_AWAIT) < 0) { Branch (11834:9): [True: 0, False: 17]
|
11835 | return -1; |
11836 | } |
11837 | if (PyModule_AddIntMacro(m, PyCF_ONLY_AST) < 0) { Branch (11837:9): [True: 0, False: 17]
|
11838 | return -1; |
11839 | } |
11840 | if (PyModule_AddIntMacro(m, PyCF_TYPE_COMMENTS) < 0) { Branch (11840:9): [True: 0, False: 17]
|
11841 | return -1; |
11842 | } |
11843 | if (PyModule_AddObjectRef(m, "mod", state->mod_type) < 0) { Branch (11843:9): [True: 0, False: 17]
|
11844 | return -1; |
11845 | } |
11846 | if (PyModule_AddObjectRef(m, "Module", state->Module_type) < 0) { Branch (11846:9): [True: 0, False: 17]
|
11847 | return -1; |
11848 | } |
11849 | if (PyModule_AddObjectRef(m, "Interactive", state->Interactive_type) < 0) { Branch (11849:9): [True: 0, False: 17]
|
11850 | return -1; |
11851 | } |
11852 | if (PyModule_AddObjectRef(m, "Expression", state->Expression_type) < 0) { Branch (11852:9): [True: 0, False: 17]
|
11853 | return -1; |
11854 | } |
11855 | if (PyModule_AddObjectRef(m, "FunctionType", state->FunctionType_type) < 0) Branch (11855:9): [True: 0, False: 17]
|
11856 | { |
11857 | return -1; |
11858 | } |
11859 | if (PyModule_AddObjectRef(m, "stmt", state->stmt_type) < 0) { Branch (11859:9): [True: 0, False: 17]
|
11860 | return -1; |
11861 | } |
11862 | if (PyModule_AddObjectRef(m, "FunctionDef", state->FunctionDef_type) < 0) { Branch (11862:9): [True: 0, False: 17]
|
11863 | return -1; |
11864 | } |
11865 | if (PyModule_AddObjectRef(m, "AsyncFunctionDef", Branch (11865:9): [True: 0, False: 17]
|
11866 | state->AsyncFunctionDef_type) < 0) { |
11867 | return -1; |
11868 | } |
11869 | if (PyModule_AddObjectRef(m, "ClassDef", state->ClassDef_type) < 0) { Branch (11869:9): [True: 0, False: 17]
|
11870 | return -1; |
11871 | } |
11872 | if (PyModule_AddObjectRef(m, "Return", state->Return_type) < 0) { Branch (11872:9): [True: 0, False: 17]
|
11873 | return -1; |
11874 | } |
11875 | if (PyModule_AddObjectRef(m, "Delete", state->Delete_type) < 0) { Branch (11875:9): [True: 0, False: 17]
|
11876 | return -1; |
11877 | } |
11878 | if (PyModule_AddObjectRef(m, "Assign", state->Assign_type) < 0) { Branch (11878:9): [True: 0, False: 17]
|
11879 | return -1; |
11880 | } |
11881 | if (PyModule_AddObjectRef(m, "AugAssign", state->AugAssign_type) < 0) { Branch (11881:9): [True: 0, False: 17]
|
11882 | return -1; |
11883 | } |
11884 | if (PyModule_AddObjectRef(m, "AnnAssign", state->AnnAssign_type) < 0) { Branch (11884:9): [True: 0, False: 17]
|
11885 | return -1; |
11886 | } |
11887 | if (PyModule_AddObjectRef(m, "For", state->For_type) < 0) { Branch (11887:9): [True: 0, False: 17]
|
11888 | return -1; |
11889 | } |
11890 | if (PyModule_AddObjectRef(m, "AsyncFor", state->AsyncFor_type) < 0) { Branch (11890:9): [True: 0, False: 17]
|
11891 | return -1; |
11892 | } |
11893 | if (PyModule_AddObjectRef(m, "While", state->While_type) < 0) { Branch (11893:9): [True: 0, False: 17]
|
11894 | return -1; |
11895 | } |
11896 | if (PyModule_AddObjectRef(m, "If", state->If_type) < 0) { Branch (11896:9): [True: 0, False: 17]
|
11897 | return -1; |
11898 | } |
11899 | if (PyModule_AddObjectRef(m, "With", state->With_type) < 0) { Branch (11899:9): [True: 0, False: 17]
|
11900 | return -1; |
11901 | } |
11902 | if (PyModule_AddObjectRef(m, "AsyncWith", state->AsyncWith_type) < 0) { Branch (11902:9): [True: 0, False: 17]
|
11903 | return -1; |
11904 | } |
11905 | if (PyModule_AddObjectRef(m, "Match", state->Match_type) < 0) { Branch (11905:9): [True: 0, False: 17]
|
11906 | return -1; |
11907 | } |
11908 | if (PyModule_AddObjectRef(m, "Raise", state->Raise_type) < 0) { Branch (11908:9): [True: 0, False: 17]
|
11909 | return -1; |
11910 | } |
11911 | if (PyModule_AddObjectRef(m, "Try", state->Try_type) < 0) { Branch (11911:9): [True: 0, False: 17]
|
11912 | return -1; |
11913 | } |
11914 | if (PyModule_AddObjectRef(m, "TryStar", state->TryStar_type) < 0) { Branch (11914:9): [True: 0, False: 17]
|
11915 | return -1; |
11916 | } |
11917 | if (PyModule_AddObjectRef(m, "Assert", state->Assert_type) < 0) { Branch (11917:9): [True: 0, False: 17]
|
11918 | return -1; |
11919 | } |
11920 | if (PyModule_AddObjectRef(m, "Import", state->Import_type) < 0) { Branch (11920:9): [True: 0, False: 17]
|
11921 | return -1; |
11922 | } |
11923 | if (PyModule_AddObjectRef(m, "ImportFrom", state->ImportFrom_type) < 0) { Branch (11923:9): [True: 0, False: 17]
|
11924 | return -1; |
11925 | } |
11926 | if (PyModule_AddObjectRef(m, "Global", state->Global_type) < 0) { Branch (11926:9): [True: 0, False: 17]
|
11927 | return -1; |
11928 | } |
11929 | if (PyModule_AddObjectRef(m, "Nonlocal", state->Nonlocal_type) < 0) { Branch (11929:9): [True: 0, False: 17]
|
11930 | return -1; |
11931 | } |
11932 | if (PyModule_AddObjectRef(m, "Expr", state->Expr_type) < 0) { Branch (11932:9): [True: 0, False: 17]
|
11933 | return -1; |
11934 | } |
11935 | if (PyModule_AddObjectRef(m, "Pass", state->Pass_type) < 0) { Branch (11935:9): [True: 0, False: 17]
|
11936 | return -1; |
11937 | } |
11938 | if (PyModule_AddObjectRef(m, "Break", state->Break_type) < 0) { Branch (11938:9): [True: 0, False: 17]
|
11939 | return -1; |
11940 | } |
11941 | if (PyModule_AddObjectRef(m, "Continue", state->Continue_type) < 0) { Branch (11941:9): [True: 0, False: 17]
|
11942 | return -1; |
11943 | } |
11944 | if (PyModule_AddObjectRef(m, "expr", state->expr_type) < 0) { Branch (11944:9): [True: 0, False: 17]
|
11945 | return -1; |
11946 | } |
11947 | if (PyModule_AddObjectRef(m, "BoolOp", state->BoolOp_type) < 0) { Branch (11947:9): [True: 0, False: 17]
|
11948 | return -1; |
11949 | } |
11950 | if (PyModule_AddObjectRef(m, "NamedExpr", state->NamedExpr_type) < 0) { Branch (11950:9): [True: 0, False: 17]
|
11951 | return -1; |
11952 | } |
11953 | if (PyModule_AddObjectRef(m, "BinOp", state->BinOp_type) < 0) { Branch (11953:9): [True: 0, False: 17]
|
11954 | return -1; |
11955 | } |
11956 | if (PyModule_AddObjectRef(m, "UnaryOp", state->UnaryOp_type) < 0) { Branch (11956:9): [True: 0, False: 17]
|
11957 | return -1; |
11958 | } |
11959 | if (PyModule_AddObjectRef(m, "Lambda", state->Lambda_type) < 0) { Branch (11959:9): [True: 0, False: 17]
|
11960 | return -1; |
11961 | } |
11962 | if (PyModule_AddObjectRef(m, "IfExp", state->IfExp_type) < 0) { Branch (11962:9): [True: 0, False: 17]
|
11963 | return -1; |
11964 | } |
11965 | if (PyModule_AddObjectRef(m, "Dict", state->Dict_type) < 0) { Branch (11965:9): [True: 0, False: 17]
|
11966 | return -1; |
11967 | } |
11968 | if (PyModule_AddObjectRef(m, "Set", state->Set_type) < 0) { Branch (11968:9): [True: 0, False: 17]
|
11969 | return -1; |
11970 | } |
11971 | if (PyModule_AddObjectRef(m, "ListComp", state->ListComp_type) < 0) { Branch (11971:9): [True: 0, False: 17]
|
11972 | return -1; |
11973 | } |
11974 | if (PyModule_AddObjectRef(m, "SetComp", state->SetComp_type) < 0) { Branch (11974:9): [True: 0, False: 17]
|
11975 | return -1; |
11976 | } |
11977 | if (PyModule_AddObjectRef(m, "DictComp", state->DictComp_type) < 0) { Branch (11977:9): [True: 0, False: 17]
|
11978 | return -1; |
11979 | } |
11980 | if (PyModule_AddObjectRef(m, "GeneratorExp", state->GeneratorExp_type) < 0) Branch (11980:9): [True: 0, False: 17]
|
11981 | { |
11982 | return -1; |
11983 | } |
11984 | if (PyModule_AddObjectRef(m, "Await", state->Await_type) < 0) { Branch (11984:9): [True: 0, False: 17]
|
11985 | return -1; |
11986 | } |
11987 | if (PyModule_AddObjectRef(m, "Yield", state->Yield_type) < 0) { Branch (11987:9): [True: 0, False: 17]
|
11988 | return -1; |
11989 | } |
11990 | if (PyModule_AddObjectRef(m, "YieldFrom", state->YieldFrom_type) < 0) { Branch (11990:9): [True: 0, False: 17]
|
11991 | return -1; |
11992 | } |
11993 | if (PyModule_AddObjectRef(m, "Compare", state->Compare_type) < 0) { Branch (11993:9): [True: 0, False: 17]
|
11994 | return -1; |
11995 | } |
11996 | if (PyModule_AddObjectRef(m, "Call", state->Call_type) < 0) { Branch (11996:9): [True: 0, False: 17]
|
11997 | return -1; |
11998 | } |
11999 | if (PyModule_AddObjectRef(m, "FormattedValue", state->FormattedValue_type) Branch (11999:9): [True: 0, False: 17]
|
12000 | < 0) { |
12001 | return -1; |
12002 | } |
12003 | if (PyModule_AddObjectRef(m, "JoinedStr", state->JoinedStr_type) < 0) { Branch (12003:9): [True: 0, False: 17]
|
12004 | return -1; |
12005 | } |
12006 | if (PyModule_AddObjectRef(m, "Constant", state->Constant_type) < 0) { Branch (12006:9): [True: 0, False: 17]
|
12007 | return -1; |
12008 | } |
12009 | if (PyModule_AddObjectRef(m, "Attribute", state->Attribute_type) < 0) { Branch (12009:9): [True: 0, False: 17]
|
12010 | return -1; |
12011 | } |
12012 | if (PyModule_AddObjectRef(m, "Subscript", state->Subscript_type) < 0) { Branch (12012:9): [True: 0, False: 17]
|
12013 | return -1; |
12014 | } |
12015 | if (PyModule_AddObjectRef(m, "Starred", state->Starred_type) < 0) { Branch (12015:9): [True: 0, False: 17]
|
12016 | return -1; |
12017 | } |
12018 | if (PyModule_AddObjectRef(m, "Name", state->Name_type) < 0) { Branch (12018:9): [True: 0, False: 17]
|
12019 | return -1; |
12020 | } |
12021 | if (PyModule_AddObjectRef(m, "List", state->List_type) < 0) { Branch (12021:9): [True: 0, False: 17]
|
12022 | return -1; |
12023 | } |
12024 | if (PyModule_AddObjectRef(m, "Tuple", state->Tuple_type) < 0) { Branch (12024:9): [True: 0, False: 17]
|
12025 | return -1; |
12026 | } |
12027 | if (PyModule_AddObjectRef(m, "Slice", state->Slice_type) < 0) { Branch (12027:9): [True: 0, False: 17]
|
12028 | return -1; |
12029 | } |
12030 | if (PyModule_AddObjectRef(m, "expr_context", state->expr_context_type) < 0) Branch (12030:9): [True: 0, False: 17]
|
12031 | { |
12032 | return -1; |
12033 | } |
12034 | if (PyModule_AddObjectRef(m, "Load", state->Load_type) < 0) { Branch (12034:9): [True: 0, False: 17]
|
12035 | return -1; |
12036 | } |
12037 | if (PyModule_AddObjectRef(m, "Store", state->Store_type) < 0) { Branch (12037:9): [True: 0, False: 17]
|
12038 | return -1; |
12039 | } |
12040 | if (PyModule_AddObjectRef(m, "Del", state->Del_type) < 0) { Branch (12040:9): [True: 0, False: 17]
|
12041 | return -1; |
12042 | } |
12043 | if (PyModule_AddObjectRef(m, "boolop", state->boolop_type) < 0) { Branch (12043:9): [True: 0, False: 17]
|
12044 | return -1; |
12045 | } |
12046 | if (PyModule_AddObjectRef(m, "And", state->And_type) < 0) { Branch (12046:9): [True: 0, False: 17]
|
12047 | return -1; |
12048 | } |
12049 | if (PyModule_AddObjectRef(m, "Or", state->Or_type) < 0) { Branch (12049:9): [True: 0, False: 17]
|
12050 | return -1; |
12051 | } |
12052 | if (PyModule_AddObjectRef(m, "operator", state->operator_type) < 0) { Branch (12052:9): [True: 0, False: 17]
|
12053 | return -1; |
12054 | } |
12055 | if (PyModule_AddObjectRef(m, "Add", state->Add_type) < 0) { Branch (12055:9): [True: 0, False: 17]
|
12056 | return -1; |
12057 | } |
12058 | if (PyModule_AddObjectRef(m, "Sub", state->Sub_type) < 0) { Branch (12058:9): [True: 0, False: 17]
|
12059 | return -1; |
12060 | } |
12061 | if (PyModule_AddObjectRef(m, "Mult", state->Mult_type) < 0) { Branch (12061:9): [True: 0, False: 17]
|
12062 | return -1; |
12063 | } |
12064 | if (PyModule_AddObjectRef(m, "MatMult", state->MatMult_type) < 0) { Branch (12064:9): [True: 0, False: 17]
|
12065 | return -1; |
12066 | } |
12067 | if (PyModule_AddObjectRef(m, "Div", state->Div_type) < 0) { Branch (12067:9): [True: 0, False: 17]
|
12068 | return -1; |
12069 | } |
12070 | if (PyModule_AddObjectRef(m, "Mod", state->Mod_type) < 0) { Branch (12070:9): [True: 0, False: 17]
|
12071 | return -1; |
12072 | } |
12073 | if (PyModule_AddObjectRef(m, "Pow", state->Pow_type) < 0) { Branch (12073:9): [True: 0, False: 17]
|
12074 | return -1; |
12075 | } |
12076 | if (PyModule_AddObjectRef(m, "LShift", state->LShift_type) < 0) { Branch (12076:9): [True: 0, False: 17]
|
12077 | return -1; |
12078 | } |
12079 | if (PyModule_AddObjectRef(m, "RShift", state->RShift_type) < 0) { Branch (12079:9): [True: 0, False: 17]
|
12080 | return -1; |
12081 | } |
12082 | if (PyModule_AddObjectRef(m, "BitOr", state->BitOr_type) < 0) { Branch (12082:9): [True: 0, False: 17]
|
12083 | return -1; |
12084 | } |
12085 | if (PyModule_AddObjectRef(m, "BitXor", state->BitXor_type) < 0) { Branch (12085:9): [True: 0, False: 17]
|
12086 | return -1; |
12087 | } |
12088 | if (PyModule_AddObjectRef(m, "BitAnd", state->BitAnd_type) < 0) { Branch (12088:9): [True: 0, False: 17]
|
12089 | return -1; |
12090 | } |
12091 | if (PyModule_AddObjectRef(m, "FloorDiv", state->FloorDiv_type) < 0) { Branch (12091:9): [True: 0, False: 17]
|
12092 | return -1; |
12093 | } |
12094 | if (PyModule_AddObjectRef(m, "unaryop", state->unaryop_type) < 0) { Branch (12094:9): [True: 0, False: 17]
|
12095 | return -1; |
12096 | } |
12097 | if (PyModule_AddObjectRef(m, "Invert", state->Invert_type) < 0) { Branch (12097:9): [True: 0, False: 17]
|
12098 | return -1; |
12099 | } |
12100 | if (PyModule_AddObjectRef(m, "Not", state->Not_type) < 0) { Branch (12100:9): [True: 0, False: 17]
|
12101 | return -1; |
12102 | } |
12103 | if (PyModule_AddObjectRef(m, "UAdd", state->UAdd_type) < 0) { Branch (12103:9): [True: 0, False: 17]
|
12104 | return -1; |
12105 | } |
12106 | if (PyModule_AddObjectRef(m, "USub", state->USub_type) < 0) { Branch (12106:9): [True: 0, False: 17]
|
12107 | return -1; |
12108 | } |
12109 | if (PyModule_AddObjectRef(m, "cmpop", state->cmpop_type) < 0) { Branch (12109:9): [True: 0, False: 17]
|
12110 | return -1; |
12111 | } |
12112 | if (PyModule_AddObjectRef(m, "Eq", state->Eq_type) < 0) { Branch (12112:9): [True: 0, False: 17]
|
12113 | return -1; |
12114 | } |
12115 | if (PyModule_AddObjectRef(m, "NotEq", state->NotEq_type) < 0) { Branch (12115:9): [True: 0, False: 17]
|
12116 | return -1; |
12117 | } |
12118 | if (PyModule_AddObjectRef(m, "Lt", state->Lt_type) < 0) { Branch (12118:9): [True: 0, False: 17]
|
12119 | return -1; |
12120 | } |
12121 | if (PyModule_AddObjectRef(m, "LtE", state->LtE_type) < 0) { Branch (12121:9): [True: 0, False: 17]
|
12122 | return -1; |
12123 | } |
12124 | if (PyModule_AddObjectRef(m, "Gt", state->Gt_type) < 0) { Branch (12124:9): [True: 0, False: 17]
|
12125 | return -1; |
12126 | } |
12127 | if (PyModule_AddObjectRef(m, "GtE", state->GtE_type) < 0) { Branch (12127:9): [True: 0, False: 17]
|
12128 | return -1; |
12129 | } |
12130 | if (PyModule_AddObjectRef(m, "Is", state->Is_type) < 0) { Branch (12130:9): [True: 0, False: 17]
|
12131 | return -1; |
12132 | } |
12133 | if (PyModule_AddObjectRef(m, "IsNot", state->IsNot_type) < 0) { Branch (12133:9): [True: 0, False: 17]
|
12134 | return -1; |
12135 | } |
12136 | if (PyModule_AddObjectRef(m, "In", state->In_type) < 0) { Branch (12136:9): [True: 0, False: 17]
|
12137 | return -1; |
12138 | } |
12139 | if (PyModule_AddObjectRef(m, "NotIn", state->NotIn_type) < 0) { Branch (12139:9): [True: 0, False: 17]
|
12140 | return -1; |
12141 | } |
12142 | if (PyModule_AddObjectRef(m, "comprehension", state->comprehension_type) < Branch (12142:9): [True: 0, False: 17]
|
12143 | 0) { |
12144 | return -1; |
12145 | } |
12146 | if (PyModule_AddObjectRef(m, "excepthandler", state->excepthandler_type) < Branch (12146:9): [True: 0, False: 17]
|
12147 | 0) { |
12148 | return -1; |
12149 | } |
12150 | if (PyModule_AddObjectRef(m, "ExceptHandler", state->ExceptHandler_type) < Branch (12150:9): [True: 0, False: 17]
|
12151 | 0) { |
12152 | return -1; |
12153 | } |
12154 | if (PyModule_AddObjectRef(m, "arguments", state->arguments_type) < 0) { Branch (12154:9): [True: 0, False: 17]
|
12155 | return -1; |
12156 | } |
12157 | if (PyModule_AddObjectRef(m, "arg", state->arg_type) < 0) { Branch (12157:9): [True: 0, False: 17]
|
12158 | return -1; |
12159 | } |
12160 | if (PyModule_AddObjectRef(m, "keyword", state->keyword_type) < 0) { Branch (12160:9): [True: 0, False: 17]
|
12161 | return -1; |
12162 | } |
12163 | if (PyModule_AddObjectRef(m, "alias", state->alias_type) < 0) { Branch (12163:9): [True: 0, False: 17]
|
12164 | return -1; |
12165 | } |
12166 | if (PyModule_AddObjectRef(m, "withitem", state->withitem_type) < 0) { Branch (12166:9): [True: 0, False: 17]
|
12167 | return -1; |
12168 | } |
12169 | if (PyModule_AddObjectRef(m, "match_case", state->match_case_type) < 0) { Branch (12169:9): [True: 0, False: 17]
|
12170 | return -1; |
12171 | } |
12172 | if (PyModule_AddObjectRef(m, "pattern", state->pattern_type) < 0) { Branch (12172:9): [True: 0, False: 17]
|
12173 | return -1; |
12174 | } |
12175 | if (PyModule_AddObjectRef(m, "MatchValue", state->MatchValue_type) < 0) { Branch (12175:9): [True: 0, False: 17]
|
12176 | return -1; |
12177 | } |
12178 | if (PyModule_AddObjectRef(m, "MatchSingleton", state->MatchSingleton_type) Branch (12178:9): [True: 0, False: 17]
|
12179 | < 0) { |
12180 | return -1; |
12181 | } |
12182 | if (PyModule_AddObjectRef(m, "MatchSequence", state->MatchSequence_type) < Branch (12182:9): [True: 0, False: 17]
|
12183 | 0) { |
12184 | return -1; |
12185 | } |
12186 | if (PyModule_AddObjectRef(m, "MatchMapping", state->MatchMapping_type) < 0) Branch (12186:9): [True: 0, False: 17]
|
12187 | { |
12188 | return -1; |
12189 | } |
12190 | if (PyModule_AddObjectRef(m, "MatchClass", state->MatchClass_type) < 0) { Branch (12190:9): [True: 0, False: 17]
|
12191 | return -1; |
12192 | } |
12193 | if (PyModule_AddObjectRef(m, "MatchStar", state->MatchStar_type) < 0) { Branch (12193:9): [True: 0, False: 17]
|
12194 | return -1; |
12195 | } |
12196 | if (PyModule_AddObjectRef(m, "MatchAs", state->MatchAs_type) < 0) { Branch (12196:9): [True: 0, False: 17]
|
12197 | return -1; |
12198 | } |
12199 | if (PyModule_AddObjectRef(m, "MatchOr", state->MatchOr_type) < 0) { Branch (12199:9): [True: 0, False: 17]
|
12200 | return -1; |
12201 | } |
12202 | if (PyModule_AddObjectRef(m, "type_ignore", state->type_ignore_type) < 0) { Branch (12202:9): [True: 0, False: 17]
|
12203 | return -1; |
12204 | } |
12205 | if (PyModule_AddObjectRef(m, "TypeIgnore", state->TypeIgnore_type) < 0) { Branch (12205:9): [True: 0, False: 17]
|
12206 | return -1; |
12207 | } |
12208 | return 0; |
12209 | } |
12210 | |
12211 | static PyModuleDef_Slot astmodule_slots[] = { |
12212 | {Py_mod_exec, astmodule_exec}, |
12213 | {0, NULL} |
12214 | }; |
12215 | |
12216 | static struct PyModuleDef _astmodule = { |
12217 | PyModuleDef_HEAD_INIT, |
12218 | .m_name = "_ast", |
12219 | // The _ast module uses a per-interpreter state (PyInterpreterState.ast) |
12220 | .m_size = 0, |
12221 | .m_slots = astmodule_slots, |
12222 | }; |
12223 | |
12224 | PyMODINIT_FUNC |
12225 | PyInit__ast(void) |
12226 | { |
12227 | return PyModuleDef_Init(&_astmodule); |
12228 | } |
12229 | |
12230 | |
12231 | PyObject* PyAST_mod2obj(mod_ty t) |
12232 | { |
12233 | struct ast_state *state = get_ast_state(); |
12234 | if (state == NULL) { Branch (12234:9): [True: 0, False: 8.94k]
|
12235 | return NULL; |
12236 | } |
12237 | return ast2obj_mod(state, t); |
12238 | } |
12239 | |
12240 | /* mode is 0 for "exec", 1 for "eval" and 2 for "single" input */ |
12241 | mod_ty PyAST_obj2mod(PyObject* ast, PyArena* arena, int mode) |
12242 | { |
12243 | const char * const req_name[] = {"Module", "Expression", "Interactive"}; |
12244 | int isinstance; |
12245 | |
12246 | if (PySys_Audit("compile", "OO", ast, Py_None) < 0) { Branch (12246:9): [True: 0, False: 688]
|
12247 | return NULL; |
12248 | } |
12249 | |
12250 | struct ast_state *state = get_ast_state(); |
12251 | if (state == NULL) { Branch (12251:9): [True: 0, False: 688]
|
12252 | return NULL; |
12253 | } |
12254 | |
12255 | PyObject *req_type[3]; |
12256 | req_type[0] = state->Module_type; |
12257 | req_type[1] = state->Expression_type; |
12258 | req_type[2] = state->Interactive_type; |
12259 | |
12260 | assert(0 <= mode && mode <= 2); |
12261 | |
12262 | isinstance = PyObject_IsInstance(ast, req_type[mode]); |
12263 | if (isinstance == -1) Branch (12263:9): [True: 0, False: 688]
|
12264 | return NULL; |
12265 | if (!isinstance) { Branch (12265:9): [True: 2, False: 686]
|
12266 | PyErr_Format(PyExc_TypeError, "expected %s node, got %.400s", |
12267 | req_name[mode], _PyType_Name(Py_TYPE(ast))); |
12268 | return NULL; |
12269 | } |
12270 | |
12271 | mod_ty res = NULL; |
12272 | if (obj2ast_mod(state, ast, &res, arena) != 0) Branch (12272:9): [True: 7, False: 679]
|
12273 | return NULL; |
12274 | else |
12275 | return res; |
12276 | } |
12277 | |
12278 | int PyAST_Check(PyObject* obj) |
12279 | { |
12280 | struct ast_state *state = get_ast_state(); |
12281 | if (state == NULL) { Branch (12281:9): [True: 0, False: 17.8k]
|
12282 | return -1; |
12283 | } |
12284 | return PyObject_IsInstance(obj, state->AST_type); |
12285 | } |
12286 | |
12287 | |