LCOV - code coverage report
Current view: top level - Python - Python-ast.c (source / functions) Hit Total Coverage
Test: CPython lcov report Lines: 475 4628 10.3 %
Date: 2017-04-19 Functions: 48 105 45.7 %

          Line data    Source code
       1             : /* File automatically generated by Parser/asdl_c.py. */
       2             : 
       3             : 
       4             : /*
       5             :    __version__ 82160.
       6             : 
       7             :    This module must be committed separately after each AST grammar change;
       8             :    The __version__ number is set to the revision number of the commit
       9             :    containing the grammar change.
      10             : */
      11             : 
      12             : #include "Python.h"
      13             : #include "Python-ast.h"
      14             : 
      15             : static PyTypeObject AST_type;
      16             : static PyTypeObject *mod_type;
      17             : static PyObject* ast2obj_mod(void*);
      18             : static PyTypeObject *Module_type;
      19             : static char *Module_fields[]={
      20             :         "body",
      21             : };
      22             : static PyTypeObject *Interactive_type;
      23             : static char *Interactive_fields[]={
      24             :         "body",
      25             : };
      26             : static PyTypeObject *Expression_type;
      27             : static char *Expression_fields[]={
      28             :         "body",
      29             : };
      30             : static PyTypeObject *Suite_type;
      31             : static char *Suite_fields[]={
      32             :         "body",
      33             : };
      34             : static PyTypeObject *stmt_type;
      35             : static char *stmt_attributes[] = {
      36             :         "lineno",
      37             :         "col_offset",
      38             : };
      39             : static PyObject* ast2obj_stmt(void*);
      40             : static PyTypeObject *FunctionDef_type;
      41             : static char *FunctionDef_fields[]={
      42             :         "name",
      43             :         "args",
      44             :         "body",
      45             :         "decorator_list",
      46             : };
      47             : static PyTypeObject *ClassDef_type;
      48             : static char *ClassDef_fields[]={
      49             :         "name",
      50             :         "bases",
      51             :         "body",
      52             :         "decorator_list",
      53             : };
      54             : static PyTypeObject *Return_type;
      55             : static char *Return_fields[]={
      56             :         "value",
      57             : };
      58             : static PyTypeObject *Delete_type;
      59             : static char *Delete_fields[]={
      60             :         "targets",
      61             : };
      62             : static PyTypeObject *Assign_type;
      63             : static char *Assign_fields[]={
      64             :         "targets",
      65             :         "value",
      66             : };
      67             : static PyTypeObject *AugAssign_type;
      68             : static char *AugAssign_fields[]={
      69             :         "target",
      70             :         "op",
      71             :         "value",
      72             : };
      73             : static PyTypeObject *Print_type;
      74             : static char *Print_fields[]={
      75             :         "dest",
      76             :         "values",
      77             :         "nl",
      78             : };
      79             : static PyTypeObject *For_type;
      80             : static char *For_fields[]={
      81             :         "target",
      82             :         "iter",
      83             :         "body",
      84             :         "orelse",
      85             : };
      86             : static PyTypeObject *While_type;
      87             : static char *While_fields[]={
      88             :         "test",
      89             :         "body",
      90             :         "orelse",
      91             : };
      92             : static PyTypeObject *If_type;
      93             : static char *If_fields[]={
      94             :         "test",
      95             :         "body",
      96             :         "orelse",
      97             : };
      98             : static PyTypeObject *With_type;
      99             : static char *With_fields[]={
     100             :         "context_expr",
     101             :         "optional_vars",
     102             :         "body",
     103             : };
     104             : static PyTypeObject *Raise_type;
     105             : static char *Raise_fields[]={
     106             :         "type",
     107             :         "inst",
     108             :         "tback",
     109             : };
     110             : static PyTypeObject *TryExcept_type;
     111             : static char *TryExcept_fields[]={
     112             :         "body",
     113             :         "handlers",
     114             :         "orelse",
     115             : };
     116             : static PyTypeObject *TryFinally_type;
     117             : static char *TryFinally_fields[]={
     118             :         "body",
     119             :         "finalbody",
     120             : };
     121             : static PyTypeObject *Assert_type;
     122             : static char *Assert_fields[]={
     123             :         "test",
     124             :         "msg",
     125             : };
     126             : static PyTypeObject *Import_type;
     127             : static char *Import_fields[]={
     128             :         "names",
     129             : };
     130             : static PyTypeObject *ImportFrom_type;
     131             : static char *ImportFrom_fields[]={
     132             :         "module",
     133             :         "names",
     134             :         "level",
     135             : };
     136             : static PyTypeObject *Exec_type;
     137             : static char *Exec_fields[]={
     138             :         "body",
     139             :         "globals",
     140             :         "locals",
     141             : };
     142             : static PyTypeObject *Global_type;
     143             : static char *Global_fields[]={
     144             :         "names",
     145             : };
     146             : static PyTypeObject *Expr_type;
     147             : static char *Expr_fields[]={
     148             :         "value",
     149             : };
     150             : static PyTypeObject *Pass_type;
     151             : static PyTypeObject *Break_type;
     152             : static PyTypeObject *Continue_type;
     153             : static PyTypeObject *expr_type;
     154             : static char *expr_attributes[] = {
     155             :         "lineno",
     156             :         "col_offset",
     157             : };
     158             : static PyObject* ast2obj_expr(void*);
     159             : static PyTypeObject *BoolOp_type;
     160             : static char *BoolOp_fields[]={
     161             :         "op",
     162             :         "values",
     163             : };
     164             : static PyTypeObject *BinOp_type;
     165             : static char *BinOp_fields[]={
     166             :         "left",
     167             :         "op",
     168             :         "right",
     169             : };
     170             : static PyTypeObject *UnaryOp_type;
     171             : static char *UnaryOp_fields[]={
     172             :         "op",
     173             :         "operand",
     174             : };
     175             : static PyTypeObject *Lambda_type;
     176             : static char *Lambda_fields[]={
     177             :         "args",
     178             :         "body",
     179             : };
     180             : static PyTypeObject *IfExp_type;
     181             : static char *IfExp_fields[]={
     182             :         "test",
     183             :         "body",
     184             :         "orelse",
     185             : };
     186             : static PyTypeObject *Dict_type;
     187             : static char *Dict_fields[]={
     188             :         "keys",
     189             :         "values",
     190             : };
     191             : static PyTypeObject *Set_type;
     192             : static char *Set_fields[]={
     193             :         "elts",
     194             : };
     195             : static PyTypeObject *ListComp_type;
     196             : static char *ListComp_fields[]={
     197             :         "elt",
     198             :         "generators",
     199             : };
     200             : static PyTypeObject *SetComp_type;
     201             : static char *SetComp_fields[]={
     202             :         "elt",
     203             :         "generators",
     204             : };
     205             : static PyTypeObject *DictComp_type;
     206             : static char *DictComp_fields[]={
     207             :         "key",
     208             :         "value",
     209             :         "generators",
     210             : };
     211             : static PyTypeObject *GeneratorExp_type;
     212             : static char *GeneratorExp_fields[]={
     213             :         "elt",
     214             :         "generators",
     215             : };
     216             : static PyTypeObject *Yield_type;
     217             : static char *Yield_fields[]={
     218             :         "value",
     219             : };
     220             : static PyTypeObject *Compare_type;
     221             : static char *Compare_fields[]={
     222             :         "left",
     223             :         "ops",
     224             :         "comparators",
     225             : };
     226             : static PyTypeObject *Call_type;
     227             : static char *Call_fields[]={
     228             :         "func",
     229             :         "args",
     230             :         "keywords",
     231             :         "starargs",
     232             :         "kwargs",
     233             : };
     234             : static PyTypeObject *Repr_type;
     235             : static char *Repr_fields[]={
     236             :         "value",
     237             : };
     238             : static PyTypeObject *Num_type;
     239             : static char *Num_fields[]={
     240             :         "n",
     241             : };
     242             : static PyTypeObject *Str_type;
     243             : static char *Str_fields[]={
     244             :         "s",
     245             : };
     246             : static PyTypeObject *Attribute_type;
     247             : static char *Attribute_fields[]={
     248             :         "value",
     249             :         "attr",
     250             :         "ctx",
     251             : };
     252             : static PyTypeObject *Subscript_type;
     253             : static char *Subscript_fields[]={
     254             :         "value",
     255             :         "slice",
     256             :         "ctx",
     257             : };
     258             : static PyTypeObject *Name_type;
     259             : static char *Name_fields[]={
     260             :         "id",
     261             :         "ctx",
     262             : };
     263             : static PyTypeObject *List_type;
     264             : static char *List_fields[]={
     265             :         "elts",
     266             :         "ctx",
     267             : };
     268             : static PyTypeObject *Tuple_type;
     269             : static char *Tuple_fields[]={
     270             :         "elts",
     271             :         "ctx",
     272             : };
     273             : static PyTypeObject *expr_context_type;
     274             : static PyObject *Load_singleton, *Store_singleton, *Del_singleton,
     275             : *AugLoad_singleton, *AugStore_singleton, *Param_singleton;
     276             : static PyObject* ast2obj_expr_context(expr_context_ty);
     277             : static PyTypeObject *Load_type;
     278             : static PyTypeObject *Store_type;
     279             : static PyTypeObject *Del_type;
     280             : static PyTypeObject *AugLoad_type;
     281             : static PyTypeObject *AugStore_type;
     282             : static PyTypeObject *Param_type;
     283             : static PyTypeObject *slice_type;
     284             : static PyObject* ast2obj_slice(void*);
     285             : static PyTypeObject *Ellipsis_type;
     286             : static PyTypeObject *Slice_type;
     287             : static char *Slice_fields[]={
     288             :         "lower",
     289             :         "upper",
     290             :         "step",
     291             : };
     292             : static PyTypeObject *ExtSlice_type;
     293             : static char *ExtSlice_fields[]={
     294             :         "dims",
     295             : };
     296             : static PyTypeObject *Index_type;
     297             : static char *Index_fields[]={
     298             :         "value",
     299             : };
     300             : static PyTypeObject *boolop_type;
     301             : static PyObject *And_singleton, *Or_singleton;
     302             : static PyObject* ast2obj_boolop(boolop_ty);
     303             : static PyTypeObject *And_type;
     304             : static PyTypeObject *Or_type;
     305             : static PyTypeObject *operator_type;
     306             : static PyObject *Add_singleton, *Sub_singleton, *Mult_singleton,
     307             : *Div_singleton, *Mod_singleton, *Pow_singleton, *LShift_singleton,
     308             : *RShift_singleton, *BitOr_singleton, *BitXor_singleton, *BitAnd_singleton,
     309             : *FloorDiv_singleton;
     310             : static PyObject* ast2obj_operator(operator_ty);
     311             : static PyTypeObject *Add_type;
     312             : static PyTypeObject *Sub_type;
     313             : static PyTypeObject *Mult_type;
     314             : static PyTypeObject *Div_type;
     315             : static PyTypeObject *Mod_type;
     316             : static PyTypeObject *Pow_type;
     317             : static PyTypeObject *LShift_type;
     318             : static PyTypeObject *RShift_type;
     319             : static PyTypeObject *BitOr_type;
     320             : static PyTypeObject *BitXor_type;
     321             : static PyTypeObject *BitAnd_type;
     322             : static PyTypeObject *FloorDiv_type;
     323             : static PyTypeObject *unaryop_type;
     324             : static PyObject *Invert_singleton, *Not_singleton, *UAdd_singleton,
     325             : *USub_singleton;
     326             : static PyObject* ast2obj_unaryop(unaryop_ty);
     327             : static PyTypeObject *Invert_type;
     328             : static PyTypeObject *Not_type;
     329             : static PyTypeObject *UAdd_type;
     330             : static PyTypeObject *USub_type;
     331             : static PyTypeObject *cmpop_type;
     332             : static PyObject *Eq_singleton, *NotEq_singleton, *Lt_singleton, *LtE_singleton,
     333             : *Gt_singleton, *GtE_singleton, *Is_singleton, *IsNot_singleton, *In_singleton,
     334             : *NotIn_singleton;
     335             : static PyObject* ast2obj_cmpop(cmpop_ty);
     336             : static PyTypeObject *Eq_type;
     337             : static PyTypeObject *NotEq_type;
     338             : static PyTypeObject *Lt_type;
     339             : static PyTypeObject *LtE_type;
     340             : static PyTypeObject *Gt_type;
     341             : static PyTypeObject *GtE_type;
     342             : static PyTypeObject *Is_type;
     343             : static PyTypeObject *IsNot_type;
     344             : static PyTypeObject *In_type;
     345             : static PyTypeObject *NotIn_type;
     346             : static PyTypeObject *comprehension_type;
     347             : static PyObject* ast2obj_comprehension(void*);
     348             : static char *comprehension_fields[]={
     349             :         "target",
     350             :         "iter",
     351             :         "ifs",
     352             : };
     353             : static PyTypeObject *excepthandler_type;
     354             : static char *excepthandler_attributes[] = {
     355             :         "lineno",
     356             :         "col_offset",
     357             : };
     358             : static PyObject* ast2obj_excepthandler(void*);
     359             : static PyTypeObject *ExceptHandler_type;
     360             : static char *ExceptHandler_fields[]={
     361             :         "type",
     362             :         "name",
     363             :         "body",
     364             : };
     365             : static PyTypeObject *arguments_type;
     366             : static PyObject* ast2obj_arguments(void*);
     367             : static char *arguments_fields[]={
     368             :         "args",
     369             :         "vararg",
     370             :         "kwarg",
     371             :         "defaults",
     372             : };
     373             : static PyTypeObject *keyword_type;
     374             : static PyObject* ast2obj_keyword(void*);
     375             : static char *keyword_fields[]={
     376             :         "arg",
     377             :         "value",
     378             : };
     379             : static PyTypeObject *alias_type;
     380             : static PyObject* ast2obj_alias(void*);
     381             : static char *alias_fields[]={
     382             :         "name",
     383             :         "asname",
     384             : };
     385             : 
     386             : 
     387             : static int
     388           0 : ast_type_init(PyObject *self, PyObject *args, PyObject *kw)
     389             : {
     390           0 :     Py_ssize_t i, numfields = 0;
     391           0 :     int res = -1;
     392             :     PyObject *key, *value, *fields;
     393           0 :     fields = PyObject_GetAttrString((PyObject*)Py_TYPE(self), "_fields");
     394           0 :     if (!fields)
     395           0 :         PyErr_Clear();
     396           0 :     if (fields) {
     397           0 :         numfields = PySequence_Size(fields);
     398           0 :         if (numfields == -1)
     399           0 :             goto cleanup;
     400             :     }
     401           0 :     res = 0; /* if no error occurs, this stays 0 to the end */
     402           0 :     if (PyTuple_GET_SIZE(args) > 0) {
     403           0 :         if (numfields != PyTuple_GET_SIZE(args)) {
     404           0 :             PyErr_Format(PyExc_TypeError, "%.400s constructor takes %s"
     405             :                          "%zd positional argument%s",
     406           0 :                          Py_TYPE(self)->tp_name,
     407             :                          numfields == 0 ? "" : "either 0 or ",
     408             :                          numfields, numfields == 1 ? "" : "s");
     409           0 :             res = -1;
     410           0 :             goto cleanup;
     411             :         }
     412           0 :         for (i = 0; i < PyTuple_GET_SIZE(args); i++) {
     413             :             /* cannot be reached when fields is NULL */
     414           0 :             PyObject *name = PySequence_GetItem(fields, i);
     415           0 :             if (!name) {
     416           0 :                 res = -1;
     417           0 :                 goto cleanup;
     418             :             }
     419           0 :             res = PyObject_SetAttr(self, name, PyTuple_GET_ITEM(args, i));
     420           0 :             Py_DECREF(name);
     421           0 :             if (res < 0)
     422           0 :                 goto cleanup;
     423             :         }
     424             :     }
     425           0 :     if (kw) {
     426           0 :         i = 0;  /* needed by PyDict_Next */
     427           0 :         while (PyDict_Next(kw, &i, &key, &value)) {
     428           0 :             res = PyObject_SetAttr(self, key, value);
     429           0 :             if (res < 0)
     430           0 :                 goto cleanup;
     431             :         }
     432             :     }
     433             :   cleanup:
     434           0 :     Py_XDECREF(fields);
     435           0 :     return res;
     436             : }
     437             : 
     438             : /* Pickling support */
     439             : static PyObject *
     440           0 : ast_type_reduce(PyObject *self, PyObject *unused)
     441             : {
     442             :     PyObject *res;
     443           0 :     PyObject *dict = PyObject_GetAttrString(self, "__dict__");
     444           0 :     if (dict == NULL) {
     445           0 :         if (PyErr_ExceptionMatches(PyExc_AttributeError))
     446           0 :             PyErr_Clear();
     447             :         else
     448           0 :             return NULL;
     449             :     }
     450           0 :     if (dict) {
     451           0 :         res = Py_BuildValue("O()O", Py_TYPE(self), dict);
     452           0 :         Py_DECREF(dict);
     453           0 :         return res;
     454             :     }
     455           0 :     return Py_BuildValue("O()", Py_TYPE(self));
     456             : }
     457             : 
     458             : static PyMethodDef ast_type_methods[] = {
     459             :     {"__reduce__", ast_type_reduce, METH_NOARGS, NULL},
     460             :     {NULL}
     461             : };
     462             : 
     463             : static PyTypeObject AST_type = {
     464             :     PyVarObject_HEAD_INIT(&PyType_Type, 0)
     465             :     "_ast.AST",
     466             :     sizeof(PyObject),
     467             :     0,
     468             :     0,                       /* tp_dealloc */
     469             :     0,                       /* tp_print */
     470             :     0,                       /* tp_getattr */
     471             :     0,                       /* tp_setattr */
     472             :     0,                       /* tp_compare */
     473             :     0,                       /* tp_repr */
     474             :     0,                       /* tp_as_number */
     475             :     0,                       /* tp_as_sequence */
     476             :     0,                       /* tp_as_mapping */
     477             :     0,                       /* tp_hash */
     478             :     0,                       /* tp_call */
     479             :     0,                       /* tp_str */
     480             :     PyObject_GenericGetAttr, /* tp_getattro */
     481             :     PyObject_GenericSetAttr, /* tp_setattro */
     482             :     0,                       /* tp_as_buffer */
     483             :     Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */
     484             :     0,                       /* tp_doc */
     485             :     0,                       /* tp_traverse */
     486             :     0,                       /* tp_clear */
     487             :     0,                       /* tp_richcompare */
     488             :     0,                       /* tp_weaklistoffset */
     489             :     0,                       /* tp_iter */
     490             :     0,                       /* tp_iternext */
     491             :     ast_type_methods,        /* tp_methods */
     492             :     0,                       /* tp_members */
     493             :     0,                       /* tp_getset */
     494             :     0,                       /* tp_base */
     495             :     0,                       /* tp_dict */
     496             :     0,                       /* tp_descr_get */
     497             :     0,                       /* tp_descr_set */
     498             :     0,                       /* tp_dictoffset */
     499             :     (initproc)ast_type_init, /* tp_init */
     500             :     PyType_GenericAlloc,     /* tp_alloc */
     501             :     PyType_GenericNew,       /* tp_new */
     502             :     PyObject_Del,            /* tp_free */
     503             : };
     504             : 
     505             : 
     506           0 : static PyTypeObject* make_type(char *type, PyTypeObject* base, char**fields, int num_fields)
     507             : {
     508             :     PyObject *fnames, *result;
     509             :     int i;
     510           0 :     fnames = PyTuple_New(num_fields);
     511           0 :     if (!fnames) return NULL;
     512           0 :     for (i = 0; i < num_fields; i++) {
     513           0 :         PyObject *field = PyString_FromString(fields[i]);
     514           0 :         if (!field) {
     515           0 :             Py_DECREF(fnames);
     516           0 :             return NULL;
     517             :         }
     518           0 :         PyTuple_SET_ITEM(fnames, i, field);
     519             :     }
     520           0 :     result = PyObject_CallFunction((PyObject*)&PyType_Type, "s(O){sOss}",
     521             :                     type, base, "_fields", fnames, "__module__", "_ast");
     522           0 :     Py_DECREF(fnames);
     523           0 :     return (PyTypeObject*)result;
     524             : }
     525             : 
     526           0 : static int add_attributes(PyTypeObject* type, char**attrs, int num_fields)
     527             : {
     528             :     int i, result;
     529           0 :     PyObject *s, *l = PyTuple_New(num_fields);
     530           0 :     if (!l)
     531           0 :         return 0;
     532           0 :     for (i = 0; i < num_fields; i++) {
     533           0 :         s = PyString_FromString(attrs[i]);
     534           0 :         if (!s) {
     535           0 :             Py_DECREF(l);
     536           0 :             return 0;
     537             :         }
     538           0 :         PyTuple_SET_ITEM(l, i, s);
     539             :     }
     540           0 :     result = PyObject_SetAttrString((PyObject*)type, "_attributes", l) >= 0;
     541           0 :     Py_DECREF(l);
     542           0 :     return result;
     543             : }
     544             : 
     545             : /* Conversion AST -> Python */
     546             : 
     547           0 : static PyObject* ast2obj_list(asdl_seq *seq, PyObject* (*func)(void*))
     548             : {
     549           0 :     int i, n = asdl_seq_LEN(seq);
     550           0 :     PyObject *result = PyList_New(n);
     551             :     PyObject *value;
     552           0 :     if (!result)
     553           0 :         return NULL;
     554           0 :     for (i = 0; i < n; i++) {
     555           0 :         value = func(asdl_seq_GET(seq, i));
     556           0 :         if (!value) {
     557           0 :             Py_DECREF(result);
     558           0 :             return NULL;
     559             :         }
     560           0 :         PyList_SET_ITEM(result, i, value);
     561             :     }
     562           0 :     return result;
     563             : }
     564             : 
     565           0 : static PyObject* ast2obj_object(void *o)
     566             : {
     567           0 :     if (!o)
     568           0 :         o = Py_None;
     569           0 :     Py_INCREF((PyObject*)o);
     570           0 :     return (PyObject*)o;
     571             : }
     572             : #define ast2obj_identifier ast2obj_object
     573             : #define ast2obj_string ast2obj_object
     574           0 : static PyObject* ast2obj_bool(bool b)
     575             : {
     576           0 :     return PyBool_FromLong(b);
     577             : }
     578             : 
     579           0 : static PyObject* ast2obj_int(long b)
     580             : {
     581           0 :     return PyInt_FromLong(b);
     582             : }
     583             : 
     584             : /* Conversion Python -> AST */
     585             : 
     586           0 : static int obj2ast_object(PyObject* obj, PyObject** out, PyArena* arena)
     587             : {
     588           0 :     if (obj == Py_None)
     589           0 :         obj = NULL;
     590           0 :     if (obj)
     591           0 :         PyArena_AddPyObject(arena, obj);
     592           0 :     Py_XINCREF(obj);
     593           0 :     *out = obj;
     594           0 :     return 0;
     595             : }
     596             : 
     597           0 : static int obj2ast_identifier(PyObject* obj, PyObject** out, PyArena* arena)
     598             : {
     599           0 :     if (!PyString_CheckExact(obj) && obj != Py_None) {
     600           0 :         PyErr_Format(PyExc_TypeError,
     601             :                     "AST identifier must be of type str");
     602           0 :         return 1;
     603             :     }
     604           0 :     return obj2ast_object(obj, out, arena);
     605             : }
     606             : 
     607           0 : static int obj2ast_string(PyObject* obj, PyObject** out, PyArena* arena)
     608             : {
     609           0 :     if (!PyString_CheckExact(obj) && !PyUnicode_CheckExact(obj)) {
     610           0 :         PyErr_SetString(PyExc_TypeError,
     611             :                        "AST string must be of type str or unicode");
     612           0 :         return 1;
     613             :     }
     614           0 :     return obj2ast_object(obj, out, arena);
     615             : }
     616             : 
     617           0 : static int obj2ast_int(PyObject* obj, int* out, PyArena* arena)
     618             : {
     619             :     int i;
     620           0 :     if (!PyInt_Check(obj) && !PyLong_Check(obj)) {
     621           0 :         PyObject *s = PyObject_Repr(obj);
     622           0 :         if (s == NULL) return 1;
     623           0 :         PyErr_Format(PyExc_ValueError, "invalid integer value: %.400s",
     624           0 :                      PyString_AS_STRING(s));
     625           0 :         Py_DECREF(s);
     626           0 :         return 1;
     627             :     }
     628             : 
     629           0 :     i = (int)PyLong_AsLong(obj);
     630           0 :     if (i == -1 && PyErr_Occurred())
     631           0 :         return 1;
     632           0 :     *out = i;
     633           0 :     return 0;
     634             : }
     635             : 
     636           0 : static int obj2ast_bool(PyObject* obj, bool* out, PyArena* arena)
     637             : {
     638           0 :     if (!PyBool_Check(obj)) {
     639           0 :         PyObject *s = PyObject_Repr(obj);
     640           0 :         if (s == NULL) return 1;
     641           0 :         PyErr_Format(PyExc_ValueError, "invalid boolean value: %.400s",
     642           0 :                      PyString_AS_STRING(s));
     643           0 :         Py_DECREF(s);
     644           0 :         return 1;
     645             :     }
     646             : 
     647           0 :     *out = (obj == Py_True);
     648           0 :     return 0;
     649             : }
     650             : 
     651           0 : static int add_ast_fields(void)
     652             : {
     653             :     PyObject *empty_tuple, *d;
     654           0 :     if (PyType_Ready(&AST_type) < 0)
     655           0 :         return -1;
     656           0 :     d = AST_type.tp_dict;
     657           0 :     empty_tuple = PyTuple_New(0);
     658           0 :     if (!empty_tuple ||
     659           0 :         PyDict_SetItemString(d, "_fields", empty_tuple) < 0 ||
     660           0 :         PyDict_SetItemString(d, "_attributes", empty_tuple) < 0) {
     661           0 :         Py_XDECREF(empty_tuple);
     662           0 :         return -1;
     663             :     }
     664           0 :     Py_DECREF(empty_tuple);
     665           0 :     return 0;
     666             : }
     667             : 
     668             : 
     669           0 : static int init_types(void)
     670             : {
     671             :         static int initialized;
     672           0 :         if (initialized) return 1;
     673           0 :         if (add_ast_fields() < 0) return 0;
     674           0 :         mod_type = make_type("mod", &AST_type, NULL, 0);
     675           0 :         if (!mod_type) return 0;
     676           0 :         if (!add_attributes(mod_type, NULL, 0)) return 0;
     677           0 :         Module_type = make_type("Module", mod_type, Module_fields, 1);
     678           0 :         if (!Module_type) return 0;
     679           0 :         Interactive_type = make_type("Interactive", mod_type,
     680             :                                      Interactive_fields, 1);
     681           0 :         if (!Interactive_type) return 0;
     682           0 :         Expression_type = make_type("Expression", mod_type, Expression_fields,
     683             :                                     1);
     684           0 :         if (!Expression_type) return 0;
     685           0 :         Suite_type = make_type("Suite", mod_type, Suite_fields, 1);
     686           0 :         if (!Suite_type) return 0;
     687           0 :         stmt_type = make_type("stmt", &AST_type, NULL, 0);
     688           0 :         if (!stmt_type) return 0;
     689           0 :         if (!add_attributes(stmt_type, stmt_attributes, 2)) return 0;
     690           0 :         FunctionDef_type = make_type("FunctionDef", stmt_type,
     691             :                                      FunctionDef_fields, 4);
     692           0 :         if (!FunctionDef_type) return 0;
     693           0 :         ClassDef_type = make_type("ClassDef", stmt_type, ClassDef_fields, 4);
     694           0 :         if (!ClassDef_type) return 0;
     695           0 :         Return_type = make_type("Return", stmt_type, Return_fields, 1);
     696           0 :         if (!Return_type) return 0;
     697           0 :         Delete_type = make_type("Delete", stmt_type, Delete_fields, 1);
     698           0 :         if (!Delete_type) return 0;
     699           0 :         Assign_type = make_type("Assign", stmt_type, Assign_fields, 2);
     700           0 :         if (!Assign_type) return 0;
     701           0 :         AugAssign_type = make_type("AugAssign", stmt_type, AugAssign_fields, 3);
     702           0 :         if (!AugAssign_type) return 0;
     703           0 :         Print_type = make_type("Print", stmt_type, Print_fields, 3);
     704           0 :         if (!Print_type) return 0;
     705           0 :         For_type = make_type("For", stmt_type, For_fields, 4);
     706           0 :         if (!For_type) return 0;
     707           0 :         While_type = make_type("While", stmt_type, While_fields, 3);
     708           0 :         if (!While_type) return 0;
     709           0 :         If_type = make_type("If", stmt_type, If_fields, 3);
     710           0 :         if (!If_type) return 0;
     711           0 :         With_type = make_type("With", stmt_type, With_fields, 3);
     712           0 :         if (!With_type) return 0;
     713           0 :         Raise_type = make_type("Raise", stmt_type, Raise_fields, 3);
     714           0 :         if (!Raise_type) return 0;
     715           0 :         TryExcept_type = make_type("TryExcept", stmt_type, TryExcept_fields, 3);
     716           0 :         if (!TryExcept_type) return 0;
     717           0 :         TryFinally_type = make_type("TryFinally", stmt_type, TryFinally_fields,
     718             :                                     2);
     719           0 :         if (!TryFinally_type) return 0;
     720           0 :         Assert_type = make_type("Assert", stmt_type, Assert_fields, 2);
     721           0 :         if (!Assert_type) return 0;
     722           0 :         Import_type = make_type("Import", stmt_type, Import_fields, 1);
     723           0 :         if (!Import_type) return 0;
     724           0 :         ImportFrom_type = make_type("ImportFrom", stmt_type, ImportFrom_fields,
     725             :                                     3);
     726           0 :         if (!ImportFrom_type) return 0;
     727           0 :         Exec_type = make_type("Exec", stmt_type, Exec_fields, 3);
     728           0 :         if (!Exec_type) return 0;
     729           0 :         Global_type = make_type("Global", stmt_type, Global_fields, 1);
     730           0 :         if (!Global_type) return 0;
     731           0 :         Expr_type = make_type("Expr", stmt_type, Expr_fields, 1);
     732           0 :         if (!Expr_type) return 0;
     733           0 :         Pass_type = make_type("Pass", stmt_type, NULL, 0);
     734           0 :         if (!Pass_type) return 0;
     735           0 :         Break_type = make_type("Break", stmt_type, NULL, 0);
     736           0 :         if (!Break_type) return 0;
     737           0 :         Continue_type = make_type("Continue", stmt_type, NULL, 0);
     738           0 :         if (!Continue_type) return 0;
     739           0 :         expr_type = make_type("expr", &AST_type, NULL, 0);
     740           0 :         if (!expr_type) return 0;
     741           0 :         if (!add_attributes(expr_type, expr_attributes, 2)) return 0;
     742           0 :         BoolOp_type = make_type("BoolOp", expr_type, BoolOp_fields, 2);
     743           0 :         if (!BoolOp_type) return 0;
     744           0 :         BinOp_type = make_type("BinOp", expr_type, BinOp_fields, 3);
     745           0 :         if (!BinOp_type) return 0;
     746           0 :         UnaryOp_type = make_type("UnaryOp", expr_type, UnaryOp_fields, 2);
     747           0 :         if (!UnaryOp_type) return 0;
     748           0 :         Lambda_type = make_type("Lambda", expr_type, Lambda_fields, 2);
     749           0 :         if (!Lambda_type) return 0;
     750           0 :         IfExp_type = make_type("IfExp", expr_type, IfExp_fields, 3);
     751           0 :         if (!IfExp_type) return 0;
     752           0 :         Dict_type = make_type("Dict", expr_type, Dict_fields, 2);
     753           0 :         if (!Dict_type) return 0;
     754           0 :         Set_type = make_type("Set", expr_type, Set_fields, 1);
     755           0 :         if (!Set_type) return 0;
     756           0 :         ListComp_type = make_type("ListComp", expr_type, ListComp_fields, 2);
     757           0 :         if (!ListComp_type) return 0;
     758           0 :         SetComp_type = make_type("SetComp", expr_type, SetComp_fields, 2);
     759           0 :         if (!SetComp_type) return 0;
     760           0 :         DictComp_type = make_type("DictComp", expr_type, DictComp_fields, 3);
     761           0 :         if (!DictComp_type) return 0;
     762           0 :         GeneratorExp_type = make_type("GeneratorExp", expr_type,
     763             :                                       GeneratorExp_fields, 2);
     764           0 :         if (!GeneratorExp_type) return 0;
     765           0 :         Yield_type = make_type("Yield", expr_type, Yield_fields, 1);
     766           0 :         if (!Yield_type) return 0;
     767           0 :         Compare_type = make_type("Compare", expr_type, Compare_fields, 3);
     768           0 :         if (!Compare_type) return 0;
     769           0 :         Call_type = make_type("Call", expr_type, Call_fields, 5);
     770           0 :         if (!Call_type) return 0;
     771           0 :         Repr_type = make_type("Repr", expr_type, Repr_fields, 1);
     772           0 :         if (!Repr_type) return 0;
     773           0 :         Num_type = make_type("Num", expr_type, Num_fields, 1);
     774           0 :         if (!Num_type) return 0;
     775           0 :         Str_type = make_type("Str", expr_type, Str_fields, 1);
     776           0 :         if (!Str_type) return 0;
     777           0 :         Attribute_type = make_type("Attribute", expr_type, Attribute_fields, 3);
     778           0 :         if (!Attribute_type) return 0;
     779           0 :         Subscript_type = make_type("Subscript", expr_type, Subscript_fields, 3);
     780           0 :         if (!Subscript_type) return 0;
     781           0 :         Name_type = make_type("Name", expr_type, Name_fields, 2);
     782           0 :         if (!Name_type) return 0;
     783           0 :         List_type = make_type("List", expr_type, List_fields, 2);
     784           0 :         if (!List_type) return 0;
     785           0 :         Tuple_type = make_type("Tuple", expr_type, Tuple_fields, 2);
     786           0 :         if (!Tuple_type) return 0;
     787           0 :         expr_context_type = make_type("expr_context", &AST_type, NULL, 0);
     788           0 :         if (!expr_context_type) return 0;
     789           0 :         if (!add_attributes(expr_context_type, NULL, 0)) return 0;
     790           0 :         Load_type = make_type("Load", expr_context_type, NULL, 0);
     791           0 :         if (!Load_type) return 0;
     792           0 :         Load_singleton = PyType_GenericNew(Load_type, NULL, NULL);
     793           0 :         if (!Load_singleton) return 0;
     794           0 :         Store_type = make_type("Store", expr_context_type, NULL, 0);
     795           0 :         if (!Store_type) return 0;
     796           0 :         Store_singleton = PyType_GenericNew(Store_type, NULL, NULL);
     797           0 :         if (!Store_singleton) return 0;
     798           0 :         Del_type = make_type("Del", expr_context_type, NULL, 0);
     799           0 :         if (!Del_type) return 0;
     800           0 :         Del_singleton = PyType_GenericNew(Del_type, NULL, NULL);
     801           0 :         if (!Del_singleton) return 0;
     802           0 :         AugLoad_type = make_type("AugLoad", expr_context_type, NULL, 0);
     803           0 :         if (!AugLoad_type) return 0;
     804           0 :         AugLoad_singleton = PyType_GenericNew(AugLoad_type, NULL, NULL);
     805           0 :         if (!AugLoad_singleton) return 0;
     806           0 :         AugStore_type = make_type("AugStore", expr_context_type, NULL, 0);
     807           0 :         if (!AugStore_type) return 0;
     808           0 :         AugStore_singleton = PyType_GenericNew(AugStore_type, NULL, NULL);
     809           0 :         if (!AugStore_singleton) return 0;
     810           0 :         Param_type = make_type("Param", expr_context_type, NULL, 0);
     811           0 :         if (!Param_type) return 0;
     812           0 :         Param_singleton = PyType_GenericNew(Param_type, NULL, NULL);
     813           0 :         if (!Param_singleton) return 0;
     814           0 :         slice_type = make_type("slice", &AST_type, NULL, 0);
     815           0 :         if (!slice_type) return 0;
     816           0 :         if (!add_attributes(slice_type, NULL, 0)) return 0;
     817           0 :         Ellipsis_type = make_type("Ellipsis", slice_type, NULL, 0);
     818           0 :         if (!Ellipsis_type) return 0;
     819           0 :         Slice_type = make_type("Slice", slice_type, Slice_fields, 3);
     820           0 :         if (!Slice_type) return 0;
     821           0 :         ExtSlice_type = make_type("ExtSlice", slice_type, ExtSlice_fields, 1);
     822           0 :         if (!ExtSlice_type) return 0;
     823           0 :         Index_type = make_type("Index", slice_type, Index_fields, 1);
     824           0 :         if (!Index_type) return 0;
     825           0 :         boolop_type = make_type("boolop", &AST_type, NULL, 0);
     826           0 :         if (!boolop_type) return 0;
     827           0 :         if (!add_attributes(boolop_type, NULL, 0)) return 0;
     828           0 :         And_type = make_type("And", boolop_type, NULL, 0);
     829           0 :         if (!And_type) return 0;
     830           0 :         And_singleton = PyType_GenericNew(And_type, NULL, NULL);
     831           0 :         if (!And_singleton) return 0;
     832           0 :         Or_type = make_type("Or", boolop_type, NULL, 0);
     833           0 :         if (!Or_type) return 0;
     834           0 :         Or_singleton = PyType_GenericNew(Or_type, NULL, NULL);
     835           0 :         if (!Or_singleton) return 0;
     836           0 :         operator_type = make_type("operator", &AST_type, NULL, 0);
     837           0 :         if (!operator_type) return 0;
     838           0 :         if (!add_attributes(operator_type, NULL, 0)) return 0;
     839           0 :         Add_type = make_type("Add", operator_type, NULL, 0);
     840           0 :         if (!Add_type) return 0;
     841           0 :         Add_singleton = PyType_GenericNew(Add_type, NULL, NULL);
     842           0 :         if (!Add_singleton) return 0;
     843           0 :         Sub_type = make_type("Sub", operator_type, NULL, 0);
     844           0 :         if (!Sub_type) return 0;
     845           0 :         Sub_singleton = PyType_GenericNew(Sub_type, NULL, NULL);
     846           0 :         if (!Sub_singleton) return 0;
     847           0 :         Mult_type = make_type("Mult", operator_type, NULL, 0);
     848           0 :         if (!Mult_type) return 0;
     849           0 :         Mult_singleton = PyType_GenericNew(Mult_type, NULL, NULL);
     850           0 :         if (!Mult_singleton) return 0;
     851           0 :         Div_type = make_type("Div", operator_type, NULL, 0);
     852           0 :         if (!Div_type) return 0;
     853           0 :         Div_singleton = PyType_GenericNew(Div_type, NULL, NULL);
     854           0 :         if (!Div_singleton) return 0;
     855           0 :         Mod_type = make_type("Mod", operator_type, NULL, 0);
     856           0 :         if (!Mod_type) return 0;
     857           0 :         Mod_singleton = PyType_GenericNew(Mod_type, NULL, NULL);
     858           0 :         if (!Mod_singleton) return 0;
     859           0 :         Pow_type = make_type("Pow", operator_type, NULL, 0);
     860           0 :         if (!Pow_type) return 0;
     861           0 :         Pow_singleton = PyType_GenericNew(Pow_type, NULL, NULL);
     862           0 :         if (!Pow_singleton) return 0;
     863           0 :         LShift_type = make_type("LShift", operator_type, NULL, 0);
     864           0 :         if (!LShift_type) return 0;
     865           0 :         LShift_singleton = PyType_GenericNew(LShift_type, NULL, NULL);
     866           0 :         if (!LShift_singleton) return 0;
     867           0 :         RShift_type = make_type("RShift", operator_type, NULL, 0);
     868           0 :         if (!RShift_type) return 0;
     869           0 :         RShift_singleton = PyType_GenericNew(RShift_type, NULL, NULL);
     870           0 :         if (!RShift_singleton) return 0;
     871           0 :         BitOr_type = make_type("BitOr", operator_type, NULL, 0);
     872           0 :         if (!BitOr_type) return 0;
     873           0 :         BitOr_singleton = PyType_GenericNew(BitOr_type, NULL, NULL);
     874           0 :         if (!BitOr_singleton) return 0;
     875           0 :         BitXor_type = make_type("BitXor", operator_type, NULL, 0);
     876           0 :         if (!BitXor_type) return 0;
     877           0 :         BitXor_singleton = PyType_GenericNew(BitXor_type, NULL, NULL);
     878           0 :         if (!BitXor_singleton) return 0;
     879           0 :         BitAnd_type = make_type("BitAnd", operator_type, NULL, 0);
     880           0 :         if (!BitAnd_type) return 0;
     881           0 :         BitAnd_singleton = PyType_GenericNew(BitAnd_type, NULL, NULL);
     882           0 :         if (!BitAnd_singleton) return 0;
     883           0 :         FloorDiv_type = make_type("FloorDiv", operator_type, NULL, 0);
     884           0 :         if (!FloorDiv_type) return 0;
     885           0 :         FloorDiv_singleton = PyType_GenericNew(FloorDiv_type, NULL, NULL);
     886           0 :         if (!FloorDiv_singleton) return 0;
     887           0 :         unaryop_type = make_type("unaryop", &AST_type, NULL, 0);
     888           0 :         if (!unaryop_type) return 0;
     889           0 :         if (!add_attributes(unaryop_type, NULL, 0)) return 0;
     890           0 :         Invert_type = make_type("Invert", unaryop_type, NULL, 0);
     891           0 :         if (!Invert_type) return 0;
     892           0 :         Invert_singleton = PyType_GenericNew(Invert_type, NULL, NULL);
     893           0 :         if (!Invert_singleton) return 0;
     894           0 :         Not_type = make_type("Not", unaryop_type, NULL, 0);
     895           0 :         if (!Not_type) return 0;
     896           0 :         Not_singleton = PyType_GenericNew(Not_type, NULL, NULL);
     897           0 :         if (!Not_singleton) return 0;
     898           0 :         UAdd_type = make_type("UAdd", unaryop_type, NULL, 0);
     899           0 :         if (!UAdd_type) return 0;
     900           0 :         UAdd_singleton = PyType_GenericNew(UAdd_type, NULL, NULL);
     901           0 :         if (!UAdd_singleton) return 0;
     902           0 :         USub_type = make_type("USub", unaryop_type, NULL, 0);
     903           0 :         if (!USub_type) return 0;
     904           0 :         USub_singleton = PyType_GenericNew(USub_type, NULL, NULL);
     905           0 :         if (!USub_singleton) return 0;
     906           0 :         cmpop_type = make_type("cmpop", &AST_type, NULL, 0);
     907           0 :         if (!cmpop_type) return 0;
     908           0 :         if (!add_attributes(cmpop_type, NULL, 0)) return 0;
     909           0 :         Eq_type = make_type("Eq", cmpop_type, NULL, 0);
     910           0 :         if (!Eq_type) return 0;
     911           0 :         Eq_singleton = PyType_GenericNew(Eq_type, NULL, NULL);
     912           0 :         if (!Eq_singleton) return 0;
     913           0 :         NotEq_type = make_type("NotEq", cmpop_type, NULL, 0);
     914           0 :         if (!NotEq_type) return 0;
     915           0 :         NotEq_singleton = PyType_GenericNew(NotEq_type, NULL, NULL);
     916           0 :         if (!NotEq_singleton) return 0;
     917           0 :         Lt_type = make_type("Lt", cmpop_type, NULL, 0);
     918           0 :         if (!Lt_type) return 0;
     919           0 :         Lt_singleton = PyType_GenericNew(Lt_type, NULL, NULL);
     920           0 :         if (!Lt_singleton) return 0;
     921           0 :         LtE_type = make_type("LtE", cmpop_type, NULL, 0);
     922           0 :         if (!LtE_type) return 0;
     923           0 :         LtE_singleton = PyType_GenericNew(LtE_type, NULL, NULL);
     924           0 :         if (!LtE_singleton) return 0;
     925           0 :         Gt_type = make_type("Gt", cmpop_type, NULL, 0);
     926           0 :         if (!Gt_type) return 0;
     927           0 :         Gt_singleton = PyType_GenericNew(Gt_type, NULL, NULL);
     928           0 :         if (!Gt_singleton) return 0;
     929           0 :         GtE_type = make_type("GtE", cmpop_type, NULL, 0);
     930           0 :         if (!GtE_type) return 0;
     931           0 :         GtE_singleton = PyType_GenericNew(GtE_type, NULL, NULL);
     932           0 :         if (!GtE_singleton) return 0;
     933           0 :         Is_type = make_type("Is", cmpop_type, NULL, 0);
     934           0 :         if (!Is_type) return 0;
     935           0 :         Is_singleton = PyType_GenericNew(Is_type, NULL, NULL);
     936           0 :         if (!Is_singleton) return 0;
     937           0 :         IsNot_type = make_type("IsNot", cmpop_type, NULL, 0);
     938           0 :         if (!IsNot_type) return 0;
     939           0 :         IsNot_singleton = PyType_GenericNew(IsNot_type, NULL, NULL);
     940           0 :         if (!IsNot_singleton) return 0;
     941           0 :         In_type = make_type("In", cmpop_type, NULL, 0);
     942           0 :         if (!In_type) return 0;
     943           0 :         In_singleton = PyType_GenericNew(In_type, NULL, NULL);
     944           0 :         if (!In_singleton) return 0;
     945           0 :         NotIn_type = make_type("NotIn", cmpop_type, NULL, 0);
     946           0 :         if (!NotIn_type) return 0;
     947           0 :         NotIn_singleton = PyType_GenericNew(NotIn_type, NULL, NULL);
     948           0 :         if (!NotIn_singleton) return 0;
     949           0 :         comprehension_type = make_type("comprehension", &AST_type,
     950             :                                        comprehension_fields, 3);
     951           0 :         if (!comprehension_type) return 0;
     952           0 :         excepthandler_type = make_type("excepthandler", &AST_type, NULL, 0);
     953           0 :         if (!excepthandler_type) return 0;
     954           0 :         if (!add_attributes(excepthandler_type, excepthandler_attributes, 2))
     955           0 :             return 0;
     956           0 :         ExceptHandler_type = make_type("ExceptHandler", excepthandler_type,
     957             :                                        ExceptHandler_fields, 3);
     958           0 :         if (!ExceptHandler_type) return 0;
     959           0 :         arguments_type = make_type("arguments", &AST_type, arguments_fields, 4);
     960           0 :         if (!arguments_type) return 0;
     961           0 :         keyword_type = make_type("keyword", &AST_type, keyword_fields, 2);
     962           0 :         if (!keyword_type) return 0;
     963           0 :         alias_type = make_type("alias", &AST_type, alias_fields, 2);
     964           0 :         if (!alias_type) return 0;
     965           0 :         initialized = 1;
     966           0 :         return 1;
     967             : }
     968             : 
     969             : static int obj2ast_mod(PyObject* obj, mod_ty* out, PyArena* arena);
     970             : static int obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena);
     971             : static int obj2ast_expr(PyObject* obj, expr_ty* out, PyArena* arena);
     972             : static int obj2ast_expr_context(PyObject* obj, expr_context_ty* out, PyArena*
     973             :                                 arena);
     974             : static int obj2ast_slice(PyObject* obj, slice_ty* out, PyArena* arena);
     975             : static int obj2ast_boolop(PyObject* obj, boolop_ty* out, PyArena* arena);
     976             : static int obj2ast_operator(PyObject* obj, operator_ty* out, PyArena* arena);
     977             : static int obj2ast_unaryop(PyObject* obj, unaryop_ty* out, PyArena* arena);
     978             : static int obj2ast_cmpop(PyObject* obj, cmpop_ty* out, PyArena* arena);
     979             : static int obj2ast_comprehension(PyObject* obj, comprehension_ty* out, PyArena*
     980             :                                  arena);
     981             : static int obj2ast_excepthandler(PyObject* obj, excepthandler_ty* out, PyArena*
     982             :                                  arena);
     983             : static int obj2ast_arguments(PyObject* obj, arguments_ty* out, PyArena* arena);
     984             : static int obj2ast_keyword(PyObject* obj, keyword_ty* out, PyArena* arena);
     985             : static int obj2ast_alias(PyObject* obj, alias_ty* out, PyArena* arena);
     986             : 
     987             : mod_ty
     988          63 : Module(asdl_seq * body, PyArena *arena)
     989             : {
     990             :         mod_ty p;
     991          63 :         p = (mod_ty)PyArena_Malloc(arena, sizeof(*p));
     992          63 :         if (!p)
     993           0 :                 return NULL;
     994          63 :         p->kind = Module_kind;
     995          63 :         p->v.Module.body = body;
     996          63 :         return p;
     997             : }
     998             : 
     999             : mod_ty
    1000           0 : Interactive(asdl_seq * body, PyArena *arena)
    1001             : {
    1002             :         mod_ty p;
    1003           0 :         p = (mod_ty)PyArena_Malloc(arena, sizeof(*p));
    1004           0 :         if (!p)
    1005           0 :                 return NULL;
    1006           0 :         p->kind = Interactive_kind;
    1007           0 :         p->v.Interactive.body = body;
    1008           0 :         return p;
    1009             : }
    1010             : 
    1011             : mod_ty
    1012           0 : Expression(expr_ty body, PyArena *arena)
    1013             : {
    1014             :         mod_ty p;
    1015           0 :         if (!body) {
    1016           0 :                 PyErr_SetString(PyExc_ValueError,
    1017             :                                 "field body is required for Expression");
    1018           0 :                 return NULL;
    1019             :         }
    1020           0 :         p = (mod_ty)PyArena_Malloc(arena, sizeof(*p));
    1021           0 :         if (!p)
    1022           0 :                 return NULL;
    1023           0 :         p->kind = Expression_kind;
    1024           0 :         p->v.Expression.body = body;
    1025           0 :         return p;
    1026             : }
    1027             : 
    1028             : mod_ty
    1029           0 : Suite(asdl_seq * body, PyArena *arena)
    1030             : {
    1031             :         mod_ty p;
    1032           0 :         p = (mod_ty)PyArena_Malloc(arena, sizeof(*p));
    1033           0 :         if (!p)
    1034           0 :                 return NULL;
    1035           0 :         p->kind = Suite_kind;
    1036           0 :         p->v.Suite.body = body;
    1037           0 :         return p;
    1038             : }
    1039             : 
    1040             : stmt_ty
    1041         821 : FunctionDef(identifier name, arguments_ty args, asdl_seq * body, asdl_seq *
    1042             :             decorator_list, int lineno, int col_offset, PyArena *arena)
    1043             : {
    1044             :         stmt_ty p;
    1045         821 :         if (!name) {
    1046           0 :                 PyErr_SetString(PyExc_ValueError,
    1047             :                                 "field name is required for FunctionDef");
    1048           0 :                 return NULL;
    1049             :         }
    1050         821 :         if (!args) {
    1051           0 :                 PyErr_SetString(PyExc_ValueError,
    1052             :                                 "field args is required for FunctionDef");
    1053           0 :                 return NULL;
    1054             :         }
    1055         821 :         p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p));
    1056         821 :         if (!p)
    1057           0 :                 return NULL;
    1058         821 :         p->kind = FunctionDef_kind;
    1059         821 :         p->v.FunctionDef.name = name;
    1060         821 :         p->v.FunctionDef.args = args;
    1061         821 :         p->v.FunctionDef.body = body;
    1062         821 :         p->v.FunctionDef.decorator_list = decorator_list;
    1063         821 :         p->lineno = lineno;
    1064         821 :         p->col_offset = col_offset;
    1065         821 :         return p;
    1066             : }
    1067             : 
    1068             : stmt_ty
    1069         144 : ClassDef(identifier name, asdl_seq * bases, asdl_seq * body, asdl_seq *
    1070             :          decorator_list, int lineno, int col_offset, PyArena *arena)
    1071             : {
    1072             :         stmt_ty p;
    1073         144 :         if (!name) {
    1074           0 :                 PyErr_SetString(PyExc_ValueError,
    1075             :                                 "field name is required for ClassDef");
    1076           0 :                 return NULL;
    1077             :         }
    1078         144 :         p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p));
    1079         144 :         if (!p)
    1080           0 :                 return NULL;
    1081         144 :         p->kind = ClassDef_kind;
    1082         144 :         p->v.ClassDef.name = name;
    1083         144 :         p->v.ClassDef.bases = bases;
    1084         144 :         p->v.ClassDef.body = body;
    1085         144 :         p->v.ClassDef.decorator_list = decorator_list;
    1086         144 :         p->lineno = lineno;
    1087         144 :         p->col_offset = col_offset;
    1088         144 :         return p;
    1089             : }
    1090             : 
    1091             : stmt_ty
    1092         999 : Return(expr_ty value, int lineno, int col_offset, PyArena *arena)
    1093             : {
    1094             :         stmt_ty p;
    1095         999 :         p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p));
    1096         999 :         if (!p)
    1097           0 :                 return NULL;
    1098         999 :         p->kind = Return_kind;
    1099         999 :         p->v.Return.value = value;
    1100         999 :         p->lineno = lineno;
    1101         999 :         p->col_offset = col_offset;
    1102         999 :         return p;
    1103             : }
    1104             : 
    1105             : stmt_ty
    1106           2 : Delete(asdl_seq * targets, int lineno, int col_offset, PyArena *arena)
    1107             : {
    1108             :         stmt_ty p;
    1109           2 :         p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p));
    1110           2 :         if (!p)
    1111           0 :                 return NULL;
    1112           2 :         p->kind = Delete_kind;
    1113           2 :         p->v.Delete.targets = targets;
    1114           2 :         p->lineno = lineno;
    1115           2 :         p->col_offset = col_offset;
    1116           2 :         return p;
    1117             : }
    1118             : 
    1119             : stmt_ty
    1120        2207 : Assign(asdl_seq * targets, expr_ty value, int lineno, int col_offset, PyArena
    1121             :        *arena)
    1122             : {
    1123             :         stmt_ty p;
    1124        2207 :         if (!value) {
    1125           0 :                 PyErr_SetString(PyExc_ValueError,
    1126             :                                 "field value is required for Assign");
    1127           0 :                 return NULL;
    1128             :         }
    1129        2207 :         p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p));
    1130        2207 :         if (!p)
    1131           0 :                 return NULL;
    1132        2207 :         p->kind = Assign_kind;
    1133        2207 :         p->v.Assign.targets = targets;
    1134        2207 :         p->v.Assign.value = value;
    1135        2207 :         p->lineno = lineno;
    1136        2207 :         p->col_offset = col_offset;
    1137        2207 :         return p;
    1138             : }
    1139             : 
    1140             : stmt_ty
    1141          48 : AugAssign(expr_ty target, operator_ty op, expr_ty value, int lineno, int
    1142             :           col_offset, PyArena *arena)
    1143             : {
    1144             :         stmt_ty p;
    1145          48 :         if (!target) {
    1146           0 :                 PyErr_SetString(PyExc_ValueError,
    1147             :                                 "field target is required for AugAssign");
    1148           0 :                 return NULL;
    1149             :         }
    1150          48 :         if (!op) {
    1151           0 :                 PyErr_SetString(PyExc_ValueError,
    1152             :                                 "field op is required for AugAssign");
    1153           0 :                 return NULL;
    1154             :         }
    1155          48 :         if (!value) {
    1156           0 :                 PyErr_SetString(PyExc_ValueError,
    1157             :                                 "field value is required for AugAssign");
    1158           0 :                 return NULL;
    1159             :         }
    1160          48 :         p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p));
    1161          48 :         if (!p)
    1162           0 :                 return NULL;
    1163          48 :         p->kind = AugAssign_kind;
    1164          48 :         p->v.AugAssign.target = target;
    1165          48 :         p->v.AugAssign.op = op;
    1166          48 :         p->v.AugAssign.value = value;
    1167          48 :         p->lineno = lineno;
    1168          48 :         p->col_offset = col_offset;
    1169          48 :         return p;
    1170             : }
    1171             : 
    1172             : stmt_ty
    1173           8 : Print(expr_ty dest, asdl_seq * values, bool nl, int lineno, int col_offset,
    1174             :       PyArena *arena)
    1175             : {
    1176             :         stmt_ty p;
    1177           8 :         p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p));
    1178           8 :         if (!p)
    1179           0 :                 return NULL;
    1180           8 :         p->kind = Print_kind;
    1181           8 :         p->v.Print.dest = dest;
    1182           8 :         p->v.Print.values = values;
    1183           8 :         p->v.Print.nl = nl;
    1184           8 :         p->lineno = lineno;
    1185           8 :         p->col_offset = col_offset;
    1186           8 :         return p;
    1187             : }
    1188             : 
    1189             : stmt_ty
    1190         172 : For(expr_ty target, expr_ty iter, asdl_seq * body, asdl_seq * orelse, int
    1191             :     lineno, int col_offset, PyArena *arena)
    1192             : {
    1193             :         stmt_ty p;
    1194         172 :         if (!target) {
    1195           0 :                 PyErr_SetString(PyExc_ValueError,
    1196             :                                 "field target is required for For");
    1197           0 :                 return NULL;
    1198             :         }
    1199         172 :         if (!iter) {
    1200           0 :                 PyErr_SetString(PyExc_ValueError,
    1201             :                                 "field iter is required for For");
    1202           0 :                 return NULL;
    1203             :         }
    1204         172 :         p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p));
    1205         172 :         if (!p)
    1206           0 :                 return NULL;
    1207         172 :         p->kind = For_kind;
    1208         172 :         p->v.For.target = target;
    1209         172 :         p->v.For.iter = iter;
    1210         172 :         p->v.For.body = body;
    1211         172 :         p->v.For.orelse = orelse;
    1212         172 :         p->lineno = lineno;
    1213         172 :         p->col_offset = col_offset;
    1214         172 :         return p;
    1215             : }
    1216             : 
    1217             : stmt_ty
    1218          31 : While(expr_ty test, asdl_seq * body, asdl_seq * orelse, int lineno, int
    1219             :       col_offset, PyArena *arena)
    1220             : {
    1221             :         stmt_ty p;
    1222          31 :         if (!test) {
    1223           0 :                 PyErr_SetString(PyExc_ValueError,
    1224             :                                 "field test is required for While");
    1225           0 :                 return NULL;
    1226             :         }
    1227          31 :         p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p));
    1228          31 :         if (!p)
    1229           0 :                 return NULL;
    1230          31 :         p->kind = While_kind;
    1231          31 :         p->v.While.test = test;
    1232          31 :         p->v.While.body = body;
    1233          31 :         p->v.While.orelse = orelse;
    1234          31 :         p->lineno = lineno;
    1235          31 :         p->col_offset = col_offset;
    1236          31 :         return p;
    1237             : }
    1238             : 
    1239             : stmt_ty
    1240        1293 : If(expr_ty test, asdl_seq * body, asdl_seq * orelse, int lineno, int
    1241             :    col_offset, PyArena *arena)
    1242             : {
    1243             :         stmt_ty p;
    1244        1293 :         if (!test) {
    1245           0 :                 PyErr_SetString(PyExc_ValueError,
    1246             :                                 "field test is required for If");
    1247           0 :                 return NULL;
    1248             :         }
    1249        1293 :         p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p));
    1250        1293 :         if (!p)
    1251           0 :                 return NULL;
    1252        1293 :         p->kind = If_kind;
    1253        1293 :         p->v.If.test = test;
    1254        1293 :         p->v.If.body = body;
    1255        1293 :         p->v.If.orelse = orelse;
    1256        1293 :         p->lineno = lineno;
    1257        1293 :         p->col_offset = col_offset;
    1258        1293 :         return p;
    1259             : }
    1260             : 
    1261             : stmt_ty
    1262           8 : With(expr_ty context_expr, expr_ty optional_vars, asdl_seq * body, int lineno,
    1263             :      int col_offset, PyArena *arena)
    1264             : {
    1265             :         stmt_ty p;
    1266           8 :         if (!context_expr) {
    1267           0 :                 PyErr_SetString(PyExc_ValueError,
    1268             :                                 "field context_expr is required for With");
    1269           0 :                 return NULL;
    1270             :         }
    1271           8 :         p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p));
    1272           8 :         if (!p)
    1273           0 :                 return NULL;
    1274           8 :         p->kind = With_kind;
    1275           8 :         p->v.With.context_expr = context_expr;
    1276           8 :         p->v.With.optional_vars = optional_vars;
    1277           8 :         p->v.With.body = body;
    1278           8 :         p->lineno = lineno;
    1279           8 :         p->col_offset = col_offset;
    1280           8 :         return p;
    1281             : }
    1282             : 
    1283             : stmt_ty
    1284         245 : Raise(expr_ty type, expr_ty inst, expr_ty tback, int lineno, int col_offset,
    1285             :       PyArena *arena)
    1286             : {
    1287             :         stmt_ty p;
    1288         245 :         p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p));
    1289         245 :         if (!p)
    1290           0 :                 return NULL;
    1291         245 :         p->kind = Raise_kind;
    1292         245 :         p->v.Raise.type = type;
    1293         245 :         p->v.Raise.inst = inst;
    1294         245 :         p->v.Raise.tback = tback;
    1295         245 :         p->lineno = lineno;
    1296         245 :         p->col_offset = col_offset;
    1297         245 :         return p;
    1298             : }
    1299             : 
    1300             : stmt_ty
    1301          60 : TryExcept(asdl_seq * body, asdl_seq * handlers, asdl_seq * orelse, int lineno,
    1302             :           int col_offset, PyArena *arena)
    1303             : {
    1304             :         stmt_ty p;
    1305          60 :         p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p));
    1306          60 :         if (!p)
    1307           0 :                 return NULL;
    1308          60 :         p->kind = TryExcept_kind;
    1309          60 :         p->v.TryExcept.body = body;
    1310          60 :         p->v.TryExcept.handlers = handlers;
    1311          60 :         p->v.TryExcept.orelse = orelse;
    1312          60 :         p->lineno = lineno;
    1313          60 :         p->col_offset = col_offset;
    1314          60 :         return p;
    1315             : }
    1316             : 
    1317             : stmt_ty
    1318           0 : TryFinally(asdl_seq * body, asdl_seq * finalbody, int lineno, int col_offset,
    1319             :            PyArena *arena)
    1320             : {
    1321             :         stmt_ty p;
    1322           0 :         p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p));
    1323           0 :         if (!p)
    1324           0 :                 return NULL;
    1325           0 :         p->kind = TryFinally_kind;
    1326           0 :         p->v.TryFinally.body = body;
    1327           0 :         p->v.TryFinally.finalbody = finalbody;
    1328           0 :         p->lineno = lineno;
    1329           0 :         p->col_offset = col_offset;
    1330           0 :         return p;
    1331             : }
    1332             : 
    1333             : stmt_ty
    1334          73 : Assert(expr_ty test, expr_ty msg, int lineno, int col_offset, PyArena *arena)
    1335             : {
    1336             :         stmt_ty p;
    1337          73 :         if (!test) {
    1338           0 :                 PyErr_SetString(PyExc_ValueError,
    1339             :                                 "field test is required for Assert");
    1340           0 :                 return NULL;
    1341             :         }
    1342          73 :         p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p));
    1343          73 :         if (!p)
    1344           0 :                 return NULL;
    1345          73 :         p->kind = Assert_kind;
    1346          73 :         p->v.Assert.test = test;
    1347          73 :         p->v.Assert.msg = msg;
    1348          73 :         p->lineno = lineno;
    1349          73 :         p->col_offset = col_offset;
    1350          73 :         return p;
    1351             : }
    1352             : 
    1353             : stmt_ty
    1354          69 : Import(asdl_seq * names, int lineno, int col_offset, PyArena *arena)
    1355             : {
    1356             :         stmt_ty p;
    1357          69 :         p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p));
    1358          69 :         if (!p)
    1359           0 :                 return NULL;
    1360          69 :         p->kind = Import_kind;
    1361          69 :         p->v.Import.names = names;
    1362          69 :         p->lineno = lineno;
    1363          69 :         p->col_offset = col_offset;
    1364          69 :         return p;
    1365             : }
    1366             : 
    1367             : stmt_ty
    1368         176 : ImportFrom(identifier module, asdl_seq * names, int level, int lineno, int
    1369             :            col_offset, PyArena *arena)
    1370             : {
    1371             :         stmt_ty p;
    1372         176 :         p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p));
    1373         176 :         if (!p)
    1374           0 :                 return NULL;
    1375         176 :         p->kind = ImportFrom_kind;
    1376         176 :         p->v.ImportFrom.module = module;
    1377         176 :         p->v.ImportFrom.names = names;
    1378         176 :         p->v.ImportFrom.level = level;
    1379         176 :         p->lineno = lineno;
    1380         176 :         p->col_offset = col_offset;
    1381         176 :         return p;
    1382             : }
    1383             : 
    1384             : stmt_ty
    1385           0 : Exec(expr_ty body, expr_ty globals, expr_ty locals, int lineno, int col_offset,
    1386             :      PyArena *arena)
    1387             : {
    1388             :         stmt_ty p;
    1389           0 :         if (!body) {
    1390           0 :                 PyErr_SetString(PyExc_ValueError,
    1391             :                                 "field body is required for Exec");
    1392           0 :                 return NULL;
    1393             :         }
    1394           0 :         p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p));
    1395           0 :         if (!p)
    1396           0 :                 return NULL;
    1397           0 :         p->kind = Exec_kind;
    1398           0 :         p->v.Exec.body = body;
    1399           0 :         p->v.Exec.globals = globals;
    1400           0 :         p->v.Exec.locals = locals;
    1401           0 :         p->lineno = lineno;
    1402           0 :         p->col_offset = col_offset;
    1403           0 :         return p;
    1404             : }
    1405             : 
    1406             : stmt_ty
    1407           0 : Global(asdl_seq * names, int lineno, int col_offset, PyArena *arena)
    1408             : {
    1409             :         stmt_ty p;
    1410           0 :         p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p));
    1411           0 :         if (!p)
    1412           0 :                 return NULL;
    1413           0 :         p->kind = Global_kind;
    1414           0 :         p->v.Global.names = names;
    1415           0 :         p->lineno = lineno;
    1416           0 :         p->col_offset = col_offset;
    1417           0 :         return p;
    1418             : }
    1419             : 
    1420             : stmt_ty
    1421        1743 : Expr(expr_ty value, int lineno, int col_offset, PyArena *arena)
    1422             : {
    1423             :         stmt_ty p;
    1424        1743 :         if (!value) {
    1425           0 :                 PyErr_SetString(PyExc_ValueError,
    1426             :                                 "field value is required for Expr");
    1427           0 :                 return NULL;
    1428             :         }
    1429        1743 :         p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p));
    1430        1743 :         if (!p)
    1431           0 :                 return NULL;
    1432        1743 :         p->kind = Expr_kind;
    1433        1743 :         p->v.Expr.value = value;
    1434        1743 :         p->lineno = lineno;
    1435        1743 :         p->col_offset = col_offset;
    1436        1743 :         return p;
    1437             : }
    1438             : 
    1439             : stmt_ty
    1440          88 : Pass(int lineno, int col_offset, PyArena *arena)
    1441             : {
    1442             :         stmt_ty p;
    1443          88 :         p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p));
    1444          88 :         if (!p)
    1445           0 :                 return NULL;
    1446          88 :         p->kind = Pass_kind;
    1447          88 :         p->lineno = lineno;
    1448          88 :         p->col_offset = col_offset;
    1449          88 :         return p;
    1450             : }
    1451             : 
    1452             : stmt_ty
    1453          35 : Break(int lineno, int col_offset, PyArena *arena)
    1454             : {
    1455             :         stmt_ty p;
    1456          35 :         p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p));
    1457          35 :         if (!p)
    1458           0 :                 return NULL;
    1459          35 :         p->kind = Break_kind;
    1460          35 :         p->lineno = lineno;
    1461          35 :         p->col_offset = col_offset;
    1462          35 :         return p;
    1463             : }
    1464             : 
    1465             : stmt_ty
    1466           9 : Continue(int lineno, int col_offset, PyArena *arena)
    1467             : {
    1468             :         stmt_ty p;
    1469           9 :         p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p));
    1470           9 :         if (!p)
    1471           0 :                 return NULL;
    1472           9 :         p->kind = Continue_kind;
    1473           9 :         p->lineno = lineno;
    1474           9 :         p->col_offset = col_offset;
    1475           9 :         return p;
    1476             : }
    1477             : 
    1478             : expr_ty
    1479          56 : BoolOp(boolop_ty op, asdl_seq * values, int lineno, int col_offset, PyArena
    1480             :        *arena)
    1481             : {
    1482             :         expr_ty p;
    1483          56 :         if (!op) {
    1484           0 :                 PyErr_SetString(PyExc_ValueError,
    1485             :                                 "field op is required for BoolOp");
    1486           0 :                 return NULL;
    1487             :         }
    1488          56 :         p = (expr_ty)PyArena_Malloc(arena, sizeof(*p));
    1489          56 :         if (!p)
    1490           0 :                 return NULL;
    1491          56 :         p->kind = BoolOp_kind;
    1492          56 :         p->v.BoolOp.op = op;
    1493          56 :         p->v.BoolOp.values = values;
    1494          56 :         p->lineno = lineno;
    1495          56 :         p->col_offset = col_offset;
    1496          56 :         return p;
    1497             : }
    1498             : 
    1499             : expr_ty
    1500         372 : BinOp(expr_ty left, operator_ty op, expr_ty right, int lineno, int col_offset,
    1501             :       PyArena *arena)
    1502             : {
    1503             :         expr_ty p;
    1504         372 :         if (!left) {
    1505           0 :                 PyErr_SetString(PyExc_ValueError,
    1506             :                                 "field left is required for BinOp");
    1507           0 :                 return NULL;
    1508             :         }
    1509         372 :         if (!op) {
    1510           0 :                 PyErr_SetString(PyExc_ValueError,
    1511             :                                 "field op is required for BinOp");
    1512           0 :                 return NULL;
    1513             :         }
    1514         372 :         if (!right) {
    1515           0 :                 PyErr_SetString(PyExc_ValueError,
    1516             :                                 "field right is required for BinOp");
    1517           0 :                 return NULL;
    1518             :         }
    1519         372 :         p = (expr_ty)PyArena_Malloc(arena, sizeof(*p));
    1520         372 :         if (!p)
    1521           0 :                 return NULL;
    1522         372 :         p->kind = BinOp_kind;
    1523         372 :         p->v.BinOp.left = left;
    1524         372 :         p->v.BinOp.op = op;
    1525         372 :         p->v.BinOp.right = right;
    1526         372 :         p->lineno = lineno;
    1527         372 :         p->col_offset = col_offset;
    1528         372 :         return p;
    1529             : }
    1530             : 
    1531             : expr_ty
    1532         254 : UnaryOp(unaryop_ty op, expr_ty operand, int lineno, int col_offset, PyArena
    1533             :         *arena)
    1534             : {
    1535             :         expr_ty p;
    1536         254 :         if (!op) {
    1537           0 :                 PyErr_SetString(PyExc_ValueError,
    1538             :                                 "field op is required for UnaryOp");
    1539           0 :                 return NULL;
    1540             :         }
    1541         254 :         if (!operand) {
    1542           0 :                 PyErr_SetString(PyExc_ValueError,
    1543             :                                 "field operand is required for UnaryOp");
    1544           0 :                 return NULL;
    1545             :         }
    1546         254 :         p = (expr_ty)PyArena_Malloc(arena, sizeof(*p));
    1547         254 :         if (!p)
    1548           0 :                 return NULL;
    1549         254 :         p->kind = UnaryOp_kind;
    1550         254 :         p->v.UnaryOp.op = op;
    1551         254 :         p->v.UnaryOp.operand = operand;
    1552         254 :         p->lineno = lineno;
    1553         254 :         p->col_offset = col_offset;
    1554         254 :         return p;
    1555             : }
    1556             : 
    1557             : expr_ty
    1558           4 : Lambda(arguments_ty args, expr_ty body, int lineno, int col_offset, PyArena
    1559             :        *arena)
    1560             : {
    1561             :         expr_ty p;
    1562           4 :         if (!args) {
    1563           0 :                 PyErr_SetString(PyExc_ValueError,
    1564             :                                 "field args is required for Lambda");
    1565           0 :                 return NULL;
    1566             :         }
    1567           4 :         if (!body) {
    1568           0 :                 PyErr_SetString(PyExc_ValueError,
    1569             :                                 "field body is required for Lambda");
    1570           0 :                 return NULL;
    1571             :         }
    1572           4 :         p = (expr_ty)PyArena_Malloc(arena, sizeof(*p));
    1573           4 :         if (!p)
    1574           0 :                 return NULL;
    1575           4 :         p->kind = Lambda_kind;
    1576           4 :         p->v.Lambda.args = args;
    1577           4 :         p->v.Lambda.body = body;
    1578           4 :         p->lineno = lineno;
    1579           4 :         p->col_offset = col_offset;
    1580           4 :         return p;
    1581             : }
    1582             : 
    1583             : expr_ty
    1584          14 : IfExp(expr_ty test, expr_ty body, expr_ty orelse, int lineno, int col_offset,
    1585             :       PyArena *arena)
    1586             : {
    1587             :         expr_ty p;
    1588          14 :         if (!test) {
    1589           0 :                 PyErr_SetString(PyExc_ValueError,
    1590             :                                 "field test is required for IfExp");
    1591           0 :                 return NULL;
    1592             :         }
    1593          14 :         if (!body) {
    1594           0 :                 PyErr_SetString(PyExc_ValueError,
    1595             :                                 "field body is required for IfExp");
    1596           0 :                 return NULL;
    1597             :         }
    1598          14 :         if (!orelse) {
    1599           0 :                 PyErr_SetString(PyExc_ValueError,
    1600             :                                 "field orelse is required for IfExp");
    1601           0 :                 return NULL;
    1602             :         }
    1603          14 :         p = (expr_ty)PyArena_Malloc(arena, sizeof(*p));
    1604          14 :         if (!p)
    1605           0 :                 return NULL;
    1606          14 :         p->kind = IfExp_kind;
    1607          14 :         p->v.IfExp.test = test;
    1608          14 :         p->v.IfExp.body = body;
    1609          14 :         p->v.IfExp.orelse = orelse;
    1610          14 :         p->lineno = lineno;
    1611          14 :         p->col_offset = col_offset;
    1612          14 :         return p;
    1613             : }
    1614             : 
    1615             : expr_ty
    1616          44 : Dict(asdl_seq * keys, asdl_seq * values, int lineno, int col_offset, PyArena
    1617             :      *arena)
    1618             : {
    1619             :         expr_ty p;
    1620          44 :         p = (expr_ty)PyArena_Malloc(arena, sizeof(*p));
    1621          44 :         if (!p)
    1622           0 :                 return NULL;
    1623          44 :         p->kind = Dict_kind;
    1624          44 :         p->v.Dict.keys = keys;
    1625          44 :         p->v.Dict.values = values;
    1626          44 :         p->lineno = lineno;
    1627          44 :         p->col_offset = col_offset;
    1628          44 :         return p;
    1629             : }
    1630             : 
    1631             : expr_ty
    1632           1 : Set(asdl_seq * elts, int lineno, int col_offset, PyArena *arena)
    1633             : {
    1634             :         expr_ty p;
    1635           1 :         p = (expr_ty)PyArena_Malloc(arena, sizeof(*p));
    1636           1 :         if (!p)
    1637           0 :                 return NULL;
    1638           1 :         p->kind = Set_kind;
    1639           1 :         p->v.Set.elts = elts;
    1640           1 :         p->lineno = lineno;
    1641           1 :         p->col_offset = col_offset;
    1642           1 :         return p;
    1643             : }
    1644             : 
    1645             : expr_ty
    1646          11 : ListComp(expr_ty elt, asdl_seq * generators, int lineno, int col_offset,
    1647             :          PyArena *arena)
    1648             : {
    1649             :         expr_ty p;
    1650          11 :         if (!elt) {
    1651           0 :                 PyErr_SetString(PyExc_ValueError,
    1652             :                                 "field elt is required for ListComp");
    1653           0 :                 return NULL;
    1654             :         }
    1655          11 :         p = (expr_ty)PyArena_Malloc(arena, sizeof(*p));
    1656          11 :         if (!p)
    1657           0 :                 return NULL;
    1658          11 :         p->kind = ListComp_kind;
    1659          11 :         p->v.ListComp.elt = elt;
    1660          11 :         p->v.ListComp.generators = generators;
    1661          11 :         p->lineno = lineno;
    1662          11 :         p->col_offset = col_offset;
    1663          11 :         return p;
    1664             : }
    1665             : 
    1666             : expr_ty
    1667           0 : SetComp(expr_ty elt, asdl_seq * generators, int lineno, int col_offset, PyArena
    1668             :         *arena)
    1669             : {
    1670             :         expr_ty p;
    1671           0 :         if (!elt) {
    1672           0 :                 PyErr_SetString(PyExc_ValueError,
    1673             :                                 "field elt is required for SetComp");
    1674           0 :                 return NULL;
    1675             :         }
    1676           0 :         p = (expr_ty)PyArena_Malloc(arena, sizeof(*p));
    1677           0 :         if (!p)
    1678           0 :                 return NULL;
    1679           0 :         p->kind = SetComp_kind;
    1680           0 :         p->v.SetComp.elt = elt;
    1681           0 :         p->v.SetComp.generators = generators;
    1682           0 :         p->lineno = lineno;
    1683           0 :         p->col_offset = col_offset;
    1684           0 :         return p;
    1685             : }
    1686             : 
    1687             : expr_ty
    1688           2 : DictComp(expr_ty key, expr_ty value, asdl_seq * generators, int lineno, int
    1689             :          col_offset, PyArena *arena)
    1690             : {
    1691             :         expr_ty p;
    1692           2 :         if (!key) {
    1693           0 :                 PyErr_SetString(PyExc_ValueError,
    1694             :                                 "field key is required for DictComp");
    1695           0 :                 return NULL;
    1696             :         }
    1697           2 :         if (!value) {
    1698           0 :                 PyErr_SetString(PyExc_ValueError,
    1699             :                                 "field value is required for DictComp");
    1700           0 :                 return NULL;
    1701             :         }
    1702           2 :         p = (expr_ty)PyArena_Malloc(arena, sizeof(*p));
    1703           2 :         if (!p)
    1704           0 :                 return NULL;
    1705           2 :         p->kind = DictComp_kind;
    1706           2 :         p->v.DictComp.key = key;
    1707           2 :         p->v.DictComp.value = value;
    1708           2 :         p->v.DictComp.generators = generators;
    1709           2 :         p->lineno = lineno;
    1710           2 :         p->col_offset = col_offset;
    1711           2 :         return p;
    1712             : }
    1713             : 
    1714             : expr_ty
    1715           9 : GeneratorExp(expr_ty elt, asdl_seq * generators, int lineno, int col_offset,
    1716             :              PyArena *arena)
    1717             : {
    1718             :         expr_ty p;
    1719           9 :         if (!elt) {
    1720           0 :                 PyErr_SetString(PyExc_ValueError,
    1721             :                                 "field elt is required for GeneratorExp");
    1722           0 :                 return NULL;
    1723             :         }
    1724           9 :         p = (expr_ty)PyArena_Malloc(arena, sizeof(*p));
    1725           9 :         if (!p)
    1726           0 :                 return NULL;
    1727           9 :         p->kind = GeneratorExp_kind;
    1728           9 :         p->v.GeneratorExp.elt = elt;
    1729           9 :         p->v.GeneratorExp.generators = generators;
    1730           9 :         p->lineno = lineno;
    1731           9 :         p->col_offset = col_offset;
    1732           9 :         return p;
    1733             : }
    1734             : 
    1735             : expr_ty
    1736          12 : Yield(expr_ty value, int lineno, int col_offset, PyArena *arena)
    1737             : {
    1738             :         expr_ty p;
    1739          12 :         p = (expr_ty)PyArena_Malloc(arena, sizeof(*p));
    1740          12 :         if (!p)
    1741           0 :                 return NULL;
    1742          12 :         p->kind = Yield_kind;
    1743          12 :         p->v.Yield.value = value;
    1744          12 :         p->lineno = lineno;
    1745          12 :         p->col_offset = col_offset;
    1746          12 :         return p;
    1747             : }
    1748             : 
    1749             : expr_ty
    1750         911 : Compare(expr_ty left, asdl_int_seq * ops, asdl_seq * comparators, int lineno,
    1751             :         int col_offset, PyArena *arena)
    1752             : {
    1753             :         expr_ty p;
    1754         911 :         if (!left) {
    1755           0 :                 PyErr_SetString(PyExc_ValueError,
    1756             :                                 "field left is required for Compare");
    1757           0 :                 return NULL;
    1758             :         }
    1759         911 :         p = (expr_ty)PyArena_Malloc(arena, sizeof(*p));
    1760         911 :         if (!p)
    1761           0 :                 return NULL;
    1762         911 :         p->kind = Compare_kind;
    1763         911 :         p->v.Compare.left = left;
    1764         911 :         p->v.Compare.ops = ops;
    1765         911 :         p->v.Compare.comparators = comparators;
    1766         911 :         p->lineno = lineno;
    1767         911 :         p->col_offset = col_offset;
    1768         911 :         return p;
    1769             : }
    1770             : 
    1771             : expr_ty
    1772        3664 : Call(expr_ty func, asdl_seq * args, asdl_seq * keywords, expr_ty starargs,
    1773             :      expr_ty kwargs, int lineno, int col_offset, PyArena *arena)
    1774             : {
    1775             :         expr_ty p;
    1776        3664 :         if (!func) {
    1777           0 :                 PyErr_SetString(PyExc_ValueError,
    1778             :                                 "field func is required for Call");
    1779           0 :                 return NULL;
    1780             :         }
    1781        3664 :         p = (expr_ty)PyArena_Malloc(arena, sizeof(*p));
    1782        3664 :         if (!p)
    1783           0 :                 return NULL;
    1784        3664 :         p->kind = Call_kind;
    1785        3664 :         p->v.Call.func = func;
    1786        3664 :         p->v.Call.args = args;
    1787        3664 :         p->v.Call.keywords = keywords;
    1788        3664 :         p->v.Call.starargs = starargs;
    1789        3664 :         p->v.Call.kwargs = kwargs;
    1790        3664 :         p->lineno = lineno;
    1791        3664 :         p->col_offset = col_offset;
    1792        3664 :         return p;
    1793             : }
    1794             : 
    1795             : expr_ty
    1796           0 : Repr(expr_ty value, int lineno, int col_offset, PyArena *arena)
    1797             : {
    1798             :         expr_ty p;
    1799           0 :         if (!value) {
    1800           0 :                 PyErr_SetString(PyExc_ValueError,
    1801             :                                 "field value is required for Repr");
    1802           0 :                 return NULL;
    1803             :         }
    1804           0 :         p = (expr_ty)PyArena_Malloc(arena, sizeof(*p));
    1805           0 :         if (!p)
    1806           0 :                 return NULL;
    1807           0 :         p->kind = Repr_kind;
    1808           0 :         p->v.Repr.value = value;
    1809           0 :         p->lineno = lineno;
    1810           0 :         p->col_offset = col_offset;
    1811           0 :         return p;
    1812             : }
    1813             : 
    1814             : expr_ty
    1815         759 : Num(object n, int lineno, int col_offset, PyArena *arena)
    1816             : {
    1817             :         expr_ty p;
    1818         759 :         if (!n) {
    1819           0 :                 PyErr_SetString(PyExc_ValueError,
    1820             :                                 "field n is required for Num");
    1821           0 :                 return NULL;
    1822             :         }
    1823         759 :         p = (expr_ty)PyArena_Malloc(arena, sizeof(*p));
    1824         759 :         if (!p)
    1825           0 :                 return NULL;
    1826         759 :         p->kind = Num_kind;
    1827         759 :         p->v.Num.n = n;
    1828         759 :         p->lineno = lineno;
    1829         759 :         p->col_offset = col_offset;
    1830         759 :         return p;
    1831             : }
    1832             : 
    1833             : expr_ty
    1834        2353 : Str(string s, int lineno, int col_offset, PyArena *arena)
    1835             : {
    1836             :         expr_ty p;
    1837        2353 :         if (!s) {
    1838           0 :                 PyErr_SetString(PyExc_ValueError,
    1839             :                                 "field s is required for Str");
    1840           0 :                 return NULL;
    1841             :         }
    1842        2353 :         p = (expr_ty)PyArena_Malloc(arena, sizeof(*p));
    1843        2353 :         if (!p)
    1844           0 :                 return NULL;
    1845        2353 :         p->kind = Str_kind;
    1846        2353 :         p->v.Str.s = s;
    1847        2353 :         p->lineno = lineno;
    1848        2353 :         p->col_offset = col_offset;
    1849        2353 :         return p;
    1850             : }
    1851             : 
    1852             : expr_ty
    1853        6204 : Attribute(expr_ty value, identifier attr, expr_context_ty ctx, int lineno, int
    1854             :           col_offset, PyArena *arena)
    1855             : {
    1856             :         expr_ty p;
    1857        6204 :         if (!value) {
    1858           0 :                 PyErr_SetString(PyExc_ValueError,
    1859             :                                 "field value is required for Attribute");
    1860           0 :                 return NULL;
    1861             :         }
    1862        6204 :         if (!attr) {
    1863           0 :                 PyErr_SetString(PyExc_ValueError,
    1864             :                                 "field attr is required for Attribute");
    1865           0 :                 return NULL;
    1866             :         }
    1867        6204 :         if (!ctx) {
    1868           0 :                 PyErr_SetString(PyExc_ValueError,
    1869             :                                 "field ctx is required for Attribute");
    1870           0 :                 return NULL;
    1871             :         }
    1872        6204 :         p = (expr_ty)PyArena_Malloc(arena, sizeof(*p));
    1873        6204 :         if (!p)
    1874           0 :                 return NULL;
    1875        6204 :         p->kind = Attribute_kind;
    1876        6204 :         p->v.Attribute.value = value;
    1877        6204 :         p->v.Attribute.attr = attr;
    1878        6204 :         p->v.Attribute.ctx = ctx;
    1879        6204 :         p->lineno = lineno;
    1880        6204 :         p->col_offset = col_offset;
    1881        6204 :         return p;
    1882             : }
    1883             : 
    1884             : expr_ty
    1885         285 : Subscript(expr_ty value, slice_ty slice, expr_context_ty ctx, int lineno, int
    1886             :           col_offset, PyArena *arena)
    1887             : {
    1888             :         expr_ty p;
    1889         285 :         if (!value) {
    1890           0 :                 PyErr_SetString(PyExc_ValueError,
    1891             :                                 "field value is required for Subscript");
    1892           0 :                 return NULL;
    1893             :         }
    1894         285 :         if (!slice) {
    1895           0 :                 PyErr_SetString(PyExc_ValueError,
    1896             :                                 "field slice is required for Subscript");
    1897           0 :                 return NULL;
    1898             :         }
    1899         285 :         if (!ctx) {
    1900           0 :                 PyErr_SetString(PyExc_ValueError,
    1901             :                                 "field ctx is required for Subscript");
    1902           0 :                 return NULL;
    1903             :         }
    1904         285 :         p = (expr_ty)PyArena_Malloc(arena, sizeof(*p));
    1905         285 :         if (!p)
    1906           0 :                 return NULL;
    1907         285 :         p->kind = Subscript_kind;
    1908         285 :         p->v.Subscript.value = value;
    1909         285 :         p->v.Subscript.slice = slice;
    1910         285 :         p->v.Subscript.ctx = ctx;
    1911         285 :         p->lineno = lineno;
    1912         285 :         p->col_offset = col_offset;
    1913         285 :         return p;
    1914             : }
    1915             : 
    1916             : expr_ty
    1917       15882 : Name(identifier id, expr_context_ty ctx, int lineno, int col_offset, PyArena
    1918             :      *arena)
    1919             : {
    1920             :         expr_ty p;
    1921       15882 :         if (!id) {
    1922           0 :                 PyErr_SetString(PyExc_ValueError,
    1923             :                                 "field id is required for Name");
    1924           0 :                 return NULL;
    1925             :         }
    1926       15882 :         if (!ctx) {
    1927           0 :                 PyErr_SetString(PyExc_ValueError,
    1928             :                                 "field ctx is required for Name");
    1929           0 :                 return NULL;
    1930             :         }
    1931       15882 :         p = (expr_ty)PyArena_Malloc(arena, sizeof(*p));
    1932       15882 :         if (!p)
    1933           0 :                 return NULL;
    1934       15882 :         p->kind = Name_kind;
    1935       15882 :         p->v.Name.id = id;
    1936       15882 :         p->v.Name.ctx = ctx;
    1937       15882 :         p->lineno = lineno;
    1938       15882 :         p->col_offset = col_offset;
    1939       15882 :         return p;
    1940             : }
    1941             : 
    1942             : expr_ty
    1943         221 : List(asdl_seq * elts, expr_context_ty ctx, int lineno, int col_offset, PyArena
    1944             :      *arena)
    1945             : {
    1946             :         expr_ty p;
    1947         221 :         if (!ctx) {
    1948           0 :                 PyErr_SetString(PyExc_ValueError,
    1949             :                                 "field ctx is required for List");
    1950           0 :                 return NULL;
    1951             :         }
    1952         221 :         p = (expr_ty)PyArena_Malloc(arena, sizeof(*p));
    1953         221 :         if (!p)
    1954           0 :                 return NULL;
    1955         221 :         p->kind = List_kind;
    1956         221 :         p->v.List.elts = elts;
    1957         221 :         p->v.List.ctx = ctx;
    1958         221 :         p->lineno = lineno;
    1959         221 :         p->col_offset = col_offset;
    1960         221 :         return p;
    1961             : }
    1962             : 
    1963             : expr_ty
    1964         530 : Tuple(asdl_seq * elts, expr_context_ty ctx, int lineno, int col_offset, PyArena
    1965             :       *arena)
    1966             : {
    1967             :         expr_ty p;
    1968         530 :         if (!ctx) {
    1969           0 :                 PyErr_SetString(PyExc_ValueError,
    1970             :                                 "field ctx is required for Tuple");
    1971           0 :                 return NULL;
    1972             :         }
    1973         530 :         p = (expr_ty)PyArena_Malloc(arena, sizeof(*p));
    1974         530 :         if (!p)
    1975           0 :                 return NULL;
    1976         530 :         p->kind = Tuple_kind;
    1977         530 :         p->v.Tuple.elts = elts;
    1978         530 :         p->v.Tuple.ctx = ctx;
    1979         530 :         p->lineno = lineno;
    1980         530 :         p->col_offset = col_offset;
    1981         530 :         return p;
    1982             : }
    1983             : 
    1984             : slice_ty
    1985           0 : Ellipsis(PyArena *arena)
    1986             : {
    1987             :         slice_ty p;
    1988           0 :         p = (slice_ty)PyArena_Malloc(arena, sizeof(*p));
    1989           0 :         if (!p)
    1990           0 :                 return NULL;
    1991           0 :         p->kind = Ellipsis_kind;
    1992           0 :         return p;
    1993             : }
    1994             : 
    1995             : slice_ty
    1996          42 : Slice(expr_ty lower, expr_ty upper, expr_ty step, PyArena *arena)
    1997             : {
    1998             :         slice_ty p;
    1999          42 :         p = (slice_ty)PyArena_Malloc(arena, sizeof(*p));
    2000          42 :         if (!p)
    2001           0 :                 return NULL;
    2002          42 :         p->kind = Slice_kind;
    2003          42 :         p->v.Slice.lower = lower;
    2004          42 :         p->v.Slice.upper = upper;
    2005          42 :         p->v.Slice.step = step;
    2006          42 :         return p;
    2007             : }
    2008             : 
    2009             : slice_ty
    2010           0 : ExtSlice(asdl_seq * dims, PyArena *arena)
    2011             : {
    2012             :         slice_ty p;
    2013           0 :         p = (slice_ty)PyArena_Malloc(arena, sizeof(*p));
    2014           0 :         if (!p)
    2015           0 :                 return NULL;
    2016           0 :         p->kind = ExtSlice_kind;
    2017           0 :         p->v.ExtSlice.dims = dims;
    2018           0 :         return p;
    2019             : }
    2020             : 
    2021             : slice_ty
    2022         242 : Index(expr_ty value, PyArena *arena)
    2023             : {
    2024             :         slice_ty p;
    2025         242 :         if (!value) {
    2026           0 :                 PyErr_SetString(PyExc_ValueError,
    2027             :                                 "field value is required for Index");
    2028           0 :                 return NULL;
    2029             :         }
    2030         242 :         p = (slice_ty)PyArena_Malloc(arena, sizeof(*p));
    2031         242 :         if (!p)
    2032           0 :                 return NULL;
    2033         242 :         p->kind = Index_kind;
    2034         242 :         p->v.Index.value = value;
    2035         242 :         return p;
    2036             : }
    2037             : 
    2038             : comprehension_ty
    2039          22 : comprehension(expr_ty target, expr_ty iter, asdl_seq * ifs, PyArena *arena)
    2040             : {
    2041             :         comprehension_ty p;
    2042          22 :         if (!target) {
    2043           0 :                 PyErr_SetString(PyExc_ValueError,
    2044             :                                 "field target is required for comprehension");
    2045           0 :                 return NULL;
    2046             :         }
    2047          22 :         if (!iter) {
    2048           0 :                 PyErr_SetString(PyExc_ValueError,
    2049             :                                 "field iter is required for comprehension");
    2050           0 :                 return NULL;
    2051             :         }
    2052          22 :         p = (comprehension_ty)PyArena_Malloc(arena, sizeof(*p));
    2053          22 :         if (!p)
    2054           0 :                 return NULL;
    2055          22 :         p->target = target;
    2056          22 :         p->iter = iter;
    2057          22 :         p->ifs = ifs;
    2058          22 :         return p;
    2059             : }
    2060             : 
    2061             : excepthandler_ty
    2062          68 : ExceptHandler(expr_ty type, expr_ty name, asdl_seq * body, int lineno, int
    2063             :               col_offset, PyArena *arena)
    2064             : {
    2065             :         excepthandler_ty p;
    2066          68 :         p = (excepthandler_ty)PyArena_Malloc(arena, sizeof(*p));
    2067          68 :         if (!p)
    2068           0 :                 return NULL;
    2069          68 :         p->kind = ExceptHandler_kind;
    2070          68 :         p->v.ExceptHandler.type = type;
    2071          68 :         p->v.ExceptHandler.name = name;
    2072          68 :         p->v.ExceptHandler.body = body;
    2073          68 :         p->lineno = lineno;
    2074          68 :         p->col_offset = col_offset;
    2075          68 :         return p;
    2076             : }
    2077             : 
    2078             : arguments_ty
    2079         825 : arguments(asdl_seq * args, identifier vararg, identifier kwarg, asdl_seq *
    2080             :           defaults, PyArena *arena)
    2081             : {
    2082             :         arguments_ty p;
    2083         825 :         p = (arguments_ty)PyArena_Malloc(arena, sizeof(*p));
    2084         825 :         if (!p)
    2085           0 :                 return NULL;
    2086         825 :         p->args = args;
    2087         825 :         p->vararg = vararg;
    2088         825 :         p->kwarg = kwarg;
    2089         825 :         p->defaults = defaults;
    2090         825 :         return p;
    2091             : }
    2092             : 
    2093             : keyword_ty
    2094         356 : keyword(identifier arg, expr_ty value, PyArena *arena)
    2095             : {
    2096             :         keyword_ty p;
    2097         356 :         if (!arg) {
    2098           0 :                 PyErr_SetString(PyExc_ValueError,
    2099             :                                 "field arg is required for keyword");
    2100           0 :                 return NULL;
    2101             :         }
    2102         356 :         if (!value) {
    2103           0 :                 PyErr_SetString(PyExc_ValueError,
    2104             :                                 "field value is required for keyword");
    2105           0 :                 return NULL;
    2106             :         }
    2107         356 :         p = (keyword_ty)PyArena_Malloc(arena, sizeof(*p));
    2108         356 :         if (!p)
    2109           0 :                 return NULL;
    2110         356 :         p->arg = arg;
    2111         356 :         p->value = value;
    2112         356 :         return p;
    2113             : }
    2114             : 
    2115             : alias_ty
    2116         455 : alias(identifier name, identifier asname, PyArena *arena)
    2117             : {
    2118             :         alias_ty p;
    2119         455 :         if (!name) {
    2120           0 :                 PyErr_SetString(PyExc_ValueError,
    2121             :                                 "field name is required for alias");
    2122           0 :                 return NULL;
    2123             :         }
    2124         455 :         p = (alias_ty)PyArena_Malloc(arena, sizeof(*p));
    2125         455 :         if (!p)
    2126           0 :                 return NULL;
    2127         455 :         p->name = name;
    2128         455 :         p->asname = asname;
    2129         455 :         return p;
    2130             : }
    2131             : 
    2132             : 
    2133             : PyObject*
    2134           0 : ast2obj_mod(void* _o)
    2135             : {
    2136           0 :         mod_ty o = (mod_ty)_o;
    2137           0 :         PyObject *result = NULL, *value = NULL;
    2138           0 :         if (!o) {
    2139           0 :                 Py_INCREF(Py_None);
    2140           0 :                 return Py_None;
    2141             :         }
    2142             : 
    2143           0 :         switch (o->kind) {
    2144             :         case Module_kind:
    2145           0 :                 result = PyType_GenericNew(Module_type, NULL, NULL);
    2146           0 :                 if (!result) goto failed;
    2147           0 :                 value = ast2obj_list(o->v.Module.body, ast2obj_stmt);
    2148           0 :                 if (!value) goto failed;
    2149           0 :                 if (PyObject_SetAttrString(result, "body", value) == -1)
    2150           0 :                         goto failed;
    2151           0 :                 Py_DECREF(value);
    2152           0 :                 break;
    2153             :         case Interactive_kind:
    2154           0 :                 result = PyType_GenericNew(Interactive_type, NULL, NULL);
    2155           0 :                 if (!result) goto failed;
    2156           0 :                 value = ast2obj_list(o->v.Interactive.body, ast2obj_stmt);
    2157           0 :                 if (!value) goto failed;
    2158           0 :                 if (PyObject_SetAttrString(result, "body", value) == -1)
    2159           0 :                         goto failed;
    2160           0 :                 Py_DECREF(value);
    2161           0 :                 break;
    2162             :         case Expression_kind:
    2163           0 :                 result = PyType_GenericNew(Expression_type, NULL, NULL);
    2164           0 :                 if (!result) goto failed;
    2165           0 :                 value = ast2obj_expr(o->v.Expression.body);
    2166           0 :                 if (!value) goto failed;
    2167           0 :                 if (PyObject_SetAttrString(result, "body", value) == -1)
    2168           0 :                         goto failed;
    2169           0 :                 Py_DECREF(value);
    2170           0 :                 break;
    2171             :         case Suite_kind:
    2172           0 :                 result = PyType_GenericNew(Suite_type, NULL, NULL);
    2173           0 :                 if (!result) goto failed;
    2174           0 :                 value = ast2obj_list(o->v.Suite.body, ast2obj_stmt);
    2175           0 :                 if (!value) goto failed;
    2176           0 :                 if (PyObject_SetAttrString(result, "body", value) == -1)
    2177           0 :                         goto failed;
    2178           0 :                 Py_DECREF(value);
    2179           0 :                 break;
    2180             :         }
    2181           0 :         return result;
    2182             : failed:
    2183           0 :         Py_XDECREF(value);
    2184           0 :         Py_XDECREF(result);
    2185           0 :         return NULL;
    2186             : }
    2187             : 
    2188             : PyObject*
    2189           0 : ast2obj_stmt(void* _o)
    2190             : {
    2191           0 :         stmt_ty o = (stmt_ty)_o;
    2192           0 :         PyObject *result = NULL, *value = NULL;
    2193           0 :         if (!o) {
    2194           0 :                 Py_INCREF(Py_None);
    2195           0 :                 return Py_None;
    2196             :         }
    2197             : 
    2198           0 :         switch (o->kind) {
    2199             :         case FunctionDef_kind:
    2200           0 :                 result = PyType_GenericNew(FunctionDef_type, NULL, NULL);
    2201           0 :                 if (!result) goto failed;
    2202           0 :                 value = ast2obj_identifier(o->v.FunctionDef.name);
    2203           0 :                 if (!value) goto failed;
    2204           0 :                 if (PyObject_SetAttrString(result, "name", value) == -1)
    2205           0 :                         goto failed;
    2206           0 :                 Py_DECREF(value);
    2207           0 :                 value = ast2obj_arguments(o->v.FunctionDef.args);
    2208           0 :                 if (!value) goto failed;
    2209           0 :                 if (PyObject_SetAttrString(result, "args", value) == -1)
    2210           0 :                         goto failed;
    2211           0 :                 Py_DECREF(value);
    2212           0 :                 value = ast2obj_list(o->v.FunctionDef.body, ast2obj_stmt);
    2213           0 :                 if (!value) goto failed;
    2214           0 :                 if (PyObject_SetAttrString(result, "body", value) == -1)
    2215           0 :                         goto failed;
    2216           0 :                 Py_DECREF(value);
    2217           0 :                 value = ast2obj_list(o->v.FunctionDef.decorator_list,
    2218             :                                      ast2obj_expr);
    2219           0 :                 if (!value) goto failed;
    2220           0 :                 if (PyObject_SetAttrString(result, "decorator_list", value) ==
    2221             :                     -1)
    2222           0 :                         goto failed;
    2223           0 :                 Py_DECREF(value);
    2224           0 :                 break;
    2225             :         case ClassDef_kind:
    2226           0 :                 result = PyType_GenericNew(ClassDef_type, NULL, NULL);
    2227           0 :                 if (!result) goto failed;
    2228           0 :                 value = ast2obj_identifier(o->v.ClassDef.name);
    2229           0 :                 if (!value) goto failed;
    2230           0 :                 if (PyObject_SetAttrString(result, "name", value) == -1)
    2231           0 :                         goto failed;
    2232           0 :                 Py_DECREF(value);
    2233           0 :                 value = ast2obj_list(o->v.ClassDef.bases, ast2obj_expr);
    2234           0 :                 if (!value) goto failed;
    2235           0 :                 if (PyObject_SetAttrString(result, "bases", value) == -1)
    2236           0 :                         goto failed;
    2237           0 :                 Py_DECREF(value);
    2238           0 :                 value = ast2obj_list(o->v.ClassDef.body, ast2obj_stmt);
    2239           0 :                 if (!value) goto failed;
    2240           0 :                 if (PyObject_SetAttrString(result, "body", value) == -1)
    2241           0 :                         goto failed;
    2242           0 :                 Py_DECREF(value);
    2243           0 :                 value = ast2obj_list(o->v.ClassDef.decorator_list,
    2244             :                                      ast2obj_expr);
    2245           0 :                 if (!value) goto failed;
    2246           0 :                 if (PyObject_SetAttrString(result, "decorator_list", value) ==
    2247             :                     -1)
    2248           0 :                         goto failed;
    2249           0 :                 Py_DECREF(value);
    2250           0 :                 break;
    2251             :         case Return_kind:
    2252           0 :                 result = PyType_GenericNew(Return_type, NULL, NULL);
    2253           0 :                 if (!result) goto failed;
    2254           0 :                 value = ast2obj_expr(o->v.Return.value);
    2255           0 :                 if (!value) goto failed;
    2256           0 :                 if (PyObject_SetAttrString(result, "value", value) == -1)
    2257           0 :                         goto failed;
    2258           0 :                 Py_DECREF(value);
    2259           0 :                 break;
    2260             :         case Delete_kind:
    2261           0 :                 result = PyType_GenericNew(Delete_type, NULL, NULL);
    2262           0 :                 if (!result) goto failed;
    2263           0 :                 value = ast2obj_list(o->v.Delete.targets, ast2obj_expr);
    2264           0 :                 if (!value) goto failed;
    2265           0 :                 if (PyObject_SetAttrString(result, "targets", value) == -1)
    2266           0 :                         goto failed;
    2267           0 :                 Py_DECREF(value);
    2268           0 :                 break;
    2269             :         case Assign_kind:
    2270           0 :                 result = PyType_GenericNew(Assign_type, NULL, NULL);
    2271           0 :                 if (!result) goto failed;
    2272           0 :                 value = ast2obj_list(o->v.Assign.targets, ast2obj_expr);
    2273           0 :                 if (!value) goto failed;
    2274           0 :                 if (PyObject_SetAttrString(result, "targets", value) == -1)
    2275           0 :                         goto failed;
    2276           0 :                 Py_DECREF(value);
    2277           0 :                 value = ast2obj_expr(o->v.Assign.value);
    2278           0 :                 if (!value) goto failed;
    2279           0 :                 if (PyObject_SetAttrString(result, "value", value) == -1)
    2280           0 :                         goto failed;
    2281           0 :                 Py_DECREF(value);
    2282           0 :                 break;
    2283             :         case AugAssign_kind:
    2284           0 :                 result = PyType_GenericNew(AugAssign_type, NULL, NULL);
    2285           0 :                 if (!result) goto failed;
    2286           0 :                 value = ast2obj_expr(o->v.AugAssign.target);
    2287           0 :                 if (!value) goto failed;
    2288           0 :                 if (PyObject_SetAttrString(result, "target", value) == -1)
    2289           0 :                         goto failed;
    2290           0 :                 Py_DECREF(value);
    2291           0 :                 value = ast2obj_operator(o->v.AugAssign.op);
    2292           0 :                 if (!value) goto failed;
    2293           0 :                 if (PyObject_SetAttrString(result, "op", value) == -1)
    2294           0 :                         goto failed;
    2295           0 :                 Py_DECREF(value);
    2296           0 :                 value = ast2obj_expr(o->v.AugAssign.value);
    2297           0 :                 if (!value) goto failed;
    2298           0 :                 if (PyObject_SetAttrString(result, "value", value) == -1)
    2299           0 :                         goto failed;
    2300           0 :                 Py_DECREF(value);
    2301           0 :                 break;
    2302             :         case Print_kind:
    2303           0 :                 result = PyType_GenericNew(Print_type, NULL, NULL);
    2304           0 :                 if (!result) goto failed;
    2305           0 :                 value = ast2obj_expr(o->v.Print.dest);
    2306           0 :                 if (!value) goto failed;
    2307           0 :                 if (PyObject_SetAttrString(result, "dest", value) == -1)
    2308           0 :                         goto failed;
    2309           0 :                 Py_DECREF(value);
    2310           0 :                 value = ast2obj_list(o->v.Print.values, ast2obj_expr);
    2311           0 :                 if (!value) goto failed;
    2312           0 :                 if (PyObject_SetAttrString(result, "values", value) == -1)
    2313           0 :                         goto failed;
    2314           0 :                 Py_DECREF(value);
    2315           0 :                 value = ast2obj_bool(o->v.Print.nl);
    2316           0 :                 if (!value) goto failed;
    2317           0 :                 if (PyObject_SetAttrString(result, "nl", value) == -1)
    2318           0 :                         goto failed;
    2319           0 :                 Py_DECREF(value);
    2320           0 :                 break;
    2321             :         case For_kind:
    2322           0 :                 result = PyType_GenericNew(For_type, NULL, NULL);
    2323           0 :                 if (!result) goto failed;
    2324           0 :                 value = ast2obj_expr(o->v.For.target);
    2325           0 :                 if (!value) goto failed;
    2326           0 :                 if (PyObject_SetAttrString(result, "target", value) == -1)
    2327           0 :                         goto failed;
    2328           0 :                 Py_DECREF(value);
    2329           0 :                 value = ast2obj_expr(o->v.For.iter);
    2330           0 :                 if (!value) goto failed;
    2331           0 :                 if (PyObject_SetAttrString(result, "iter", value) == -1)
    2332           0 :                         goto failed;
    2333           0 :                 Py_DECREF(value);
    2334           0 :                 value = ast2obj_list(o->v.For.body, ast2obj_stmt);
    2335           0 :                 if (!value) goto failed;
    2336           0 :                 if (PyObject_SetAttrString(result, "body", value) == -1)
    2337           0 :                         goto failed;
    2338           0 :                 Py_DECREF(value);
    2339           0 :                 value = ast2obj_list(o->v.For.orelse, ast2obj_stmt);
    2340           0 :                 if (!value) goto failed;
    2341           0 :                 if (PyObject_SetAttrString(result, "orelse", value) == -1)
    2342           0 :                         goto failed;
    2343           0 :                 Py_DECREF(value);
    2344           0 :                 break;
    2345             :         case While_kind:
    2346           0 :                 result = PyType_GenericNew(While_type, NULL, NULL);
    2347           0 :                 if (!result) goto failed;
    2348           0 :                 value = ast2obj_expr(o->v.While.test);
    2349           0 :                 if (!value) goto failed;
    2350           0 :                 if (PyObject_SetAttrString(result, "test", value) == -1)
    2351           0 :                         goto failed;
    2352           0 :                 Py_DECREF(value);
    2353           0 :                 value = ast2obj_list(o->v.While.body, ast2obj_stmt);
    2354           0 :                 if (!value) goto failed;
    2355           0 :                 if (PyObject_SetAttrString(result, "body", value) == -1)
    2356           0 :                         goto failed;
    2357           0 :                 Py_DECREF(value);
    2358           0 :                 value = ast2obj_list(o->v.While.orelse, ast2obj_stmt);
    2359           0 :                 if (!value) goto failed;
    2360           0 :                 if (PyObject_SetAttrString(result, "orelse", value) == -1)
    2361           0 :                         goto failed;
    2362           0 :                 Py_DECREF(value);
    2363           0 :                 break;
    2364             :         case If_kind:
    2365           0 :                 result = PyType_GenericNew(If_type, NULL, NULL);
    2366           0 :                 if (!result) goto failed;
    2367           0 :                 value = ast2obj_expr(o->v.If.test);
    2368           0 :                 if (!value) goto failed;
    2369           0 :                 if (PyObject_SetAttrString(result, "test", value) == -1)
    2370           0 :                         goto failed;
    2371           0 :                 Py_DECREF(value);
    2372           0 :                 value = ast2obj_list(o->v.If.body, ast2obj_stmt);
    2373           0 :                 if (!value) goto failed;
    2374           0 :                 if (PyObject_SetAttrString(result, "body", value) == -1)
    2375           0 :                         goto failed;
    2376           0 :                 Py_DECREF(value);
    2377           0 :                 value = ast2obj_list(o->v.If.orelse, ast2obj_stmt);
    2378           0 :                 if (!value) goto failed;
    2379           0 :                 if (PyObject_SetAttrString(result, "orelse", value) == -1)
    2380           0 :                         goto failed;
    2381           0 :                 Py_DECREF(value);
    2382           0 :                 break;
    2383             :         case With_kind:
    2384           0 :                 result = PyType_GenericNew(With_type, NULL, NULL);
    2385           0 :                 if (!result) goto failed;
    2386           0 :                 value = ast2obj_expr(o->v.With.context_expr);
    2387           0 :                 if (!value) goto failed;
    2388           0 :                 if (PyObject_SetAttrString(result, "context_expr", value) == -1)
    2389           0 :                         goto failed;
    2390           0 :                 Py_DECREF(value);
    2391           0 :                 value = ast2obj_expr(o->v.With.optional_vars);
    2392           0 :                 if (!value) goto failed;
    2393           0 :                 if (PyObject_SetAttrString(result, "optional_vars", value) ==
    2394             :                     -1)
    2395           0 :                         goto failed;
    2396           0 :                 Py_DECREF(value);
    2397           0 :                 value = ast2obj_list(o->v.With.body, ast2obj_stmt);
    2398           0 :                 if (!value) goto failed;
    2399           0 :                 if (PyObject_SetAttrString(result, "body", value) == -1)
    2400           0 :                         goto failed;
    2401           0 :                 Py_DECREF(value);
    2402           0 :                 break;
    2403             :         case Raise_kind:
    2404           0 :                 result = PyType_GenericNew(Raise_type, NULL, NULL);
    2405           0 :                 if (!result) goto failed;
    2406           0 :                 value = ast2obj_expr(o->v.Raise.type);
    2407           0 :                 if (!value) goto failed;
    2408           0 :                 if (PyObject_SetAttrString(result, "type", value) == -1)
    2409           0 :                         goto failed;
    2410           0 :                 Py_DECREF(value);
    2411           0 :                 value = ast2obj_expr(o->v.Raise.inst);
    2412           0 :                 if (!value) goto failed;
    2413           0 :                 if (PyObject_SetAttrString(result, "inst", value) == -1)
    2414           0 :                         goto failed;
    2415           0 :                 Py_DECREF(value);
    2416           0 :                 value = ast2obj_expr(o->v.Raise.tback);
    2417           0 :                 if (!value) goto failed;
    2418           0 :                 if (PyObject_SetAttrString(result, "tback", value) == -1)
    2419           0 :                         goto failed;
    2420           0 :                 Py_DECREF(value);
    2421           0 :                 break;
    2422             :         case TryExcept_kind:
    2423           0 :                 result = PyType_GenericNew(TryExcept_type, NULL, NULL);
    2424           0 :                 if (!result) goto failed;
    2425           0 :                 value = ast2obj_list(o->v.TryExcept.body, ast2obj_stmt);
    2426           0 :                 if (!value) goto failed;
    2427           0 :                 if (PyObject_SetAttrString(result, "body", value) == -1)
    2428           0 :                         goto failed;
    2429           0 :                 Py_DECREF(value);
    2430           0 :                 value = ast2obj_list(o->v.TryExcept.handlers,
    2431             :                                      ast2obj_excepthandler);
    2432           0 :                 if (!value) goto failed;
    2433           0 :                 if (PyObject_SetAttrString(result, "handlers", value) == -1)
    2434           0 :                         goto failed;
    2435           0 :                 Py_DECREF(value);
    2436           0 :                 value = ast2obj_list(o->v.TryExcept.orelse, ast2obj_stmt);
    2437           0 :                 if (!value) goto failed;
    2438           0 :                 if (PyObject_SetAttrString(result, "orelse", value) == -1)
    2439           0 :                         goto failed;
    2440           0 :                 Py_DECREF(value);
    2441           0 :                 break;
    2442             :         case TryFinally_kind:
    2443           0 :                 result = PyType_GenericNew(TryFinally_type, NULL, NULL);
    2444           0 :                 if (!result) goto failed;
    2445           0 :                 value = ast2obj_list(o->v.TryFinally.body, ast2obj_stmt);
    2446           0 :                 if (!value) goto failed;
    2447           0 :                 if (PyObject_SetAttrString(result, "body", value) == -1)
    2448           0 :                         goto failed;
    2449           0 :                 Py_DECREF(value);
    2450           0 :                 value = ast2obj_list(o->v.TryFinally.finalbody, ast2obj_stmt);
    2451           0 :                 if (!value) goto failed;
    2452           0 :                 if (PyObject_SetAttrString(result, "finalbody", value) == -1)
    2453           0 :                         goto failed;
    2454           0 :                 Py_DECREF(value);
    2455           0 :                 break;
    2456             :         case Assert_kind:
    2457           0 :                 result = PyType_GenericNew(Assert_type, NULL, NULL);
    2458           0 :                 if (!result) goto failed;
    2459           0 :                 value = ast2obj_expr(o->v.Assert.test);
    2460           0 :                 if (!value) goto failed;
    2461           0 :                 if (PyObject_SetAttrString(result, "test", value) == -1)
    2462           0 :                         goto failed;
    2463           0 :                 Py_DECREF(value);
    2464           0 :                 value = ast2obj_expr(o->v.Assert.msg);
    2465           0 :                 if (!value) goto failed;
    2466           0 :                 if (PyObject_SetAttrString(result, "msg", value) == -1)
    2467           0 :                         goto failed;
    2468           0 :                 Py_DECREF(value);
    2469           0 :                 break;
    2470             :         case Import_kind:
    2471           0 :                 result = PyType_GenericNew(Import_type, NULL, NULL);
    2472           0 :                 if (!result) goto failed;
    2473           0 :                 value = ast2obj_list(o->v.Import.names, ast2obj_alias);
    2474           0 :                 if (!value) goto failed;
    2475           0 :                 if (PyObject_SetAttrString(result, "names", value) == -1)
    2476           0 :                         goto failed;
    2477           0 :                 Py_DECREF(value);
    2478           0 :                 break;
    2479             :         case ImportFrom_kind:
    2480           0 :                 result = PyType_GenericNew(ImportFrom_type, NULL, NULL);
    2481           0 :                 if (!result) goto failed;
    2482           0 :                 value = ast2obj_identifier(o->v.ImportFrom.module);
    2483           0 :                 if (!value) goto failed;
    2484           0 :                 if (PyObject_SetAttrString(result, "module", value) == -1)
    2485           0 :                         goto failed;
    2486           0 :                 Py_DECREF(value);
    2487           0 :                 value = ast2obj_list(o->v.ImportFrom.names, ast2obj_alias);
    2488           0 :                 if (!value) goto failed;
    2489           0 :                 if (PyObject_SetAttrString(result, "names", value) == -1)
    2490           0 :                         goto failed;
    2491           0 :                 Py_DECREF(value);
    2492           0 :                 value = ast2obj_int(o->v.ImportFrom.level);
    2493           0 :                 if (!value) goto failed;
    2494           0 :                 if (PyObject_SetAttrString(result, "level", value) == -1)
    2495           0 :                         goto failed;
    2496           0 :                 Py_DECREF(value);
    2497           0 :                 break;
    2498             :         case Exec_kind:
    2499           0 :                 result = PyType_GenericNew(Exec_type, NULL, NULL);
    2500           0 :                 if (!result) goto failed;
    2501           0 :                 value = ast2obj_expr(o->v.Exec.body);
    2502           0 :                 if (!value) goto failed;
    2503           0 :                 if (PyObject_SetAttrString(result, "body", value) == -1)
    2504           0 :                         goto failed;
    2505           0 :                 Py_DECREF(value);
    2506           0 :                 value = ast2obj_expr(o->v.Exec.globals);
    2507           0 :                 if (!value) goto failed;
    2508           0 :                 if (PyObject_SetAttrString(result, "globals", value) == -1)
    2509           0 :                         goto failed;
    2510           0 :                 Py_DECREF(value);
    2511           0 :                 value = ast2obj_expr(o->v.Exec.locals);
    2512           0 :                 if (!value) goto failed;
    2513           0 :                 if (PyObject_SetAttrString(result, "locals", value) == -1)
    2514           0 :                         goto failed;
    2515           0 :                 Py_DECREF(value);
    2516           0 :                 break;
    2517             :         case Global_kind:
    2518           0 :                 result = PyType_GenericNew(Global_type, NULL, NULL);
    2519           0 :                 if (!result) goto failed;
    2520           0 :                 value = ast2obj_list(o->v.Global.names, ast2obj_identifier);
    2521           0 :                 if (!value) goto failed;
    2522           0 :                 if (PyObject_SetAttrString(result, "names", value) == -1)
    2523           0 :                         goto failed;
    2524           0 :                 Py_DECREF(value);
    2525           0 :                 break;
    2526             :         case Expr_kind:
    2527           0 :                 result = PyType_GenericNew(Expr_type, NULL, NULL);
    2528           0 :                 if (!result) goto failed;
    2529           0 :                 value = ast2obj_expr(o->v.Expr.value);
    2530           0 :                 if (!value) goto failed;
    2531           0 :                 if (PyObject_SetAttrString(result, "value", value) == -1)
    2532           0 :                         goto failed;
    2533           0 :                 Py_DECREF(value);
    2534           0 :                 break;
    2535             :         case Pass_kind:
    2536           0 :                 result = PyType_GenericNew(Pass_type, NULL, NULL);
    2537           0 :                 if (!result) goto failed;
    2538           0 :                 break;
    2539             :         case Break_kind:
    2540           0 :                 result = PyType_GenericNew(Break_type, NULL, NULL);
    2541           0 :                 if (!result) goto failed;
    2542           0 :                 break;
    2543             :         case Continue_kind:
    2544           0 :                 result = PyType_GenericNew(Continue_type, NULL, NULL);
    2545           0 :                 if (!result) goto failed;
    2546           0 :                 break;
    2547             :         }
    2548           0 :         value = ast2obj_int(o->lineno);
    2549           0 :         if (!value) goto failed;
    2550           0 :         if (PyObject_SetAttrString(result, "lineno", value) < 0)
    2551           0 :                 goto failed;
    2552           0 :         Py_DECREF(value);
    2553           0 :         value = ast2obj_int(o->col_offset);
    2554           0 :         if (!value) goto failed;
    2555           0 :         if (PyObject_SetAttrString(result, "col_offset", value) < 0)
    2556           0 :                 goto failed;
    2557           0 :         Py_DECREF(value);
    2558           0 :         return result;
    2559             : failed:
    2560           0 :         Py_XDECREF(value);
    2561           0 :         Py_XDECREF(result);
    2562           0 :         return NULL;
    2563             : }
    2564             : 
    2565             : PyObject*
    2566           0 : ast2obj_expr(void* _o)
    2567             : {
    2568           0 :         expr_ty o = (expr_ty)_o;
    2569           0 :         PyObject *result = NULL, *value = NULL;
    2570           0 :         if (!o) {
    2571           0 :                 Py_INCREF(Py_None);
    2572           0 :                 return Py_None;
    2573             :         }
    2574             : 
    2575           0 :         switch (o->kind) {
    2576             :         case BoolOp_kind:
    2577           0 :                 result = PyType_GenericNew(BoolOp_type, NULL, NULL);
    2578           0 :                 if (!result) goto failed;
    2579           0 :                 value = ast2obj_boolop(o->v.BoolOp.op);
    2580           0 :                 if (!value) goto failed;
    2581           0 :                 if (PyObject_SetAttrString(result, "op", value) == -1)
    2582           0 :                         goto failed;
    2583           0 :                 Py_DECREF(value);
    2584           0 :                 value = ast2obj_list(o->v.BoolOp.values, ast2obj_expr);
    2585           0 :                 if (!value) goto failed;
    2586           0 :                 if (PyObject_SetAttrString(result, "values", value) == -1)
    2587           0 :                         goto failed;
    2588           0 :                 Py_DECREF(value);
    2589           0 :                 break;
    2590             :         case BinOp_kind:
    2591           0 :                 result = PyType_GenericNew(BinOp_type, NULL, NULL);
    2592           0 :                 if (!result) goto failed;
    2593           0 :                 value = ast2obj_expr(o->v.BinOp.left);
    2594           0 :                 if (!value) goto failed;
    2595           0 :                 if (PyObject_SetAttrString(result, "left", value) == -1)
    2596           0 :                         goto failed;
    2597           0 :                 Py_DECREF(value);
    2598           0 :                 value = ast2obj_operator(o->v.BinOp.op);
    2599           0 :                 if (!value) goto failed;
    2600           0 :                 if (PyObject_SetAttrString(result, "op", value) == -1)
    2601           0 :                         goto failed;
    2602           0 :                 Py_DECREF(value);
    2603           0 :                 value = ast2obj_expr(o->v.BinOp.right);
    2604           0 :                 if (!value) goto failed;
    2605           0 :                 if (PyObject_SetAttrString(result, "right", value) == -1)
    2606           0 :                         goto failed;
    2607           0 :                 Py_DECREF(value);
    2608           0 :                 break;
    2609             :         case UnaryOp_kind:
    2610           0 :                 result = PyType_GenericNew(UnaryOp_type, NULL, NULL);
    2611           0 :                 if (!result) goto failed;
    2612           0 :                 value = ast2obj_unaryop(o->v.UnaryOp.op);
    2613           0 :                 if (!value) goto failed;
    2614           0 :                 if (PyObject_SetAttrString(result, "op", value) == -1)
    2615           0 :                         goto failed;
    2616           0 :                 Py_DECREF(value);
    2617           0 :                 value = ast2obj_expr(o->v.UnaryOp.operand);
    2618           0 :                 if (!value) goto failed;
    2619           0 :                 if (PyObject_SetAttrString(result, "operand", value) == -1)
    2620           0 :                         goto failed;
    2621           0 :                 Py_DECREF(value);
    2622           0 :                 break;
    2623             :         case Lambda_kind:
    2624           0 :                 result = PyType_GenericNew(Lambda_type, NULL, NULL);
    2625           0 :                 if (!result) goto failed;
    2626           0 :                 value = ast2obj_arguments(o->v.Lambda.args);
    2627           0 :                 if (!value) goto failed;
    2628           0 :                 if (PyObject_SetAttrString(result, "args", value) == -1)
    2629           0 :                         goto failed;
    2630           0 :                 Py_DECREF(value);
    2631           0 :                 value = ast2obj_expr(o->v.Lambda.body);
    2632           0 :                 if (!value) goto failed;
    2633           0 :                 if (PyObject_SetAttrString(result, "body", value) == -1)
    2634           0 :                         goto failed;
    2635           0 :                 Py_DECREF(value);
    2636           0 :                 break;
    2637             :         case IfExp_kind:
    2638           0 :                 result = PyType_GenericNew(IfExp_type, NULL, NULL);
    2639           0 :                 if (!result) goto failed;
    2640           0 :                 value = ast2obj_expr(o->v.IfExp.test);
    2641           0 :                 if (!value) goto failed;
    2642           0 :                 if (PyObject_SetAttrString(result, "test", value) == -1)
    2643           0 :                         goto failed;
    2644           0 :                 Py_DECREF(value);
    2645           0 :                 value = ast2obj_expr(o->v.IfExp.body);
    2646           0 :                 if (!value) goto failed;
    2647           0 :                 if (PyObject_SetAttrString(result, "body", value) == -1)
    2648           0 :                         goto failed;
    2649           0 :                 Py_DECREF(value);
    2650           0 :                 value = ast2obj_expr(o->v.IfExp.orelse);
    2651           0 :                 if (!value) goto failed;
    2652           0 :                 if (PyObject_SetAttrString(result, "orelse", value) == -1)
    2653           0 :                         goto failed;
    2654           0 :                 Py_DECREF(value);
    2655           0 :                 break;
    2656             :         case Dict_kind:
    2657           0 :                 result = PyType_GenericNew(Dict_type, NULL, NULL);
    2658           0 :                 if (!result) goto failed;
    2659           0 :                 value = ast2obj_list(o->v.Dict.keys, ast2obj_expr);
    2660           0 :                 if (!value) goto failed;
    2661           0 :                 if (PyObject_SetAttrString(result, "keys", value) == -1)
    2662           0 :                         goto failed;
    2663           0 :                 Py_DECREF(value);
    2664           0 :                 value = ast2obj_list(o->v.Dict.values, ast2obj_expr);
    2665           0 :                 if (!value) goto failed;
    2666           0 :                 if (PyObject_SetAttrString(result, "values", value) == -1)
    2667           0 :                         goto failed;
    2668           0 :                 Py_DECREF(value);
    2669           0 :                 break;
    2670             :         case Set_kind:
    2671           0 :                 result = PyType_GenericNew(Set_type, NULL, NULL);
    2672           0 :                 if (!result) goto failed;
    2673           0 :                 value = ast2obj_list(o->v.Set.elts, ast2obj_expr);
    2674           0 :                 if (!value) goto failed;
    2675           0 :                 if (PyObject_SetAttrString(result, "elts", value) == -1)
    2676           0 :                         goto failed;
    2677           0 :                 Py_DECREF(value);
    2678           0 :                 break;
    2679             :         case ListComp_kind:
    2680           0 :                 result = PyType_GenericNew(ListComp_type, NULL, NULL);
    2681           0 :                 if (!result) goto failed;
    2682           0 :                 value = ast2obj_expr(o->v.ListComp.elt);
    2683           0 :                 if (!value) goto failed;
    2684           0 :                 if (PyObject_SetAttrString(result, "elt", value) == -1)
    2685           0 :                         goto failed;
    2686           0 :                 Py_DECREF(value);
    2687           0 :                 value = ast2obj_list(o->v.ListComp.generators,
    2688             :                                      ast2obj_comprehension);
    2689           0 :                 if (!value) goto failed;
    2690           0 :                 if (PyObject_SetAttrString(result, "generators", value) == -1)
    2691           0 :                         goto failed;
    2692           0 :                 Py_DECREF(value);
    2693           0 :                 break;
    2694             :         case SetComp_kind:
    2695           0 :                 result = PyType_GenericNew(SetComp_type, NULL, NULL);
    2696           0 :                 if (!result) goto failed;
    2697           0 :                 value = ast2obj_expr(o->v.SetComp.elt);
    2698           0 :                 if (!value) goto failed;
    2699           0 :                 if (PyObject_SetAttrString(result, "elt", value) == -1)
    2700           0 :                         goto failed;
    2701           0 :                 Py_DECREF(value);
    2702           0 :                 value = ast2obj_list(o->v.SetComp.generators,
    2703             :                                      ast2obj_comprehension);
    2704           0 :                 if (!value) goto failed;
    2705           0 :                 if (PyObject_SetAttrString(result, "generators", value) == -1)
    2706           0 :                         goto failed;
    2707           0 :                 Py_DECREF(value);
    2708           0 :                 break;
    2709             :         case DictComp_kind:
    2710           0 :                 result = PyType_GenericNew(DictComp_type, NULL, NULL);
    2711           0 :                 if (!result) goto failed;
    2712           0 :                 value = ast2obj_expr(o->v.DictComp.key);
    2713           0 :                 if (!value) goto failed;
    2714           0 :                 if (PyObject_SetAttrString(result, "key", value) == -1)
    2715           0 :                         goto failed;
    2716           0 :                 Py_DECREF(value);
    2717           0 :                 value = ast2obj_expr(o->v.DictComp.value);
    2718           0 :                 if (!value) goto failed;
    2719           0 :                 if (PyObject_SetAttrString(result, "value", value) == -1)
    2720           0 :                         goto failed;
    2721           0 :                 Py_DECREF(value);
    2722           0 :                 value = ast2obj_list(o->v.DictComp.generators,
    2723             :                                      ast2obj_comprehension);
    2724           0 :                 if (!value) goto failed;
    2725           0 :                 if (PyObject_SetAttrString(result, "generators", value) == -1)
    2726           0 :                         goto failed;
    2727           0 :                 Py_DECREF(value);
    2728           0 :                 break;
    2729             :         case GeneratorExp_kind:
    2730           0 :                 result = PyType_GenericNew(GeneratorExp_type, NULL, NULL);
    2731           0 :                 if (!result) goto failed;
    2732           0 :                 value = ast2obj_expr(o->v.GeneratorExp.elt);
    2733           0 :                 if (!value) goto failed;
    2734           0 :                 if (PyObject_SetAttrString(result, "elt", value) == -1)
    2735           0 :                         goto failed;
    2736           0 :                 Py_DECREF(value);
    2737           0 :                 value = ast2obj_list(o->v.GeneratorExp.generators,
    2738             :                                      ast2obj_comprehension);
    2739           0 :                 if (!value) goto failed;
    2740           0 :                 if (PyObject_SetAttrString(result, "generators", value) == -1)
    2741           0 :                         goto failed;
    2742           0 :                 Py_DECREF(value);
    2743           0 :                 break;
    2744             :         case Yield_kind:
    2745           0 :                 result = PyType_GenericNew(Yield_type, NULL, NULL);
    2746           0 :                 if (!result) goto failed;
    2747           0 :                 value = ast2obj_expr(o->v.Yield.value);
    2748           0 :                 if (!value) goto failed;
    2749           0 :                 if (PyObject_SetAttrString(result, "value", value) == -1)
    2750           0 :                         goto failed;
    2751           0 :                 Py_DECREF(value);
    2752           0 :                 break;
    2753             :         case Compare_kind:
    2754           0 :                 result = PyType_GenericNew(Compare_type, NULL, NULL);
    2755           0 :                 if (!result) goto failed;
    2756           0 :                 value = ast2obj_expr(o->v.Compare.left);
    2757           0 :                 if (!value) goto failed;
    2758           0 :                 if (PyObject_SetAttrString(result, "left", value) == -1)
    2759           0 :                         goto failed;
    2760           0 :                 Py_DECREF(value);
    2761             :                 {
    2762           0 :                         int i, n = asdl_seq_LEN(o->v.Compare.ops);
    2763           0 :                         value = PyList_New(n);
    2764           0 :                         if (!value) goto failed;
    2765           0 :                         for(i = 0; i < n; i++)
    2766           0 :                                 PyList_SET_ITEM(value, i, ast2obj_cmpop((cmpop_ty)asdl_seq_GET(o->v.Compare.ops, i)));
    2767             :                 }
    2768           0 :                 if (!value) goto failed;
    2769           0 :                 if (PyObject_SetAttrString(result, "ops", value) == -1)
    2770           0 :                         goto failed;
    2771           0 :                 Py_DECREF(value);
    2772           0 :                 value = ast2obj_list(o->v.Compare.comparators, ast2obj_expr);
    2773           0 :                 if (!value) goto failed;
    2774           0 :                 if (PyObject_SetAttrString(result, "comparators", value) == -1)
    2775           0 :                         goto failed;
    2776           0 :                 Py_DECREF(value);
    2777           0 :                 break;
    2778             :         case Call_kind:
    2779           0 :                 result = PyType_GenericNew(Call_type, NULL, NULL);
    2780           0 :                 if (!result) goto failed;
    2781           0 :                 value = ast2obj_expr(o->v.Call.func);
    2782           0 :                 if (!value) goto failed;
    2783           0 :                 if (PyObject_SetAttrString(result, "func", value) == -1)
    2784           0 :                         goto failed;
    2785           0 :                 Py_DECREF(value);
    2786           0 :                 value = ast2obj_list(o->v.Call.args, ast2obj_expr);
    2787           0 :                 if (!value) goto failed;
    2788           0 :                 if (PyObject_SetAttrString(result, "args", value) == -1)
    2789           0 :                         goto failed;
    2790           0 :                 Py_DECREF(value);
    2791           0 :                 value = ast2obj_list(o->v.Call.keywords, ast2obj_keyword);
    2792           0 :                 if (!value) goto failed;
    2793           0 :                 if (PyObject_SetAttrString(result, "keywords", value) == -1)
    2794           0 :                         goto failed;
    2795           0 :                 Py_DECREF(value);
    2796           0 :                 value = ast2obj_expr(o->v.Call.starargs);
    2797           0 :                 if (!value) goto failed;
    2798           0 :                 if (PyObject_SetAttrString(result, "starargs", value) == -1)
    2799           0 :                         goto failed;
    2800           0 :                 Py_DECREF(value);
    2801           0 :                 value = ast2obj_expr(o->v.Call.kwargs);
    2802           0 :                 if (!value) goto failed;
    2803           0 :                 if (PyObject_SetAttrString(result, "kwargs", value) == -1)
    2804           0 :                         goto failed;
    2805           0 :                 Py_DECREF(value);
    2806           0 :                 break;
    2807             :         case Repr_kind:
    2808           0 :                 result = PyType_GenericNew(Repr_type, NULL, NULL);
    2809           0 :                 if (!result) goto failed;
    2810           0 :                 value = ast2obj_expr(o->v.Repr.value);
    2811           0 :                 if (!value) goto failed;
    2812           0 :                 if (PyObject_SetAttrString(result, "value", value) == -1)
    2813           0 :                         goto failed;
    2814           0 :                 Py_DECREF(value);
    2815           0 :                 break;
    2816             :         case Num_kind:
    2817           0 :                 result = PyType_GenericNew(Num_type, NULL, NULL);
    2818           0 :                 if (!result) goto failed;
    2819           0 :                 value = ast2obj_object(o->v.Num.n);
    2820           0 :                 if (!value) goto failed;
    2821           0 :                 if (PyObject_SetAttrString(result, "n", value) == -1)
    2822           0 :                         goto failed;
    2823           0 :                 Py_DECREF(value);
    2824           0 :                 break;
    2825             :         case Str_kind:
    2826           0 :                 result = PyType_GenericNew(Str_type, NULL, NULL);
    2827           0 :                 if (!result) goto failed;
    2828           0 :                 value = ast2obj_string(o->v.Str.s);
    2829           0 :                 if (!value) goto failed;
    2830           0 :                 if (PyObject_SetAttrString(result, "s", value) == -1)
    2831           0 :                         goto failed;
    2832           0 :                 Py_DECREF(value);
    2833           0 :                 break;
    2834             :         case Attribute_kind:
    2835           0 :                 result = PyType_GenericNew(Attribute_type, NULL, NULL);
    2836           0 :                 if (!result) goto failed;
    2837           0 :                 value = ast2obj_expr(o->v.Attribute.value);
    2838           0 :                 if (!value) goto failed;
    2839           0 :                 if (PyObject_SetAttrString(result, "value", value) == -1)
    2840           0 :                         goto failed;
    2841           0 :                 Py_DECREF(value);
    2842           0 :                 value = ast2obj_identifier(o->v.Attribute.attr);
    2843           0 :                 if (!value) goto failed;
    2844           0 :                 if (PyObject_SetAttrString(result, "attr", value) == -1)
    2845           0 :                         goto failed;
    2846           0 :                 Py_DECREF(value);
    2847           0 :                 value = ast2obj_expr_context(o->v.Attribute.ctx);
    2848           0 :                 if (!value) goto failed;
    2849           0 :                 if (PyObject_SetAttrString(result, "ctx", value) == -1)
    2850           0 :                         goto failed;
    2851           0 :                 Py_DECREF(value);
    2852           0 :                 break;
    2853             :         case Subscript_kind:
    2854           0 :                 result = PyType_GenericNew(Subscript_type, NULL, NULL);
    2855           0 :                 if (!result) goto failed;
    2856           0 :                 value = ast2obj_expr(o->v.Subscript.value);
    2857           0 :                 if (!value) goto failed;
    2858           0 :                 if (PyObject_SetAttrString(result, "value", value) == -1)
    2859           0 :                         goto failed;
    2860           0 :                 Py_DECREF(value);
    2861           0 :                 value = ast2obj_slice(o->v.Subscript.slice);
    2862           0 :                 if (!value) goto failed;
    2863           0 :                 if (PyObject_SetAttrString(result, "slice", value) == -1)
    2864           0 :                         goto failed;
    2865           0 :                 Py_DECREF(value);
    2866           0 :                 value = ast2obj_expr_context(o->v.Subscript.ctx);
    2867           0 :                 if (!value) goto failed;
    2868           0 :                 if (PyObject_SetAttrString(result, "ctx", value) == -1)
    2869           0 :                         goto failed;
    2870           0 :                 Py_DECREF(value);
    2871           0 :                 break;
    2872             :         case Name_kind:
    2873           0 :                 result = PyType_GenericNew(Name_type, NULL, NULL);
    2874           0 :                 if (!result) goto failed;
    2875           0 :                 value = ast2obj_identifier(o->v.Name.id);
    2876           0 :                 if (!value) goto failed;
    2877           0 :                 if (PyObject_SetAttrString(result, "id", value) == -1)
    2878           0 :                         goto failed;
    2879           0 :                 Py_DECREF(value);
    2880           0 :                 value = ast2obj_expr_context(o->v.Name.ctx);
    2881           0 :                 if (!value) goto failed;
    2882           0 :                 if (PyObject_SetAttrString(result, "ctx", value) == -1)
    2883           0 :                         goto failed;
    2884           0 :                 Py_DECREF(value);
    2885           0 :                 break;
    2886             :         case List_kind:
    2887           0 :                 result = PyType_GenericNew(List_type, NULL, NULL);
    2888           0 :                 if (!result) goto failed;
    2889           0 :                 value = ast2obj_list(o->v.List.elts, ast2obj_expr);
    2890           0 :                 if (!value) goto failed;
    2891           0 :                 if (PyObject_SetAttrString(result, "elts", value) == -1)
    2892           0 :                         goto failed;
    2893           0 :                 Py_DECREF(value);
    2894           0 :                 value = ast2obj_expr_context(o->v.List.ctx);
    2895           0 :                 if (!value) goto failed;
    2896           0 :                 if (PyObject_SetAttrString(result, "ctx", value) == -1)
    2897           0 :                         goto failed;
    2898           0 :                 Py_DECREF(value);
    2899           0 :                 break;
    2900             :         case Tuple_kind:
    2901           0 :                 result = PyType_GenericNew(Tuple_type, NULL, NULL);
    2902           0 :                 if (!result) goto failed;
    2903           0 :                 value = ast2obj_list(o->v.Tuple.elts, ast2obj_expr);
    2904           0 :                 if (!value) goto failed;
    2905           0 :                 if (PyObject_SetAttrString(result, "elts", value) == -1)
    2906           0 :                         goto failed;
    2907           0 :                 Py_DECREF(value);
    2908           0 :                 value = ast2obj_expr_context(o->v.Tuple.ctx);
    2909           0 :                 if (!value) goto failed;
    2910           0 :                 if (PyObject_SetAttrString(result, "ctx", value) == -1)
    2911           0 :                         goto failed;
    2912           0 :                 Py_DECREF(value);
    2913           0 :                 break;
    2914             :         }
    2915           0 :         value = ast2obj_int(o->lineno);
    2916           0 :         if (!value) goto failed;
    2917           0 :         if (PyObject_SetAttrString(result, "lineno", value) < 0)
    2918           0 :                 goto failed;
    2919           0 :         Py_DECREF(value);
    2920           0 :         value = ast2obj_int(o->col_offset);
    2921           0 :         if (!value) goto failed;
    2922           0 :         if (PyObject_SetAttrString(result, "col_offset", value) < 0)
    2923           0 :                 goto failed;
    2924           0 :         Py_DECREF(value);
    2925           0 :         return result;
    2926             : failed:
    2927           0 :         Py_XDECREF(value);
    2928           0 :         Py_XDECREF(result);
    2929           0 :         return NULL;
    2930             : }
    2931             : 
    2932           0 : PyObject* ast2obj_expr_context(expr_context_ty o)
    2933             : {
    2934           0 :         switch(o) {
    2935             :                 case Load:
    2936           0 :                         Py_INCREF(Load_singleton);
    2937           0 :                         return Load_singleton;
    2938             :                 case Store:
    2939           0 :                         Py_INCREF(Store_singleton);
    2940           0 :                         return Store_singleton;
    2941             :                 case Del:
    2942           0 :                         Py_INCREF(Del_singleton);
    2943           0 :                         return Del_singleton;
    2944             :                 case AugLoad:
    2945           0 :                         Py_INCREF(AugLoad_singleton);
    2946           0 :                         return AugLoad_singleton;
    2947             :                 case AugStore:
    2948           0 :                         Py_INCREF(AugStore_singleton);
    2949           0 :                         return AugStore_singleton;
    2950             :                 case Param:
    2951           0 :                         Py_INCREF(Param_singleton);
    2952           0 :                         return Param_singleton;
    2953             :                 default:
    2954             :                         /* should never happen, but just in case ... */
    2955           0 :                         PyErr_Format(PyExc_SystemError, "unknown expr_context found");
    2956           0 :                         return NULL;
    2957             :         }
    2958             : }
    2959             : PyObject*
    2960           0 : ast2obj_slice(void* _o)
    2961             : {
    2962           0 :         slice_ty o = (slice_ty)_o;
    2963           0 :         PyObject *result = NULL, *value = NULL;
    2964           0 :         if (!o) {
    2965           0 :                 Py_INCREF(Py_None);
    2966           0 :                 return Py_None;
    2967             :         }
    2968             : 
    2969           0 :         switch (o->kind) {
    2970             :         case Ellipsis_kind:
    2971           0 :                 result = PyType_GenericNew(Ellipsis_type, NULL, NULL);
    2972           0 :                 if (!result) goto failed;
    2973           0 :                 break;
    2974             :         case Slice_kind:
    2975           0 :                 result = PyType_GenericNew(Slice_type, NULL, NULL);
    2976           0 :                 if (!result) goto failed;
    2977           0 :                 value = ast2obj_expr(o->v.Slice.lower);
    2978           0 :                 if (!value) goto failed;
    2979           0 :                 if (PyObject_SetAttrString(result, "lower", value) == -1)
    2980           0 :                         goto failed;
    2981           0 :                 Py_DECREF(value);
    2982           0 :                 value = ast2obj_expr(o->v.Slice.upper);
    2983           0 :                 if (!value) goto failed;
    2984           0 :                 if (PyObject_SetAttrString(result, "upper", value) == -1)
    2985           0 :                         goto failed;
    2986           0 :                 Py_DECREF(value);
    2987           0 :                 value = ast2obj_expr(o->v.Slice.step);
    2988           0 :                 if (!value) goto failed;
    2989           0 :                 if (PyObject_SetAttrString(result, "step", value) == -1)
    2990           0 :                         goto failed;
    2991           0 :                 Py_DECREF(value);
    2992           0 :                 break;
    2993             :         case ExtSlice_kind:
    2994           0 :                 result = PyType_GenericNew(ExtSlice_type, NULL, NULL);
    2995           0 :                 if (!result) goto failed;
    2996           0 :                 value = ast2obj_list(o->v.ExtSlice.dims, ast2obj_slice);
    2997           0 :                 if (!value) goto failed;
    2998           0 :                 if (PyObject_SetAttrString(result, "dims", value) == -1)
    2999           0 :                         goto failed;
    3000           0 :                 Py_DECREF(value);
    3001           0 :                 break;
    3002             :         case Index_kind:
    3003           0 :                 result = PyType_GenericNew(Index_type, NULL, NULL);
    3004           0 :                 if (!result) goto failed;
    3005           0 :                 value = ast2obj_expr(o->v.Index.value);
    3006           0 :                 if (!value) goto failed;
    3007           0 :                 if (PyObject_SetAttrString(result, "value", value) == -1)
    3008           0 :                         goto failed;
    3009           0 :                 Py_DECREF(value);
    3010           0 :                 break;
    3011             :         }
    3012           0 :         return result;
    3013             : failed:
    3014           0 :         Py_XDECREF(value);
    3015           0 :         Py_XDECREF(result);
    3016           0 :         return NULL;
    3017             : }
    3018             : 
    3019           0 : PyObject* ast2obj_boolop(boolop_ty o)
    3020             : {
    3021           0 :         switch(o) {
    3022             :                 case And:
    3023           0 :                         Py_INCREF(And_singleton);
    3024           0 :                         return And_singleton;
    3025             :                 case Or:
    3026           0 :                         Py_INCREF(Or_singleton);
    3027           0 :                         return Or_singleton;
    3028             :                 default:
    3029             :                         /* should never happen, but just in case ... */
    3030           0 :                         PyErr_Format(PyExc_SystemError, "unknown boolop found");
    3031           0 :                         return NULL;
    3032             :         }
    3033             : }
    3034           0 : PyObject* ast2obj_operator(operator_ty o)
    3035             : {
    3036           0 :         switch(o) {
    3037             :                 case Add:
    3038           0 :                         Py_INCREF(Add_singleton);
    3039           0 :                         return Add_singleton;
    3040             :                 case Sub:
    3041           0 :                         Py_INCREF(Sub_singleton);
    3042           0 :                         return Sub_singleton;
    3043             :                 case Mult:
    3044           0 :                         Py_INCREF(Mult_singleton);
    3045           0 :                         return Mult_singleton;
    3046             :                 case Div:
    3047           0 :                         Py_INCREF(Div_singleton);
    3048           0 :                         return Div_singleton;
    3049             :                 case Mod:
    3050           0 :                         Py_INCREF(Mod_singleton);
    3051           0 :                         return Mod_singleton;
    3052             :                 case Pow:
    3053           0 :                         Py_INCREF(Pow_singleton);
    3054           0 :                         return Pow_singleton;
    3055             :                 case LShift:
    3056           0 :                         Py_INCREF(LShift_singleton);
    3057           0 :                         return LShift_singleton;
    3058             :                 case RShift:
    3059           0 :                         Py_INCREF(RShift_singleton);
    3060           0 :                         return RShift_singleton;
    3061             :                 case BitOr:
    3062           0 :                         Py_INCREF(BitOr_singleton);
    3063           0 :                         return BitOr_singleton;
    3064             :                 case BitXor:
    3065           0 :                         Py_INCREF(BitXor_singleton);
    3066           0 :                         return BitXor_singleton;
    3067             :                 case BitAnd:
    3068           0 :                         Py_INCREF(BitAnd_singleton);
    3069           0 :                         return BitAnd_singleton;
    3070             :                 case FloorDiv:
    3071           0 :                         Py_INCREF(FloorDiv_singleton);
    3072           0 :                         return FloorDiv_singleton;
    3073             :                 default:
    3074             :                         /* should never happen, but just in case ... */
    3075           0 :                         PyErr_Format(PyExc_SystemError, "unknown operator found");
    3076           0 :                         return NULL;
    3077             :         }
    3078             : }
    3079           0 : PyObject* ast2obj_unaryop(unaryop_ty o)
    3080             : {
    3081           0 :         switch(o) {
    3082             :                 case Invert:
    3083           0 :                         Py_INCREF(Invert_singleton);
    3084           0 :                         return Invert_singleton;
    3085             :                 case Not:
    3086           0 :                         Py_INCREF(Not_singleton);
    3087           0 :                         return Not_singleton;
    3088             :                 case UAdd:
    3089           0 :                         Py_INCREF(UAdd_singleton);
    3090           0 :                         return UAdd_singleton;
    3091             :                 case USub:
    3092           0 :                         Py_INCREF(USub_singleton);
    3093           0 :                         return USub_singleton;
    3094             :                 default:
    3095             :                         /* should never happen, but just in case ... */
    3096           0 :                         PyErr_Format(PyExc_SystemError, "unknown unaryop found");
    3097           0 :                         return NULL;
    3098             :         }
    3099             : }
    3100           0 : PyObject* ast2obj_cmpop(cmpop_ty o)
    3101             : {
    3102           0 :         switch(o) {
    3103             :                 case Eq:
    3104           0 :                         Py_INCREF(Eq_singleton);
    3105           0 :                         return Eq_singleton;
    3106             :                 case NotEq:
    3107           0 :                         Py_INCREF(NotEq_singleton);
    3108           0 :                         return NotEq_singleton;
    3109             :                 case Lt:
    3110           0 :                         Py_INCREF(Lt_singleton);
    3111           0 :                         return Lt_singleton;
    3112             :                 case LtE:
    3113           0 :                         Py_INCREF(LtE_singleton);
    3114           0 :                         return LtE_singleton;
    3115             :                 case Gt:
    3116           0 :                         Py_INCREF(Gt_singleton);
    3117           0 :                         return Gt_singleton;
    3118             :                 case GtE:
    3119           0 :                         Py_INCREF(GtE_singleton);
    3120           0 :                         return GtE_singleton;
    3121             :                 case Is:
    3122           0 :                         Py_INCREF(Is_singleton);
    3123           0 :                         return Is_singleton;
    3124             :                 case IsNot:
    3125           0 :                         Py_INCREF(IsNot_singleton);
    3126           0 :                         return IsNot_singleton;
    3127             :                 case In:
    3128           0 :                         Py_INCREF(In_singleton);
    3129           0 :                         return In_singleton;
    3130             :                 case NotIn:
    3131           0 :                         Py_INCREF(NotIn_singleton);
    3132           0 :                         return NotIn_singleton;
    3133             :                 default:
    3134             :                         /* should never happen, but just in case ... */
    3135           0 :                         PyErr_Format(PyExc_SystemError, "unknown cmpop found");
    3136           0 :                         return NULL;
    3137             :         }
    3138             : }
    3139             : PyObject*
    3140           0 : ast2obj_comprehension(void* _o)
    3141             : {
    3142           0 :         comprehension_ty o = (comprehension_ty)_o;
    3143           0 :         PyObject *result = NULL, *value = NULL;
    3144           0 :         if (!o) {
    3145           0 :                 Py_INCREF(Py_None);
    3146           0 :                 return Py_None;
    3147             :         }
    3148             : 
    3149           0 :         result = PyType_GenericNew(comprehension_type, NULL, NULL);
    3150           0 :         if (!result) return NULL;
    3151           0 :         value = ast2obj_expr(o->target);
    3152           0 :         if (!value) goto failed;
    3153           0 :         if (PyObject_SetAttrString(result, "target", value) == -1)
    3154           0 :                 goto failed;
    3155           0 :         Py_DECREF(value);
    3156           0 :         value = ast2obj_expr(o->iter);
    3157           0 :         if (!value) goto failed;
    3158           0 :         if (PyObject_SetAttrString(result, "iter", value) == -1)
    3159           0 :                 goto failed;
    3160           0 :         Py_DECREF(value);
    3161           0 :         value = ast2obj_list(o->ifs, ast2obj_expr);
    3162           0 :         if (!value) goto failed;
    3163           0 :         if (PyObject_SetAttrString(result, "ifs", value) == -1)
    3164           0 :                 goto failed;
    3165           0 :         Py_DECREF(value);
    3166           0 :         return result;
    3167             : failed:
    3168           0 :         Py_XDECREF(value);
    3169           0 :         Py_XDECREF(result);
    3170           0 :         return NULL;
    3171             : }
    3172             : 
    3173             : PyObject*
    3174           0 : ast2obj_excepthandler(void* _o)
    3175             : {
    3176           0 :         excepthandler_ty o = (excepthandler_ty)_o;
    3177           0 :         PyObject *result = NULL, *value = NULL;
    3178           0 :         if (!o) {
    3179           0 :                 Py_INCREF(Py_None);
    3180           0 :                 return Py_None;
    3181             :         }
    3182             : 
    3183           0 :         switch (o->kind) {
    3184             :         case ExceptHandler_kind:
    3185           0 :                 result = PyType_GenericNew(ExceptHandler_type, NULL, NULL);
    3186           0 :                 if (!result) goto failed;
    3187           0 :                 value = ast2obj_expr(o->v.ExceptHandler.type);
    3188           0 :                 if (!value) goto failed;
    3189           0 :                 if (PyObject_SetAttrString(result, "type", value) == -1)
    3190           0 :                         goto failed;
    3191           0 :                 Py_DECREF(value);
    3192           0 :                 value = ast2obj_expr(o->v.ExceptHandler.name);
    3193           0 :                 if (!value) goto failed;
    3194           0 :                 if (PyObject_SetAttrString(result, "name", value) == -1)
    3195           0 :                         goto failed;
    3196           0 :                 Py_DECREF(value);
    3197           0 :                 value = ast2obj_list(o->v.ExceptHandler.body, ast2obj_stmt);
    3198           0 :                 if (!value) goto failed;
    3199           0 :                 if (PyObject_SetAttrString(result, "body", value) == -1)
    3200           0 :                         goto failed;
    3201           0 :                 Py_DECREF(value);
    3202           0 :                 break;
    3203             :         }
    3204           0 :         value = ast2obj_int(o->lineno);
    3205           0 :         if (!value) goto failed;
    3206           0 :         if (PyObject_SetAttrString(result, "lineno", value) < 0)
    3207           0 :                 goto failed;
    3208           0 :         Py_DECREF(value);
    3209           0 :         value = ast2obj_int(o->col_offset);
    3210           0 :         if (!value) goto failed;
    3211           0 :         if (PyObject_SetAttrString(result, "col_offset", value) < 0)
    3212           0 :                 goto failed;
    3213           0 :         Py_DECREF(value);
    3214           0 :         return result;
    3215             : failed:
    3216           0 :         Py_XDECREF(value);
    3217           0 :         Py_XDECREF(result);
    3218           0 :         return NULL;
    3219             : }
    3220             : 
    3221             : PyObject*
    3222           0 : ast2obj_arguments(void* _o)
    3223             : {
    3224           0 :         arguments_ty o = (arguments_ty)_o;
    3225           0 :         PyObject *result = NULL, *value = NULL;
    3226           0 :         if (!o) {
    3227           0 :                 Py_INCREF(Py_None);
    3228           0 :                 return Py_None;
    3229             :         }
    3230             : 
    3231           0 :         result = PyType_GenericNew(arguments_type, NULL, NULL);
    3232           0 :         if (!result) return NULL;
    3233           0 :         value = ast2obj_list(o->args, ast2obj_expr);
    3234           0 :         if (!value) goto failed;
    3235           0 :         if (PyObject_SetAttrString(result, "args", value) == -1)
    3236           0 :                 goto failed;
    3237           0 :         Py_DECREF(value);
    3238           0 :         value = ast2obj_identifier(o->vararg);
    3239           0 :         if (!value) goto failed;
    3240           0 :         if (PyObject_SetAttrString(result, "vararg", value) == -1)
    3241           0 :                 goto failed;
    3242           0 :         Py_DECREF(value);
    3243           0 :         value = ast2obj_identifier(o->kwarg);
    3244           0 :         if (!value) goto failed;
    3245           0 :         if (PyObject_SetAttrString(result, "kwarg", value) == -1)
    3246           0 :                 goto failed;
    3247           0 :         Py_DECREF(value);
    3248           0 :         value = ast2obj_list(o->defaults, ast2obj_expr);
    3249           0 :         if (!value) goto failed;
    3250           0 :         if (PyObject_SetAttrString(result, "defaults", value) == -1)
    3251           0 :                 goto failed;
    3252           0 :         Py_DECREF(value);
    3253           0 :         return result;
    3254             : failed:
    3255           0 :         Py_XDECREF(value);
    3256           0 :         Py_XDECREF(result);
    3257           0 :         return NULL;
    3258             : }
    3259             : 
    3260             : PyObject*
    3261           0 : ast2obj_keyword(void* _o)
    3262             : {
    3263           0 :         keyword_ty o = (keyword_ty)_o;
    3264           0 :         PyObject *result = NULL, *value = NULL;
    3265           0 :         if (!o) {
    3266           0 :                 Py_INCREF(Py_None);
    3267           0 :                 return Py_None;
    3268             :         }
    3269             : 
    3270           0 :         result = PyType_GenericNew(keyword_type, NULL, NULL);
    3271           0 :         if (!result) return NULL;
    3272           0 :         value = ast2obj_identifier(o->arg);
    3273           0 :         if (!value) goto failed;
    3274           0 :         if (PyObject_SetAttrString(result, "arg", value) == -1)
    3275           0 :                 goto failed;
    3276           0 :         Py_DECREF(value);
    3277           0 :         value = ast2obj_expr(o->value);
    3278           0 :         if (!value) goto failed;
    3279           0 :         if (PyObject_SetAttrString(result, "value", value) == -1)
    3280           0 :                 goto failed;
    3281           0 :         Py_DECREF(value);
    3282           0 :         return result;
    3283             : failed:
    3284           0 :         Py_XDECREF(value);
    3285           0 :         Py_XDECREF(result);
    3286           0 :         return NULL;
    3287             : }
    3288             : 
    3289             : PyObject*
    3290           0 : ast2obj_alias(void* _o)
    3291             : {
    3292           0 :         alias_ty o = (alias_ty)_o;
    3293           0 :         PyObject *result = NULL, *value = NULL;
    3294           0 :         if (!o) {
    3295           0 :                 Py_INCREF(Py_None);
    3296           0 :                 return Py_None;
    3297             :         }
    3298             : 
    3299           0 :         result = PyType_GenericNew(alias_type, NULL, NULL);
    3300           0 :         if (!result) return NULL;
    3301           0 :         value = ast2obj_identifier(o->name);
    3302           0 :         if (!value) goto failed;
    3303           0 :         if (PyObject_SetAttrString(result, "name", value) == -1)
    3304           0 :                 goto failed;
    3305           0 :         Py_DECREF(value);
    3306           0 :         value = ast2obj_identifier(o->asname);
    3307           0 :         if (!value) goto failed;
    3308           0 :         if (PyObject_SetAttrString(result, "asname", value) == -1)
    3309           0 :                 goto failed;
    3310           0 :         Py_DECREF(value);
    3311           0 :         return result;
    3312             : failed:
    3313           0 :         Py_XDECREF(value);
    3314           0 :         Py_XDECREF(result);
    3315           0 :         return NULL;
    3316             : }
    3317             : 
    3318             : 
    3319             : int
    3320           0 : obj2ast_mod(PyObject* obj, mod_ty* out, PyArena* arena)
    3321             : {
    3322           0 :         PyObject* tmp = NULL;
    3323             :         int isinstance;
    3324             : 
    3325             : 
    3326           0 :         if (obj == Py_None) {
    3327           0 :                 *out = NULL;
    3328           0 :                 return 0;
    3329             :         }
    3330           0 :         isinstance = PyObject_IsInstance(obj, (PyObject*)Module_type);
    3331           0 :         if (isinstance == -1) {
    3332           0 :                 return 1;
    3333             :         }
    3334           0 :         if (isinstance) {
    3335             :                 asdl_seq* body;
    3336             : 
    3337           0 :                 if (PyObject_HasAttrString(obj, "body")) {
    3338             :                         int res;
    3339             :                         Py_ssize_t len;
    3340             :                         Py_ssize_t i;
    3341           0 :                         tmp = PyObject_GetAttrString(obj, "body");
    3342           0 :                         if (tmp == NULL) goto failed;
    3343           0 :                         if (!PyList_Check(tmp)) {
    3344           0 :                                 PyErr_Format(PyExc_TypeError, "Module field \"body\" must be a list, not a %.200s", tmp->ob_type->tp_name);
    3345           0 :                                 goto failed;
    3346             :                         }
    3347           0 :                         len = PyList_GET_SIZE(tmp);
    3348           0 :                         body = asdl_seq_new(len, arena);
    3349           0 :                         if (body == NULL) goto failed;
    3350           0 :                         for (i = 0; i < len; i++) {
    3351             :                                 stmt_ty value;
    3352           0 :                                 res = obj2ast_stmt(PyList_GET_ITEM(tmp, i), &value, arena);
    3353           0 :                                 if (res != 0) goto failed;
    3354           0 :                                 if (len != PyList_GET_SIZE(tmp)) {
    3355           0 :                                         PyErr_SetString(PyExc_RuntimeError, "Module field \"body\" changed size during iteration");
    3356           0 :                                         goto failed;
    3357             :                                 }
    3358           0 :                                 asdl_seq_SET(body, i, value);
    3359             :                         }
    3360           0 :                         Py_XDECREF(tmp);
    3361           0 :                         tmp = NULL;
    3362             :                 } else {
    3363           0 :                         PyErr_SetString(PyExc_TypeError, "required field \"body\" missing from Module");
    3364           0 :                         return 1;
    3365             :                 }
    3366           0 :                 *out = Module(body, arena);
    3367           0 :                 if (*out == NULL) goto failed;
    3368           0 :                 return 0;
    3369             :         }
    3370           0 :         isinstance = PyObject_IsInstance(obj, (PyObject*)Interactive_type);
    3371           0 :         if (isinstance == -1) {
    3372           0 :                 return 1;
    3373             :         }
    3374           0 :         if (isinstance) {
    3375             :                 asdl_seq* body;
    3376             : 
    3377           0 :                 if (PyObject_HasAttrString(obj, "body")) {
    3378             :                         int res;
    3379             :                         Py_ssize_t len;
    3380             :                         Py_ssize_t i;
    3381           0 :                         tmp = PyObject_GetAttrString(obj, "body");
    3382           0 :                         if (tmp == NULL) goto failed;
    3383           0 :                         if (!PyList_Check(tmp)) {
    3384           0 :                                 PyErr_Format(PyExc_TypeError, "Interactive field \"body\" must be a list, not a %.200s", tmp->ob_type->tp_name);
    3385           0 :                                 goto failed;
    3386             :                         }
    3387           0 :                         len = PyList_GET_SIZE(tmp);
    3388           0 :                         body = asdl_seq_new(len, arena);
    3389           0 :                         if (body == NULL) goto failed;
    3390           0 :                         for (i = 0; i < len; i++) {
    3391             :                                 stmt_ty value;
    3392           0 :                                 res = obj2ast_stmt(PyList_GET_ITEM(tmp, i), &value, arena);
    3393           0 :                                 if (res != 0) goto failed;
    3394           0 :                                 if (len != PyList_GET_SIZE(tmp)) {
    3395           0 :                                         PyErr_SetString(PyExc_RuntimeError, "Interactive field \"body\" changed size during iteration");
    3396           0 :                                         goto failed;
    3397             :                                 }
    3398           0 :                                 asdl_seq_SET(body, i, value);
    3399             :                         }
    3400           0 :                         Py_XDECREF(tmp);
    3401           0 :                         tmp = NULL;
    3402             :                 } else {
    3403           0 :                         PyErr_SetString(PyExc_TypeError, "required field \"body\" missing from Interactive");
    3404           0 :                         return 1;
    3405             :                 }
    3406           0 :                 *out = Interactive(body, arena);
    3407           0 :                 if (*out == NULL) goto failed;
    3408           0 :                 return 0;
    3409             :         }
    3410           0 :         isinstance = PyObject_IsInstance(obj, (PyObject*)Expression_type);
    3411           0 :         if (isinstance == -1) {
    3412           0 :                 return 1;
    3413             :         }
    3414           0 :         if (isinstance) {
    3415             :                 expr_ty body;
    3416             : 
    3417           0 :                 if (PyObject_HasAttrString(obj, "body")) {
    3418             :                         int res;
    3419           0 :                         tmp = PyObject_GetAttrString(obj, "body");
    3420           0 :                         if (tmp == NULL) goto failed;
    3421           0 :                         res = obj2ast_expr(tmp, &body, arena);
    3422           0 :                         if (res != 0) goto failed;
    3423           0 :                         Py_XDECREF(tmp);
    3424           0 :                         tmp = NULL;
    3425             :                 } else {
    3426           0 :                         PyErr_SetString(PyExc_TypeError, "required field \"body\" missing from Expression");
    3427           0 :                         return 1;
    3428             :                 }
    3429           0 :                 *out = Expression(body, arena);
    3430           0 :                 if (*out == NULL) goto failed;
    3431           0 :                 return 0;
    3432             :         }
    3433           0 :         isinstance = PyObject_IsInstance(obj, (PyObject*)Suite_type);
    3434           0 :         if (isinstance == -1) {
    3435           0 :                 return 1;
    3436             :         }
    3437           0 :         if (isinstance) {
    3438             :                 asdl_seq* body;
    3439             : 
    3440           0 :                 if (PyObject_HasAttrString(obj, "body")) {
    3441             :                         int res;
    3442             :                         Py_ssize_t len;
    3443             :                         Py_ssize_t i;
    3444           0 :                         tmp = PyObject_GetAttrString(obj, "body");
    3445           0 :                         if (tmp == NULL) goto failed;
    3446           0 :                         if (!PyList_Check(tmp)) {
    3447           0 :                                 PyErr_Format(PyExc_TypeError, "Suite field \"body\" must be a list, not a %.200s", tmp->ob_type->tp_name);
    3448           0 :                                 goto failed;
    3449             :                         }
    3450           0 :                         len = PyList_GET_SIZE(tmp);
    3451           0 :                         body = asdl_seq_new(len, arena);
    3452           0 :                         if (body == NULL) goto failed;
    3453           0 :                         for (i = 0; i < len; i++) {
    3454             :                                 stmt_ty value;
    3455           0 :                                 res = obj2ast_stmt(PyList_GET_ITEM(tmp, i), &value, arena);
    3456           0 :                                 if (res != 0) goto failed;
    3457           0 :                                 if (len != PyList_GET_SIZE(tmp)) {
    3458           0 :                                         PyErr_SetString(PyExc_RuntimeError, "Suite field \"body\" changed size during iteration");
    3459           0 :                                         goto failed;
    3460             :                                 }
    3461           0 :                                 asdl_seq_SET(body, i, value);
    3462             :                         }
    3463           0 :                         Py_XDECREF(tmp);
    3464           0 :                         tmp = NULL;
    3465             :                 } else {
    3466           0 :                         PyErr_SetString(PyExc_TypeError, "required field \"body\" missing from Suite");
    3467           0 :                         return 1;
    3468             :                 }
    3469           0 :                 *out = Suite(body, arena);
    3470           0 :                 if (*out == NULL) goto failed;
    3471           0 :                 return 0;
    3472             :         }
    3473             : 
    3474           0 :         tmp = PyObject_Repr(obj);
    3475           0 :         if (tmp == NULL) goto failed;
    3476           0 :         PyErr_Format(PyExc_TypeError, "expected some sort of mod, but got %.400s", PyString_AS_STRING(tmp));
    3477             : failed:
    3478           0 :         Py_XDECREF(tmp);
    3479           0 :         return 1;
    3480             : }
    3481             : 
    3482             : int
    3483           0 : obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena)
    3484             : {
    3485           0 :         PyObject* tmp = NULL;
    3486             :         int isinstance;
    3487             : 
    3488             :         int lineno;
    3489             :         int col_offset;
    3490             : 
    3491           0 :         if (obj == Py_None) {
    3492           0 :                 *out = NULL;
    3493           0 :                 return 0;
    3494             :         }
    3495           0 :         if (PyObject_HasAttrString(obj, "lineno")) {
    3496             :                 int res;
    3497           0 :                 tmp = PyObject_GetAttrString(obj, "lineno");
    3498           0 :                 if (tmp == NULL) goto failed;
    3499           0 :                 res = obj2ast_int(tmp, &lineno, arena);
    3500           0 :                 if (res != 0) goto failed;
    3501           0 :                 Py_XDECREF(tmp);
    3502           0 :                 tmp = NULL;
    3503             :         } else {
    3504           0 :                 PyErr_SetString(PyExc_TypeError, "required field \"lineno\" missing from stmt");
    3505           0 :                 return 1;
    3506             :         }
    3507           0 :         if (PyObject_HasAttrString(obj, "col_offset")) {
    3508             :                 int res;
    3509           0 :                 tmp = PyObject_GetAttrString(obj, "col_offset");
    3510           0 :                 if (tmp == NULL) goto failed;
    3511           0 :                 res = obj2ast_int(tmp, &col_offset, arena);
    3512           0 :                 if (res != 0) goto failed;
    3513           0 :                 Py_XDECREF(tmp);
    3514           0 :                 tmp = NULL;
    3515             :         } else {
    3516           0 :                 PyErr_SetString(PyExc_TypeError, "required field \"col_offset\" missing from stmt");
    3517           0 :                 return 1;
    3518             :         }
    3519           0 :         isinstance = PyObject_IsInstance(obj, (PyObject*)FunctionDef_type);
    3520           0 :         if (isinstance == -1) {
    3521           0 :                 return 1;
    3522             :         }
    3523           0 :         if (isinstance) {
    3524             :                 identifier name;
    3525             :                 arguments_ty args;
    3526             :                 asdl_seq* body;
    3527             :                 asdl_seq* decorator_list;
    3528             : 
    3529           0 :                 if (PyObject_HasAttrString(obj, "name")) {
    3530             :                         int res;
    3531           0 :                         tmp = PyObject_GetAttrString(obj, "name");
    3532           0 :                         if (tmp == NULL) goto failed;
    3533           0 :                         res = obj2ast_identifier(tmp, &name, arena);
    3534           0 :                         if (res != 0) goto failed;
    3535           0 :                         Py_XDECREF(tmp);
    3536           0 :                         tmp = NULL;
    3537             :                 } else {
    3538           0 :                         PyErr_SetString(PyExc_TypeError, "required field \"name\" missing from FunctionDef");
    3539           0 :                         return 1;
    3540             :                 }
    3541           0 :                 if (PyObject_HasAttrString(obj, "args")) {
    3542             :                         int res;
    3543           0 :                         tmp = PyObject_GetAttrString(obj, "args");
    3544           0 :                         if (tmp == NULL) goto failed;
    3545           0 :                         res = obj2ast_arguments(tmp, &args, arena);
    3546           0 :                         if (res != 0) goto failed;
    3547           0 :                         Py_XDECREF(tmp);
    3548           0 :                         tmp = NULL;
    3549             :                 } else {
    3550           0 :                         PyErr_SetString(PyExc_TypeError, "required field \"args\" missing from FunctionDef");
    3551           0 :                         return 1;
    3552             :                 }
    3553           0 :                 if (PyObject_HasAttrString(obj, "body")) {
    3554             :                         int res;
    3555             :                         Py_ssize_t len;
    3556             :                         Py_ssize_t i;
    3557           0 :                         tmp = PyObject_GetAttrString(obj, "body");
    3558           0 :                         if (tmp == NULL) goto failed;
    3559           0 :                         if (!PyList_Check(tmp)) {
    3560           0 :                                 PyErr_Format(PyExc_TypeError, "FunctionDef field \"body\" must be a list, not a %.200s", tmp->ob_type->tp_name);
    3561           0 :                                 goto failed;
    3562             :                         }
    3563           0 :                         len = PyList_GET_SIZE(tmp);
    3564           0 :                         body = asdl_seq_new(len, arena);
    3565           0 :                         if (body == NULL) goto failed;
    3566           0 :                         for (i = 0; i < len; i++) {
    3567             :                                 stmt_ty value;
    3568           0 :                                 res = obj2ast_stmt(PyList_GET_ITEM(tmp, i), &value, arena);
    3569           0 :                                 if (res != 0) goto failed;
    3570           0 :                                 if (len != PyList_GET_SIZE(tmp)) {
    3571           0 :                                         PyErr_SetString(PyExc_RuntimeError, "FunctionDef field \"body\" changed size during iteration");
    3572           0 :                                         goto failed;
    3573             :                                 }
    3574           0 :                                 asdl_seq_SET(body, i, value);
    3575             :                         }
    3576           0 :                         Py_XDECREF(tmp);
    3577           0 :                         tmp = NULL;
    3578             :                 } else {
    3579           0 :                         PyErr_SetString(PyExc_TypeError, "required field \"body\" missing from FunctionDef");
    3580           0 :                         return 1;
    3581             :                 }
    3582           0 :                 if (PyObject_HasAttrString(obj, "decorator_list")) {
    3583             :                         int res;
    3584             :                         Py_ssize_t len;
    3585             :                         Py_ssize_t i;
    3586           0 :                         tmp = PyObject_GetAttrString(obj, "decorator_list");
    3587           0 :                         if (tmp == NULL) goto failed;
    3588           0 :                         if (!PyList_Check(tmp)) {
    3589           0 :                                 PyErr_Format(PyExc_TypeError, "FunctionDef field \"decorator_list\" must be a list, not a %.200s", tmp->ob_type->tp_name);
    3590           0 :                                 goto failed;
    3591             :                         }
    3592           0 :                         len = PyList_GET_SIZE(tmp);
    3593           0 :                         decorator_list = asdl_seq_new(len, arena);
    3594           0 :                         if (decorator_list == NULL) goto failed;
    3595           0 :                         for (i = 0; i < len; i++) {
    3596             :                                 expr_ty value;
    3597           0 :                                 res = obj2ast_expr(PyList_GET_ITEM(tmp, i), &value, arena);
    3598           0 :                                 if (res != 0) goto failed;
    3599           0 :                                 if (len != PyList_GET_SIZE(tmp)) {
    3600           0 :                                         PyErr_SetString(PyExc_RuntimeError, "FunctionDef field \"decorator_list\" changed size during iteration");
    3601           0 :                                         goto failed;
    3602             :                                 }
    3603           0 :                                 asdl_seq_SET(decorator_list, i, value);
    3604             :                         }
    3605           0 :                         Py_XDECREF(tmp);
    3606           0 :                         tmp = NULL;
    3607             :                 } else {
    3608           0 :                         PyErr_SetString(PyExc_TypeError, "required field \"decorator_list\" missing from FunctionDef");
    3609           0 :                         return 1;
    3610             :                 }
    3611           0 :                 *out = FunctionDef(name, args, body, decorator_list, lineno,
    3612             :                                    col_offset, arena);
    3613           0 :                 if (*out == NULL) goto failed;
    3614           0 :                 return 0;
    3615             :         }
    3616           0 :         isinstance = PyObject_IsInstance(obj, (PyObject*)ClassDef_type);
    3617           0 :         if (isinstance == -1) {
    3618           0 :                 return 1;
    3619             :         }
    3620           0 :         if (isinstance) {
    3621             :                 identifier name;
    3622             :                 asdl_seq* bases;
    3623             :                 asdl_seq* body;
    3624             :                 asdl_seq* decorator_list;
    3625             : 
    3626           0 :                 if (PyObject_HasAttrString(obj, "name")) {
    3627             :                         int res;
    3628           0 :                         tmp = PyObject_GetAttrString(obj, "name");
    3629           0 :                         if (tmp == NULL) goto failed;
    3630           0 :                         res = obj2ast_identifier(tmp, &name, arena);
    3631           0 :                         if (res != 0) goto failed;
    3632           0 :                         Py_XDECREF(tmp);
    3633           0 :                         tmp = NULL;
    3634             :                 } else {
    3635           0 :                         PyErr_SetString(PyExc_TypeError, "required field \"name\" missing from ClassDef");
    3636           0 :                         return 1;
    3637             :                 }
    3638           0 :                 if (PyObject_HasAttrString(obj, "bases")) {
    3639             :                         int res;
    3640             :                         Py_ssize_t len;
    3641             :                         Py_ssize_t i;
    3642           0 :                         tmp = PyObject_GetAttrString(obj, "bases");
    3643           0 :                         if (tmp == NULL) goto failed;
    3644           0 :                         if (!PyList_Check(tmp)) {
    3645           0 :                                 PyErr_Format(PyExc_TypeError, "ClassDef field \"bases\" must be a list, not a %.200s", tmp->ob_type->tp_name);
    3646           0 :                                 goto failed;
    3647             :                         }
    3648           0 :                         len = PyList_GET_SIZE(tmp);
    3649           0 :                         bases = asdl_seq_new(len, arena);
    3650           0 :                         if (bases == NULL) goto failed;
    3651           0 :                         for (i = 0; i < len; i++) {
    3652             :                                 expr_ty value;
    3653           0 :                                 res = obj2ast_expr(PyList_GET_ITEM(tmp, i), &value, arena);
    3654           0 :                                 if (res != 0) goto failed;
    3655           0 :                                 if (len != PyList_GET_SIZE(tmp)) {
    3656           0 :                                         PyErr_SetString(PyExc_RuntimeError, "ClassDef field \"bases\" changed size during iteration");
    3657           0 :                                         goto failed;
    3658             :                                 }
    3659           0 :                                 asdl_seq_SET(bases, i, value);
    3660             :                         }
    3661           0 :                         Py_XDECREF(tmp);
    3662           0 :                         tmp = NULL;
    3663             :                 } else {
    3664           0 :                         PyErr_SetString(PyExc_TypeError, "required field \"bases\" missing from ClassDef");
    3665           0 :                         return 1;
    3666             :                 }
    3667           0 :                 if (PyObject_HasAttrString(obj, "body")) {
    3668             :                         int res;
    3669             :                         Py_ssize_t len;
    3670             :                         Py_ssize_t i;
    3671           0 :                         tmp = PyObject_GetAttrString(obj, "body");
    3672           0 :                         if (tmp == NULL) goto failed;
    3673           0 :                         if (!PyList_Check(tmp)) {
    3674           0 :                                 PyErr_Format(PyExc_TypeError, "ClassDef field \"body\" must be a list, not a %.200s", tmp->ob_type->tp_name);
    3675           0 :                                 goto failed;
    3676             :                         }
    3677           0 :                         len = PyList_GET_SIZE(tmp);
    3678           0 :                         body = asdl_seq_new(len, arena);
    3679           0 :                         if (body == NULL) goto failed;
    3680           0 :                         for (i = 0; i < len; i++) {
    3681             :                                 stmt_ty value;
    3682           0 :                                 res = obj2ast_stmt(PyList_GET_ITEM(tmp, i), &value, arena);
    3683           0 :                                 if (res != 0) goto failed;
    3684           0 :                                 if (len != PyList_GET_SIZE(tmp)) {
    3685           0 :                                         PyErr_SetString(PyExc_RuntimeError, "ClassDef field \"body\" changed size during iteration");
    3686           0 :                                         goto failed;
    3687             :                                 }
    3688           0 :                                 asdl_seq_SET(body, i, value);
    3689             :                         }
    3690           0 :                         Py_XDECREF(tmp);
    3691           0 :                         tmp = NULL;
    3692             :                 } else {
    3693           0 :                         PyErr_SetString(PyExc_TypeError, "required field \"body\" missing from ClassDef");
    3694           0 :                         return 1;
    3695             :                 }
    3696           0 :                 if (PyObject_HasAttrString(obj, "decorator_list")) {
    3697             :                         int res;
    3698             :                         Py_ssize_t len;
    3699             :                         Py_ssize_t i;
    3700           0 :                         tmp = PyObject_GetAttrString(obj, "decorator_list");
    3701           0 :                         if (tmp == NULL) goto failed;
    3702           0 :                         if (!PyList_Check(tmp)) {
    3703           0 :                                 PyErr_Format(PyExc_TypeError, "ClassDef field \"decorator_list\" must be a list, not a %.200s", tmp->ob_type->tp_name);
    3704           0 :                                 goto failed;
    3705             :                         }
    3706           0 :                         len = PyList_GET_SIZE(tmp);
    3707           0 :                         decorator_list = asdl_seq_new(len, arena);
    3708           0 :                         if (decorator_list == NULL) goto failed;
    3709           0 :                         for (i = 0; i < len; i++) {
    3710             :                                 expr_ty value;
    3711           0 :                                 res = obj2ast_expr(PyList_GET_ITEM(tmp, i), &value, arena);
    3712           0 :                                 if (res != 0) goto failed;
    3713           0 :                                 if (len != PyList_GET_SIZE(tmp)) {
    3714           0 :                                         PyErr_SetString(PyExc_RuntimeError, "ClassDef field \"decorator_list\" changed size during iteration");
    3715           0 :                                         goto failed;
    3716             :                                 }
    3717           0 :                                 asdl_seq_SET(decorator_list, i, value);
    3718             :                         }
    3719           0 :                         Py_XDECREF(tmp);
    3720           0 :                         tmp = NULL;
    3721             :                 } else {
    3722           0 :                         PyErr_SetString(PyExc_TypeError, "required field \"decorator_list\" missing from ClassDef");
    3723           0 :                         return 1;
    3724             :                 }
    3725           0 :                 *out = ClassDef(name, bases, body, decorator_list, lineno,
    3726             :                                 col_offset, arena);
    3727           0 :                 if (*out == NULL) goto failed;
    3728           0 :                 return 0;
    3729             :         }
    3730           0 :         isinstance = PyObject_IsInstance(obj, (PyObject*)Return_type);
    3731           0 :         if (isinstance == -1) {
    3732           0 :                 return 1;
    3733             :         }
    3734           0 :         if (isinstance) {
    3735             :                 expr_ty value;
    3736             : 
    3737           0 :                 if (PyObject_HasAttrString(obj, "value")) {
    3738             :                         int res;
    3739           0 :                         tmp = PyObject_GetAttrString(obj, "value");
    3740           0 :                         if (tmp == NULL) goto failed;
    3741           0 :                         res = obj2ast_expr(tmp, &value, arena);
    3742           0 :                         if (res != 0) goto failed;
    3743           0 :                         Py_XDECREF(tmp);
    3744           0 :                         tmp = NULL;
    3745             :                 } else {
    3746           0 :                         value = NULL;
    3747             :                 }
    3748           0 :                 *out = Return(value, lineno, col_offset, arena);
    3749           0 :                 if (*out == NULL) goto failed;
    3750           0 :                 return 0;
    3751             :         }
    3752           0 :         isinstance = PyObject_IsInstance(obj, (PyObject*)Delete_type);
    3753           0 :         if (isinstance == -1) {
    3754           0 :                 return 1;
    3755             :         }
    3756           0 :         if (isinstance) {
    3757             :                 asdl_seq* targets;
    3758             : 
    3759           0 :                 if (PyObject_HasAttrString(obj, "targets")) {
    3760             :                         int res;
    3761             :                         Py_ssize_t len;
    3762             :                         Py_ssize_t i;
    3763           0 :                         tmp = PyObject_GetAttrString(obj, "targets");
    3764           0 :                         if (tmp == NULL) goto failed;
    3765           0 :                         if (!PyList_Check(tmp)) {
    3766           0 :                                 PyErr_Format(PyExc_TypeError, "Delete field \"targets\" must be a list, not a %.200s", tmp->ob_type->tp_name);
    3767           0 :                                 goto failed;
    3768             :                         }
    3769           0 :                         len = PyList_GET_SIZE(tmp);
    3770           0 :                         targets = asdl_seq_new(len, arena);
    3771           0 :                         if (targets == NULL) goto failed;
    3772           0 :                         for (i = 0; i < len; i++) {
    3773             :                                 expr_ty value;
    3774           0 :                                 res = obj2ast_expr(PyList_GET_ITEM(tmp, i), &value, arena);
    3775           0 :                                 if (res != 0) goto failed;
    3776           0 :                                 if (len != PyList_GET_SIZE(tmp)) {
    3777           0 :                                         PyErr_SetString(PyExc_RuntimeError, "Delete field \"targets\" changed size during iteration");
    3778           0 :                                         goto failed;
    3779             :                                 }
    3780           0 :                                 asdl_seq_SET(targets, i, value);
    3781             :                         }
    3782           0 :                         Py_XDECREF(tmp);
    3783           0 :                         tmp = NULL;
    3784             :                 } else {
    3785           0 :                         PyErr_SetString(PyExc_TypeError, "required field \"targets\" missing from Delete");
    3786           0 :                         return 1;
    3787             :                 }
    3788           0 :                 *out = Delete(targets, lineno, col_offset, arena);
    3789           0 :                 if (*out == NULL) goto failed;
    3790           0 :                 return 0;
    3791             :         }
    3792           0 :         isinstance = PyObject_IsInstance(obj, (PyObject*)Assign_type);
    3793           0 :         if (isinstance == -1) {
    3794           0 :                 return 1;
    3795             :         }
    3796           0 :         if (isinstance) {
    3797             :                 asdl_seq* targets;
    3798             :                 expr_ty value;
    3799             : 
    3800           0 :                 if (PyObject_HasAttrString(obj, "targets")) {
    3801             :                         int res;
    3802             :                         Py_ssize_t len;
    3803             :                         Py_ssize_t i;
    3804           0 :                         tmp = PyObject_GetAttrString(obj, "targets");
    3805           0 :                         if (tmp == NULL) goto failed;
    3806           0 :                         if (!PyList_Check(tmp)) {
    3807           0 :                                 PyErr_Format(PyExc_TypeError, "Assign field \"targets\" must be a list, not a %.200s", tmp->ob_type->tp_name);
    3808           0 :                                 goto failed;
    3809             :                         }
    3810           0 :                         len = PyList_GET_SIZE(tmp);
    3811           0 :                         targets = asdl_seq_new(len, arena);
    3812           0 :                         if (targets == NULL) goto failed;
    3813           0 :                         for (i = 0; i < len; i++) {
    3814             :                                 expr_ty value;
    3815           0 :                                 res = obj2ast_expr(PyList_GET_ITEM(tmp, i), &value, arena);
    3816           0 :                                 if (res != 0) goto failed;
    3817           0 :                                 if (len != PyList_GET_SIZE(tmp)) {
    3818           0 :                                         PyErr_SetString(PyExc_RuntimeError, "Assign field \"targets\" changed size during iteration");
    3819           0 :                                         goto failed;
    3820             :                                 }
    3821           0 :                                 asdl_seq_SET(targets, i, value);
    3822             :                         }
    3823           0 :                         Py_XDECREF(tmp);
    3824           0 :                         tmp = NULL;
    3825             :                 } else {
    3826           0 :                         PyErr_SetString(PyExc_TypeError, "required field \"targets\" missing from Assign");
    3827           0 :                         return 1;
    3828             :                 }
    3829           0 :                 if (PyObject_HasAttrString(obj, "value")) {
    3830             :                         int res;
    3831           0 :                         tmp = PyObject_GetAttrString(obj, "value");
    3832           0 :                         if (tmp == NULL) goto failed;
    3833           0 :                         res = obj2ast_expr(tmp, &value, arena);
    3834           0 :                         if (res != 0) goto failed;
    3835           0 :                         Py_XDECREF(tmp);
    3836           0 :                         tmp = NULL;
    3837             :                 } else {
    3838           0 :                         PyErr_SetString(PyExc_TypeError, "required field \"value\" missing from Assign");
    3839           0 :                         return 1;
    3840             :                 }
    3841           0 :                 *out = Assign(targets, value, lineno, col_offset, arena);
    3842           0 :                 if (*out == NULL) goto failed;
    3843           0 :                 return 0;
    3844             :         }
    3845           0 :         isinstance = PyObject_IsInstance(obj, (PyObject*)AugAssign_type);
    3846           0 :         if (isinstance == -1) {
    3847           0 :                 return 1;
    3848             :         }
    3849           0 :         if (isinstance) {
    3850             :                 expr_ty target;
    3851             :                 operator_ty op;
    3852             :                 expr_ty value;
    3853             : 
    3854           0 :                 if (PyObject_HasAttrString(obj, "target")) {
    3855             :                         int res;
    3856           0 :                         tmp = PyObject_GetAttrString(obj, "target");
    3857           0 :                         if (tmp == NULL) goto failed;
    3858           0 :                         res = obj2ast_expr(tmp, &target, arena);
    3859           0 :                         if (res != 0) goto failed;
    3860           0 :                         Py_XDECREF(tmp);
    3861           0 :                         tmp = NULL;
    3862             :                 } else {
    3863           0 :                         PyErr_SetString(PyExc_TypeError, "required field \"target\" missing from AugAssign");
    3864           0 :                         return 1;
    3865             :                 }
    3866           0 :                 if (PyObject_HasAttrString(obj, "op")) {
    3867             :                         int res;
    3868           0 :                         tmp = PyObject_GetAttrString(obj, "op");
    3869           0 :                         if (tmp == NULL) goto failed;
    3870           0 :                         res = obj2ast_operator(tmp, &op, arena);
    3871           0 :                         if (res != 0) goto failed;
    3872           0 :                         Py_XDECREF(tmp);
    3873           0 :                         tmp = NULL;
    3874             :                 } else {
    3875           0 :                         PyErr_SetString(PyExc_TypeError, "required field \"op\" missing from AugAssign");
    3876           0 :                         return 1;
    3877             :                 }
    3878           0 :                 if (PyObject_HasAttrString(obj, "value")) {
    3879             :                         int res;
    3880           0 :                         tmp = PyObject_GetAttrString(obj, "value");
    3881           0 :                         if (tmp == NULL) goto failed;
    3882           0 :                         res = obj2ast_expr(tmp, &value, arena);
    3883           0 :                         if (res != 0) goto failed;
    3884           0 :                         Py_XDECREF(tmp);
    3885           0 :                         tmp = NULL;
    3886             :                 } else {
    3887           0 :                         PyErr_SetString(PyExc_TypeError, "required field \"value\" missing from AugAssign");
    3888           0 :                         return 1;
    3889             :                 }
    3890           0 :                 *out = AugAssign(target, op, value, lineno, col_offset, arena);
    3891           0 :                 if (*out == NULL) goto failed;
    3892           0 :                 return 0;
    3893             :         }
    3894           0 :         isinstance = PyObject_IsInstance(obj, (PyObject*)Print_type);
    3895           0 :         if (isinstance == -1) {
    3896           0 :                 return 1;
    3897             :         }
    3898           0 :         if (isinstance) {
    3899             :                 expr_ty dest;
    3900             :                 asdl_seq* values;
    3901             :                 bool nl;
    3902             : 
    3903           0 :                 if (PyObject_HasAttrString(obj, "dest")) {
    3904             :                         int res;
    3905           0 :                         tmp = PyObject_GetAttrString(obj, "dest");
    3906           0 :                         if (tmp == NULL) goto failed;
    3907           0 :                         res = obj2ast_expr(tmp, &dest, arena);
    3908           0 :                         if (res != 0) goto failed;
    3909           0 :                         Py_XDECREF(tmp);
    3910           0 :                         tmp = NULL;
    3911             :                 } else {
    3912           0 :                         dest = NULL;
    3913             :                 }
    3914           0 :                 if (PyObject_HasAttrString(obj, "values")) {
    3915             :                         int res;
    3916             :                         Py_ssize_t len;
    3917             :                         Py_ssize_t i;
    3918           0 :                         tmp = PyObject_GetAttrString(obj, "values");
    3919           0 :                         if (tmp == NULL) goto failed;
    3920           0 :                         if (!PyList_Check(tmp)) {
    3921           0 :                                 PyErr_Format(PyExc_TypeError, "Print field \"values\" must be a list, not a %.200s", tmp->ob_type->tp_name);
    3922           0 :                                 goto failed;
    3923             :                         }
    3924           0 :                         len = PyList_GET_SIZE(tmp);
    3925           0 :                         values = asdl_seq_new(len, arena);
    3926           0 :                         if (values == NULL) goto failed;
    3927           0 :                         for (i = 0; i < len; i++) {
    3928             :                                 expr_ty value;
    3929           0 :                                 res = obj2ast_expr(PyList_GET_ITEM(tmp, i), &value, arena);
    3930           0 :                                 if (res != 0) goto failed;
    3931           0 :                                 if (len != PyList_GET_SIZE(tmp)) {
    3932           0 :                                         PyErr_SetString(PyExc_RuntimeError, "Print field \"values\" changed size during iteration");
    3933           0 :                                         goto failed;
    3934             :                                 }
    3935           0 :                                 asdl_seq_SET(values, i, value);
    3936             :                         }
    3937           0 :                         Py_XDECREF(tmp);
    3938           0 :                         tmp = NULL;
    3939             :                 } else {
    3940           0 :                         PyErr_SetString(PyExc_TypeError, "required field \"values\" missing from Print");
    3941           0 :                         return 1;
    3942             :                 }
    3943           0 :                 if (PyObject_HasAttrString(obj, "nl")) {
    3944             :                         int res;
    3945           0 :                         tmp = PyObject_GetAttrString(obj, "nl");
    3946           0 :                         if (tmp == NULL) goto failed;
    3947           0 :                         res = obj2ast_bool(tmp, &nl, arena);
    3948           0 :                         if (res != 0) goto failed;
    3949           0 :                         Py_XDECREF(tmp);
    3950           0 :                         tmp = NULL;
    3951             :                 } else {
    3952           0 :                         PyErr_SetString(PyExc_TypeError, "required field \"nl\" missing from Print");
    3953           0 :                         return 1;
    3954             :                 }
    3955           0 :                 *out = Print(dest, values, nl, lineno, col_offset, arena);
    3956           0 :                 if (*out == NULL) goto failed;
    3957           0 :                 return 0;
    3958             :         }
    3959           0 :         isinstance = PyObject_IsInstance(obj, (PyObject*)For_type);
    3960           0 :         if (isinstance == -1) {
    3961           0 :                 return 1;
    3962             :         }
    3963           0 :         if (isinstance) {
    3964             :                 expr_ty target;
    3965             :                 expr_ty iter;
    3966             :                 asdl_seq* body;
    3967             :                 asdl_seq* orelse;
    3968             : 
    3969           0 :                 if (PyObject_HasAttrString(obj, "target")) {
    3970             :                         int res;
    3971           0 :                         tmp = PyObject_GetAttrString(obj, "target");
    3972           0 :                         if (tmp == NULL) goto failed;
    3973           0 :                         res = obj2ast_expr(tmp, &target, arena);
    3974           0 :                         if (res != 0) goto failed;
    3975           0 :                         Py_XDECREF(tmp);
    3976           0 :                         tmp = NULL;
    3977             :                 } else {
    3978           0 :                         PyErr_SetString(PyExc_TypeError, "required field \"target\" missing from For");
    3979           0 :                         return 1;
    3980             :                 }
    3981           0 :                 if (PyObject_HasAttrString(obj, "iter")) {
    3982             :                         int res;
    3983           0 :                         tmp = PyObject_GetAttrString(obj, "iter");
    3984           0 :                         if (tmp == NULL) goto failed;
    3985           0 :                         res = obj2ast_expr(tmp, &iter, arena);
    3986           0 :                         if (res != 0) goto failed;
    3987           0 :                         Py_XDECREF(tmp);
    3988           0 :                         tmp = NULL;
    3989             :                 } else {
    3990           0 :                         PyErr_SetString(PyExc_TypeError, "required field \"iter\" missing from For");
    3991           0 :                         return 1;
    3992             :                 }
    3993           0 :                 if (PyObject_HasAttrString(obj, "body")) {
    3994             :                         int res;
    3995             :                         Py_ssize_t len;
    3996             :                         Py_ssize_t i;
    3997           0 :                         tmp = PyObject_GetAttrString(obj, "body");
    3998           0 :                         if (tmp == NULL) goto failed;
    3999           0 :                         if (!PyList_Check(tmp)) {
    4000           0 :                                 PyErr_Format(PyExc_TypeError, "For field \"body\" must be a list, not a %.200s", tmp->ob_type->tp_name);
    4001           0 :                                 goto failed;
    4002             :                         }
    4003           0 :                         len = PyList_GET_SIZE(tmp);
    4004           0 :                         body = asdl_seq_new(len, arena);
    4005           0 :                         if (body == NULL) goto failed;
    4006           0 :                         for (i = 0; i < len; i++) {
    4007             :                                 stmt_ty value;
    4008           0 :                                 res = obj2ast_stmt(PyList_GET_ITEM(tmp, i), &value, arena);
    4009           0 :                                 if (res != 0) goto failed;
    4010           0 :                                 if (len != PyList_GET_SIZE(tmp)) {
    4011           0 :                                         PyErr_SetString(PyExc_RuntimeError, "For field \"body\" changed size during iteration");
    4012           0 :                                         goto failed;
    4013             :                                 }
    4014           0 :                                 asdl_seq_SET(body, i, value);
    4015             :                         }
    4016           0 :                         Py_XDECREF(tmp);
    4017           0 :                         tmp = NULL;
    4018             :                 } else {
    4019           0 :                         PyErr_SetString(PyExc_TypeError, "required field \"body\" missing from For");
    4020           0 :                         return 1;
    4021             :                 }
    4022           0 :                 if (PyObject_HasAttrString(obj, "orelse")) {
    4023             :                         int res;
    4024             :                         Py_ssize_t len;
    4025             :                         Py_ssize_t i;
    4026           0 :                         tmp = PyObject_GetAttrString(obj, "orelse");
    4027           0 :                         if (tmp == NULL) goto failed;
    4028           0 :                         if (!PyList_Check(tmp)) {
    4029           0 :                                 PyErr_Format(PyExc_TypeError, "For field \"orelse\" must be a list, not a %.200s", tmp->ob_type->tp_name);
    4030           0 :                                 goto failed;
    4031             :                         }
    4032           0 :                         len = PyList_GET_SIZE(tmp);
    4033           0 :                         orelse = asdl_seq_new(len, arena);
    4034           0 :                         if (orelse == NULL) goto failed;
    4035           0 :                         for (i = 0; i < len; i++) {
    4036             :                                 stmt_ty value;
    4037           0 :                                 res = obj2ast_stmt(PyList_GET_ITEM(tmp, i), &value, arena);
    4038           0 :                                 if (res != 0) goto failed;
    4039           0 :                                 if (len != PyList_GET_SIZE(tmp)) {
    4040           0 :                                         PyErr_SetString(PyExc_RuntimeError, "For field \"orelse\" changed size during iteration");
    4041           0 :                                         goto failed;
    4042             :                                 }
    4043           0 :                                 asdl_seq_SET(orelse, i, value);
    4044             :                         }
    4045           0 :                         Py_XDECREF(tmp);
    4046           0 :                         tmp = NULL;
    4047             :                 } else {
    4048           0 :                         PyErr_SetString(PyExc_TypeError, "required field \"orelse\" missing from For");
    4049           0 :                         return 1;
    4050             :                 }
    4051           0 :                 *out = For(target, iter, body, orelse, lineno, col_offset,
    4052             :                            arena);
    4053           0 :                 if (*out == NULL) goto failed;
    4054           0 :                 return 0;
    4055             :         }
    4056           0 :         isinstance = PyObject_IsInstance(obj, (PyObject*)While_type);
    4057           0 :         if (isinstance == -1) {
    4058           0 :                 return 1;
    4059             :         }
    4060           0 :         if (isinstance) {
    4061             :                 expr_ty test;
    4062             :                 asdl_seq* body;
    4063             :                 asdl_seq* orelse;
    4064             : 
    4065           0 :                 if (PyObject_HasAttrString(obj, "test")) {
    4066             :                         int res;
    4067           0 :                         tmp = PyObject_GetAttrString(obj, "test");
    4068           0 :                         if (tmp == NULL) goto failed;
    4069           0 :                         res = obj2ast_expr(tmp, &test, arena);
    4070           0 :                         if (res != 0) goto failed;
    4071           0 :                         Py_XDECREF(tmp);
    4072           0 :                         tmp = NULL;
    4073             :                 } else {
    4074           0 :                         PyErr_SetString(PyExc_TypeError, "required field \"test\" missing from While");
    4075           0 :                         return 1;
    4076             :                 }
    4077           0 :                 if (PyObject_HasAttrString(obj, "body")) {
    4078             :                         int res;
    4079             :                         Py_ssize_t len;
    4080             :                         Py_ssize_t i;
    4081           0 :                         tmp = PyObject_GetAttrString(obj, "body");
    4082           0 :                         if (tmp == NULL) goto failed;
    4083           0 :                         if (!PyList_Check(tmp)) {
    4084           0 :                                 PyErr_Format(PyExc_TypeError, "While field \"body\" must be a list, not a %.200s", tmp->ob_type->tp_name);
    4085           0 :                                 goto failed;
    4086             :                         }
    4087           0 :                         len = PyList_GET_SIZE(tmp);
    4088           0 :                         body = asdl_seq_new(len, arena);
    4089           0 :                         if (body == NULL) goto failed;
    4090           0 :                         for (i = 0; i < len; i++) {
    4091             :                                 stmt_ty value;
    4092           0 :                                 res = obj2ast_stmt(PyList_GET_ITEM(tmp, i), &value, arena);
    4093           0 :                                 if (res != 0) goto failed;
    4094           0 :                                 if (len != PyList_GET_SIZE(tmp)) {
    4095           0 :                                         PyErr_SetString(PyExc_RuntimeError, "While field \"body\" changed size during iteration");
    4096           0 :                                         goto failed;
    4097             :                                 }
    4098           0 :                                 asdl_seq_SET(body, i, value);
    4099             :                         }
    4100           0 :                         Py_XDECREF(tmp);
    4101           0 :                         tmp = NULL;
    4102             :                 } else {
    4103           0 :                         PyErr_SetString(PyExc_TypeError, "required field \"body\" missing from While");
    4104           0 :                         return 1;
    4105             :                 }
    4106           0 :                 if (PyObject_HasAttrString(obj, "orelse")) {
    4107             :                         int res;
    4108             :                         Py_ssize_t len;
    4109             :                         Py_ssize_t i;
    4110           0 :                         tmp = PyObject_GetAttrString(obj, "orelse");
    4111           0 :                         if (tmp == NULL) goto failed;
    4112           0 :                         if (!PyList_Check(tmp)) {
    4113           0 :                                 PyErr_Format(PyExc_TypeError, "While field \"orelse\" must be a list, not a %.200s", tmp->ob_type->tp_name);
    4114           0 :                                 goto failed;
    4115             :                         }
    4116           0 :                         len = PyList_GET_SIZE(tmp);
    4117           0 :                         orelse = asdl_seq_new(len, arena);
    4118           0 :                         if (orelse == NULL) goto failed;
    4119           0 :                         for (i = 0; i < len; i++) {
    4120             :                                 stmt_ty value;
    4121           0 :                                 res = obj2ast_stmt(PyList_GET_ITEM(tmp, i), &value, arena);
    4122           0 :                                 if (res != 0) goto failed;
    4123           0 :                                 if (len != PyList_GET_SIZE(tmp)) {
    4124           0 :                                         PyErr_SetString(PyExc_RuntimeError, "While field \"orelse\" changed size during iteration");
    4125           0 :                                         goto failed;
    4126             :                                 }
    4127           0 :                                 asdl_seq_SET(orelse, i, value);
    4128             :                         }
    4129           0 :                         Py_XDECREF(tmp);
    4130           0 :                         tmp = NULL;
    4131             :                 } else {
    4132           0 :                         PyErr_SetString(PyExc_TypeError, "required field \"orelse\" missing from While");
    4133           0 :                         return 1;
    4134             :                 }
    4135           0 :                 *out = While(test, body, orelse, lineno, col_offset, arena);
    4136           0 :                 if (*out == NULL) goto failed;
    4137           0 :                 return 0;
    4138             :         }
    4139           0 :         isinstance = PyObject_IsInstance(obj, (PyObject*)If_type);
    4140           0 :         if (isinstance == -1) {
    4141           0 :                 return 1;
    4142             :         }
    4143           0 :         if (isinstance) {
    4144             :                 expr_ty test;
    4145             :                 asdl_seq* body;
    4146             :                 asdl_seq* orelse;
    4147             : 
    4148           0 :                 if (PyObject_HasAttrString(obj, "test")) {
    4149             :                         int res;
    4150           0 :                         tmp = PyObject_GetAttrString(obj, "test");
    4151           0 :                         if (tmp == NULL) goto failed;
    4152           0 :                         res = obj2ast_expr(tmp, &test, arena);
    4153           0 :                         if (res != 0) goto failed;
    4154           0 :                         Py_XDECREF(tmp);
    4155           0 :                         tmp = NULL;
    4156             :                 } else {
    4157           0 :                         PyErr_SetString(PyExc_TypeError, "required field \"test\" missing from If");
    4158           0 :                         return 1;
    4159             :                 }
    4160           0 :                 if (PyObject_HasAttrString(obj, "body")) {
    4161             :                         int res;
    4162             :                         Py_ssize_t len;
    4163             :                         Py_ssize_t i;
    4164           0 :                         tmp = PyObject_GetAttrString(obj, "body");
    4165           0 :                         if (tmp == NULL) goto failed;
    4166           0 :                         if (!PyList_Check(tmp)) {
    4167           0 :                                 PyErr_Format(PyExc_TypeError, "If field \"body\" must be a list, not a %.200s", tmp->ob_type->tp_name);
    4168           0 :                                 goto failed;
    4169             :                         }
    4170           0 :                         len = PyList_GET_SIZE(tmp);
    4171           0 :                         body = asdl_seq_new(len, arena);
    4172           0 :                         if (body == NULL) goto failed;
    4173           0 :                         for (i = 0; i < len; i++) {
    4174             :                                 stmt_ty value;
    4175           0 :                                 res = obj2ast_stmt(PyList_GET_ITEM(tmp, i), &value, arena);
    4176           0 :                                 if (res != 0) goto failed;
    4177           0 :                                 if (len != PyList_GET_SIZE(tmp)) {
    4178           0 :                                         PyErr_SetString(PyExc_RuntimeError, "If field \"body\" changed size during iteration");
    4179           0 :                                         goto failed;
    4180             :                                 }
    4181           0 :                                 asdl_seq_SET(body, i, value);
    4182             :                         }
    4183           0 :                         Py_XDECREF(tmp);
    4184           0 :                         tmp = NULL;
    4185             :                 } else {
    4186           0 :                         PyErr_SetString(PyExc_TypeError, "required field \"body\" missing from If");
    4187           0 :                         return 1;
    4188             :                 }
    4189           0 :                 if (PyObject_HasAttrString(obj, "orelse")) {
    4190             :                         int res;
    4191             :                         Py_ssize_t len;
    4192             :                         Py_ssize_t i;
    4193           0 :                         tmp = PyObject_GetAttrString(obj, "orelse");
    4194           0 :                         if (tmp == NULL) goto failed;
    4195           0 :                         if (!PyList_Check(tmp)) {
    4196           0 :                                 PyErr_Format(PyExc_TypeError, "If field \"orelse\" must be a list, not a %.200s", tmp->ob_type->tp_name);
    4197           0 :                                 goto failed;
    4198             :                         }
    4199           0 :                         len = PyList_GET_SIZE(tmp);
    4200           0 :                         orelse = asdl_seq_new(len, arena);
    4201           0 :                         if (orelse == NULL) goto failed;
    4202           0 :                         for (i = 0; i < len; i++) {
    4203             :                                 stmt_ty value;
    4204           0 :                                 res = obj2ast_stmt(PyList_GET_ITEM(tmp, i), &value, arena);
    4205           0 :                                 if (res != 0) goto failed;
    4206           0 :                                 if (len != PyList_GET_SIZE(tmp)) {
    4207           0 :                                         PyErr_SetString(PyExc_RuntimeError, "If field \"orelse\" changed size during iteration");
    4208           0 :                                         goto failed;
    4209             :                                 }
    4210           0 :                                 asdl_seq_SET(orelse, i, value);
    4211             :                         }
    4212           0 :                         Py_XDECREF(tmp);
    4213           0 :                         tmp = NULL;
    4214             :                 } else {
    4215           0 :                         PyErr_SetString(PyExc_TypeError, "required field \"orelse\" missing from If");
    4216           0 :                         return 1;
    4217             :                 }
    4218           0 :                 *out = If(test, body, orelse, lineno, col_offset, arena);
    4219           0 :                 if (*out == NULL) goto failed;
    4220           0 :                 return 0;
    4221             :         }
    4222           0 :         isinstance = PyObject_IsInstance(obj, (PyObject*)With_type);
    4223           0 :         if (isinstance == -1) {
    4224           0 :                 return 1;
    4225             :         }
    4226           0 :         if (isinstance) {
    4227             :                 expr_ty context_expr;
    4228             :                 expr_ty optional_vars;
    4229             :                 asdl_seq* body;
    4230             : 
    4231           0 :                 if (PyObject_HasAttrString(obj, "context_expr")) {
    4232             :                         int res;
    4233           0 :                         tmp = PyObject_GetAttrString(obj, "context_expr");
    4234           0 :                         if (tmp == NULL) goto failed;
    4235           0 :                         res = obj2ast_expr(tmp, &context_expr, arena);
    4236           0 :                         if (res != 0) goto failed;
    4237           0 :                         Py_XDECREF(tmp);
    4238           0 :                         tmp = NULL;
    4239             :                 } else {
    4240           0 :                         PyErr_SetString(PyExc_TypeError, "required field \"context_expr\" missing from With");
    4241           0 :                         return 1;
    4242             :                 }
    4243           0 :                 if (PyObject_HasAttrString(obj, "optional_vars")) {
    4244             :                         int res;
    4245           0 :                         tmp = PyObject_GetAttrString(obj, "optional_vars");
    4246           0 :                         if (tmp == NULL) goto failed;
    4247           0 :                         res = obj2ast_expr(tmp, &optional_vars, arena);
    4248           0 :                         if (res != 0) goto failed;
    4249           0 :                         Py_XDECREF(tmp);
    4250           0 :                         tmp = NULL;
    4251             :                 } else {
    4252           0 :                         optional_vars = NULL;
    4253             :                 }
    4254           0 :                 if (PyObject_HasAttrString(obj, "body")) {
    4255             :                         int res;
    4256             :                         Py_ssize_t len;
    4257             :                         Py_ssize_t i;
    4258           0 :                         tmp = PyObject_GetAttrString(obj, "body");
    4259           0 :                         if (tmp == NULL) goto failed;
    4260           0 :                         if (!PyList_Check(tmp)) {
    4261           0 :                                 PyErr_Format(PyExc_TypeError, "With field \"body\" must be a list, not a %.200s", tmp->ob_type->tp_name);
    4262           0 :                                 goto failed;
    4263             :                         }
    4264           0 :                         len = PyList_GET_SIZE(tmp);
    4265           0 :                         body = asdl_seq_new(len, arena);
    4266           0 :                         if (body == NULL) goto failed;
    4267           0 :                         for (i = 0; i < len; i++) {
    4268             :                                 stmt_ty value;
    4269           0 :                                 res = obj2ast_stmt(PyList_GET_ITEM(tmp, i), &value, arena);
    4270           0 :                                 if (res != 0) goto failed;
    4271           0 :                                 if (len != PyList_GET_SIZE(tmp)) {
    4272           0 :                                         PyErr_SetString(PyExc_RuntimeError, "With field \"body\" changed size during iteration");
    4273           0 :                                         goto failed;
    4274             :                                 }
    4275           0 :                                 asdl_seq_SET(body, i, value);
    4276             :                         }
    4277           0 :                         Py_XDECREF(tmp);
    4278           0 :                         tmp = NULL;
    4279             :                 } else {
    4280           0 :                         PyErr_SetString(PyExc_TypeError, "required field \"body\" missing from With");
    4281           0 :                         return 1;
    4282             :                 }
    4283           0 :                 *out = With(context_expr, optional_vars, body, lineno,
    4284             :                             col_offset, arena);
    4285           0 :                 if (*out == NULL) goto failed;
    4286           0 :                 return 0;
    4287             :         }
    4288           0 :         isinstance = PyObject_IsInstance(obj, (PyObject*)Raise_type);
    4289           0 :         if (isinstance == -1) {
    4290           0 :                 return 1;
    4291             :         }
    4292           0 :         if (isinstance) {
    4293             :                 expr_ty type;
    4294             :                 expr_ty inst;
    4295             :                 expr_ty tback;
    4296             : 
    4297           0 :                 if (PyObject_HasAttrString(obj, "type")) {
    4298             :                         int res;
    4299           0 :                         tmp = PyObject_GetAttrString(obj, "type");
    4300           0 :                         if (tmp == NULL) goto failed;
    4301           0 :                         res = obj2ast_expr(tmp, &type, arena);
    4302           0 :                         if (res != 0) goto failed;
    4303           0 :                         Py_XDECREF(tmp);
    4304           0 :                         tmp = NULL;
    4305             :                 } else {
    4306           0 :                         type = NULL;
    4307             :                 }
    4308           0 :                 if (PyObject_HasAttrString(obj, "inst")) {
    4309             :                         int res;
    4310           0 :                         tmp = PyObject_GetAttrString(obj, "inst");
    4311           0 :                         if (tmp == NULL) goto failed;
    4312           0 :                         res = obj2ast_expr(tmp, &inst, arena);
    4313           0 :                         if (res != 0) goto failed;
    4314           0 :                         Py_XDECREF(tmp);
    4315           0 :                         tmp = NULL;
    4316             :                 } else {
    4317           0 :                         inst = NULL;
    4318             :                 }
    4319           0 :                 if (PyObject_HasAttrString(obj, "tback")) {
    4320             :                         int res;
    4321           0 :                         tmp = PyObject_GetAttrString(obj, "tback");
    4322           0 :                         if (tmp == NULL) goto failed;
    4323           0 :                         res = obj2ast_expr(tmp, &tback, arena);
    4324           0 :                         if (res != 0) goto failed;
    4325           0 :                         Py_XDECREF(tmp);
    4326           0 :                         tmp = NULL;
    4327             :                 } else {
    4328           0 :                         tback = NULL;
    4329             :                 }
    4330           0 :                 *out = Raise(type, inst, tback, lineno, col_offset, arena);
    4331           0 :                 if (*out == NULL) goto failed;
    4332           0 :                 return 0;
    4333             :         }
    4334           0 :         isinstance = PyObject_IsInstance(obj, (PyObject*)TryExcept_type);
    4335           0 :         if (isinstance == -1) {
    4336           0 :                 return 1;
    4337             :         }
    4338           0 :         if (isinstance) {
    4339             :                 asdl_seq* body;
    4340             :                 asdl_seq* handlers;
    4341             :                 asdl_seq* orelse;
    4342             : 
    4343           0 :                 if (PyObject_HasAttrString(obj, "body")) {
    4344             :                         int res;
    4345             :                         Py_ssize_t len;
    4346             :                         Py_ssize_t i;
    4347           0 :                         tmp = PyObject_GetAttrString(obj, "body");
    4348           0 :                         if (tmp == NULL) goto failed;
    4349           0 :                         if (!PyList_Check(tmp)) {
    4350           0 :                                 PyErr_Format(PyExc_TypeError, "TryExcept field \"body\" must be a list, not a %.200s", tmp->ob_type->tp_name);
    4351           0 :                                 goto failed;
    4352             :                         }
    4353           0 :                         len = PyList_GET_SIZE(tmp);
    4354           0 :                         body = asdl_seq_new(len, arena);
    4355           0 :                         if (body == NULL) goto failed;
    4356           0 :                         for (i = 0; i < len; i++) {
    4357             :                                 stmt_ty value;
    4358           0 :                                 res = obj2ast_stmt(PyList_GET_ITEM(tmp, i), &value, arena);
    4359           0 :                                 if (res != 0) goto failed;
    4360           0 :                                 if (len != PyList_GET_SIZE(tmp)) {
    4361           0 :                                         PyErr_SetString(PyExc_RuntimeError, "TryExcept field \"body\" changed size during iteration");
    4362           0 :                                         goto failed;
    4363             :                                 }
    4364           0 :                                 asdl_seq_SET(body, i, value);
    4365             :                         }
    4366           0 :                         Py_XDECREF(tmp);
    4367           0 :                         tmp = NULL;
    4368             :                 } else {
    4369           0 :                         PyErr_SetString(PyExc_TypeError, "required field \"body\" missing from TryExcept");
    4370           0 :                         return 1;
    4371             :                 }
    4372           0 :                 if (PyObject_HasAttrString(obj, "handlers")) {
    4373             :                         int res;
    4374             :                         Py_ssize_t len;
    4375             :                         Py_ssize_t i;
    4376           0 :                         tmp = PyObject_GetAttrString(obj, "handlers");
    4377           0 :                         if (tmp == NULL) goto failed;
    4378           0 :                         if (!PyList_Check(tmp)) {
    4379           0 :                                 PyErr_Format(PyExc_TypeError, "TryExcept field \"handlers\" must be a list, not a %.200s", tmp->ob_type->tp_name);
    4380           0 :                                 goto failed;
    4381             :                         }
    4382           0 :                         len = PyList_GET_SIZE(tmp);
    4383           0 :                         handlers = asdl_seq_new(len, arena);
    4384           0 :                         if (handlers == NULL) goto failed;
    4385           0 :                         for (i = 0; i < len; i++) {
    4386             :                                 excepthandler_ty value;
    4387           0 :                                 res = obj2ast_excepthandler(PyList_GET_ITEM(tmp, i), &value, arena);
    4388           0 :                                 if (res != 0) goto failed;
    4389           0 :                                 if (len != PyList_GET_SIZE(tmp)) {
    4390           0 :                                         PyErr_SetString(PyExc_RuntimeError, "TryExcept field \"handlers\" changed size during iteration");
    4391           0 :                                         goto failed;
    4392             :                                 }
    4393           0 :                                 asdl_seq_SET(handlers, i, value);
    4394             :                         }
    4395           0 :                         Py_XDECREF(tmp);
    4396           0 :                         tmp = NULL;
    4397             :                 } else {
    4398           0 :                         PyErr_SetString(PyExc_TypeError, "required field \"handlers\" missing from TryExcept");
    4399           0 :                         return 1;
    4400             :                 }
    4401           0 :                 if (PyObject_HasAttrString(obj, "orelse")) {
    4402             :                         int res;
    4403             :                         Py_ssize_t len;
    4404             :                         Py_ssize_t i;
    4405           0 :                         tmp = PyObject_GetAttrString(obj, "orelse");
    4406           0 :                         if (tmp == NULL) goto failed;
    4407           0 :                         if (!PyList_Check(tmp)) {
    4408           0 :                                 PyErr_Format(PyExc_TypeError, "TryExcept field \"orelse\" must be a list, not a %.200s", tmp->ob_type->tp_name);
    4409           0 :                                 goto failed;
    4410             :                         }
    4411           0 :                         len = PyList_GET_SIZE(tmp);
    4412           0 :                         orelse = asdl_seq_new(len, arena);
    4413           0 :                         if (orelse == NULL) goto failed;
    4414           0 :                         for (i = 0; i < len; i++) {
    4415             :                                 stmt_ty value;
    4416           0 :                                 res = obj2ast_stmt(PyList_GET_ITEM(tmp, i), &value, arena);
    4417           0 :                                 if (res != 0) goto failed;
    4418           0 :                                 if (len != PyList_GET_SIZE(tmp)) {
    4419           0 :                                         PyErr_SetString(PyExc_RuntimeError, "TryExcept field \"orelse\" changed size during iteration");
    4420           0 :                                         goto failed;
    4421             :                                 }
    4422           0 :                                 asdl_seq_SET(orelse, i, value);
    4423             :                         }
    4424           0 :                         Py_XDECREF(tmp);
    4425           0 :                         tmp = NULL;
    4426             :                 } else {
    4427           0 :                         PyErr_SetString(PyExc_TypeError, "required field \"orelse\" missing from TryExcept");
    4428           0 :                         return 1;
    4429             :                 }
    4430           0 :                 *out = TryExcept(body, handlers, orelse, lineno, col_offset,
    4431             :                                  arena);
    4432           0 :                 if (*out == NULL) goto failed;
    4433           0 :                 return 0;
    4434             :         }
    4435           0 :         isinstance = PyObject_IsInstance(obj, (PyObject*)TryFinally_type);
    4436           0 :         if (isinstance == -1) {
    4437           0 :                 return 1;
    4438             :         }
    4439           0 :         if (isinstance) {
    4440             :                 asdl_seq* body;
    4441             :                 asdl_seq* finalbody;
    4442             : 
    4443           0 :                 if (PyObject_HasAttrString(obj, "body")) {
    4444             :                         int res;
    4445             :                         Py_ssize_t len;
    4446             :                         Py_ssize_t i;
    4447           0 :                         tmp = PyObject_GetAttrString(obj, "body");
    4448           0 :                         if (tmp == NULL) goto failed;
    4449           0 :                         if (!PyList_Check(tmp)) {
    4450           0 :                                 PyErr_Format(PyExc_TypeError, "TryFinally field \"body\" must be a list, not a %.200s", tmp->ob_type->tp_name);
    4451           0 :                                 goto failed;
    4452             :                         }
    4453           0 :                         len = PyList_GET_SIZE(tmp);
    4454           0 :                         body = asdl_seq_new(len, arena);
    4455           0 :                         if (body == NULL) goto failed;
    4456           0 :                         for (i = 0; i < len; i++) {
    4457             :                                 stmt_ty value;
    4458           0 :                                 res = obj2ast_stmt(PyList_GET_ITEM(tmp, i), &value, arena);
    4459           0 :                                 if (res != 0) goto failed;
    4460           0 :                                 if (len != PyList_GET_SIZE(tmp)) {
    4461           0 :                                         PyErr_SetString(PyExc_RuntimeError, "TryFinally field \"body\" changed size during iteration");
    4462           0 :                                         goto failed;
    4463             :                                 }
    4464           0 :                                 asdl_seq_SET(body, i, value);
    4465             :                         }
    4466           0 :                         Py_XDECREF(tmp);
    4467           0 :                         tmp = NULL;
    4468             :                 } else {
    4469           0 :                         PyErr_SetString(PyExc_TypeError, "required field \"body\" missing from TryFinally");
    4470           0 :                         return 1;
    4471             :                 }
    4472           0 :                 if (PyObject_HasAttrString(obj, "finalbody")) {
    4473             :                         int res;
    4474             :                         Py_ssize_t len;
    4475             :                         Py_ssize_t i;
    4476           0 :                         tmp = PyObject_GetAttrString(obj, "finalbody");
    4477           0 :                         if (tmp == NULL) goto failed;
    4478           0 :                         if (!PyList_Check(tmp)) {
    4479           0 :                                 PyErr_Format(PyExc_TypeError, "TryFinally field \"finalbody\" must be a list, not a %.200s", tmp->ob_type->tp_name);
    4480           0 :                                 goto failed;
    4481             :                         }
    4482           0 :                         len = PyList_GET_SIZE(tmp);
    4483           0 :                         finalbody = asdl_seq_new(len, arena);
    4484           0 :                         if (finalbody == NULL) goto failed;
    4485           0 :                         for (i = 0; i < len; i++) {
    4486             :                                 stmt_ty value;
    4487           0 :                                 res = obj2ast_stmt(PyList_GET_ITEM(tmp, i), &value, arena);
    4488           0 :                                 if (res != 0) goto failed;
    4489           0 :                                 if (len != PyList_GET_SIZE(tmp)) {
    4490           0 :                                         PyErr_SetString(PyExc_RuntimeError, "TryFinally field \"finalbody\" changed size during iteration");
    4491           0 :                                         goto failed;
    4492             :                                 }
    4493           0 :                                 asdl_seq_SET(finalbody, i, value);
    4494             :                         }
    4495           0 :                         Py_XDECREF(tmp);
    4496           0 :                         tmp = NULL;
    4497             :                 } else {
    4498           0 :                         PyErr_SetString(PyExc_TypeError, "required field \"finalbody\" missing from TryFinally");
    4499           0 :                         return 1;
    4500             :                 }
    4501           0 :                 *out = TryFinally(body, finalbody, lineno, col_offset, arena);
    4502           0 :                 if (*out == NULL) goto failed;
    4503           0 :                 return 0;
    4504             :         }
    4505           0 :         isinstance = PyObject_IsInstance(obj, (PyObject*)Assert_type);
    4506           0 :         if (isinstance == -1) {
    4507           0 :                 return 1;
    4508             :         }
    4509           0 :         if (isinstance) {
    4510             :                 expr_ty test;
    4511             :                 expr_ty msg;
    4512             : 
    4513           0 :                 if (PyObject_HasAttrString(obj, "test")) {
    4514             :                         int res;
    4515           0 :                         tmp = PyObject_GetAttrString(obj, "test");
    4516           0 :                         if (tmp == NULL) goto failed;
    4517           0 :                         res = obj2ast_expr(tmp, &test, arena);
    4518           0 :                         if (res != 0) goto failed;
    4519           0 :                         Py_XDECREF(tmp);
    4520           0 :                         tmp = NULL;
    4521             :                 } else {
    4522           0 :                         PyErr_SetString(PyExc_TypeError, "required field \"test\" missing from Assert");
    4523           0 :                         return 1;
    4524             :                 }
    4525           0 :                 if (PyObject_HasAttrString(obj, "msg")) {
    4526             :                         int res;
    4527           0 :                         tmp = PyObject_GetAttrString(obj, "msg");
    4528           0 :                         if (tmp == NULL) goto failed;
    4529           0 :                         res = obj2ast_expr(tmp, &msg, arena);
    4530           0 :                         if (res != 0) goto failed;
    4531           0 :                         Py_XDECREF(tmp);
    4532           0 :                         tmp = NULL;
    4533             :                 } else {
    4534           0 :                         msg = NULL;
    4535             :                 }
    4536           0 :                 *out = Assert(test, msg, lineno, col_offset, arena);
    4537           0 :                 if (*out == NULL) goto failed;
    4538           0 :                 return 0;
    4539             :         }
    4540           0 :         isinstance = PyObject_IsInstance(obj, (PyObject*)Import_type);
    4541           0 :         if (isinstance == -1) {
    4542           0 :                 return 1;
    4543             :         }
    4544           0 :         if (isinstance) {
    4545             :                 asdl_seq* names;
    4546             : 
    4547           0 :                 if (PyObject_HasAttrString(obj, "names")) {
    4548             :                         int res;
    4549             :                         Py_ssize_t len;
    4550             :                         Py_ssize_t i;
    4551           0 :                         tmp = PyObject_GetAttrString(obj, "names");
    4552           0 :                         if (tmp == NULL) goto failed;
    4553           0 :                         if (!PyList_Check(tmp)) {
    4554           0 :                                 PyErr_Format(PyExc_TypeError, "Import field \"names\" must be a list, not a %.200s", tmp->ob_type->tp_name);
    4555           0 :                                 goto failed;
    4556             :                         }
    4557           0 :                         len = PyList_GET_SIZE(tmp);
    4558           0 :                         names = asdl_seq_new(len, arena);
    4559           0 :                         if (names == NULL) goto failed;
    4560           0 :                         for (i = 0; i < len; i++) {
    4561             :                                 alias_ty value;
    4562           0 :                                 res = obj2ast_alias(PyList_GET_ITEM(tmp, i), &value, arena);
    4563           0 :                                 if (res != 0) goto failed;
    4564           0 :                                 if (len != PyList_GET_SIZE(tmp)) {
    4565           0 :                                         PyErr_SetString(PyExc_RuntimeError, "Import field \"names\" changed size during iteration");
    4566           0 :                                         goto failed;
    4567             :                                 }
    4568           0 :                                 asdl_seq_SET(names, i, value);
    4569             :                         }
    4570           0 :                         Py_XDECREF(tmp);
    4571           0 :                         tmp = NULL;
    4572             :                 } else {
    4573           0 :                         PyErr_SetString(PyExc_TypeError, "required field \"names\" missing from Import");
    4574           0 :                         return 1;
    4575             :                 }
    4576           0 :                 *out = Import(names, lineno, col_offset, arena);
    4577           0 :                 if (*out == NULL) goto failed;
    4578           0 :                 return 0;
    4579             :         }
    4580           0 :         isinstance = PyObject_IsInstance(obj, (PyObject*)ImportFrom_type);
    4581           0 :         if (isinstance == -1) {
    4582           0 :                 return 1;
    4583             :         }
    4584           0 :         if (isinstance) {
    4585             :                 identifier module;
    4586             :                 asdl_seq* names;
    4587             :                 int level;
    4588             : 
    4589           0 :                 if (PyObject_HasAttrString(obj, "module")) {
    4590             :                         int res;
    4591           0 :                         tmp = PyObject_GetAttrString(obj, "module");
    4592           0 :                         if (tmp == NULL) goto failed;
    4593           0 :                         res = obj2ast_identifier(tmp, &module, arena);
    4594           0 :                         if (res != 0) goto failed;
    4595           0 :                         Py_XDECREF(tmp);
    4596           0 :                         tmp = NULL;
    4597             :                 } else {
    4598           0 :                         module = NULL;
    4599             :                 }
    4600           0 :                 if (PyObject_HasAttrString(obj, "names")) {
    4601             :                         int res;
    4602             :                         Py_ssize_t len;
    4603             :                         Py_ssize_t i;
    4604           0 :                         tmp = PyObject_GetAttrString(obj, "names");
    4605           0 :                         if (tmp == NULL) goto failed;
    4606           0 :                         if (!PyList_Check(tmp)) {
    4607           0 :                                 PyErr_Format(PyExc_TypeError, "ImportFrom field \"names\" must be a list, not a %.200s", tmp->ob_type->tp_name);
    4608           0 :                                 goto failed;
    4609             :                         }
    4610           0 :                         len = PyList_GET_SIZE(tmp);
    4611           0 :                         names = asdl_seq_new(len, arena);
    4612           0 :                         if (names == NULL) goto failed;
    4613           0 :                         for (i = 0; i < len; i++) {
    4614             :                                 alias_ty value;
    4615           0 :                                 res = obj2ast_alias(PyList_GET_ITEM(tmp, i), &value, arena);
    4616           0 :                                 if (res != 0) goto failed;
    4617           0 :                                 if (len != PyList_GET_SIZE(tmp)) {
    4618           0 :                                         PyErr_SetString(PyExc_RuntimeError, "ImportFrom field \"names\" changed size during iteration");
    4619           0 :                                         goto failed;
    4620             :                                 }
    4621           0 :                                 asdl_seq_SET(names, i, value);
    4622             :                         }
    4623           0 :                         Py_XDECREF(tmp);
    4624           0 :                         tmp = NULL;
    4625             :                 } else {
    4626           0 :                         PyErr_SetString(PyExc_TypeError, "required field \"names\" missing from ImportFrom");
    4627           0 :                         return 1;
    4628             :                 }
    4629           0 :                 if (PyObject_HasAttrString(obj, "level")) {
    4630             :                         int res;
    4631           0 :                         tmp = PyObject_GetAttrString(obj, "level");
    4632           0 :                         if (tmp == NULL) goto failed;
    4633           0 :                         res = obj2ast_int(tmp, &level, arena);
    4634           0 :                         if (res != 0) goto failed;
    4635           0 :                         Py_XDECREF(tmp);
    4636           0 :                         tmp = NULL;
    4637             :                 } else {
    4638           0 :                         level = 0;
    4639             :                 }
    4640           0 :                 *out = ImportFrom(module, names, level, lineno, col_offset,
    4641             :                                   arena);
    4642           0 :                 if (*out == NULL) goto failed;
    4643           0 :                 return 0;
    4644             :         }
    4645           0 :         isinstance = PyObject_IsInstance(obj, (PyObject*)Exec_type);
    4646           0 :         if (isinstance == -1) {
    4647           0 :                 return 1;
    4648             :         }
    4649           0 :         if (isinstance) {
    4650             :                 expr_ty body;
    4651             :                 expr_ty globals;
    4652             :                 expr_ty locals;
    4653             : 
    4654           0 :                 if (PyObject_HasAttrString(obj, "body")) {
    4655             :                         int res;
    4656           0 :                         tmp = PyObject_GetAttrString(obj, "body");
    4657           0 :                         if (tmp == NULL) goto failed;
    4658           0 :                         res = obj2ast_expr(tmp, &body, arena);
    4659           0 :                         if (res != 0) goto failed;
    4660           0 :                         Py_XDECREF(tmp);
    4661           0 :                         tmp = NULL;
    4662             :                 } else {
    4663           0 :                         PyErr_SetString(PyExc_TypeError, "required field \"body\" missing from Exec");
    4664           0 :                         return 1;
    4665             :                 }
    4666           0 :                 if (PyObject_HasAttrString(obj, "globals")) {
    4667             :                         int res;
    4668           0 :                         tmp = PyObject_GetAttrString(obj, "globals");
    4669           0 :                         if (tmp == NULL) goto failed;
    4670           0 :                         res = obj2ast_expr(tmp, &globals, arena);
    4671           0 :                         if (res != 0) goto failed;
    4672           0 :                         Py_XDECREF(tmp);
    4673           0 :                         tmp = NULL;
    4674             :                 } else {
    4675           0 :                         globals = NULL;
    4676             :                 }
    4677           0 :                 if (PyObject_HasAttrString(obj, "locals")) {
    4678             :                         int res;
    4679           0 :                         tmp = PyObject_GetAttrString(obj, "locals");
    4680           0 :                         if (tmp == NULL) goto failed;
    4681           0 :                         res = obj2ast_expr(tmp, &locals, arena);
    4682           0 :                         if (res != 0) goto failed;
    4683           0 :                         Py_XDECREF(tmp);
    4684           0 :                         tmp = NULL;
    4685             :                 } else {
    4686           0 :                         locals = NULL;
    4687             :                 }
    4688           0 :                 *out = Exec(body, globals, locals, lineno, col_offset, arena);
    4689           0 :                 if (*out == NULL) goto failed;
    4690           0 :                 return 0;
    4691             :         }
    4692           0 :         isinstance = PyObject_IsInstance(obj, (PyObject*)Global_type);
    4693           0 :         if (isinstance == -1) {
    4694           0 :                 return 1;
    4695             :         }
    4696           0 :         if (isinstance) {
    4697             :                 asdl_seq* names;
    4698             : 
    4699           0 :                 if (PyObject_HasAttrString(obj, "names")) {
    4700             :                         int res;
    4701             :                         Py_ssize_t len;
    4702             :                         Py_ssize_t i;
    4703           0 :                         tmp = PyObject_GetAttrString(obj, "names");
    4704           0 :                         if (tmp == NULL) goto failed;
    4705           0 :                         if (!PyList_Check(tmp)) {
    4706           0 :                                 PyErr_Format(PyExc_TypeError, "Global field \"names\" must be a list, not a %.200s", tmp->ob_type->tp_name);
    4707           0 :                                 goto failed;
    4708             :                         }
    4709           0 :                         len = PyList_GET_SIZE(tmp);
    4710           0 :                         names = asdl_seq_new(len, arena);
    4711           0 :                         if (names == NULL) goto failed;
    4712           0 :                         for (i = 0; i < len; i++) {
    4713             :                                 identifier value;
    4714           0 :                                 res = obj2ast_identifier(PyList_GET_ITEM(tmp, i), &value, arena);
    4715           0 :                                 if (res != 0) goto failed;
    4716           0 :                                 if (len != PyList_GET_SIZE(tmp)) {
    4717           0 :                                         PyErr_SetString(PyExc_RuntimeError, "Global field \"names\" changed size during iteration");
    4718           0 :                                         goto failed;
    4719             :                                 }
    4720           0 :                                 asdl_seq_SET(names, i, value);
    4721             :                         }
    4722           0 :                         Py_XDECREF(tmp);
    4723           0 :                         tmp = NULL;
    4724             :                 } else {
    4725           0 :                         PyErr_SetString(PyExc_TypeError, "required field \"names\" missing from Global");
    4726           0 :                         return 1;
    4727             :                 }
    4728           0 :                 *out = Global(names, lineno, col_offset, arena);
    4729           0 :                 if (*out == NULL) goto failed;
    4730           0 :                 return 0;
    4731             :         }
    4732           0 :         isinstance = PyObject_IsInstance(obj, (PyObject*)Expr_type);
    4733           0 :         if (isinstance == -1) {
    4734           0 :                 return 1;
    4735             :         }
    4736           0 :         if (isinstance) {
    4737             :                 expr_ty value;
    4738             : 
    4739           0 :                 if (PyObject_HasAttrString(obj, "value")) {
    4740             :                         int res;
    4741           0 :                         tmp = PyObject_GetAttrString(obj, "value");
    4742           0 :                         if (tmp == NULL) goto failed;
    4743           0 :                         res = obj2ast_expr(tmp, &value, arena);
    4744           0 :                         if (res != 0) goto failed;
    4745           0 :                         Py_XDECREF(tmp);
    4746           0 :                         tmp = NULL;
    4747             :                 } else {
    4748           0 :                         PyErr_SetString(PyExc_TypeError, "required field \"value\" missing from Expr");
    4749           0 :                         return 1;
    4750             :                 }
    4751           0 :                 *out = Expr(value, lineno, col_offset, arena);
    4752           0 :                 if (*out == NULL) goto failed;
    4753           0 :                 return 0;
    4754             :         }
    4755           0 :         isinstance = PyObject_IsInstance(obj, (PyObject*)Pass_type);
    4756           0 :         if (isinstance == -1) {
    4757           0 :                 return 1;
    4758             :         }
    4759           0 :         if (isinstance) {
    4760             : 
    4761           0 :                 *out = Pass(lineno, col_offset, arena);
    4762           0 :                 if (*out == NULL) goto failed;
    4763           0 :                 return 0;
    4764             :         }
    4765           0 :         isinstance = PyObject_IsInstance(obj, (PyObject*)Break_type);
    4766           0 :         if (isinstance == -1) {
    4767           0 :                 return 1;
    4768             :         }
    4769           0 :         if (isinstance) {
    4770             : 
    4771           0 :                 *out = Break(lineno, col_offset, arena);
    4772           0 :                 if (*out == NULL) goto failed;
    4773           0 :                 return 0;
    4774             :         }
    4775           0 :         isinstance = PyObject_IsInstance(obj, (PyObject*)Continue_type);
    4776           0 :         if (isinstance == -1) {
    4777           0 :                 return 1;
    4778             :         }
    4779           0 :         if (isinstance) {
    4780             : 
    4781           0 :                 *out = Continue(lineno, col_offset, arena);
    4782           0 :                 if (*out == NULL) goto failed;
    4783           0 :                 return 0;
    4784             :         }
    4785             : 
    4786           0 :         tmp = PyObject_Repr(obj);
    4787           0 :         if (tmp == NULL) goto failed;
    4788           0 :         PyErr_Format(PyExc_TypeError, "expected some sort of stmt, but got %.400s", PyString_AS_STRING(tmp));
    4789             : failed:
    4790           0 :         Py_XDECREF(tmp);
    4791           0 :         return 1;
    4792             : }
    4793             : 
    4794             : int
    4795           0 : obj2ast_expr(PyObject* obj, expr_ty* out, PyArena* arena)
    4796             : {
    4797           0 :         PyObject* tmp = NULL;
    4798             :         int isinstance;
    4799             : 
    4800             :         int lineno;
    4801             :         int col_offset;
    4802             : 
    4803           0 :         if (obj == Py_None) {
    4804           0 :                 *out = NULL;
    4805           0 :                 return 0;
    4806             :         }
    4807           0 :         if (PyObject_HasAttrString(obj, "lineno")) {
    4808             :                 int res;
    4809           0 :                 tmp = PyObject_GetAttrString(obj, "lineno");
    4810           0 :                 if (tmp == NULL) goto failed;
    4811           0 :                 res = obj2ast_int(tmp, &lineno, arena);
    4812           0 :                 if (res != 0) goto failed;
    4813           0 :                 Py_XDECREF(tmp);
    4814           0 :                 tmp = NULL;
    4815             :         } else {
    4816           0 :                 PyErr_SetString(PyExc_TypeError, "required field \"lineno\" missing from expr");
    4817           0 :                 return 1;
    4818             :         }
    4819           0 :         if (PyObject_HasAttrString(obj, "col_offset")) {
    4820             :                 int res;
    4821           0 :                 tmp = PyObject_GetAttrString(obj, "col_offset");
    4822           0 :                 if (tmp == NULL) goto failed;
    4823           0 :                 res = obj2ast_int(tmp, &col_offset, arena);
    4824           0 :                 if (res != 0) goto failed;
    4825           0 :                 Py_XDECREF(tmp);
    4826           0 :                 tmp = NULL;
    4827             :         } else {
    4828           0 :                 PyErr_SetString(PyExc_TypeError, "required field \"col_offset\" missing from expr");
    4829           0 :                 return 1;
    4830             :         }
    4831           0 :         isinstance = PyObject_IsInstance(obj, (PyObject*)BoolOp_type);
    4832           0 :         if (isinstance == -1) {
    4833           0 :                 return 1;
    4834             :         }
    4835           0 :         if (isinstance) {
    4836             :                 boolop_ty op;
    4837             :                 asdl_seq* values;
    4838             : 
    4839           0 :                 if (PyObject_HasAttrString(obj, "op")) {
    4840             :                         int res;
    4841           0 :                         tmp = PyObject_GetAttrString(obj, "op");
    4842           0 :                         if (tmp == NULL) goto failed;
    4843           0 :                         res = obj2ast_boolop(tmp, &op, arena);
    4844           0 :                         if (res != 0) goto failed;
    4845           0 :                         Py_XDECREF(tmp);
    4846           0 :                         tmp = NULL;
    4847             :                 } else {
    4848           0 :                         PyErr_SetString(PyExc_TypeError, "required field \"op\" missing from BoolOp");
    4849           0 :                         return 1;
    4850             :                 }
    4851           0 :                 if (PyObject_HasAttrString(obj, "values")) {
    4852             :                         int res;
    4853             :                         Py_ssize_t len;
    4854             :                         Py_ssize_t i;
    4855           0 :                         tmp = PyObject_GetAttrString(obj, "values");
    4856           0 :                         if (tmp == NULL) goto failed;
    4857           0 :                         if (!PyList_Check(tmp)) {
    4858           0 :                                 PyErr_Format(PyExc_TypeError, "BoolOp field \"values\" must be a list, not a %.200s", tmp->ob_type->tp_name);
    4859           0 :                                 goto failed;
    4860             :                         }
    4861           0 :                         len = PyList_GET_SIZE(tmp);
    4862           0 :                         values = asdl_seq_new(len, arena);
    4863           0 :                         if (values == NULL) goto failed;
    4864           0 :                         for (i = 0; i < len; i++) {
    4865             :                                 expr_ty value;
    4866           0 :                                 res = obj2ast_expr(PyList_GET_ITEM(tmp, i), &value, arena);
    4867           0 :                                 if (res != 0) goto failed;
    4868           0 :                                 if (len != PyList_GET_SIZE(tmp)) {
    4869           0 :                                         PyErr_SetString(PyExc_RuntimeError, "BoolOp field \"values\" changed size during iteration");
    4870           0 :                                         goto failed;
    4871             :                                 }
    4872           0 :                                 asdl_seq_SET(values, i, value);
    4873             :                         }
    4874           0 :                         Py_XDECREF(tmp);
    4875           0 :                         tmp = NULL;
    4876             :                 } else {
    4877           0 :                         PyErr_SetString(PyExc_TypeError, "required field \"values\" missing from BoolOp");
    4878           0 :                         return 1;
    4879             :                 }
    4880           0 :                 *out = BoolOp(op, values, lineno, col_offset, arena);
    4881           0 :                 if (*out == NULL) goto failed;
    4882           0 :                 return 0;
    4883             :         }
    4884           0 :         isinstance = PyObject_IsInstance(obj, (PyObject*)BinOp_type);
    4885           0 :         if (isinstance == -1) {
    4886           0 :                 return 1;
    4887             :         }
    4888           0 :         if (isinstance) {
    4889             :                 expr_ty left;
    4890             :                 operator_ty op;
    4891             :                 expr_ty right;
    4892             : 
    4893           0 :                 if (PyObject_HasAttrString(obj, "left")) {
    4894             :                         int res;
    4895           0 :                         tmp = PyObject_GetAttrString(obj, "left");
    4896           0 :                         if (tmp == NULL) goto failed;
    4897           0 :                         res = obj2ast_expr(tmp, &left, arena);
    4898           0 :                         if (res != 0) goto failed;
    4899           0 :                         Py_XDECREF(tmp);
    4900           0 :                         tmp = NULL;
    4901             :                 } else {
    4902           0 :                         PyErr_SetString(PyExc_TypeError, "required field \"left\" missing from BinOp");
    4903           0 :                         return 1;
    4904             :                 }
    4905           0 :                 if (PyObject_HasAttrString(obj, "op")) {
    4906             :                         int res;
    4907           0 :                         tmp = PyObject_GetAttrString(obj, "op");
    4908           0 :                         if (tmp == NULL) goto failed;
    4909           0 :                         res = obj2ast_operator(tmp, &op, arena);
    4910           0 :                         if (res != 0) goto failed;
    4911           0 :                         Py_XDECREF(tmp);
    4912           0 :                         tmp = NULL;
    4913             :                 } else {
    4914           0 :                         PyErr_SetString(PyExc_TypeError, "required field \"op\" missing from BinOp");
    4915           0 :                         return 1;
    4916             :                 }
    4917           0 :                 if (PyObject_HasAttrString(obj, "right")) {
    4918             :                         int res;
    4919           0 :                         tmp = PyObject_GetAttrString(obj, "right");
    4920           0 :                         if (tmp == NULL) goto failed;
    4921           0 :                         res = obj2ast_expr(tmp, &right, arena);
    4922           0 :                         if (res != 0) goto failed;
    4923           0 :                         Py_XDECREF(tmp);
    4924           0 :                         tmp = NULL;
    4925             :                 } else {
    4926           0 :                         PyErr_SetString(PyExc_TypeError, "required field \"right\" missing from BinOp");
    4927           0 :                         return 1;
    4928             :                 }
    4929           0 :                 *out = BinOp(left, op, right, lineno, col_offset, arena);
    4930           0 :                 if (*out == NULL) goto failed;
    4931           0 :                 return 0;
    4932             :         }
    4933           0 :         isinstance = PyObject_IsInstance(obj, (PyObject*)UnaryOp_type);
    4934           0 :         if (isinstance == -1) {
    4935           0 :                 return 1;
    4936             :         }
    4937           0 :         if (isinstance) {
    4938             :                 unaryop_ty op;
    4939             :                 expr_ty operand;
    4940             : 
    4941           0 :                 if (PyObject_HasAttrString(obj, "op")) {
    4942             :                         int res;
    4943           0 :                         tmp = PyObject_GetAttrString(obj, "op");
    4944           0 :                         if (tmp == NULL) goto failed;
    4945           0 :                         res = obj2ast_unaryop(tmp, &op, arena);
    4946           0 :                         if (res != 0) goto failed;
    4947           0 :                         Py_XDECREF(tmp);
    4948           0 :                         tmp = NULL;
    4949             :                 } else {
    4950           0 :                         PyErr_SetString(PyExc_TypeError, "required field \"op\" missing from UnaryOp");
    4951           0 :                         return 1;
    4952             :                 }
    4953           0 :                 if (PyObject_HasAttrString(obj, "operand")) {
    4954             :                         int res;
    4955           0 :                         tmp = PyObject_GetAttrString(obj, "operand");
    4956           0 :                         if (tmp == NULL) goto failed;
    4957           0 :                         res = obj2ast_expr(tmp, &operand, arena);
    4958           0 :                         if (res != 0) goto failed;
    4959           0 :                         Py_XDECREF(tmp);
    4960           0 :                         tmp = NULL;
    4961             :                 } else {
    4962           0 :                         PyErr_SetString(PyExc_TypeError, "required field \"operand\" missing from UnaryOp");
    4963           0 :                         return 1;
    4964             :                 }
    4965           0 :                 *out = UnaryOp(op, operand, lineno, col_offset, arena);
    4966           0 :                 if (*out == NULL) goto failed;
    4967           0 :                 return 0;
    4968             :         }
    4969           0 :         isinstance = PyObject_IsInstance(obj, (PyObject*)Lambda_type);
    4970           0 :         if (isinstance == -1) {
    4971           0 :                 return 1;
    4972             :         }
    4973           0 :         if (isinstance) {
    4974             :                 arguments_ty args;
    4975             :                 expr_ty body;
    4976             : 
    4977           0 :                 if (PyObject_HasAttrString(obj, "args")) {
    4978             :                         int res;
    4979           0 :                         tmp = PyObject_GetAttrString(obj, "args");
    4980           0 :                         if (tmp == NULL) goto failed;
    4981           0 :                         res = obj2ast_arguments(tmp, &args, arena);
    4982           0 :                         if (res != 0) goto failed;
    4983           0 :                         Py_XDECREF(tmp);
    4984           0 :                         tmp = NULL;
    4985             :                 } else {
    4986           0 :                         PyErr_SetString(PyExc_TypeError, "required field \"args\" missing from Lambda");
    4987           0 :                         return 1;
    4988             :                 }
    4989           0 :                 if (PyObject_HasAttrString(obj, "body")) {
    4990             :                         int res;
    4991           0 :                         tmp = PyObject_GetAttrString(obj, "body");
    4992           0 :                         if (tmp == NULL) goto failed;
    4993           0 :                         res = obj2ast_expr(tmp, &body, arena);
    4994           0 :                         if (res != 0) goto failed;
    4995           0 :                         Py_XDECREF(tmp);
    4996           0 :                         tmp = NULL;
    4997             :                 } else {
    4998           0 :                         PyErr_SetString(PyExc_TypeError, "required field \"body\" missing from Lambda");
    4999           0 :                         return 1;
    5000             :                 }
    5001           0 :                 *out = Lambda(args, body, lineno, col_offset, arena);
    5002           0 :                 if (*out == NULL) goto failed;
    5003           0 :                 return 0;
    5004             :         }
    5005           0 :         isinstance = PyObject_IsInstance(obj, (PyObject*)IfExp_type);
    5006           0 :         if (isinstance == -1) {
    5007           0 :                 return 1;
    5008             :         }
    5009           0 :         if (isinstance) {
    5010             :                 expr_ty test;
    5011             :                 expr_ty body;
    5012             :                 expr_ty orelse;
    5013             : 
    5014           0 :                 if (PyObject_HasAttrString(obj, "test")) {
    5015             :                         int res;
    5016           0 :                         tmp = PyObject_GetAttrString(obj, "test");
    5017           0 :                         if (tmp == NULL) goto failed;
    5018           0 :                         res = obj2ast_expr(tmp, &test, arena);
    5019           0 :                         if (res != 0) goto failed;
    5020           0 :                         Py_XDECREF(tmp);
    5021           0 :                         tmp = NULL;
    5022             :                 } else {
    5023           0 :                         PyErr_SetString(PyExc_TypeError, "required field \"test\" missing from IfExp");
    5024           0 :                         return 1;
    5025             :                 }
    5026           0 :                 if (PyObject_HasAttrString(obj, "body")) {
    5027             :                         int res;
    5028           0 :                         tmp = PyObject_GetAttrString(obj, "body");
    5029           0 :                         if (tmp == NULL) goto failed;
    5030           0 :                         res = obj2ast_expr(tmp, &body, arena);
    5031           0 :                         if (res != 0) goto failed;
    5032           0 :                         Py_XDECREF(tmp);
    5033           0 :                         tmp = NULL;
    5034             :                 } else {
    5035           0 :                         PyErr_SetString(PyExc_TypeError, "required field \"body\" missing from IfExp");
    5036           0 :                         return 1;
    5037             :                 }
    5038           0 :                 if (PyObject_HasAttrString(obj, "orelse")) {
    5039             :                         int res;
    5040           0 :                         tmp = PyObject_GetAttrString(obj, "orelse");
    5041           0 :                         if (tmp == NULL) goto failed;
    5042           0 :                         res = obj2ast_expr(tmp, &orelse, arena);
    5043           0 :                         if (res != 0) goto failed;
    5044           0 :                         Py_XDECREF(tmp);
    5045           0 :                         tmp = NULL;
    5046             :                 } else {
    5047           0 :                         PyErr_SetString(PyExc_TypeError, "required field \"orelse\" missing from IfExp");
    5048           0 :                         return 1;
    5049             :                 }
    5050           0 :                 *out = IfExp(test, body, orelse, lineno, col_offset, arena);
    5051           0 :                 if (*out == NULL) goto failed;
    5052           0 :                 return 0;
    5053             :         }
    5054           0 :         isinstance = PyObject_IsInstance(obj, (PyObject*)Dict_type);
    5055           0 :         if (isinstance == -1) {
    5056           0 :                 return 1;
    5057             :         }
    5058           0 :         if (isinstance) {
    5059             :                 asdl_seq* keys;
    5060             :                 asdl_seq* values;
    5061             : 
    5062           0 :                 if (PyObject_HasAttrString(obj, "keys")) {
    5063             :                         int res;
    5064             :                         Py_ssize_t len;
    5065             :                         Py_ssize_t i;
    5066           0 :                         tmp = PyObject_GetAttrString(obj, "keys");
    5067           0 :                         if (tmp == NULL) goto failed;
    5068           0 :                         if (!PyList_Check(tmp)) {
    5069           0 :                                 PyErr_Format(PyExc_TypeError, "Dict field \"keys\" must be a list, not a %.200s", tmp->ob_type->tp_name);
    5070           0 :                                 goto failed;
    5071             :                         }
    5072           0 :                         len = PyList_GET_SIZE(tmp);
    5073           0 :                         keys = asdl_seq_new(len, arena);
    5074           0 :                         if (keys == NULL) goto failed;
    5075           0 :                         for (i = 0; i < len; i++) {
    5076             :                                 expr_ty value;
    5077           0 :                                 res = obj2ast_expr(PyList_GET_ITEM(tmp, i), &value, arena);
    5078           0 :                                 if (res != 0) goto failed;
    5079           0 :                                 if (len != PyList_GET_SIZE(tmp)) {
    5080           0 :                                         PyErr_SetString(PyExc_RuntimeError, "Dict field \"keys\" changed size during iteration");
    5081           0 :                                         goto failed;
    5082             :                                 }
    5083           0 :                                 asdl_seq_SET(keys, i, value);
    5084             :                         }
    5085           0 :                         Py_XDECREF(tmp);
    5086           0 :                         tmp = NULL;
    5087             :                 } else {
    5088           0 :                         PyErr_SetString(PyExc_TypeError, "required field \"keys\" missing from Dict");
    5089           0 :                         return 1;
    5090             :                 }
    5091           0 :                 if (PyObject_HasAttrString(obj, "values")) {
    5092             :                         int res;
    5093             :                         Py_ssize_t len;
    5094             :                         Py_ssize_t i;
    5095           0 :                         tmp = PyObject_GetAttrString(obj, "values");
    5096           0 :                         if (tmp == NULL) goto failed;
    5097           0 :                         if (!PyList_Check(tmp)) {
    5098           0 :                                 PyErr_Format(PyExc_TypeError, "Dict field \"values\" must be a list, not a %.200s", tmp->ob_type->tp_name);
    5099           0 :                                 goto failed;
    5100             :                         }
    5101           0 :                         len = PyList_GET_SIZE(tmp);
    5102           0 :                         values = asdl_seq_new(len, arena);
    5103           0 :                         if (values == NULL) goto failed;
    5104           0 :                         for (i = 0; i < len; i++) {
    5105             :                                 expr_ty value;
    5106           0 :                                 res = obj2ast_expr(PyList_GET_ITEM(tmp, i), &value, arena);
    5107           0 :                                 if (res != 0) goto failed;
    5108           0 :                                 if (len != PyList_GET_SIZE(tmp)) {
    5109           0 :                                         PyErr_SetString(PyExc_RuntimeError, "Dict field \"values\" changed size during iteration");
    5110           0 :                                         goto failed;
    5111             :                                 }
    5112           0 :                                 asdl_seq_SET(values, i, value);
    5113             :                         }
    5114           0 :                         Py_XDECREF(tmp);
    5115           0 :                         tmp = NULL;
    5116             :                 } else {
    5117           0 :                         PyErr_SetString(PyExc_TypeError, "required field \"values\" missing from Dict");
    5118           0 :                         return 1;
    5119             :                 }
    5120           0 :                 *out = Dict(keys, values, lineno, col_offset, arena);
    5121           0 :                 if (*out == NULL) goto failed;
    5122           0 :                 return 0;
    5123             :         }
    5124           0 :         isinstance = PyObject_IsInstance(obj, (PyObject*)Set_type);
    5125           0 :         if (isinstance == -1) {
    5126           0 :                 return 1;
    5127             :         }
    5128           0 :         if (isinstance) {
    5129             :                 asdl_seq* elts;
    5130             : 
    5131           0 :                 if (PyObject_HasAttrString(obj, "elts")) {
    5132             :                         int res;
    5133             :                         Py_ssize_t len;
    5134             :                         Py_ssize_t i;
    5135           0 :                         tmp = PyObject_GetAttrString(obj, "elts");
    5136           0 :                         if (tmp == NULL) goto failed;
    5137           0 :                         if (!PyList_Check(tmp)) {
    5138           0 :                                 PyErr_Format(PyExc_TypeError, "Set field \"elts\" must be a list, not a %.200s", tmp->ob_type->tp_name);
    5139           0 :                                 goto failed;
    5140             :                         }
    5141           0 :                         len = PyList_GET_SIZE(tmp);
    5142           0 :                         elts = asdl_seq_new(len, arena);
    5143           0 :                         if (elts == NULL) goto failed;
    5144           0 :                         for (i = 0; i < len; i++) {
    5145             :                                 expr_ty value;
    5146           0 :                                 res = obj2ast_expr(PyList_GET_ITEM(tmp, i), &value, arena);
    5147           0 :                                 if (res != 0) goto failed;
    5148           0 :                                 if (len != PyList_GET_SIZE(tmp)) {
    5149           0 :                                         PyErr_SetString(PyExc_RuntimeError, "Set field \"elts\" changed size during iteration");
    5150           0 :                                         goto failed;
    5151             :                                 }
    5152           0 :                                 asdl_seq_SET(elts, i, value);
    5153             :                         }
    5154           0 :                         Py_XDECREF(tmp);
    5155           0 :                         tmp = NULL;
    5156             :                 } else {
    5157           0 :                         PyErr_SetString(PyExc_TypeError, "required field \"elts\" missing from Set");
    5158           0 :                         return 1;
    5159             :                 }
    5160           0 :                 *out = Set(elts, lineno, col_offset, arena);
    5161           0 :                 if (*out == NULL) goto failed;
    5162           0 :                 return 0;
    5163             :         }
    5164           0 :         isinstance = PyObject_IsInstance(obj, (PyObject*)ListComp_type);
    5165           0 :         if (isinstance == -1) {
    5166           0 :                 return 1;
    5167             :         }
    5168           0 :         if (isinstance) {
    5169             :                 expr_ty elt;
    5170             :                 asdl_seq* generators;
    5171             : 
    5172           0 :                 if (PyObject_HasAttrString(obj, "elt")) {
    5173             :                         int res;
    5174           0 :                         tmp = PyObject_GetAttrString(obj, "elt");
    5175           0 :                         if (tmp == NULL) goto failed;
    5176           0 :                         res = obj2ast_expr(tmp, &elt, arena);
    5177           0 :                         if (res != 0) goto failed;
    5178           0 :                         Py_XDECREF(tmp);
    5179           0 :                         tmp = NULL;
    5180             :                 } else {
    5181           0 :                         PyErr_SetString(PyExc_TypeError, "required field \"elt\" missing from ListComp");
    5182           0 :                         return 1;
    5183             :                 }
    5184           0 :                 if (PyObject_HasAttrString(obj, "generators")) {
    5185             :                         int res;
    5186             :                         Py_ssize_t len;
    5187             :                         Py_ssize_t i;
    5188           0 :                         tmp = PyObject_GetAttrString(obj, "generators");
    5189           0 :                         if (tmp == NULL) goto failed;
    5190           0 :                         if (!PyList_Check(tmp)) {
    5191           0 :                                 PyErr_Format(PyExc_TypeError, "ListComp field \"generators\" must be a list, not a %.200s", tmp->ob_type->tp_name);
    5192           0 :                                 goto failed;
    5193             :                         }
    5194           0 :                         len = PyList_GET_SIZE(tmp);
    5195           0 :                         generators = asdl_seq_new(len, arena);
    5196           0 :                         if (generators == NULL) goto failed;
    5197           0 :                         for (i = 0; i < len; i++) {
    5198             :                                 comprehension_ty value;
    5199           0 :                                 res = obj2ast_comprehension(PyList_GET_ITEM(tmp, i), &value, arena);
    5200           0 :                                 if (res != 0) goto failed;
    5201           0 :                                 if (len != PyList_GET_SIZE(tmp)) {
    5202           0 :                                         PyErr_SetString(PyExc_RuntimeError, "ListComp field \"generators\" changed size during iteration");
    5203           0 :                                         goto failed;
    5204             :                                 }
    5205           0 :                                 asdl_seq_SET(generators, i, value);
    5206             :                         }
    5207           0 :                         Py_XDECREF(tmp);
    5208           0 :                         tmp = NULL;
    5209             :                 } else {
    5210           0 :                         PyErr_SetString(PyExc_TypeError, "required field \"generators\" missing from ListComp");
    5211           0 :                         return 1;
    5212             :                 }
    5213           0 :                 *out = ListComp(elt, generators, lineno, col_offset, arena);
    5214           0 :                 if (*out == NULL) goto failed;
    5215           0 :                 return 0;
    5216             :         }
    5217           0 :         isinstance = PyObject_IsInstance(obj, (PyObject*)SetComp_type);
    5218           0 :         if (isinstance == -1) {
    5219           0 :                 return 1;
    5220             :         }
    5221           0 :         if (isinstance) {
    5222             :                 expr_ty elt;
    5223             :                 asdl_seq* generators;
    5224             : 
    5225           0 :                 if (PyObject_HasAttrString(obj, "elt")) {
    5226             :                         int res;
    5227           0 :                         tmp = PyObject_GetAttrString(obj, "elt");
    5228           0 :                         if (tmp == NULL) goto failed;
    5229           0 :                         res = obj2ast_expr(tmp, &elt, arena);
    5230           0 :                         if (res != 0) goto failed;
    5231           0 :                         Py_XDECREF(tmp);
    5232           0 :                         tmp = NULL;
    5233             :                 } else {
    5234           0 :                         PyErr_SetString(PyExc_TypeError, "required field \"elt\" missing from SetComp");
    5235           0 :                         return 1;
    5236             :                 }
    5237           0 :                 if (PyObject_HasAttrString(obj, "generators")) {
    5238             :                         int res;
    5239             :                         Py_ssize_t len;
    5240             :                         Py_ssize_t i;
    5241           0 :                         tmp = PyObject_GetAttrString(obj, "generators");
    5242           0 :                         if (tmp == NULL) goto failed;
    5243           0 :                         if (!PyList_Check(tmp)) {
    5244           0 :                                 PyErr_Format(PyExc_TypeError, "SetComp field \"generators\" must be a list, not a %.200s", tmp->ob_type->tp_name);
    5245           0 :                                 goto failed;
    5246             :                         }
    5247           0 :                         len = PyList_GET_SIZE(tmp);
    5248           0 :                         generators = asdl_seq_new(len, arena);
    5249           0 :                         if (generators == NULL) goto failed;
    5250           0 :                         for (i = 0; i < len; i++) {
    5251             :                                 comprehension_ty value;
    5252           0 :                                 res = obj2ast_comprehension(PyList_GET_ITEM(tmp, i), &value, arena);
    5253           0 :                                 if (res != 0) goto failed;
    5254           0 :                                 if (len != PyList_GET_SIZE(tmp)) {
    5255           0 :                                         PyErr_SetString(PyExc_RuntimeError, "SetComp field \"generators\" changed size during iteration");
    5256           0 :                                         goto failed;
    5257             :                                 }
    5258           0 :                                 asdl_seq_SET(generators, i, value);
    5259             :                         }
    5260           0 :                         Py_XDECREF(tmp);
    5261           0 :                         tmp = NULL;
    5262             :                 } else {
    5263           0 :                         PyErr_SetString(PyExc_TypeError, "required field \"generators\" missing from SetComp");
    5264           0 :                         return 1;
    5265             :                 }
    5266           0 :                 *out = SetComp(elt, generators, lineno, col_offset, arena);
    5267           0 :                 if (*out == NULL) goto failed;
    5268           0 :                 return 0;
    5269             :         }
    5270           0 :         isinstance = PyObject_IsInstance(obj, (PyObject*)DictComp_type);
    5271           0 :         if (isinstance == -1) {
    5272           0 :                 return 1;
    5273             :         }
    5274           0 :         if (isinstance) {
    5275             :                 expr_ty key;
    5276             :                 expr_ty value;
    5277             :                 asdl_seq* generators;
    5278             : 
    5279           0 :                 if (PyObject_HasAttrString(obj, "key")) {
    5280             :                         int res;
    5281           0 :                         tmp = PyObject_GetAttrString(obj, "key");
    5282           0 :                         if (tmp == NULL) goto failed;
    5283           0 :                         res = obj2ast_expr(tmp, &key, arena);
    5284           0 :                         if (res != 0) goto failed;
    5285           0 :                         Py_XDECREF(tmp);
    5286           0 :                         tmp = NULL;
    5287             :                 } else {
    5288           0 :                         PyErr_SetString(PyExc_TypeError, "required field \"key\" missing from DictComp");
    5289           0 :                         return 1;
    5290             :                 }
    5291           0 :                 if (PyObject_HasAttrString(obj, "value")) {
    5292             :                         int res;
    5293           0 :                         tmp = PyObject_GetAttrString(obj, "value");
    5294           0 :                         if (tmp == NULL) goto failed;
    5295           0 :                         res = obj2ast_expr(tmp, &value, arena);
    5296           0 :                         if (res != 0) goto failed;
    5297           0 :                         Py_XDECREF(tmp);
    5298           0 :                         tmp = NULL;
    5299             :                 } else {
    5300           0 :                         PyErr_SetString(PyExc_TypeError, "required field \"value\" missing from DictComp");
    5301           0 :                         return 1;
    5302             :                 }
    5303           0 :                 if (PyObject_HasAttrString(obj, "generators")) {
    5304             :                         int res;
    5305             :                         Py_ssize_t len;
    5306             :                         Py_ssize_t i;
    5307           0 :                         tmp = PyObject_GetAttrString(obj, "generators");
    5308           0 :                         if (tmp == NULL) goto failed;
    5309           0 :                         if (!PyList_Check(tmp)) {
    5310           0 :                                 PyErr_Format(PyExc_TypeError, "DictComp field \"generators\" must be a list, not a %.200s", tmp->ob_type->tp_name);
    5311           0 :                                 goto failed;
    5312             :                         }
    5313           0 :                         len = PyList_GET_SIZE(tmp);
    5314           0 :                         generators = asdl_seq_new(len, arena);
    5315           0 :                         if (generators == NULL) goto failed;
    5316           0 :                         for (i = 0; i < len; i++) {
    5317             :                                 comprehension_ty value;
    5318           0 :                                 res = obj2ast_comprehension(PyList_GET_ITEM(tmp, i), &value, arena);
    5319           0 :                                 if (res != 0) goto failed;
    5320           0 :                                 if (len != PyList_GET_SIZE(tmp)) {
    5321           0 :                                         PyErr_SetString(PyExc_RuntimeError, "DictComp field \"generators\" changed size during iteration");
    5322           0 :                                         goto failed;
    5323             :                                 }
    5324           0 :                                 asdl_seq_SET(generators, i, value);
    5325             :                         }
    5326           0 :                         Py_XDECREF(tmp);
    5327           0 :                         tmp = NULL;
    5328             :                 } else {
    5329           0 :                         PyErr_SetString(PyExc_TypeError, "required field \"generators\" missing from DictComp");
    5330           0 :                         return 1;
    5331             :                 }
    5332           0 :                 *out = DictComp(key, value, generators, lineno, col_offset,
    5333             :                                 arena);
    5334           0 :                 if (*out == NULL) goto failed;
    5335           0 :                 return 0;
    5336             :         }
    5337           0 :         isinstance = PyObject_IsInstance(obj, (PyObject*)GeneratorExp_type);
    5338           0 :         if (isinstance == -1) {
    5339           0 :                 return 1;
    5340             :         }
    5341           0 :         if (isinstance) {
    5342             :                 expr_ty elt;
    5343             :                 asdl_seq* generators;
    5344             : 
    5345           0 :                 if (PyObject_HasAttrString(obj, "elt")) {
    5346             :                         int res;
    5347           0 :                         tmp = PyObject_GetAttrString(obj, "elt");
    5348           0 :                         if (tmp == NULL) goto failed;
    5349           0 :                         res = obj2ast_expr(tmp, &elt, arena);
    5350           0 :                         if (res != 0) goto failed;
    5351           0 :                         Py_XDECREF(tmp);
    5352           0 :                         tmp = NULL;
    5353             :                 } else {
    5354           0 :                         PyErr_SetString(PyExc_TypeError, "required field \"elt\" missing from GeneratorExp");
    5355           0 :                         return 1;
    5356             :                 }
    5357           0 :                 if (PyObject_HasAttrString(obj, "generators")) {
    5358             :                         int res;
    5359             :                         Py_ssize_t len;
    5360             :                         Py_ssize_t i;
    5361           0 :                         tmp = PyObject_GetAttrString(obj, "generators");
    5362           0 :                         if (tmp == NULL) goto failed;
    5363           0 :                         if (!PyList_Check(tmp)) {
    5364           0 :                                 PyErr_Format(PyExc_TypeError, "GeneratorExp field \"generators\" must be a list, not a %.200s", tmp->ob_type->tp_name);
    5365           0 :                                 goto failed;
    5366             :                         }
    5367           0 :                         len = PyList_GET_SIZE(tmp);
    5368           0 :                         generators = asdl_seq_new(len, arena);
    5369           0 :                         if (generators == NULL) goto failed;
    5370           0 :                         for (i = 0; i < len; i++) {
    5371             :                                 comprehension_ty value;
    5372           0 :                                 res = obj2ast_comprehension(PyList_GET_ITEM(tmp, i), &value, arena);
    5373           0 :                                 if (res != 0) goto failed;
    5374           0 :                                 if (len != PyList_GET_SIZE(tmp)) {
    5375           0 :                                         PyErr_SetString(PyExc_RuntimeError, "GeneratorExp field \"generators\" changed size during iteration");
    5376           0 :                                         goto failed;
    5377             :                                 }
    5378           0 :                                 asdl_seq_SET(generators, i, value);
    5379             :                         }
    5380           0 :                         Py_XDECREF(tmp);
    5381           0 :                         tmp = NULL;
    5382             :                 } else {
    5383           0 :                         PyErr_SetString(PyExc_TypeError, "required field \"generators\" missing from GeneratorExp");
    5384           0 :                         return 1;
    5385             :                 }
    5386           0 :                 *out = GeneratorExp(elt, generators, lineno, col_offset, arena);
    5387           0 :                 if (*out == NULL) goto failed;
    5388           0 :                 return 0;
    5389             :         }
    5390           0 :         isinstance = PyObject_IsInstance(obj, (PyObject*)Yield_type);
    5391           0 :         if (isinstance == -1) {
    5392           0 :                 return 1;
    5393             :         }
    5394           0 :         if (isinstance) {
    5395             :                 expr_ty value;
    5396             : 
    5397           0 :                 if (PyObject_HasAttrString(obj, "value")) {
    5398             :                         int res;
    5399           0 :                         tmp = PyObject_GetAttrString(obj, "value");
    5400           0 :                         if (tmp == NULL) goto failed;
    5401           0 :                         res = obj2ast_expr(tmp, &value, arena);
    5402           0 :                         if (res != 0) goto failed;
    5403           0 :                         Py_XDECREF(tmp);
    5404           0 :                         tmp = NULL;
    5405             :                 } else {
    5406           0 :                         value = NULL;
    5407             :                 }
    5408           0 :                 *out = Yield(value, lineno, col_offset, arena);
    5409           0 :                 if (*out == NULL) goto failed;
    5410           0 :                 return 0;
    5411             :         }
    5412           0 :         isinstance = PyObject_IsInstance(obj, (PyObject*)Compare_type);
    5413           0 :         if (isinstance == -1) {
    5414           0 :                 return 1;
    5415             :         }
    5416           0 :         if (isinstance) {
    5417             :                 expr_ty left;
    5418             :                 asdl_int_seq* ops;
    5419             :                 asdl_seq* comparators;
    5420             : 
    5421           0 :                 if (PyObject_HasAttrString(obj, "left")) {
    5422             :                         int res;
    5423           0 :                         tmp = PyObject_GetAttrString(obj, "left");
    5424           0 :                         if (tmp == NULL) goto failed;
    5425           0 :                         res = obj2ast_expr(tmp, &left, arena);
    5426           0 :                         if (res != 0) goto failed;
    5427           0 :                         Py_XDECREF(tmp);
    5428           0 :                         tmp = NULL;
    5429             :                 } else {
    5430           0 :                         PyErr_SetString(PyExc_TypeError, "required field \"left\" missing from Compare");
    5431           0 :                         return 1;
    5432             :                 }
    5433           0 :                 if (PyObject_HasAttrString(obj, "ops")) {
    5434             :                         int res;
    5435             :                         Py_ssize_t len;
    5436             :                         Py_ssize_t i;
    5437           0 :                         tmp = PyObject_GetAttrString(obj, "ops");
    5438           0 :                         if (tmp == NULL) goto failed;
    5439           0 :                         if (!PyList_Check(tmp)) {
    5440           0 :                                 PyErr_Format(PyExc_TypeError, "Compare field \"ops\" must be a list, not a %.200s", tmp->ob_type->tp_name);
    5441           0 :                                 goto failed;
    5442             :                         }
    5443           0 :                         len = PyList_GET_SIZE(tmp);
    5444           0 :                         ops = asdl_int_seq_new(len, arena);
    5445           0 :                         if (ops == NULL) goto failed;
    5446           0 :                         for (i = 0; i < len; i++) {
    5447             :                                 cmpop_ty value;
    5448           0 :                                 res = obj2ast_cmpop(PyList_GET_ITEM(tmp, i), &value, arena);
    5449           0 :                                 if (res != 0) goto failed;
    5450           0 :                                 if (len != PyList_GET_SIZE(tmp)) {
    5451           0 :                                         PyErr_SetString(PyExc_RuntimeError, "Compare field \"ops\" changed size during iteration");
    5452           0 :                                         goto failed;
    5453             :                                 }
    5454           0 :                                 asdl_seq_SET(ops, i, value);
    5455             :                         }
    5456           0 :                         Py_XDECREF(tmp);
    5457           0 :                         tmp = NULL;
    5458             :                 } else {
    5459           0 :                         PyErr_SetString(PyExc_TypeError, "required field \"ops\" missing from Compare");
    5460           0 :                         return 1;
    5461             :                 }
    5462           0 :                 if (PyObject_HasAttrString(obj, "comparators")) {
    5463             :                         int res;
    5464             :                         Py_ssize_t len;
    5465             :                         Py_ssize_t i;
    5466           0 :                         tmp = PyObject_GetAttrString(obj, "comparators");
    5467           0 :                         if (tmp == NULL) goto failed;
    5468           0 :                         if (!PyList_Check(tmp)) {
    5469           0 :                                 PyErr_Format(PyExc_TypeError, "Compare field \"comparators\" must be a list, not a %.200s", tmp->ob_type->tp_name);
    5470           0 :                                 goto failed;
    5471             :                         }
    5472           0 :                         len = PyList_GET_SIZE(tmp);
    5473           0 :                         comparators = asdl_seq_new(len, arena);
    5474           0 :                         if (comparators == NULL) goto failed;
    5475           0 :                         for (i = 0; i < len; i++) {
    5476             :                                 expr_ty value;
    5477           0 :                                 res = obj2ast_expr(PyList_GET_ITEM(tmp, i), &value, arena);
    5478           0 :                                 if (res != 0) goto failed;
    5479           0 :                                 if (len != PyList_GET_SIZE(tmp)) {
    5480           0 :                                         PyErr_SetString(PyExc_RuntimeError, "Compare field \"comparators\" changed size during iteration");
    5481           0 :                                         goto failed;
    5482             :                                 }
    5483           0 :                                 asdl_seq_SET(comparators, i, value);
    5484             :                         }
    5485           0 :                         Py_XDECREF(tmp);
    5486           0 :                         tmp = NULL;
    5487             :                 } else {
    5488           0 :                         PyErr_SetString(PyExc_TypeError, "required field \"comparators\" missing from Compare");
    5489           0 :                         return 1;
    5490             :                 }
    5491           0 :                 *out = Compare(left, ops, comparators, lineno, col_offset,
    5492             :                                arena);
    5493           0 :                 if (*out == NULL) goto failed;
    5494           0 :                 return 0;
    5495             :         }
    5496           0 :         isinstance = PyObject_IsInstance(obj, (PyObject*)Call_type);
    5497           0 :         if (isinstance == -1) {
    5498           0 :                 return 1;
    5499             :         }
    5500           0 :         if (isinstance) {
    5501             :                 expr_ty func;
    5502             :                 asdl_seq* args;
    5503             :                 asdl_seq* keywords;
    5504             :                 expr_ty starargs;
    5505             :                 expr_ty kwargs;
    5506             : 
    5507           0 :                 if (PyObject_HasAttrString(obj, "func")) {
    5508             :                         int res;
    5509           0 :                         tmp = PyObject_GetAttrString(obj, "func");
    5510           0 :                         if (tmp == NULL) goto failed;
    5511           0 :                         res = obj2ast_expr(tmp, &func, arena);
    5512           0 :                         if (res != 0) goto failed;
    5513           0 :                         Py_XDECREF(tmp);
    5514           0 :                         tmp = NULL;
    5515             :                 } else {
    5516           0 :                         PyErr_SetString(PyExc_TypeError, "required field \"func\" missing from Call");
    5517           0 :                         return 1;
    5518             :                 }
    5519           0 :                 if (PyObject_HasAttrString(obj, "args")) {
    5520             :                         int res;
    5521             :                         Py_ssize_t len;
    5522             :                         Py_ssize_t i;
    5523           0 :                         tmp = PyObject_GetAttrString(obj, "args");
    5524           0 :                         if (tmp == NULL) goto failed;
    5525           0 :                         if (!PyList_Check(tmp)) {
    5526           0 :                                 PyErr_Format(PyExc_TypeError, "Call field \"args\" must be a list, not a %.200s", tmp->ob_type->tp_name);
    5527           0 :                                 goto failed;
    5528             :                         }
    5529           0 :                         len = PyList_GET_SIZE(tmp);
    5530           0 :                         args = asdl_seq_new(len, arena);
    5531           0 :                         if (args == NULL) goto failed;
    5532           0 :                         for (i = 0; i < len; i++) {
    5533             :                                 expr_ty value;
    5534           0 :                                 res = obj2ast_expr(PyList_GET_ITEM(tmp, i), &value, arena);
    5535           0 :                                 if (res != 0) goto failed;
    5536           0 :                                 if (len != PyList_GET_SIZE(tmp)) {
    5537           0 :                                         PyErr_SetString(PyExc_RuntimeError, "Call field \"args\" changed size during iteration");
    5538           0 :                                         goto failed;
    5539             :                                 }
    5540           0 :                                 asdl_seq_SET(args, i, value);
    5541             :                         }
    5542           0 :                         Py_XDECREF(tmp);
    5543           0 :                         tmp = NULL;
    5544             :                 } else {
    5545           0 :                         PyErr_SetString(PyExc_TypeError, "required field \"args\" missing from Call");
    5546           0 :                         return 1;
    5547             :                 }
    5548           0 :                 if (PyObject_HasAttrString(obj, "keywords")) {
    5549             :                         int res;
    5550             :                         Py_ssize_t len;
    5551             :                         Py_ssize_t i;
    5552           0 :                         tmp = PyObject_GetAttrString(obj, "keywords");
    5553           0 :                         if (tmp == NULL) goto failed;
    5554           0 :                         if (!PyList_Check(tmp)) {
    5555           0 :                                 PyErr_Format(PyExc_TypeError, "Call field \"keywords\" must be a list, not a %.200s", tmp->ob_type->tp_name);
    5556           0 :                                 goto failed;
    5557             :                         }
    5558           0 :                         len = PyList_GET_SIZE(tmp);
    5559           0 :                         keywords = asdl_seq_new(len, arena);
    5560           0 :                         if (keywords == NULL) goto failed;
    5561           0 :                         for (i = 0; i < len; i++) {
    5562             :                                 keyword_ty value;
    5563           0 :                                 res = obj2ast_keyword(PyList_GET_ITEM(tmp, i), &value, arena);
    5564           0 :                                 if (res != 0) goto failed;
    5565           0 :                                 if (len != PyList_GET_SIZE(tmp)) {
    5566           0 :                                         PyErr_SetString(PyExc_RuntimeError, "Call field \"keywords\" changed size during iteration");
    5567           0 :                                         goto failed;
    5568             :                                 }
    5569           0 :                                 asdl_seq_SET(keywords, i, value);
    5570             :                         }
    5571           0 :                         Py_XDECREF(tmp);
    5572           0 :                         tmp = NULL;
    5573             :                 } else {
    5574           0 :                         PyErr_SetString(PyExc_TypeError, "required field \"keywords\" missing from Call");
    5575           0 :                         return 1;
    5576             :                 }
    5577           0 :                 if (PyObject_HasAttrString(obj, "starargs")) {
    5578             :                         int res;
    5579           0 :                         tmp = PyObject_GetAttrString(obj, "starargs");
    5580           0 :                         if (tmp == NULL) goto failed;
    5581           0 :                         res = obj2ast_expr(tmp, &starargs, arena);
    5582           0 :                         if (res != 0) goto failed;
    5583           0 :                         Py_XDECREF(tmp);
    5584           0 :                         tmp = NULL;
    5585             :                 } else {
    5586           0 :                         starargs = NULL;
    5587             :                 }
    5588           0 :                 if (PyObject_HasAttrString(obj, "kwargs")) {
    5589             :                         int res;
    5590           0 :                         tmp = PyObject_GetAttrString(obj, "kwargs");
    5591           0 :                         if (tmp == NULL) goto failed;
    5592           0 :                         res = obj2ast_expr(tmp, &kwargs, arena);
    5593           0 :                         if (res != 0) goto failed;
    5594           0 :                         Py_XDECREF(tmp);
    5595           0 :                         tmp = NULL;
    5596             :                 } else {
    5597           0 :                         kwargs = NULL;
    5598             :                 }
    5599           0 :                 *out = Call(func, args, keywords, starargs, kwargs, lineno,
    5600             :                             col_offset, arena);
    5601           0 :                 if (*out == NULL) goto failed;
    5602           0 :                 return 0;
    5603             :         }
    5604           0 :         isinstance = PyObject_IsInstance(obj, (PyObject*)Repr_type);
    5605           0 :         if (isinstance == -1) {
    5606           0 :                 return 1;
    5607             :         }
    5608           0 :         if (isinstance) {
    5609             :                 expr_ty value;
    5610             : 
    5611           0 :                 if (PyObject_HasAttrString(obj, "value")) {
    5612             :                         int res;
    5613           0 :                         tmp = PyObject_GetAttrString(obj, "value");
    5614           0 :                         if (tmp == NULL) goto failed;
    5615           0 :                         res = obj2ast_expr(tmp, &value, arena);
    5616           0 :                         if (res != 0) goto failed;
    5617           0 :                         Py_XDECREF(tmp);
    5618           0 :                         tmp = NULL;
    5619             :                 } else {
    5620           0 :                         PyErr_SetString(PyExc_TypeError, "required field \"value\" missing from Repr");
    5621           0 :                         return 1;
    5622             :                 }
    5623           0 :                 *out = Repr(value, lineno, col_offset, arena);
    5624           0 :                 if (*out == NULL) goto failed;
    5625           0 :                 return 0;
    5626             :         }
    5627           0 :         isinstance = PyObject_IsInstance(obj, (PyObject*)Num_type);
    5628           0 :         if (isinstance == -1) {
    5629           0 :                 return 1;
    5630             :         }
    5631           0 :         if (isinstance) {
    5632             :                 object n;
    5633             : 
    5634           0 :                 if (PyObject_HasAttrString(obj, "n")) {
    5635             :                         int res;
    5636           0 :                         tmp = PyObject_GetAttrString(obj, "n");
    5637           0 :                         if (tmp == NULL) goto failed;
    5638           0 :                         res = obj2ast_object(tmp, &n, arena);
    5639           0 :                         if (res != 0) goto failed;
    5640           0 :                         Py_XDECREF(tmp);
    5641           0 :                         tmp = NULL;
    5642             :                 } else {
    5643           0 :                         PyErr_SetString(PyExc_TypeError, "required field \"n\" missing from Num");
    5644           0 :                         return 1;
    5645             :                 }
    5646           0 :                 *out = Num(n, lineno, col_offset, arena);
    5647           0 :                 if (*out == NULL) goto failed;
    5648           0 :                 return 0;
    5649             :         }
    5650           0 :         isinstance = PyObject_IsInstance(obj, (PyObject*)Str_type);
    5651           0 :         if (isinstance == -1) {
    5652           0 :                 return 1;
    5653             :         }
    5654           0 :         if (isinstance) {
    5655             :                 string s;
    5656             : 
    5657           0 :                 if (PyObject_HasAttrString(obj, "s")) {
    5658             :                         int res;
    5659           0 :                         tmp = PyObject_GetAttrString(obj, "s");
    5660           0 :                         if (tmp == NULL) goto failed;
    5661           0 :                         res = obj2ast_string(tmp, &s, arena);
    5662           0 :                         if (res != 0) goto failed;
    5663           0 :                         Py_XDECREF(tmp);
    5664           0 :                         tmp = NULL;
    5665             :                 } else {
    5666           0 :                         PyErr_SetString(PyExc_TypeError, "required field \"s\" missing from Str");
    5667           0 :                         return 1;
    5668             :                 }
    5669           0 :                 *out = Str(s, lineno, col_offset, arena);
    5670           0 :                 if (*out == NULL) goto failed;
    5671           0 :                 return 0;
    5672             :         }
    5673           0 :         isinstance = PyObject_IsInstance(obj, (PyObject*)Attribute_type);
    5674           0 :         if (isinstance == -1) {
    5675           0 :                 return 1;
    5676             :         }
    5677           0 :         if (isinstance) {
    5678             :                 expr_ty value;
    5679             :                 identifier attr;
    5680             :                 expr_context_ty ctx;
    5681             : 
    5682           0 :                 if (PyObject_HasAttrString(obj, "value")) {
    5683             :                         int res;
    5684           0 :                         tmp = PyObject_GetAttrString(obj, "value");
    5685           0 :                         if (tmp == NULL) goto failed;
    5686           0 :                         res = obj2ast_expr(tmp, &value, arena);
    5687           0 :                         if (res != 0) goto failed;
    5688           0 :                         Py_XDECREF(tmp);
    5689           0 :                         tmp = NULL;
    5690             :                 } else {
    5691           0 :                         PyErr_SetString(PyExc_TypeError, "required field \"value\" missing from Attribute");
    5692           0 :                         return 1;
    5693             :                 }
    5694           0 :                 if (PyObject_HasAttrString(obj, "attr")) {
    5695             :                         int res;
    5696           0 :                         tmp = PyObject_GetAttrString(obj, "attr");
    5697           0 :                         if (tmp == NULL) goto failed;
    5698           0 :                         res = obj2ast_identifier(tmp, &attr, arena);
    5699           0 :                         if (res != 0) goto failed;
    5700           0 :                         Py_XDECREF(tmp);
    5701           0 :                         tmp = NULL;
    5702             :                 } else {
    5703           0 :                         PyErr_SetString(PyExc_TypeError, "required field \"attr\" missing from Attribute");
    5704           0 :                         return 1;
    5705             :                 }
    5706           0 :                 if (PyObject_HasAttrString(obj, "ctx")) {
    5707             :                         int res;
    5708           0 :                         tmp = PyObject_GetAttrString(obj, "ctx");
    5709           0 :                         if (tmp == NULL) goto failed;
    5710           0 :                         res = obj2ast_expr_context(tmp, &ctx, arena);
    5711           0 :                         if (res != 0) goto failed;
    5712           0 :                         Py_XDECREF(tmp);
    5713           0 :                         tmp = NULL;
    5714             :                 } else {
    5715           0 :                         PyErr_SetString(PyExc_TypeError, "required field \"ctx\" missing from Attribute");
    5716           0 :                         return 1;
    5717             :                 }
    5718           0 :                 *out = Attribute(value, attr, ctx, lineno, col_offset, arena);
    5719           0 :                 if (*out == NULL) goto failed;
    5720           0 :                 return 0;
    5721             :         }
    5722           0 :         isinstance = PyObject_IsInstance(obj, (PyObject*)Subscript_type);
    5723           0 :         if (isinstance == -1) {
    5724           0 :                 return 1;
    5725             :         }
    5726           0 :         if (isinstance) {
    5727             :                 expr_ty value;
    5728             :                 slice_ty slice;
    5729             :                 expr_context_ty ctx;
    5730             : 
    5731           0 :                 if (PyObject_HasAttrString(obj, "value")) {
    5732             :                         int res;
    5733           0 :                         tmp = PyObject_GetAttrString(obj, "value");
    5734           0 :                         if (tmp == NULL) goto failed;
    5735           0 :                         res = obj2ast_expr(tmp, &value, arena);
    5736           0 :                         if (res != 0) goto failed;
    5737           0 :                         Py_XDECREF(tmp);
    5738           0 :                         tmp = NULL;
    5739             :                 } else {
    5740           0 :                         PyErr_SetString(PyExc_TypeError, "required field \"value\" missing from Subscript");
    5741           0 :                         return 1;
    5742             :                 }
    5743           0 :                 if (PyObject_HasAttrString(obj, "slice")) {
    5744             :                         int res;
    5745           0 :                         tmp = PyObject_GetAttrString(obj, "slice");
    5746           0 :                         if (tmp == NULL) goto failed;
    5747           0 :                         res = obj2ast_slice(tmp, &slice, arena);
    5748           0 :                         if (res != 0) goto failed;
    5749           0 :                         Py_XDECREF(tmp);
    5750           0 :                         tmp = NULL;
    5751             :                 } else {
    5752           0 :                         PyErr_SetString(PyExc_TypeError, "required field \"slice\" missing from Subscript");
    5753           0 :                         return 1;
    5754             :                 }
    5755           0 :                 if (PyObject_HasAttrString(obj, "ctx")) {
    5756             :                         int res;
    5757           0 :                         tmp = PyObject_GetAttrString(obj, "ctx");
    5758           0 :                         if (tmp == NULL) goto failed;
    5759           0 :                         res = obj2ast_expr_context(tmp, &ctx, arena);
    5760           0 :                         if (res != 0) goto failed;
    5761           0 :                         Py_XDECREF(tmp);
    5762           0 :                         tmp = NULL;
    5763             :                 } else {
    5764           0 :                         PyErr_SetString(PyExc_TypeError, "required field \"ctx\" missing from Subscript");
    5765           0 :                         return 1;
    5766             :                 }
    5767           0 :                 *out = Subscript(value, slice, ctx, lineno, col_offset, arena);
    5768           0 :                 if (*out == NULL) goto failed;
    5769           0 :                 return 0;
    5770             :         }
    5771           0 :         isinstance = PyObject_IsInstance(obj, (PyObject*)Name_type);
    5772           0 :         if (isinstance == -1) {
    5773           0 :                 return 1;
    5774             :         }
    5775           0 :         if (isinstance) {
    5776             :                 identifier id;
    5777             :                 expr_context_ty ctx;
    5778             : 
    5779           0 :                 if (PyObject_HasAttrString(obj, "id")) {
    5780             :                         int res;
    5781           0 :                         tmp = PyObject_GetAttrString(obj, "id");
    5782           0 :                         if (tmp == NULL) goto failed;
    5783           0 :                         res = obj2ast_identifier(tmp, &id, arena);
    5784           0 :                         if (res != 0) goto failed;
    5785           0 :                         Py_XDECREF(tmp);
    5786           0 :                         tmp = NULL;
    5787             :                 } else {
    5788           0 :                         PyErr_SetString(PyExc_TypeError, "required field \"id\" missing from Name");
    5789           0 :                         return 1;
    5790             :                 }
    5791           0 :                 if (PyObject_HasAttrString(obj, "ctx")) {
    5792             :                         int res;
    5793           0 :                         tmp = PyObject_GetAttrString(obj, "ctx");
    5794           0 :                         if (tmp == NULL) goto failed;
    5795           0 :                         res = obj2ast_expr_context(tmp, &ctx, arena);
    5796           0 :                         if (res != 0) goto failed;
    5797           0 :                         Py_XDECREF(tmp);
    5798           0 :                         tmp = NULL;
    5799             :                 } else {
    5800           0 :                         PyErr_SetString(PyExc_TypeError, "required field \"ctx\" missing from Name");
    5801           0 :                         return 1;
    5802             :                 }
    5803           0 :                 *out = Name(id, ctx, lineno, col_offset, arena);
    5804           0 :                 if (*out == NULL) goto failed;
    5805           0 :                 return 0;
    5806             :         }
    5807           0 :         isinstance = PyObject_IsInstance(obj, (PyObject*)List_type);
    5808           0 :         if (isinstance == -1) {
    5809           0 :                 return 1;
    5810             :         }
    5811           0 :         if (isinstance) {
    5812             :                 asdl_seq* elts;
    5813             :                 expr_context_ty ctx;
    5814             : 
    5815           0 :                 if (PyObject_HasAttrString(obj, "elts")) {
    5816             :                         int res;
    5817             :                         Py_ssize_t len;
    5818             :                         Py_ssize_t i;
    5819           0 :                         tmp = PyObject_GetAttrString(obj, "elts");
    5820           0 :                         if (tmp == NULL) goto failed;
    5821           0 :                         if (!PyList_Check(tmp)) {
    5822           0 :                                 PyErr_Format(PyExc_TypeError, "List field \"elts\" must be a list, not a %.200s", tmp->ob_type->tp_name);
    5823           0 :                                 goto failed;
    5824             :                         }
    5825           0 :                         len = PyList_GET_SIZE(tmp);
    5826           0 :                         elts = asdl_seq_new(len, arena);
    5827           0 :                         if (elts == NULL) goto failed;
    5828           0 :                         for (i = 0; i < len; i++) {
    5829             :                                 expr_ty value;
    5830           0 :                                 res = obj2ast_expr(PyList_GET_ITEM(tmp, i), &value, arena);
    5831           0 :                                 if (res != 0) goto failed;
    5832           0 :                                 if (len != PyList_GET_SIZE(tmp)) {
    5833           0 :                                         PyErr_SetString(PyExc_RuntimeError, "List field \"elts\" changed size during iteration");
    5834           0 :                                         goto failed;
    5835             :                                 }
    5836           0 :                                 asdl_seq_SET(elts, i, value);
    5837             :                         }
    5838           0 :                         Py_XDECREF(tmp);
    5839           0 :                         tmp = NULL;
    5840             :                 } else {
    5841           0 :                         PyErr_SetString(PyExc_TypeError, "required field \"elts\" missing from List");
    5842           0 :                         return 1;
    5843             :                 }
    5844           0 :                 if (PyObject_HasAttrString(obj, "ctx")) {
    5845             :                         int res;
    5846           0 :                         tmp = PyObject_GetAttrString(obj, "ctx");
    5847           0 :                         if (tmp == NULL) goto failed;
    5848           0 :                         res = obj2ast_expr_context(tmp, &ctx, arena);
    5849           0 :                         if (res != 0) goto failed;
    5850           0 :                         Py_XDECREF(tmp);
    5851           0 :                         tmp = NULL;
    5852             :                 } else {
    5853           0 :                         PyErr_SetString(PyExc_TypeError, "required field \"ctx\" missing from List");
    5854           0 :                         return 1;
    5855             :                 }
    5856           0 :                 *out = List(elts, ctx, lineno, col_offset, arena);
    5857           0 :                 if (*out == NULL) goto failed;
    5858           0 :                 return 0;
    5859             :         }
    5860           0 :         isinstance = PyObject_IsInstance(obj, (PyObject*)Tuple_type);
    5861           0 :         if (isinstance == -1) {
    5862           0 :                 return 1;
    5863             :         }
    5864           0 :         if (isinstance) {
    5865             :                 asdl_seq* elts;
    5866             :                 expr_context_ty ctx;
    5867             : 
    5868           0 :                 if (PyObject_HasAttrString(obj, "elts")) {
    5869             :                         int res;
    5870             :                         Py_ssize_t len;
    5871             :                         Py_ssize_t i;
    5872           0 :                         tmp = PyObject_GetAttrString(obj, "elts");
    5873           0 :                         if (tmp == NULL) goto failed;
    5874           0 :                         if (!PyList_Check(tmp)) {
    5875           0 :                                 PyErr_Format(PyExc_TypeError, "Tuple field \"elts\" must be a list, not a %.200s", tmp->ob_type->tp_name);
    5876           0 :                                 goto failed;
    5877             :                         }
    5878           0 :                         len = PyList_GET_SIZE(tmp);
    5879           0 :                         elts = asdl_seq_new(len, arena);
    5880           0 :                         if (elts == NULL) goto failed;
    5881           0 :                         for (i = 0; i < len; i++) {
    5882             :                                 expr_ty value;
    5883           0 :                                 res = obj2ast_expr(PyList_GET_ITEM(tmp, i), &value, arena);
    5884           0 :                                 if (res != 0) goto failed;
    5885           0 :                                 if (len != PyList_GET_SIZE(tmp)) {
    5886           0 :                                         PyErr_SetString(PyExc_RuntimeError, "Tuple field \"elts\" changed size during iteration");
    5887           0 :                                         goto failed;
    5888             :                                 }
    5889           0 :                                 asdl_seq_SET(elts, i, value);
    5890             :                         }
    5891           0 :                         Py_XDECREF(tmp);
    5892           0 :                         tmp = NULL;
    5893             :                 } else {
    5894           0 :                         PyErr_SetString(PyExc_TypeError, "required field \"elts\" missing from Tuple");
    5895           0 :                         return 1;
    5896             :                 }
    5897           0 :                 if (PyObject_HasAttrString(obj, "ctx")) {
    5898             :                         int res;
    5899           0 :                         tmp = PyObject_GetAttrString(obj, "ctx");
    5900           0 :                         if (tmp == NULL) goto failed;
    5901           0 :                         res = obj2ast_expr_context(tmp, &ctx, arena);
    5902           0 :                         if (res != 0) goto failed;
    5903           0 :                         Py_XDECREF(tmp);
    5904           0 :                         tmp = NULL;
    5905             :                 } else {
    5906           0 :                         PyErr_SetString(PyExc_TypeError, "required field \"ctx\" missing from Tuple");
    5907           0 :                         return 1;
    5908             :                 }
    5909           0 :                 *out = Tuple(elts, ctx, lineno, col_offset, arena);
    5910           0 :                 if (*out == NULL) goto failed;
    5911           0 :                 return 0;
    5912             :         }
    5913             : 
    5914           0 :         tmp = PyObject_Repr(obj);
    5915           0 :         if (tmp == NULL) goto failed;
    5916           0 :         PyErr_Format(PyExc_TypeError, "expected some sort of expr, but got %.400s", PyString_AS_STRING(tmp));
    5917             : failed:
    5918           0 :         Py_XDECREF(tmp);
    5919           0 :         return 1;
    5920             : }
    5921             : 
    5922             : int
    5923           0 : obj2ast_expr_context(PyObject* obj, expr_context_ty* out, PyArena* arena)
    5924             : {
    5925           0 :         PyObject* tmp = NULL;
    5926             :         int isinstance;
    5927             : 
    5928           0 :         isinstance = PyObject_IsInstance(obj, (PyObject *)Load_type);
    5929           0 :         if (isinstance == -1) {
    5930           0 :                 return 1;
    5931             :         }
    5932           0 :         if (isinstance) {
    5933           0 :                 *out = Load;
    5934           0 :                 return 0;
    5935             :         }
    5936           0 :         isinstance = PyObject_IsInstance(obj, (PyObject *)Store_type);
    5937           0 :         if (isinstance == -1) {
    5938           0 :                 return 1;
    5939             :         }
    5940           0 :         if (isinstance) {
    5941           0 :                 *out = Store;
    5942           0 :                 return 0;
    5943             :         }
    5944           0 :         isinstance = PyObject_IsInstance(obj, (PyObject *)Del_type);
    5945           0 :         if (isinstance == -1) {
    5946           0 :                 return 1;
    5947             :         }
    5948           0 :         if (isinstance) {
    5949           0 :                 *out = Del;
    5950           0 :                 return 0;
    5951             :         }
    5952           0 :         isinstance = PyObject_IsInstance(obj, (PyObject *)AugLoad_type);
    5953           0 :         if (isinstance == -1) {
    5954           0 :                 return 1;
    5955             :         }
    5956           0 :         if (isinstance) {
    5957           0 :                 *out = AugLoad;
    5958           0 :                 return 0;
    5959             :         }
    5960           0 :         isinstance = PyObject_IsInstance(obj, (PyObject *)AugStore_type);
    5961           0 :         if (isinstance == -1) {
    5962           0 :                 return 1;
    5963             :         }
    5964           0 :         if (isinstance) {
    5965           0 :                 *out = AugStore;
    5966           0 :                 return 0;
    5967             :         }
    5968           0 :         isinstance = PyObject_IsInstance(obj, (PyObject *)Param_type);
    5969           0 :         if (isinstance == -1) {
    5970           0 :                 return 1;
    5971             :         }
    5972           0 :         if (isinstance) {
    5973           0 :                 *out = Param;
    5974           0 :                 return 0;
    5975             :         }
    5976             : 
    5977           0 :         tmp = PyObject_Repr(obj);
    5978           0 :         if (tmp == NULL) goto failed;
    5979           0 :         PyErr_Format(PyExc_TypeError, "expected some sort of expr_context, but got %.400s", PyString_AS_STRING(tmp));
    5980             : failed:
    5981           0 :         Py_XDECREF(tmp);
    5982           0 :         return 1;
    5983             : }
    5984             : 
    5985             : int
    5986           0 : obj2ast_slice(PyObject* obj, slice_ty* out, PyArena* arena)
    5987             : {
    5988           0 :         PyObject* tmp = NULL;
    5989             :         int isinstance;
    5990             : 
    5991             : 
    5992           0 :         if (obj == Py_None) {
    5993           0 :                 *out = NULL;
    5994           0 :                 return 0;
    5995             :         }
    5996           0 :         isinstance = PyObject_IsInstance(obj, (PyObject*)Ellipsis_type);
    5997           0 :         if (isinstance == -1) {
    5998           0 :                 return 1;
    5999             :         }
    6000           0 :         if (isinstance) {
    6001             : 
    6002           0 :                 *out = Ellipsis(arena);
    6003           0 :                 if (*out == NULL) goto failed;
    6004           0 :                 return 0;
    6005             :         }
    6006           0 :         isinstance = PyObject_IsInstance(obj, (PyObject*)Slice_type);
    6007           0 :         if (isinstance == -1) {
    6008           0 :                 return 1;
    6009             :         }
    6010           0 :         if (isinstance) {
    6011             :                 expr_ty lower;
    6012             :                 expr_ty upper;
    6013             :                 expr_ty step;
    6014             : 
    6015           0 :                 if (PyObject_HasAttrString(obj, "lower")) {
    6016             :                         int res;
    6017           0 :                         tmp = PyObject_GetAttrString(obj, "lower");
    6018           0 :                         if (tmp == NULL) goto failed;
    6019           0 :                         res = obj2ast_expr(tmp, &lower, arena);
    6020           0 :                         if (res != 0) goto failed;
    6021           0 :                         Py_XDECREF(tmp);
    6022           0 :                         tmp = NULL;
    6023             :                 } else {
    6024           0 :                         lower = NULL;
    6025             :                 }
    6026           0 :                 if (PyObject_HasAttrString(obj, "upper")) {
    6027             :                         int res;
    6028           0 :                         tmp = PyObject_GetAttrString(obj, "upper");
    6029           0 :                         if (tmp == NULL) goto failed;
    6030           0 :                         res = obj2ast_expr(tmp, &upper, arena);
    6031           0 :                         if (res != 0) goto failed;
    6032           0 :                         Py_XDECREF(tmp);
    6033           0 :                         tmp = NULL;
    6034             :                 } else {
    6035           0 :                         upper = NULL;
    6036             :                 }
    6037           0 :                 if (PyObject_HasAttrString(obj, "step")) {
    6038             :                         int res;
    6039           0 :                         tmp = PyObject_GetAttrString(obj, "step");
    6040           0 :                         if (tmp == NULL) goto failed;
    6041           0 :                         res = obj2ast_expr(tmp, &step, arena);
    6042           0 :                         if (res != 0) goto failed;
    6043           0 :                         Py_XDECREF(tmp);
    6044           0 :                         tmp = NULL;
    6045             :                 } else {
    6046           0 :                         step = NULL;
    6047             :                 }
    6048           0 :                 *out = Slice(lower, upper, step, arena);
    6049           0 :                 if (*out == NULL) goto failed;
    6050           0 :                 return 0;
    6051             :         }
    6052           0 :         isinstance = PyObject_IsInstance(obj, (PyObject*)ExtSlice_type);
    6053           0 :         if (isinstance == -1) {
    6054           0 :                 return 1;
    6055             :         }
    6056           0 :         if (isinstance) {
    6057             :                 asdl_seq* dims;
    6058             : 
    6059           0 :                 if (PyObject_HasAttrString(obj, "dims")) {
    6060             :                         int res;
    6061             :                         Py_ssize_t len;
    6062             :                         Py_ssize_t i;
    6063           0 :                         tmp = PyObject_GetAttrString(obj, "dims");
    6064           0 :                         if (tmp == NULL) goto failed;
    6065           0 :                         if (!PyList_Check(tmp)) {
    6066           0 :                                 PyErr_Format(PyExc_TypeError, "ExtSlice field \"dims\" must be a list, not a %.200s", tmp->ob_type->tp_name);
    6067           0 :                                 goto failed;
    6068             :                         }
    6069           0 :                         len = PyList_GET_SIZE(tmp);
    6070           0 :                         dims = asdl_seq_new(len, arena);
    6071           0 :                         if (dims == NULL) goto failed;
    6072           0 :                         for (i = 0; i < len; i++) {
    6073             :                                 slice_ty value;
    6074           0 :                                 res = obj2ast_slice(PyList_GET_ITEM(tmp, i), &value, arena);
    6075           0 :                                 if (res != 0) goto failed;
    6076           0 :                                 if (len != PyList_GET_SIZE(tmp)) {
    6077           0 :                                         PyErr_SetString(PyExc_RuntimeError, "ExtSlice field \"dims\" changed size during iteration");
    6078           0 :                                         goto failed;
    6079             :                                 }
    6080           0 :                                 asdl_seq_SET(dims, i, value);
    6081             :                         }
    6082           0 :                         Py_XDECREF(tmp);
    6083           0 :                         tmp = NULL;
    6084             :                 } else {
    6085           0 :                         PyErr_SetString(PyExc_TypeError, "required field \"dims\" missing from ExtSlice");
    6086           0 :                         return 1;
    6087             :                 }
    6088           0 :                 *out = ExtSlice(dims, arena);
    6089           0 :                 if (*out == NULL) goto failed;
    6090           0 :                 return 0;
    6091             :         }
    6092           0 :         isinstance = PyObject_IsInstance(obj, (PyObject*)Index_type);
    6093           0 :         if (isinstance == -1) {
    6094           0 :                 return 1;
    6095             :         }
    6096           0 :         if (isinstance) {
    6097             :                 expr_ty value;
    6098             : 
    6099           0 :                 if (PyObject_HasAttrString(obj, "value")) {
    6100             :                         int res;
    6101           0 :                         tmp = PyObject_GetAttrString(obj, "value");
    6102           0 :                         if (tmp == NULL) goto failed;
    6103           0 :                         res = obj2ast_expr(tmp, &value, arena);
    6104           0 :                         if (res != 0) goto failed;
    6105           0 :                         Py_XDECREF(tmp);
    6106           0 :                         tmp = NULL;
    6107             :                 } else {
    6108           0 :                         PyErr_SetString(PyExc_TypeError, "required field \"value\" missing from Index");
    6109           0 :                         return 1;
    6110             :                 }
    6111           0 :                 *out = Index(value, arena);
    6112           0 :                 if (*out == NULL) goto failed;
    6113           0 :                 return 0;
    6114             :         }
    6115             : 
    6116           0 :         tmp = PyObject_Repr(obj);
    6117           0 :         if (tmp == NULL) goto failed;
    6118           0 :         PyErr_Format(PyExc_TypeError, "expected some sort of slice, but got %.400s", PyString_AS_STRING(tmp));
    6119             : failed:
    6120           0 :         Py_XDECREF(tmp);
    6121           0 :         return 1;
    6122             : }
    6123             : 
    6124             : int
    6125           0 : obj2ast_boolop(PyObject* obj, boolop_ty* out, PyArena* arena)
    6126             : {
    6127           0 :         PyObject* tmp = NULL;
    6128             :         int isinstance;
    6129             : 
    6130           0 :         isinstance = PyObject_IsInstance(obj, (PyObject *)And_type);
    6131           0 :         if (isinstance == -1) {
    6132           0 :                 return 1;
    6133             :         }
    6134           0 :         if (isinstance) {
    6135           0 :                 *out = And;
    6136           0 :                 return 0;
    6137             :         }
    6138           0 :         isinstance = PyObject_IsInstance(obj, (PyObject *)Or_type);
    6139           0 :         if (isinstance == -1) {
    6140           0 :                 return 1;
    6141             :         }
    6142           0 :         if (isinstance) {
    6143           0 :                 *out = Or;
    6144           0 :                 return 0;
    6145             :         }
    6146             : 
    6147           0 :         tmp = PyObject_Repr(obj);
    6148           0 :         if (tmp == NULL) goto failed;
    6149           0 :         PyErr_Format(PyExc_TypeError, "expected some sort of boolop, but got %.400s", PyString_AS_STRING(tmp));
    6150             : failed:
    6151           0 :         Py_XDECREF(tmp);
    6152           0 :         return 1;
    6153             : }
    6154             : 
    6155             : int
    6156           0 : obj2ast_operator(PyObject* obj, operator_ty* out, PyArena* arena)
    6157             : {
    6158           0 :         PyObject* tmp = NULL;
    6159             :         int isinstance;
    6160             : 
    6161           0 :         isinstance = PyObject_IsInstance(obj, (PyObject *)Add_type);
    6162           0 :         if (isinstance == -1) {
    6163           0 :                 return 1;
    6164             :         }
    6165           0 :         if (isinstance) {
    6166           0 :                 *out = Add;
    6167           0 :                 return 0;
    6168             :         }
    6169           0 :         isinstance = PyObject_IsInstance(obj, (PyObject *)Sub_type);
    6170           0 :         if (isinstance == -1) {
    6171           0 :                 return 1;
    6172             :         }
    6173           0 :         if (isinstance) {
    6174           0 :                 *out = Sub;
    6175           0 :                 return 0;
    6176             :         }
    6177           0 :         isinstance = PyObject_IsInstance(obj, (PyObject *)Mult_type);
    6178           0 :         if (isinstance == -1) {
    6179           0 :                 return 1;
    6180             :         }
    6181           0 :         if (isinstance) {
    6182           0 :                 *out = Mult;
    6183           0 :                 return 0;
    6184             :         }
    6185           0 :         isinstance = PyObject_IsInstance(obj, (PyObject *)Div_type);
    6186           0 :         if (isinstance == -1) {
    6187           0 :                 return 1;
    6188             :         }
    6189           0 :         if (isinstance) {
    6190           0 :                 *out = Div;
    6191           0 :                 return 0;
    6192             :         }
    6193           0 :         isinstance = PyObject_IsInstance(obj, (PyObject *)Mod_type);
    6194           0 :         if (isinstance == -1) {
    6195           0 :                 return 1;
    6196             :         }
    6197           0 :         if (isinstance) {
    6198           0 :                 *out = Mod;
    6199           0 :                 return 0;
    6200             :         }
    6201           0 :         isinstance = PyObject_IsInstance(obj, (PyObject *)Pow_type);
    6202           0 :         if (isinstance == -1) {
    6203           0 :                 return 1;
    6204             :         }
    6205           0 :         if (isinstance) {
    6206           0 :                 *out = Pow;
    6207           0 :                 return 0;
    6208             :         }
    6209           0 :         isinstance = PyObject_IsInstance(obj, (PyObject *)LShift_type);
    6210           0 :         if (isinstance == -1) {
    6211           0 :                 return 1;
    6212             :         }
    6213           0 :         if (isinstance) {
    6214           0 :                 *out = LShift;
    6215           0 :                 return 0;
    6216             :         }
    6217           0 :         isinstance = PyObject_IsInstance(obj, (PyObject *)RShift_type);
    6218           0 :         if (isinstance == -1) {
    6219           0 :                 return 1;
    6220             :         }
    6221           0 :         if (isinstance) {
    6222           0 :                 *out = RShift;
    6223           0 :                 return 0;
    6224             :         }
    6225           0 :         isinstance = PyObject_IsInstance(obj, (PyObject *)BitOr_type);
    6226           0 :         if (isinstance == -1) {
    6227           0 :                 return 1;
    6228             :         }
    6229           0 :         if (isinstance) {
    6230           0 :                 *out = BitOr;
    6231           0 :                 return 0;
    6232             :         }
    6233           0 :         isinstance = PyObject_IsInstance(obj, (PyObject *)BitXor_type);
    6234           0 :         if (isinstance == -1) {
    6235           0 :                 return 1;
    6236             :         }
    6237           0 :         if (isinstance) {
    6238           0 :                 *out = BitXor;
    6239           0 :                 return 0;
    6240             :         }
    6241           0 :         isinstance = PyObject_IsInstance(obj, (PyObject *)BitAnd_type);
    6242           0 :         if (isinstance == -1) {
    6243           0 :                 return 1;
    6244             :         }
    6245           0 :         if (isinstance) {
    6246           0 :                 *out = BitAnd;
    6247           0 :                 return 0;
    6248             :         }
    6249           0 :         isinstance = PyObject_IsInstance(obj, (PyObject *)FloorDiv_type);
    6250           0 :         if (isinstance == -1) {
    6251           0 :                 return 1;
    6252             :         }
    6253           0 :         if (isinstance) {
    6254           0 :                 *out = FloorDiv;
    6255           0 :                 return 0;
    6256             :         }
    6257             : 
    6258           0 :         tmp = PyObject_Repr(obj);
    6259           0 :         if (tmp == NULL) goto failed;
    6260           0 :         PyErr_Format(PyExc_TypeError, "expected some sort of operator, but got %.400s", PyString_AS_STRING(tmp));
    6261             : failed:
    6262           0 :         Py_XDECREF(tmp);
    6263           0 :         return 1;
    6264             : }
    6265             : 
    6266             : int
    6267           0 : obj2ast_unaryop(PyObject* obj, unaryop_ty* out, PyArena* arena)
    6268             : {
    6269           0 :         PyObject* tmp = NULL;
    6270             :         int isinstance;
    6271             : 
    6272           0 :         isinstance = PyObject_IsInstance(obj, (PyObject *)Invert_type);
    6273           0 :         if (isinstance == -1) {
    6274           0 :                 return 1;
    6275             :         }
    6276           0 :         if (isinstance) {
    6277           0 :                 *out = Invert;
    6278           0 :                 return 0;
    6279             :         }
    6280           0 :         isinstance = PyObject_IsInstance(obj, (PyObject *)Not_type);
    6281           0 :         if (isinstance == -1) {
    6282           0 :                 return 1;
    6283             :         }
    6284           0 :         if (isinstance) {
    6285           0 :                 *out = Not;
    6286           0 :                 return 0;
    6287             :         }
    6288           0 :         isinstance = PyObject_IsInstance(obj, (PyObject *)UAdd_type);
    6289           0 :         if (isinstance == -1) {
    6290           0 :                 return 1;
    6291             :         }
    6292           0 :         if (isinstance) {
    6293           0 :                 *out = UAdd;
    6294           0 :                 return 0;
    6295             :         }
    6296           0 :         isinstance = PyObject_IsInstance(obj, (PyObject *)USub_type);
    6297           0 :         if (isinstance == -1) {
    6298           0 :                 return 1;
    6299             :         }
    6300           0 :         if (isinstance) {
    6301           0 :                 *out = USub;
    6302           0 :                 return 0;
    6303             :         }
    6304             : 
    6305           0 :         tmp = PyObject_Repr(obj);
    6306           0 :         if (tmp == NULL) goto failed;
    6307           0 :         PyErr_Format(PyExc_TypeError, "expected some sort of unaryop, but got %.400s", PyString_AS_STRING(tmp));
    6308             : failed:
    6309           0 :         Py_XDECREF(tmp);
    6310           0 :         return 1;
    6311             : }
    6312             : 
    6313             : int
    6314           0 : obj2ast_cmpop(PyObject* obj, cmpop_ty* out, PyArena* arena)
    6315             : {
    6316           0 :         PyObject* tmp = NULL;
    6317             :         int isinstance;
    6318             : 
    6319           0 :         isinstance = PyObject_IsInstance(obj, (PyObject *)Eq_type);
    6320           0 :         if (isinstance == -1) {
    6321           0 :                 return 1;
    6322             :         }
    6323           0 :         if (isinstance) {
    6324           0 :                 *out = Eq;
    6325           0 :                 return 0;
    6326             :         }
    6327           0 :         isinstance = PyObject_IsInstance(obj, (PyObject *)NotEq_type);
    6328           0 :         if (isinstance == -1) {
    6329           0 :                 return 1;
    6330             :         }
    6331           0 :         if (isinstance) {
    6332           0 :                 *out = NotEq;
    6333           0 :                 return 0;
    6334             :         }
    6335           0 :         isinstance = PyObject_IsInstance(obj, (PyObject *)Lt_type);
    6336           0 :         if (isinstance == -1) {
    6337           0 :                 return 1;
    6338             :         }
    6339           0 :         if (isinstance) {
    6340           0 :                 *out = Lt;
    6341           0 :                 return 0;
    6342             :         }
    6343           0 :         isinstance = PyObject_IsInstance(obj, (PyObject *)LtE_type);
    6344           0 :         if (isinstance == -1) {
    6345           0 :                 return 1;
    6346             :         }
    6347           0 :         if (isinstance) {
    6348           0 :                 *out = LtE;
    6349           0 :                 return 0;
    6350             :         }
    6351           0 :         isinstance = PyObject_IsInstance(obj, (PyObject *)Gt_type);
    6352           0 :         if (isinstance == -1) {
    6353           0 :                 return 1;
    6354             :         }
    6355           0 :         if (isinstance) {
    6356           0 :                 *out = Gt;
    6357           0 :                 return 0;
    6358             :         }
    6359           0 :         isinstance = PyObject_IsInstance(obj, (PyObject *)GtE_type);
    6360           0 :         if (isinstance == -1) {
    6361           0 :                 return 1;
    6362             :         }
    6363           0 :         if (isinstance) {
    6364           0 :                 *out = GtE;
    6365           0 :                 return 0;
    6366             :         }
    6367           0 :         isinstance = PyObject_IsInstance(obj, (PyObject *)Is_type);
    6368           0 :         if (isinstance == -1) {
    6369           0 :                 return 1;
    6370             :         }
    6371           0 :         if (isinstance) {
    6372           0 :                 *out = Is;
    6373           0 :                 return 0;
    6374             :         }
    6375           0 :         isinstance = PyObject_IsInstance(obj, (PyObject *)IsNot_type);
    6376           0 :         if (isinstance == -1) {
    6377           0 :                 return 1;
    6378             :         }
    6379           0 :         if (isinstance) {
    6380           0 :                 *out = IsNot;
    6381           0 :                 return 0;
    6382             :         }
    6383           0 :         isinstance = PyObject_IsInstance(obj, (PyObject *)In_type);
    6384           0 :         if (isinstance == -1) {
    6385           0 :                 return 1;
    6386             :         }
    6387           0 :         if (isinstance) {
    6388           0 :                 *out = In;
    6389           0 :                 return 0;
    6390             :         }
    6391           0 :         isinstance = PyObject_IsInstance(obj, (PyObject *)NotIn_type);
    6392           0 :         if (isinstance == -1) {
    6393           0 :                 return 1;
    6394             :         }
    6395           0 :         if (isinstance) {
    6396           0 :                 *out = NotIn;
    6397           0 :                 return 0;
    6398             :         }
    6399             : 
    6400           0 :         tmp = PyObject_Repr(obj);
    6401           0 :         if (tmp == NULL) goto failed;
    6402           0 :         PyErr_Format(PyExc_TypeError, "expected some sort of cmpop, but got %.400s", PyString_AS_STRING(tmp));
    6403             : failed:
    6404           0 :         Py_XDECREF(tmp);
    6405           0 :         return 1;
    6406             : }
    6407             : 
    6408             : int
    6409           0 : obj2ast_comprehension(PyObject* obj, comprehension_ty* out, PyArena* arena)
    6410             : {
    6411           0 :         PyObject* tmp = NULL;
    6412             :         expr_ty target;
    6413             :         expr_ty iter;
    6414             :         asdl_seq* ifs;
    6415             : 
    6416           0 :         if (PyObject_HasAttrString(obj, "target")) {
    6417             :                 int res;
    6418           0 :                 tmp = PyObject_GetAttrString(obj, "target");
    6419           0 :                 if (tmp == NULL) goto failed;
    6420           0 :                 res = obj2ast_expr(tmp, &target, arena);
    6421           0 :                 if (res != 0) goto failed;
    6422           0 :                 Py_XDECREF(tmp);
    6423           0 :                 tmp = NULL;
    6424             :         } else {
    6425           0 :                 PyErr_SetString(PyExc_TypeError, "required field \"target\" missing from comprehension");
    6426           0 :                 return 1;
    6427             :         }
    6428           0 :         if (PyObject_HasAttrString(obj, "iter")) {
    6429             :                 int res;
    6430           0 :                 tmp = PyObject_GetAttrString(obj, "iter");
    6431           0 :                 if (tmp == NULL) goto failed;
    6432           0 :                 res = obj2ast_expr(tmp, &iter, arena);
    6433           0 :                 if (res != 0) goto failed;
    6434           0 :                 Py_XDECREF(tmp);
    6435           0 :                 tmp = NULL;
    6436             :         } else {
    6437           0 :                 PyErr_SetString(PyExc_TypeError, "required field \"iter\" missing from comprehension");
    6438           0 :                 return 1;
    6439             :         }
    6440           0 :         if (PyObject_HasAttrString(obj, "ifs")) {
    6441             :                 int res;
    6442             :                 Py_ssize_t len;
    6443             :                 Py_ssize_t i;
    6444           0 :                 tmp = PyObject_GetAttrString(obj, "ifs");
    6445           0 :                 if (tmp == NULL) goto failed;
    6446           0 :                 if (!PyList_Check(tmp)) {
    6447           0 :                         PyErr_Format(PyExc_TypeError, "comprehension field \"ifs\" must be a list, not a %.200s", tmp->ob_type->tp_name);
    6448           0 :                         goto failed;
    6449             :                 }
    6450           0 :                 len = PyList_GET_SIZE(tmp);
    6451           0 :                 ifs = asdl_seq_new(len, arena);
    6452           0 :                 if (ifs == NULL) goto failed;
    6453           0 :                 for (i = 0; i < len; i++) {
    6454             :                         expr_ty value;
    6455           0 :                         res = obj2ast_expr(PyList_GET_ITEM(tmp, i), &value, arena);
    6456           0 :                         if (res != 0) goto failed;
    6457           0 :                         if (len != PyList_GET_SIZE(tmp)) {
    6458           0 :                                 PyErr_SetString(PyExc_RuntimeError, "comprehension field \"ifs\" changed size during iteration");
    6459           0 :                                 goto failed;
    6460             :                         }
    6461           0 :                         asdl_seq_SET(ifs, i, value);
    6462             :                 }
    6463           0 :                 Py_XDECREF(tmp);
    6464           0 :                 tmp = NULL;
    6465             :         } else {
    6466           0 :                 PyErr_SetString(PyExc_TypeError, "required field \"ifs\" missing from comprehension");
    6467           0 :                 return 1;
    6468             :         }
    6469           0 :         *out = comprehension(target, iter, ifs, arena);
    6470           0 :         return 0;
    6471             : failed:
    6472           0 :         Py_XDECREF(tmp);
    6473           0 :         return 1;
    6474             : }
    6475             : 
    6476             : int
    6477           0 : obj2ast_excepthandler(PyObject* obj, excepthandler_ty* out, PyArena* arena)
    6478             : {
    6479           0 :         PyObject* tmp = NULL;
    6480             :         int isinstance;
    6481             : 
    6482             :         int lineno;
    6483             :         int col_offset;
    6484             : 
    6485           0 :         if (obj == Py_None) {
    6486           0 :                 *out = NULL;
    6487           0 :                 return 0;
    6488             :         }
    6489           0 :         if (PyObject_HasAttrString(obj, "lineno")) {
    6490             :                 int res;
    6491           0 :                 tmp = PyObject_GetAttrString(obj, "lineno");
    6492           0 :                 if (tmp == NULL) goto failed;
    6493           0 :                 res = obj2ast_int(tmp, &lineno, arena);
    6494           0 :                 if (res != 0) goto failed;
    6495           0 :                 Py_XDECREF(tmp);
    6496           0 :                 tmp = NULL;
    6497             :         } else {
    6498           0 :                 PyErr_SetString(PyExc_TypeError, "required field \"lineno\" missing from excepthandler");
    6499           0 :                 return 1;
    6500             :         }
    6501           0 :         if (PyObject_HasAttrString(obj, "col_offset")) {
    6502             :                 int res;
    6503           0 :                 tmp = PyObject_GetAttrString(obj, "col_offset");
    6504           0 :                 if (tmp == NULL) goto failed;
    6505           0 :                 res = obj2ast_int(tmp, &col_offset, arena);
    6506           0 :                 if (res != 0) goto failed;
    6507           0 :                 Py_XDECREF(tmp);
    6508           0 :                 tmp = NULL;
    6509             :         } else {
    6510           0 :                 PyErr_SetString(PyExc_TypeError, "required field \"col_offset\" missing from excepthandler");
    6511           0 :                 return 1;
    6512             :         }
    6513           0 :         isinstance = PyObject_IsInstance(obj, (PyObject*)ExceptHandler_type);
    6514           0 :         if (isinstance == -1) {
    6515           0 :                 return 1;
    6516             :         }
    6517           0 :         if (isinstance) {
    6518             :                 expr_ty type;
    6519             :                 expr_ty name;
    6520             :                 asdl_seq* body;
    6521             : 
    6522           0 :                 if (PyObject_HasAttrString(obj, "type")) {
    6523             :                         int res;
    6524           0 :                         tmp = PyObject_GetAttrString(obj, "type");
    6525           0 :                         if (tmp == NULL) goto failed;
    6526           0 :                         res = obj2ast_expr(tmp, &type, arena);
    6527           0 :                         if (res != 0) goto failed;
    6528           0 :                         Py_XDECREF(tmp);
    6529           0 :                         tmp = NULL;
    6530             :                 } else {
    6531           0 :                         type = NULL;
    6532             :                 }
    6533           0 :                 if (PyObject_HasAttrString(obj, "name")) {
    6534             :                         int res;
    6535           0 :                         tmp = PyObject_GetAttrString(obj, "name");
    6536           0 :                         if (tmp == NULL) goto failed;
    6537           0 :                         res = obj2ast_expr(tmp, &name, arena);
    6538           0 :                         if (res != 0) goto failed;
    6539           0 :                         Py_XDECREF(tmp);
    6540           0 :                         tmp = NULL;
    6541             :                 } else {
    6542           0 :                         name = NULL;
    6543             :                 }
    6544           0 :                 if (PyObject_HasAttrString(obj, "body")) {
    6545             :                         int res;
    6546             :                         Py_ssize_t len;
    6547             :                         Py_ssize_t i;
    6548           0 :                         tmp = PyObject_GetAttrString(obj, "body");
    6549           0 :                         if (tmp == NULL) goto failed;
    6550           0 :                         if (!PyList_Check(tmp)) {
    6551           0 :                                 PyErr_Format(PyExc_TypeError, "ExceptHandler field \"body\" must be a list, not a %.200s", tmp->ob_type->tp_name);
    6552           0 :                                 goto failed;
    6553             :                         }
    6554           0 :                         len = PyList_GET_SIZE(tmp);
    6555           0 :                         body = asdl_seq_new(len, arena);
    6556           0 :                         if (body == NULL) goto failed;
    6557           0 :                         for (i = 0; i < len; i++) {
    6558             :                                 stmt_ty value;
    6559           0 :                                 res = obj2ast_stmt(PyList_GET_ITEM(tmp, i), &value, arena);
    6560           0 :                                 if (res != 0) goto failed;
    6561           0 :                                 if (len != PyList_GET_SIZE(tmp)) {
    6562           0 :                                         PyErr_SetString(PyExc_RuntimeError, "ExceptHandler field \"body\" changed size during iteration");
    6563           0 :                                         goto failed;
    6564             :                                 }
    6565           0 :                                 asdl_seq_SET(body, i, value);
    6566             :                         }
    6567           0 :                         Py_XDECREF(tmp);
    6568           0 :                         tmp = NULL;
    6569             :                 } else {
    6570           0 :                         PyErr_SetString(PyExc_TypeError, "required field \"body\" missing from ExceptHandler");
    6571           0 :                         return 1;
    6572             :                 }
    6573           0 :                 *out = ExceptHandler(type, name, body, lineno, col_offset,
    6574             :                                      arena);
    6575           0 :                 if (*out == NULL) goto failed;
    6576           0 :                 return 0;
    6577             :         }
    6578             : 
    6579           0 :         tmp = PyObject_Repr(obj);
    6580           0 :         if (tmp == NULL) goto failed;
    6581           0 :         PyErr_Format(PyExc_TypeError, "expected some sort of excepthandler, but got %.400s", PyString_AS_STRING(tmp));
    6582             : failed:
    6583           0 :         Py_XDECREF(tmp);
    6584           0 :         return 1;
    6585             : }
    6586             : 
    6587             : int
    6588           0 : obj2ast_arguments(PyObject* obj, arguments_ty* out, PyArena* arena)
    6589             : {
    6590           0 :         PyObject* tmp = NULL;
    6591             :         asdl_seq* args;
    6592             :         identifier vararg;
    6593             :         identifier kwarg;
    6594             :         asdl_seq* defaults;
    6595             : 
    6596           0 :         if (PyObject_HasAttrString(obj, "args")) {
    6597             :                 int res;
    6598             :                 Py_ssize_t len;
    6599             :                 Py_ssize_t i;
    6600           0 :                 tmp = PyObject_GetAttrString(obj, "args");
    6601           0 :                 if (tmp == NULL) goto failed;
    6602           0 :                 if (!PyList_Check(tmp)) {
    6603           0 :                         PyErr_Format(PyExc_TypeError, "arguments field \"args\" must be a list, not a %.200s", tmp->ob_type->tp_name);
    6604           0 :                         goto failed;
    6605             :                 }
    6606           0 :                 len = PyList_GET_SIZE(tmp);
    6607           0 :                 args = asdl_seq_new(len, arena);
    6608           0 :                 if (args == NULL) goto failed;
    6609           0 :                 for (i = 0; i < len; i++) {
    6610             :                         expr_ty value;
    6611           0 :                         res = obj2ast_expr(PyList_GET_ITEM(tmp, i), &value, arena);
    6612           0 :                         if (res != 0) goto failed;
    6613           0 :                         if (len != PyList_GET_SIZE(tmp)) {
    6614           0 :                                 PyErr_SetString(PyExc_RuntimeError, "arguments field \"args\" changed size during iteration");
    6615           0 :                                 goto failed;
    6616             :                         }
    6617           0 :                         asdl_seq_SET(args, i, value);
    6618             :                 }
    6619           0 :                 Py_XDECREF(tmp);
    6620           0 :                 tmp = NULL;
    6621             :         } else {
    6622           0 :                 PyErr_SetString(PyExc_TypeError, "required field \"args\" missing from arguments");
    6623           0 :                 return 1;
    6624             :         }
    6625           0 :         if (PyObject_HasAttrString(obj, "vararg")) {
    6626             :                 int res;
    6627           0 :                 tmp = PyObject_GetAttrString(obj, "vararg");
    6628           0 :                 if (tmp == NULL) goto failed;
    6629           0 :                 res = obj2ast_identifier(tmp, &vararg, arena);
    6630           0 :                 if (res != 0) goto failed;
    6631           0 :                 Py_XDECREF(tmp);
    6632           0 :                 tmp = NULL;
    6633             :         } else {
    6634           0 :                 vararg = NULL;
    6635             :         }
    6636           0 :         if (PyObject_HasAttrString(obj, "kwarg")) {
    6637             :                 int res;
    6638           0 :                 tmp = PyObject_GetAttrString(obj, "kwarg");
    6639           0 :                 if (tmp == NULL) goto failed;
    6640           0 :                 res = obj2ast_identifier(tmp, &kwarg, arena);
    6641           0 :                 if (res != 0) goto failed;
    6642           0 :                 Py_XDECREF(tmp);
    6643           0 :                 tmp = NULL;
    6644             :         } else {
    6645           0 :                 kwarg = NULL;
    6646             :         }
    6647           0 :         if (PyObject_HasAttrString(obj, "defaults")) {
    6648             :                 int res;
    6649             :                 Py_ssize_t len;
    6650             :                 Py_ssize_t i;
    6651           0 :                 tmp = PyObject_GetAttrString(obj, "defaults");
    6652           0 :                 if (tmp == NULL) goto failed;
    6653           0 :                 if (!PyList_Check(tmp)) {
    6654           0 :                         PyErr_Format(PyExc_TypeError, "arguments field \"defaults\" must be a list, not a %.200s", tmp->ob_type->tp_name);
    6655           0 :                         goto failed;
    6656             :                 }
    6657           0 :                 len = PyList_GET_SIZE(tmp);
    6658           0 :                 defaults = asdl_seq_new(len, arena);
    6659           0 :                 if (defaults == NULL) goto failed;
    6660           0 :                 for (i = 0; i < len; i++) {
    6661             :                         expr_ty value;
    6662           0 :                         res = obj2ast_expr(PyList_GET_ITEM(tmp, i), &value, arena);
    6663           0 :                         if (res != 0) goto failed;
    6664           0 :                         if (len != PyList_GET_SIZE(tmp)) {
    6665           0 :                                 PyErr_SetString(PyExc_RuntimeError, "arguments field \"defaults\" changed size during iteration");
    6666           0 :                                 goto failed;
    6667             :                         }
    6668           0 :                         asdl_seq_SET(defaults, i, value);
    6669             :                 }
    6670           0 :                 Py_XDECREF(tmp);
    6671           0 :                 tmp = NULL;
    6672             :         } else {
    6673           0 :                 PyErr_SetString(PyExc_TypeError, "required field \"defaults\" missing from arguments");
    6674           0 :                 return 1;
    6675             :         }
    6676           0 :         *out = arguments(args, vararg, kwarg, defaults, arena);
    6677           0 :         return 0;
    6678             : failed:
    6679           0 :         Py_XDECREF(tmp);
    6680           0 :         return 1;
    6681             : }
    6682             : 
    6683             : int
    6684           0 : obj2ast_keyword(PyObject* obj, keyword_ty* out, PyArena* arena)
    6685             : {
    6686           0 :         PyObject* tmp = NULL;
    6687             :         identifier arg;
    6688             :         expr_ty value;
    6689             : 
    6690           0 :         if (PyObject_HasAttrString(obj, "arg")) {
    6691             :                 int res;
    6692           0 :                 tmp = PyObject_GetAttrString(obj, "arg");
    6693           0 :                 if (tmp == NULL) goto failed;
    6694           0 :                 res = obj2ast_identifier(tmp, &arg, arena);
    6695           0 :                 if (res != 0) goto failed;
    6696           0 :                 Py_XDECREF(tmp);
    6697           0 :                 tmp = NULL;
    6698             :         } else {
    6699           0 :                 PyErr_SetString(PyExc_TypeError, "required field \"arg\" missing from keyword");
    6700           0 :                 return 1;
    6701             :         }
    6702           0 :         if (PyObject_HasAttrString(obj, "value")) {
    6703             :                 int res;
    6704           0 :                 tmp = PyObject_GetAttrString(obj, "value");
    6705           0 :                 if (tmp == NULL) goto failed;
    6706           0 :                 res = obj2ast_expr(tmp, &value, arena);
    6707           0 :                 if (res != 0) goto failed;
    6708           0 :                 Py_XDECREF(tmp);
    6709           0 :                 tmp = NULL;
    6710             :         } else {
    6711           0 :                 PyErr_SetString(PyExc_TypeError, "required field \"value\" missing from keyword");
    6712           0 :                 return 1;
    6713             :         }
    6714           0 :         *out = keyword(arg, value, arena);
    6715           0 :         return 0;
    6716             : failed:
    6717           0 :         Py_XDECREF(tmp);
    6718           0 :         return 1;
    6719             : }
    6720             : 
    6721             : int
    6722           0 : obj2ast_alias(PyObject* obj, alias_ty* out, PyArena* arena)
    6723             : {
    6724           0 :         PyObject* tmp = NULL;
    6725             :         identifier name;
    6726             :         identifier asname;
    6727             : 
    6728           0 :         if (PyObject_HasAttrString(obj, "name")) {
    6729             :                 int res;
    6730           0 :                 tmp = PyObject_GetAttrString(obj, "name");
    6731           0 :                 if (tmp == NULL) goto failed;
    6732           0 :                 res = obj2ast_identifier(tmp, &name, arena);
    6733           0 :                 if (res != 0) goto failed;
    6734           0 :                 Py_XDECREF(tmp);
    6735           0 :                 tmp = NULL;
    6736             :         } else {
    6737           0 :                 PyErr_SetString(PyExc_TypeError, "required field \"name\" missing from alias");
    6738           0 :                 return 1;
    6739             :         }
    6740           0 :         if (PyObject_HasAttrString(obj, "asname")) {
    6741             :                 int res;
    6742           0 :                 tmp = PyObject_GetAttrString(obj, "asname");
    6743           0 :                 if (tmp == NULL) goto failed;
    6744           0 :                 res = obj2ast_identifier(tmp, &asname, arena);
    6745           0 :                 if (res != 0) goto failed;
    6746           0 :                 Py_XDECREF(tmp);
    6747           0 :                 tmp = NULL;
    6748             :         } else {
    6749           0 :                 asname = NULL;
    6750             :         }
    6751           0 :         *out = alias(name, asname, arena);
    6752           0 :         return 0;
    6753             : failed:
    6754           0 :         Py_XDECREF(tmp);
    6755           0 :         return 1;
    6756             : }
    6757             : 
    6758             : 
    6759             : PyMODINIT_FUNC
    6760           0 : init_ast(void)
    6761             : {
    6762             :         PyObject *m, *d;
    6763           0 :         if (!init_types()) return;
    6764           0 :         m = Py_InitModule3("_ast", NULL, NULL);
    6765           0 :         if (!m) return;
    6766           0 :         d = PyModule_GetDict(m);
    6767           0 :         if (PyDict_SetItemString(d, "AST", (PyObject*)&AST_type) < 0) return;
    6768           0 :         if (PyModule_AddIntConstant(m, "PyCF_ONLY_AST", PyCF_ONLY_AST) < 0)
    6769           0 :                 return;
    6770           0 :         if (PyModule_AddStringConstant(m, "__version__", "82160") < 0)
    6771           0 :                 return;
    6772           0 :         if (PyDict_SetItemString(d, "mod", (PyObject*)mod_type) < 0) return;
    6773           0 :         if (PyDict_SetItemString(d, "Module", (PyObject*)Module_type) < 0)
    6774           0 :             return;
    6775           0 :         if (PyDict_SetItemString(d, "Interactive", (PyObject*)Interactive_type)
    6776           0 :             < 0) return;
    6777           0 :         if (PyDict_SetItemString(d, "Expression", (PyObject*)Expression_type) <
    6778           0 :             0) return;
    6779           0 :         if (PyDict_SetItemString(d, "Suite", (PyObject*)Suite_type) < 0) return;
    6780           0 :         if (PyDict_SetItemString(d, "stmt", (PyObject*)stmt_type) < 0) return;
    6781           0 :         if (PyDict_SetItemString(d, "FunctionDef", (PyObject*)FunctionDef_type)
    6782           0 :             < 0) return;
    6783           0 :         if (PyDict_SetItemString(d, "ClassDef", (PyObject*)ClassDef_type) < 0)
    6784           0 :             return;
    6785           0 :         if (PyDict_SetItemString(d, "Return", (PyObject*)Return_type) < 0)
    6786           0 :             return;
    6787           0 :         if (PyDict_SetItemString(d, "Delete", (PyObject*)Delete_type) < 0)
    6788           0 :             return;
    6789           0 :         if (PyDict_SetItemString(d, "Assign", (PyObject*)Assign_type) < 0)
    6790           0 :             return;
    6791           0 :         if (PyDict_SetItemString(d, "AugAssign", (PyObject*)AugAssign_type) <
    6792           0 :             0) return;
    6793           0 :         if (PyDict_SetItemString(d, "Print", (PyObject*)Print_type) < 0) return;
    6794           0 :         if (PyDict_SetItemString(d, "For", (PyObject*)For_type) < 0) return;
    6795           0 :         if (PyDict_SetItemString(d, "While", (PyObject*)While_type) < 0) return;
    6796           0 :         if (PyDict_SetItemString(d, "If", (PyObject*)If_type) < 0) return;
    6797           0 :         if (PyDict_SetItemString(d, "With", (PyObject*)With_type) < 0) return;
    6798           0 :         if (PyDict_SetItemString(d, "Raise", (PyObject*)Raise_type) < 0) return;
    6799           0 :         if (PyDict_SetItemString(d, "TryExcept", (PyObject*)TryExcept_type) <
    6800           0 :             0) return;
    6801           0 :         if (PyDict_SetItemString(d, "TryFinally", (PyObject*)TryFinally_type) <
    6802           0 :             0) return;
    6803           0 :         if (PyDict_SetItemString(d, "Assert", (PyObject*)Assert_type) < 0)
    6804           0 :             return;
    6805           0 :         if (PyDict_SetItemString(d, "Import", (PyObject*)Import_type) < 0)
    6806           0 :             return;
    6807           0 :         if (PyDict_SetItemString(d, "ImportFrom", (PyObject*)ImportFrom_type) <
    6808           0 :             0) return;
    6809           0 :         if (PyDict_SetItemString(d, "Exec", (PyObject*)Exec_type) < 0) return;
    6810           0 :         if (PyDict_SetItemString(d, "Global", (PyObject*)Global_type) < 0)
    6811           0 :             return;
    6812           0 :         if (PyDict_SetItemString(d, "Expr", (PyObject*)Expr_type) < 0) return;
    6813           0 :         if (PyDict_SetItemString(d, "Pass", (PyObject*)Pass_type) < 0) return;
    6814           0 :         if (PyDict_SetItemString(d, "Break", (PyObject*)Break_type) < 0) return;
    6815           0 :         if (PyDict_SetItemString(d, "Continue", (PyObject*)Continue_type) < 0)
    6816           0 :             return;
    6817           0 :         if (PyDict_SetItemString(d, "expr", (PyObject*)expr_type) < 0) return;
    6818           0 :         if (PyDict_SetItemString(d, "BoolOp", (PyObject*)BoolOp_type) < 0)
    6819           0 :             return;
    6820           0 :         if (PyDict_SetItemString(d, "BinOp", (PyObject*)BinOp_type) < 0) return;
    6821           0 :         if (PyDict_SetItemString(d, "UnaryOp", (PyObject*)UnaryOp_type) < 0)
    6822           0 :             return;
    6823           0 :         if (PyDict_SetItemString(d, "Lambda", (PyObject*)Lambda_type) < 0)
    6824           0 :             return;
    6825           0 :         if (PyDict_SetItemString(d, "IfExp", (PyObject*)IfExp_type) < 0) return;
    6826           0 :         if (PyDict_SetItemString(d, "Dict", (PyObject*)Dict_type) < 0) return;
    6827           0 :         if (PyDict_SetItemString(d, "Set", (PyObject*)Set_type) < 0) return;
    6828           0 :         if (PyDict_SetItemString(d, "ListComp", (PyObject*)ListComp_type) < 0)
    6829           0 :             return;
    6830           0 :         if (PyDict_SetItemString(d, "SetComp", (PyObject*)SetComp_type) < 0)
    6831           0 :             return;
    6832           0 :         if (PyDict_SetItemString(d, "DictComp", (PyObject*)DictComp_type) < 0)
    6833           0 :             return;
    6834           0 :         if (PyDict_SetItemString(d, "GeneratorExp",
    6835           0 :             (PyObject*)GeneratorExp_type) < 0) return;
    6836           0 :         if (PyDict_SetItemString(d, "Yield", (PyObject*)Yield_type) < 0) return;
    6837           0 :         if (PyDict_SetItemString(d, "Compare", (PyObject*)Compare_type) < 0)
    6838           0 :             return;
    6839           0 :         if (PyDict_SetItemString(d, "Call", (PyObject*)Call_type) < 0) return;
    6840           0 :         if (PyDict_SetItemString(d, "Repr", (PyObject*)Repr_type) < 0) return;
    6841           0 :         if (PyDict_SetItemString(d, "Num", (PyObject*)Num_type) < 0) return;
    6842           0 :         if (PyDict_SetItemString(d, "Str", (PyObject*)Str_type) < 0) return;
    6843           0 :         if (PyDict_SetItemString(d, "Attribute", (PyObject*)Attribute_type) <
    6844           0 :             0) return;
    6845           0 :         if (PyDict_SetItemString(d, "Subscript", (PyObject*)Subscript_type) <
    6846           0 :             0) return;
    6847           0 :         if (PyDict_SetItemString(d, "Name", (PyObject*)Name_type) < 0) return;
    6848           0 :         if (PyDict_SetItemString(d, "List", (PyObject*)List_type) < 0) return;
    6849           0 :         if (PyDict_SetItemString(d, "Tuple", (PyObject*)Tuple_type) < 0) return;
    6850           0 :         if (PyDict_SetItemString(d, "expr_context",
    6851           0 :             (PyObject*)expr_context_type) < 0) return;
    6852           0 :         if (PyDict_SetItemString(d, "Load", (PyObject*)Load_type) < 0) return;
    6853           0 :         if (PyDict_SetItemString(d, "Store", (PyObject*)Store_type) < 0) return;
    6854           0 :         if (PyDict_SetItemString(d, "Del", (PyObject*)Del_type) < 0) return;
    6855           0 :         if (PyDict_SetItemString(d, "AugLoad", (PyObject*)AugLoad_type) < 0)
    6856           0 :             return;
    6857           0 :         if (PyDict_SetItemString(d, "AugStore", (PyObject*)AugStore_type) < 0)
    6858           0 :             return;
    6859           0 :         if (PyDict_SetItemString(d, "Param", (PyObject*)Param_type) < 0) return;
    6860           0 :         if (PyDict_SetItemString(d, "slice", (PyObject*)slice_type) < 0) return;
    6861           0 :         if (PyDict_SetItemString(d, "Ellipsis", (PyObject*)Ellipsis_type) < 0)
    6862           0 :             return;
    6863           0 :         if (PyDict_SetItemString(d, "Slice", (PyObject*)Slice_type) < 0) return;
    6864           0 :         if (PyDict_SetItemString(d, "ExtSlice", (PyObject*)ExtSlice_type) < 0)
    6865           0 :             return;
    6866           0 :         if (PyDict_SetItemString(d, "Index", (PyObject*)Index_type) < 0) return;
    6867           0 :         if (PyDict_SetItemString(d, "boolop", (PyObject*)boolop_type) < 0)
    6868           0 :             return;
    6869           0 :         if (PyDict_SetItemString(d, "And", (PyObject*)And_type) < 0) return;
    6870           0 :         if (PyDict_SetItemString(d, "Or", (PyObject*)Or_type) < 0) return;
    6871           0 :         if (PyDict_SetItemString(d, "operator", (PyObject*)operator_type) < 0)
    6872           0 :             return;
    6873           0 :         if (PyDict_SetItemString(d, "Add", (PyObject*)Add_type) < 0) return;
    6874           0 :         if (PyDict_SetItemString(d, "Sub", (PyObject*)Sub_type) < 0) return;
    6875           0 :         if (PyDict_SetItemString(d, "Mult", (PyObject*)Mult_type) < 0) return;
    6876           0 :         if (PyDict_SetItemString(d, "Div", (PyObject*)Div_type) < 0) return;
    6877           0 :         if (PyDict_SetItemString(d, "Mod", (PyObject*)Mod_type) < 0) return;
    6878           0 :         if (PyDict_SetItemString(d, "Pow", (PyObject*)Pow_type) < 0) return;
    6879           0 :         if (PyDict_SetItemString(d, "LShift", (PyObject*)LShift_type) < 0)
    6880           0 :             return;
    6881           0 :         if (PyDict_SetItemString(d, "RShift", (PyObject*)RShift_type) < 0)
    6882           0 :             return;
    6883           0 :         if (PyDict_SetItemString(d, "BitOr", (PyObject*)BitOr_type) < 0) return;
    6884           0 :         if (PyDict_SetItemString(d, "BitXor", (PyObject*)BitXor_type) < 0)
    6885           0 :             return;
    6886           0 :         if (PyDict_SetItemString(d, "BitAnd", (PyObject*)BitAnd_type) < 0)
    6887           0 :             return;
    6888           0 :         if (PyDict_SetItemString(d, "FloorDiv", (PyObject*)FloorDiv_type) < 0)
    6889           0 :             return;
    6890           0 :         if (PyDict_SetItemString(d, "unaryop", (PyObject*)unaryop_type) < 0)
    6891           0 :             return;
    6892           0 :         if (PyDict_SetItemString(d, "Invert", (PyObject*)Invert_type) < 0)
    6893           0 :             return;
    6894           0 :         if (PyDict_SetItemString(d, "Not", (PyObject*)Not_type) < 0) return;
    6895           0 :         if (PyDict_SetItemString(d, "UAdd", (PyObject*)UAdd_type) < 0) return;
    6896           0 :         if (PyDict_SetItemString(d, "USub", (PyObject*)USub_type) < 0) return;
    6897           0 :         if (PyDict_SetItemString(d, "cmpop", (PyObject*)cmpop_type) < 0) return;
    6898           0 :         if (PyDict_SetItemString(d, "Eq", (PyObject*)Eq_type) < 0) return;
    6899           0 :         if (PyDict_SetItemString(d, "NotEq", (PyObject*)NotEq_type) < 0) return;
    6900           0 :         if (PyDict_SetItemString(d, "Lt", (PyObject*)Lt_type) < 0) return;
    6901           0 :         if (PyDict_SetItemString(d, "LtE", (PyObject*)LtE_type) < 0) return;
    6902           0 :         if (PyDict_SetItemString(d, "Gt", (PyObject*)Gt_type) < 0) return;
    6903           0 :         if (PyDict_SetItemString(d, "GtE", (PyObject*)GtE_type) < 0) return;
    6904           0 :         if (PyDict_SetItemString(d, "Is", (PyObject*)Is_type) < 0) return;
    6905           0 :         if (PyDict_SetItemString(d, "IsNot", (PyObject*)IsNot_type) < 0) return;
    6906           0 :         if (PyDict_SetItemString(d, "In", (PyObject*)In_type) < 0) return;
    6907           0 :         if (PyDict_SetItemString(d, "NotIn", (PyObject*)NotIn_type) < 0) return;
    6908           0 :         if (PyDict_SetItemString(d, "comprehension",
    6909           0 :             (PyObject*)comprehension_type) < 0) return;
    6910           0 :         if (PyDict_SetItemString(d, "excepthandler",
    6911           0 :             (PyObject*)excepthandler_type) < 0) return;
    6912           0 :         if (PyDict_SetItemString(d, "ExceptHandler",
    6913           0 :             (PyObject*)ExceptHandler_type) < 0) return;
    6914           0 :         if (PyDict_SetItemString(d, "arguments", (PyObject*)arguments_type) <
    6915           0 :             0) return;
    6916           0 :         if (PyDict_SetItemString(d, "keyword", (PyObject*)keyword_type) < 0)
    6917           0 :             return;
    6918           0 :         if (PyDict_SetItemString(d, "alias", (PyObject*)alias_type) < 0) return;
    6919             : }
    6920             : 
    6921             : 
    6922           0 : PyObject* PyAST_mod2obj(mod_ty t)
    6923             : {
    6924           0 :     init_types();
    6925           0 :     return ast2obj_mod(t);
    6926             : }
    6927             : 
    6928             : /* mode is 0 for "exec", 1 for "eval" and 2 for "single" input */
    6929           0 : mod_ty PyAST_obj2mod(PyObject* ast, PyArena* arena, int mode)
    6930             : {
    6931             :     mod_ty res;
    6932             :     PyObject *req_type[3];
    6933             :     char *req_name[3];
    6934             :     int isinstance;
    6935             : 
    6936           0 :     req_type[0] = (PyObject*)Module_type;
    6937           0 :     req_type[1] = (PyObject*)Expression_type;
    6938           0 :     req_type[2] = (PyObject*)Interactive_type;
    6939             : 
    6940           0 :     req_name[0] = "Module";
    6941           0 :     req_name[1] = "Expression";
    6942           0 :     req_name[2] = "Interactive";
    6943             : 
    6944             :     assert(0 <= mode && mode <= 2);
    6945             : 
    6946           0 :     init_types();
    6947             : 
    6948           0 :     isinstance = PyObject_IsInstance(ast, req_type[mode]);
    6949           0 :     if (isinstance == -1)
    6950           0 :         return NULL;
    6951           0 :     if (!isinstance) {
    6952           0 :         PyErr_Format(PyExc_TypeError, "expected %s node, got %.400s",
    6953           0 :                      req_name[mode], Py_TYPE(ast)->tp_name);
    6954           0 :         return NULL;
    6955             :     }
    6956           0 :     if (obj2ast_mod(ast, &res, arena) != 0)
    6957           0 :         return NULL;
    6958             :     else
    6959           0 :         return res;
    6960             : }
    6961             : 
    6962           0 : int PyAST_Check(PyObject* obj)
    6963             : {
    6964           0 :     init_types();
    6965           0 :     return PyObject_IsInstance(obj, (PyObject*)&AST_type);
    6966             : }
    6967             : 
    6968             : 

Generated by: LCOV version 1.10