1 /* File automatically generated by Parser/asdl_c.py */
4 #include "Python-ast.h"
6 static PyTypeObject
* AST_type
;
7 static PyTypeObject
*mod_type
;
8 static PyObject
* ast2obj_mod(void*);
9 static PyTypeObject
*Module_type
;
10 static char *Module_fields
[]={
13 static PyTypeObject
*Interactive_type
;
14 static char *Interactive_fields
[]={
17 static PyTypeObject
*Expression_type
;
18 static char *Expression_fields
[]={
21 static PyTypeObject
*Suite_type
;
22 static char *Suite_fields
[]={
25 static PyTypeObject
*stmt_type
;
26 static char *stmt_attributes
[] = {
30 static PyObject
* ast2obj_stmt(void*);
31 static PyTypeObject
*FunctionDef_type
;
32 static char *FunctionDef_fields
[]={
38 static PyTypeObject
*ClassDef_type
;
39 static char *ClassDef_fields
[]={
44 static PyTypeObject
*Return_type
;
45 static char *Return_fields
[]={
48 static PyTypeObject
*Delete_type
;
49 static char *Delete_fields
[]={
52 static PyTypeObject
*Assign_type
;
53 static char *Assign_fields
[]={
57 static PyTypeObject
*AugAssign_type
;
58 static char *AugAssign_fields
[]={
63 static PyTypeObject
*Print_type
;
64 static char *Print_fields
[]={
69 static PyTypeObject
*For_type
;
70 static char *For_fields
[]={
76 static PyTypeObject
*While_type
;
77 static char *While_fields
[]={
82 static PyTypeObject
*If_type
;
83 static char *If_fields
[]={
88 static PyTypeObject
*With_type
;
89 static char *With_fields
[]={
94 static PyTypeObject
*Raise_type
;
95 static char *Raise_fields
[]={
100 static PyTypeObject
*TryExcept_type
;
101 static char *TryExcept_fields
[]={
106 static PyTypeObject
*TryFinally_type
;
107 static char *TryFinally_fields
[]={
111 static PyTypeObject
*Assert_type
;
112 static char *Assert_fields
[]={
116 static PyTypeObject
*Import_type
;
117 static char *Import_fields
[]={
120 static PyTypeObject
*ImportFrom_type
;
121 static char *ImportFrom_fields
[]={
126 static PyTypeObject
*Exec_type
;
127 static char *Exec_fields
[]={
132 static PyTypeObject
*Global_type
;
133 static char *Global_fields
[]={
136 static PyTypeObject
*Expr_type
;
137 static char *Expr_fields
[]={
140 static PyTypeObject
*Pass_type
;
141 static PyTypeObject
*Break_type
;
142 static PyTypeObject
*Continue_type
;
143 static PyTypeObject
*expr_type
;
144 static char *expr_attributes
[] = {
148 static PyObject
* ast2obj_expr(void*);
149 static PyTypeObject
*BoolOp_type
;
150 static char *BoolOp_fields
[]={
154 static PyTypeObject
*BinOp_type
;
155 static char *BinOp_fields
[]={
160 static PyTypeObject
*UnaryOp_type
;
161 static char *UnaryOp_fields
[]={
165 static PyTypeObject
*Lambda_type
;
166 static char *Lambda_fields
[]={
170 static PyTypeObject
*IfExp_type
;
171 static char *IfExp_fields
[]={
176 static PyTypeObject
*Dict_type
;
177 static char *Dict_fields
[]={
181 static PyTypeObject
*ListComp_type
;
182 static char *ListComp_fields
[]={
186 static PyTypeObject
*GeneratorExp_type
;
187 static char *GeneratorExp_fields
[]={
191 static PyTypeObject
*Yield_type
;
192 static char *Yield_fields
[]={
195 static PyTypeObject
*Compare_type
;
196 static char *Compare_fields
[]={
201 static PyTypeObject
*Call_type
;
202 static char *Call_fields
[]={
209 static PyTypeObject
*Repr_type
;
210 static char *Repr_fields
[]={
213 static PyTypeObject
*Num_type
;
214 static char *Num_fields
[]={
217 static PyTypeObject
*Str_type
;
218 static char *Str_fields
[]={
221 static PyTypeObject
*Attribute_type
;
222 static char *Attribute_fields
[]={
227 static PyTypeObject
*Subscript_type
;
228 static char *Subscript_fields
[]={
233 static PyTypeObject
*Name_type
;
234 static char *Name_fields
[]={
238 static PyTypeObject
*List_type
;
239 static char *List_fields
[]={
243 static PyTypeObject
*Tuple_type
;
244 static char *Tuple_fields
[]={
248 static PyTypeObject
*expr_context_type
;
249 static PyObject
*Load_singleton
, *Store_singleton
, *Del_singleton
,
250 *AugLoad_singleton
, *AugStore_singleton
, *Param_singleton
;
251 static PyObject
* ast2obj_expr_context(expr_context_ty
);
252 static PyTypeObject
*Load_type
;
253 static PyTypeObject
*Store_type
;
254 static PyTypeObject
*Del_type
;
255 static PyTypeObject
*AugLoad_type
;
256 static PyTypeObject
*AugStore_type
;
257 static PyTypeObject
*Param_type
;
258 static PyTypeObject
*slice_type
;
259 static PyObject
* ast2obj_slice(void*);
260 static PyTypeObject
*Ellipsis_type
;
261 static PyTypeObject
*Slice_type
;
262 static char *Slice_fields
[]={
267 static PyTypeObject
*ExtSlice_type
;
268 static char *ExtSlice_fields
[]={
271 static PyTypeObject
*Index_type
;
272 static char *Index_fields
[]={
275 static PyTypeObject
*boolop_type
;
276 static PyObject
*And_singleton
, *Or_singleton
;
277 static PyObject
* ast2obj_boolop(boolop_ty
);
278 static PyTypeObject
*And_type
;
279 static PyTypeObject
*Or_type
;
280 static PyTypeObject
*operator_type
;
281 static PyObject
*Add_singleton
, *Sub_singleton
, *Mult_singleton
,
282 *Div_singleton
, *Mod_singleton
, *Pow_singleton
, *LShift_singleton
,
283 *RShift_singleton
, *BitOr_singleton
, *BitXor_singleton
, *BitAnd_singleton
,
285 static PyObject
* ast2obj_operator(operator_ty
);
286 static PyTypeObject
*Add_type
;
287 static PyTypeObject
*Sub_type
;
288 static PyTypeObject
*Mult_type
;
289 static PyTypeObject
*Div_type
;
290 static PyTypeObject
*Mod_type
;
291 static PyTypeObject
*Pow_type
;
292 static PyTypeObject
*LShift_type
;
293 static PyTypeObject
*RShift_type
;
294 static PyTypeObject
*BitOr_type
;
295 static PyTypeObject
*BitXor_type
;
296 static PyTypeObject
*BitAnd_type
;
297 static PyTypeObject
*FloorDiv_type
;
298 static PyTypeObject
*unaryop_type
;
299 static PyObject
*Invert_singleton
, *Not_singleton
, *UAdd_singleton
,
301 static PyObject
* ast2obj_unaryop(unaryop_ty
);
302 static PyTypeObject
*Invert_type
;
303 static PyTypeObject
*Not_type
;
304 static PyTypeObject
*UAdd_type
;
305 static PyTypeObject
*USub_type
;
306 static PyTypeObject
*cmpop_type
;
307 static PyObject
*Eq_singleton
, *NotEq_singleton
, *Lt_singleton
, *LtE_singleton
,
308 *Gt_singleton
, *GtE_singleton
, *Is_singleton
, *IsNot_singleton
, *In_singleton
,
310 static PyObject
* ast2obj_cmpop(cmpop_ty
);
311 static PyTypeObject
*Eq_type
;
312 static PyTypeObject
*NotEq_type
;
313 static PyTypeObject
*Lt_type
;
314 static PyTypeObject
*LtE_type
;
315 static PyTypeObject
*Gt_type
;
316 static PyTypeObject
*GtE_type
;
317 static PyTypeObject
*Is_type
;
318 static PyTypeObject
*IsNot_type
;
319 static PyTypeObject
*In_type
;
320 static PyTypeObject
*NotIn_type
;
321 static PyTypeObject
*comprehension_type
;
322 static PyObject
* ast2obj_comprehension(void*);
323 static char *comprehension_fields
[]={
328 static PyTypeObject
*excepthandler_type
;
329 static PyObject
* ast2obj_excepthandler(void*);
330 static char *excepthandler_fields
[]={
337 static PyTypeObject
*arguments_type
;
338 static PyObject
* ast2obj_arguments(void*);
339 static char *arguments_fields
[]={
345 static PyTypeObject
*keyword_type
;
346 static PyObject
* ast2obj_keyword(void*);
347 static char *keyword_fields
[]={
351 static PyTypeObject
*alias_type
;
352 static PyObject
* ast2obj_alias(void*);
353 static char *alias_fields
[]={
359 static PyTypeObject
* make_type(char *type
, PyTypeObject
* base
, char**fields
, int num_fields
)
361 PyObject
*fnames
, *result
;
364 fnames
= PyTuple_New(num_fields
);
365 if (!fnames
) return NULL
;
370 for(i
=0; i
< num_fields
; i
++) {
371 PyObject
*field
= PyString_FromString(fields
[i
]);
376 PyTuple_SET_ITEM(fnames
, i
, field
);
378 result
= PyObject_CallFunction((PyObject
*)&PyType_Type
, "s(O){sOss}",
379 type
, base
, "_fields", fnames
, "__module__", "_ast");
381 return (PyTypeObject
*)result
;
384 static int add_attributes(PyTypeObject
* type
, char**attrs
, int num_fields
)
387 PyObject
*s
, *l
= PyList_New(num_fields
);
389 for(i
= 0; i
< num_fields
; i
++) {
390 s
= PyString_FromString(attrs
[i
]);
395 PyList_SET_ITEM(l
, i
, s
);
397 result
= PyObject_SetAttrString((PyObject
*)type
, "_attributes", l
) >= 0;
402 static PyObject
* ast2obj_list(asdl_seq
*seq
, PyObject
* (*func
)(void*))
404 int i
, n
= asdl_seq_LEN(seq
);
405 PyObject
*result
= PyList_New(n
);
409 for (i
= 0; i
< n
; i
++) {
410 value
= func(asdl_seq_GET(seq
, i
));
415 PyList_SET_ITEM(result
, i
, value
);
420 static PyObject
* ast2obj_object(void *o
)
424 Py_INCREF((PyObject
*)o
);
427 #define ast2obj_identifier ast2obj_object
428 #define ast2obj_string ast2obj_object
429 static PyObject
* ast2obj_bool(bool b
)
431 return PyBool_FromLong(b
);
434 static PyObject
* ast2obj_int(bool b
)
436 return PyInt_FromLong(b
);
439 static int init_types(void)
441 static int initialized
;
442 if (initialized
) return 1;
443 AST_type
= make_type("AST", &PyBaseObject_Type
, NULL
, 0);
444 mod_type
= make_type("mod", AST_type
, NULL
, 0);
445 if (!mod_type
) return 0;
446 if (!add_attributes(mod_type
, NULL
, 0)) return 0;
447 Module_type
= make_type("Module", mod_type
, Module_fields
, 1);
448 if (!Module_type
) return 0;
449 Interactive_type
= make_type("Interactive", mod_type
,
450 Interactive_fields
, 1);
451 if (!Interactive_type
) return 0;
452 Expression_type
= make_type("Expression", mod_type
, Expression_fields
,
454 if (!Expression_type
) return 0;
455 Suite_type
= make_type("Suite", mod_type
, Suite_fields
, 1);
456 if (!Suite_type
) return 0;
457 stmt_type
= make_type("stmt", AST_type
, NULL
, 0);
458 if (!stmt_type
) return 0;
459 if (!add_attributes(stmt_type
, stmt_attributes
, 2)) return 0;
460 FunctionDef_type
= make_type("FunctionDef", stmt_type
,
461 FunctionDef_fields
, 4);
462 if (!FunctionDef_type
) return 0;
463 ClassDef_type
= make_type("ClassDef", stmt_type
, ClassDef_fields
, 3);
464 if (!ClassDef_type
) return 0;
465 Return_type
= make_type("Return", stmt_type
, Return_fields
, 1);
466 if (!Return_type
) return 0;
467 Delete_type
= make_type("Delete", stmt_type
, Delete_fields
, 1);
468 if (!Delete_type
) return 0;
469 Assign_type
= make_type("Assign", stmt_type
, Assign_fields
, 2);
470 if (!Assign_type
) return 0;
471 AugAssign_type
= make_type("AugAssign", stmt_type
, AugAssign_fields
, 3);
472 if (!AugAssign_type
) return 0;
473 Print_type
= make_type("Print", stmt_type
, Print_fields
, 3);
474 if (!Print_type
) return 0;
475 For_type
= make_type("For", stmt_type
, For_fields
, 4);
476 if (!For_type
) return 0;
477 While_type
= make_type("While", stmt_type
, While_fields
, 3);
478 if (!While_type
) return 0;
479 If_type
= make_type("If", stmt_type
, If_fields
, 3);
480 if (!If_type
) return 0;
481 With_type
= make_type("With", stmt_type
, With_fields
, 3);
482 if (!With_type
) return 0;
483 Raise_type
= make_type("Raise", stmt_type
, Raise_fields
, 3);
484 if (!Raise_type
) return 0;
485 TryExcept_type
= make_type("TryExcept", stmt_type
, TryExcept_fields
, 3);
486 if (!TryExcept_type
) return 0;
487 TryFinally_type
= make_type("TryFinally", stmt_type
, TryFinally_fields
,
489 if (!TryFinally_type
) return 0;
490 Assert_type
= make_type("Assert", stmt_type
, Assert_fields
, 2);
491 if (!Assert_type
) return 0;
492 Import_type
= make_type("Import", stmt_type
, Import_fields
, 1);
493 if (!Import_type
) return 0;
494 ImportFrom_type
= make_type("ImportFrom", stmt_type
, ImportFrom_fields
,
496 if (!ImportFrom_type
) return 0;
497 Exec_type
= make_type("Exec", stmt_type
, Exec_fields
, 3);
498 if (!Exec_type
) return 0;
499 Global_type
= make_type("Global", stmt_type
, Global_fields
, 1);
500 if (!Global_type
) return 0;
501 Expr_type
= make_type("Expr", stmt_type
, Expr_fields
, 1);
502 if (!Expr_type
) return 0;
503 Pass_type
= make_type("Pass", stmt_type
, NULL
, 0);
504 if (!Pass_type
) return 0;
505 Break_type
= make_type("Break", stmt_type
, NULL
, 0);
506 if (!Break_type
) return 0;
507 Continue_type
= make_type("Continue", stmt_type
, NULL
, 0);
508 if (!Continue_type
) return 0;
509 expr_type
= make_type("expr", AST_type
, NULL
, 0);
510 if (!expr_type
) return 0;
511 if (!add_attributes(expr_type
, expr_attributes
, 2)) return 0;
512 BoolOp_type
= make_type("BoolOp", expr_type
, BoolOp_fields
, 2);
513 if (!BoolOp_type
) return 0;
514 BinOp_type
= make_type("BinOp", expr_type
, BinOp_fields
, 3);
515 if (!BinOp_type
) return 0;
516 UnaryOp_type
= make_type("UnaryOp", expr_type
, UnaryOp_fields
, 2);
517 if (!UnaryOp_type
) return 0;
518 Lambda_type
= make_type("Lambda", expr_type
, Lambda_fields
, 2);
519 if (!Lambda_type
) return 0;
520 IfExp_type
= make_type("IfExp", expr_type
, IfExp_fields
, 3);
521 if (!IfExp_type
) return 0;
522 Dict_type
= make_type("Dict", expr_type
, Dict_fields
, 2);
523 if (!Dict_type
) return 0;
524 ListComp_type
= make_type("ListComp", expr_type
, ListComp_fields
, 2);
525 if (!ListComp_type
) return 0;
526 GeneratorExp_type
= make_type("GeneratorExp", expr_type
,
527 GeneratorExp_fields
, 2);
528 if (!GeneratorExp_type
) return 0;
529 Yield_type
= make_type("Yield", expr_type
, Yield_fields
, 1);
530 if (!Yield_type
) return 0;
531 Compare_type
= make_type("Compare", expr_type
, Compare_fields
, 3);
532 if (!Compare_type
) return 0;
533 Call_type
= make_type("Call", expr_type
, Call_fields
, 5);
534 if (!Call_type
) return 0;
535 Repr_type
= make_type("Repr", expr_type
, Repr_fields
, 1);
536 if (!Repr_type
) return 0;
537 Num_type
= make_type("Num", expr_type
, Num_fields
, 1);
538 if (!Num_type
) return 0;
539 Str_type
= make_type("Str", expr_type
, Str_fields
, 1);
540 if (!Str_type
) return 0;
541 Attribute_type
= make_type("Attribute", expr_type
, Attribute_fields
, 3);
542 if (!Attribute_type
) return 0;
543 Subscript_type
= make_type("Subscript", expr_type
, Subscript_fields
, 3);
544 if (!Subscript_type
) return 0;
545 Name_type
= make_type("Name", expr_type
, Name_fields
, 2);
546 if (!Name_type
) return 0;
547 List_type
= make_type("List", expr_type
, List_fields
, 2);
548 if (!List_type
) return 0;
549 Tuple_type
= make_type("Tuple", expr_type
, Tuple_fields
, 2);
550 if (!Tuple_type
) return 0;
551 expr_context_type
= make_type("expr_context", AST_type
, NULL
, 0);
552 if (!expr_context_type
) return 0;
553 if (!add_attributes(expr_context_type
, NULL
, 0)) return 0;
554 Load_type
= make_type("Load", expr_context_type
, NULL
, 0);
555 if (!Load_type
) return 0;
556 Load_singleton
= PyType_GenericNew(Load_type
, NULL
, NULL
);
557 if (!Load_singleton
) return 0;
558 Store_type
= make_type("Store", expr_context_type
, NULL
, 0);
559 if (!Store_type
) return 0;
560 Store_singleton
= PyType_GenericNew(Store_type
, NULL
, NULL
);
561 if (!Store_singleton
) return 0;
562 Del_type
= make_type("Del", expr_context_type
, NULL
, 0);
563 if (!Del_type
) return 0;
564 Del_singleton
= PyType_GenericNew(Del_type
, NULL
, NULL
);
565 if (!Del_singleton
) return 0;
566 AugLoad_type
= make_type("AugLoad", expr_context_type
, NULL
, 0);
567 if (!AugLoad_type
) return 0;
568 AugLoad_singleton
= PyType_GenericNew(AugLoad_type
, NULL
, NULL
);
569 if (!AugLoad_singleton
) return 0;
570 AugStore_type
= make_type("AugStore", expr_context_type
, NULL
, 0);
571 if (!AugStore_type
) return 0;
572 AugStore_singleton
= PyType_GenericNew(AugStore_type
, NULL
, NULL
);
573 if (!AugStore_singleton
) return 0;
574 Param_type
= make_type("Param", expr_context_type
, NULL
, 0);
575 if (!Param_type
) return 0;
576 Param_singleton
= PyType_GenericNew(Param_type
, NULL
, NULL
);
577 if (!Param_singleton
) return 0;
578 slice_type
= make_type("slice", AST_type
, NULL
, 0);
579 if (!slice_type
) return 0;
580 if (!add_attributes(slice_type
, NULL
, 0)) return 0;
581 Ellipsis_type
= make_type("Ellipsis", slice_type
, NULL
, 0);
582 if (!Ellipsis_type
) return 0;
583 Slice_type
= make_type("Slice", slice_type
, Slice_fields
, 3);
584 if (!Slice_type
) return 0;
585 ExtSlice_type
= make_type("ExtSlice", slice_type
, ExtSlice_fields
, 1);
586 if (!ExtSlice_type
) return 0;
587 Index_type
= make_type("Index", slice_type
, Index_fields
, 1);
588 if (!Index_type
) return 0;
589 boolop_type
= make_type("boolop", AST_type
, NULL
, 0);
590 if (!boolop_type
) return 0;
591 if (!add_attributes(boolop_type
, NULL
, 0)) return 0;
592 And_type
= make_type("And", boolop_type
, NULL
, 0);
593 if (!And_type
) return 0;
594 And_singleton
= PyType_GenericNew(And_type
, NULL
, NULL
);
595 if (!And_singleton
) return 0;
596 Or_type
= make_type("Or", boolop_type
, NULL
, 0);
597 if (!Or_type
) return 0;
598 Or_singleton
= PyType_GenericNew(Or_type
, NULL
, NULL
);
599 if (!Or_singleton
) return 0;
600 operator_type
= make_type("operator", AST_type
, NULL
, 0);
601 if (!operator_type
) return 0;
602 if (!add_attributes(operator_type
, NULL
, 0)) return 0;
603 Add_type
= make_type("Add", operator_type
, NULL
, 0);
604 if (!Add_type
) return 0;
605 Add_singleton
= PyType_GenericNew(Add_type
, NULL
, NULL
);
606 if (!Add_singleton
) return 0;
607 Sub_type
= make_type("Sub", operator_type
, NULL
, 0);
608 if (!Sub_type
) return 0;
609 Sub_singleton
= PyType_GenericNew(Sub_type
, NULL
, NULL
);
610 if (!Sub_singleton
) return 0;
611 Mult_type
= make_type("Mult", operator_type
, NULL
, 0);
612 if (!Mult_type
) return 0;
613 Mult_singleton
= PyType_GenericNew(Mult_type
, NULL
, NULL
);
614 if (!Mult_singleton
) return 0;
615 Div_type
= make_type("Div", operator_type
, NULL
, 0);
616 if (!Div_type
) return 0;
617 Div_singleton
= PyType_GenericNew(Div_type
, NULL
, NULL
);
618 if (!Div_singleton
) return 0;
619 Mod_type
= make_type("Mod", operator_type
, NULL
, 0);
620 if (!Mod_type
) return 0;
621 Mod_singleton
= PyType_GenericNew(Mod_type
, NULL
, NULL
);
622 if (!Mod_singleton
) return 0;
623 Pow_type
= make_type("Pow", operator_type
, NULL
, 0);
624 if (!Pow_type
) return 0;
625 Pow_singleton
= PyType_GenericNew(Pow_type
, NULL
, NULL
);
626 if (!Pow_singleton
) return 0;
627 LShift_type
= make_type("LShift", operator_type
, NULL
, 0);
628 if (!LShift_type
) return 0;
629 LShift_singleton
= PyType_GenericNew(LShift_type
, NULL
, NULL
);
630 if (!LShift_singleton
) return 0;
631 RShift_type
= make_type("RShift", operator_type
, NULL
, 0);
632 if (!RShift_type
) return 0;
633 RShift_singleton
= PyType_GenericNew(RShift_type
, NULL
, NULL
);
634 if (!RShift_singleton
) return 0;
635 BitOr_type
= make_type("BitOr", operator_type
, NULL
, 0);
636 if (!BitOr_type
) return 0;
637 BitOr_singleton
= PyType_GenericNew(BitOr_type
, NULL
, NULL
);
638 if (!BitOr_singleton
) return 0;
639 BitXor_type
= make_type("BitXor", operator_type
, NULL
, 0);
640 if (!BitXor_type
) return 0;
641 BitXor_singleton
= PyType_GenericNew(BitXor_type
, NULL
, NULL
);
642 if (!BitXor_singleton
) return 0;
643 BitAnd_type
= make_type("BitAnd", operator_type
, NULL
, 0);
644 if (!BitAnd_type
) return 0;
645 BitAnd_singleton
= PyType_GenericNew(BitAnd_type
, NULL
, NULL
);
646 if (!BitAnd_singleton
) return 0;
647 FloorDiv_type
= make_type("FloorDiv", operator_type
, NULL
, 0);
648 if (!FloorDiv_type
) return 0;
649 FloorDiv_singleton
= PyType_GenericNew(FloorDiv_type
, NULL
, NULL
);
650 if (!FloorDiv_singleton
) return 0;
651 unaryop_type
= make_type("unaryop", AST_type
, NULL
, 0);
652 if (!unaryop_type
) return 0;
653 if (!add_attributes(unaryop_type
, NULL
, 0)) return 0;
654 Invert_type
= make_type("Invert", unaryop_type
, NULL
, 0);
655 if (!Invert_type
) return 0;
656 Invert_singleton
= PyType_GenericNew(Invert_type
, NULL
, NULL
);
657 if (!Invert_singleton
) return 0;
658 Not_type
= make_type("Not", unaryop_type
, NULL
, 0);
659 if (!Not_type
) return 0;
660 Not_singleton
= PyType_GenericNew(Not_type
, NULL
, NULL
);
661 if (!Not_singleton
) return 0;
662 UAdd_type
= make_type("UAdd", unaryop_type
, NULL
, 0);
663 if (!UAdd_type
) return 0;
664 UAdd_singleton
= PyType_GenericNew(UAdd_type
, NULL
, NULL
);
665 if (!UAdd_singleton
) return 0;
666 USub_type
= make_type("USub", unaryop_type
, NULL
, 0);
667 if (!USub_type
) return 0;
668 USub_singleton
= PyType_GenericNew(USub_type
, NULL
, NULL
);
669 if (!USub_singleton
) return 0;
670 cmpop_type
= make_type("cmpop", AST_type
, NULL
, 0);
671 if (!cmpop_type
) return 0;
672 if (!add_attributes(cmpop_type
, NULL
, 0)) return 0;
673 Eq_type
= make_type("Eq", cmpop_type
, NULL
, 0);
674 if (!Eq_type
) return 0;
675 Eq_singleton
= PyType_GenericNew(Eq_type
, NULL
, NULL
);
676 if (!Eq_singleton
) return 0;
677 NotEq_type
= make_type("NotEq", cmpop_type
, NULL
, 0);
678 if (!NotEq_type
) return 0;
679 NotEq_singleton
= PyType_GenericNew(NotEq_type
, NULL
, NULL
);
680 if (!NotEq_singleton
) return 0;
681 Lt_type
= make_type("Lt", cmpop_type
, NULL
, 0);
682 if (!Lt_type
) return 0;
683 Lt_singleton
= PyType_GenericNew(Lt_type
, NULL
, NULL
);
684 if (!Lt_singleton
) return 0;
685 LtE_type
= make_type("LtE", cmpop_type
, NULL
, 0);
686 if (!LtE_type
) return 0;
687 LtE_singleton
= PyType_GenericNew(LtE_type
, NULL
, NULL
);
688 if (!LtE_singleton
) return 0;
689 Gt_type
= make_type("Gt", cmpop_type
, NULL
, 0);
690 if (!Gt_type
) return 0;
691 Gt_singleton
= PyType_GenericNew(Gt_type
, NULL
, NULL
);
692 if (!Gt_singleton
) return 0;
693 GtE_type
= make_type("GtE", cmpop_type
, NULL
, 0);
694 if (!GtE_type
) return 0;
695 GtE_singleton
= PyType_GenericNew(GtE_type
, NULL
, NULL
);
696 if (!GtE_singleton
) return 0;
697 Is_type
= make_type("Is", cmpop_type
, NULL
, 0);
698 if (!Is_type
) return 0;
699 Is_singleton
= PyType_GenericNew(Is_type
, NULL
, NULL
);
700 if (!Is_singleton
) return 0;
701 IsNot_type
= make_type("IsNot", cmpop_type
, NULL
, 0);
702 if (!IsNot_type
) return 0;
703 IsNot_singleton
= PyType_GenericNew(IsNot_type
, NULL
, NULL
);
704 if (!IsNot_singleton
) return 0;
705 In_type
= make_type("In", cmpop_type
, NULL
, 0);
706 if (!In_type
) return 0;
707 In_singleton
= PyType_GenericNew(In_type
, NULL
, NULL
);
708 if (!In_singleton
) return 0;
709 NotIn_type
= make_type("NotIn", cmpop_type
, NULL
, 0);
710 if (!NotIn_type
) return 0;
711 NotIn_singleton
= PyType_GenericNew(NotIn_type
, NULL
, NULL
);
712 if (!NotIn_singleton
) return 0;
713 comprehension_type
= make_type("comprehension", AST_type
,
714 comprehension_fields
, 3);
715 if (!comprehension_type
) return 0;
716 excepthandler_type
= make_type("excepthandler", AST_type
,
717 excepthandler_fields
, 5);
718 if (!excepthandler_type
) return 0;
719 arguments_type
= make_type("arguments", AST_type
, arguments_fields
, 4);
720 if (!arguments_type
) return 0;
721 keyword_type
= make_type("keyword", AST_type
, keyword_fields
, 2);
722 if (!keyword_type
) return 0;
723 alias_type
= make_type("alias", AST_type
, alias_fields
, 2);
724 if (!alias_type
) return 0;
730 Module(asdl_seq
* body
, PyArena
*arena
)
733 p
= (mod_ty
)PyArena_Malloc(arena
, sizeof(*p
));
738 p
->kind
= Module_kind
;
739 p
->v
.Module
.body
= body
;
744 Interactive(asdl_seq
* body
, PyArena
*arena
)
747 p
= (mod_ty
)PyArena_Malloc(arena
, sizeof(*p
));
752 p
->kind
= Interactive_kind
;
753 p
->v
.Interactive
.body
= body
;
758 Expression(expr_ty body
, PyArena
*arena
)
762 PyErr_SetString(PyExc_ValueError
,
763 "field body is required for Expression");
766 p
= (mod_ty
)PyArena_Malloc(arena
, sizeof(*p
));
771 p
->kind
= Expression_kind
;
772 p
->v
.Expression
.body
= body
;
777 Suite(asdl_seq
* body
, PyArena
*arena
)
780 p
= (mod_ty
)PyArena_Malloc(arena
, sizeof(*p
));
785 p
->kind
= Suite_kind
;
786 p
->v
.Suite
.body
= body
;
791 FunctionDef(identifier name
, arguments_ty args
, asdl_seq
* body
, asdl_seq
*
792 decorators
, int lineno
, int col_offset
, PyArena
*arena
)
796 PyErr_SetString(PyExc_ValueError
,
797 "field name is required for FunctionDef");
801 PyErr_SetString(PyExc_ValueError
,
802 "field args is required for FunctionDef");
805 p
= (stmt_ty
)PyArena_Malloc(arena
, sizeof(*p
));
810 p
->kind
= FunctionDef_kind
;
811 p
->v
.FunctionDef
.name
= name
;
812 p
->v
.FunctionDef
.args
= args
;
813 p
->v
.FunctionDef
.body
= body
;
814 p
->v
.FunctionDef
.decorators
= decorators
;
816 p
->col_offset
= col_offset
;
821 ClassDef(identifier name
, asdl_seq
* bases
, asdl_seq
* body
, int lineno
, int
822 col_offset
, PyArena
*arena
)
826 PyErr_SetString(PyExc_ValueError
,
827 "field name is required for ClassDef");
830 p
= (stmt_ty
)PyArena_Malloc(arena
, sizeof(*p
));
835 p
->kind
= ClassDef_kind
;
836 p
->v
.ClassDef
.name
= name
;
837 p
->v
.ClassDef
.bases
= bases
;
838 p
->v
.ClassDef
.body
= body
;
840 p
->col_offset
= col_offset
;
845 Return(expr_ty value
, int lineno
, int col_offset
, PyArena
*arena
)
848 p
= (stmt_ty
)PyArena_Malloc(arena
, sizeof(*p
));
853 p
->kind
= Return_kind
;
854 p
->v
.Return
.value
= value
;
856 p
->col_offset
= col_offset
;
861 Delete(asdl_seq
* targets
, int lineno
, int col_offset
, PyArena
*arena
)
864 p
= (stmt_ty
)PyArena_Malloc(arena
, sizeof(*p
));
869 p
->kind
= Delete_kind
;
870 p
->v
.Delete
.targets
= targets
;
872 p
->col_offset
= col_offset
;
877 Assign(asdl_seq
* targets
, expr_ty value
, int lineno
, int col_offset
, PyArena
882 PyErr_SetString(PyExc_ValueError
,
883 "field value is required for Assign");
886 p
= (stmt_ty
)PyArena_Malloc(arena
, sizeof(*p
));
891 p
->kind
= Assign_kind
;
892 p
->v
.Assign
.targets
= targets
;
893 p
->v
.Assign
.value
= value
;
895 p
->col_offset
= col_offset
;
900 AugAssign(expr_ty target
, operator_ty op
, expr_ty value
, int lineno
, int
901 col_offset
, PyArena
*arena
)
905 PyErr_SetString(PyExc_ValueError
,
906 "field target is required for AugAssign");
910 PyErr_SetString(PyExc_ValueError
,
911 "field op is required for AugAssign");
915 PyErr_SetString(PyExc_ValueError
,
916 "field value is required for AugAssign");
919 p
= (stmt_ty
)PyArena_Malloc(arena
, sizeof(*p
));
924 p
->kind
= AugAssign_kind
;
925 p
->v
.AugAssign
.target
= target
;
926 p
->v
.AugAssign
.op
= op
;
927 p
->v
.AugAssign
.value
= value
;
929 p
->col_offset
= col_offset
;
934 Print(expr_ty dest
, asdl_seq
* values
, bool nl
, int lineno
, int col_offset
,
938 p
= (stmt_ty
)PyArena_Malloc(arena
, sizeof(*p
));
943 p
->kind
= Print_kind
;
944 p
->v
.Print
.dest
= dest
;
945 p
->v
.Print
.values
= values
;
948 p
->col_offset
= col_offset
;
953 For(expr_ty target
, expr_ty iter
, asdl_seq
* body
, asdl_seq
* orelse
, int
954 lineno
, int col_offset
, PyArena
*arena
)
958 PyErr_SetString(PyExc_ValueError
,
959 "field target is required for For");
963 PyErr_SetString(PyExc_ValueError
,
964 "field iter is required for For");
967 p
= (stmt_ty
)PyArena_Malloc(arena
, sizeof(*p
));
973 p
->v
.For
.target
= target
;
974 p
->v
.For
.iter
= iter
;
975 p
->v
.For
.body
= body
;
976 p
->v
.For
.orelse
= orelse
;
978 p
->col_offset
= col_offset
;
983 While(expr_ty test
, asdl_seq
* body
, asdl_seq
* orelse
, int lineno
, int
984 col_offset
, PyArena
*arena
)
988 PyErr_SetString(PyExc_ValueError
,
989 "field test is required for While");
992 p
= (stmt_ty
)PyArena_Malloc(arena
, sizeof(*p
));
997 p
->kind
= While_kind
;
998 p
->v
.While
.test
= test
;
999 p
->v
.While
.body
= body
;
1000 p
->v
.While
.orelse
= orelse
;
1002 p
->col_offset
= col_offset
;
1007 If(expr_ty test
, asdl_seq
* body
, asdl_seq
* orelse
, int lineno
, int
1008 col_offset
, PyArena
*arena
)
1012 PyErr_SetString(PyExc_ValueError
,
1013 "field test is required for If");
1016 p
= (stmt_ty
)PyArena_Malloc(arena
, sizeof(*p
));
1022 p
->v
.If
.test
= test
;
1023 p
->v
.If
.body
= body
;
1024 p
->v
.If
.orelse
= orelse
;
1026 p
->col_offset
= col_offset
;
1031 With(expr_ty context_expr
, expr_ty optional_vars
, asdl_seq
* body
, int lineno
,
1032 int col_offset
, PyArena
*arena
)
1035 if (!context_expr
) {
1036 PyErr_SetString(PyExc_ValueError
,
1037 "field context_expr is required for With");
1040 p
= (stmt_ty
)PyArena_Malloc(arena
, sizeof(*p
));
1045 p
->kind
= With_kind
;
1046 p
->v
.With
.context_expr
= context_expr
;
1047 p
->v
.With
.optional_vars
= optional_vars
;
1048 p
->v
.With
.body
= body
;
1050 p
->col_offset
= col_offset
;
1055 Raise(expr_ty type
, expr_ty inst
, expr_ty tback
, int lineno
, int col_offset
,
1059 p
= (stmt_ty
)PyArena_Malloc(arena
, sizeof(*p
));
1064 p
->kind
= Raise_kind
;
1065 p
->v
.Raise
.type
= type
;
1066 p
->v
.Raise
.inst
= inst
;
1067 p
->v
.Raise
.tback
= tback
;
1069 p
->col_offset
= col_offset
;
1074 TryExcept(asdl_seq
* body
, asdl_seq
* handlers
, asdl_seq
* orelse
, int lineno
,
1075 int col_offset
, PyArena
*arena
)
1078 p
= (stmt_ty
)PyArena_Malloc(arena
, sizeof(*p
));
1083 p
->kind
= TryExcept_kind
;
1084 p
->v
.TryExcept
.body
= body
;
1085 p
->v
.TryExcept
.handlers
= handlers
;
1086 p
->v
.TryExcept
.orelse
= orelse
;
1088 p
->col_offset
= col_offset
;
1093 TryFinally(asdl_seq
* body
, asdl_seq
* finalbody
, int lineno
, int col_offset
,
1097 p
= (stmt_ty
)PyArena_Malloc(arena
, sizeof(*p
));
1102 p
->kind
= TryFinally_kind
;
1103 p
->v
.TryFinally
.body
= body
;
1104 p
->v
.TryFinally
.finalbody
= finalbody
;
1106 p
->col_offset
= col_offset
;
1111 Assert(expr_ty test
, expr_ty msg
, int lineno
, int col_offset
, PyArena
*arena
)
1115 PyErr_SetString(PyExc_ValueError
,
1116 "field test is required for Assert");
1119 p
= (stmt_ty
)PyArena_Malloc(arena
, sizeof(*p
));
1124 p
->kind
= Assert_kind
;
1125 p
->v
.Assert
.test
= test
;
1126 p
->v
.Assert
.msg
= msg
;
1128 p
->col_offset
= col_offset
;
1133 Import(asdl_seq
* names
, int lineno
, int col_offset
, PyArena
*arena
)
1136 p
= (stmt_ty
)PyArena_Malloc(arena
, sizeof(*p
));
1141 p
->kind
= Import_kind
;
1142 p
->v
.Import
.names
= names
;
1144 p
->col_offset
= col_offset
;
1149 ImportFrom(identifier module
, asdl_seq
* names
, int level
, int lineno
, int
1150 col_offset
, PyArena
*arena
)
1154 PyErr_SetString(PyExc_ValueError
,
1155 "field module is required for ImportFrom");
1158 p
= (stmt_ty
)PyArena_Malloc(arena
, sizeof(*p
));
1163 p
->kind
= ImportFrom_kind
;
1164 p
->v
.ImportFrom
.module
= module
;
1165 p
->v
.ImportFrom
.names
= names
;
1166 p
->v
.ImportFrom
.level
= level
;
1168 p
->col_offset
= col_offset
;
1173 Exec(expr_ty body
, expr_ty globals
, expr_ty locals
, int lineno
, int col_offset
,
1178 PyErr_SetString(PyExc_ValueError
,
1179 "field body is required for Exec");
1182 p
= (stmt_ty
)PyArena_Malloc(arena
, sizeof(*p
));
1187 p
->kind
= Exec_kind
;
1188 p
->v
.Exec
.body
= body
;
1189 p
->v
.Exec
.globals
= globals
;
1190 p
->v
.Exec
.locals
= locals
;
1192 p
->col_offset
= col_offset
;
1197 Global(asdl_seq
* names
, int lineno
, int col_offset
, PyArena
*arena
)
1200 p
= (stmt_ty
)PyArena_Malloc(arena
, sizeof(*p
));
1205 p
->kind
= Global_kind
;
1206 p
->v
.Global
.names
= names
;
1208 p
->col_offset
= col_offset
;
1213 Expr(expr_ty value
, int lineno
, int col_offset
, PyArena
*arena
)
1217 PyErr_SetString(PyExc_ValueError
,
1218 "field value is required for Expr");
1221 p
= (stmt_ty
)PyArena_Malloc(arena
, sizeof(*p
));
1226 p
->kind
= Expr_kind
;
1227 p
->v
.Expr
.value
= value
;
1229 p
->col_offset
= col_offset
;
1234 Pass(int lineno
, int col_offset
, PyArena
*arena
)
1237 p
= (stmt_ty
)PyArena_Malloc(arena
, sizeof(*p
));
1242 p
->kind
= Pass_kind
;
1244 p
->col_offset
= col_offset
;
1249 Break(int lineno
, int col_offset
, PyArena
*arena
)
1252 p
= (stmt_ty
)PyArena_Malloc(arena
, sizeof(*p
));
1257 p
->kind
= Break_kind
;
1259 p
->col_offset
= col_offset
;
1264 Continue(int lineno
, int col_offset
, PyArena
*arena
)
1267 p
= (stmt_ty
)PyArena_Malloc(arena
, sizeof(*p
));
1272 p
->kind
= Continue_kind
;
1274 p
->col_offset
= col_offset
;
1279 BoolOp(boolop_ty op
, asdl_seq
* values
, int lineno
, int col_offset
, PyArena
1284 PyErr_SetString(PyExc_ValueError
,
1285 "field op is required for BoolOp");
1288 p
= (expr_ty
)PyArena_Malloc(arena
, sizeof(*p
));
1293 p
->kind
= BoolOp_kind
;
1294 p
->v
.BoolOp
.op
= op
;
1295 p
->v
.BoolOp
.values
= values
;
1297 p
->col_offset
= col_offset
;
1302 BinOp(expr_ty left
, operator_ty op
, expr_ty right
, int lineno
, int col_offset
,
1307 PyErr_SetString(PyExc_ValueError
,
1308 "field left is required for BinOp");
1312 PyErr_SetString(PyExc_ValueError
,
1313 "field op is required for BinOp");
1317 PyErr_SetString(PyExc_ValueError
,
1318 "field right is required for BinOp");
1321 p
= (expr_ty
)PyArena_Malloc(arena
, sizeof(*p
));
1326 p
->kind
= BinOp_kind
;
1327 p
->v
.BinOp
.left
= left
;
1329 p
->v
.BinOp
.right
= right
;
1331 p
->col_offset
= col_offset
;
1336 UnaryOp(unaryop_ty op
, expr_ty operand
, int lineno
, int col_offset
, PyArena
1341 PyErr_SetString(PyExc_ValueError
,
1342 "field op is required for UnaryOp");
1346 PyErr_SetString(PyExc_ValueError
,
1347 "field operand is required for UnaryOp");
1350 p
= (expr_ty
)PyArena_Malloc(arena
, sizeof(*p
));
1355 p
->kind
= UnaryOp_kind
;
1356 p
->v
.UnaryOp
.op
= op
;
1357 p
->v
.UnaryOp
.operand
= operand
;
1359 p
->col_offset
= col_offset
;
1364 Lambda(arguments_ty args
, expr_ty body
, int lineno
, int col_offset
, PyArena
1369 PyErr_SetString(PyExc_ValueError
,
1370 "field args is required for Lambda");
1374 PyErr_SetString(PyExc_ValueError
,
1375 "field body is required for Lambda");
1378 p
= (expr_ty
)PyArena_Malloc(arena
, sizeof(*p
));
1383 p
->kind
= Lambda_kind
;
1384 p
->v
.Lambda
.args
= args
;
1385 p
->v
.Lambda
.body
= body
;
1387 p
->col_offset
= col_offset
;
1392 IfExp(expr_ty test
, expr_ty body
, expr_ty orelse
, int lineno
, int col_offset
,
1397 PyErr_SetString(PyExc_ValueError
,
1398 "field test is required for IfExp");
1402 PyErr_SetString(PyExc_ValueError
,
1403 "field body is required for IfExp");
1407 PyErr_SetString(PyExc_ValueError
,
1408 "field orelse is required for IfExp");
1411 p
= (expr_ty
)PyArena_Malloc(arena
, sizeof(*p
));
1416 p
->kind
= IfExp_kind
;
1417 p
->v
.IfExp
.test
= test
;
1418 p
->v
.IfExp
.body
= body
;
1419 p
->v
.IfExp
.orelse
= orelse
;
1421 p
->col_offset
= col_offset
;
1426 Dict(asdl_seq
* keys
, asdl_seq
* values
, int lineno
, int col_offset
, PyArena
1430 p
= (expr_ty
)PyArena_Malloc(arena
, sizeof(*p
));
1435 p
->kind
= Dict_kind
;
1436 p
->v
.Dict
.keys
= keys
;
1437 p
->v
.Dict
.values
= values
;
1439 p
->col_offset
= col_offset
;
1444 ListComp(expr_ty elt
, asdl_seq
* generators
, int lineno
, int col_offset
,
1449 PyErr_SetString(PyExc_ValueError
,
1450 "field elt is required for ListComp");
1453 p
= (expr_ty
)PyArena_Malloc(arena
, sizeof(*p
));
1458 p
->kind
= ListComp_kind
;
1459 p
->v
.ListComp
.elt
= elt
;
1460 p
->v
.ListComp
.generators
= generators
;
1462 p
->col_offset
= col_offset
;
1467 GeneratorExp(expr_ty elt
, asdl_seq
* generators
, int lineno
, int col_offset
,
1472 PyErr_SetString(PyExc_ValueError
,
1473 "field elt is required for GeneratorExp");
1476 p
= (expr_ty
)PyArena_Malloc(arena
, sizeof(*p
));
1481 p
->kind
= GeneratorExp_kind
;
1482 p
->v
.GeneratorExp
.elt
= elt
;
1483 p
->v
.GeneratorExp
.generators
= generators
;
1485 p
->col_offset
= col_offset
;
1490 Yield(expr_ty value
, int lineno
, int col_offset
, PyArena
*arena
)
1493 p
= (expr_ty
)PyArena_Malloc(arena
, sizeof(*p
));
1498 p
->kind
= Yield_kind
;
1499 p
->v
.Yield
.value
= value
;
1501 p
->col_offset
= col_offset
;
1506 Compare(expr_ty left
, asdl_int_seq
* ops
, asdl_seq
* comparators
, int lineno
,
1507 int col_offset
, PyArena
*arena
)
1511 PyErr_SetString(PyExc_ValueError
,
1512 "field left is required for Compare");
1515 p
= (expr_ty
)PyArena_Malloc(arena
, sizeof(*p
));
1520 p
->kind
= Compare_kind
;
1521 p
->v
.Compare
.left
= left
;
1522 p
->v
.Compare
.ops
= ops
;
1523 p
->v
.Compare
.comparators
= comparators
;
1525 p
->col_offset
= col_offset
;
1530 Call(expr_ty func
, asdl_seq
* args
, asdl_seq
* keywords
, expr_ty starargs
,
1531 expr_ty kwargs
, int lineno
, int col_offset
, PyArena
*arena
)
1535 PyErr_SetString(PyExc_ValueError
,
1536 "field func is required for Call");
1539 p
= (expr_ty
)PyArena_Malloc(arena
, sizeof(*p
));
1544 p
->kind
= Call_kind
;
1545 p
->v
.Call
.func
= func
;
1546 p
->v
.Call
.args
= args
;
1547 p
->v
.Call
.keywords
= keywords
;
1548 p
->v
.Call
.starargs
= starargs
;
1549 p
->v
.Call
.kwargs
= kwargs
;
1551 p
->col_offset
= col_offset
;
1556 Repr(expr_ty value
, int lineno
, int col_offset
, PyArena
*arena
)
1560 PyErr_SetString(PyExc_ValueError
,
1561 "field value is required for Repr");
1564 p
= (expr_ty
)PyArena_Malloc(arena
, sizeof(*p
));
1569 p
->kind
= Repr_kind
;
1570 p
->v
.Repr
.value
= value
;
1572 p
->col_offset
= col_offset
;
1577 Num(object n
, int lineno
, int col_offset
, PyArena
*arena
)
1581 PyErr_SetString(PyExc_ValueError
,
1582 "field n is required for Num");
1585 p
= (expr_ty
)PyArena_Malloc(arena
, sizeof(*p
));
1593 p
->col_offset
= col_offset
;
1598 Str(string s
, int lineno
, int col_offset
, PyArena
*arena
)
1602 PyErr_SetString(PyExc_ValueError
,
1603 "field s is required for Str");
1606 p
= (expr_ty
)PyArena_Malloc(arena
, sizeof(*p
));
1614 p
->col_offset
= col_offset
;
1619 Attribute(expr_ty value
, identifier attr
, expr_context_ty ctx
, int lineno
, int
1620 col_offset
, PyArena
*arena
)
1624 PyErr_SetString(PyExc_ValueError
,
1625 "field value is required for Attribute");
1629 PyErr_SetString(PyExc_ValueError
,
1630 "field attr is required for Attribute");
1634 PyErr_SetString(PyExc_ValueError
,
1635 "field ctx is required for Attribute");
1638 p
= (expr_ty
)PyArena_Malloc(arena
, sizeof(*p
));
1643 p
->kind
= Attribute_kind
;
1644 p
->v
.Attribute
.value
= value
;
1645 p
->v
.Attribute
.attr
= attr
;
1646 p
->v
.Attribute
.ctx
= ctx
;
1648 p
->col_offset
= col_offset
;
1653 Subscript(expr_ty value
, slice_ty slice
, expr_context_ty ctx
, int lineno
, int
1654 col_offset
, PyArena
*arena
)
1658 PyErr_SetString(PyExc_ValueError
,
1659 "field value is required for Subscript");
1663 PyErr_SetString(PyExc_ValueError
,
1664 "field slice is required for Subscript");
1668 PyErr_SetString(PyExc_ValueError
,
1669 "field ctx is required for Subscript");
1672 p
= (expr_ty
)PyArena_Malloc(arena
, sizeof(*p
));
1677 p
->kind
= Subscript_kind
;
1678 p
->v
.Subscript
.value
= value
;
1679 p
->v
.Subscript
.slice
= slice
;
1680 p
->v
.Subscript
.ctx
= ctx
;
1682 p
->col_offset
= col_offset
;
1687 Name(identifier id
, expr_context_ty ctx
, int lineno
, int col_offset
, PyArena
1692 PyErr_SetString(PyExc_ValueError
,
1693 "field id is required for Name");
1697 PyErr_SetString(PyExc_ValueError
,
1698 "field ctx is required for Name");
1701 p
= (expr_ty
)PyArena_Malloc(arena
, sizeof(*p
));
1706 p
->kind
= Name_kind
;
1708 p
->v
.Name
.ctx
= ctx
;
1710 p
->col_offset
= col_offset
;
1715 List(asdl_seq
* elts
, expr_context_ty ctx
, int lineno
, int col_offset
, PyArena
1720 PyErr_SetString(PyExc_ValueError
,
1721 "field ctx is required for List");
1724 p
= (expr_ty
)PyArena_Malloc(arena
, sizeof(*p
));
1729 p
->kind
= List_kind
;
1730 p
->v
.List
.elts
= elts
;
1731 p
->v
.List
.ctx
= ctx
;
1733 p
->col_offset
= col_offset
;
1738 Tuple(asdl_seq
* elts
, expr_context_ty ctx
, int lineno
, int col_offset
, PyArena
1743 PyErr_SetString(PyExc_ValueError
,
1744 "field ctx is required for Tuple");
1747 p
= (expr_ty
)PyArena_Malloc(arena
, sizeof(*p
));
1752 p
->kind
= Tuple_kind
;
1753 p
->v
.Tuple
.elts
= elts
;
1754 p
->v
.Tuple
.ctx
= ctx
;
1756 p
->col_offset
= col_offset
;
1761 Ellipsis(PyArena
*arena
)
1764 p
= (slice_ty
)PyArena_Malloc(arena
, sizeof(*p
));
1769 p
->kind
= Ellipsis_kind
;
1774 Slice(expr_ty lower
, expr_ty upper
, expr_ty step
, PyArena
*arena
)
1777 p
= (slice_ty
)PyArena_Malloc(arena
, sizeof(*p
));
1782 p
->kind
= Slice_kind
;
1783 p
->v
.Slice
.lower
= lower
;
1784 p
->v
.Slice
.upper
= upper
;
1785 p
->v
.Slice
.step
= step
;
1790 ExtSlice(asdl_seq
* dims
, PyArena
*arena
)
1793 p
= (slice_ty
)PyArena_Malloc(arena
, sizeof(*p
));
1798 p
->kind
= ExtSlice_kind
;
1799 p
->v
.ExtSlice
.dims
= dims
;
1804 Index(expr_ty value
, PyArena
*arena
)
1808 PyErr_SetString(PyExc_ValueError
,
1809 "field value is required for Index");
1812 p
= (slice_ty
)PyArena_Malloc(arena
, sizeof(*p
));
1817 p
->kind
= Index_kind
;
1818 p
->v
.Index
.value
= value
;
1823 comprehension(expr_ty target
, expr_ty iter
, asdl_seq
* ifs
, PyArena
*arena
)
1827 PyErr_SetString(PyExc_ValueError
,
1828 "field target is required for comprehension");
1832 PyErr_SetString(PyExc_ValueError
,
1833 "field iter is required for comprehension");
1836 p
= (comprehension_ty
)PyArena_Malloc(arena
, sizeof(*p
));
1848 excepthandler(expr_ty type
, expr_ty name
, asdl_seq
* body
, int lineno
, int
1849 col_offset
, PyArena
*arena
)
1852 p
= (excepthandler_ty
)PyArena_Malloc(arena
, sizeof(*p
));
1861 p
->col_offset
= col_offset
;
1866 arguments(asdl_seq
* args
, identifier vararg
, identifier kwarg
, asdl_seq
*
1867 defaults
, PyArena
*arena
)
1870 p
= (arguments_ty
)PyArena_Malloc(arena
, sizeof(*p
));
1878 p
->defaults
= defaults
;
1883 keyword(identifier arg
, expr_ty value
, PyArena
*arena
)
1887 PyErr_SetString(PyExc_ValueError
,
1888 "field arg is required for keyword");
1892 PyErr_SetString(PyExc_ValueError
,
1893 "field value is required for keyword");
1896 p
= (keyword_ty
)PyArena_Malloc(arena
, sizeof(*p
));
1907 alias(identifier name
, identifier asname
, PyArena
*arena
)
1911 PyErr_SetString(PyExc_ValueError
,
1912 "field name is required for alias");
1915 p
= (alias_ty
)PyArena_Malloc(arena
, sizeof(*p
));
1927 ast2obj_mod(void* _o
)
1929 mod_ty o
= (mod_ty
)_o
;
1930 PyObject
*result
= NULL
, *value
= NULL
;
1938 result
= PyType_GenericNew(Module_type
, NULL
, NULL
);
1939 if (!result
) goto failed
;
1940 value
= ast2obj_list(o
->v
.Module
.body
, ast2obj_stmt
);
1941 if (!value
) goto failed
;
1942 if (PyObject_SetAttrString(result
, "body", value
) == -1)
1946 case Interactive_kind
:
1947 result
= PyType_GenericNew(Interactive_type
, NULL
, NULL
);
1948 if (!result
) goto failed
;
1949 value
= ast2obj_list(o
->v
.Interactive
.body
, ast2obj_stmt
);
1950 if (!value
) goto failed
;
1951 if (PyObject_SetAttrString(result
, "body", value
) == -1)
1955 case Expression_kind
:
1956 result
= PyType_GenericNew(Expression_type
, NULL
, NULL
);
1957 if (!result
) goto failed
;
1958 value
= ast2obj_expr(o
->v
.Expression
.body
);
1959 if (!value
) goto failed
;
1960 if (PyObject_SetAttrString(result
, "body", value
) == -1)
1965 result
= PyType_GenericNew(Suite_type
, NULL
, NULL
);
1966 if (!result
) goto failed
;
1967 value
= ast2obj_list(o
->v
.Suite
.body
, ast2obj_stmt
);
1968 if (!value
) goto failed
;
1969 if (PyObject_SetAttrString(result
, "body", value
) == -1)
1982 ast2obj_stmt(void* _o
)
1984 stmt_ty o
= (stmt_ty
)_o
;
1985 PyObject
*result
= NULL
, *value
= NULL
;
1992 case FunctionDef_kind
:
1993 result
= PyType_GenericNew(FunctionDef_type
, NULL
, NULL
);
1994 if (!result
) goto failed
;
1995 value
= ast2obj_identifier(o
->v
.FunctionDef
.name
);
1996 if (!value
) goto failed
;
1997 if (PyObject_SetAttrString(result
, "name", value
) == -1)
2000 value
= ast2obj_arguments(o
->v
.FunctionDef
.args
);
2001 if (!value
) goto failed
;
2002 if (PyObject_SetAttrString(result
, "args", value
) == -1)
2005 value
= ast2obj_list(o
->v
.FunctionDef
.body
, ast2obj_stmt
);
2006 if (!value
) goto failed
;
2007 if (PyObject_SetAttrString(result
, "body", value
) == -1)
2010 value
= ast2obj_list(o
->v
.FunctionDef
.decorators
, ast2obj_expr
);
2011 if (!value
) goto failed
;
2012 if (PyObject_SetAttrString(result
, "decorators", value
) == -1)
2017 result
= PyType_GenericNew(ClassDef_type
, NULL
, NULL
);
2018 if (!result
) goto failed
;
2019 value
= ast2obj_identifier(o
->v
.ClassDef
.name
);
2020 if (!value
) goto failed
;
2021 if (PyObject_SetAttrString(result
, "name", value
) == -1)
2024 value
= ast2obj_list(o
->v
.ClassDef
.bases
, ast2obj_expr
);
2025 if (!value
) goto failed
;
2026 if (PyObject_SetAttrString(result
, "bases", value
) == -1)
2029 value
= ast2obj_list(o
->v
.ClassDef
.body
, ast2obj_stmt
);
2030 if (!value
) goto failed
;
2031 if (PyObject_SetAttrString(result
, "body", value
) == -1)
2036 result
= PyType_GenericNew(Return_type
, NULL
, NULL
);
2037 if (!result
) goto failed
;
2038 value
= ast2obj_expr(o
->v
.Return
.value
);
2039 if (!value
) goto failed
;
2040 if (PyObject_SetAttrString(result
, "value", value
) == -1)
2045 result
= PyType_GenericNew(Delete_type
, NULL
, NULL
);
2046 if (!result
) goto failed
;
2047 value
= ast2obj_list(o
->v
.Delete
.targets
, ast2obj_expr
);
2048 if (!value
) goto failed
;
2049 if (PyObject_SetAttrString(result
, "targets", value
) == -1)
2054 result
= PyType_GenericNew(Assign_type
, NULL
, NULL
);
2055 if (!result
) goto failed
;
2056 value
= ast2obj_list(o
->v
.Assign
.targets
, ast2obj_expr
);
2057 if (!value
) goto failed
;
2058 if (PyObject_SetAttrString(result
, "targets", value
) == -1)
2061 value
= ast2obj_expr(o
->v
.Assign
.value
);
2062 if (!value
) goto failed
;
2063 if (PyObject_SetAttrString(result
, "value", value
) == -1)
2067 case AugAssign_kind
:
2068 result
= PyType_GenericNew(AugAssign_type
, NULL
, NULL
);
2069 if (!result
) goto failed
;
2070 value
= ast2obj_expr(o
->v
.AugAssign
.target
);
2071 if (!value
) goto failed
;
2072 if (PyObject_SetAttrString(result
, "target", value
) == -1)
2075 value
= ast2obj_operator(o
->v
.AugAssign
.op
);
2076 if (!value
) goto failed
;
2077 if (PyObject_SetAttrString(result
, "op", value
) == -1)
2080 value
= ast2obj_expr(o
->v
.AugAssign
.value
);
2081 if (!value
) goto failed
;
2082 if (PyObject_SetAttrString(result
, "value", value
) == -1)
2087 result
= PyType_GenericNew(Print_type
, NULL
, NULL
);
2088 if (!result
) goto failed
;
2089 value
= ast2obj_expr(o
->v
.Print
.dest
);
2090 if (!value
) goto failed
;
2091 if (PyObject_SetAttrString(result
, "dest", value
) == -1)
2094 value
= ast2obj_list(o
->v
.Print
.values
, ast2obj_expr
);
2095 if (!value
) goto failed
;
2096 if (PyObject_SetAttrString(result
, "values", value
) == -1)
2099 value
= ast2obj_bool(o
->v
.Print
.nl
);
2100 if (!value
) goto failed
;
2101 if (PyObject_SetAttrString(result
, "nl", value
) == -1)
2106 result
= PyType_GenericNew(For_type
, NULL
, NULL
);
2107 if (!result
) goto failed
;
2108 value
= ast2obj_expr(o
->v
.For
.target
);
2109 if (!value
) goto failed
;
2110 if (PyObject_SetAttrString(result
, "target", value
) == -1)
2113 value
= ast2obj_expr(o
->v
.For
.iter
);
2114 if (!value
) goto failed
;
2115 if (PyObject_SetAttrString(result
, "iter", value
) == -1)
2118 value
= ast2obj_list(o
->v
.For
.body
, ast2obj_stmt
);
2119 if (!value
) goto failed
;
2120 if (PyObject_SetAttrString(result
, "body", value
) == -1)
2123 value
= ast2obj_list(o
->v
.For
.orelse
, ast2obj_stmt
);
2124 if (!value
) goto failed
;
2125 if (PyObject_SetAttrString(result
, "orelse", value
) == -1)
2130 result
= PyType_GenericNew(While_type
, NULL
, NULL
);
2131 if (!result
) goto failed
;
2132 value
= ast2obj_expr(o
->v
.While
.test
);
2133 if (!value
) goto failed
;
2134 if (PyObject_SetAttrString(result
, "test", value
) == -1)
2137 value
= ast2obj_list(o
->v
.While
.body
, ast2obj_stmt
);
2138 if (!value
) goto failed
;
2139 if (PyObject_SetAttrString(result
, "body", value
) == -1)
2142 value
= ast2obj_list(o
->v
.While
.orelse
, ast2obj_stmt
);
2143 if (!value
) goto failed
;
2144 if (PyObject_SetAttrString(result
, "orelse", value
) == -1)
2149 result
= PyType_GenericNew(If_type
, NULL
, NULL
);
2150 if (!result
) goto failed
;
2151 value
= ast2obj_expr(o
->v
.If
.test
);
2152 if (!value
) goto failed
;
2153 if (PyObject_SetAttrString(result
, "test", value
) == -1)
2156 value
= ast2obj_list(o
->v
.If
.body
, ast2obj_stmt
);
2157 if (!value
) goto failed
;
2158 if (PyObject_SetAttrString(result
, "body", value
) == -1)
2161 value
= ast2obj_list(o
->v
.If
.orelse
, ast2obj_stmt
);
2162 if (!value
) goto failed
;
2163 if (PyObject_SetAttrString(result
, "orelse", value
) == -1)
2168 result
= PyType_GenericNew(With_type
, NULL
, NULL
);
2169 if (!result
) goto failed
;
2170 value
= ast2obj_expr(o
->v
.With
.context_expr
);
2171 if (!value
) goto failed
;
2172 if (PyObject_SetAttrString(result
, "context_expr", value
) == -1)
2175 value
= ast2obj_expr(o
->v
.With
.optional_vars
);
2176 if (!value
) goto failed
;
2177 if (PyObject_SetAttrString(result
, "optional_vars", value
) ==
2181 value
= ast2obj_list(o
->v
.With
.body
, ast2obj_stmt
);
2182 if (!value
) goto failed
;
2183 if (PyObject_SetAttrString(result
, "body", value
) == -1)
2188 result
= PyType_GenericNew(Raise_type
, NULL
, NULL
);
2189 if (!result
) goto failed
;
2190 value
= ast2obj_expr(o
->v
.Raise
.type
);
2191 if (!value
) goto failed
;
2192 if (PyObject_SetAttrString(result
, "type", value
) == -1)
2195 value
= ast2obj_expr(o
->v
.Raise
.inst
);
2196 if (!value
) goto failed
;
2197 if (PyObject_SetAttrString(result
, "inst", value
) == -1)
2200 value
= ast2obj_expr(o
->v
.Raise
.tback
);
2201 if (!value
) goto failed
;
2202 if (PyObject_SetAttrString(result
, "tback", value
) == -1)
2206 case TryExcept_kind
:
2207 result
= PyType_GenericNew(TryExcept_type
, NULL
, NULL
);
2208 if (!result
) goto failed
;
2209 value
= ast2obj_list(o
->v
.TryExcept
.body
, ast2obj_stmt
);
2210 if (!value
) goto failed
;
2211 if (PyObject_SetAttrString(result
, "body", value
) == -1)
2214 value
= ast2obj_list(o
->v
.TryExcept
.handlers
,
2215 ast2obj_excepthandler
);
2216 if (!value
) goto failed
;
2217 if (PyObject_SetAttrString(result
, "handlers", value
) == -1)
2220 value
= ast2obj_list(o
->v
.TryExcept
.orelse
, ast2obj_stmt
);
2221 if (!value
) goto failed
;
2222 if (PyObject_SetAttrString(result
, "orelse", value
) == -1)
2226 case TryFinally_kind
:
2227 result
= PyType_GenericNew(TryFinally_type
, NULL
, NULL
);
2228 if (!result
) goto failed
;
2229 value
= ast2obj_list(o
->v
.TryFinally
.body
, ast2obj_stmt
);
2230 if (!value
) goto failed
;
2231 if (PyObject_SetAttrString(result
, "body", value
) == -1)
2234 value
= ast2obj_list(o
->v
.TryFinally
.finalbody
, ast2obj_stmt
);
2235 if (!value
) goto failed
;
2236 if (PyObject_SetAttrString(result
, "finalbody", value
) == -1)
2241 result
= PyType_GenericNew(Assert_type
, NULL
, NULL
);
2242 if (!result
) goto failed
;
2243 value
= ast2obj_expr(o
->v
.Assert
.test
);
2244 if (!value
) goto failed
;
2245 if (PyObject_SetAttrString(result
, "test", value
) == -1)
2248 value
= ast2obj_expr(o
->v
.Assert
.msg
);
2249 if (!value
) goto failed
;
2250 if (PyObject_SetAttrString(result
, "msg", value
) == -1)
2255 result
= PyType_GenericNew(Import_type
, NULL
, NULL
);
2256 if (!result
) goto failed
;
2257 value
= ast2obj_list(o
->v
.Import
.names
, ast2obj_alias
);
2258 if (!value
) goto failed
;
2259 if (PyObject_SetAttrString(result
, "names", value
) == -1)
2263 case ImportFrom_kind
:
2264 result
= PyType_GenericNew(ImportFrom_type
, NULL
, NULL
);
2265 if (!result
) goto failed
;
2266 value
= ast2obj_identifier(o
->v
.ImportFrom
.module
);
2267 if (!value
) goto failed
;
2268 if (PyObject_SetAttrString(result
, "module", value
) == -1)
2271 value
= ast2obj_list(o
->v
.ImportFrom
.names
, ast2obj_alias
);
2272 if (!value
) goto failed
;
2273 if (PyObject_SetAttrString(result
, "names", value
) == -1)
2276 value
= ast2obj_int(o
->v
.ImportFrom
.level
);
2277 if (!value
) goto failed
;
2278 if (PyObject_SetAttrString(result
, "level", value
) == -1)
2283 result
= PyType_GenericNew(Exec_type
, NULL
, NULL
);
2284 if (!result
) goto failed
;
2285 value
= ast2obj_expr(o
->v
.Exec
.body
);
2286 if (!value
) goto failed
;
2287 if (PyObject_SetAttrString(result
, "body", value
) == -1)
2290 value
= ast2obj_expr(o
->v
.Exec
.globals
);
2291 if (!value
) goto failed
;
2292 if (PyObject_SetAttrString(result
, "globals", value
) == -1)
2295 value
= ast2obj_expr(o
->v
.Exec
.locals
);
2296 if (!value
) goto failed
;
2297 if (PyObject_SetAttrString(result
, "locals", value
) == -1)
2302 result
= PyType_GenericNew(Global_type
, NULL
, NULL
);
2303 if (!result
) goto failed
;
2304 value
= ast2obj_list(o
->v
.Global
.names
, ast2obj_identifier
);
2305 if (!value
) goto failed
;
2306 if (PyObject_SetAttrString(result
, "names", value
) == -1)
2311 result
= PyType_GenericNew(Expr_type
, NULL
, NULL
);
2312 if (!result
) goto failed
;
2313 value
= ast2obj_expr(o
->v
.Expr
.value
);
2314 if (!value
) goto failed
;
2315 if (PyObject_SetAttrString(result
, "value", value
) == -1)
2320 result
= PyType_GenericNew(Pass_type
, NULL
, NULL
);
2321 if (!result
) goto failed
;
2324 result
= PyType_GenericNew(Break_type
, NULL
, NULL
);
2325 if (!result
) goto failed
;
2328 result
= PyType_GenericNew(Continue_type
, NULL
, NULL
);
2329 if (!result
) goto failed
;
2332 value
= ast2obj_int(o
->lineno
);
2333 if (!value
) goto failed
;
2334 if (PyObject_SetAttrString(result
, "lineno", value
) < 0)
2337 value
= ast2obj_int(o
->col_offset
);
2338 if (!value
) goto failed
;
2339 if (PyObject_SetAttrString(result
, "col_offset", value
) < 0)
2350 ast2obj_expr(void* _o
)
2352 expr_ty o
= (expr_ty
)_o
;
2353 PyObject
*result
= NULL
, *value
= NULL
;
2361 result
= PyType_GenericNew(BoolOp_type
, NULL
, NULL
);
2362 if (!result
) goto failed
;
2363 value
= ast2obj_boolop(o
->v
.BoolOp
.op
);
2364 if (!value
) goto failed
;
2365 if (PyObject_SetAttrString(result
, "op", value
) == -1)
2368 value
= ast2obj_list(o
->v
.BoolOp
.values
, ast2obj_expr
);
2369 if (!value
) goto failed
;
2370 if (PyObject_SetAttrString(result
, "values", value
) == -1)
2375 result
= PyType_GenericNew(BinOp_type
, NULL
, NULL
);
2376 if (!result
) goto failed
;
2377 value
= ast2obj_expr(o
->v
.BinOp
.left
);
2378 if (!value
) goto failed
;
2379 if (PyObject_SetAttrString(result
, "left", value
) == -1)
2382 value
= ast2obj_operator(o
->v
.BinOp
.op
);
2383 if (!value
) goto failed
;
2384 if (PyObject_SetAttrString(result
, "op", value
) == -1)
2387 value
= ast2obj_expr(o
->v
.BinOp
.right
);
2388 if (!value
) goto failed
;
2389 if (PyObject_SetAttrString(result
, "right", value
) == -1)
2394 result
= PyType_GenericNew(UnaryOp_type
, NULL
, NULL
);
2395 if (!result
) goto failed
;
2396 value
= ast2obj_unaryop(o
->v
.UnaryOp
.op
);
2397 if (!value
) goto failed
;
2398 if (PyObject_SetAttrString(result
, "op", value
) == -1)
2401 value
= ast2obj_expr(o
->v
.UnaryOp
.operand
);
2402 if (!value
) goto failed
;
2403 if (PyObject_SetAttrString(result
, "operand", value
) == -1)
2408 result
= PyType_GenericNew(Lambda_type
, NULL
, NULL
);
2409 if (!result
) goto failed
;
2410 value
= ast2obj_arguments(o
->v
.Lambda
.args
);
2411 if (!value
) goto failed
;
2412 if (PyObject_SetAttrString(result
, "args", value
) == -1)
2415 value
= ast2obj_expr(o
->v
.Lambda
.body
);
2416 if (!value
) goto failed
;
2417 if (PyObject_SetAttrString(result
, "body", value
) == -1)
2422 result
= PyType_GenericNew(IfExp_type
, NULL
, NULL
);
2423 if (!result
) goto failed
;
2424 value
= ast2obj_expr(o
->v
.IfExp
.test
);
2425 if (!value
) goto failed
;
2426 if (PyObject_SetAttrString(result
, "test", value
) == -1)
2429 value
= ast2obj_expr(o
->v
.IfExp
.body
);
2430 if (!value
) goto failed
;
2431 if (PyObject_SetAttrString(result
, "body", value
) == -1)
2434 value
= ast2obj_expr(o
->v
.IfExp
.orelse
);
2435 if (!value
) goto failed
;
2436 if (PyObject_SetAttrString(result
, "orelse", value
) == -1)
2441 result
= PyType_GenericNew(Dict_type
, NULL
, NULL
);
2442 if (!result
) goto failed
;
2443 value
= ast2obj_list(o
->v
.Dict
.keys
, ast2obj_expr
);
2444 if (!value
) goto failed
;
2445 if (PyObject_SetAttrString(result
, "keys", value
) == -1)
2448 value
= ast2obj_list(o
->v
.Dict
.values
, ast2obj_expr
);
2449 if (!value
) goto failed
;
2450 if (PyObject_SetAttrString(result
, "values", value
) == -1)
2455 result
= PyType_GenericNew(ListComp_type
, NULL
, NULL
);
2456 if (!result
) goto failed
;
2457 value
= ast2obj_expr(o
->v
.ListComp
.elt
);
2458 if (!value
) goto failed
;
2459 if (PyObject_SetAttrString(result
, "elt", value
) == -1)
2462 value
= ast2obj_list(o
->v
.ListComp
.generators
,
2463 ast2obj_comprehension
);
2464 if (!value
) goto failed
;
2465 if (PyObject_SetAttrString(result
, "generators", value
) == -1)
2469 case GeneratorExp_kind
:
2470 result
= PyType_GenericNew(GeneratorExp_type
, NULL
, NULL
);
2471 if (!result
) goto failed
;
2472 value
= ast2obj_expr(o
->v
.GeneratorExp
.elt
);
2473 if (!value
) goto failed
;
2474 if (PyObject_SetAttrString(result
, "elt", value
) == -1)
2477 value
= ast2obj_list(o
->v
.GeneratorExp
.generators
,
2478 ast2obj_comprehension
);
2479 if (!value
) goto failed
;
2480 if (PyObject_SetAttrString(result
, "generators", value
) == -1)
2485 result
= PyType_GenericNew(Yield_type
, NULL
, NULL
);
2486 if (!result
) goto failed
;
2487 value
= ast2obj_expr(o
->v
.Yield
.value
);
2488 if (!value
) goto failed
;
2489 if (PyObject_SetAttrString(result
, "value", value
) == -1)
2494 result
= PyType_GenericNew(Compare_type
, NULL
, NULL
);
2495 if (!result
) goto failed
;
2496 value
= ast2obj_expr(o
->v
.Compare
.left
);
2497 if (!value
) goto failed
;
2498 if (PyObject_SetAttrString(result
, "left", value
) == -1)
2502 int i
, n
= asdl_seq_LEN(o
->v
.Compare
.ops
);
2503 value
= PyList_New(n
);
2504 if (!value
) goto failed
;
2505 for(i
= 0; i
< n
; i
++)
2506 PyList_SET_ITEM(value
, i
, ast2obj_cmpop((cmpop_ty
)asdl_seq_GET(o
->v
.Compare
.ops
, i
)));
2508 if (!value
) goto failed
;
2509 if (PyObject_SetAttrString(result
, "ops", value
) == -1)
2512 value
= ast2obj_list(o
->v
.Compare
.comparators
, ast2obj_expr
);
2513 if (!value
) goto failed
;
2514 if (PyObject_SetAttrString(result
, "comparators", value
) == -1)
2519 result
= PyType_GenericNew(Call_type
, NULL
, NULL
);
2520 if (!result
) goto failed
;
2521 value
= ast2obj_expr(o
->v
.Call
.func
);
2522 if (!value
) goto failed
;
2523 if (PyObject_SetAttrString(result
, "func", value
) == -1)
2526 value
= ast2obj_list(o
->v
.Call
.args
, ast2obj_expr
);
2527 if (!value
) goto failed
;
2528 if (PyObject_SetAttrString(result
, "args", value
) == -1)
2531 value
= ast2obj_list(o
->v
.Call
.keywords
, ast2obj_keyword
);
2532 if (!value
) goto failed
;
2533 if (PyObject_SetAttrString(result
, "keywords", value
) == -1)
2536 value
= ast2obj_expr(o
->v
.Call
.starargs
);
2537 if (!value
) goto failed
;
2538 if (PyObject_SetAttrString(result
, "starargs", value
) == -1)
2541 value
= ast2obj_expr(o
->v
.Call
.kwargs
);
2542 if (!value
) goto failed
;
2543 if (PyObject_SetAttrString(result
, "kwargs", value
) == -1)
2548 result
= PyType_GenericNew(Repr_type
, NULL
, NULL
);
2549 if (!result
) goto failed
;
2550 value
= ast2obj_expr(o
->v
.Repr
.value
);
2551 if (!value
) goto failed
;
2552 if (PyObject_SetAttrString(result
, "value", value
) == -1)
2557 result
= PyType_GenericNew(Num_type
, NULL
, NULL
);
2558 if (!result
) goto failed
;
2559 value
= ast2obj_object(o
->v
.Num
.n
);
2560 if (!value
) goto failed
;
2561 if (PyObject_SetAttrString(result
, "n", value
) == -1)
2566 result
= PyType_GenericNew(Str_type
, NULL
, NULL
);
2567 if (!result
) goto failed
;
2568 value
= ast2obj_string(o
->v
.Str
.s
);
2569 if (!value
) goto failed
;
2570 if (PyObject_SetAttrString(result
, "s", value
) == -1)
2574 case Attribute_kind
:
2575 result
= PyType_GenericNew(Attribute_type
, NULL
, NULL
);
2576 if (!result
) goto failed
;
2577 value
= ast2obj_expr(o
->v
.Attribute
.value
);
2578 if (!value
) goto failed
;
2579 if (PyObject_SetAttrString(result
, "value", value
) == -1)
2582 value
= ast2obj_identifier(o
->v
.Attribute
.attr
);
2583 if (!value
) goto failed
;
2584 if (PyObject_SetAttrString(result
, "attr", value
) == -1)
2587 value
= ast2obj_expr_context(o
->v
.Attribute
.ctx
);
2588 if (!value
) goto failed
;
2589 if (PyObject_SetAttrString(result
, "ctx", value
) == -1)
2593 case Subscript_kind
:
2594 result
= PyType_GenericNew(Subscript_type
, NULL
, NULL
);
2595 if (!result
) goto failed
;
2596 value
= ast2obj_expr(o
->v
.Subscript
.value
);
2597 if (!value
) goto failed
;
2598 if (PyObject_SetAttrString(result
, "value", value
) == -1)
2601 value
= ast2obj_slice(o
->v
.Subscript
.slice
);
2602 if (!value
) goto failed
;
2603 if (PyObject_SetAttrString(result
, "slice", value
) == -1)
2606 value
= ast2obj_expr_context(o
->v
.Subscript
.ctx
);
2607 if (!value
) goto failed
;
2608 if (PyObject_SetAttrString(result
, "ctx", value
) == -1)
2613 result
= PyType_GenericNew(Name_type
, NULL
, NULL
);
2614 if (!result
) goto failed
;
2615 value
= ast2obj_identifier(o
->v
.Name
.id
);
2616 if (!value
) goto failed
;
2617 if (PyObject_SetAttrString(result
, "id", value
) == -1)
2620 value
= ast2obj_expr_context(o
->v
.Name
.ctx
);
2621 if (!value
) goto failed
;
2622 if (PyObject_SetAttrString(result
, "ctx", value
) == -1)
2627 result
= PyType_GenericNew(List_type
, NULL
, NULL
);
2628 if (!result
) goto failed
;
2629 value
= ast2obj_list(o
->v
.List
.elts
, ast2obj_expr
);
2630 if (!value
) goto failed
;
2631 if (PyObject_SetAttrString(result
, "elts", value
) == -1)
2634 value
= ast2obj_expr_context(o
->v
.List
.ctx
);
2635 if (!value
) goto failed
;
2636 if (PyObject_SetAttrString(result
, "ctx", value
) == -1)
2641 result
= PyType_GenericNew(Tuple_type
, NULL
, NULL
);
2642 if (!result
) goto failed
;
2643 value
= ast2obj_list(o
->v
.Tuple
.elts
, ast2obj_expr
);
2644 if (!value
) goto failed
;
2645 if (PyObject_SetAttrString(result
, "elts", value
) == -1)
2648 value
= ast2obj_expr_context(o
->v
.Tuple
.ctx
);
2649 if (!value
) goto failed
;
2650 if (PyObject_SetAttrString(result
, "ctx", value
) == -1)
2655 value
= ast2obj_int(o
->lineno
);
2656 if (!value
) goto failed
;
2657 if (PyObject_SetAttrString(result
, "lineno", value
) < 0)
2660 value
= ast2obj_int(o
->col_offset
);
2661 if (!value
) goto failed
;
2662 if (PyObject_SetAttrString(result
, "col_offset", value
) < 0)
2672 PyObject
* ast2obj_expr_context(expr_context_ty o
)
2676 Py_INCREF(Load_singleton
);
2677 return Load_singleton
;
2679 Py_INCREF(Store_singleton
);
2680 return Store_singleton
;
2682 Py_INCREF(Del_singleton
);
2683 return Del_singleton
;
2685 Py_INCREF(AugLoad_singleton
);
2686 return AugLoad_singleton
;
2688 Py_INCREF(AugStore_singleton
);
2689 return AugStore_singleton
;
2691 Py_INCREF(Param_singleton
);
2692 return Param_singleton
;
2694 return NULL
; /* cannot happen */
2697 ast2obj_slice(void* _o
)
2699 slice_ty o
= (slice_ty
)_o
;
2700 PyObject
*result
= NULL
, *value
= NULL
;
2708 result
= PyType_GenericNew(Ellipsis_type
, NULL
, NULL
);
2709 if (!result
) goto failed
;
2712 result
= PyType_GenericNew(Slice_type
, NULL
, NULL
);
2713 if (!result
) goto failed
;
2714 value
= ast2obj_expr(o
->v
.Slice
.lower
);
2715 if (!value
) goto failed
;
2716 if (PyObject_SetAttrString(result
, "lower", value
) == -1)
2719 value
= ast2obj_expr(o
->v
.Slice
.upper
);
2720 if (!value
) goto failed
;
2721 if (PyObject_SetAttrString(result
, "upper", value
) == -1)
2724 value
= ast2obj_expr(o
->v
.Slice
.step
);
2725 if (!value
) goto failed
;
2726 if (PyObject_SetAttrString(result
, "step", value
) == -1)
2731 result
= PyType_GenericNew(ExtSlice_type
, NULL
, NULL
);
2732 if (!result
) goto failed
;
2733 value
= ast2obj_list(o
->v
.ExtSlice
.dims
, ast2obj_slice
);
2734 if (!value
) goto failed
;
2735 if (PyObject_SetAttrString(result
, "dims", value
) == -1)
2740 result
= PyType_GenericNew(Index_type
, NULL
, NULL
);
2741 if (!result
) goto failed
;
2742 value
= ast2obj_expr(o
->v
.Index
.value
);
2743 if (!value
) goto failed
;
2744 if (PyObject_SetAttrString(result
, "value", value
) == -1)
2756 PyObject
* ast2obj_boolop(boolop_ty o
)
2760 Py_INCREF(And_singleton
);
2761 return And_singleton
;
2763 Py_INCREF(Or_singleton
);
2764 return Or_singleton
;
2766 return NULL
; /* cannot happen */
2768 PyObject
* ast2obj_operator(operator_ty o
)
2772 Py_INCREF(Add_singleton
);
2773 return Add_singleton
;
2775 Py_INCREF(Sub_singleton
);
2776 return Sub_singleton
;
2778 Py_INCREF(Mult_singleton
);
2779 return Mult_singleton
;
2781 Py_INCREF(Div_singleton
);
2782 return Div_singleton
;
2784 Py_INCREF(Mod_singleton
);
2785 return Mod_singleton
;
2787 Py_INCREF(Pow_singleton
);
2788 return Pow_singleton
;
2790 Py_INCREF(LShift_singleton
);
2791 return LShift_singleton
;
2793 Py_INCREF(RShift_singleton
);
2794 return RShift_singleton
;
2796 Py_INCREF(BitOr_singleton
);
2797 return BitOr_singleton
;
2799 Py_INCREF(BitXor_singleton
);
2800 return BitXor_singleton
;
2802 Py_INCREF(BitAnd_singleton
);
2803 return BitAnd_singleton
;
2805 Py_INCREF(FloorDiv_singleton
);
2806 return FloorDiv_singleton
;
2808 return NULL
; /* cannot happen */
2810 PyObject
* ast2obj_unaryop(unaryop_ty o
)
2814 Py_INCREF(Invert_singleton
);
2815 return Invert_singleton
;
2817 Py_INCREF(Not_singleton
);
2818 return Not_singleton
;
2820 Py_INCREF(UAdd_singleton
);
2821 return UAdd_singleton
;
2823 Py_INCREF(USub_singleton
);
2824 return USub_singleton
;
2826 return NULL
; /* cannot happen */
2828 PyObject
* ast2obj_cmpop(cmpop_ty o
)
2832 Py_INCREF(Eq_singleton
);
2833 return Eq_singleton
;
2835 Py_INCREF(NotEq_singleton
);
2836 return NotEq_singleton
;
2838 Py_INCREF(Lt_singleton
);
2839 return Lt_singleton
;
2841 Py_INCREF(LtE_singleton
);
2842 return LtE_singleton
;
2844 Py_INCREF(Gt_singleton
);
2845 return Gt_singleton
;
2847 Py_INCREF(GtE_singleton
);
2848 return GtE_singleton
;
2850 Py_INCREF(Is_singleton
);
2851 return Is_singleton
;
2853 Py_INCREF(IsNot_singleton
);
2854 return IsNot_singleton
;
2856 Py_INCREF(In_singleton
);
2857 return In_singleton
;
2859 Py_INCREF(NotIn_singleton
);
2860 return NotIn_singleton
;
2862 return NULL
; /* cannot happen */
2865 ast2obj_comprehension(void* _o
)
2867 comprehension_ty o
= (comprehension_ty
)_o
;
2868 PyObject
*result
= NULL
, *value
= NULL
;
2874 result
= PyType_GenericNew(comprehension_type
, NULL
, NULL
);
2875 if (!result
) return NULL
;
2876 value
= ast2obj_expr(o
->target
);
2877 if (!value
) goto failed
;
2878 if (PyObject_SetAttrString(result
, "target", value
) == -1)
2881 value
= ast2obj_expr(o
->iter
);
2882 if (!value
) goto failed
;
2883 if (PyObject_SetAttrString(result
, "iter", value
) == -1)
2886 value
= ast2obj_list(o
->ifs
, ast2obj_expr
);
2887 if (!value
) goto failed
;
2888 if (PyObject_SetAttrString(result
, "ifs", value
) == -1)
2899 ast2obj_excepthandler(void* _o
)
2901 excepthandler_ty o
= (excepthandler_ty
)_o
;
2902 PyObject
*result
= NULL
, *value
= NULL
;
2908 result
= PyType_GenericNew(excepthandler_type
, NULL
, NULL
);
2909 if (!result
) return NULL
;
2910 value
= ast2obj_expr(o
->type
);
2911 if (!value
) goto failed
;
2912 if (PyObject_SetAttrString(result
, "type", value
) == -1)
2915 value
= ast2obj_expr(o
->name
);
2916 if (!value
) goto failed
;
2917 if (PyObject_SetAttrString(result
, "name", value
) == -1)
2920 value
= ast2obj_list(o
->body
, ast2obj_stmt
);
2921 if (!value
) goto failed
;
2922 if (PyObject_SetAttrString(result
, "body", value
) == -1)
2925 value
= ast2obj_int(o
->lineno
);
2926 if (!value
) goto failed
;
2927 if (PyObject_SetAttrString(result
, "lineno", value
) == -1)
2930 value
= ast2obj_int(o
->col_offset
);
2931 if (!value
) goto failed
;
2932 if (PyObject_SetAttrString(result
, "col_offset", value
) == -1)
2943 ast2obj_arguments(void* _o
)
2945 arguments_ty o
= (arguments_ty
)_o
;
2946 PyObject
*result
= NULL
, *value
= NULL
;
2952 result
= PyType_GenericNew(arguments_type
, NULL
, NULL
);
2953 if (!result
) return NULL
;
2954 value
= ast2obj_list(o
->args
, ast2obj_expr
);
2955 if (!value
) goto failed
;
2956 if (PyObject_SetAttrString(result
, "args", value
) == -1)
2959 value
= ast2obj_identifier(o
->vararg
);
2960 if (!value
) goto failed
;
2961 if (PyObject_SetAttrString(result
, "vararg", value
) == -1)
2964 value
= ast2obj_identifier(o
->kwarg
);
2965 if (!value
) goto failed
;
2966 if (PyObject_SetAttrString(result
, "kwarg", value
) == -1)
2969 value
= ast2obj_list(o
->defaults
, ast2obj_expr
);
2970 if (!value
) goto failed
;
2971 if (PyObject_SetAttrString(result
, "defaults", value
) == -1)
2982 ast2obj_keyword(void* _o
)
2984 keyword_ty o
= (keyword_ty
)_o
;
2985 PyObject
*result
= NULL
, *value
= NULL
;
2991 result
= PyType_GenericNew(keyword_type
, NULL
, NULL
);
2992 if (!result
) return NULL
;
2993 value
= ast2obj_identifier(o
->arg
);
2994 if (!value
) goto failed
;
2995 if (PyObject_SetAttrString(result
, "arg", value
) == -1)
2998 value
= ast2obj_expr(o
->value
);
2999 if (!value
) goto failed
;
3000 if (PyObject_SetAttrString(result
, "value", value
) == -1)
3011 ast2obj_alias(void* _o
)
3013 alias_ty o
= (alias_ty
)_o
;
3014 PyObject
*result
= NULL
, *value
= NULL
;
3020 result
= PyType_GenericNew(alias_type
, NULL
, NULL
);
3021 if (!result
) return NULL
;
3022 value
= ast2obj_identifier(o
->name
);
3023 if (!value
) goto failed
;
3024 if (PyObject_SetAttrString(result
, "name", value
) == -1)
3027 value
= ast2obj_identifier(o
->asname
);
3028 if (!value
) goto failed
;
3029 if (PyObject_SetAttrString(result
, "asname", value
) == -1)
3044 if (!init_types()) return;
3045 m
= Py_InitModule3("_ast", NULL
, NULL
);
3047 d
= PyModule_GetDict(m
);
3048 if (PyDict_SetItemString(d
, "AST", (PyObject
*)AST_type
) < 0) return;
3049 if (PyModule_AddIntConstant(m
, "PyCF_ONLY_AST", PyCF_ONLY_AST
) < 0)
3051 if (PyModule_AddStringConstant(m
, "__version__", "43614") < 0)
3053 if (PyDict_SetItemString(d
, "mod", (PyObject
*)mod_type
) < 0) return;
3054 if (PyDict_SetItemString(d
, "Module", (PyObject
*)Module_type
) < 0)
3056 if (PyDict_SetItemString(d
, "Interactive", (PyObject
*)Interactive_type
)
3058 if (PyDict_SetItemString(d
, "Expression", (PyObject
*)Expression_type
) <
3060 if (PyDict_SetItemString(d
, "Suite", (PyObject
*)Suite_type
) < 0) return;
3061 if (PyDict_SetItemString(d
, "stmt", (PyObject
*)stmt_type
) < 0) return;
3062 if (PyDict_SetItemString(d
, "FunctionDef", (PyObject
*)FunctionDef_type
)
3064 if (PyDict_SetItemString(d
, "ClassDef", (PyObject
*)ClassDef_type
) < 0)
3066 if (PyDict_SetItemString(d
, "Return", (PyObject
*)Return_type
) < 0)
3068 if (PyDict_SetItemString(d
, "Delete", (PyObject
*)Delete_type
) < 0)
3070 if (PyDict_SetItemString(d
, "Assign", (PyObject
*)Assign_type
) < 0)
3072 if (PyDict_SetItemString(d
, "AugAssign", (PyObject
*)AugAssign_type
) <
3074 if (PyDict_SetItemString(d
, "Print", (PyObject
*)Print_type
) < 0) return;
3075 if (PyDict_SetItemString(d
, "For", (PyObject
*)For_type
) < 0) return;
3076 if (PyDict_SetItemString(d
, "While", (PyObject
*)While_type
) < 0) return;
3077 if (PyDict_SetItemString(d
, "If", (PyObject
*)If_type
) < 0) return;
3078 if (PyDict_SetItemString(d
, "With", (PyObject
*)With_type
) < 0) return;
3079 if (PyDict_SetItemString(d
, "Raise", (PyObject
*)Raise_type
) < 0) return;
3080 if (PyDict_SetItemString(d
, "TryExcept", (PyObject
*)TryExcept_type
) <
3082 if (PyDict_SetItemString(d
, "TryFinally", (PyObject
*)TryFinally_type
) <
3084 if (PyDict_SetItemString(d
, "Assert", (PyObject
*)Assert_type
) < 0)
3086 if (PyDict_SetItemString(d
, "Import", (PyObject
*)Import_type
) < 0)
3088 if (PyDict_SetItemString(d
, "ImportFrom", (PyObject
*)ImportFrom_type
) <
3090 if (PyDict_SetItemString(d
, "Exec", (PyObject
*)Exec_type
) < 0) return;
3091 if (PyDict_SetItemString(d
, "Global", (PyObject
*)Global_type
) < 0)
3093 if (PyDict_SetItemString(d
, "Expr", (PyObject
*)Expr_type
) < 0) return;
3094 if (PyDict_SetItemString(d
, "Pass", (PyObject
*)Pass_type
) < 0) return;
3095 if (PyDict_SetItemString(d
, "Break", (PyObject
*)Break_type
) < 0) return;
3096 if (PyDict_SetItemString(d
, "Continue", (PyObject
*)Continue_type
) < 0)
3098 if (PyDict_SetItemString(d
, "expr", (PyObject
*)expr_type
) < 0) return;
3099 if (PyDict_SetItemString(d
, "BoolOp", (PyObject
*)BoolOp_type
) < 0)
3101 if (PyDict_SetItemString(d
, "BinOp", (PyObject
*)BinOp_type
) < 0) return;
3102 if (PyDict_SetItemString(d
, "UnaryOp", (PyObject
*)UnaryOp_type
) < 0)
3104 if (PyDict_SetItemString(d
, "Lambda", (PyObject
*)Lambda_type
) < 0)
3106 if (PyDict_SetItemString(d
, "IfExp", (PyObject
*)IfExp_type
) < 0) return;
3107 if (PyDict_SetItemString(d
, "Dict", (PyObject
*)Dict_type
) < 0) return;
3108 if (PyDict_SetItemString(d
, "ListComp", (PyObject
*)ListComp_type
) < 0)
3110 if (PyDict_SetItemString(d
, "GeneratorExp",
3111 (PyObject
*)GeneratorExp_type
) < 0) return;
3112 if (PyDict_SetItemString(d
, "Yield", (PyObject
*)Yield_type
) < 0) return;
3113 if (PyDict_SetItemString(d
, "Compare", (PyObject
*)Compare_type
) < 0)
3115 if (PyDict_SetItemString(d
, "Call", (PyObject
*)Call_type
) < 0) return;
3116 if (PyDict_SetItemString(d
, "Repr", (PyObject
*)Repr_type
) < 0) return;
3117 if (PyDict_SetItemString(d
, "Num", (PyObject
*)Num_type
) < 0) return;
3118 if (PyDict_SetItemString(d
, "Str", (PyObject
*)Str_type
) < 0) return;
3119 if (PyDict_SetItemString(d
, "Attribute", (PyObject
*)Attribute_type
) <
3121 if (PyDict_SetItemString(d
, "Subscript", (PyObject
*)Subscript_type
) <
3123 if (PyDict_SetItemString(d
, "Name", (PyObject
*)Name_type
) < 0) return;
3124 if (PyDict_SetItemString(d
, "List", (PyObject
*)List_type
) < 0) return;
3125 if (PyDict_SetItemString(d
, "Tuple", (PyObject
*)Tuple_type
) < 0) return;
3126 if (PyDict_SetItemString(d
, "expr_context",
3127 (PyObject
*)expr_context_type
) < 0) return;
3128 if (PyDict_SetItemString(d
, "Load", (PyObject
*)Load_type
) < 0) return;
3129 if (PyDict_SetItemString(d
, "Store", (PyObject
*)Store_type
) < 0) return;
3130 if (PyDict_SetItemString(d
, "Del", (PyObject
*)Del_type
) < 0) return;
3131 if (PyDict_SetItemString(d
, "AugLoad", (PyObject
*)AugLoad_type
) < 0)
3133 if (PyDict_SetItemString(d
, "AugStore", (PyObject
*)AugStore_type
) < 0)
3135 if (PyDict_SetItemString(d
, "Param", (PyObject
*)Param_type
) < 0) return;
3136 if (PyDict_SetItemString(d
, "slice", (PyObject
*)slice_type
) < 0) return;
3137 if (PyDict_SetItemString(d
, "Ellipsis", (PyObject
*)Ellipsis_type
) < 0)
3139 if (PyDict_SetItemString(d
, "Slice", (PyObject
*)Slice_type
) < 0) return;
3140 if (PyDict_SetItemString(d
, "ExtSlice", (PyObject
*)ExtSlice_type
) < 0)
3142 if (PyDict_SetItemString(d
, "Index", (PyObject
*)Index_type
) < 0) return;
3143 if (PyDict_SetItemString(d
, "boolop", (PyObject
*)boolop_type
) < 0)
3145 if (PyDict_SetItemString(d
, "And", (PyObject
*)And_type
) < 0) return;
3146 if (PyDict_SetItemString(d
, "Or", (PyObject
*)Or_type
) < 0) return;
3147 if (PyDict_SetItemString(d
, "operator", (PyObject
*)operator_type
) < 0)
3149 if (PyDict_SetItemString(d
, "Add", (PyObject
*)Add_type
) < 0) return;
3150 if (PyDict_SetItemString(d
, "Sub", (PyObject
*)Sub_type
) < 0) return;
3151 if (PyDict_SetItemString(d
, "Mult", (PyObject
*)Mult_type
) < 0) return;
3152 if (PyDict_SetItemString(d
, "Div", (PyObject
*)Div_type
) < 0) return;
3153 if (PyDict_SetItemString(d
, "Mod", (PyObject
*)Mod_type
) < 0) return;
3154 if (PyDict_SetItemString(d
, "Pow", (PyObject
*)Pow_type
) < 0) return;
3155 if (PyDict_SetItemString(d
, "LShift", (PyObject
*)LShift_type
) < 0)
3157 if (PyDict_SetItemString(d
, "RShift", (PyObject
*)RShift_type
) < 0)
3159 if (PyDict_SetItemString(d
, "BitOr", (PyObject
*)BitOr_type
) < 0) return;
3160 if (PyDict_SetItemString(d
, "BitXor", (PyObject
*)BitXor_type
) < 0)
3162 if (PyDict_SetItemString(d
, "BitAnd", (PyObject
*)BitAnd_type
) < 0)
3164 if (PyDict_SetItemString(d
, "FloorDiv", (PyObject
*)FloorDiv_type
) < 0)
3166 if (PyDict_SetItemString(d
, "unaryop", (PyObject
*)unaryop_type
) < 0)
3168 if (PyDict_SetItemString(d
, "Invert", (PyObject
*)Invert_type
) < 0)
3170 if (PyDict_SetItemString(d
, "Not", (PyObject
*)Not_type
) < 0) return;
3171 if (PyDict_SetItemString(d
, "UAdd", (PyObject
*)UAdd_type
) < 0) return;
3172 if (PyDict_SetItemString(d
, "USub", (PyObject
*)USub_type
) < 0) return;
3173 if (PyDict_SetItemString(d
, "cmpop", (PyObject
*)cmpop_type
) < 0) return;
3174 if (PyDict_SetItemString(d
, "Eq", (PyObject
*)Eq_type
) < 0) return;
3175 if (PyDict_SetItemString(d
, "NotEq", (PyObject
*)NotEq_type
) < 0) return;
3176 if (PyDict_SetItemString(d
, "Lt", (PyObject
*)Lt_type
) < 0) return;
3177 if (PyDict_SetItemString(d
, "LtE", (PyObject
*)LtE_type
) < 0) return;
3178 if (PyDict_SetItemString(d
, "Gt", (PyObject
*)Gt_type
) < 0) return;
3179 if (PyDict_SetItemString(d
, "GtE", (PyObject
*)GtE_type
) < 0) return;
3180 if (PyDict_SetItemString(d
, "Is", (PyObject
*)Is_type
) < 0) return;
3181 if (PyDict_SetItemString(d
, "IsNot", (PyObject
*)IsNot_type
) < 0) return;
3182 if (PyDict_SetItemString(d
, "In", (PyObject
*)In_type
) < 0) return;
3183 if (PyDict_SetItemString(d
, "NotIn", (PyObject
*)NotIn_type
) < 0) return;
3184 if (PyDict_SetItemString(d
, "comprehension",
3185 (PyObject
*)comprehension_type
) < 0) return;
3186 if (PyDict_SetItemString(d
, "excepthandler",
3187 (PyObject
*)excepthandler_type
) < 0) return;
3188 if (PyDict_SetItemString(d
, "arguments", (PyObject
*)arguments_type
) <
3190 if (PyDict_SetItemString(d
, "keyword", (PyObject
*)keyword_type
) < 0)
3192 if (PyDict_SetItemString(d
, "alias", (PyObject
*)alias_type
) < 0) return;
3196 PyObject
* PyAST_mod2obj(mod_ty t
)
3199 return ast2obj_mod(t
);