cinap_lenrekadd hg and python4bb9e2215 years agoHistory
3202 lines · 110.8 KB · C
RawDownload
                if (!value) goto failed;                if (PyObject_SetAttrString(result, "args", value) == -1)                        goto failed;                Py_DECREF(value);                value = ast2obj_list(o->v.FunctionDef.body, ast2obj_stmt);                if (!value) goto failed;                if (PyObject_SetAttrString(result, "body", value) == -1)                        goto failed;                Py_DECREF(value);                value = ast2obj_list(o->v.FunctionDef.decorators, ast2obj_expr);                if (!value) goto failed;                if (PyObject_SetAttrString(result, "decorators", value) == -1)                        goto failed;                Py_DECREF(value);                break;        case ClassDef_kind:                result = PyType_GenericNew(ClassDef_type, NULL, NULL);                if (!result) goto failed;                value = ast2obj_identifier(o->v.ClassDef.name);                if (!value) goto failed;                if (PyObject_SetAttrString(result, "name", value) == -1)                        goto failed;                Py_DECREF(value);                value = ast2obj_list(o->v.ClassDef.bases, ast2obj_expr);                if (!value) goto failed;                if (PyObject_SetAttrString(result, "bases", value) == -1)                        goto failed;                Py_DECREF(value);                value = ast2obj_list(o->v.ClassDef.body, ast2obj_stmt);                if (!value) goto failed;                if (PyObject_SetAttrString(result, "body", value) == -1)                        goto failed;                Py_DECREF(value);                break;        case Return_kind:                result = PyType_GenericNew(Return_type, NULL, NULL);                if (!result) goto failed;                value = ast2obj_expr(o->v.Return.value);                if (!value) goto failed;                if (PyObject_SetAttrString(result, "value", value) == -1)                        goto failed;                Py_DECREF(value);                break;        case Delete_kind:                result = PyType_GenericNew(Delete_type, NULL, NULL);                if (!result) goto failed;                value = ast2obj_list(o->v.Delete.targets, ast2obj_expr);                if (!value) goto failed;                if (PyObject_SetAttrString(result, "targets", value) == -1)                        goto failed;                Py_DECREF(value);                break;        case Assign_kind:                result = PyType_GenericNew(Assign_type, NULL, NULL);                if (!result) goto failed;                value = ast2obj_list(o->v.Assign.targets, ast2obj_expr);                if (!value) goto failed;                if (PyObject_SetAttrString(result, "targets", value) == -1)                        goto failed;                Py_DECREF(value);                value = ast2obj_expr(o->v.Assign.value);                if (!value) goto failed;                if (PyObject_SetAttrString(result, "value", value) == -1)                        goto failed;                Py_DECREF(value);                break;        case AugAssign_kind:                result = PyType_GenericNew(AugAssign_type, NULL, NULL);                if (!result) goto failed;                value = ast2obj_expr(o->v.AugAssign.target);                if (!value) goto failed;                if (PyObject_SetAttrString(result, "target", value) == -1)                        goto failed;                Py_DECREF(value);                value = ast2obj_operator(o->v.AugAssign.op);                if (!value) goto failed;                if (PyObject_SetAttrString(result, "op", value) == -1)                        goto failed;                Py_DECREF(value);                value = ast2obj_expr(o->v.AugAssign.value);                if (!value) goto failed;                if (PyObject_SetAttrString(result, "value", value) == -1)                        goto failed;                Py_DECREF(value);                break;        case Print_kind:                result = PyType_GenericNew(Print_type, NULL, NULL);                if (!result) goto failed;                value = ast2obj_expr(o->v.Print.dest);                if (!value) goto failed;                if (PyObject_SetAttrString(result, "dest", value) == -1)                        goto failed;                Py_DECREF(value);                value = ast2obj_list(o->v.Print.values, ast2obj_expr);                if (!value) goto failed;                if (PyObject_SetAttrString(result, "values", value) == -1)                        goto failed;                Py_DECREF(value);                value = ast2obj_bool(o->v.Print.nl);                if (!value) goto failed;                if (PyObject_SetAttrString(result, "nl", value) == -1)                        goto failed;                Py_DECREF(value);                break;        case For_kind:                result = PyType_GenericNew(For_type, NULL, NULL);                if (!result) goto failed;                value = ast2obj_expr(o->v.For.target);                if (!value) goto failed;                if (PyObject_SetAttrString(result, "target", value) == -1)                        goto failed;                Py_DECREF(value);                value = ast2obj_expr(o->v.For.iter);                if (!value) goto failed;                if (PyObject_SetAttrString(result, "iter", value) == -1)                        goto failed;                Py_DECREF(value);                value = ast2obj_list(o->v.For.body, ast2obj_stmt);                if (!value) goto failed;                if (PyObject_SetAttrString(result, "body", value) == -1)                        goto failed;                Py_DECREF(value);                value = ast2obj_list(o->v.For.orelse, ast2obj_stmt);                if (!value) goto failed;                if (PyObject_SetAttrString(result, "orelse", value) == -1)                        goto failed;                Py_DECREF(value);                break;        case While_kind:                result = PyType_GenericNew(While_type, NULL, NULL);                if (!result) goto failed;                value = ast2obj_expr(o->v.While.test);                if (!value) goto failed;                if (PyObject_SetAttrString(result, "test", value) == -1)                        goto failed;                Py_DECREF(value);                value = ast2obj_list(o->v.While.body, ast2obj_stmt);                if (!value) goto failed;                if (PyObject_SetAttrString(result, "body", value) == -1)                        goto failed;                Py_DECREF(value);                value = ast2obj_list(o->v.While.orelse, ast2obj_stmt);                if (!value) goto failed;                if (PyObject_SetAttrString(result, "orelse", value) == -1)                        goto failed;                Py_DECREF(value);                break;        case If_kind:                result = PyType_GenericNew(If_type, NULL, NULL);                if (!result) goto failed;                value = ast2obj_expr(o->v.If.test);                if (!value) goto failed;                if (PyObject_SetAttrString(result, "test", value) == -1)                        goto failed;                Py_DECREF(value);                value = ast2obj_list(o->v.If.body, ast2obj_stmt);                if (!value) goto failed;                if (PyObject_SetAttrString(result, "body", value) == -1)                        goto failed;                Py_DECREF(value);                value = ast2obj_list(o->v.If.orelse, ast2obj_stmt);                if (!value) goto failed;                if (PyObject_SetAttrString(result, "orelse", value) == -1)                        goto failed;                Py_DECREF(value);                break;        case With_kind:                result = PyType_GenericNew(With_type, NULL, NULL);                if (!result) goto failed;                value = ast2obj_expr(o->v.With.context_expr);                if (!value) goto failed;                if (PyObject_SetAttrString(result, "context_expr", value) == -1)                        goto failed;                Py_DECREF(value);                value = ast2obj_expr(o->v.With.optional_vars);                if (!value) goto failed;                if (PyObject_SetAttrString(result, "optional_vars", value) ==                    -1)                        goto failed;                Py_DECREF(value);                value = ast2obj_list(o->v.With.body, ast2obj_stmt);                if (!value) goto failed;                if (PyObject_SetAttrString(result, "body", value) == -1)                        goto failed;                Py_DECREF(value);                break;        case Raise_kind:                result = PyType_GenericNew(Raise_type, NULL, NULL);                if (!result) goto failed;                value = ast2obj_expr(o->v.Raise.type);                if (!value) goto failed;                if (PyObject_SetAttrString(result, "type", value) == -1)                        goto failed;                Py_DECREF(value);                value = ast2obj_expr(o->v.Raise.inst);                if (!value) goto failed;                if (PyObject_SetAttrString(result, "inst", value) == -1)                        goto failed;                Py_DECREF(value);                value = ast2obj_expr(o->v.Raise.tback);                if (!value) goto failed;                if (PyObject_SetAttrString(result, "tback", value) == -1)                        goto failed;                Py_DECREF(value);                break;        case TryExcept_kind:                result = PyType_GenericNew(TryExcept_type, NULL, NULL);                if (!result) goto failed;                value = ast2obj_list(o->v.TryExcept.body, ast2obj_stmt);                if (!value) goto failed;                if (PyObject_SetAttrString(result, "body", value) == -1)                        goto failed;                Py_DECREF(value);                value = ast2obj_list(o->v.TryExcept.handlers,                                     ast2obj_excepthandler);                if (!value) goto failed;                if (PyObject_SetAttrString(result, "handlers", value) == -1)                        goto failed;                Py_DECREF(value);                value = ast2obj_list(o->v.TryExcept.orelse, ast2obj_stmt);                if (!value) goto failed;                if (PyObject_SetAttrString(result, "orelse", value) == -1)                        goto failed;                Py_DECREF(value);                break;        case TryFinally_kind:                result = PyType_GenericNew(TryFinally_type, NULL, NULL);                if (!result) goto failed;                value = ast2obj_list(o->v.TryFinally.body, ast2obj_stmt);                if (!value) goto failed;                if (PyObject_SetAttrString(result, "body", value) == -1)                        goto failed;                Py_DECREF(value);                value = ast2obj_list(o->v.TryFinally.finalbody, ast2obj_stmt);                if (!value) goto failed;                if (PyObject_SetAttrString(result, "finalbody", value) == -1)                        goto failed;                Py_DECREF(value);                break;        case Assert_kind:                result = PyType_GenericNew(Assert_type, NULL, NULL);                if (!result) goto failed;                value = ast2obj_expr(o->v.Assert.test);                if (!value) goto failed;                if (PyObject_SetAttrString(result, "test", value) == -1)                        goto failed;                Py_DECREF(value);                value = ast2obj_expr(o->v.Assert.msg);                if (!value) goto failed;                if (PyObject_SetAttrString(result, "msg", value) == -1)                        goto failed;                Py_DECREF(value);                break;        case Import_kind:                result = PyType_GenericNew(Import_type, NULL, NULL);                if (!result) goto failed;                value = ast2obj_list(o->v.Import.names, ast2obj_alias);                if (!value) goto failed;                if (PyObject_SetAttrString(result, "names", value) == -1)                        goto failed;                Py_DECREF(value);                break;        case ImportFrom_kind:                result = PyType_GenericNew(ImportFrom_type, NULL, NULL);                if (!result) goto failed;                value = ast2obj_identifier(o->v.ImportFrom.module);                if (!value) goto failed;                if (PyObject_SetAttrString(result, "module", value) == -1)                        goto failed;                Py_DECREF(value);                value = ast2obj_list(o->v.ImportFrom.names, ast2obj_alias);                if (!value) goto failed;                if (PyObject_SetAttrString(result, "names", value) == -1)                        goto failed;                Py_DECREF(value);                value = ast2obj_int(o->v.ImportFrom.level);                if (!value) goto failed;                if (PyObject_SetAttrString(result, "level", value) == -1)                        goto failed;                Py_DECREF(value);                break;        case Exec_kind:                result = PyType_GenericNew(Exec_type, NULL, NULL);                if (!result) goto failed;                value = ast2obj_expr(o->v.Exec.body);                if (!value) goto failed;                if (PyObject_SetAttrString(result, "body", value) == -1)                        goto failed;                Py_DECREF(value);                value = ast2obj_expr(o->v.Exec.globals);                if (!value) goto failed;                if (PyObject_SetAttrString(result, "globals", value) == -1)                        goto failed;                Py_DECREF(value);                value = ast2obj_expr(o->v.Exec.locals);                if (!value) goto failed;                if (PyObject_SetAttrString(result, "locals", value) == -1)                        goto failed;                Py_DECREF(value);                break;        case Global_kind:                result = PyType_GenericNew(Global_type, NULL, NULL);                if (!result) goto failed;                value = ast2obj_list(o->v.Global.names, ast2obj_identifier);                if (!value) goto failed;                if (PyObject_SetAttrString(result, "names", value) == -1)                        goto failed;                Py_DECREF(value);                break;        case Expr_kind:                result = PyType_GenericNew(Expr_type, NULL, NULL);                if (!result) goto failed;                value = ast2obj_expr(o->v.Expr.value);                if (!value) goto failed;                if (PyObject_SetAttrString(result, "value", value) == -1)                        goto failed;                Py_DECREF(value);                break;        case Pass_kind:                result = PyType_GenericNew(Pass_type, NULL, NULL);                if (!result) goto failed;                break;        case Break_kind:                result = PyType_GenericNew(Break_type, NULL, NULL);                if (!result) goto failed;                break;        case Continue_kind:                result = PyType_GenericNew(Continue_type, NULL, NULL);                if (!result) goto failed;                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(void* _o){        expr_ty o = (expr_ty)_o;        PyObject *result = NULL, *value = NULL;        if (!o) {                Py_INCREF(Py_None);                return Py_None;        }         switch (o->kind) {        case BoolOp_kind:                result = PyType_GenericNew(BoolOp_type, NULL, NULL);                if (!result) goto failed;                value = ast2obj_boolop(o->v.BoolOp.op);                if (!value) goto failed;                if (PyObject_SetAttrString(result, "op", value) == -1)                        goto failed;                Py_DECREF(value);                value = ast2obj_list(o->v.BoolOp.values, ast2obj_expr);                if (!value) goto failed;                if (PyObject_SetAttrString(result, "values", value) == -1)                        goto failed;                Py_DECREF(value);                break;        case BinOp_kind:                result = PyType_GenericNew(BinOp_type, NULL, NULL);                if (!result) goto failed;                value = ast2obj_expr(o->v.BinOp.left);                if (!value) goto failed;                if (PyObject_SetAttrString(result, "left", value) == -1)                        goto failed;                Py_DECREF(value);                value = ast2obj_operator(o->v.BinOp.op);                if (!value) goto failed;                if (PyObject_SetAttrString(result, "op", value) == -1)                        goto failed;                Py_DECREF(value);                value = ast2obj_expr(o->v.BinOp.right);                if (!value) goto failed;                if (PyObject_SetAttrString(result, "right", value) == -1)                        goto failed;                Py_DECREF(value);                break;        case UnaryOp_kind:                result = PyType_GenericNew(UnaryOp_type, NULL, NULL);                if (!result) goto failed;                value = ast2obj_unaryop(o->v.UnaryOp.op);                if (!value) goto failed;                if (PyObject_SetAttrString(result, "op", value) == -1)                        goto failed;                Py_DECREF(value);                value = ast2obj_expr(o->v.UnaryOp.operand);                if (!value) goto failed;                if (PyObject_SetAttrString(result, "operand", value) == -1)                        goto failed;                Py_DECREF(value);                break;        case Lambda_kind:                result = PyType_GenericNew(Lambda_type, NULL, NULL);                if (!result) goto failed;                value = ast2obj_arguments(o->v.Lambda.args);                if (!value) goto failed;                if (PyObject_SetAttrString(result, "args", value) == -1)                        goto failed;                Py_DECREF(value);                value = ast2obj_expr(o->v.Lambda.body);                if (!value) goto failed;                if (PyObject_SetAttrString(result, "body", value) == -1)                        goto failed;                Py_DECREF(value);                break;        case IfExp_kind:                result = PyType_GenericNew(IfExp_type, NULL, NULL);                if (!result) goto failed;                value = ast2obj_expr(o->v.IfExp.test);                if (!value) goto failed;                if (PyObject_SetAttrString(result, "test", value) == -1)                        goto failed;                Py_DECREF(value);                value = ast2obj_expr(o->v.IfExp.body);                if (!value) goto failed;                if (PyObject_SetAttrString(result, "body", value) == -1)                        goto failed;                Py_DECREF(value);                value = ast2obj_expr(o->v.IfExp.orelse);                if (!value) goto failed;                if (PyObject_SetAttrString(result, "orelse", value) == -1)                        goto failed;                Py_DECREF(value);                break;        case Dict_kind:                result = PyType_GenericNew(Dict_type, NULL, NULL);                if (!result) goto failed;                value = ast2obj_list(o->v.Dict.keys, ast2obj_expr);                if (!value) goto failed;                if (PyObject_SetAttrString(result, "keys", value) == -1)                        goto failed;                Py_DECREF(value);                value = ast2obj_list(o->v.Dict.values, ast2obj_expr);                if (!value) goto failed;                if (PyObject_SetAttrString(result, "values", value) == -1)                        goto failed;                Py_DECREF(value);                break;        case ListComp_kind:                result = PyType_GenericNew(ListComp_type, NULL, NULL);                if (!result) goto failed;                value = ast2obj_expr(o->v.ListComp.elt);                if (!value) goto failed;                if (PyObject_SetAttrString(result, "elt", value) == -1)                        goto failed;                Py_DECREF(value);                value = ast2obj_list(o->v.ListComp.generators,                                     ast2obj_comprehension);                if (!value) goto failed;                if (PyObject_SetAttrString(result, "generators", value) == -1)                        goto failed;                Py_DECREF(value);                break;        case GeneratorExp_kind:                result = PyType_GenericNew(GeneratorExp_type, NULL, NULL);                if (!result) goto failed;                value = ast2obj_expr(o->v.GeneratorExp.elt);                if (!value) goto failed;                if (PyObject_SetAttrString(result, "elt", value) == -1)                        goto failed;                Py_DECREF(value);                value = ast2obj_list(o->v.GeneratorExp.generators,                                     ast2obj_comprehension);                if (!value) goto failed;                if (PyObject_SetAttrString(result, "generators", value) == -1)                        goto failed;                Py_DECREF(value);                break;        case Yield_kind:                result = PyType_GenericNew(Yield_type, NULL, NULL);                if (!result) goto failed;                value = ast2obj_expr(o->v.Yield.value);                if (!value) goto failed;                if (PyObject_SetAttrString(result, "value", value) == -1)                        goto failed;                Py_DECREF(value);                break;        case Compare_kind:                result = PyType_GenericNew(Compare_type, NULL, NULL);                if (!result) goto failed;                value = ast2obj_expr(o->v.Compare.left);                if (!value) goto failed;                if (PyObject_SetAttrString(result, "left", value) == -1)                        goto failed;                Py_DECREF(value);

Lines 2001–2500 of 3202. Previous lines