comparison Python/Python-ast.c @ 40936:0376f13a1af9 legacy-trunk

Fix a couple of problems in generating the AST code: * use %r instead of backticks since backticks are going away in Py3k * PyArena_Malloc() already sets PyErr_NoMemory so we don't need to do it again * the signature for ast2obj_int incorrectly used a bool, rather than a long
author Neal Norwitz <nnorwitz@gmail.com>
date Mon, 26 Feb 2007 18:10:47 +0000
parents 180d4e899683
children 393822f2ef90
comparison
equal deleted inserted replaced
40935:45affae465e4 40936:0376f13a1af9
438 static PyObject* ast2obj_bool(bool b) 438 static PyObject* ast2obj_bool(bool b)
439 { 439 {
440 return PyBool_FromLong(b); 440 return PyBool_FromLong(b);
441 } 441 }
442 442
443 static PyObject* ast2obj_int(bool b) 443 static PyObject* ast2obj_int(long b)
444 { 444 {
445 return PyInt_FromLong(b); 445 return PyInt_FromLong(b);
446 } 446 }
447 447
448 static int init_types(void) 448 static int init_types(void)
738 mod_ty 738 mod_ty
739 Module(asdl_seq * body, PyArena *arena) 739 Module(asdl_seq * body, PyArena *arena)
740 { 740 {
741 mod_ty p; 741 mod_ty p;
742 p = (mod_ty)PyArena_Malloc(arena, sizeof(*p)); 742 p = (mod_ty)PyArena_Malloc(arena, sizeof(*p));
743 if (!p) { 743 if (!p)
744 PyErr_NoMemory(); 744 return NULL;
745 return NULL;
746 }
747 p->kind = Module_kind; 745 p->kind = Module_kind;
748 p->v.Module.body = body; 746 p->v.Module.body = body;
749 return p; 747 return p;
750 } 748 }
751 749
752 mod_ty 750 mod_ty
753 Interactive(asdl_seq * body, PyArena *arena) 751 Interactive(asdl_seq * body, PyArena *arena)
754 { 752 {
755 mod_ty p; 753 mod_ty p;
756 p = (mod_ty)PyArena_Malloc(arena, sizeof(*p)); 754 p = (mod_ty)PyArena_Malloc(arena, sizeof(*p));
757 if (!p) { 755 if (!p)
758 PyErr_NoMemory(); 756 return NULL;
759 return NULL;
760 }
761 p->kind = Interactive_kind; 757 p->kind = Interactive_kind;
762 p->v.Interactive.body = body; 758 p->v.Interactive.body = body;
763 return p; 759 return p;
764 } 760 }
765 761
771 PyErr_SetString(PyExc_ValueError, 767 PyErr_SetString(PyExc_ValueError,
772 "field body is required for Expression"); 768 "field body is required for Expression");
773 return NULL; 769 return NULL;
774 } 770 }
775 p = (mod_ty)PyArena_Malloc(arena, sizeof(*p)); 771 p = (mod_ty)PyArena_Malloc(arena, sizeof(*p));
776 if (!p) { 772 if (!p)
777 PyErr_NoMemory(); 773 return NULL;
778 return NULL;
779 }
780 p->kind = Expression_kind; 774 p->kind = Expression_kind;
781 p->v.Expression.body = body; 775 p->v.Expression.body = body;
782 return p; 776 return p;
783 } 777 }
784 778
785 mod_ty 779 mod_ty
786 Suite(asdl_seq * body, PyArena *arena) 780 Suite(asdl_seq * body, PyArena *arena)
787 { 781 {
788 mod_ty p; 782 mod_ty p;
789 p = (mod_ty)PyArena_Malloc(arena, sizeof(*p)); 783 p = (mod_ty)PyArena_Malloc(arena, sizeof(*p));
790 if (!p) { 784 if (!p)
791 PyErr_NoMemory(); 785 return NULL;
792 return NULL;
793 }
794 p->kind = Suite_kind; 786 p->kind = Suite_kind;
795 p->v.Suite.body = body; 787 p->v.Suite.body = body;
796 return p; 788 return p;
797 } 789 }
798 790
810 PyErr_SetString(PyExc_ValueError, 802 PyErr_SetString(PyExc_ValueError,
811 "field args is required for FunctionDef"); 803 "field args is required for FunctionDef");
812 return NULL; 804 return NULL;
813 } 805 }
814 p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p)); 806 p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p));
815 if (!p) { 807 if (!p)
816 PyErr_NoMemory(); 808 return NULL;
817 return NULL;
818 }
819 p->kind = FunctionDef_kind; 809 p->kind = FunctionDef_kind;
820 p->v.FunctionDef.name = name; 810 p->v.FunctionDef.name = name;
821 p->v.FunctionDef.args = args; 811 p->v.FunctionDef.args = args;
822 p->v.FunctionDef.body = body; 812 p->v.FunctionDef.body = body;
823 p->v.FunctionDef.decorators = decorators; 813 p->v.FunctionDef.decorators = decorators;
835 PyErr_SetString(PyExc_ValueError, 825 PyErr_SetString(PyExc_ValueError,
836 "field name is required for ClassDef"); 826 "field name is required for ClassDef");
837 return NULL; 827 return NULL;
838 } 828 }
839 p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p)); 829 p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p));
840 if (!p) { 830 if (!p)
841 PyErr_NoMemory(); 831 return NULL;
842 return NULL;
843 }
844 p->kind = ClassDef_kind; 832 p->kind = ClassDef_kind;
845 p->v.ClassDef.name = name; 833 p->v.ClassDef.name = name;
846 p->v.ClassDef.bases = bases; 834 p->v.ClassDef.bases = bases;
847 p->v.ClassDef.body = body; 835 p->v.ClassDef.body = body;
848 p->lineno = lineno; 836 p->lineno = lineno;
853 stmt_ty 841 stmt_ty
854 Return(expr_ty value, int lineno, int col_offset, PyArena *arena) 842 Return(expr_ty value, int lineno, int col_offset, PyArena *arena)
855 { 843 {
856 stmt_ty p; 844 stmt_ty p;
857 p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p)); 845 p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p));
858 if (!p) { 846 if (!p)
859 PyErr_NoMemory(); 847 return NULL;
860 return NULL;
861 }
862 p->kind = Return_kind; 848 p->kind = Return_kind;
863 p->v.Return.value = value; 849 p->v.Return.value = value;
864 p->lineno = lineno; 850 p->lineno = lineno;
865 p->col_offset = col_offset; 851 p->col_offset = col_offset;
866 return p; 852 return p;
869 stmt_ty 855 stmt_ty
870 Delete(asdl_seq * targets, int lineno, int col_offset, PyArena *arena) 856 Delete(asdl_seq * targets, int lineno, int col_offset, PyArena *arena)
871 { 857 {
872 stmt_ty p; 858 stmt_ty p;
873 p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p)); 859 p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p));
874 if (!p) { 860 if (!p)
875 PyErr_NoMemory(); 861 return NULL;
876 return NULL;
877 }
878 p->kind = Delete_kind; 862 p->kind = Delete_kind;
879 p->v.Delete.targets = targets; 863 p->v.Delete.targets = targets;
880 p->lineno = lineno; 864 p->lineno = lineno;
881 p->col_offset = col_offset; 865 p->col_offset = col_offset;
882 return p; 866 return p;
891 PyErr_SetString(PyExc_ValueError, 875 PyErr_SetString(PyExc_ValueError,
892 "field value is required for Assign"); 876 "field value is required for Assign");
893 return NULL; 877 return NULL;
894 } 878 }
895 p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p)); 879 p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p));
896 if (!p) { 880 if (!p)
897 PyErr_NoMemory(); 881 return NULL;
898 return NULL;
899 }
900 p->kind = Assign_kind; 882 p->kind = Assign_kind;
901 p->v.Assign.targets = targets; 883 p->v.Assign.targets = targets;
902 p->v.Assign.value = value; 884 p->v.Assign.value = value;
903 p->lineno = lineno; 885 p->lineno = lineno;
904 p->col_offset = col_offset; 886 p->col_offset = col_offset;
924 PyErr_SetString(PyExc_ValueError, 906 PyErr_SetString(PyExc_ValueError,
925 "field value is required for AugAssign"); 907 "field value is required for AugAssign");
926 return NULL; 908 return NULL;
927 } 909 }
928 p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p)); 910 p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p));
929 if (!p) { 911 if (!p)
930 PyErr_NoMemory(); 912 return NULL;
931 return NULL;
932 }
933 p->kind = AugAssign_kind; 913 p->kind = AugAssign_kind;
934 p->v.AugAssign.target = target; 914 p->v.AugAssign.target = target;
935 p->v.AugAssign.op = op; 915 p->v.AugAssign.op = op;
936 p->v.AugAssign.value = value; 916 p->v.AugAssign.value = value;
937 p->lineno = lineno; 917 p->lineno = lineno;
943 Print(expr_ty dest, asdl_seq * values, bool nl, int lineno, int col_offset, 923 Print(expr_ty dest, asdl_seq * values, bool nl, int lineno, int col_offset,
944 PyArena *arena) 924 PyArena *arena)
945 { 925 {
946 stmt_ty p; 926 stmt_ty p;
947 p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p)); 927 p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p));
948 if (!p) { 928 if (!p)
949 PyErr_NoMemory(); 929 return NULL;
950 return NULL;
951 }
952 p->kind = Print_kind; 930 p->kind = Print_kind;
953 p->v.Print.dest = dest; 931 p->v.Print.dest = dest;
954 p->v.Print.values = values; 932 p->v.Print.values = values;
955 p->v.Print.nl = nl; 933 p->v.Print.nl = nl;
956 p->lineno = lineno; 934 p->lineno = lineno;
972 PyErr_SetString(PyExc_ValueError, 950 PyErr_SetString(PyExc_ValueError,
973 "field iter is required for For"); 951 "field iter is required for For");
974 return NULL; 952 return NULL;
975 } 953 }
976 p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p)); 954 p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p));
977 if (!p) { 955 if (!p)
978 PyErr_NoMemory(); 956 return NULL;
979 return NULL;
980 }
981 p->kind = For_kind; 957 p->kind = For_kind;
982 p->v.For.target = target; 958 p->v.For.target = target;
983 p->v.For.iter = iter; 959 p->v.For.iter = iter;
984 p->v.For.body = body; 960 p->v.For.body = body;
985 p->v.For.orelse = orelse; 961 p->v.For.orelse = orelse;
997 PyErr_SetString(PyExc_ValueError, 973 PyErr_SetString(PyExc_ValueError,
998 "field test is required for While"); 974 "field test is required for While");
999 return NULL; 975 return NULL;
1000 } 976 }
1001 p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p)); 977 p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p));
1002 if (!p) { 978 if (!p)
1003 PyErr_NoMemory(); 979 return NULL;
1004 return NULL;
1005 }
1006 p->kind = While_kind; 980 p->kind = While_kind;
1007 p->v.While.test = test; 981 p->v.While.test = test;
1008 p->v.While.body = body; 982 p->v.While.body = body;
1009 p->v.While.orelse = orelse; 983 p->v.While.orelse = orelse;
1010 p->lineno = lineno; 984 p->lineno = lineno;
1021 PyErr_SetString(PyExc_ValueError, 995 PyErr_SetString(PyExc_ValueError,
1022 "field test is required for If"); 996 "field test is required for If");
1023 return NULL; 997 return NULL;
1024 } 998 }
1025 p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p)); 999 p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p));
1026 if (!p) { 1000 if (!p)
1027 PyErr_NoMemory(); 1001 return NULL;
1028 return NULL;
1029 }
1030 p->kind = If_kind; 1002 p->kind = If_kind;
1031 p->v.If.test = test; 1003 p->v.If.test = test;
1032 p->v.If.body = body; 1004 p->v.If.body = body;
1033 p->v.If.orelse = orelse; 1005 p->v.If.orelse = orelse;
1034 p->lineno = lineno; 1006 p->lineno = lineno;
1045 PyErr_SetString(PyExc_ValueError, 1017 PyErr_SetString(PyExc_ValueError,
1046 "field context_expr is required for With"); 1018 "field context_expr is required for With");
1047 return NULL; 1019 return NULL;
1048 } 1020 }
1049 p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p)); 1021 p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p));
1050 if (!p) { 1022 if (!p)
1051 PyErr_NoMemory(); 1023 return NULL;
1052 return NULL;
1053 }
1054 p->kind = With_kind; 1024 p->kind = With_kind;
1055 p->v.With.context_expr = context_expr; 1025 p->v.With.context_expr = context_expr;
1056 p->v.With.optional_vars = optional_vars; 1026 p->v.With.optional_vars = optional_vars;
1057 p->v.With.body = body; 1027 p->v.With.body = body;
1058 p->lineno = lineno; 1028 p->lineno = lineno;
1064 Raise(expr_ty type, expr_ty inst, expr_ty tback, int lineno, int col_offset, 1034 Raise(expr_ty type, expr_ty inst, expr_ty tback, int lineno, int col_offset,
1065 PyArena *arena) 1035 PyArena *arena)
1066 { 1036 {
1067 stmt_ty p; 1037 stmt_ty p;
1068 p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p)); 1038 p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p));
1069 if (!p) { 1039 if (!p)
1070 PyErr_NoMemory(); 1040 return NULL;
1071 return NULL;
1072 }
1073 p->kind = Raise_kind; 1041 p->kind = Raise_kind;
1074 p->v.Raise.type = type; 1042 p->v.Raise.type = type;
1075 p->v.Raise.inst = inst; 1043 p->v.Raise.inst = inst;
1076 p->v.Raise.tback = tback; 1044 p->v.Raise.tback = tback;
1077 p->lineno = lineno; 1045 p->lineno = lineno;
1083 TryExcept(asdl_seq * body, asdl_seq * handlers, asdl_seq * orelse, int lineno, 1051 TryExcept(asdl_seq * body, asdl_seq * handlers, asdl_seq * orelse, int lineno,
1084 int col_offset, PyArena *arena) 1052 int col_offset, PyArena *arena)
1085 { 1053 {
1086 stmt_ty p; 1054 stmt_ty p;
1087 p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p)); 1055 p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p));
1088 if (!p) { 1056 if (!p)
1089 PyErr_NoMemory(); 1057 return NULL;
1090 return NULL;
1091 }
1092 p->kind = TryExcept_kind; 1058 p->kind = TryExcept_kind;
1093 p->v.TryExcept.body = body; 1059 p->v.TryExcept.body = body;
1094 p->v.TryExcept.handlers = handlers; 1060 p->v.TryExcept.handlers = handlers;
1095 p->v.TryExcept.orelse = orelse; 1061 p->v.TryExcept.orelse = orelse;
1096 p->lineno = lineno; 1062 p->lineno = lineno;
1102 TryFinally(asdl_seq * body, asdl_seq * finalbody, int lineno, int col_offset, 1068 TryFinally(asdl_seq * body, asdl_seq * finalbody, int lineno, int col_offset,
1103 PyArena *arena) 1069 PyArena *arena)
1104 { 1070 {
1105 stmt_ty p; 1071 stmt_ty p;
1106 p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p)); 1072 p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p));
1107 if (!p) { 1073 if (!p)
1108 PyErr_NoMemory(); 1074 return NULL;
1109 return NULL;
1110 }
1111 p->kind = TryFinally_kind; 1075 p->kind = TryFinally_kind;
1112 p->v.TryFinally.body = body; 1076 p->v.TryFinally.body = body;
1113 p->v.TryFinally.finalbody = finalbody; 1077 p->v.TryFinally.finalbody = finalbody;
1114 p->lineno = lineno; 1078 p->lineno = lineno;
1115 p->col_offset = col_offset; 1079 p->col_offset = col_offset;
1124 PyErr_SetString(PyExc_ValueError, 1088 PyErr_SetString(PyExc_ValueError,
1125 "field test is required for Assert"); 1089 "field test is required for Assert");
1126 return NULL; 1090 return NULL;
1127 } 1091 }
1128 p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p)); 1092 p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p));
1129 if (!p) { 1093 if (!p)
1130 PyErr_NoMemory(); 1094 return NULL;
1131 return NULL;
1132 }
1133 p->kind = Assert_kind; 1095 p->kind = Assert_kind;
1134 p->v.Assert.test = test; 1096 p->v.Assert.test = test;
1135 p->v.Assert.msg = msg; 1097 p->v.Assert.msg = msg;
1136 p->lineno = lineno; 1098 p->lineno = lineno;
1137 p->col_offset = col_offset; 1099 p->col_offset = col_offset;
1141 stmt_ty 1103 stmt_ty
1142 Import(asdl_seq * names, int lineno, int col_offset, PyArena *arena) 1104 Import(asdl_seq * names, int lineno, int col_offset, PyArena *arena)
1143 { 1105 {
1144 stmt_ty p; 1106 stmt_ty p;
1145 p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p)); 1107 p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p));
1146 if (!p) { 1108 if (!p)
1147 PyErr_NoMemory(); 1109 return NULL;
1148 return NULL;
1149 }
1150 p->kind = Import_kind; 1110 p->kind = Import_kind;
1151 p->v.Import.names = names; 1111 p->v.Import.names = names;
1152 p->lineno = lineno; 1112 p->lineno = lineno;
1153 p->col_offset = col_offset; 1113 p->col_offset = col_offset;
1154 return p; 1114 return p;
1163 PyErr_SetString(PyExc_ValueError, 1123 PyErr_SetString(PyExc_ValueError,
1164 "field module is required for ImportFrom"); 1124 "field module is required for ImportFrom");
1165 return NULL; 1125 return NULL;
1166 } 1126 }
1167 p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p)); 1127 p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p));
1168 if (!p) { 1128 if (!p)
1169 PyErr_NoMemory(); 1129 return NULL;
1170 return NULL;
1171 }
1172 p->kind = ImportFrom_kind; 1130 p->kind = ImportFrom_kind;
1173 p->v.ImportFrom.module = module; 1131 p->v.ImportFrom.module = module;
1174 p->v.ImportFrom.names = names; 1132 p->v.ImportFrom.names = names;
1175 p->v.ImportFrom.level = level; 1133 p->v.ImportFrom.level = level;
1176 p->lineno = lineno; 1134 p->lineno = lineno;
1187 PyErr_SetString(PyExc_ValueError, 1145 PyErr_SetString(PyExc_ValueError,
1188 "field body is required for Exec"); 1146 "field body is required for Exec");
1189 return NULL; 1147 return NULL;
1190 } 1148 }
1191 p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p)); 1149 p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p));
1192 if (!p) { 1150 if (!p)
1193 PyErr_NoMemory(); 1151 return NULL;
1194 return NULL;
1195 }
1196 p->kind = Exec_kind; 1152 p->kind = Exec_kind;
1197 p->v.Exec.body = body; 1153 p->v.Exec.body = body;
1198 p->v.Exec.globals = globals; 1154 p->v.Exec.globals = globals;
1199 p->v.Exec.locals = locals; 1155 p->v.Exec.locals = locals;
1200 p->lineno = lineno; 1156 p->lineno = lineno;
1205 stmt_ty 1161 stmt_ty
1206 Global(asdl_seq * names, int lineno, int col_offset, PyArena *arena) 1162 Global(asdl_seq * names, int lineno, int col_offset, PyArena *arena)
1207 { 1163 {
1208 stmt_ty p; 1164 stmt_ty p;
1209 p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p)); 1165 p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p));
1210 if (!p) { 1166 if (!p)
1211 PyErr_NoMemory(); 1167 return NULL;
1212 return NULL;
1213 }
1214 p->kind = Global_kind; 1168 p->kind = Global_kind;
1215 p->v.Global.names = names; 1169 p->v.Global.names = names;
1216 p->lineno = lineno; 1170 p->lineno = lineno;
1217 p->col_offset = col_offset; 1171 p->col_offset = col_offset;
1218 return p; 1172 return p;
1226 PyErr_SetString(PyExc_ValueError, 1180 PyErr_SetString(PyExc_ValueError,
1227 "field value is required for Expr"); 1181 "field value is required for Expr");
1228 return NULL; 1182 return NULL;
1229 } 1183 }
1230 p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p)); 1184 p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p));
1231 if (!p) { 1185 if (!p)
1232 PyErr_NoMemory(); 1186 return NULL;
1233 return NULL;
1234 }
1235 p->kind = Expr_kind; 1187 p->kind = Expr_kind;
1236 p->v.Expr.value = value; 1188 p->v.Expr.value = value;
1237 p->lineno = lineno; 1189 p->lineno = lineno;
1238 p->col_offset = col_offset; 1190 p->col_offset = col_offset;
1239 return p; 1191 return p;
1242 stmt_ty 1194 stmt_ty
1243 Pass(int lineno, int col_offset, PyArena *arena) 1195 Pass(int lineno, int col_offset, PyArena *arena)
1244 { 1196 {
1245 stmt_ty p; 1197 stmt_ty p;
1246 p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p)); 1198 p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p));
1247 if (!p) { 1199 if (!p)
1248 PyErr_NoMemory(); 1200 return NULL;
1249 return NULL;
1250 }
1251 p->kind = Pass_kind; 1201 p->kind = Pass_kind;
1252 p->lineno = lineno; 1202 p->lineno = lineno;
1253 p->col_offset = col_offset; 1203 p->col_offset = col_offset;
1254 return p; 1204 return p;
1255 } 1205 }
1257 stmt_ty 1207 stmt_ty
1258 Break(int lineno, int col_offset, PyArena *arena) 1208 Break(int lineno, int col_offset, PyArena *arena)
1259 { 1209 {
1260 stmt_ty p; 1210 stmt_ty p;
1261 p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p)); 1211 p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p));
1262 if (!p) { 1212 if (!p)
1263 PyErr_NoMemory(); 1213 return NULL;
1264 return NULL;
1265 }
1266 p->kind = Break_kind; 1214 p->kind = Break_kind;
1267 p->lineno = lineno; 1215 p->lineno = lineno;
1268 p->col_offset = col_offset; 1216 p->col_offset = col_offset;
1269 return p; 1217 return p;
1270 } 1218 }
1272 stmt_ty 1220 stmt_ty
1273 Continue(int lineno, int col_offset, PyArena *arena) 1221 Continue(int lineno, int col_offset, PyArena *arena)
1274 { 1222 {
1275 stmt_ty p; 1223 stmt_ty p;
1276 p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p)); 1224 p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p));
1277 if (!p) { 1225 if (!p)
1278 PyErr_NoMemory(); 1226 return NULL;
1279 return NULL;
1280 }
1281 p->kind = Continue_kind; 1227 p->kind = Continue_kind;
1282 p->lineno = lineno; 1228 p->lineno = lineno;
1283 p->col_offset = col_offset; 1229 p->col_offset = col_offset;
1284 return p; 1230 return p;
1285 } 1231 }
1293 PyErr_SetString(PyExc_ValueError, 1239 PyErr_SetString(PyExc_ValueError,
1294 "field op is required for BoolOp"); 1240 "field op is required for BoolOp");
1295 return NULL; 1241 return NULL;
1296 } 1242 }
1297 p = (expr_ty)PyArena_Malloc(arena, sizeof(*p)); 1243 p = (expr_ty)PyArena_Malloc(arena, sizeof(*p));
1298 if (!p) { 1244 if (!p)
1299 PyErr_NoMemory(); 1245 return NULL;
1300 return NULL;
1301 }
1302 p->kind = BoolOp_kind; 1246 p->kind = BoolOp_kind;
1303 p->v.BoolOp.op = op; 1247 p->v.BoolOp.op = op;
1304 p->v.BoolOp.values = values; 1248 p->v.BoolOp.values = values;
1305 p->lineno = lineno; 1249 p->lineno = lineno;
1306 p->col_offset = col_offset; 1250 p->col_offset = col_offset;
1326 PyErr_SetString(PyExc_ValueError, 1270 PyErr_SetString(PyExc_ValueError,
1327 "field right is required for BinOp"); 1271 "field right is required for BinOp");
1328 return NULL; 1272 return NULL;
1329 } 1273 }
1330 p = (expr_ty)PyArena_Malloc(arena, sizeof(*p)); 1274 p = (expr_ty)PyArena_Malloc(arena, sizeof(*p));
1331 if (!p) { 1275 if (!p)
1332 PyErr_NoMemory(); 1276 return NULL;
1333 return NULL;
1334 }
1335 p->kind = BinOp_kind; 1277 p->kind = BinOp_kind;
1336 p->v.BinOp.left = left; 1278 p->v.BinOp.left = left;
1337 p->v.BinOp.op = op; 1279 p->v.BinOp.op = op;
1338 p->v.BinOp.right = right; 1280 p->v.BinOp.right = right;
1339 p->lineno = lineno; 1281 p->lineno = lineno;
1355 PyErr_SetString(PyExc_ValueError, 1297 PyErr_SetString(PyExc_ValueError,
1356 "field operand is required for UnaryOp"); 1298 "field operand is required for UnaryOp");
1357 return NULL; 1299 return NULL;
1358 } 1300 }
1359 p = (expr_ty)PyArena_Malloc(arena, sizeof(*p)); 1301 p = (expr_ty)PyArena_Malloc(arena, sizeof(*p));
1360 if (!p) { 1302 if (!p)
1361 PyErr_NoMemory(); 1303 return NULL;
1362 return NULL;
1363 }
1364 p->kind = UnaryOp_kind; 1304 p->kind = UnaryOp_kind;
1365 p->v.UnaryOp.op = op; 1305 p->v.UnaryOp.op = op;
1366 p->v.UnaryOp.operand = operand; 1306 p->v.UnaryOp.operand = operand;
1367 p->lineno = lineno; 1307 p->lineno = lineno;
1368 p->col_offset = col_offset; 1308 p->col_offset = col_offset;
1383 PyErr_SetString(PyExc_ValueError, 1323 PyErr_SetString(PyExc_ValueError,
1384 "field body is required for Lambda"); 1324 "field body is required for Lambda");
1385 return NULL; 1325 return NULL;
1386 } 1326 }
1387 p = (expr_ty)PyArena_Malloc(arena, sizeof(*p)); 1327 p = (expr_ty)PyArena_Malloc(arena, sizeof(*p));
1388 if (!p) { 1328 if (!p)
1389 PyErr_NoMemory(); 1329 return NULL;
1390 return NULL;
1391 }
1392 p->kind = Lambda_kind; 1330 p->kind = Lambda_kind;
1393 p->v.Lambda.args = args; 1331 p->v.Lambda.args = args;
1394 p->v.Lambda.body = body; 1332 p->v.Lambda.body = body;
1395 p->lineno = lineno; 1333 p->lineno = lineno;
1396 p->col_offset = col_offset; 1334 p->col_offset = col_offset;
1416 PyErr_SetString(PyExc_ValueError, 1354 PyErr_SetString(PyExc_ValueError,
1417 "field orelse is required for IfExp"); 1355 "field orelse is required for IfExp");
1418 return NULL; 1356 return NULL;
1419 } 1357 }
1420 p = (expr_ty)PyArena_Malloc(arena, sizeof(*p)); 1358 p = (expr_ty)PyArena_Malloc(arena, sizeof(*p));
1421 if (!p) { 1359 if (!p)
1422 PyErr_NoMemory(); 1360 return NULL;
1423 return NULL;
1424 }
1425 p->kind = IfExp_kind; 1361 p->kind = IfExp_kind;
1426 p->v.IfExp.test = test; 1362 p->v.IfExp.test = test;
1427 p->v.IfExp.body = body; 1363 p->v.IfExp.body = body;
1428 p->v.IfExp.orelse = orelse; 1364 p->v.IfExp.orelse = orelse;
1429 p->lineno = lineno; 1365 p->lineno = lineno;
1435 Dict(asdl_seq * keys, asdl_seq * values, int lineno, int col_offset, PyArena 1371 Dict(asdl_seq * keys, asdl_seq * values, int lineno, int col_offset, PyArena
1436 *arena) 1372 *arena)
1437 { 1373 {
1438 expr_ty p; 1374 expr_ty p;
1439 p = (expr_ty)PyArena_Malloc(arena, sizeof(*p)); 1375 p = (expr_ty)PyArena_Malloc(arena, sizeof(*p));
1440 if (!p) { 1376 if (!p)
1441 PyErr_NoMemory(); 1377 return NULL;
1442 return NULL;
1443 }
1444 p->kind = Dict_kind; 1378 p->kind = Dict_kind;
1445 p->v.Dict.keys = keys; 1379 p->v.Dict.keys = keys;
1446 p->v.Dict.values = values; 1380 p->v.Dict.values = values;
1447 p->lineno = lineno; 1381 p->lineno = lineno;
1448 p->col_offset = col_offset; 1382 p->col_offset = col_offset;
1458 PyErr_SetString(PyExc_ValueError, 1392 PyErr_SetString(PyExc_ValueError,
1459 "field elt is required for ListComp"); 1393 "field elt is required for ListComp");
1460 return NULL; 1394 return NULL;
1461 } 1395 }
1462 p = (expr_ty)PyArena_Malloc(arena, sizeof(*p)); 1396 p = (expr_ty)PyArena_Malloc(arena, sizeof(*p));
1463 if (!p) { 1397 if (!p)
1464 PyErr_NoMemory(); 1398 return NULL;
1465 return NULL;
1466 }
1467 p->kind = ListComp_kind; 1399 p->kind = ListComp_kind;
1468 p->v.ListComp.elt = elt; 1400 p->v.ListComp.elt = elt;
1469 p->v.ListComp.generators = generators; 1401 p->v.ListComp.generators = generators;
1470 p->lineno = lineno; 1402 p->lineno = lineno;
1471 p->col_offset = col_offset; 1403 p->col_offset = col_offset;
1481 PyErr_SetString(PyExc_ValueError, 1413 PyErr_SetString(PyExc_ValueError,
1482 "field elt is required for GeneratorExp"); 1414 "field elt is required for GeneratorExp");
1483 return NULL; 1415 return NULL;
1484 } 1416 }
1485 p = (expr_ty)PyArena_Malloc(arena, sizeof(*p)); 1417 p = (expr_ty)PyArena_Malloc(arena, sizeof(*p));
1486 if (!p) { 1418 if (!p)
1487 PyErr_NoMemory(); 1419 return NULL;
1488 return NULL;
1489 }
1490 p->kind = GeneratorExp_kind; 1420 p->kind = GeneratorExp_kind;
1491 p->v.GeneratorExp.elt = elt; 1421 p->v.GeneratorExp.elt = elt;
1492 p->v.GeneratorExp.generators = generators; 1422 p->v.GeneratorExp.generators = generators;
1493 p->lineno = lineno; 1423 p->lineno = lineno;
1494 p->col_offset = col_offset; 1424 p->col_offset = col_offset;
1498 expr_ty 1428 expr_ty
1499 Yield(expr_ty value, int lineno, int col_offset, PyArena *arena) 1429 Yield(expr_ty value, int lineno, int col_offset, PyArena *arena)
1500 { 1430 {
1501 expr_ty p; 1431 expr_ty p;
1502 p = (expr_ty)PyArena_Malloc(arena, sizeof(*p)); 1432 p = (expr_ty)PyArena_Malloc(arena, sizeof(*p));
1503 if (!p) { 1433 if (!p)
1504 PyErr_NoMemory(); 1434 return NULL;
1505 return NULL;
1506 }
1507 p->kind = Yield_kind; 1435 p->kind = Yield_kind;
1508 p->v.Yield.value = value; 1436 p->v.Yield.value = value;
1509 p->lineno = lineno; 1437 p->lineno = lineno;
1510 p->col_offset = col_offset; 1438 p->col_offset = col_offset;
1511 return p; 1439 return p;
1520 PyErr_SetString(PyExc_ValueError, 1448 PyErr_SetString(PyExc_ValueError,
1521 "field left is required for Compare"); 1449 "field left is required for Compare");
1522 return NULL; 1450 return NULL;
1523 } 1451 }
1524 p = (expr_ty)PyArena_Malloc(arena, sizeof(*p)); 1452 p = (expr_ty)PyArena_Malloc(arena, sizeof(*p));
1525 if (!p) { 1453 if (!p)
1526 PyErr_NoMemory(); 1454 return NULL;
1527 return NULL;
1528 }
1529 p->kind = Compare_kind; 1455 p->kind = Compare_kind;
1530 p->v.Compare.left = left; 1456 p->v.Compare.left = left;
1531 p->v.Compare.ops = ops; 1457 p->v.Compare.ops = ops;
1532 p->v.Compare.comparators = comparators; 1458 p->v.Compare.comparators = comparators;
1533 p->lineno = lineno; 1459 p->lineno = lineno;
1544 PyErr_SetString(PyExc_ValueError, 1470 PyErr_SetString(PyExc_ValueError,
1545 "field func is required for Call"); 1471 "field func is required for Call");
1546 return NULL; 1472 return NULL;
1547 } 1473 }
1548 p = (expr_ty)PyArena_Malloc(arena, sizeof(*p)); 1474 p = (expr_ty)PyArena_Malloc(arena, sizeof(*p));
1549 if (!p) { 1475 if (!p)
1550 PyErr_NoMemory(); 1476 return NULL;
1551 return NULL;
1552 }
1553 p->kind = Call_kind; 1477 p->kind = Call_kind;
1554 p->v.Call.func = func; 1478 p->v.Call.func = func;
1555 p->v.Call.args = args; 1479 p->v.Call.args = args;
1556 p->v.Call.keywords = keywords; 1480 p->v.Call.keywords = keywords;
1557 p->v.Call.starargs = starargs; 1481 p->v.Call.starargs = starargs;
1569 PyErr_SetString(PyExc_ValueError, 1493 PyErr_SetString(PyExc_ValueError,
1570 "field value is required for Repr"); 1494 "field value is required for Repr");
1571 return NULL; 1495 return NULL;
1572 } 1496 }
1573 p = (expr_ty)PyArena_Malloc(arena, sizeof(*p)); 1497 p = (expr_ty)PyArena_Malloc(arena, sizeof(*p));
1574 if (!p) { 1498 if (!p)
1575 PyErr_NoMemory(); 1499 return NULL;
1576 return NULL;
1577 }
1578 p->kind = Repr_kind; 1500 p->kind = Repr_kind;
1579 p->v.Repr.value = value; 1501 p->v.Repr.value = value;
1580 p->lineno = lineno; 1502 p->lineno = lineno;
1581 p->col_offset = col_offset; 1503 p->col_offset = col_offset;
1582 return p; 1504 return p;
1590 PyErr_SetString(PyExc_ValueError, 1512 PyErr_SetString(PyExc_ValueError,
1591 "field n is required for Num"); 1513 "field n is required for Num");
1592 return NULL; 1514 return NULL;
1593 } 1515 }
1594 p = (expr_ty)PyArena_Malloc(arena, sizeof(*p)); 1516 p = (expr_ty)PyArena_Malloc(arena, sizeof(*p));
1595 if (!p) { 1517 if (!p)
1596 PyErr_NoMemory(); 1518 return NULL;
1597 return NULL;
1598 }
1599 p->kind = Num_kind; 1519 p->kind = Num_kind;
1600 p->v.Num.n = n; 1520 p->v.Num.n = n;
1601 p->lineno = lineno; 1521 p->lineno = lineno;
1602 p->col_offset = col_offset; 1522 p->col_offset = col_offset;
1603 return p; 1523 return p;
1611 PyErr_SetString(PyExc_ValueError, 1531 PyErr_SetString(PyExc_ValueError,
1612 "field s is required for Str"); 1532 "field s is required for Str");
1613 return NULL; 1533 return NULL;
1614 } 1534 }
1615 p = (expr_ty)PyArena_Malloc(arena, sizeof(*p)); 1535 p = (expr_ty)PyArena_Malloc(arena, sizeof(*p));
1616 if (!p) { 1536 if (!p)
1617 PyErr_NoMemory(); 1537 return NULL;
1618 return NULL;
1619 }
1620 p->kind = Str_kind; 1538 p->kind = Str_kind;
1621 p->v.Str.s = s; 1539 p->v.Str.s = s;
1622 p->lineno = lineno; 1540 p->lineno = lineno;
1623 p->col_offset = col_offset; 1541 p->col_offset = col_offset;
1624 return p; 1542 return p;
1643 PyErr_SetString(PyExc_ValueError, 1561 PyErr_SetString(PyExc_ValueError,
1644 "field ctx is required for Attribute"); 1562 "field ctx is required for Attribute");
1645 return NULL; 1563 return NULL;
1646 } 1564 }
1647 p = (expr_ty)PyArena_Malloc(arena, sizeof(*p)); 1565 p = (expr_ty)PyArena_Malloc(arena, sizeof(*p));
1648 if (!p) { 1566 if (!p)
1649 PyErr_NoMemory(); 1567 return NULL;
1650 return NULL;
1651 }
1652 p->kind = Attribute_kind; 1568 p->kind = Attribute_kind;
1653 p->v.Attribute.value = value; 1569 p->v.Attribute.value = value;
1654 p->v.Attribute.attr = attr; 1570 p->v.Attribute.attr = attr;
1655 p->v.Attribute.ctx = ctx; 1571 p->v.Attribute.ctx = ctx;
1656 p->lineno = lineno; 1572 p->lineno = lineno;
1677 PyErr_SetString(PyExc_ValueError, 1593 PyErr_SetString(PyExc_ValueError,
1678 "field ctx is required for Subscript"); 1594 "field ctx is required for Subscript");
1679 return NULL; 1595 return NULL;
1680 } 1596 }
1681 p = (expr_ty)PyArena_Malloc(arena, sizeof(*p)); 1597 p = (expr_ty)PyArena_Malloc(arena, sizeof(*p));
1682 if (!p) { 1598 if (!p)
1683 PyErr_NoMemory(); 1599 return NULL;
1684 return NULL;
1685 }
1686 p->kind = Subscript_kind; 1600 p->kind = Subscript_kind;
1687 p->v.Subscript.value = value; 1601 p->v.Subscript.value = value;
1688 p->v.Subscript.slice = slice; 1602 p->v.Subscript.slice = slice;
1689 p->v.Subscript.ctx = ctx; 1603 p->v.Subscript.ctx = ctx;
1690 p->lineno = lineno; 1604 p->lineno = lineno;
1706 PyErr_SetString(PyExc_ValueError, 1620 PyErr_SetString(PyExc_ValueError,
1707 "field ctx is required for Name"); 1621 "field ctx is required for Name");
1708 return NULL; 1622 return NULL;
1709 } 1623 }
1710 p = (expr_ty)PyArena_Malloc(arena, sizeof(*p)); 1624 p = (expr_ty)PyArena_Malloc(arena, sizeof(*p));
1711 if (!p) { 1625 if (!p)
1712 PyErr_NoMemory(); 1626 return NULL;
1713 return NULL;
1714 }
1715 p->kind = Name_kind; 1627 p->kind = Name_kind;
1716 p->v.Name.id = id; 1628 p->v.Name.id = id;
1717 p->v.Name.ctx = ctx; 1629 p->v.Name.ctx = ctx;
1718 p->lineno = lineno; 1630 p->lineno = lineno;
1719 p->col_offset = col_offset; 1631 p->col_offset = col_offset;
1729 PyErr_SetString(PyExc_ValueError, 1641 PyErr_SetString(PyExc_ValueError,
1730 "field ctx is required for List"); 1642 "field ctx is required for List");
1731 return NULL; 1643 return NULL;
1732 } 1644 }
1733 p = (expr_ty)PyArena_Malloc(arena, sizeof(*p)); 1645 p = (expr_ty)PyArena_Malloc(arena, sizeof(*p));
1734 if (!p) { 1646 if (!p)
1735 PyErr_NoMemory(); 1647 return NULL;
1736 return NULL;
1737 }
1738 p->kind = List_kind; 1648 p->kind = List_kind;
1739 p->v.List.elts = elts; 1649 p->v.List.elts = elts;
1740 p->v.List.ctx = ctx; 1650 p->v.List.ctx = ctx;
1741 p->lineno = lineno; 1651 p->lineno = lineno;
1742 p->col_offset = col_offset; 1652 p->col_offset = col_offset;
1752 PyErr_SetString(PyExc_ValueError, 1662 PyErr_SetString(PyExc_ValueError,
1753 "field ctx is required for Tuple"); 1663 "field ctx is required for Tuple");
1754 return NULL; 1664 return NULL;
1755 } 1665 }
1756 p = (expr_ty)PyArena_Malloc(arena, sizeof(*p)); 1666 p = (expr_ty)PyArena_Malloc(arena, sizeof(*p));
1757 if (!p) { 1667 if (!p)
1758 PyErr_NoMemory(); 1668 return NULL;
1759 return NULL;
1760 }
1761 p->kind = Tuple_kind; 1669 p->kind = Tuple_kind;
1762 p->v.Tuple.elts = elts; 1670 p->v.Tuple.elts = elts;
1763 p->v.Tuple.ctx = ctx; 1671 p->v.Tuple.ctx = ctx;
1764 p->lineno = lineno; 1672 p->lineno = lineno;
1765 p->col_offset = col_offset; 1673 p->col_offset = col_offset;
1769 slice_ty 1677 slice_ty
1770 Ellipsis(PyArena *arena) 1678 Ellipsis(PyArena *arena)
1771 { 1679 {
1772 slice_ty p; 1680 slice_ty p;
1773 p = (slice_ty)PyArena_Malloc(arena, sizeof(*p)); 1681 p = (slice_ty)PyArena_Malloc(arena, sizeof(*p));
1774 if (!p) { 1682 if (!p)
1775 PyErr_NoMemory(); 1683 return NULL;
1776 return NULL;
1777 }
1778 p->kind = Ellipsis_kind; 1684 p->kind = Ellipsis_kind;
1779 return p; 1685 return p;
1780 } 1686 }
1781 1687
1782 slice_ty 1688 slice_ty
1783 Slice(expr_ty lower, expr_ty upper, expr_ty step, PyArena *arena) 1689 Slice(expr_ty lower, expr_ty upper, expr_ty step, PyArena *arena)
1784 { 1690 {
1785 slice_ty p; 1691 slice_ty p;
1786 p = (slice_ty)PyArena_Malloc(arena, sizeof(*p)); 1692 p = (slice_ty)PyArena_Malloc(arena, sizeof(*p));
1787 if (!p) { 1693 if (!p)
1788 PyErr_NoMemory(); 1694 return NULL;
1789 return NULL;
1790 }
1791 p->kind = Slice_kind; 1695 p->kind = Slice_kind;
1792 p->v.Slice.lower = lower; 1696 p->v.Slice.lower = lower;
1793 p->v.Slice.upper = upper; 1697 p->v.Slice.upper = upper;
1794 p->v.Slice.step = step; 1698 p->v.Slice.step = step;
1795 return p; 1699 return p;
1798 slice_ty 1702 slice_ty
1799 ExtSlice(asdl_seq * dims, PyArena *arena) 1703 ExtSlice(asdl_seq * dims, PyArena *arena)
1800 { 1704 {
1801 slice_ty p; 1705 slice_ty p;
1802 p = (slice_ty)PyArena_Malloc(arena, sizeof(*p)); 1706 p = (slice_ty)PyArena_Malloc(arena, sizeof(*p));
1803 if (!p) { 1707 if (!p)
1804 PyErr_NoMemory(); 1708 return NULL;
1805 return NULL;
1806 }
1807 p->kind = ExtSlice_kind; 1709 p->kind = ExtSlice_kind;
1808 p->v.ExtSlice.dims = dims; 1710 p->v.ExtSlice.dims = dims;
1809 return p; 1711 return p;
1810 } 1712 }
1811 1713
1817 PyErr_SetString(PyExc_ValueError, 1719 PyErr_SetString(PyExc_ValueError,
1818 "field value is required for Index"); 1720 "field value is required for Index");
1819 return NULL; 1721 return NULL;
1820 } 1722 }
1821 p = (slice_ty)PyArena_Malloc(arena, sizeof(*p)); 1723 p = (slice_ty)PyArena_Malloc(arena, sizeof(*p));
1822 if (!p) { 1724 if (!p)
1823 PyErr_NoMemory(); 1725 return NULL;
1824 return NULL;
1825 }
1826 p->kind = Index_kind; 1726 p->kind = Index_kind;
1827 p->v.Index.value = value; 1727 p->v.Index.value = value;
1828 return p; 1728 return p;
1829 } 1729 }
1830 1730
1841 PyErr_SetString(PyExc_ValueError, 1741 PyErr_SetString(PyExc_ValueError,
1842 "field iter is required for comprehension"); 1742 "field iter is required for comprehension");
1843 return NULL; 1743 return NULL;
1844 } 1744 }
1845 p = (comprehension_ty)PyArena_Malloc(arena, sizeof(*p)); 1745 p = (comprehension_ty)PyArena_Malloc(arena, sizeof(*p));
1846 if (!p) { 1746 if (!p)
1847 PyErr_NoMemory(); 1747 return NULL;
1848 return NULL;
1849 }
1850 p->target = target; 1748 p->target = target;
1851 p->iter = iter; 1749 p->iter = iter;
1852 p->ifs = ifs; 1750 p->ifs = ifs;
1853 return p; 1751 return p;
1854 } 1752 }
1857 excepthandler(expr_ty type, expr_ty name, asdl_seq * body, int lineno, int 1755 excepthandler(expr_ty type, expr_ty name, asdl_seq * body, int lineno, int
1858 col_offset, PyArena *arena) 1756 col_offset, PyArena *arena)
1859 { 1757 {
1860 excepthandler_ty p; 1758 excepthandler_ty p;
1861 p = (excepthandler_ty)PyArena_Malloc(arena, sizeof(*p)); 1759 p = (excepthandler_ty)PyArena_Malloc(arena, sizeof(*p));
1862 if (!p) { 1760 if (!p)
1863 PyErr_NoMemory(); 1761 return NULL;
1864 return NULL;
1865 }
1866 p->type = type; 1762 p->type = type;
1867 p->name = name; 1763 p->name = name;
1868 p->body = body; 1764 p->body = body;
1869 p->lineno = lineno; 1765 p->lineno = lineno;
1870 p->col_offset = col_offset; 1766 p->col_offset = col_offset;
1875 arguments(asdl_seq * args, identifier vararg, identifier kwarg, asdl_seq * 1771 arguments(asdl_seq * args, identifier vararg, identifier kwarg, asdl_seq *
1876 defaults, PyArena *arena) 1772 defaults, PyArena *arena)
1877 { 1773 {
1878 arguments_ty p; 1774 arguments_ty p;
1879 p = (arguments_ty)PyArena_Malloc(arena, sizeof(*p)); 1775 p = (arguments_ty)PyArena_Malloc(arena, sizeof(*p));
1880 if (!p) { 1776 if (!p)
1881 PyErr_NoMemory(); 1777 return NULL;
1882 return NULL;
1883 }
1884 p->args = args; 1778 p->args = args;
1885 p->vararg = vararg; 1779 p->vararg = vararg;
1886 p->kwarg = kwarg; 1780 p->kwarg = kwarg;
1887 p->defaults = defaults; 1781 p->defaults = defaults;
1888 return p; 1782 return p;
1901 PyErr_SetString(PyExc_ValueError, 1795 PyErr_SetString(PyExc_ValueError,
1902 "field value is required for keyword"); 1796 "field value is required for keyword");
1903 return NULL; 1797 return NULL;
1904 } 1798 }
1905 p = (keyword_ty)PyArena_Malloc(arena, sizeof(*p)); 1799 p = (keyword_ty)PyArena_Malloc(arena, sizeof(*p));
1906 if (!p) { 1800 if (!p)
1907 PyErr_NoMemory(); 1801 return NULL;
1908 return NULL;
1909 }
1910 p->arg = arg; 1802 p->arg = arg;
1911 p->value = value; 1803 p->value = value;
1912 return p; 1804 return p;
1913 } 1805 }
1914 1806
1920 PyErr_SetString(PyExc_ValueError, 1812 PyErr_SetString(PyExc_ValueError,
1921 "field name is required for alias"); 1813 "field name is required for alias");
1922 return NULL; 1814 return NULL;
1923 } 1815 }
1924 p = (alias_ty)PyArena_Malloc(arena, sizeof(*p)); 1816 p = (alias_ty)PyArena_Malloc(arena, sizeof(*p));
1925 if (!p) { 1817 if (!p)
1926 PyErr_NoMemory(); 1818 return NULL;
1927 return NULL;
1928 }
1929 p->name = name; 1819 p->name = name;
1930 p->asname = asname; 1820 p->asname = asname;
1931 return p; 1821 return p;
1932 } 1822 }
1933 1823