{ int i, n = asdl_seq_LEN(o->v.Compare.ops); value = PyList_New(n); if (!value) goto failed; for(i = 0; i < n; i++) PyList_SET_ITEM(value, i, ast2obj_cmpop((cmpop_ty)asdl_seq_GET(o->v.Compare.ops, i))); } if (!value) goto failed; if (PyObject_SetAttrString(result, "ops", value) == -1) goto failed; Py_DECREF(value); value = ast2obj_list(o->v.Compare.comparators, ast2obj_expr); if (!value) goto failed; if (PyObject_SetAttrString(result, "comparators", value) == -1) goto failed; Py_DECREF(value); break; case Call_kind: result = PyType_GenericNew(Call_type, NULL, NULL); if (!result) goto failed; value = ast2obj_expr(o->v.Call.func); if (!value) goto failed; if (PyObject_SetAttrString(result, "func", value) == -1) goto failed; Py_DECREF(value); value = ast2obj_list(o->v.Call.args, ast2obj_expr); if (!value) goto failed; if (PyObject_SetAttrString(result, "args", value) == -1) goto failed; Py_DECREF(value); value = ast2obj_list(o->v.Call.keywords, ast2obj_keyword); if (!value) goto failed; if (PyObject_SetAttrString(result, "keywords", value) == -1) goto failed; Py_DECREF(value); value = ast2obj_expr(o->v.Call.starargs); if (!value) goto failed; if (PyObject_SetAttrString(result, "starargs", value) == -1) goto failed; Py_DECREF(value); value = ast2obj_expr(o->v.Call.kwargs); if (!value) goto failed; if (PyObject_SetAttrString(result, "kwargs", value) == -1) goto failed; Py_DECREF(value); break; case Repr_kind: result = PyType_GenericNew(Repr_type, NULL, NULL); if (!result) goto failed; value = ast2obj_expr(o->v.Repr.value); if (!value) goto failed; if (PyObject_SetAttrString(result, "value", value) == -1) goto failed; Py_DECREF(value); break; case Num_kind: result = PyType_GenericNew(Num_type, NULL, NULL); if (!result) goto failed; value = ast2obj_object(o->v.Num.n); if (!value) goto failed; if (PyObject_SetAttrString(result, "n", value) == -1) goto failed; Py_DECREF(value); break; case Str_kind: result = PyType_GenericNew(Str_type, NULL, NULL); if (!result) goto failed; value = ast2obj_string(o->v.Str.s); if (!value) goto failed; if (PyObject_SetAttrString(result, "s", value) == -1) goto failed; Py_DECREF(value); break; case Attribute_kind: result = PyType_GenericNew(Attribute_type, NULL, NULL); if (!result) goto failed; value = ast2obj_expr(o->v.Attribute.value); if (!value) goto failed; if (PyObject_SetAttrString(result, "value", value) == -1) goto failed; Py_DECREF(value); value = ast2obj_identifier(o->v.Attribute.attr); if (!value) goto failed; if (PyObject_SetAttrString(result, "attr", value) == -1) goto failed; Py_DECREF(value); value = ast2obj_expr_context(o->v.Attribute.ctx); if (!value) goto failed; if (PyObject_SetAttrString(result, "ctx", value) == -1) goto failed; Py_DECREF(value); break; case Subscript_kind: result = PyType_GenericNew(Subscript_type, NULL, NULL); if (!result) goto failed; value = ast2obj_expr(o->v.Subscript.value); if (!value) goto failed; if (PyObject_SetAttrString(result, "value", value) == -1) goto failed; Py_DECREF(value); value = ast2obj_slice(o->v.Subscript.slice); if (!value) goto failed; if (PyObject_SetAttrString(result, "slice", value) == -1) goto failed; Py_DECREF(value); value = ast2obj_expr_context(o->v.Subscript.ctx); if (!value) goto failed; if (PyObject_SetAttrString(result, "ctx", value) == -1) goto failed; Py_DECREF(value); break; case Name_kind: result = PyType_GenericNew(Name_type, NULL, NULL); if (!result) goto failed; value = ast2obj_identifier(o->v.Name.id); if (!value) goto failed; if (PyObject_SetAttrString(result, "id", value) == -1) goto failed; Py_DECREF(value); value = ast2obj_expr_context(o->v.Name.ctx); if (!value) goto failed; if (PyObject_SetAttrString(result, "ctx", value) == -1) goto failed; Py_DECREF(value); break; case List_kind: result = PyType_GenericNew(List_type, NULL, NULL); if (!result) goto failed; value = ast2obj_list(o->v.List.elts, ast2obj_expr); if (!value) goto failed; if (PyObject_SetAttrString(result, "elts", value) == -1) goto failed; Py_DECREF(value); value = ast2obj_expr_context(o->v.List.ctx); if (!value) goto failed; if (PyObject_SetAttrString(result, "ctx", value) == -1) goto failed; Py_DECREF(value); break; case Tuple_kind: result = PyType_GenericNew(Tuple_type, NULL, NULL); if (!result) goto failed; value = ast2obj_list(o->v.Tuple.elts, ast2obj_expr); if (!value) goto failed; if (PyObject_SetAttrString(result, "elts", value) == -1) goto failed; Py_DECREF(value); value = ast2obj_expr_context(o->v.Tuple.ctx); if (!value) goto failed; if (PyObject_SetAttrString(result, "ctx", value) == -1) goto failed; Py_DECREF(value); break; } value = ast2obj_int(o->lineno); if (!value) goto failed; if (PyObject_SetAttrString(result, "lineno", value) < 0) goto failed; Py_DECREF(value); value = ast2obj_int(o->col_offset); if (!value) goto failed; if (PyObject_SetAttrString(result, "col_offset", value) < 0) goto failed; Py_DECREF(value); return result;failed: Py_XDECREF(value); Py_XDECREF(result); return NULL;} PyObject* ast2obj_expr_context(expr_context_ty o){ switch(o) { case Load: Py_INCREF(Load_singleton); return Load_singleton; case Store: Py_INCREF(Store_singleton); return Store_singleton; case Del: Py_INCREF(Del_singleton); return Del_singleton; case AugLoad: Py_INCREF(AugLoad_singleton); return AugLoad_singleton; case AugStore: Py_INCREF(AugStore_singleton); return AugStore_singleton; case Param: Py_INCREF(Param_singleton); return Param_singleton; } return NULL; /* cannot happen */}PyObject*ast2obj_slice(void* _o){ slice_ty o = (slice_ty)_o; PyObject *result = NULL, *value = NULL; if (!o) { Py_INCREF(Py_None); return Py_None; } switch (o->kind) { case Ellipsis_kind: result = PyType_GenericNew(Ellipsis_type, NULL, NULL); if (!result) goto failed; break; case Slice_kind: result = PyType_GenericNew(Slice_type, NULL, NULL); if (!result) goto failed; value = ast2obj_expr(o->v.Slice.lower); if (!value) goto failed; if (PyObject_SetAttrString(result, "lower", value) == -1) goto failed; Py_DECREF(value); value = ast2obj_expr(o->v.Slice.upper); if (!value) goto failed; if (PyObject_SetAttrString(result, "upper", value) == -1) goto failed; Py_DECREF(value); value = ast2obj_expr(o->v.Slice.step); if (!value) goto failed; if (PyObject_SetAttrString(result, "step", value) == -1) goto failed; Py_DECREF(value); break; case ExtSlice_kind: result = PyType_GenericNew(ExtSlice_type, NULL, NULL); if (!result) goto failed; value = ast2obj_list(o->v.ExtSlice.dims, ast2obj_slice); if (!value) goto failed; if (PyObject_SetAttrString(result, "dims", value) == -1) goto failed; Py_DECREF(value); break; case Index_kind: result = PyType_GenericNew(Index_type, NULL, NULL); if (!result) goto failed; value = ast2obj_expr(o->v.Index.value); if (!value) goto failed; if (PyObject_SetAttrString(result, "value", value) == -1) goto failed; Py_DECREF(value); break; } return result;failed: Py_XDECREF(value); Py_XDECREF(result); return NULL;} PyObject* ast2obj_boolop(boolop_ty o){ switch(o) { case And: Py_INCREF(And_singleton); return And_singleton; case Or: Py_INCREF(Or_singleton); return Or_singleton; } return NULL; /* cannot happen */}PyObject* ast2obj_operator(operator_ty o){ switch(o) { case Add: Py_INCREF(Add_singleton); return Add_singleton; case Sub: Py_INCREF(Sub_singleton); return Sub_singleton; case Mult: Py_INCREF(Mult_singleton); return Mult_singleton; case Div: Py_INCREF(Div_singleton); return Div_singleton; case Mod: Py_INCREF(Mod_singleton); return Mod_singleton; case Pow: Py_INCREF(Pow_singleton); return Pow_singleton; case LShift: Py_INCREF(LShift_singleton); return LShift_singleton; case RShift: Py_INCREF(RShift_singleton); return RShift_singleton; case BitOr: Py_INCREF(BitOr_singleton); return BitOr_singleton; case BitXor: Py_INCREF(BitXor_singleton); return BitXor_singleton; case BitAnd: Py_INCREF(BitAnd_singleton); return BitAnd_singleton; case FloorDiv: Py_INCREF(FloorDiv_singleton); return FloorDiv_singleton; } return NULL; /* cannot happen */}PyObject* ast2obj_unaryop(unaryop_ty o){ switch(o) { case Invert: Py_INCREF(Invert_singleton); return Invert_singleton; case Not: Py_INCREF(Not_singleton); return Not_singleton; case UAdd: Py_INCREF(UAdd_singleton); return UAdd_singleton; case USub: Py_INCREF(USub_singleton); return USub_singleton; } return NULL; /* cannot happen */}PyObject* ast2obj_cmpop(cmpop_ty o){ switch(o) { case Eq: Py_INCREF(Eq_singleton); return Eq_singleton; case NotEq: Py_INCREF(NotEq_singleton); return NotEq_singleton; case Lt: Py_INCREF(Lt_singleton); return Lt_singleton; case LtE: Py_INCREF(LtE_singleton); return LtE_singleton; case Gt: Py_INCREF(Gt_singleton); return Gt_singleton; case GtE: Py_INCREF(GtE_singleton); return GtE_singleton; case Is: Py_INCREF(Is_singleton); return Is_singleton; case IsNot: Py_INCREF(IsNot_singleton); return IsNot_singleton; case In: Py_INCREF(In_singleton); return In_singleton; case NotIn: Py_INCREF(NotIn_singleton); return NotIn_singleton; } return NULL; /* cannot happen */}PyObject*ast2obj_comprehension(void* _o){ comprehension_ty o = (comprehension_ty)_o; PyObject *result = NULL, *value = NULL; if (!o) { Py_INCREF(Py_None); return Py_None; } result = PyType_GenericNew(comprehension_type, NULL, NULL); if (!result) return NULL; value = ast2obj_expr(o->target); if (!value) goto failed; if (PyObject_SetAttrString(result, "target", value) == -1) goto failed; Py_DECREF(value); value = ast2obj_expr(o->iter); if (!value) goto failed; if (PyObject_SetAttrString(result, "iter", value) == -1) goto failed; Py_DECREF(value); value = ast2obj_list(o->ifs, ast2obj_expr); if (!value) goto failed; if (PyObject_SetAttrString(result, "ifs", value) == -1) goto failed; Py_DECREF(value); return result;failed: Py_XDECREF(value); Py_XDECREF(result); return NULL;} PyObject*ast2obj_excepthandler(void* _o){ excepthandler_ty o = (excepthandler_ty)_o; PyObject *result = NULL, *value = NULL; if (!o) { Py_INCREF(Py_None); return Py_None; } result = PyType_GenericNew(excepthandler_type, NULL, NULL); if (!result) return NULL; value = ast2obj_expr(o->type); if (!value) goto failed; if (PyObject_SetAttrString(result, "type", value) == -1) goto failed; Py_DECREF(value); value = ast2obj_expr(o->name); if (!value) goto failed; if (PyObject_SetAttrString(result, "name", value) == -1) goto failed; Py_DECREF(value); value = ast2obj_list(o->body, ast2obj_stmt); if (!value) goto failed; if (PyObject_SetAttrString(result, "body", value) == -1) goto failed; Py_DECREF(value); value = ast2obj_int(o->lineno); if (!value) goto failed; if (PyObject_SetAttrString(result, "lineno", value) == -1) goto failed; Py_DECREF(value); value = ast2obj_int(o->col_offset); if (!value) goto failed; if (PyObject_SetAttrString(result, "col_offset", value) == -1) goto failed; Py_DECREF(value); return result;failed: Py_XDECREF(value); Py_XDECREF(result); return NULL;} PyObject*ast2obj_arguments(void* _o){ arguments_ty o = (arguments_ty)_o; PyObject *result = NULL, *value = NULL; if (!o) { Py_INCREF(Py_None); return Py_None; } result = PyType_GenericNew(arguments_type, NULL, NULL); if (!result) return NULL; value = ast2obj_list(o->args, ast2obj_expr); if (!value) goto failed; if (PyObject_SetAttrString(result, "args", value) == -1) goto failed; Py_DECREF(value); value = ast2obj_identifier(o->vararg); if (!value) goto failed; if (PyObject_SetAttrString(result, "vararg", value) == -1) goto failed; Py_DECREF(value); value = ast2obj_identifier(o->kwarg); if (!value) goto failed; if (PyObject_SetAttrString(result, "kwarg", value) == -1) goto failed; Py_DECREF(value); value = ast2obj_list(o->defaults, ast2obj_expr); if (!value) goto failed; if (PyObject_SetAttrString(result, "defaults", value) == -1) goto failed; Py_DECREF(value); return result;failed: Py_XDECREF(value); Py_XDECREF(result); return NULL;} PyObject*ast2obj_keyword(void* _o){ keyword_ty o = (keyword_ty)_o; PyObject *result = NULL, *value = NULL; if (!o) { Py_INCREF(Py_None); return Py_None; } result = PyType_GenericNew(keyword_type, NULL, NULL); if (!result) return NULL; value = ast2obj_identifier(o->arg); if (!value) goto failed; if (PyObject_SetAttrString(result, "arg", value) == -1) goto failed; Py_DECREF(value); value = ast2obj_expr(o->value); if (!value) goto failed; if (PyObject_SetAttrString(result, "value", value) == -1)Lines 2501–3000 of 3202. Previous lines Load more
{ int i, n = asdl_seq_LEN(o->v.Compare.ops); value = PyList_New(n); if (!value) goto failed; for(i = 0; i < n; i++) PyList_SET_ITEM(value, i, ast2obj_cmpop((cmpop_ty)asdl_seq_GET(o->v.Compare.ops, i))); } if (!value) goto failed; if (PyObject_SetAttrString(result, "ops", value) == -1) goto failed; Py_DECREF(value); value = ast2obj_list(o->v.Compare.comparators, ast2obj_expr); if (!value) goto failed; if (PyObject_SetAttrString(result, "comparators", value) == -1) goto failed; Py_DECREF(value); break; case Call_kind: result = PyType_GenericNew(Call_type, NULL, NULL); if (!result) goto failed; value = ast2obj_expr(o->v.Call.func); if (!value) goto failed; if (PyObject_SetAttrString(result, "func", value) == -1) goto failed; Py_DECREF(value); value = ast2obj_list(o->v.Call.args, ast2obj_expr); if (!value) goto failed; if (PyObject_SetAttrString(result, "args", value) == -1) goto failed; Py_DECREF(value); value = ast2obj_list(o->v.Call.keywords, ast2obj_keyword); if (!value) goto failed; if (PyObject_SetAttrString(result, "keywords", value) == -1) goto failed; Py_DECREF(value); value = ast2obj_expr(o->v.Call.starargs); if (!value) goto failed; if (PyObject_SetAttrString(result, "starargs", value) == -1) goto failed; Py_DECREF(value); value = ast2obj_expr(o->v.Call.kwargs); if (!value) goto failed; if (PyObject_SetAttrString(result, "kwargs", value) == -1) goto failed; Py_DECREF(value); break; case Repr_kind: result = PyType_GenericNew(Repr_type, NULL, NULL); if (!result) goto failed; value = ast2obj_expr(o->v.Repr.value); if (!value) goto failed; if (PyObject_SetAttrString(result, "value", value) == -1) goto failed; Py_DECREF(value); break; case Num_kind: result = PyType_GenericNew(Num_type, NULL, NULL); if (!result) goto failed; value = ast2obj_object(o->v.Num.n); if (!value) goto failed; if (PyObject_SetAttrString(result, "n", value) == -1) goto failed; Py_DECREF(value); break; case Str_kind: result = PyType_GenericNew(Str_type, NULL, NULL); if (!result) goto failed; value = ast2obj_string(o->v.Str.s); if (!value) goto failed; if (PyObject_SetAttrString(result, "s", value) == -1) goto failed; Py_DECREF(value); break; case Attribute_kind: result = PyType_GenericNew(Attribute_type, NULL, NULL); if (!result) goto failed; value = ast2obj_expr(o->v.Attribute.value); if (!value) goto failed; if (PyObject_SetAttrString(result, "value", value) == -1) goto failed; Py_DECREF(value); value = ast2obj_identifier(o->v.Attribute.attr); if (!value) goto failed; if (PyObject_SetAttrString(result, "attr", value) == -1) goto failed; Py_DECREF(value); value = ast2obj_expr_context(o->v.Attribute.ctx); if (!value) goto failed; if (PyObject_SetAttrString(result, "ctx", value) == -1) goto failed; Py_DECREF(value); break; case Subscript_kind: result = PyType_GenericNew(Subscript_type, NULL, NULL); if (!result) goto failed; value = ast2obj_expr(o->v.Subscript.value); if (!value) goto failed; if (PyObject_SetAttrString(result, "value", value) == -1) goto failed; Py_DECREF(value); value = ast2obj_slice(o->v.Subscript.slice); if (!value) goto failed; if (PyObject_SetAttrString(result, "slice", value) == -1) goto failed; Py_DECREF(value); value = ast2obj_expr_context(o->v.Subscript.ctx); if (!value) goto failed; if (PyObject_SetAttrString(result, "ctx", value) == -1) goto failed; Py_DECREF(value); break; case Name_kind: result = PyType_GenericNew(Name_type, NULL, NULL); if (!result) goto failed; value = ast2obj_identifier(o->v.Name.id); if (!value) goto failed; if (PyObject_SetAttrString(result, "id", value) == -1) goto failed; Py_DECREF(value); value = ast2obj_expr_context(o->v.Name.ctx); if (!value) goto failed; if (PyObject_SetAttrString(result, "ctx", value) == -1) goto failed; Py_DECREF(value); break; case List_kind: result = PyType_GenericNew(List_type, NULL, NULL); if (!result) goto failed; value = ast2obj_list(o->v.List.elts, ast2obj_expr); if (!value) goto failed; if (PyObject_SetAttrString(result, "elts", value) == -1) goto failed; Py_DECREF(value); value = ast2obj_expr_context(o->v.List.ctx); if (!value) goto failed; if (PyObject_SetAttrString(result, "ctx", value) == -1) goto failed; Py_DECREF(value); break; case Tuple_kind: result = PyType_GenericNew(Tuple_type, NULL, NULL); if (!result) goto failed; value = ast2obj_list(o->v.Tuple.elts, ast2obj_expr); if (!value) goto failed; if (PyObject_SetAttrString(result, "elts", value) == -1) goto failed; Py_DECREF(value); value = ast2obj_expr_context(o->v.Tuple.ctx); if (!value) goto failed; if (PyObject_SetAttrString(result, "ctx", value) == -1) goto failed; Py_DECREF(value); break; } value = ast2obj_int(o->lineno); if (!value) goto failed; if (PyObject_SetAttrString(result, "lineno", value) < 0) goto failed; Py_DECREF(value); value = ast2obj_int(o->col_offset); if (!value) goto failed; if (PyObject_SetAttrString(result, "col_offset", value) < 0) goto failed; Py_DECREF(value); return result; failed: Py_XDECREF(value); Py_XDECREF(result); return NULL; } PyObject* ast2obj_expr_context(expr_context_ty o) { switch(o) { case Load: Py_INCREF(Load_singleton); return Load_singleton; case Store: Py_INCREF(Store_singleton); return Store_singleton; case Del: Py_INCREF(Del_singleton); return Del_singleton; case AugLoad: Py_INCREF(AugLoad_singleton); return AugLoad_singleton; case AugStore: Py_INCREF(AugStore_singleton); return AugStore_singleton; case Param: Py_INCREF(Param_singleton); return Param_singleton; } return NULL; /* cannot happen */ } PyObject* ast2obj_slice(void* _o) { slice_ty o = (slice_ty)_o; PyObject *result = NULL, *value = NULL; if (!o) { Py_INCREF(Py_None); return Py_None; } switch (o->kind) { case Ellipsis_kind: result = PyType_GenericNew(Ellipsis_type, NULL, NULL); if (!result) goto failed; break; case Slice_kind: result = PyType_GenericNew(Slice_type, NULL, NULL); if (!result) goto failed; value = ast2obj_expr(o->v.Slice.lower); if (!value) goto failed; if (PyObject_SetAttrString(result, "lower", value) == -1) goto failed; Py_DECREF(value); value = ast2obj_expr(o->v.Slice.upper); if (!value) goto failed; if (PyObject_SetAttrString(result, "upper", value) == -1) goto failed; Py_DECREF(value); value = ast2obj_expr(o->v.Slice.step); if (!value) goto failed; if (PyObject_SetAttrString(result, "step", value) == -1) goto failed; Py_DECREF(value); break; case ExtSlice_kind: result = PyType_GenericNew(ExtSlice_type, NULL, NULL); if (!result) goto failed; value = ast2obj_list(o->v.ExtSlice.dims, ast2obj_slice); if (!value) goto failed; if (PyObject_SetAttrString(result, "dims", value) == -1) goto failed; Py_DECREF(value); break; case Index_kind: result = PyType_GenericNew(Index_type, NULL, NULL); if (!result) goto failed; value = ast2obj_expr(o->v.Index.value); if (!value) goto failed; if (PyObject_SetAttrString(result, "value", value) == -1) goto failed; Py_DECREF(value); break; } return result; failed: Py_XDECREF(value); Py_XDECREF(result); return NULL; } PyObject* ast2obj_boolop(boolop_ty o) { switch(o) { case And: Py_INCREF(And_singleton); return And_singleton; case Or: Py_INCREF(Or_singleton); return Or_singleton; } return NULL; /* cannot happen */ } PyObject* ast2obj_operator(operator_ty o) { switch(o) { case Add: Py_INCREF(Add_singleton); return Add_singleton; case Sub: Py_INCREF(Sub_singleton); return Sub_singleton; case Mult: Py_INCREF(Mult_singleton); return Mult_singleton; case Div: Py_INCREF(Div_singleton); return Div_singleton; case Mod: Py_INCREF(Mod_singleton); return Mod_singleton; case Pow: Py_INCREF(Pow_singleton); return Pow_singleton; case LShift: Py_INCREF(LShift_singleton); return LShift_singleton; case RShift: Py_INCREF(RShift_singleton); return RShift_singleton; case BitOr: Py_INCREF(BitOr_singleton); return BitOr_singleton; case BitXor: Py_INCREF(BitXor_singleton); return BitXor_singleton; case BitAnd: Py_INCREF(BitAnd_singleton); return BitAnd_singleton; case FloorDiv: Py_INCREF(FloorDiv_singleton); return FloorDiv_singleton; } return NULL; /* cannot happen */ } PyObject* ast2obj_unaryop(unaryop_ty o) { switch(o) { case Invert: Py_INCREF(Invert_singleton); return Invert_singleton; case Not: Py_INCREF(Not_singleton); return Not_singleton; case UAdd: Py_INCREF(UAdd_singleton); return UAdd_singleton; case USub: Py_INCREF(USub_singleton); return USub_singleton; } return NULL; /* cannot happen */ } PyObject* ast2obj_cmpop(cmpop_ty o) { switch(o) { case Eq: Py_INCREF(Eq_singleton); return Eq_singleton; case NotEq: Py_INCREF(NotEq_singleton); return NotEq_singleton; case Lt: Py_INCREF(Lt_singleton); return Lt_singleton; case LtE: Py_INCREF(LtE_singleton); return LtE_singleton; case Gt: Py_INCREF(Gt_singleton); return Gt_singleton; case GtE: Py_INCREF(GtE_singleton); return GtE_singleton; case Is: Py_INCREF(Is_singleton); return Is_singleton; case IsNot: Py_INCREF(IsNot_singleton); return IsNot_singleton; case In: Py_INCREF(In_singleton); return In_singleton; case NotIn: Py_INCREF(NotIn_singleton); return NotIn_singleton; } return NULL; /* cannot happen */ } PyObject* ast2obj_comprehension(void* _o) { comprehension_ty o = (comprehension_ty)_o; PyObject *result = NULL, *value = NULL; if (!o) { Py_INCREF(Py_None); return Py_None; } result = PyType_GenericNew(comprehension_type, NULL, NULL); if (!result) return NULL; value = ast2obj_expr(o->target); if (!value) goto failed; if (PyObject_SetAttrString(result, "target", value) == -1) goto failed; Py_DECREF(value); value = ast2obj_expr(o->iter); if (!value) goto failed; if (PyObject_SetAttrString(result, "iter", value) == -1) goto failed; Py_DECREF(value); value = ast2obj_list(o->ifs, ast2obj_expr); if (!value) goto failed; if (PyObject_SetAttrString(result, "ifs", value) == -1) goto failed; Py_DECREF(value); return result; failed: Py_XDECREF(value); Py_XDECREF(result); return NULL; } PyObject* ast2obj_excepthandler(void* _o) { excepthandler_ty o = (excepthandler_ty)_o; PyObject *result = NULL, *value = NULL; if (!o) { Py_INCREF(Py_None); return Py_None; } result = PyType_GenericNew(excepthandler_type, NULL, NULL); if (!result) return NULL; value = ast2obj_expr(o->type); if (!value) goto failed; if (PyObject_SetAttrString(result, "type", value) == -1) goto failed; Py_DECREF(value); value = ast2obj_expr(o->name); if (!value) goto failed; if (PyObject_SetAttrString(result, "name", value) == -1) goto failed; Py_DECREF(value); value = ast2obj_list(o->body, ast2obj_stmt); if (!value) goto failed; if (PyObject_SetAttrString(result, "body", value) == -1) goto failed; Py_DECREF(value); value = ast2obj_int(o->lineno); if (!value) goto failed; if (PyObject_SetAttrString(result, "lineno", value) == -1) goto failed; Py_DECREF(value); value = ast2obj_int(o->col_offset); if (!value) goto failed; if (PyObject_SetAttrString(result, "col_offset", value) == -1) goto failed; Py_DECREF(value); return result; failed: Py_XDECREF(value); Py_XDECREF(result); return NULL; } PyObject* ast2obj_arguments(void* _o) { arguments_ty o = (arguments_ty)_o; PyObject *result = NULL, *value = NULL; if (!o) { Py_INCREF(Py_None); return Py_None; } result = PyType_GenericNew(arguments_type, NULL, NULL); if (!result) return NULL; value = ast2obj_list(o->args, ast2obj_expr); if (!value) goto failed; if (PyObject_SetAttrString(result, "args", value) == -1) goto failed; Py_DECREF(value); value = ast2obj_identifier(o->vararg); if (!value) goto failed; if (PyObject_SetAttrString(result, "vararg", value) == -1) goto failed; Py_DECREF(value); value = ast2obj_identifier(o->kwarg); if (!value) goto failed; if (PyObject_SetAttrString(result, "kwarg", value) == -1) goto failed; Py_DECREF(value); value = ast2obj_list(o->defaults, ast2obj_expr); if (!value) goto failed; if (PyObject_SetAttrString(result, "defaults", value) == -1) goto failed; Py_DECREF(value); return result; failed: Py_XDECREF(value); Py_XDECREF(result); return NULL; } PyObject* ast2obj_keyword(void* _o) { keyword_ty o = (keyword_ty)_o; PyObject *result = NULL, *value = NULL; if (!o) { Py_INCREF(Py_None); return Py_None; } result = PyType_GenericNew(keyword_type, NULL, NULL); if (!result) return NULL; value = ast2obj_identifier(o->arg); if (!value) goto failed; if (PyObject_SetAttrString(result, "arg", value) == -1) goto failed; Py_DECREF(value); value = ast2obj_expr(o->value); if (!value) goto failed; if (PyObject_SetAttrString(result, "value", value) == -1)