comparison Python/Python-ast.c @ 36786:57322cb2ca11 legacy-trunk

Patch #1440601: Add col_offset attribute to AST nodes.
author Martin v. Löwis <martin@v.loewis.de>
date Wed, 01 Mar 2006 22:49:05 +0000
parents dbf9cc6c36eb
children df843b07f5fe
comparison
equal deleted inserted replaced
36785:6e285c69efc0 36786:57322cb2ca11
23 "body", 23 "body",
24 }; 24 };
25 static PyTypeObject *stmt_type; 25 static PyTypeObject *stmt_type;
26 static char *stmt_attributes[] = { 26 static char *stmt_attributes[] = {
27 "lineno", 27 "lineno",
28 "col_offset",
28 }; 29 };
29 static PyObject* ast2obj_stmt(void*); 30 static PyObject* ast2obj_stmt(void*);
30 static PyTypeObject *FunctionDef_type; 31 static PyTypeObject *FunctionDef_type;
31 static char *FunctionDef_fields[]={ 32 static char *FunctionDef_fields[]={
32 "name", 33 "name",
140 static PyTypeObject *Break_type; 141 static PyTypeObject *Break_type;
141 static PyTypeObject *Continue_type; 142 static PyTypeObject *Continue_type;
142 static PyTypeObject *expr_type; 143 static PyTypeObject *expr_type;
143 static char *expr_attributes[] = { 144 static char *expr_attributes[] = {
144 "lineno", 145 "lineno",
146 "col_offset",
145 }; 147 };
146 static PyObject* ast2obj_expr(void*); 148 static PyObject* ast2obj_expr(void*);
147 static PyTypeObject *BoolOp_type; 149 static PyTypeObject *BoolOp_type;
148 static char *BoolOp_fields[]={ 150 static char *BoolOp_fields[]={
149 "op", 151 "op",
448 if (!Expression_type) return 0; 450 if (!Expression_type) return 0;
449 Suite_type = make_type("Suite", mod_type, Suite_fields, 1); 451 Suite_type = make_type("Suite", mod_type, Suite_fields, 1);
450 if (!Suite_type) return 0; 452 if (!Suite_type) return 0;
451 stmt_type = make_type("stmt", AST_type, NULL, 0); 453 stmt_type = make_type("stmt", AST_type, NULL, 0);
452 if (!stmt_type) return 0; 454 if (!stmt_type) return 0;
453 if (!add_attributes(stmt_type, stmt_attributes, 1)) return 0; 455 if (!add_attributes(stmt_type, stmt_attributes, 2)) return 0;
454 FunctionDef_type = make_type("FunctionDef", stmt_type, 456 FunctionDef_type = make_type("FunctionDef", stmt_type,
455 FunctionDef_fields, 4); 457 FunctionDef_fields, 4);
456 if (!FunctionDef_type) return 0; 458 if (!FunctionDef_type) return 0;
457 ClassDef_type = make_type("ClassDef", stmt_type, ClassDef_fields, 3); 459 ClassDef_type = make_type("ClassDef", stmt_type, ClassDef_fields, 3);
458 if (!ClassDef_type) return 0; 460 if (!ClassDef_type) return 0;
500 if (!Break_type) return 0; 502 if (!Break_type) return 0;
501 Continue_type = make_type("Continue", stmt_type, NULL, 0); 503 Continue_type = make_type("Continue", stmt_type, NULL, 0);
502 if (!Continue_type) return 0; 504 if (!Continue_type) return 0;
503 expr_type = make_type("expr", AST_type, NULL, 0); 505 expr_type = make_type("expr", AST_type, NULL, 0);
504 if (!expr_type) return 0; 506 if (!expr_type) return 0;
505 if (!add_attributes(expr_type, expr_attributes, 1)) return 0; 507 if (!add_attributes(expr_type, expr_attributes, 2)) return 0;
506 BoolOp_type = make_type("BoolOp", expr_type, BoolOp_fields, 2); 508 BoolOp_type = make_type("BoolOp", expr_type, BoolOp_fields, 2);
507 if (!BoolOp_type) return 0; 509 if (!BoolOp_type) return 0;
508 BinOp_type = make_type("BinOp", expr_type, BinOp_fields, 3); 510 BinOp_type = make_type("BinOp", expr_type, BinOp_fields, 3);
509 if (!BinOp_type) return 0; 511 if (!BinOp_type) return 0;
510 UnaryOp_type = make_type("UnaryOp", expr_type, UnaryOp_fields, 2); 512 UnaryOp_type = make_type("UnaryOp", expr_type, UnaryOp_fields, 2);
781 return p; 783 return p;
782 } 784 }
783 785
784 stmt_ty 786 stmt_ty
785 FunctionDef(identifier name, arguments_ty args, asdl_seq * body, asdl_seq * 787 FunctionDef(identifier name, arguments_ty args, asdl_seq * body, asdl_seq *
786 decorators, int lineno, PyArena *arena) 788 decorators, int lineno, int col_offset, PyArena *arena)
787 { 789 {
788 stmt_ty p; 790 stmt_ty p;
789 if (!name) { 791 if (!name) {
790 PyErr_SetString(PyExc_ValueError, 792 PyErr_SetString(PyExc_ValueError,
791 "field name is required for FunctionDef"); 793 "field name is required for FunctionDef");
805 p->v.FunctionDef.name = name; 807 p->v.FunctionDef.name = name;
806 p->v.FunctionDef.args = args; 808 p->v.FunctionDef.args = args;
807 p->v.FunctionDef.body = body; 809 p->v.FunctionDef.body = body;
808 p->v.FunctionDef.decorators = decorators; 810 p->v.FunctionDef.decorators = decorators;
809 p->lineno = lineno; 811 p->lineno = lineno;
812 p->col_offset = col_offset;
810 return p; 813 return p;
811 } 814 }
812 815
813 stmt_ty 816 stmt_ty
814 ClassDef(identifier name, asdl_seq * bases, asdl_seq * body, int lineno, 817 ClassDef(identifier name, asdl_seq * bases, asdl_seq * body, int lineno, int
815 PyArena *arena) 818 col_offset, PyArena *arena)
816 { 819 {
817 stmt_ty p; 820 stmt_ty p;
818 if (!name) { 821 if (!name) {
819 PyErr_SetString(PyExc_ValueError, 822 PyErr_SetString(PyExc_ValueError,
820 "field name is required for ClassDef"); 823 "field name is required for ClassDef");
828 p->kind = ClassDef_kind; 831 p->kind = ClassDef_kind;
829 p->v.ClassDef.name = name; 832 p->v.ClassDef.name = name;
830 p->v.ClassDef.bases = bases; 833 p->v.ClassDef.bases = bases;
831 p->v.ClassDef.body = body; 834 p->v.ClassDef.body = body;
832 p->lineno = lineno; 835 p->lineno = lineno;
836 p->col_offset = col_offset;
833 return p; 837 return p;
834 } 838 }
835 839
836 stmt_ty 840 stmt_ty
837 Return(expr_ty value, int lineno, PyArena *arena) 841 Return(expr_ty value, int lineno, int col_offset, PyArena *arena)
838 { 842 {
839 stmt_ty p; 843 stmt_ty p;
840 p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p)); 844 p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p));
841 if (!p) { 845 if (!p) {
842 PyErr_NoMemory(); 846 PyErr_NoMemory();
843 return NULL; 847 return NULL;
844 } 848 }
845 p->kind = Return_kind; 849 p->kind = Return_kind;
846 p->v.Return.value = value; 850 p->v.Return.value = value;
847 p->lineno = lineno; 851 p->lineno = lineno;
852 p->col_offset = col_offset;
848 return p; 853 return p;
849 } 854 }
850 855
851 stmt_ty 856 stmt_ty
852 Delete(asdl_seq * targets, int lineno, PyArena *arena) 857 Delete(asdl_seq * targets, int lineno, int col_offset, PyArena *arena)
853 { 858 {
854 stmt_ty p; 859 stmt_ty p;
855 p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p)); 860 p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p));
856 if (!p) { 861 if (!p) {
857 PyErr_NoMemory(); 862 PyErr_NoMemory();
858 return NULL; 863 return NULL;
859 } 864 }
860 p->kind = Delete_kind; 865 p->kind = Delete_kind;
861 p->v.Delete.targets = targets; 866 p->v.Delete.targets = targets;
862 p->lineno = lineno; 867 p->lineno = lineno;
868 p->col_offset = col_offset;
863 return p; 869 return p;
864 } 870 }
865 871
866 stmt_ty 872 stmt_ty
867 Assign(asdl_seq * targets, expr_ty value, int lineno, PyArena *arena) 873 Assign(asdl_seq * targets, expr_ty value, int lineno, int col_offset, PyArena
874 *arena)
868 { 875 {
869 stmt_ty p; 876 stmt_ty p;
870 if (!value) { 877 if (!value) {
871 PyErr_SetString(PyExc_ValueError, 878 PyErr_SetString(PyExc_ValueError,
872 "field value is required for Assign"); 879 "field value is required for Assign");
879 } 886 }
880 p->kind = Assign_kind; 887 p->kind = Assign_kind;
881 p->v.Assign.targets = targets; 888 p->v.Assign.targets = targets;
882 p->v.Assign.value = value; 889 p->v.Assign.value = value;
883 p->lineno = lineno; 890 p->lineno = lineno;
891 p->col_offset = col_offset;
884 return p; 892 return p;
885 } 893 }
886 894
887 stmt_ty 895 stmt_ty
888 AugAssign(expr_ty target, operator_ty op, expr_ty value, int lineno, PyArena 896 AugAssign(expr_ty target, operator_ty op, expr_ty value, int lineno, int
889 *arena) 897 col_offset, PyArena *arena)
890 { 898 {
891 stmt_ty p; 899 stmt_ty p;
892 if (!target) { 900 if (!target) {
893 PyErr_SetString(PyExc_ValueError, 901 PyErr_SetString(PyExc_ValueError,
894 "field target is required for AugAssign"); 902 "field target is required for AugAssign");
912 p->kind = AugAssign_kind; 920 p->kind = AugAssign_kind;
913 p->v.AugAssign.target = target; 921 p->v.AugAssign.target = target;
914 p->v.AugAssign.op = op; 922 p->v.AugAssign.op = op;
915 p->v.AugAssign.value = value; 923 p->v.AugAssign.value = value;
916 p->lineno = lineno; 924 p->lineno = lineno;
925 p->col_offset = col_offset;
917 return p; 926 return p;
918 } 927 }
919 928
920 stmt_ty 929 stmt_ty
921 Print(expr_ty dest, asdl_seq * values, bool nl, int lineno, PyArena *arena) 930 Print(expr_ty dest, asdl_seq * values, bool nl, int lineno, int col_offset,
931 PyArena *arena)
922 { 932 {
923 stmt_ty p; 933 stmt_ty p;
924 p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p)); 934 p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p));
925 if (!p) { 935 if (!p) {
926 PyErr_NoMemory(); 936 PyErr_NoMemory();
929 p->kind = Print_kind; 939 p->kind = Print_kind;
930 p->v.Print.dest = dest; 940 p->v.Print.dest = dest;
931 p->v.Print.values = values; 941 p->v.Print.values = values;
932 p->v.Print.nl = nl; 942 p->v.Print.nl = nl;
933 p->lineno = lineno; 943 p->lineno = lineno;
944 p->col_offset = col_offset;
934 return p; 945 return p;
935 } 946 }
936 947
937 stmt_ty 948 stmt_ty
938 For(expr_ty target, expr_ty iter, asdl_seq * body, asdl_seq * orelse, int 949 For(expr_ty target, expr_ty iter, asdl_seq * body, asdl_seq * orelse, int
939 lineno, PyArena *arena) 950 lineno, int col_offset, PyArena *arena)
940 { 951 {
941 stmt_ty p; 952 stmt_ty p;
942 if (!target) { 953 if (!target) {
943 PyErr_SetString(PyExc_ValueError, 954 PyErr_SetString(PyExc_ValueError,
944 "field target is required for For"); 955 "field target is required for For");
958 p->v.For.target = target; 969 p->v.For.target = target;
959 p->v.For.iter = iter; 970 p->v.For.iter = iter;
960 p->v.For.body = body; 971 p->v.For.body = body;
961 p->v.For.orelse = orelse; 972 p->v.For.orelse = orelse;
962 p->lineno = lineno; 973 p->lineno = lineno;
974 p->col_offset = col_offset;
963 return p; 975 return p;
964 } 976 }
965 977
966 stmt_ty 978 stmt_ty
967 While(expr_ty test, asdl_seq * body, asdl_seq * orelse, int lineno, PyArena 979 While(expr_ty test, asdl_seq * body, asdl_seq * orelse, int lineno, int
968 *arena) 980 col_offset, PyArena *arena)
969 { 981 {
970 stmt_ty p; 982 stmt_ty p;
971 if (!test) { 983 if (!test) {
972 PyErr_SetString(PyExc_ValueError, 984 PyErr_SetString(PyExc_ValueError,
973 "field test is required for While"); 985 "field test is required for While");
981 p->kind = While_kind; 993 p->kind = While_kind;
982 p->v.While.test = test; 994 p->v.While.test = test;
983 p->v.While.body = body; 995 p->v.While.body = body;
984 p->v.While.orelse = orelse; 996 p->v.While.orelse = orelse;
985 p->lineno = lineno; 997 p->lineno = lineno;
998 p->col_offset = col_offset;
986 return p; 999 return p;
987 } 1000 }
988 1001
989 stmt_ty 1002 stmt_ty
990 If(expr_ty test, asdl_seq * body, asdl_seq * orelse, int lineno, PyArena *arena) 1003 If(expr_ty test, asdl_seq * body, asdl_seq * orelse, int lineno, int
1004 col_offset, PyArena *arena)
991 { 1005 {
992 stmt_ty p; 1006 stmt_ty p;
993 if (!test) { 1007 if (!test) {
994 PyErr_SetString(PyExc_ValueError, 1008 PyErr_SetString(PyExc_ValueError,
995 "field test is required for If"); 1009 "field test is required for If");
1003 p->kind = If_kind; 1017 p->kind = If_kind;
1004 p->v.If.test = test; 1018 p->v.If.test = test;
1005 p->v.If.body = body; 1019 p->v.If.body = body;
1006 p->v.If.orelse = orelse; 1020 p->v.If.orelse = orelse;
1007 p->lineno = lineno; 1021 p->lineno = lineno;
1022 p->col_offset = col_offset;
1008 return p; 1023 return p;
1009 } 1024 }
1010 1025
1011 stmt_ty 1026 stmt_ty
1012 With(expr_ty context_expr, expr_ty optional_vars, asdl_seq * body, int lineno, 1027 With(expr_ty context_expr, expr_ty optional_vars, asdl_seq * body, int lineno,
1013 PyArena *arena) 1028 int col_offset, PyArena *arena)
1014 { 1029 {
1015 stmt_ty p; 1030 stmt_ty p;
1016 if (!context_expr) { 1031 if (!context_expr) {
1017 PyErr_SetString(PyExc_ValueError, 1032 PyErr_SetString(PyExc_ValueError,
1018 "field context_expr is required for With"); 1033 "field context_expr is required for With");
1026 p->kind = With_kind; 1041 p->kind = With_kind;
1027 p->v.With.context_expr = context_expr; 1042 p->v.With.context_expr = context_expr;
1028 p->v.With.optional_vars = optional_vars; 1043 p->v.With.optional_vars = optional_vars;
1029 p->v.With.body = body; 1044 p->v.With.body = body;
1030 p->lineno = lineno; 1045 p->lineno = lineno;
1046 p->col_offset = col_offset;
1031 return p; 1047 return p;
1032 } 1048 }
1033 1049
1034 stmt_ty 1050 stmt_ty
1035 Raise(expr_ty type, expr_ty inst, expr_ty tback, int lineno, PyArena *arena) 1051 Raise(expr_ty type, expr_ty inst, expr_ty tback, int lineno, int col_offset,
1052 PyArena *arena)
1036 { 1053 {
1037 stmt_ty p; 1054 stmt_ty p;
1038 p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p)); 1055 p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p));
1039 if (!p) { 1056 if (!p) {
1040 PyErr_NoMemory(); 1057 PyErr_NoMemory();
1043 p->kind = Raise_kind; 1060 p->kind = Raise_kind;
1044 p->v.Raise.type = type; 1061 p->v.Raise.type = type;
1045 p->v.Raise.inst = inst; 1062 p->v.Raise.inst = inst;
1046 p->v.Raise.tback = tback; 1063 p->v.Raise.tback = tback;
1047 p->lineno = lineno; 1064 p->lineno = lineno;
1065 p->col_offset = col_offset;
1048 return p; 1066 return p;
1049 } 1067 }
1050 1068
1051 stmt_ty 1069 stmt_ty
1052 TryExcept(asdl_seq * body, asdl_seq * handlers, asdl_seq * orelse, int lineno, 1070 TryExcept(asdl_seq * body, asdl_seq * handlers, asdl_seq * orelse, int lineno,
1053 PyArena *arena) 1071 int col_offset, PyArena *arena)
1054 { 1072 {
1055 stmt_ty p; 1073 stmt_ty p;
1056 p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p)); 1074 p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p));
1057 if (!p) { 1075 if (!p) {
1058 PyErr_NoMemory(); 1076 PyErr_NoMemory();
1061 p->kind = TryExcept_kind; 1079 p->kind = TryExcept_kind;
1062 p->v.TryExcept.body = body; 1080 p->v.TryExcept.body = body;
1063 p->v.TryExcept.handlers = handlers; 1081 p->v.TryExcept.handlers = handlers;
1064 p->v.TryExcept.orelse = orelse; 1082 p->v.TryExcept.orelse = orelse;
1065 p->lineno = lineno; 1083 p->lineno = lineno;
1084 p->col_offset = col_offset;
1066 return p; 1085 return p;
1067 } 1086 }
1068 1087
1069 stmt_ty 1088 stmt_ty
1070 TryFinally(asdl_seq * body, asdl_seq * finalbody, int lineno, PyArena *arena) 1089 TryFinally(asdl_seq * body, asdl_seq * finalbody, int lineno, int col_offset,
1090 PyArena *arena)
1071 { 1091 {
1072 stmt_ty p; 1092 stmt_ty p;
1073 p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p)); 1093 p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p));
1074 if (!p) { 1094 if (!p) {
1075 PyErr_NoMemory(); 1095 PyErr_NoMemory();
1077 } 1097 }
1078 p->kind = TryFinally_kind; 1098 p->kind = TryFinally_kind;
1079 p->v.TryFinally.body = body; 1099 p->v.TryFinally.body = body;
1080 p->v.TryFinally.finalbody = finalbody; 1100 p->v.TryFinally.finalbody = finalbody;
1081 p->lineno = lineno; 1101 p->lineno = lineno;
1102 p->col_offset = col_offset;
1082 return p; 1103 return p;
1083 } 1104 }
1084 1105
1085 stmt_ty 1106 stmt_ty
1086 Assert(expr_ty test, expr_ty msg, int lineno, PyArena *arena) 1107 Assert(expr_ty test, expr_ty msg, int lineno, int col_offset, PyArena *arena)
1087 { 1108 {
1088 stmt_ty p; 1109 stmt_ty p;
1089 if (!test) { 1110 if (!test) {
1090 PyErr_SetString(PyExc_ValueError, 1111 PyErr_SetString(PyExc_ValueError,
1091 "field test is required for Assert"); 1112 "field test is required for Assert");
1098 } 1119 }
1099 p->kind = Assert_kind; 1120 p->kind = Assert_kind;
1100 p->v.Assert.test = test; 1121 p->v.Assert.test = test;
1101 p->v.Assert.msg = msg; 1122 p->v.Assert.msg = msg;
1102 p->lineno = lineno; 1123 p->lineno = lineno;
1124 p->col_offset = col_offset;
1103 return p; 1125 return p;
1104 } 1126 }
1105 1127
1106 stmt_ty 1128 stmt_ty
1107 Import(asdl_seq * names, int lineno, PyArena *arena) 1129 Import(asdl_seq * names, int lineno, int col_offset, PyArena *arena)
1108 { 1130 {
1109 stmt_ty p; 1131 stmt_ty p;
1110 p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p)); 1132 p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p));
1111 if (!p) { 1133 if (!p) {
1112 PyErr_NoMemory(); 1134 PyErr_NoMemory();
1113 return NULL; 1135 return NULL;
1114 } 1136 }
1115 p->kind = Import_kind; 1137 p->kind = Import_kind;
1116 p->v.Import.names = names; 1138 p->v.Import.names = names;
1117 p->lineno = lineno; 1139 p->lineno = lineno;
1140 p->col_offset = col_offset;
1118 return p; 1141 return p;
1119 } 1142 }
1120 1143
1121 stmt_ty 1144 stmt_ty
1122 ImportFrom(identifier module, asdl_seq * names, int level, int lineno, PyArena 1145 ImportFrom(identifier module, asdl_seq * names, int level, int lineno, int
1123 *arena) 1146 col_offset, PyArena *arena)
1124 { 1147 {
1125 stmt_ty p; 1148 stmt_ty p;
1126 if (!module) { 1149 if (!module) {
1127 PyErr_SetString(PyExc_ValueError, 1150 PyErr_SetString(PyExc_ValueError,
1128 "field module is required for ImportFrom"); 1151 "field module is required for ImportFrom");
1136 p->kind = ImportFrom_kind; 1159 p->kind = ImportFrom_kind;
1137 p->v.ImportFrom.module = module; 1160 p->v.ImportFrom.module = module;
1138 p->v.ImportFrom.names = names; 1161 p->v.ImportFrom.names = names;
1139 p->v.ImportFrom.level = level; 1162 p->v.ImportFrom.level = level;
1140 p->lineno = lineno; 1163 p->lineno = lineno;
1164 p->col_offset = col_offset;
1141 return p; 1165 return p;
1142 } 1166 }
1143 1167
1144 stmt_ty 1168 stmt_ty
1145 Exec(expr_ty body, expr_ty globals, expr_ty locals, int lineno, PyArena *arena) 1169 Exec(expr_ty body, expr_ty globals, expr_ty locals, int lineno, int col_offset,
1170 PyArena *arena)
1146 { 1171 {
1147 stmt_ty p; 1172 stmt_ty p;
1148 if (!body) { 1173 if (!body) {
1149 PyErr_SetString(PyExc_ValueError, 1174 PyErr_SetString(PyExc_ValueError,
1150 "field body is required for Exec"); 1175 "field body is required for Exec");
1158 p->kind = Exec_kind; 1183 p->kind = Exec_kind;
1159 p->v.Exec.body = body; 1184 p->v.Exec.body = body;
1160 p->v.Exec.globals = globals; 1185 p->v.Exec.globals = globals;
1161 p->v.Exec.locals = locals; 1186 p->v.Exec.locals = locals;
1162 p->lineno = lineno; 1187 p->lineno = lineno;
1188 p->col_offset = col_offset;
1163 return p; 1189 return p;
1164 } 1190 }
1165 1191
1166 stmt_ty 1192 stmt_ty
1167 Global(asdl_seq * names, int lineno, PyArena *arena) 1193 Global(asdl_seq * names, int lineno, int col_offset, PyArena *arena)
1168 { 1194 {
1169 stmt_ty p; 1195 stmt_ty p;
1170 p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p)); 1196 p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p));
1171 if (!p) { 1197 if (!p) {
1172 PyErr_NoMemory(); 1198 PyErr_NoMemory();
1173 return NULL; 1199 return NULL;
1174 } 1200 }
1175 p->kind = Global_kind; 1201 p->kind = Global_kind;
1176 p->v.Global.names = names; 1202 p->v.Global.names = names;
1177 p->lineno = lineno; 1203 p->lineno = lineno;
1204 p->col_offset = col_offset;
1178 return p; 1205 return p;
1179 } 1206 }
1180 1207
1181 stmt_ty 1208 stmt_ty
1182 Expr(expr_ty value, int lineno, PyArena *arena) 1209 Expr(expr_ty value, int lineno, int col_offset, PyArena *arena)
1183 { 1210 {
1184 stmt_ty p; 1211 stmt_ty p;
1185 if (!value) { 1212 if (!value) {
1186 PyErr_SetString(PyExc_ValueError, 1213 PyErr_SetString(PyExc_ValueError,
1187 "field value is required for Expr"); 1214 "field value is required for Expr");
1193 return NULL; 1220 return NULL;
1194 } 1221 }
1195 p->kind = Expr_kind; 1222 p->kind = Expr_kind;
1196 p->v.Expr.value = value; 1223 p->v.Expr.value = value;
1197 p->lineno = lineno; 1224 p->lineno = lineno;
1225 p->col_offset = col_offset;
1198 return p; 1226 return p;
1199 } 1227 }
1200 1228
1201 stmt_ty 1229 stmt_ty
1202 Pass(int lineno, PyArena *arena) 1230 Pass(int lineno, int col_offset, PyArena *arena)
1203 { 1231 {
1204 stmt_ty p; 1232 stmt_ty p;
1205 p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p)); 1233 p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p));
1206 if (!p) { 1234 if (!p) {
1207 PyErr_NoMemory(); 1235 PyErr_NoMemory();
1208 return NULL; 1236 return NULL;
1209 } 1237 }
1210 p->kind = Pass_kind; 1238 p->kind = Pass_kind;
1211 p->lineno = lineno; 1239 p->lineno = lineno;
1240 p->col_offset = col_offset;
1212 return p; 1241 return p;
1213 } 1242 }
1214 1243
1215 stmt_ty 1244 stmt_ty
1216 Break(int lineno, PyArena *arena) 1245 Break(int lineno, int col_offset, PyArena *arena)
1217 { 1246 {
1218 stmt_ty p; 1247 stmt_ty p;
1219 p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p)); 1248 p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p));
1220 if (!p) { 1249 if (!p) {
1221 PyErr_NoMemory(); 1250 PyErr_NoMemory();
1222 return NULL; 1251 return NULL;
1223 } 1252 }
1224 p->kind = Break_kind; 1253 p->kind = Break_kind;
1225 p->lineno = lineno; 1254 p->lineno = lineno;
1255 p->col_offset = col_offset;
1226 return p; 1256 return p;
1227 } 1257 }
1228 1258
1229 stmt_ty 1259 stmt_ty
1230 Continue(int lineno, PyArena *arena) 1260 Continue(int lineno, int col_offset, PyArena *arena)
1231 { 1261 {
1232 stmt_ty p; 1262 stmt_ty p;
1233 p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p)); 1263 p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p));
1234 if (!p) { 1264 if (!p) {
1235 PyErr_NoMemory(); 1265 PyErr_NoMemory();
1236 return NULL; 1266 return NULL;
1237 } 1267 }
1238 p->kind = Continue_kind; 1268 p->kind = Continue_kind;
1239 p->lineno = lineno; 1269 p->lineno = lineno;
1270 p->col_offset = col_offset;
1240 return p; 1271 return p;
1241 } 1272 }
1242 1273
1243 expr_ty 1274 expr_ty
1244 BoolOp(boolop_ty op, asdl_seq * values, int lineno, PyArena *arena) 1275 BoolOp(boolop_ty op, asdl_seq * values, int lineno, int col_offset, PyArena
1276 *arena)
1245 { 1277 {
1246 expr_ty p; 1278 expr_ty p;
1247 if (!op) { 1279 if (!op) {
1248 PyErr_SetString(PyExc_ValueError, 1280 PyErr_SetString(PyExc_ValueError,
1249 "field op is required for BoolOp"); 1281 "field op is required for BoolOp");
1256 } 1288 }
1257 p->kind = BoolOp_kind; 1289 p->kind = BoolOp_kind;
1258 p->v.BoolOp.op = op; 1290 p->v.BoolOp.op = op;
1259 p->v.BoolOp.values = values; 1291 p->v.BoolOp.values = values;
1260 p->lineno = lineno; 1292 p->lineno = lineno;
1293 p->col_offset = col_offset;
1261 return p; 1294 return p;
1262 } 1295 }
1263 1296
1264 expr_ty 1297 expr_ty
1265 BinOp(expr_ty left, operator_ty op, expr_ty right, int lineno, PyArena *arena) 1298 BinOp(expr_ty left, operator_ty op, expr_ty right, int lineno, int col_offset,
1299 PyArena *arena)
1266 { 1300 {
1267 expr_ty p; 1301 expr_ty p;
1268 if (!left) { 1302 if (!left) {
1269 PyErr_SetString(PyExc_ValueError, 1303 PyErr_SetString(PyExc_ValueError,
1270 "field left is required for BinOp"); 1304 "field left is required for BinOp");
1288 p->kind = BinOp_kind; 1322 p->kind = BinOp_kind;
1289 p->v.BinOp.left = left; 1323 p->v.BinOp.left = left;
1290 p->v.BinOp.op = op; 1324 p->v.BinOp.op = op;
1291 p->v.BinOp.right = right; 1325 p->v.BinOp.right = right;
1292 p->lineno = lineno; 1326 p->lineno = lineno;
1327 p->col_offset = col_offset;
1293 return p; 1328 return p;
1294 } 1329 }
1295 1330
1296 expr_ty 1331 expr_ty
1297 UnaryOp(unaryop_ty op, expr_ty operand, int lineno, PyArena *arena) 1332 UnaryOp(unaryop_ty op, expr_ty operand, int lineno, int col_offset, PyArena
1333 *arena)
1298 { 1334 {
1299 expr_ty p; 1335 expr_ty p;
1300 if (!op) { 1336 if (!op) {
1301 PyErr_SetString(PyExc_ValueError, 1337 PyErr_SetString(PyExc_ValueError,
1302 "field op is required for UnaryOp"); 1338 "field op is required for UnaryOp");
1314 } 1350 }
1315 p->kind = UnaryOp_kind; 1351 p->kind = UnaryOp_kind;
1316 p->v.UnaryOp.op = op; 1352 p->v.UnaryOp.op = op;
1317 p->v.UnaryOp.operand = operand; 1353 p->v.UnaryOp.operand = operand;
1318 p->lineno = lineno; 1354 p->lineno = lineno;
1355 p->col_offset = col_offset;
1319 return p; 1356 return p;
1320 } 1357 }
1321 1358
1322 expr_ty 1359 expr_ty
1323 Lambda(arguments_ty args, expr_ty body, int lineno, PyArena *arena) 1360 Lambda(arguments_ty args, expr_ty body, int lineno, int col_offset, PyArena
1361 *arena)
1324 { 1362 {
1325 expr_ty p; 1363 expr_ty p;
1326 if (!args) { 1364 if (!args) {
1327 PyErr_SetString(PyExc_ValueError, 1365 PyErr_SetString(PyExc_ValueError,
1328 "field args is required for Lambda"); 1366 "field args is required for Lambda");
1340 } 1378 }
1341 p->kind = Lambda_kind; 1379 p->kind = Lambda_kind;
1342 p->v.Lambda.args = args; 1380 p->v.Lambda.args = args;
1343 p->v.Lambda.body = body; 1381 p->v.Lambda.body = body;
1344 p->lineno = lineno; 1382 p->lineno = lineno;
1383 p->col_offset = col_offset;
1345 return p; 1384 return p;
1346 } 1385 }
1347 1386
1348 expr_ty 1387 expr_ty
1349 IfExp(expr_ty test, expr_ty body, expr_ty orelse, int lineno, PyArena *arena) 1388 IfExp(expr_ty test, expr_ty body, expr_ty orelse, int lineno, int col_offset,
1389 PyArena *arena)
1350 { 1390 {
1351 expr_ty p; 1391 expr_ty p;
1352 if (!test) { 1392 if (!test) {
1353 PyErr_SetString(PyExc_ValueError, 1393 PyErr_SetString(PyExc_ValueError,
1354 "field test is required for IfExp"); 1394 "field test is required for IfExp");
1372 p->kind = IfExp_kind; 1412 p->kind = IfExp_kind;
1373 p->v.IfExp.test = test; 1413 p->v.IfExp.test = test;
1374 p->v.IfExp.body = body; 1414 p->v.IfExp.body = body;
1375 p->v.IfExp.orelse = orelse; 1415 p->v.IfExp.orelse = orelse;
1376 p->lineno = lineno; 1416 p->lineno = lineno;
1417 p->col_offset = col_offset;
1377 return p; 1418 return p;
1378 } 1419 }
1379 1420
1380 expr_ty 1421 expr_ty
1381 Dict(asdl_seq * keys, asdl_seq * values, int lineno, PyArena *arena) 1422 Dict(asdl_seq * keys, asdl_seq * values, int lineno, int col_offset, PyArena
1423 *arena)
1382 { 1424 {
1383 expr_ty p; 1425 expr_ty p;
1384 p = (expr_ty)PyArena_Malloc(arena, sizeof(*p)); 1426 p = (expr_ty)PyArena_Malloc(arena, sizeof(*p));
1385 if (!p) { 1427 if (!p) {
1386 PyErr_NoMemory(); 1428 PyErr_NoMemory();
1388 } 1430 }
1389 p->kind = Dict_kind; 1431 p->kind = Dict_kind;
1390 p->v.Dict.keys = keys; 1432 p->v.Dict.keys = keys;
1391 p->v.Dict.values = values; 1433 p->v.Dict.values = values;
1392 p->lineno = lineno; 1434 p->lineno = lineno;
1435 p->col_offset = col_offset;
1393 return p; 1436 return p;
1394 } 1437 }
1395 1438
1396 expr_ty 1439 expr_ty
1397 ListComp(expr_ty elt, asdl_seq * generators, int lineno, PyArena *arena) 1440 ListComp(expr_ty elt, asdl_seq * generators, int lineno, int col_offset,
1441 PyArena *arena)
1398 { 1442 {
1399 expr_ty p; 1443 expr_ty p;
1400 if (!elt) { 1444 if (!elt) {
1401 PyErr_SetString(PyExc_ValueError, 1445 PyErr_SetString(PyExc_ValueError,
1402 "field elt is required for ListComp"); 1446 "field elt is required for ListComp");
1409 } 1453 }
1410 p->kind = ListComp_kind; 1454 p->kind = ListComp_kind;
1411 p->v.ListComp.elt = elt; 1455 p->v.ListComp.elt = elt;
1412 p->v.ListComp.generators = generators; 1456 p->v.ListComp.generators = generators;
1413 p->lineno = lineno; 1457 p->lineno = lineno;
1458 p->col_offset = col_offset;
1414 return p; 1459 return p;
1415 } 1460 }
1416 1461
1417 expr_ty 1462 expr_ty
1418 GeneratorExp(expr_ty elt, asdl_seq * generators, int lineno, PyArena *arena) 1463 GeneratorExp(expr_ty elt, asdl_seq * generators, int lineno, int col_offset,
1464 PyArena *arena)
1419 { 1465 {
1420 expr_ty p; 1466 expr_ty p;
1421 if (!elt) { 1467 if (!elt) {
1422 PyErr_SetString(PyExc_ValueError, 1468 PyErr_SetString(PyExc_ValueError,
1423 "field elt is required for GeneratorExp"); 1469 "field elt is required for GeneratorExp");
1430 } 1476 }
1431 p->kind = GeneratorExp_kind; 1477 p->kind = GeneratorExp_kind;
1432 p->v.GeneratorExp.elt = elt; 1478 p->v.GeneratorExp.elt = elt;
1433 p->v.GeneratorExp.generators = generators; 1479 p->v.GeneratorExp.generators = generators;
1434 p->lineno = lineno; 1480 p->lineno = lineno;
1481 p->col_offset = col_offset;
1435 return p; 1482 return p;
1436 } 1483 }
1437 1484
1438 expr_ty 1485 expr_ty
1439 Yield(expr_ty value, int lineno, PyArena *arena) 1486 Yield(expr_ty value, int lineno, int col_offset, PyArena *arena)
1440 { 1487 {
1441 expr_ty p; 1488 expr_ty p;
1442 p = (expr_ty)PyArena_Malloc(arena, sizeof(*p)); 1489 p = (expr_ty)PyArena_Malloc(arena, sizeof(*p));
1443 if (!p) { 1490 if (!p) {
1444 PyErr_NoMemory(); 1491 PyErr_NoMemory();
1445 return NULL; 1492 return NULL;
1446 } 1493 }
1447 p->kind = Yield_kind; 1494 p->kind = Yield_kind;
1448 p->v.Yield.value = value; 1495 p->v.Yield.value = value;
1449 p->lineno = lineno; 1496 p->lineno = lineno;
1497 p->col_offset = col_offset;
1450 return p; 1498 return p;
1451 } 1499 }
1452 1500
1453 expr_ty 1501 expr_ty
1454 Compare(expr_ty left, asdl_seq * ops, asdl_seq * comparators, int lineno, 1502 Compare(expr_ty left, asdl_seq * ops, asdl_seq * comparators, int lineno, int
1455 PyArena *arena) 1503 col_offset, PyArena *arena)
1456 { 1504 {
1457 expr_ty p; 1505 expr_ty p;
1458 if (!left) { 1506 if (!left) {
1459 PyErr_SetString(PyExc_ValueError, 1507 PyErr_SetString(PyExc_ValueError,
1460 "field left is required for Compare"); 1508 "field left is required for Compare");
1468 p->kind = Compare_kind; 1516 p->kind = Compare_kind;
1469 p->v.Compare.left = left; 1517 p->v.Compare.left = left;
1470 p->v.Compare.ops = ops; 1518 p->v.Compare.ops = ops;
1471 p->v.Compare.comparators = comparators; 1519 p->v.Compare.comparators = comparators;
1472 p->lineno = lineno; 1520 p->lineno = lineno;
1521 p->col_offset = col_offset;
1473 return p; 1522 return p;
1474 } 1523 }
1475 1524
1476 expr_ty 1525 expr_ty
1477 Call(expr_ty func, asdl_seq * args, asdl_seq * keywords, expr_ty starargs, 1526 Call(expr_ty func, asdl_seq * args, asdl_seq * keywords, expr_ty starargs,
1478 expr_ty kwargs, int lineno, PyArena *arena) 1527 expr_ty kwargs, int lineno, int col_offset, PyArena *arena)
1479 { 1528 {
1480 expr_ty p; 1529 expr_ty p;
1481 if (!func) { 1530 if (!func) {
1482 PyErr_SetString(PyExc_ValueError, 1531 PyErr_SetString(PyExc_ValueError,
1483 "field func is required for Call"); 1532 "field func is required for Call");
1493 p->v.Call.args = args; 1542 p->v.Call.args = args;
1494 p->v.Call.keywords = keywords; 1543 p->v.Call.keywords = keywords;
1495 p->v.Call.starargs = starargs; 1544 p->v.Call.starargs = starargs;
1496 p->v.Call.kwargs = kwargs; 1545 p->v.Call.kwargs = kwargs;
1497 p->lineno = lineno; 1546 p->lineno = lineno;
1547 p->col_offset = col_offset;
1498 return p; 1548 return p;
1499 } 1549 }
1500 1550
1501 expr_ty 1551 expr_ty
1502 Repr(expr_ty value, int lineno, PyArena *arena) 1552 Repr(expr_ty value, int lineno, int col_offset, PyArena *arena)
1503 { 1553 {
1504 expr_ty p; 1554 expr_ty p;
1505 if (!value) { 1555 if (!value) {
1506 PyErr_SetString(PyExc_ValueError, 1556 PyErr_SetString(PyExc_ValueError,
1507 "field value is required for Repr"); 1557 "field value is required for Repr");
1513 return NULL; 1563 return NULL;
1514 } 1564 }
1515 p->kind = Repr_kind; 1565 p->kind = Repr_kind;
1516 p->v.Repr.value = value; 1566 p->v.Repr.value = value;
1517 p->lineno = lineno; 1567 p->lineno = lineno;
1568 p->col_offset = col_offset;
1518 return p; 1569 return p;
1519 } 1570 }
1520 1571
1521 expr_ty 1572 expr_ty
1522 Num(object n, int lineno, PyArena *arena) 1573 Num(object n, int lineno, int col_offset, PyArena *arena)
1523 { 1574 {
1524 expr_ty p; 1575 expr_ty p;
1525 if (!n) { 1576 if (!n) {
1526 PyErr_SetString(PyExc_ValueError, 1577 PyErr_SetString(PyExc_ValueError,
1527 "field n is required for Num"); 1578 "field n is required for Num");
1533 return NULL; 1584 return NULL;
1534 } 1585 }
1535 p->kind = Num_kind; 1586 p->kind = Num_kind;
1536 p->v.Num.n = n; 1587 p->v.Num.n = n;
1537 p->lineno = lineno; 1588 p->lineno = lineno;
1589 p->col_offset = col_offset;
1538 return p; 1590 return p;
1539 } 1591 }
1540 1592
1541 expr_ty 1593 expr_ty
1542 Str(string s, int lineno, PyArena *arena) 1594 Str(string s, int lineno, int col_offset, PyArena *arena)
1543 { 1595 {
1544 expr_ty p; 1596 expr_ty p;
1545 if (!s) { 1597 if (!s) {
1546 PyErr_SetString(PyExc_ValueError, 1598 PyErr_SetString(PyExc_ValueError,
1547 "field s is required for Str"); 1599 "field s is required for Str");
1553 return NULL; 1605 return NULL;
1554 } 1606 }
1555 p->kind = Str_kind; 1607 p->kind = Str_kind;
1556 p->v.Str.s = s; 1608 p->v.Str.s = s;
1557 p->lineno = lineno; 1609 p->lineno = lineno;
1610 p->col_offset = col_offset;
1558 return p; 1611 return p;
1559 } 1612 }
1560 1613
1561 expr_ty 1614 expr_ty
1562 Attribute(expr_ty value, identifier attr, expr_context_ty ctx, int lineno, 1615 Attribute(expr_ty value, identifier attr, expr_context_ty ctx, int lineno, int
1563 PyArena *arena) 1616 col_offset, PyArena *arena)
1564 { 1617 {
1565 expr_ty p; 1618 expr_ty p;
1566 if (!value) { 1619 if (!value) {
1567 PyErr_SetString(PyExc_ValueError, 1620 PyErr_SetString(PyExc_ValueError,
1568 "field value is required for Attribute"); 1621 "field value is required for Attribute");
1586 p->kind = Attribute_kind; 1639 p->kind = Attribute_kind;
1587 p->v.Attribute.value = value; 1640 p->v.Attribute.value = value;
1588 p->v.Attribute.attr = attr; 1641 p->v.Attribute.attr = attr;
1589 p->v.Attribute.ctx = ctx; 1642 p->v.Attribute.ctx = ctx;
1590 p->lineno = lineno; 1643 p->lineno = lineno;
1644 p->col_offset = col_offset;
1591 return p; 1645 return p;
1592 } 1646 }
1593 1647
1594 expr_ty 1648 expr_ty
1595 Subscript(expr_ty value, slice_ty slice, expr_context_ty ctx, int lineno, 1649 Subscript(expr_ty value, slice_ty slice, expr_context_ty ctx, int lineno, int
1596 PyArena *arena) 1650 col_offset, PyArena *arena)
1597 { 1651 {
1598 expr_ty p; 1652 expr_ty p;
1599 if (!value) { 1653 if (!value) {
1600 PyErr_SetString(PyExc_ValueError, 1654 PyErr_SetString(PyExc_ValueError,
1601 "field value is required for Subscript"); 1655 "field value is required for Subscript");
1619 p->kind = Subscript_kind; 1673 p->kind = Subscript_kind;
1620 p->v.Subscript.value = value; 1674 p->v.Subscript.value = value;
1621 p->v.Subscript.slice = slice; 1675 p->v.Subscript.slice = slice;
1622 p->v.Subscript.ctx = ctx; 1676 p->v.Subscript.ctx = ctx;
1623 p->lineno = lineno; 1677 p->lineno = lineno;
1678 p->col_offset = col_offset;
1624 return p; 1679 return p;
1625 } 1680 }
1626 1681
1627 expr_ty 1682 expr_ty
1628 Name(identifier id, expr_context_ty ctx, int lineno, PyArena *arena) 1683 Name(identifier id, expr_context_ty ctx, int lineno, int col_offset, PyArena
1684 *arena)
1629 { 1685 {
1630 expr_ty p; 1686 expr_ty p;
1631 if (!id) { 1687 if (!id) {
1632 PyErr_SetString(PyExc_ValueError, 1688 PyErr_SetString(PyExc_ValueError,
1633 "field id is required for Name"); 1689 "field id is required for Name");
1645 } 1701 }
1646 p->kind = Name_kind; 1702 p->kind = Name_kind;
1647 p->v.Name.id = id; 1703 p->v.Name.id = id;
1648 p->v.Name.ctx = ctx; 1704 p->v.Name.ctx = ctx;
1649 p->lineno = lineno; 1705 p->lineno = lineno;
1706 p->col_offset = col_offset;
1650 return p; 1707 return p;
1651 } 1708 }
1652 1709
1653 expr_ty 1710 expr_ty
1654 List(asdl_seq * elts, expr_context_ty ctx, int lineno, PyArena *arena) 1711 List(asdl_seq * elts, expr_context_ty ctx, int lineno, int col_offset, PyArena
1712 *arena)
1655 { 1713 {
1656 expr_ty p; 1714 expr_ty p;
1657 if (!ctx) { 1715 if (!ctx) {
1658 PyErr_SetString(PyExc_ValueError, 1716 PyErr_SetString(PyExc_ValueError,
1659 "field ctx is required for List"); 1717 "field ctx is required for List");
1666 } 1724 }
1667 p->kind = List_kind; 1725 p->kind = List_kind;
1668 p->v.List.elts = elts; 1726 p->v.List.elts = elts;
1669 p->v.List.ctx = ctx; 1727 p->v.List.ctx = ctx;
1670 p->lineno = lineno; 1728 p->lineno = lineno;
1729 p->col_offset = col_offset;
1671 return p; 1730 return p;
1672 } 1731 }
1673 1732
1674 expr_ty 1733 expr_ty
1675 Tuple(asdl_seq * elts, expr_context_ty ctx, int lineno, PyArena *arena) 1734 Tuple(asdl_seq * elts, expr_context_ty ctx, int lineno, int col_offset, PyArena
1735 *arena)
1676 { 1736 {
1677 expr_ty p; 1737 expr_ty p;
1678 if (!ctx) { 1738 if (!ctx) {
1679 PyErr_SetString(PyExc_ValueError, 1739 PyErr_SetString(PyExc_ValueError,
1680 "field ctx is required for Tuple"); 1740 "field ctx is required for Tuple");
1687 } 1747 }
1688 p->kind = Tuple_kind; 1748 p->kind = Tuple_kind;
1689 p->v.Tuple.elts = elts; 1749 p->v.Tuple.elts = elts;
1690 p->v.Tuple.ctx = ctx; 1750 p->v.Tuple.ctx = ctx;
1691 p->lineno = lineno; 1751 p->lineno = lineno;
1752 p->col_offset = col_offset;
1692 return p; 1753 return p;
1693 } 1754 }
1694 1755
1695 slice_ty 1756 slice_ty
1696 Ellipsis(PyArena *arena) 1757 Ellipsis(PyArena *arena)
2262 break; 2323 break;
2263 } 2324 }
2264 value = ast2obj_int(o->lineno); 2325 value = ast2obj_int(o->lineno);
2265 if (!value) goto failed; 2326 if (!value) goto failed;
2266 PyObject_SetAttrString(result, "lineno", value); 2327 PyObject_SetAttrString(result, "lineno", value);
2328 value = ast2obj_int(o->col_offset);
2329 if (!value) goto failed;
2330 PyObject_SetAttrString(result, "col_offset", value);
2267 return result; 2331 return result;
2268 failed: 2332 failed:
2269 Py_XDECREF(value); 2333 Py_XDECREF(value);
2270 Py_XDECREF(result); 2334 Py_XDECREF(result);
2271 return NULL; 2335 return NULL;
2578 break; 2642 break;
2579 } 2643 }
2580 value = ast2obj_int(o->lineno); 2644 value = ast2obj_int(o->lineno);
2581 if (!value) goto failed; 2645 if (!value) goto failed;
2582 PyObject_SetAttrString(result, "lineno", value); 2646 PyObject_SetAttrString(result, "lineno", value);
2647 value = ast2obj_int(o->col_offset);
2648 if (!value) goto failed;
2649 PyObject_SetAttrString(result, "col_offset", value);
2583 return result; 2650 return result;
2584 failed: 2651 failed:
2585 Py_XDECREF(value); 2652 Py_XDECREF(value);
2586 Py_XDECREF(result); 2653 Py_XDECREF(result);
2587 return NULL; 2654 return NULL;