Mercurial > cpython-lru_cache-weakref
comparison Python/Python-ast.c @ 72848:81380082d216
Use identifier API for PyObject_GetAttrString.
| author | Martin v. Löwis <martin@v.loewis.de> |
|---|---|
| date | Mon, 10 Oct 2011 18:11:30 +0200 |
| parents | 321b8372eef6 |
| children | 7109f31300fb |
comparison
equal
deleted
inserted
replaced
| 72847:f924e0f62bcb | 72848:81380082d216 |
|---|---|
| 5 | 5 |
| 6 static PyTypeObject AST_type; | 6 static PyTypeObject AST_type; |
| 7 static PyTypeObject *mod_type; | 7 static PyTypeObject *mod_type; |
| 8 static PyObject* ast2obj_mod(void*); | 8 static PyObject* ast2obj_mod(void*); |
| 9 static PyTypeObject *Module_type; | 9 static PyTypeObject *Module_type; |
| 10 _Py_identifier(body); | |
| 10 static char *Module_fields[]={ | 11 static char *Module_fields[]={ |
| 11 "body", | 12 "body", |
| 12 }; | 13 }; |
| 13 static PyTypeObject *Interactive_type; | 14 static PyTypeObject *Interactive_type; |
| 14 static char *Interactive_fields[]={ | 15 static char *Interactive_fields[]={ |
| 21 static PyTypeObject *Suite_type; | 22 static PyTypeObject *Suite_type; |
| 22 static char *Suite_fields[]={ | 23 static char *Suite_fields[]={ |
| 23 "body", | 24 "body", |
| 24 }; | 25 }; |
| 25 static PyTypeObject *stmt_type; | 26 static PyTypeObject *stmt_type; |
| 27 _Py_identifier(lineno); | |
| 28 _Py_identifier(col_offset); | |
| 26 static char *stmt_attributes[] = { | 29 static char *stmt_attributes[] = { |
| 27 "lineno", | 30 "lineno", |
| 28 "col_offset", | 31 "col_offset", |
| 29 }; | 32 }; |
| 30 static PyObject* ast2obj_stmt(void*); | 33 static PyObject* ast2obj_stmt(void*); |
| 31 static PyTypeObject *FunctionDef_type; | 34 static PyTypeObject *FunctionDef_type; |
| 35 _Py_identifier(name); | |
| 36 _Py_identifier(args); | |
| 37 _Py_identifier(decorator_list); | |
| 38 _Py_identifier(returns); | |
| 32 static char *FunctionDef_fields[]={ | 39 static char *FunctionDef_fields[]={ |
| 33 "name", | 40 "name", |
| 34 "args", | 41 "args", |
| 35 "body", | 42 "body", |
| 36 "decorator_list", | 43 "decorator_list", |
| 37 "returns", | 44 "returns", |
| 38 }; | 45 }; |
| 39 static PyTypeObject *ClassDef_type; | 46 static PyTypeObject *ClassDef_type; |
| 47 _Py_identifier(bases); | |
| 48 _Py_identifier(keywords); | |
| 49 _Py_identifier(starargs); | |
| 50 _Py_identifier(kwargs); | |
| 40 static char *ClassDef_fields[]={ | 51 static char *ClassDef_fields[]={ |
| 41 "name", | 52 "name", |
| 42 "bases", | 53 "bases", |
| 43 "keywords", | 54 "keywords", |
| 44 "starargs", | 55 "starargs", |
| 45 "kwargs", | 56 "kwargs", |
| 46 "body", | 57 "body", |
| 47 "decorator_list", | 58 "decorator_list", |
| 48 }; | 59 }; |
| 49 static PyTypeObject *Return_type; | 60 static PyTypeObject *Return_type; |
| 61 _Py_identifier(value); | |
| 50 static char *Return_fields[]={ | 62 static char *Return_fields[]={ |
| 51 "value", | 63 "value", |
| 52 }; | 64 }; |
| 53 static PyTypeObject *Delete_type; | 65 static PyTypeObject *Delete_type; |
| 66 _Py_identifier(targets); | |
| 54 static char *Delete_fields[]={ | 67 static char *Delete_fields[]={ |
| 55 "targets", | 68 "targets", |
| 56 }; | 69 }; |
| 57 static PyTypeObject *Assign_type; | 70 static PyTypeObject *Assign_type; |
| 58 static char *Assign_fields[]={ | 71 static char *Assign_fields[]={ |
| 59 "targets", | 72 "targets", |
| 60 "value", | 73 "value", |
| 61 }; | 74 }; |
| 62 static PyTypeObject *AugAssign_type; | 75 static PyTypeObject *AugAssign_type; |
| 76 _Py_identifier(target); | |
| 77 _Py_identifier(op); | |
| 63 static char *AugAssign_fields[]={ | 78 static char *AugAssign_fields[]={ |
| 64 "target", | 79 "target", |
| 65 "op", | 80 "op", |
| 66 "value", | 81 "value", |
| 67 }; | 82 }; |
| 68 static PyTypeObject *For_type; | 83 static PyTypeObject *For_type; |
| 84 _Py_identifier(iter); | |
| 85 _Py_identifier(orelse); | |
| 69 static char *For_fields[]={ | 86 static char *For_fields[]={ |
| 70 "target", | 87 "target", |
| 71 "iter", | 88 "iter", |
| 72 "body", | 89 "body", |
| 73 "orelse", | 90 "orelse", |
| 74 }; | 91 }; |
| 75 static PyTypeObject *While_type; | 92 static PyTypeObject *While_type; |
| 93 _Py_identifier(test); | |
| 76 static char *While_fields[]={ | 94 static char *While_fields[]={ |
| 77 "test", | 95 "test", |
| 78 "body", | 96 "body", |
| 79 "orelse", | 97 "orelse", |
| 80 }; | 98 }; |
| 83 "test", | 101 "test", |
| 84 "body", | 102 "body", |
| 85 "orelse", | 103 "orelse", |
| 86 }; | 104 }; |
| 87 static PyTypeObject *With_type; | 105 static PyTypeObject *With_type; |
| 106 _Py_identifier(items); | |
| 88 static char *With_fields[]={ | 107 static char *With_fields[]={ |
| 89 "items", | 108 "items", |
| 90 "body", | 109 "body", |
| 91 }; | 110 }; |
| 92 static PyTypeObject *Raise_type; | 111 static PyTypeObject *Raise_type; |
| 112 _Py_identifier(exc); | |
| 113 _Py_identifier(cause); | |
| 93 static char *Raise_fields[]={ | 114 static char *Raise_fields[]={ |
| 94 "exc", | 115 "exc", |
| 95 "cause", | 116 "cause", |
| 96 }; | 117 }; |
| 97 static PyTypeObject *Try_type; | 118 static PyTypeObject *Try_type; |
| 119 _Py_identifier(handlers); | |
| 120 _Py_identifier(finalbody); | |
| 98 static char *Try_fields[]={ | 121 static char *Try_fields[]={ |
| 99 "body", | 122 "body", |
| 100 "handlers", | 123 "handlers", |
| 101 "orelse", | 124 "orelse", |
| 102 "finalbody", | 125 "finalbody", |
| 103 }; | 126 }; |
| 104 static PyTypeObject *Assert_type; | 127 static PyTypeObject *Assert_type; |
| 128 _Py_identifier(msg); | |
| 105 static char *Assert_fields[]={ | 129 static char *Assert_fields[]={ |
| 106 "test", | 130 "test", |
| 107 "msg", | 131 "msg", |
| 108 }; | 132 }; |
| 109 static PyTypeObject *Import_type; | 133 static PyTypeObject *Import_type; |
| 134 _Py_identifier(names); | |
| 110 static char *Import_fields[]={ | 135 static char *Import_fields[]={ |
| 111 "names", | 136 "names", |
| 112 }; | 137 }; |
| 113 static PyTypeObject *ImportFrom_type; | 138 static PyTypeObject *ImportFrom_type; |
| 139 _Py_identifier(module); | |
| 140 _Py_identifier(level); | |
| 114 static char *ImportFrom_fields[]={ | 141 static char *ImportFrom_fields[]={ |
| 115 "module", | 142 "module", |
| 116 "names", | 143 "names", |
| 117 "level", | 144 "level", |
| 118 }; | 145 }; |
| 136 "lineno", | 163 "lineno", |
| 137 "col_offset", | 164 "col_offset", |
| 138 }; | 165 }; |
| 139 static PyObject* ast2obj_expr(void*); | 166 static PyObject* ast2obj_expr(void*); |
| 140 static PyTypeObject *BoolOp_type; | 167 static PyTypeObject *BoolOp_type; |
| 168 _Py_identifier(values); | |
| 141 static char *BoolOp_fields[]={ | 169 static char *BoolOp_fields[]={ |
| 142 "op", | 170 "op", |
| 143 "values", | 171 "values", |
| 144 }; | 172 }; |
| 145 static PyTypeObject *BinOp_type; | 173 static PyTypeObject *BinOp_type; |
| 174 _Py_identifier(left); | |
| 175 _Py_identifier(right); | |
| 146 static char *BinOp_fields[]={ | 176 static char *BinOp_fields[]={ |
| 147 "left", | 177 "left", |
| 148 "op", | 178 "op", |
| 149 "right", | 179 "right", |
| 150 }; | 180 }; |
| 151 static PyTypeObject *UnaryOp_type; | 181 static PyTypeObject *UnaryOp_type; |
| 182 _Py_identifier(operand); | |
| 152 static char *UnaryOp_fields[]={ | 183 static char *UnaryOp_fields[]={ |
| 153 "op", | 184 "op", |
| 154 "operand", | 185 "operand", |
| 155 }; | 186 }; |
| 156 static PyTypeObject *Lambda_type; | 187 static PyTypeObject *Lambda_type; |
| 163 "test", | 194 "test", |
| 164 "body", | 195 "body", |
| 165 "orelse", | 196 "orelse", |
| 166 }; | 197 }; |
| 167 static PyTypeObject *Dict_type; | 198 static PyTypeObject *Dict_type; |
| 199 _Py_identifier(keys); | |
| 168 static char *Dict_fields[]={ | 200 static char *Dict_fields[]={ |
| 169 "keys", | 201 "keys", |
| 170 "values", | 202 "values", |
| 171 }; | 203 }; |
| 172 static PyTypeObject *Set_type; | 204 static PyTypeObject *Set_type; |
| 205 _Py_identifier(elts); | |
| 173 static char *Set_fields[]={ | 206 static char *Set_fields[]={ |
| 174 "elts", | 207 "elts", |
| 175 }; | 208 }; |
| 176 static PyTypeObject *ListComp_type; | 209 static PyTypeObject *ListComp_type; |
| 210 _Py_identifier(elt); | |
| 211 _Py_identifier(generators); | |
| 177 static char *ListComp_fields[]={ | 212 static char *ListComp_fields[]={ |
| 178 "elt", | 213 "elt", |
| 179 "generators", | 214 "generators", |
| 180 }; | 215 }; |
| 181 static PyTypeObject *SetComp_type; | 216 static PyTypeObject *SetComp_type; |
| 182 static char *SetComp_fields[]={ | 217 static char *SetComp_fields[]={ |
| 183 "elt", | 218 "elt", |
| 184 "generators", | 219 "generators", |
| 185 }; | 220 }; |
| 186 static PyTypeObject *DictComp_type; | 221 static PyTypeObject *DictComp_type; |
| 222 _Py_identifier(key); | |
| 187 static char *DictComp_fields[]={ | 223 static char *DictComp_fields[]={ |
| 188 "key", | 224 "key", |
| 189 "value", | 225 "value", |
| 190 "generators", | 226 "generators", |
| 191 }; | 227 }; |
| 197 static PyTypeObject *Yield_type; | 233 static PyTypeObject *Yield_type; |
| 198 static char *Yield_fields[]={ | 234 static char *Yield_fields[]={ |
| 199 "value", | 235 "value", |
| 200 }; | 236 }; |
| 201 static PyTypeObject *Compare_type; | 237 static PyTypeObject *Compare_type; |
| 238 _Py_identifier(ops); | |
| 239 _Py_identifier(comparators); | |
| 202 static char *Compare_fields[]={ | 240 static char *Compare_fields[]={ |
| 203 "left", | 241 "left", |
| 204 "ops", | 242 "ops", |
| 205 "comparators", | 243 "comparators", |
| 206 }; | 244 }; |
| 207 static PyTypeObject *Call_type; | 245 static PyTypeObject *Call_type; |
| 246 _Py_identifier(func); | |
| 208 static char *Call_fields[]={ | 247 static char *Call_fields[]={ |
| 209 "func", | 248 "func", |
| 210 "args", | 249 "args", |
| 211 "keywords", | 250 "keywords", |
| 212 "starargs", | 251 "starargs", |
| 213 "kwargs", | 252 "kwargs", |
| 214 }; | 253 }; |
| 215 static PyTypeObject *Num_type; | 254 static PyTypeObject *Num_type; |
| 255 _Py_identifier(n); | |
| 216 static char *Num_fields[]={ | 256 static char *Num_fields[]={ |
| 217 "n", | 257 "n", |
| 218 }; | 258 }; |
| 219 static PyTypeObject *Str_type; | 259 static PyTypeObject *Str_type; |
| 260 _Py_identifier(s); | |
| 220 static char *Str_fields[]={ | 261 static char *Str_fields[]={ |
| 221 "s", | 262 "s", |
| 222 }; | 263 }; |
| 223 static PyTypeObject *Bytes_type; | 264 static PyTypeObject *Bytes_type; |
| 224 static char *Bytes_fields[]={ | 265 static char *Bytes_fields[]={ |
| 225 "s", | 266 "s", |
| 226 }; | 267 }; |
| 227 static PyTypeObject *Ellipsis_type; | 268 static PyTypeObject *Ellipsis_type; |
| 228 static PyTypeObject *Attribute_type; | 269 static PyTypeObject *Attribute_type; |
| 270 _Py_identifier(attr); | |
| 271 _Py_identifier(ctx); | |
| 229 static char *Attribute_fields[]={ | 272 static char *Attribute_fields[]={ |
| 230 "value", | 273 "value", |
| 231 "attr", | 274 "attr", |
| 232 "ctx", | 275 "ctx", |
| 233 }; | 276 }; |
| 234 static PyTypeObject *Subscript_type; | 277 static PyTypeObject *Subscript_type; |
| 278 _Py_identifier(slice); | |
| 235 static char *Subscript_fields[]={ | 279 static char *Subscript_fields[]={ |
| 236 "value", | 280 "value", |
| 237 "slice", | 281 "slice", |
| 238 "ctx", | 282 "ctx", |
| 239 }; | 283 }; |
| 241 static char *Starred_fields[]={ | 285 static char *Starred_fields[]={ |
| 242 "value", | 286 "value", |
| 243 "ctx", | 287 "ctx", |
| 244 }; | 288 }; |
| 245 static PyTypeObject *Name_type; | 289 static PyTypeObject *Name_type; |
| 290 _Py_identifier(id); | |
| 246 static char *Name_fields[]={ | 291 static char *Name_fields[]={ |
| 247 "id", | 292 "id", |
| 248 "ctx", | 293 "ctx", |
| 249 }; | 294 }; |
| 250 static PyTypeObject *List_type; | 295 static PyTypeObject *List_type; |
| 268 static PyTypeObject *AugStore_type; | 313 static PyTypeObject *AugStore_type; |
| 269 static PyTypeObject *Param_type; | 314 static PyTypeObject *Param_type; |
| 270 static PyTypeObject *slice_type; | 315 static PyTypeObject *slice_type; |
| 271 static PyObject* ast2obj_slice(void*); | 316 static PyObject* ast2obj_slice(void*); |
| 272 static PyTypeObject *Slice_type; | 317 static PyTypeObject *Slice_type; |
| 318 _Py_identifier(lower); | |
| 319 _Py_identifier(upper); | |
| 320 _Py_identifier(step); | |
| 273 static char *Slice_fields[]={ | 321 static char *Slice_fields[]={ |
| 274 "lower", | 322 "lower", |
| 275 "upper", | 323 "upper", |
| 276 "step", | 324 "step", |
| 277 }; | 325 }; |
| 278 static PyTypeObject *ExtSlice_type; | 326 static PyTypeObject *ExtSlice_type; |
| 327 _Py_identifier(dims); | |
| 279 static char *ExtSlice_fields[]={ | 328 static char *ExtSlice_fields[]={ |
| 280 "dims", | 329 "dims", |
| 281 }; | 330 }; |
| 282 static PyTypeObject *Index_type; | 331 static PyTypeObject *Index_type; |
| 283 static char *Index_fields[]={ | 332 static char *Index_fields[]={ |
| 329 static PyTypeObject *IsNot_type; | 378 static PyTypeObject *IsNot_type; |
| 330 static PyTypeObject *In_type; | 379 static PyTypeObject *In_type; |
| 331 static PyTypeObject *NotIn_type; | 380 static PyTypeObject *NotIn_type; |
| 332 static PyTypeObject *comprehension_type; | 381 static PyTypeObject *comprehension_type; |
| 333 static PyObject* ast2obj_comprehension(void*); | 382 static PyObject* ast2obj_comprehension(void*); |
| 383 _Py_identifier(ifs); | |
| 334 static char *comprehension_fields[]={ | 384 static char *comprehension_fields[]={ |
| 335 "target", | 385 "target", |
| 336 "iter", | 386 "iter", |
| 337 "ifs", | 387 "ifs", |
| 338 }; | 388 }; |
| 341 "lineno", | 391 "lineno", |
| 342 "col_offset", | 392 "col_offset", |
| 343 }; | 393 }; |
| 344 static PyObject* ast2obj_excepthandler(void*); | 394 static PyObject* ast2obj_excepthandler(void*); |
| 345 static PyTypeObject *ExceptHandler_type; | 395 static PyTypeObject *ExceptHandler_type; |
| 396 _Py_identifier(type); | |
| 346 static char *ExceptHandler_fields[]={ | 397 static char *ExceptHandler_fields[]={ |
| 347 "type", | 398 "type", |
| 348 "name", | 399 "name", |
| 349 "body", | 400 "body", |
| 350 }; | 401 }; |
| 351 static PyTypeObject *arguments_type; | 402 static PyTypeObject *arguments_type; |
| 352 static PyObject* ast2obj_arguments(void*); | 403 static PyObject* ast2obj_arguments(void*); |
| 404 _Py_identifier(vararg); | |
| 405 _Py_identifier(varargannotation); | |
| 406 _Py_identifier(kwonlyargs); | |
| 407 _Py_identifier(kwarg); | |
| 408 _Py_identifier(kwargannotation); | |
| 409 _Py_identifier(defaults); | |
| 410 _Py_identifier(kw_defaults); | |
| 353 static char *arguments_fields[]={ | 411 static char *arguments_fields[]={ |
| 354 "args", | 412 "args", |
| 355 "vararg", | 413 "vararg", |
| 356 "varargannotation", | 414 "varargannotation", |
| 357 "kwonlyargs", | 415 "kwonlyargs", |
| 360 "defaults", | 418 "defaults", |
| 361 "kw_defaults", | 419 "kw_defaults", |
| 362 }; | 420 }; |
| 363 static PyTypeObject *arg_type; | 421 static PyTypeObject *arg_type; |
| 364 static PyObject* ast2obj_arg(void*); | 422 static PyObject* ast2obj_arg(void*); |
| 423 _Py_identifier(arg); | |
| 424 _Py_identifier(annotation); | |
| 365 static char *arg_fields[]={ | 425 static char *arg_fields[]={ |
| 366 "arg", | 426 "arg", |
| 367 "annotation", | 427 "annotation", |
| 368 }; | 428 }; |
| 369 static PyTypeObject *keyword_type; | 429 static PyTypeObject *keyword_type; |
| 372 "arg", | 432 "arg", |
| 373 "value", | 433 "value", |
| 374 }; | 434 }; |
| 375 static PyTypeObject *alias_type; | 435 static PyTypeObject *alias_type; |
| 376 static PyObject* ast2obj_alias(void*); | 436 static PyObject* ast2obj_alias(void*); |
| 437 _Py_identifier(asname); | |
| 377 static char *alias_fields[]={ | 438 static char *alias_fields[]={ |
| 378 "name", | 439 "name", |
| 379 "asname", | 440 "asname", |
| 380 }; | 441 }; |
| 381 static PyTypeObject *withitem_type; | 442 static PyTypeObject *withitem_type; |
| 382 static PyObject* ast2obj_withitem(void*); | 443 static PyObject* ast2obj_withitem(void*); |
| 444 _Py_identifier(context_expr); | |
| 445 _Py_identifier(optional_vars); | |
| 383 static char *withitem_fields[]={ | 446 static char *withitem_fields[]={ |
| 384 "context_expr", | 447 "context_expr", |
| 385 "optional_vars", | 448 "optional_vars", |
| 386 }; | 449 }; |
| 387 | 450 |
| 388 | 451 |
| 389 static int | 452 static int |
| 390 ast_type_init(PyObject *self, PyObject *args, PyObject *kw) | 453 ast_type_init(PyObject *self, PyObject *args, PyObject *kw) |
| 391 { | 454 { |
| 455 _Py_identifier(_fields); | |
| 392 Py_ssize_t i, numfields = 0; | 456 Py_ssize_t i, numfields = 0; |
| 393 int res = -1; | 457 int res = -1; |
| 394 PyObject *key, *value, *fields; | 458 PyObject *key, *value, *fields; |
| 395 fields = PyObject_GetAttrString((PyObject*)Py_TYPE(self), "_fields"); | 459 fields = _PyObject_GetAttrId((PyObject*)Py_TYPE(self), &PyId__fields); |
| 396 if (!fields) | 460 if (!fields) |
| 397 PyErr_Clear(); | 461 PyErr_Clear(); |
| 398 if (fields) { | 462 if (fields) { |
| 399 numfields = PySequence_Size(fields); | 463 numfields = PySequence_Size(fields); |
| 400 if (numfields == -1) | 464 if (numfields == -1) |
| 440 /* Pickling support */ | 504 /* Pickling support */ |
| 441 static PyObject * | 505 static PyObject * |
| 442 ast_type_reduce(PyObject *self, PyObject *unused) | 506 ast_type_reduce(PyObject *self, PyObject *unused) |
| 443 { | 507 { |
| 444 PyObject *res; | 508 PyObject *res; |
| 445 PyObject *dict = PyObject_GetAttrString(self, "__dict__"); | 509 _Py_identifier(__dict__); |
| 510 PyObject *dict = _PyObject_GetAttrId(self, &PyId___dict__); | |
| 446 if (dict == NULL) { | 511 if (dict == NULL) { |
| 447 if (PyErr_ExceptionMatches(PyExc_AttributeError)) | 512 if (PyErr_ExceptionMatches(PyExc_AttributeError)) |
| 448 PyErr_Clear(); | 513 PyErr_Clear(); |
| 449 else | 514 else |
| 450 return NULL; | 515 return NULL; |
| 3413 return 1; | 3478 return 1; |
| 3414 } | 3479 } |
| 3415 if (isinstance) { | 3480 if (isinstance) { |
| 3416 asdl_seq* body; | 3481 asdl_seq* body; |
| 3417 | 3482 |
| 3418 if (PyObject_HasAttrString(obj, "body")) { | 3483 if (_PyObject_HasAttrId(obj, &PyId_body)) { |
| 3419 int res; | 3484 int res; |
| 3420 Py_ssize_t len; | 3485 Py_ssize_t len; |
| 3421 Py_ssize_t i; | 3486 Py_ssize_t i; |
| 3422 tmp = PyObject_GetAttrString(obj, "body"); | 3487 tmp = _PyObject_GetAttrId(obj, &PyId_body); |
| 3423 if (tmp == NULL) goto failed; | 3488 if (tmp == NULL) goto failed; |
| 3424 if (!PyList_Check(tmp)) { | 3489 if (!PyList_Check(tmp)) { |
| 3425 PyErr_Format(PyExc_TypeError, "Module field \"body\" must be a list, not a %.200s", tmp->ob_type->tp_name); | 3490 PyErr_Format(PyExc_TypeError, "Module field \"body\" must be a list, not a %.200s", tmp->ob_type->tp_name); |
| 3426 goto failed; | 3491 goto failed; |
| 3427 } | 3492 } |
| 3449 return 1; | 3514 return 1; |
| 3450 } | 3515 } |
| 3451 if (isinstance) { | 3516 if (isinstance) { |
| 3452 asdl_seq* body; | 3517 asdl_seq* body; |
| 3453 | 3518 |
| 3454 if (PyObject_HasAttrString(obj, "body")) { | 3519 if (_PyObject_HasAttrId(obj, &PyId_body)) { |
| 3455 int res; | 3520 int res; |
| 3456 Py_ssize_t len; | 3521 Py_ssize_t len; |
| 3457 Py_ssize_t i; | 3522 Py_ssize_t i; |
| 3458 tmp = PyObject_GetAttrString(obj, "body"); | 3523 tmp = _PyObject_GetAttrId(obj, &PyId_body); |
| 3459 if (tmp == NULL) goto failed; | 3524 if (tmp == NULL) goto failed; |
| 3460 if (!PyList_Check(tmp)) { | 3525 if (!PyList_Check(tmp)) { |
| 3461 PyErr_Format(PyExc_TypeError, "Interactive field \"body\" must be a list, not a %.200s", tmp->ob_type->tp_name); | 3526 PyErr_Format(PyExc_TypeError, "Interactive field \"body\" must be a list, not a %.200s", tmp->ob_type->tp_name); |
| 3462 goto failed; | 3527 goto failed; |
| 3463 } | 3528 } |
| 3485 return 1; | 3550 return 1; |
| 3486 } | 3551 } |
| 3487 if (isinstance) { | 3552 if (isinstance) { |
| 3488 expr_ty body; | 3553 expr_ty body; |
| 3489 | 3554 |
| 3490 if (PyObject_HasAttrString(obj, "body")) { | 3555 if (_PyObject_HasAttrId(obj, &PyId_body)) { |
| 3491 int res; | 3556 int res; |
| 3492 tmp = PyObject_GetAttrString(obj, "body"); | 3557 tmp = _PyObject_GetAttrId(obj, &PyId_body); |
| 3493 if (tmp == NULL) goto failed; | 3558 if (tmp == NULL) goto failed; |
| 3494 res = obj2ast_expr(tmp, &body, arena); | 3559 res = obj2ast_expr(tmp, &body, arena); |
| 3495 if (res != 0) goto failed; | 3560 if (res != 0) goto failed; |
| 3496 Py_XDECREF(tmp); | 3561 Py_XDECREF(tmp); |
| 3497 tmp = NULL; | 3562 tmp = NULL; |
| 3508 return 1; | 3573 return 1; |
| 3509 } | 3574 } |
| 3510 if (isinstance) { | 3575 if (isinstance) { |
| 3511 asdl_seq* body; | 3576 asdl_seq* body; |
| 3512 | 3577 |
| 3513 if (PyObject_HasAttrString(obj, "body")) { | 3578 if (_PyObject_HasAttrId(obj, &PyId_body)) { |
| 3514 int res; | 3579 int res; |
| 3515 Py_ssize_t len; | 3580 Py_ssize_t len; |
| 3516 Py_ssize_t i; | 3581 Py_ssize_t i; |
| 3517 tmp = PyObject_GetAttrString(obj, "body"); | 3582 tmp = _PyObject_GetAttrId(obj, &PyId_body); |
| 3518 if (tmp == NULL) goto failed; | 3583 if (tmp == NULL) goto failed; |
| 3519 if (!PyList_Check(tmp)) { | 3584 if (!PyList_Check(tmp)) { |
| 3520 PyErr_Format(PyExc_TypeError, "Suite field \"body\" must be a list, not a %.200s", tmp->ob_type->tp_name); | 3585 PyErr_Format(PyExc_TypeError, "Suite field \"body\" must be a list, not a %.200s", tmp->ob_type->tp_name); |
| 3521 goto failed; | 3586 goto failed; |
| 3522 } | 3587 } |
| 3557 | 3622 |
| 3558 if (obj == Py_None) { | 3623 if (obj == Py_None) { |
| 3559 *out = NULL; | 3624 *out = NULL; |
| 3560 return 0; | 3625 return 0; |
| 3561 } | 3626 } |
| 3562 if (PyObject_HasAttrString(obj, "lineno")) { | 3627 if (_PyObject_HasAttrId(obj, &PyId_lineno)) { |
| 3563 int res; | 3628 int res; |
| 3564 tmp = PyObject_GetAttrString(obj, "lineno"); | 3629 tmp = _PyObject_GetAttrId(obj, &PyId_lineno); |
| 3565 if (tmp == NULL) goto failed; | 3630 if (tmp == NULL) goto failed; |
| 3566 res = obj2ast_int(tmp, &lineno, arena); | 3631 res = obj2ast_int(tmp, &lineno, arena); |
| 3567 if (res != 0) goto failed; | 3632 if (res != 0) goto failed; |
| 3568 Py_XDECREF(tmp); | 3633 Py_XDECREF(tmp); |
| 3569 tmp = NULL; | 3634 tmp = NULL; |
| 3570 } else { | 3635 } else { |
| 3571 PyErr_SetString(PyExc_TypeError, "required field \"lineno\" missing from stmt"); | 3636 PyErr_SetString(PyExc_TypeError, "required field \"lineno\" missing from stmt"); |
| 3572 return 1; | 3637 return 1; |
| 3573 } | 3638 } |
| 3574 if (PyObject_HasAttrString(obj, "col_offset")) { | 3639 if (_PyObject_HasAttrId(obj, &PyId_col_offset)) { |
| 3575 int res; | 3640 int res; |
| 3576 tmp = PyObject_GetAttrString(obj, "col_offset"); | 3641 tmp = _PyObject_GetAttrId(obj, &PyId_col_offset); |
| 3577 if (tmp == NULL) goto failed; | 3642 if (tmp == NULL) goto failed; |
| 3578 res = obj2ast_int(tmp, &col_offset, arena); | 3643 res = obj2ast_int(tmp, &col_offset, arena); |
| 3579 if (res != 0) goto failed; | 3644 if (res != 0) goto failed; |
| 3580 Py_XDECREF(tmp); | 3645 Py_XDECREF(tmp); |
| 3581 tmp = NULL; | 3646 tmp = NULL; |
| 3592 arguments_ty args; | 3657 arguments_ty args; |
| 3593 asdl_seq* body; | 3658 asdl_seq* body; |
| 3594 asdl_seq* decorator_list; | 3659 asdl_seq* decorator_list; |
| 3595 expr_ty returns; | 3660 expr_ty returns; |
| 3596 | 3661 |
| 3597 if (PyObject_HasAttrString(obj, "name")) { | 3662 if (_PyObject_HasAttrId(obj, &PyId_name)) { |
| 3598 int res; | 3663 int res; |
| 3599 tmp = PyObject_GetAttrString(obj, "name"); | 3664 tmp = _PyObject_GetAttrId(obj, &PyId_name); |
| 3600 if (tmp == NULL) goto failed; | 3665 if (tmp == NULL) goto failed; |
| 3601 res = obj2ast_identifier(tmp, &name, arena); | 3666 res = obj2ast_identifier(tmp, &name, arena); |
| 3602 if (res != 0) goto failed; | 3667 if (res != 0) goto failed; |
| 3603 Py_XDECREF(tmp); | 3668 Py_XDECREF(tmp); |
| 3604 tmp = NULL; | 3669 tmp = NULL; |
| 3605 } else { | 3670 } else { |
| 3606 PyErr_SetString(PyExc_TypeError, "required field \"name\" missing from FunctionDef"); | 3671 PyErr_SetString(PyExc_TypeError, "required field \"name\" missing from FunctionDef"); |
| 3607 return 1; | 3672 return 1; |
| 3608 } | 3673 } |
| 3609 if (PyObject_HasAttrString(obj, "args")) { | 3674 if (_PyObject_HasAttrId(obj, &PyId_args)) { |
| 3610 int res; | 3675 int res; |
| 3611 tmp = PyObject_GetAttrString(obj, "args"); | 3676 tmp = _PyObject_GetAttrId(obj, &PyId_args); |
| 3612 if (tmp == NULL) goto failed; | 3677 if (tmp == NULL) goto failed; |
| 3613 res = obj2ast_arguments(tmp, &args, arena); | 3678 res = obj2ast_arguments(tmp, &args, arena); |
| 3614 if (res != 0) goto failed; | 3679 if (res != 0) goto failed; |
| 3615 Py_XDECREF(tmp); | 3680 Py_XDECREF(tmp); |
| 3616 tmp = NULL; | 3681 tmp = NULL; |
| 3617 } else { | 3682 } else { |
| 3618 PyErr_SetString(PyExc_TypeError, "required field \"args\" missing from FunctionDef"); | 3683 PyErr_SetString(PyExc_TypeError, "required field \"args\" missing from FunctionDef"); |
| 3619 return 1; | 3684 return 1; |
| 3620 } | 3685 } |
| 3621 if (PyObject_HasAttrString(obj, "body")) { | 3686 if (_PyObject_HasAttrId(obj, &PyId_body)) { |
| 3622 int res; | 3687 int res; |
| 3623 Py_ssize_t len; | 3688 Py_ssize_t len; |
| 3624 Py_ssize_t i; | 3689 Py_ssize_t i; |
| 3625 tmp = PyObject_GetAttrString(obj, "body"); | 3690 tmp = _PyObject_GetAttrId(obj, &PyId_body); |
| 3626 if (tmp == NULL) goto failed; | 3691 if (tmp == NULL) goto failed; |
| 3627 if (!PyList_Check(tmp)) { | 3692 if (!PyList_Check(tmp)) { |
| 3628 PyErr_Format(PyExc_TypeError, "FunctionDef field \"body\" must be a list, not a %.200s", tmp->ob_type->tp_name); | 3693 PyErr_Format(PyExc_TypeError, "FunctionDef field \"body\" must be a list, not a %.200s", tmp->ob_type->tp_name); |
| 3629 goto failed; | 3694 goto failed; |
| 3630 } | 3695 } |
| 3641 tmp = NULL; | 3706 tmp = NULL; |
| 3642 } else { | 3707 } else { |
| 3643 PyErr_SetString(PyExc_TypeError, "required field \"body\" missing from FunctionDef"); | 3708 PyErr_SetString(PyExc_TypeError, "required field \"body\" missing from FunctionDef"); |
| 3644 return 1; | 3709 return 1; |
| 3645 } | 3710 } |
| 3646 if (PyObject_HasAttrString(obj, "decorator_list")) { | 3711 if (_PyObject_HasAttrId(obj, &PyId_decorator_list)) { |
| 3647 int res; | 3712 int res; |
| 3648 Py_ssize_t len; | 3713 Py_ssize_t len; |
| 3649 Py_ssize_t i; | 3714 Py_ssize_t i; |
| 3650 tmp = PyObject_GetAttrString(obj, "decorator_list"); | 3715 tmp = _PyObject_GetAttrId(obj, &PyId_decorator_list); |
| 3651 if (tmp == NULL) goto failed; | 3716 if (tmp == NULL) goto failed; |
| 3652 if (!PyList_Check(tmp)) { | 3717 if (!PyList_Check(tmp)) { |
| 3653 PyErr_Format(PyExc_TypeError, "FunctionDef field \"decorator_list\" must be a list, not a %.200s", tmp->ob_type->tp_name); | 3718 PyErr_Format(PyExc_TypeError, "FunctionDef field \"decorator_list\" must be a list, not a %.200s", tmp->ob_type->tp_name); |
| 3654 goto failed; | 3719 goto failed; |
| 3655 } | 3720 } |
| 3666 tmp = NULL; | 3731 tmp = NULL; |
| 3667 } else { | 3732 } else { |
| 3668 PyErr_SetString(PyExc_TypeError, "required field \"decorator_list\" missing from FunctionDef"); | 3733 PyErr_SetString(PyExc_TypeError, "required field \"decorator_list\" missing from FunctionDef"); |
| 3669 return 1; | 3734 return 1; |
| 3670 } | 3735 } |
| 3671 if (PyObject_HasAttrString(obj, "returns")) { | 3736 if (_PyObject_HasAttrId(obj, &PyId_returns)) { |
| 3672 int res; | 3737 int res; |
| 3673 tmp = PyObject_GetAttrString(obj, "returns"); | 3738 tmp = _PyObject_GetAttrId(obj, &PyId_returns); |
| 3674 if (tmp == NULL) goto failed; | 3739 if (tmp == NULL) goto failed; |
| 3675 res = obj2ast_expr(tmp, &returns, arena); | 3740 res = obj2ast_expr(tmp, &returns, arena); |
| 3676 if (res != 0) goto failed; | 3741 if (res != 0) goto failed; |
| 3677 Py_XDECREF(tmp); | 3742 Py_XDECREF(tmp); |
| 3678 tmp = NULL; | 3743 tmp = NULL; |
| 3695 expr_ty starargs; | 3760 expr_ty starargs; |
| 3696 expr_ty kwargs; | 3761 expr_ty kwargs; |
| 3697 asdl_seq* body; | 3762 asdl_seq* body; |
| 3698 asdl_seq* decorator_list; | 3763 asdl_seq* decorator_list; |
| 3699 | 3764 |
| 3700 if (PyObject_HasAttrString(obj, "name")) { | 3765 if (_PyObject_HasAttrId(obj, &PyId_name)) { |
| 3701 int res; | 3766 int res; |
| 3702 tmp = PyObject_GetAttrString(obj, "name"); | 3767 tmp = _PyObject_GetAttrId(obj, &PyId_name); |
| 3703 if (tmp == NULL) goto failed; | 3768 if (tmp == NULL) goto failed; |
| 3704 res = obj2ast_identifier(tmp, &name, arena); | 3769 res = obj2ast_identifier(tmp, &name, arena); |
| 3705 if (res != 0) goto failed; | 3770 if (res != 0) goto failed; |
| 3706 Py_XDECREF(tmp); | 3771 Py_XDECREF(tmp); |
| 3707 tmp = NULL; | 3772 tmp = NULL; |
| 3708 } else { | 3773 } else { |
| 3709 PyErr_SetString(PyExc_TypeError, "required field \"name\" missing from ClassDef"); | 3774 PyErr_SetString(PyExc_TypeError, "required field \"name\" missing from ClassDef"); |
| 3710 return 1; | 3775 return 1; |
| 3711 } | 3776 } |
| 3712 if (PyObject_HasAttrString(obj, "bases")) { | 3777 if (_PyObject_HasAttrId(obj, &PyId_bases)) { |
| 3713 int res; | 3778 int res; |
| 3714 Py_ssize_t len; | 3779 Py_ssize_t len; |
| 3715 Py_ssize_t i; | 3780 Py_ssize_t i; |
| 3716 tmp = PyObject_GetAttrString(obj, "bases"); | 3781 tmp = _PyObject_GetAttrId(obj, &PyId_bases); |
| 3717 if (tmp == NULL) goto failed; | 3782 if (tmp == NULL) goto failed; |
| 3718 if (!PyList_Check(tmp)) { | 3783 if (!PyList_Check(tmp)) { |
| 3719 PyErr_Format(PyExc_TypeError, "ClassDef field \"bases\" must be a list, not a %.200s", tmp->ob_type->tp_name); | 3784 PyErr_Format(PyExc_TypeError, "ClassDef field \"bases\" must be a list, not a %.200s", tmp->ob_type->tp_name); |
| 3720 goto failed; | 3785 goto failed; |
| 3721 } | 3786 } |
| 3732 tmp = NULL; | 3797 tmp = NULL; |
| 3733 } else { | 3798 } else { |
| 3734 PyErr_SetString(PyExc_TypeError, "required field \"bases\" missing from ClassDef"); | 3799 PyErr_SetString(PyExc_TypeError, "required field \"bases\" missing from ClassDef"); |
| 3735 return 1; | 3800 return 1; |
| 3736 } | 3801 } |
| 3737 if (PyObject_HasAttrString(obj, "keywords")) { | 3802 if (_PyObject_HasAttrId(obj, &PyId_keywords)) { |
| 3738 int res; | 3803 int res; |
| 3739 Py_ssize_t len; | 3804 Py_ssize_t len; |
| 3740 Py_ssize_t i; | 3805 Py_ssize_t i; |
| 3741 tmp = PyObject_GetAttrString(obj, "keywords"); | 3806 tmp = _PyObject_GetAttrId(obj, &PyId_keywords); |
| 3742 if (tmp == NULL) goto failed; | 3807 if (tmp == NULL) goto failed; |
| 3743 if (!PyList_Check(tmp)) { | 3808 if (!PyList_Check(tmp)) { |
| 3744 PyErr_Format(PyExc_TypeError, "ClassDef field \"keywords\" must be a list, not a %.200s", tmp->ob_type->tp_name); | 3809 PyErr_Format(PyExc_TypeError, "ClassDef field \"keywords\" must be a list, not a %.200s", tmp->ob_type->tp_name); |
| 3745 goto failed; | 3810 goto failed; |
| 3746 } | 3811 } |
| 3757 tmp = NULL; | 3822 tmp = NULL; |
| 3758 } else { | 3823 } else { |
| 3759 PyErr_SetString(PyExc_TypeError, "required field \"keywords\" missing from ClassDef"); | 3824 PyErr_SetString(PyExc_TypeError, "required field \"keywords\" missing from ClassDef"); |
| 3760 return 1; | 3825 return 1; |
| 3761 } | 3826 } |
| 3762 if (PyObject_HasAttrString(obj, "starargs")) { | 3827 if (_PyObject_HasAttrId(obj, &PyId_starargs)) { |
| 3763 int res; | 3828 int res; |
| 3764 tmp = PyObject_GetAttrString(obj, "starargs"); | 3829 tmp = _PyObject_GetAttrId(obj, &PyId_starargs); |
| 3765 if (tmp == NULL) goto failed; | 3830 if (tmp == NULL) goto failed; |
| 3766 res = obj2ast_expr(tmp, &starargs, arena); | 3831 res = obj2ast_expr(tmp, &starargs, arena); |
| 3767 if (res != 0) goto failed; | 3832 if (res != 0) goto failed; |
| 3768 Py_XDECREF(tmp); | 3833 Py_XDECREF(tmp); |
| 3769 tmp = NULL; | 3834 tmp = NULL; |
| 3770 } else { | 3835 } else { |
| 3771 starargs = NULL; | 3836 starargs = NULL; |
| 3772 } | 3837 } |
| 3773 if (PyObject_HasAttrString(obj, "kwargs")) { | 3838 if (_PyObject_HasAttrId(obj, &PyId_kwargs)) { |
| 3774 int res; | 3839 int res; |
| 3775 tmp = PyObject_GetAttrString(obj, "kwargs"); | 3840 tmp = _PyObject_GetAttrId(obj, &PyId_kwargs); |
| 3776 if (tmp == NULL) goto failed; | 3841 if (tmp == NULL) goto failed; |
| 3777 res = obj2ast_expr(tmp, &kwargs, arena); | 3842 res = obj2ast_expr(tmp, &kwargs, arena); |
| 3778 if (res != 0) goto failed; | 3843 if (res != 0) goto failed; |
| 3779 Py_XDECREF(tmp); | 3844 Py_XDECREF(tmp); |
| 3780 tmp = NULL; | 3845 tmp = NULL; |
| 3781 } else { | 3846 } else { |
| 3782 kwargs = NULL; | 3847 kwargs = NULL; |
| 3783 } | 3848 } |
| 3784 if (PyObject_HasAttrString(obj, "body")) { | 3849 if (_PyObject_HasAttrId(obj, &PyId_body)) { |
| 3785 int res; | 3850 int res; |
| 3786 Py_ssize_t len; | 3851 Py_ssize_t len; |
| 3787 Py_ssize_t i; | 3852 Py_ssize_t i; |
| 3788 tmp = PyObject_GetAttrString(obj, "body"); | 3853 tmp = _PyObject_GetAttrId(obj, &PyId_body); |
| 3789 if (tmp == NULL) goto failed; | 3854 if (tmp == NULL) goto failed; |
| 3790 if (!PyList_Check(tmp)) { | 3855 if (!PyList_Check(tmp)) { |
| 3791 PyErr_Format(PyExc_TypeError, "ClassDef field \"body\" must be a list, not a %.200s", tmp->ob_type->tp_name); | 3856 PyErr_Format(PyExc_TypeError, "ClassDef field \"body\" must be a list, not a %.200s", tmp->ob_type->tp_name); |
| 3792 goto failed; | 3857 goto failed; |
| 3793 } | 3858 } |
| 3804 tmp = NULL; | 3869 tmp = NULL; |
| 3805 } else { | 3870 } else { |
| 3806 PyErr_SetString(PyExc_TypeError, "required field \"body\" missing from ClassDef"); | 3871 PyErr_SetString(PyExc_TypeError, "required field \"body\" missing from ClassDef"); |
| 3807 return 1; | 3872 return 1; |
| 3808 } | 3873 } |
| 3809 if (PyObject_HasAttrString(obj, "decorator_list")) { | 3874 if (_PyObject_HasAttrId(obj, &PyId_decorator_list)) { |
| 3810 int res; | 3875 int res; |
| 3811 Py_ssize_t len; | 3876 Py_ssize_t len; |
| 3812 Py_ssize_t i; | 3877 Py_ssize_t i; |
| 3813 tmp = PyObject_GetAttrString(obj, "decorator_list"); | 3878 tmp = _PyObject_GetAttrId(obj, &PyId_decorator_list); |
| 3814 if (tmp == NULL) goto failed; | 3879 if (tmp == NULL) goto failed; |
| 3815 if (!PyList_Check(tmp)) { | 3880 if (!PyList_Check(tmp)) { |
| 3816 PyErr_Format(PyExc_TypeError, "ClassDef field \"decorator_list\" must be a list, not a %.200s", tmp->ob_type->tp_name); | 3881 PyErr_Format(PyExc_TypeError, "ClassDef field \"decorator_list\" must be a list, not a %.200s", tmp->ob_type->tp_name); |
| 3817 goto failed; | 3882 goto failed; |
| 3818 } | 3883 } |
| 3841 return 1; | 3906 return 1; |
| 3842 } | 3907 } |
| 3843 if (isinstance) { | 3908 if (isinstance) { |
| 3844 expr_ty value; | 3909 expr_ty value; |
| 3845 | 3910 |
| 3846 if (PyObject_HasAttrString(obj, "value")) { | 3911 if (_PyObject_HasAttrId(obj, &PyId_value)) { |
| 3847 int res; | 3912 int res; |
| 3848 tmp = PyObject_GetAttrString(obj, "value"); | 3913 tmp = _PyObject_GetAttrId(obj, &PyId_value); |
| 3849 if (tmp == NULL) goto failed; | 3914 if (tmp == NULL) goto failed; |
| 3850 res = obj2ast_expr(tmp, &value, arena); | 3915 res = obj2ast_expr(tmp, &value, arena); |
| 3851 if (res != 0) goto failed; | 3916 if (res != 0) goto failed; |
| 3852 Py_XDECREF(tmp); | 3917 Py_XDECREF(tmp); |
| 3853 tmp = NULL; | 3918 tmp = NULL; |
| 3863 return 1; | 3928 return 1; |
| 3864 } | 3929 } |
| 3865 if (isinstance) { | 3930 if (isinstance) { |
| 3866 asdl_seq* targets; | 3931 asdl_seq* targets; |
| 3867 | 3932 |
| 3868 if (PyObject_HasAttrString(obj, "targets")) { | 3933 if (_PyObject_HasAttrId(obj, &PyId_targets)) { |
| 3869 int res; | 3934 int res; |
| 3870 Py_ssize_t len; | 3935 Py_ssize_t len; |
| 3871 Py_ssize_t i; | 3936 Py_ssize_t i; |
| 3872 tmp = PyObject_GetAttrString(obj, "targets"); | 3937 tmp = _PyObject_GetAttrId(obj, &PyId_targets); |
| 3873 if (tmp == NULL) goto failed; | 3938 if (tmp == NULL) goto failed; |
| 3874 if (!PyList_Check(tmp)) { | 3939 if (!PyList_Check(tmp)) { |
| 3875 PyErr_Format(PyExc_TypeError, "Delete field \"targets\" must be a list, not a %.200s", tmp->ob_type->tp_name); | 3940 PyErr_Format(PyExc_TypeError, "Delete field \"targets\" must be a list, not a %.200s", tmp->ob_type->tp_name); |
| 3876 goto failed; | 3941 goto failed; |
| 3877 } | 3942 } |
| 3900 } | 3965 } |
| 3901 if (isinstance) { | 3966 if (isinstance) { |
| 3902 asdl_seq* targets; | 3967 asdl_seq* targets; |
| 3903 expr_ty value; | 3968 expr_ty value; |
| 3904 | 3969 |
| 3905 if (PyObject_HasAttrString(obj, "targets")) { | 3970 if (_PyObject_HasAttrId(obj, &PyId_targets)) { |
| 3906 int res; | 3971 int res; |
| 3907 Py_ssize_t len; | 3972 Py_ssize_t len; |
| 3908 Py_ssize_t i; | 3973 Py_ssize_t i; |
| 3909 tmp = PyObject_GetAttrString(obj, "targets"); | 3974 tmp = _PyObject_GetAttrId(obj, &PyId_targets); |
| 3910 if (tmp == NULL) goto failed; | 3975 if (tmp == NULL) goto failed; |
| 3911 if (!PyList_Check(tmp)) { | 3976 if (!PyList_Check(tmp)) { |
| 3912 PyErr_Format(PyExc_TypeError, "Assign field \"targets\" must be a list, not a %.200s", tmp->ob_type->tp_name); | 3977 PyErr_Format(PyExc_TypeError, "Assign field \"targets\" must be a list, not a %.200s", tmp->ob_type->tp_name); |
| 3913 goto failed; | 3978 goto failed; |
| 3914 } | 3979 } |
| 3925 tmp = NULL; | 3990 tmp = NULL; |
| 3926 } else { | 3991 } else { |
| 3927 PyErr_SetString(PyExc_TypeError, "required field \"targets\" missing from Assign"); | 3992 PyErr_SetString(PyExc_TypeError, "required field \"targets\" missing from Assign"); |
| 3928 return 1; | 3993 return 1; |
| 3929 } | 3994 } |
| 3930 if (PyObject_HasAttrString(obj, "value")) { | 3995 if (_PyObject_HasAttrId(obj, &PyId_value)) { |
| 3931 int res; | 3996 int res; |
| 3932 tmp = PyObject_GetAttrString(obj, "value"); | 3997 tmp = _PyObject_GetAttrId(obj, &PyId_value); |
| 3933 if (tmp == NULL) goto failed; | 3998 if (tmp == NULL) goto failed; |
| 3934 res = obj2ast_expr(tmp, &value, arena); | 3999 res = obj2ast_expr(tmp, &value, arena); |
| 3935 if (res != 0) goto failed; | 4000 if (res != 0) goto failed; |
| 3936 Py_XDECREF(tmp); | 4001 Py_XDECREF(tmp); |
| 3937 tmp = NULL; | 4002 tmp = NULL; |
| 3950 if (isinstance) { | 4015 if (isinstance) { |
| 3951 expr_ty target; | 4016 expr_ty target; |
| 3952 operator_ty op; | 4017 operator_ty op; |
| 3953 expr_ty value; | 4018 expr_ty value; |
| 3954 | 4019 |
| 3955 if (PyObject_HasAttrString(obj, "target")) { | 4020 if (_PyObject_HasAttrId(obj, &PyId_target)) { |
| 3956 int res; | 4021 int res; |
| 3957 tmp = PyObject_GetAttrString(obj, "target"); | 4022 tmp = _PyObject_GetAttrId(obj, &PyId_target); |
| 3958 if (tmp == NULL) goto failed; | 4023 if (tmp == NULL) goto failed; |
| 3959 res = obj2ast_expr(tmp, &target, arena); | 4024 res = obj2ast_expr(tmp, &target, arena); |
| 3960 if (res != 0) goto failed; | 4025 if (res != 0) goto failed; |
| 3961 Py_XDECREF(tmp); | 4026 Py_XDECREF(tmp); |
| 3962 tmp = NULL; | 4027 tmp = NULL; |
| 3963 } else { | 4028 } else { |
| 3964 PyErr_SetString(PyExc_TypeError, "required field \"target\" missing from AugAssign"); | 4029 PyErr_SetString(PyExc_TypeError, "required field \"target\" missing from AugAssign"); |
| 3965 return 1; | 4030 return 1; |
| 3966 } | 4031 } |
| 3967 if (PyObject_HasAttrString(obj, "op")) { | 4032 if (_PyObject_HasAttrId(obj, &PyId_op)) { |
| 3968 int res; | 4033 int res; |
| 3969 tmp = PyObject_GetAttrString(obj, "op"); | 4034 tmp = _PyObject_GetAttrId(obj, &PyId_op); |
| 3970 if (tmp == NULL) goto failed; | 4035 if (tmp == NULL) goto failed; |
| 3971 res = obj2ast_operator(tmp, &op, arena); | 4036 res = obj2ast_operator(tmp, &op, arena); |
| 3972 if (res != 0) goto failed; | 4037 if (res != 0) goto failed; |
| 3973 Py_XDECREF(tmp); | 4038 Py_XDECREF(tmp); |
| 3974 tmp = NULL; | 4039 tmp = NULL; |
| 3975 } else { | 4040 } else { |
| 3976 PyErr_SetString(PyExc_TypeError, "required field \"op\" missing from AugAssign"); | 4041 PyErr_SetString(PyExc_TypeError, "required field \"op\" missing from AugAssign"); |
| 3977 return 1; | 4042 return 1; |
| 3978 } | 4043 } |
| 3979 if (PyObject_HasAttrString(obj, "value")) { | 4044 if (_PyObject_HasAttrId(obj, &PyId_value)) { |
| 3980 int res; | 4045 int res; |
| 3981 tmp = PyObject_GetAttrString(obj, "value"); | 4046 tmp = _PyObject_GetAttrId(obj, &PyId_value); |
| 3982 if (tmp == NULL) goto failed; | 4047 if (tmp == NULL) goto failed; |
| 3983 res = obj2ast_expr(tmp, &value, arena); | 4048 res = obj2ast_expr(tmp, &value, arena); |
| 3984 if (res != 0) goto failed; | 4049 if (res != 0) goto failed; |
| 3985 Py_XDECREF(tmp); | 4050 Py_XDECREF(tmp); |
| 3986 tmp = NULL; | 4051 tmp = NULL; |
| 4000 expr_ty target; | 4065 expr_ty target; |
| 4001 expr_ty iter; | 4066 expr_ty iter; |
| 4002 asdl_seq* body; | 4067 asdl_seq* body; |
| 4003 asdl_seq* orelse; | 4068 asdl_seq* orelse; |
| 4004 | 4069 |
| 4005 if (PyObject_HasAttrString(obj, "target")) { | 4070 if (_PyObject_HasAttrId(obj, &PyId_target)) { |
| 4006 int res; | 4071 int res; |
| 4007 tmp = PyObject_GetAttrString(obj, "target"); | 4072 tmp = _PyObject_GetAttrId(obj, &PyId_target); |
| 4008 if (tmp == NULL) goto failed; | 4073 if (tmp == NULL) goto failed; |
| 4009 res = obj2ast_expr(tmp, &target, arena); | 4074 res = obj2ast_expr(tmp, &target, arena); |
| 4010 if (res != 0) goto failed; | 4075 if (res != 0) goto failed; |
| 4011 Py_XDECREF(tmp); | 4076 Py_XDECREF(tmp); |
| 4012 tmp = NULL; | 4077 tmp = NULL; |
| 4013 } else { | 4078 } else { |
| 4014 PyErr_SetString(PyExc_TypeError, "required field \"target\" missing from For"); | 4079 PyErr_SetString(PyExc_TypeError, "required field \"target\" missing from For"); |
| 4015 return 1; | 4080 return 1; |
| 4016 } | 4081 } |
| 4017 if (PyObject_HasAttrString(obj, "iter")) { | 4082 if (_PyObject_HasAttrId(obj, &PyId_iter)) { |
| 4018 int res; | 4083 int res; |
| 4019 tmp = PyObject_GetAttrString(obj, "iter"); | 4084 tmp = _PyObject_GetAttrId(obj, &PyId_iter); |
| 4020 if (tmp == NULL) goto failed; | 4085 if (tmp == NULL) goto failed; |
| 4021 res = obj2ast_expr(tmp, &iter, arena); | 4086 res = obj2ast_expr(tmp, &iter, arena); |
| 4022 if (res != 0) goto failed; | 4087 if (res != 0) goto failed; |
| 4023 Py_XDECREF(tmp); | 4088 Py_XDECREF(tmp); |
| 4024 tmp = NULL; | 4089 tmp = NULL; |
| 4025 } else { | 4090 } else { |
| 4026 PyErr_SetString(PyExc_TypeError, "required field \"iter\" missing from For"); | 4091 PyErr_SetString(PyExc_TypeError, "required field \"iter\" missing from For"); |
| 4027 return 1; | 4092 return 1; |
| 4028 } | 4093 } |
| 4029 if (PyObject_HasAttrString(obj, "body")) { | 4094 if (_PyObject_HasAttrId(obj, &PyId_body)) { |
| 4030 int res; | 4095 int res; |
| 4031 Py_ssize_t len; | 4096 Py_ssize_t len; |
| 4032 Py_ssize_t i; | 4097 Py_ssize_t i; |
| 4033 tmp = PyObject_GetAttrString(obj, "body"); | 4098 tmp = _PyObject_GetAttrId(obj, &PyId_body); |
| 4034 if (tmp == NULL) goto failed; | 4099 if (tmp == NULL) goto failed; |
| 4035 if (!PyList_Check(tmp)) { | 4100 if (!PyList_Check(tmp)) { |
| 4036 PyErr_Format(PyExc_TypeError, "For field \"body\" must be a list, not a %.200s", tmp->ob_type->tp_name); | 4101 PyErr_Format(PyExc_TypeError, "For field \"body\" must be a list, not a %.200s", tmp->ob_type->tp_name); |
| 4037 goto failed; | 4102 goto failed; |
| 4038 } | 4103 } |
| 4049 tmp = NULL; | 4114 tmp = NULL; |
| 4050 } else { | 4115 } else { |
| 4051 PyErr_SetString(PyExc_TypeError, "required field \"body\" missing from For"); | 4116 PyErr_SetString(PyExc_TypeError, "required field \"body\" missing from For"); |
| 4052 return 1; | 4117 return 1; |
| 4053 } | 4118 } |
| 4054 if (PyObject_HasAttrString(obj, "orelse")) { | 4119 if (_PyObject_HasAttrId(obj, &PyId_orelse)) { |
| 4055 int res; | 4120 int res; |
| 4056 Py_ssize_t len; | 4121 Py_ssize_t len; |
| 4057 Py_ssize_t i; | 4122 Py_ssize_t i; |
| 4058 tmp = PyObject_GetAttrString(obj, "orelse"); | 4123 tmp = _PyObject_GetAttrId(obj, &PyId_orelse); |
| 4059 if (tmp == NULL) goto failed; | 4124 if (tmp == NULL) goto failed; |
| 4060 if (!PyList_Check(tmp)) { | 4125 if (!PyList_Check(tmp)) { |
| 4061 PyErr_Format(PyExc_TypeError, "For field \"orelse\" must be a list, not a %.200s", tmp->ob_type->tp_name); | 4126 PyErr_Format(PyExc_TypeError, "For field \"orelse\" must be a list, not a %.200s", tmp->ob_type->tp_name); |
| 4062 goto failed; | 4127 goto failed; |
| 4063 } | 4128 } |
| 4088 if (isinstance) { | 4153 if (isinstance) { |
| 4089 expr_ty test; | 4154 expr_ty test; |
| 4090 asdl_seq* body; | 4155 asdl_seq* body; |
| 4091 asdl_seq* orelse; | 4156 asdl_seq* orelse; |
| 4092 | 4157 |
| 4093 if (PyObject_HasAttrString(obj, "test")) { | 4158 if (_PyObject_HasAttrId(obj, &PyId_test)) { |
| 4094 int res; | 4159 int res; |
| 4095 tmp = PyObject_GetAttrString(obj, "test"); | 4160 tmp = _PyObject_GetAttrId(obj, &PyId_test); |
| 4096 if (tmp == NULL) goto failed; | 4161 if (tmp == NULL) goto failed; |
| 4097 res = obj2ast_expr(tmp, &test, arena); | 4162 res = obj2ast_expr(tmp, &test, arena); |
| 4098 if (res != 0) goto failed; | 4163 if (res != 0) goto failed; |
| 4099 Py_XDECREF(tmp); | 4164 Py_XDECREF(tmp); |
| 4100 tmp = NULL; | 4165 tmp = NULL; |
| 4101 } else { | 4166 } else { |
| 4102 PyErr_SetString(PyExc_TypeError, "required field \"test\" missing from While"); | 4167 PyErr_SetString(PyExc_TypeError, "required field \"test\" missing from While"); |
| 4103 return 1; | 4168 return 1; |
| 4104 } | 4169 } |
| 4105 if (PyObject_HasAttrString(obj, "body")) { | 4170 if (_PyObject_HasAttrId(obj, &PyId_body)) { |
| 4106 int res; | 4171 int res; |
| 4107 Py_ssize_t len; | 4172 Py_ssize_t len; |
| 4108 Py_ssize_t i; | 4173 Py_ssize_t i; |
| 4109 tmp = PyObject_GetAttrString(obj, "body"); | 4174 tmp = _PyObject_GetAttrId(obj, &PyId_body); |
| 4110 if (tmp == NULL) goto failed; | 4175 if (tmp == NULL) goto failed; |
| 4111 if (!PyList_Check(tmp)) { | 4176 if (!PyList_Check(tmp)) { |
| 4112 PyErr_Format(PyExc_TypeError, "While field \"body\" must be a list, not a %.200s", tmp->ob_type->tp_name); | 4177 PyErr_Format(PyExc_TypeError, "While field \"body\" must be a list, not a %.200s", tmp->ob_type->tp_name); |
| 4113 goto failed; | 4178 goto failed; |
| 4114 } | 4179 } |
| 4125 tmp = NULL; | 4190 tmp = NULL; |
| 4126 } else { | 4191 } else { |
| 4127 PyErr_SetString(PyExc_TypeError, "required field \"body\" missing from While"); | 4192 PyErr_SetString(PyExc_TypeError, "required field \"body\" missing from While"); |
| 4128 return 1; | 4193 return 1; |
| 4129 } | 4194 } |
| 4130 if (PyObject_HasAttrString(obj, "orelse")) { | 4195 if (_PyObject_HasAttrId(obj, &PyId_orelse)) { |
| 4131 int res; | 4196 int res; |
| 4132 Py_ssize_t len; | 4197 Py_ssize_t len; |
| 4133 Py_ssize_t i; | 4198 Py_ssize_t i; |
| 4134 tmp = PyObject_GetAttrString(obj, "orelse"); | 4199 tmp = _PyObject_GetAttrId(obj, &PyId_orelse); |
| 4135 if (tmp == NULL) goto failed; | 4200 if (tmp == NULL) goto failed; |
| 4136 if (!PyList_Check(tmp)) { | 4201 if (!PyList_Check(tmp)) { |
| 4137 PyErr_Format(PyExc_TypeError, "While field \"orelse\" must be a list, not a %.200s", tmp->ob_type->tp_name); | 4202 PyErr_Format(PyExc_TypeError, "While field \"orelse\" must be a list, not a %.200s", tmp->ob_type->tp_name); |
| 4138 goto failed; | 4203 goto failed; |
| 4139 } | 4204 } |
| 4163 if (isinstance) { | 4228 if (isinstance) { |
| 4164 expr_ty test; | 4229 expr_ty test; |
| 4165 asdl_seq* body; | 4230 asdl_seq* body; |
| 4166 asdl_seq* orelse; | 4231 asdl_seq* orelse; |
| 4167 | 4232 |
| 4168 if (PyObject_HasAttrString(obj, "test")) { | 4233 if (_PyObject_HasAttrId(obj, &PyId_test)) { |
| 4169 int res; | 4234 int res; |
| 4170 tmp = PyObject_GetAttrString(obj, "test"); | 4235 tmp = _PyObject_GetAttrId(obj, &PyId_test); |
| 4171 if (tmp == NULL) goto failed; | 4236 if (tmp == NULL) goto failed; |
| 4172 res = obj2ast_expr(tmp, &test, arena); | 4237 res = obj2ast_expr(tmp, &test, arena); |
| 4173 if (res != 0) goto failed; | 4238 if (res != 0) goto failed; |
| 4174 Py_XDECREF(tmp); | 4239 Py_XDECREF(tmp); |
| 4175 tmp = NULL; | 4240 tmp = NULL; |
| 4176 } else { | 4241 } else { |
| 4177 PyErr_SetString(PyExc_TypeError, "required field \"test\" missing from If"); | 4242 PyErr_SetString(PyExc_TypeError, "required field \"test\" missing from If"); |
| 4178 return 1; | 4243 return 1; |
| 4179 } | 4244 } |
| 4180 if (PyObject_HasAttrString(obj, "body")) { | 4245 if (_PyObject_HasAttrId(obj, &PyId_body)) { |
| 4181 int res; | 4246 int res; |
| 4182 Py_ssize_t len; | 4247 Py_ssize_t len; |
| 4183 Py_ssize_t i; | 4248 Py_ssize_t i; |
| 4184 tmp = PyObject_GetAttrString(obj, "body"); | 4249 tmp = _PyObject_GetAttrId(obj, &PyId_body); |
| 4185 if (tmp == NULL) goto failed; | 4250 if (tmp == NULL) goto failed; |
| 4186 if (!PyList_Check(tmp)) { | 4251 if (!PyList_Check(tmp)) { |
| 4187 PyErr_Format(PyExc_TypeError, "If field \"body\" must be a list, not a %.200s", tmp->ob_type->tp_name); | 4252 PyErr_Format(PyExc_TypeError, "If field \"body\" must be a list, not a %.200s", tmp->ob_type->tp_name); |
| 4188 goto failed; | 4253 goto failed; |
| 4189 } | 4254 } |
| 4200 tmp = NULL; | 4265 tmp = NULL; |
| 4201 } else { | 4266 } else { |
| 4202 PyErr_SetString(PyExc_TypeError, "required field \"body\" missing from If"); | 4267 PyErr_SetString(PyExc_TypeError, "required field \"body\" missing from If"); |
| 4203 return 1; | 4268 return 1; |
| 4204 } | 4269 } |
| 4205 if (PyObject_HasAttrString(obj, "orelse")) { | 4270 if (_PyObject_HasAttrId(obj, &PyId_orelse)) { |
| 4206 int res; | 4271 int res; |
| 4207 Py_ssize_t len; | 4272 Py_ssize_t len; |
| 4208 Py_ssize_t i; | 4273 Py_ssize_t i; |
| 4209 tmp = PyObject_GetAttrString(obj, "orelse"); | 4274 tmp = _PyObject_GetAttrId(obj, &PyId_orelse); |
| 4210 if (tmp == NULL) goto failed; | 4275 if (tmp == NULL) goto failed; |
| 4211 if (!PyList_Check(tmp)) { | 4276 if (!PyList_Check(tmp)) { |
| 4212 PyErr_Format(PyExc_TypeError, "If field \"orelse\" must be a list, not a %.200s", tmp->ob_type->tp_name); | 4277 PyErr_Format(PyExc_TypeError, "If field \"orelse\" must be a list, not a %.200s", tmp->ob_type->tp_name); |
| 4213 goto failed; | 4278 goto failed; |
| 4214 } | 4279 } |
| 4237 } | 4302 } |
| 4238 if (isinstance) { | 4303 if (isinstance) { |
| 4239 asdl_seq* items; | 4304 asdl_seq* items; |
| 4240 asdl_seq* body; | 4305 asdl_seq* body; |
| 4241 | 4306 |
| 4242 if (PyObject_HasAttrString(obj, "items")) { | 4307 if (_PyObject_HasAttrId(obj, &PyId_items)) { |
| 4243 int res; | 4308 int res; |
| 4244 Py_ssize_t len; | 4309 Py_ssize_t len; |
| 4245 Py_ssize_t i; | 4310 Py_ssize_t i; |
| 4246 tmp = PyObject_GetAttrString(obj, "items"); | 4311 tmp = _PyObject_GetAttrId(obj, &PyId_items); |
| 4247 if (tmp == NULL) goto failed; | 4312 if (tmp == NULL) goto failed; |
| 4248 if (!PyList_Check(tmp)) { | 4313 if (!PyList_Check(tmp)) { |
| 4249 PyErr_Format(PyExc_TypeError, "With field \"items\" must be a list, not a %.200s", tmp->ob_type->tp_name); | 4314 PyErr_Format(PyExc_TypeError, "With field \"items\" must be a list, not a %.200s", tmp->ob_type->tp_name); |
| 4250 goto failed; | 4315 goto failed; |
| 4251 } | 4316 } |
| 4262 tmp = NULL; | 4327 tmp = NULL; |
| 4263 } else { | 4328 } else { |
| 4264 PyErr_SetString(PyExc_TypeError, "required field \"items\" missing from With"); | 4329 PyErr_SetString(PyExc_TypeError, "required field \"items\" missing from With"); |
| 4265 return 1; | 4330 return 1; |
| 4266 } | 4331 } |
| 4267 if (PyObject_HasAttrString(obj, "body")) { | 4332 if (_PyObject_HasAttrId(obj, &PyId_body)) { |
| 4268 int res; | 4333 int res; |
| 4269 Py_ssize_t len; | 4334 Py_ssize_t len; |
| 4270 Py_ssize_t i; | 4335 Py_ssize_t i; |
| 4271 tmp = PyObject_GetAttrString(obj, "body"); | 4336 tmp = _PyObject_GetAttrId(obj, &PyId_body); |
| 4272 if (tmp == NULL) goto failed; | 4337 if (tmp == NULL) goto failed; |
| 4273 if (!PyList_Check(tmp)) { | 4338 if (!PyList_Check(tmp)) { |
| 4274 PyErr_Format(PyExc_TypeError, "With field \"body\" must be a list, not a %.200s", tmp->ob_type->tp_name); | 4339 PyErr_Format(PyExc_TypeError, "With field \"body\" must be a list, not a %.200s", tmp->ob_type->tp_name); |
| 4275 goto failed; | 4340 goto failed; |
| 4276 } | 4341 } |
| 4299 } | 4364 } |
| 4300 if (isinstance) { | 4365 if (isinstance) { |
| 4301 expr_ty exc; | 4366 expr_ty exc; |
| 4302 expr_ty cause; | 4367 expr_ty cause; |
| 4303 | 4368 |
| 4304 if (PyObject_HasAttrString(obj, "exc")) { | 4369 if (_PyObject_HasAttrId(obj, &PyId_exc)) { |
| 4305 int res; | 4370 int res; |
| 4306 tmp = PyObject_GetAttrString(obj, "exc"); | 4371 tmp = _PyObject_GetAttrId(obj, &PyId_exc); |
| 4307 if (tmp == NULL) goto failed; | 4372 if (tmp == NULL) goto failed; |
| 4308 res = obj2ast_expr(tmp, &exc, arena); | 4373 res = obj2ast_expr(tmp, &exc, arena); |
| 4309 if (res != 0) goto failed; | 4374 if (res != 0) goto failed; |
| 4310 Py_XDECREF(tmp); | 4375 Py_XDECREF(tmp); |
| 4311 tmp = NULL; | 4376 tmp = NULL; |
| 4312 } else { | 4377 } else { |
| 4313 exc = NULL; | 4378 exc = NULL; |
| 4314 } | 4379 } |
| 4315 if (PyObject_HasAttrString(obj, "cause")) { | 4380 if (_PyObject_HasAttrId(obj, &PyId_cause)) { |
| 4316 int res; | 4381 int res; |
| 4317 tmp = PyObject_GetAttrString(obj, "cause"); | 4382 tmp = _PyObject_GetAttrId(obj, &PyId_cause); |
| 4318 if (tmp == NULL) goto failed; | 4383 if (tmp == NULL) goto failed; |
| 4319 res = obj2ast_expr(tmp, &cause, arena); | 4384 res = obj2ast_expr(tmp, &cause, arena); |
| 4320 if (res != 0) goto failed; | 4385 if (res != 0) goto failed; |
| 4321 Py_XDECREF(tmp); | 4386 Py_XDECREF(tmp); |
| 4322 tmp = NULL; | 4387 tmp = NULL; |
| 4335 asdl_seq* body; | 4400 asdl_seq* body; |
| 4336 asdl_seq* handlers; | 4401 asdl_seq* handlers; |
| 4337 asdl_seq* orelse; | 4402 asdl_seq* orelse; |
| 4338 asdl_seq* finalbody; | 4403 asdl_seq* finalbody; |
| 4339 | 4404 |
| 4340 if (PyObject_HasAttrString(obj, "body")) { | 4405 if (_PyObject_HasAttrId(obj, &PyId_body)) { |
| 4341 int res; | 4406 int res; |
| 4342 Py_ssize_t len; | 4407 Py_ssize_t len; |
| 4343 Py_ssize_t i; | 4408 Py_ssize_t i; |
| 4344 tmp = PyObject_GetAttrString(obj, "body"); | 4409 tmp = _PyObject_GetAttrId(obj, &PyId_body); |
| 4345 if (tmp == NULL) goto failed; | 4410 if (tmp == NULL) goto failed; |
| 4346 if (!PyList_Check(tmp)) { | 4411 if (!PyList_Check(tmp)) { |
| 4347 PyErr_Format(PyExc_TypeError, "Try field \"body\" must be a list, not a %.200s", tmp->ob_type->tp_name); | 4412 PyErr_Format(PyExc_TypeError, "Try field \"body\" must be a list, not a %.200s", tmp->ob_type->tp_name); |
| 4348 goto failed; | 4413 goto failed; |
| 4349 } | 4414 } |
| 4360 tmp = NULL; | 4425 tmp = NULL; |
| 4361 } else { | 4426 } else { |
| 4362 PyErr_SetString(PyExc_TypeError, "required field \"body\" missing from Try"); | 4427 PyErr_SetString(PyExc_TypeError, "required field \"body\" missing from Try"); |
| 4363 return 1; | 4428 return 1; |
| 4364 } | 4429 } |
| 4365 if (PyObject_HasAttrString(obj, "handlers")) { | 4430 if (_PyObject_HasAttrId(obj, &PyId_handlers)) { |
| 4366 int res; | 4431 int res; |
| 4367 Py_ssize_t len; | 4432 Py_ssize_t len; |
| 4368 Py_ssize_t i; | 4433 Py_ssize_t i; |
| 4369 tmp = PyObject_GetAttrString(obj, "handlers"); | 4434 tmp = _PyObject_GetAttrId(obj, &PyId_handlers); |
| 4370 if (tmp == NULL) goto failed; | 4435 if (tmp == NULL) goto failed; |
| 4371 if (!PyList_Check(tmp)) { | 4436 if (!PyList_Check(tmp)) { |
| 4372 PyErr_Format(PyExc_TypeError, "Try field \"handlers\" must be a list, not a %.200s", tmp->ob_type->tp_name); | 4437 PyErr_Format(PyExc_TypeError, "Try field \"handlers\" must be a list, not a %.200s", tmp->ob_type->tp_name); |
| 4373 goto failed; | 4438 goto failed; |
| 4374 } | 4439 } |
| 4385 tmp = NULL; | 4450 tmp = NULL; |
| 4386 } else { | 4451 } else { |
| 4387 PyErr_SetString(PyExc_TypeError, "required field \"handlers\" missing from Try"); | 4452 PyErr_SetString(PyExc_TypeError, "required field \"handlers\" missing from Try"); |
| 4388 return 1; | 4453 return 1; |
| 4389 } | 4454 } |
| 4390 if (PyObject_HasAttrString(obj, "orelse")) { | 4455 if (_PyObject_HasAttrId(obj, &PyId_orelse)) { |
| 4391 int res; | 4456 int res; |
| 4392 Py_ssize_t len; | 4457 Py_ssize_t len; |
| 4393 Py_ssize_t i; | 4458 Py_ssize_t i; |
| 4394 tmp = PyObject_GetAttrString(obj, "orelse"); | 4459 tmp = _PyObject_GetAttrId(obj, &PyId_orelse); |
| 4395 if (tmp == NULL) goto failed; | 4460 if (tmp == NULL) goto failed; |
| 4396 if (!PyList_Check(tmp)) { | 4461 if (!PyList_Check(tmp)) { |
| 4397 PyErr_Format(PyExc_TypeError, "Try field \"orelse\" must be a list, not a %.200s", tmp->ob_type->tp_name); | 4462 PyErr_Format(PyExc_TypeError, "Try field \"orelse\" must be a list, not a %.200s", tmp->ob_type->tp_name); |
| 4398 goto failed; | 4463 goto failed; |
| 4399 } | 4464 } |
| 4410 tmp = NULL; | 4475 tmp = NULL; |
| 4411 } else { | 4476 } else { |
| 4412 PyErr_SetString(PyExc_TypeError, "required field \"orelse\" missing from Try"); | 4477 PyErr_SetString(PyExc_TypeError, "required field \"orelse\" missing from Try"); |
| 4413 return 1; | 4478 return 1; |
| 4414 } | 4479 } |
| 4415 if (PyObject_HasAttrString(obj, "finalbody")) { | 4480 if (_PyObject_HasAttrId(obj, &PyId_finalbody)) { |
| 4416 int res; | 4481 int res; |
| 4417 Py_ssize_t len; | 4482 Py_ssize_t len; |
| 4418 Py_ssize_t i; | 4483 Py_ssize_t i; |
| 4419 tmp = PyObject_GetAttrString(obj, "finalbody"); | 4484 tmp = _PyObject_GetAttrId(obj, &PyId_finalbody); |
| 4420 if (tmp == NULL) goto failed; | 4485 if (tmp == NULL) goto failed; |
| 4421 if (!PyList_Check(tmp)) { | 4486 if (!PyList_Check(tmp)) { |
| 4422 PyErr_Format(PyExc_TypeError, "Try field \"finalbody\" must be a list, not a %.200s", tmp->ob_type->tp_name); | 4487 PyErr_Format(PyExc_TypeError, "Try field \"finalbody\" must be a list, not a %.200s", tmp->ob_type->tp_name); |
| 4423 goto failed; | 4488 goto failed; |
| 4424 } | 4489 } |
| 4448 } | 4513 } |
| 4449 if (isinstance) { | 4514 if (isinstance) { |
| 4450 expr_ty test; | 4515 expr_ty test; |
| 4451 expr_ty msg; | 4516 expr_ty msg; |
| 4452 | 4517 |
| 4453 if (PyObject_HasAttrString(obj, "test")) { | 4518 if (_PyObject_HasAttrId(obj, &PyId_test)) { |
| 4454 int res; | 4519 int res; |
| 4455 tmp = PyObject_GetAttrString(obj, "test"); | 4520 tmp = _PyObject_GetAttrId(obj, &PyId_test); |
| 4456 if (tmp == NULL) goto failed; | 4521 if (tmp == NULL) goto failed; |
| 4457 res = obj2ast_expr(tmp, &test, arena); | 4522 res = obj2ast_expr(tmp, &test, arena); |
| 4458 if (res != 0) goto failed; | 4523 if (res != 0) goto failed; |
| 4459 Py_XDECREF(tmp); | 4524 Py_XDECREF(tmp); |
| 4460 tmp = NULL; | 4525 tmp = NULL; |
| 4461 } else { | 4526 } else { |
| 4462 PyErr_SetString(PyExc_TypeError, "required field \"test\" missing from Assert"); | 4527 PyErr_SetString(PyExc_TypeError, "required field \"test\" missing from Assert"); |
| 4463 return 1; | 4528 return 1; |
| 4464 } | 4529 } |
| 4465 if (PyObject_HasAttrString(obj, "msg")) { | 4530 if (_PyObject_HasAttrId(obj, &PyId_msg)) { |
| 4466 int res; | 4531 int res; |
| 4467 tmp = PyObject_GetAttrString(obj, "msg"); | 4532 tmp = _PyObject_GetAttrId(obj, &PyId_msg); |
| 4468 if (tmp == NULL) goto failed; | 4533 if (tmp == NULL) goto failed; |
| 4469 res = obj2ast_expr(tmp, &msg, arena); | 4534 res = obj2ast_expr(tmp, &msg, arena); |
| 4470 if (res != 0) goto failed; | 4535 if (res != 0) goto failed; |
| 4471 Py_XDECREF(tmp); | 4536 Py_XDECREF(tmp); |
| 4472 tmp = NULL; | 4537 tmp = NULL; |
| 4482 return 1; | 4547 return 1; |
| 4483 } | 4548 } |
| 4484 if (isinstance) { | 4549 if (isinstance) { |
| 4485 asdl_seq* names; | 4550 asdl_seq* names; |
| 4486 | 4551 |
| 4487 if (PyObject_HasAttrString(obj, "names")) { | 4552 if (_PyObject_HasAttrId(obj, &PyId_names)) { |
| 4488 int res; | 4553 int res; |
| 4489 Py_ssize_t len; | 4554 Py_ssize_t len; |
| 4490 Py_ssize_t i; | 4555 Py_ssize_t i; |
| 4491 tmp = PyObject_GetAttrString(obj, "names"); | 4556 tmp = _PyObject_GetAttrId(obj, &PyId_names); |
| 4492 if (tmp == NULL) goto failed; | 4557 if (tmp == NULL) goto failed; |
| 4493 if (!PyList_Check(tmp)) { | 4558 if (!PyList_Check(tmp)) { |
| 4494 PyErr_Format(PyExc_TypeError, "Import field \"names\" must be a list, not a %.200s", tmp->ob_type->tp_name); | 4559 PyErr_Format(PyExc_TypeError, "Import field \"names\" must be a list, not a %.200s", tmp->ob_type->tp_name); |
| 4495 goto failed; | 4560 goto failed; |
| 4496 } | 4561 } |
| 4520 if (isinstance) { | 4585 if (isinstance) { |
| 4521 identifier module; | 4586 identifier module; |
| 4522 asdl_seq* names; | 4587 asdl_seq* names; |
| 4523 int level; | 4588 int level; |
| 4524 | 4589 |
| 4525 if (PyObject_HasAttrString(obj, "module")) { | 4590 if (_PyObject_HasAttrId(obj, &PyId_module)) { |
| 4526 int res; | 4591 int res; |
| 4527 tmp = PyObject_GetAttrString(obj, "module"); | 4592 tmp = _PyObject_GetAttrId(obj, &PyId_module); |
| 4528 if (tmp == NULL) goto failed; | 4593 if (tmp == NULL) goto failed; |
| 4529 res = obj2ast_identifier(tmp, &module, arena); | 4594 res = obj2ast_identifier(tmp, &module, arena); |
| 4530 if (res != 0) goto failed; | 4595 if (res != 0) goto failed; |
| 4531 Py_XDECREF(tmp); | 4596 Py_XDECREF(tmp); |
| 4532 tmp = NULL; | 4597 tmp = NULL; |
| 4533 } else { | 4598 } else { |
| 4534 module = NULL; | 4599 module = NULL; |
| 4535 } | 4600 } |
| 4536 if (PyObject_HasAttrString(obj, "names")) { | 4601 if (_PyObject_HasAttrId(obj, &PyId_names)) { |
| 4537 int res; | 4602 int res; |
| 4538 Py_ssize_t len; | 4603 Py_ssize_t len; |
| 4539 Py_ssize_t i; | 4604 Py_ssize_t i; |
| 4540 tmp = PyObject_GetAttrString(obj, "names"); | 4605 tmp = _PyObject_GetAttrId(obj, &PyId_names); |
| 4541 if (tmp == NULL) goto failed; | 4606 if (tmp == NULL) goto failed; |
| 4542 if (!PyList_Check(tmp)) { | 4607 if (!PyList_Check(tmp)) { |
| 4543 PyErr_Format(PyExc_TypeError, "ImportFrom field \"names\" must be a list, not a %.200s", tmp->ob_type->tp_name); | 4608 PyErr_Format(PyExc_TypeError, "ImportFrom field \"names\" must be a list, not a %.200s", tmp->ob_type->tp_name); |
| 4544 goto failed; | 4609 goto failed; |
| 4545 } | 4610 } |
| 4556 tmp = NULL; | 4621 tmp = NULL; |
| 4557 } else { | 4622 } else { |
| 4558 PyErr_SetString(PyExc_TypeError, "required field \"names\" missing from ImportFrom"); | 4623 PyErr_SetString(PyExc_TypeError, "required field \"names\" missing from ImportFrom"); |
| 4559 return 1; | 4624 return 1; |
| 4560 } | 4625 } |
| 4561 if (PyObject_HasAttrString(obj, "level")) { | 4626 if (_PyObject_HasAttrId(obj, &PyId_level)) { |
| 4562 int res; | 4627 int res; |
| 4563 tmp = PyObject_GetAttrString(obj, "level"); | 4628 tmp = _PyObject_GetAttrId(obj, &PyId_level); |
| 4564 if (tmp == NULL) goto failed; | 4629 if (tmp == NULL) goto failed; |
| 4565 res = obj2ast_int(tmp, &level, arena); | 4630 res = obj2ast_int(tmp, &level, arena); |
| 4566 if (res != 0) goto failed; | 4631 if (res != 0) goto failed; |
| 4567 Py_XDECREF(tmp); | 4632 Py_XDECREF(tmp); |
| 4568 tmp = NULL; | 4633 tmp = NULL; |
| 4579 return 1; | 4644 return 1; |
| 4580 } | 4645 } |
| 4581 if (isinstance) { | 4646 if (isinstance) { |
| 4582 asdl_seq* names; | 4647 asdl_seq* names; |
| 4583 | 4648 |
| 4584 if (PyObject_HasAttrString(obj, "names")) { | 4649 if (_PyObject_HasAttrId(obj, &PyId_names)) { |
| 4585 int res; | 4650 int res; |
| 4586 Py_ssize_t len; | 4651 Py_ssize_t len; |
| 4587 Py_ssize_t i; | 4652 Py_ssize_t i; |
| 4588 tmp = PyObject_GetAttrString(obj, "names"); | 4653 tmp = _PyObject_GetAttrId(obj, &PyId_names); |
| 4589 if (tmp == NULL) goto failed; | 4654 if (tmp == NULL) goto failed; |
| 4590 if (!PyList_Check(tmp)) { | 4655 if (!PyList_Check(tmp)) { |
| 4591 PyErr_Format(PyExc_TypeError, "Global field \"names\" must be a list, not a %.200s", tmp->ob_type->tp_name); | 4656 PyErr_Format(PyExc_TypeError, "Global field \"names\" must be a list, not a %.200s", tmp->ob_type->tp_name); |
| 4592 goto failed; | 4657 goto failed; |
| 4593 } | 4658 } |
| 4615 return 1; | 4680 return 1; |
| 4616 } | 4681 } |
| 4617 if (isinstance) { | 4682 if (isinstance) { |
| 4618 asdl_seq* names; | 4683 asdl_seq* names; |
| 4619 | 4684 |
| 4620 if (PyObject_HasAttrString(obj, "names")) { | 4685 if (_PyObject_HasAttrId(obj, &PyId_names)) { |
| 4621 int res; | 4686 int res; |
| 4622 Py_ssize_t len; | 4687 Py_ssize_t len; |
| 4623 Py_ssize_t i; | 4688 Py_ssize_t i; |
| 4624 tmp = PyObject_GetAttrString(obj, "names"); | 4689 tmp = _PyObject_GetAttrId(obj, &PyId_names); |
| 4625 if (tmp == NULL) goto failed; | 4690 if (tmp == NULL) goto failed; |
| 4626 if (!PyList_Check(tmp)) { | 4691 if (!PyList_Check(tmp)) { |
| 4627 PyErr_Format(PyExc_TypeError, "Nonlocal field \"names\" must be a list, not a %.200s", tmp->ob_type->tp_name); | 4692 PyErr_Format(PyExc_TypeError, "Nonlocal field \"names\" must be a list, not a %.200s", tmp->ob_type->tp_name); |
| 4628 goto failed; | 4693 goto failed; |
| 4629 } | 4694 } |
| 4651 return 1; | 4716 return 1; |
| 4652 } | 4717 } |
| 4653 if (isinstance) { | 4718 if (isinstance) { |
| 4654 expr_ty value; | 4719 expr_ty value; |
| 4655 | 4720 |
| 4656 if (PyObject_HasAttrString(obj, "value")) { | 4721 if (_PyObject_HasAttrId(obj, &PyId_value)) { |
| 4657 int res; | 4722 int res; |
| 4658 tmp = PyObject_GetAttrString(obj, "value"); | 4723 tmp = _PyObject_GetAttrId(obj, &PyId_value); |
| 4659 if (tmp == NULL) goto failed; | 4724 if (tmp == NULL) goto failed; |
| 4660 res = obj2ast_expr(tmp, &value, arena); | 4725 res = obj2ast_expr(tmp, &value, arena); |
| 4661 if (res != 0) goto failed; | 4726 if (res != 0) goto failed; |
| 4662 Py_XDECREF(tmp); | 4727 Py_XDECREF(tmp); |
| 4663 tmp = NULL; | 4728 tmp = NULL; |
| 4717 | 4782 |
| 4718 if (obj == Py_None) { | 4783 if (obj == Py_None) { |
| 4719 *out = NULL; | 4784 *out = NULL; |
| 4720 return 0; | 4785 return 0; |
| 4721 } | 4786 } |
| 4722 if (PyObject_HasAttrString(obj, "lineno")) { | 4787 if (_PyObject_HasAttrId(obj, &PyId_lineno)) { |
| 4723 int res; | 4788 int res; |
| 4724 tmp = PyObject_GetAttrString(obj, "lineno"); | 4789 tmp = _PyObject_GetAttrId(obj, &PyId_lineno); |
| 4725 if (tmp == NULL) goto failed; | 4790 if (tmp == NULL) goto failed; |
| 4726 res = obj2ast_int(tmp, &lineno, arena); | 4791 res = obj2ast_int(tmp, &lineno, arena); |
| 4727 if (res != 0) goto failed; | 4792 if (res != 0) goto failed; |
| 4728 Py_XDECREF(tmp); | 4793 Py_XDECREF(tmp); |
| 4729 tmp = NULL; | 4794 tmp = NULL; |
| 4730 } else { | 4795 } else { |
| 4731 PyErr_SetString(PyExc_TypeError, "required field \"lineno\" missing from expr"); | 4796 PyErr_SetString(PyExc_TypeError, "required field \"lineno\" missing from expr"); |
| 4732 return 1; | 4797 return 1; |
| 4733 } | 4798 } |
| 4734 if (PyObject_HasAttrString(obj, "col_offset")) { | 4799 if (_PyObject_HasAttrId(obj, &PyId_col_offset)) { |
| 4735 int res; | 4800 int res; |
| 4736 tmp = PyObject_GetAttrString(obj, "col_offset"); | 4801 tmp = _PyObject_GetAttrId(obj, &PyId_col_offset); |
| 4737 if (tmp == NULL) goto failed; | 4802 if (tmp == NULL) goto failed; |
| 4738 res = obj2ast_int(tmp, &col_offset, arena); | 4803 res = obj2ast_int(tmp, &col_offset, arena); |
| 4739 if (res != 0) goto failed; | 4804 if (res != 0) goto failed; |
| 4740 Py_XDECREF(tmp); | 4805 Py_XDECREF(tmp); |
| 4741 tmp = NULL; | 4806 tmp = NULL; |
| 4749 } | 4814 } |
| 4750 if (isinstance) { | 4815 if (isinstance) { |
| 4751 boolop_ty op; | 4816 boolop_ty op; |
| 4752 asdl_seq* values; | 4817 asdl_seq* values; |
| 4753 | 4818 |
| 4754 if (PyObject_HasAttrString(obj, "op")) { | 4819 if (_PyObject_HasAttrId(obj, &PyId_op)) { |
| 4755 int res; | 4820 int res; |
| 4756 tmp = PyObject_GetAttrString(obj, "op"); | 4821 tmp = _PyObject_GetAttrId(obj, &PyId_op); |
| 4757 if (tmp == NULL) goto failed; | 4822 if (tmp == NULL) goto failed; |
| 4758 res = obj2ast_boolop(tmp, &op, arena); | 4823 res = obj2ast_boolop(tmp, &op, arena); |
| 4759 if (res != 0) goto failed; | 4824 if (res != 0) goto failed; |
| 4760 Py_XDECREF(tmp); | 4825 Py_XDECREF(tmp); |
| 4761 tmp = NULL; | 4826 tmp = NULL; |
| 4762 } else { | 4827 } else { |
| 4763 PyErr_SetString(PyExc_TypeError, "required field \"op\" missing from BoolOp"); | 4828 PyErr_SetString(PyExc_TypeError, "required field \"op\" missing from BoolOp"); |
| 4764 return 1; | 4829 return 1; |
| 4765 } | 4830 } |
| 4766 if (PyObject_HasAttrString(obj, "values")) { | 4831 if (_PyObject_HasAttrId(obj, &PyId_values)) { |
| 4767 int res; | 4832 int res; |
| 4768 Py_ssize_t len; | 4833 Py_ssize_t len; |
| 4769 Py_ssize_t i; | 4834 Py_ssize_t i; |
| 4770 tmp = PyObject_GetAttrString(obj, "values"); | 4835 tmp = _PyObject_GetAttrId(obj, &PyId_values); |
| 4771 if (tmp == NULL) goto failed; | 4836 if (tmp == NULL) goto failed; |
| 4772 if (!PyList_Check(tmp)) { | 4837 if (!PyList_Check(tmp)) { |
| 4773 PyErr_Format(PyExc_TypeError, "BoolOp field \"values\" must be a list, not a %.200s", tmp->ob_type->tp_name); | 4838 PyErr_Format(PyExc_TypeError, "BoolOp field \"values\" must be a list, not a %.200s", tmp->ob_type->tp_name); |
| 4774 goto failed; | 4839 goto failed; |
| 4775 } | 4840 } |
| 4799 if (isinstance) { | 4864 if (isinstance) { |
| 4800 expr_ty left; | 4865 expr_ty left; |
| 4801 operator_ty op; | 4866 operator_ty op; |
| 4802 expr_ty right; | 4867 expr_ty right; |
| 4803 | 4868 |
| 4804 if (PyObject_HasAttrString(obj, "left")) { | 4869 if (_PyObject_HasAttrId(obj, &PyId_left)) { |
| 4805 int res; | 4870 int res; |
| 4806 tmp = PyObject_GetAttrString(obj, "left"); | 4871 tmp = _PyObject_GetAttrId(obj, &PyId_left); |
| 4807 if (tmp == NULL) goto failed; | 4872 if (tmp == NULL) goto failed; |
| 4808 res = obj2ast_expr(tmp, &left, arena); | 4873 res = obj2ast_expr(tmp, &left, arena); |
| 4809 if (res != 0) goto failed; | 4874 if (res != 0) goto failed; |
| 4810 Py_XDECREF(tmp); | 4875 Py_XDECREF(tmp); |
| 4811 tmp = NULL; | 4876 tmp = NULL; |
| 4812 } else { | 4877 } else { |
| 4813 PyErr_SetString(PyExc_TypeError, "required field \"left\" missing from BinOp"); | 4878 PyErr_SetString(PyExc_TypeError, "required field \"left\" missing from BinOp"); |
| 4814 return 1; | 4879 return 1; |
| 4815 } | 4880 } |
| 4816 if (PyObject_HasAttrString(obj, "op")) { | 4881 if (_PyObject_HasAttrId(obj, &PyId_op)) { |
| 4817 int res; | 4882 int res; |
| 4818 tmp = PyObject_GetAttrString(obj, "op"); | 4883 tmp = _PyObject_GetAttrId(obj, &PyId_op); |
| 4819 if (tmp == NULL) goto failed; | 4884 if (tmp == NULL) goto failed; |
| 4820 res = obj2ast_operator(tmp, &op, arena); | 4885 res = obj2ast_operator(tmp, &op, arena); |
| 4821 if (res != 0) goto failed; | 4886 if (res != 0) goto failed; |
| 4822 Py_XDECREF(tmp); | 4887 Py_XDECREF(tmp); |
| 4823 tmp = NULL; | 4888 tmp = NULL; |
| 4824 } else { | 4889 } else { |
| 4825 PyErr_SetString(PyExc_TypeError, "required field \"op\" missing from BinOp"); | 4890 PyErr_SetString(PyExc_TypeError, "required field \"op\" missing from BinOp"); |
| 4826 return 1; | 4891 return 1; |
| 4827 } | 4892 } |
| 4828 if (PyObject_HasAttrString(obj, "right")) { | 4893 if (_PyObject_HasAttrId(obj, &PyId_right)) { |
| 4829 int res; | 4894 int res; |
| 4830 tmp = PyObject_GetAttrString(obj, "right"); | 4895 tmp = _PyObject_GetAttrId(obj, &PyId_right); |
| 4831 if (tmp == NULL) goto failed; | 4896 if (tmp == NULL) goto failed; |
| 4832 res = obj2ast_expr(tmp, &right, arena); | 4897 res = obj2ast_expr(tmp, &right, arena); |
| 4833 if (res != 0) goto failed; | 4898 if (res != 0) goto failed; |
| 4834 Py_XDECREF(tmp); | 4899 Py_XDECREF(tmp); |
| 4835 tmp = NULL; | 4900 tmp = NULL; |
| 4847 } | 4912 } |
| 4848 if (isinstance) { | 4913 if (isinstance) { |
| 4849 unaryop_ty op; | 4914 unaryop_ty op; |
| 4850 expr_ty operand; | 4915 expr_ty operand; |
| 4851 | 4916 |
| 4852 if (PyObject_HasAttrString(obj, "op")) { | 4917 if (_PyObject_HasAttrId(obj, &PyId_op)) { |
| 4853 int res; | 4918 int res; |
| 4854 tmp = PyObject_GetAttrString(obj, "op"); | 4919 tmp = _PyObject_GetAttrId(obj, &PyId_op); |
| 4855 if (tmp == NULL) goto failed; | 4920 if (tmp == NULL) goto failed; |
| 4856 res = obj2ast_unaryop(tmp, &op, arena); | 4921 res = obj2ast_unaryop(tmp, &op, arena); |
| 4857 if (res != 0) goto failed; | 4922 if (res != 0) goto failed; |
| 4858 Py_XDECREF(tmp); | 4923 Py_XDECREF(tmp); |
| 4859 tmp = NULL; | 4924 tmp = NULL; |
| 4860 } else { | 4925 } else { |
| 4861 PyErr_SetString(PyExc_TypeError, "required field \"op\" missing from UnaryOp"); | 4926 PyErr_SetString(PyExc_TypeError, "required field \"op\" missing from UnaryOp"); |
| 4862 return 1; | 4927 return 1; |
| 4863 } | 4928 } |
| 4864 if (PyObject_HasAttrString(obj, "operand")) { | 4929 if (_PyObject_HasAttrId(obj, &PyId_operand)) { |
| 4865 int res; | 4930 int res; |
| 4866 tmp = PyObject_GetAttrString(obj, "operand"); | 4931 tmp = _PyObject_GetAttrId(obj, &PyId_operand); |
| 4867 if (tmp == NULL) goto failed; | 4932 if (tmp == NULL) goto failed; |
| 4868 res = obj2ast_expr(tmp, &operand, arena); | 4933 res = obj2ast_expr(tmp, &operand, arena); |
| 4869 if (res != 0) goto failed; | 4934 if (res != 0) goto failed; |
| 4870 Py_XDECREF(tmp); | 4935 Py_XDECREF(tmp); |
| 4871 tmp = NULL; | 4936 tmp = NULL; |
| 4883 } | 4948 } |
| 4884 if (isinstance) { | 4949 if (isinstance) { |
| 4885 arguments_ty args; | 4950 arguments_ty args; |
| 4886 expr_ty body; | 4951 expr_ty body; |
| 4887 | 4952 |
| 4888 if (PyObject_HasAttrString(obj, "args")) { | 4953 if (_PyObject_HasAttrId(obj, &PyId_args)) { |
| 4889 int res; | 4954 int res; |
| 4890 tmp = PyObject_GetAttrString(obj, "args"); | 4955 tmp = _PyObject_GetAttrId(obj, &PyId_args); |
| 4891 if (tmp == NULL) goto failed; | 4956 if (tmp == NULL) goto failed; |
| 4892 res = obj2ast_arguments(tmp, &args, arena); | 4957 res = obj2ast_arguments(tmp, &args, arena); |
| 4893 if (res != 0) goto failed; | 4958 if (res != 0) goto failed; |
| 4894 Py_XDECREF(tmp); | 4959 Py_XDECREF(tmp); |
| 4895 tmp = NULL; | 4960 tmp = NULL; |
| 4896 } else { | 4961 } else { |
| 4897 PyErr_SetString(PyExc_TypeError, "required field \"args\" missing from Lambda"); | 4962 PyErr_SetString(PyExc_TypeError, "required field \"args\" missing from Lambda"); |
| 4898 return 1; | 4963 return 1; |
| 4899 } | 4964 } |
| 4900 if (PyObject_HasAttrString(obj, "body")) { | 4965 if (_PyObject_HasAttrId(obj, &PyId_body)) { |
| 4901 int res; | 4966 int res; |
| 4902 tmp = PyObject_GetAttrString(obj, "body"); | 4967 tmp = _PyObject_GetAttrId(obj, &PyId_body); |
| 4903 if (tmp == NULL) goto failed; | 4968 if (tmp == NULL) goto failed; |
| 4904 res = obj2ast_expr(tmp, &body, arena); | 4969 res = obj2ast_expr(tmp, &body, arena); |
| 4905 if (res != 0) goto failed; | 4970 if (res != 0) goto failed; |
| 4906 Py_XDECREF(tmp); | 4971 Py_XDECREF(tmp); |
| 4907 tmp = NULL; | 4972 tmp = NULL; |
| 4920 if (isinstance) { | 4985 if (isinstance) { |
| 4921 expr_ty test; | 4986 expr_ty test; |
| 4922 expr_ty body; | 4987 expr_ty body; |
| 4923 expr_ty orelse; | 4988 expr_ty orelse; |
| 4924 | 4989 |
| 4925 if (PyObject_HasAttrString(obj, "test")) { | 4990 if (_PyObject_HasAttrId(obj, &PyId_test)) { |
| 4926 int res; | 4991 int res; |
| 4927 tmp = PyObject_GetAttrString(obj, "test"); | 4992 tmp = _PyObject_GetAttrId(obj, &PyId_test); |
| 4928 if (tmp == NULL) goto failed; | 4993 if (tmp == NULL) goto failed; |
| 4929 res = obj2ast_expr(tmp, &test, arena); | 4994 res = obj2ast_expr(tmp, &test, arena); |
| 4930 if (res != 0) goto failed; | 4995 if (res != 0) goto failed; |
| 4931 Py_XDECREF(tmp); | 4996 Py_XDECREF(tmp); |
| 4932 tmp = NULL; | 4997 tmp = NULL; |
| 4933 } else { | 4998 } else { |
| 4934 PyErr_SetString(PyExc_TypeError, "required field \"test\" missing from IfExp"); | 4999 PyErr_SetString(PyExc_TypeError, "required field \"test\" missing from IfExp"); |
| 4935 return 1; | 5000 return 1; |
| 4936 } | 5001 } |
| 4937 if (PyObject_HasAttrString(obj, "body")) { | 5002 if (_PyObject_HasAttrId(obj, &PyId_body)) { |
| 4938 int res; | 5003 int res; |
| 4939 tmp = PyObject_GetAttrString(obj, "body"); | 5004 tmp = _PyObject_GetAttrId(obj, &PyId_body); |
| 4940 if (tmp == NULL) goto failed; | 5005 if (tmp == NULL) goto failed; |
| 4941 res = obj2ast_expr(tmp, &body, arena); | 5006 res = obj2ast_expr(tmp, &body, arena); |
| 4942 if (res != 0) goto failed; | 5007 if (res != 0) goto failed; |
| 4943 Py_XDECREF(tmp); | 5008 Py_XDECREF(tmp); |
| 4944 tmp = NULL; | 5009 tmp = NULL; |
| 4945 } else { | 5010 } else { |
| 4946 PyErr_SetString(PyExc_TypeError, "required field \"body\" missing from IfExp"); | 5011 PyErr_SetString(PyExc_TypeError, "required field \"body\" missing from IfExp"); |
| 4947 return 1; | 5012 return 1; |
| 4948 } | 5013 } |
| 4949 if (PyObject_HasAttrString(obj, "orelse")) { | 5014 if (_PyObject_HasAttrId(obj, &PyId_orelse)) { |
| 4950 int res; | 5015 int res; |
| 4951 tmp = PyObject_GetAttrString(obj, "orelse"); | 5016 tmp = _PyObject_GetAttrId(obj, &PyId_orelse); |
| 4952 if (tmp == NULL) goto failed; | 5017 if (tmp == NULL) goto failed; |
| 4953 res = obj2ast_expr(tmp, &orelse, arena); | 5018 res = obj2ast_expr(tmp, &orelse, arena); |
| 4954 if (res != 0) goto failed; | 5019 if (res != 0) goto failed; |
| 4955 Py_XDECREF(tmp); | 5020 Py_XDECREF(tmp); |
| 4956 tmp = NULL; | 5021 tmp = NULL; |
| 4968 } | 5033 } |
| 4969 if (isinstance) { | 5034 if (isinstance) { |
| 4970 asdl_seq* keys; | 5035 asdl_seq* keys; |
| 4971 asdl_seq* values; | 5036 asdl_seq* values; |
| 4972 | 5037 |
| 4973 if (PyObject_HasAttrString(obj, "keys")) { | 5038 if (_PyObject_HasAttrId(obj, &PyId_keys)) { |
| 4974 int res; | 5039 int res; |
| 4975 Py_ssize_t len; | 5040 Py_ssize_t len; |
| 4976 Py_ssize_t i; | 5041 Py_ssize_t i; |
| 4977 tmp = PyObject_GetAttrString(obj, "keys"); | 5042 tmp = _PyObject_GetAttrId(obj, &PyId_keys); |
| 4978 if (tmp == NULL) goto failed; | 5043 if (tmp == NULL) goto failed; |
| 4979 if (!PyList_Check(tmp)) { | 5044 if (!PyList_Check(tmp)) { |
| 4980 PyErr_Format(PyExc_TypeError, "Dict field \"keys\" must be a list, not a %.200s", tmp->ob_type->tp_name); | 5045 PyErr_Format(PyExc_TypeError, "Dict field \"keys\" must be a list, not a %.200s", tmp->ob_type->tp_name); |
| 4981 goto failed; | 5046 goto failed; |
| 4982 } | 5047 } |
| 4993 tmp = NULL; | 5058 tmp = NULL; |
| 4994 } else { | 5059 } else { |
| 4995 PyErr_SetString(PyExc_TypeError, "required field \"keys\" missing from Dict"); | 5060 PyErr_SetString(PyExc_TypeError, "required field \"keys\" missing from Dict"); |
| 4996 return 1; | 5061 return 1; |
| 4997 } | 5062 } |
| 4998 if (PyObject_HasAttrString(obj, "values")) { | 5063 if (_PyObject_HasAttrId(obj, &PyId_values)) { |
| 4999 int res; | 5064 int res; |
| 5000 Py_ssize_t len; | 5065 Py_ssize_t len; |
| 5001 Py_ssize_t i; | 5066 Py_ssize_t i; |
| 5002 tmp = PyObject_GetAttrString(obj, "values"); | 5067 tmp = _PyObject_GetAttrId(obj, &PyId_values); |
| 5003 if (tmp == NULL) goto failed; | 5068 if (tmp == NULL) goto failed; |
| 5004 if (!PyList_Check(tmp)) { | 5069 if (!PyList_Check(tmp)) { |
| 5005 PyErr_Format(PyExc_TypeError, "Dict field \"values\" must be a list, not a %.200s", tmp->ob_type->tp_name); | 5070 PyErr_Format(PyExc_TypeError, "Dict field \"values\" must be a list, not a %.200s", tmp->ob_type->tp_name); |
| 5006 goto failed; | 5071 goto failed; |
| 5007 } | 5072 } |
| 5029 return 1; | 5094 return 1; |
| 5030 } | 5095 } |
| 5031 if (isinstance) { | 5096 if (isinstance) { |
| 5032 asdl_seq* elts; | 5097 asdl_seq* elts; |
| 5033 | 5098 |
| 5034 if (PyObject_HasAttrString(obj, "elts")) { | 5099 if (_PyObject_HasAttrId(obj, &PyId_elts)) { |
| 5035 int res; | 5100 int res; |
| 5036 Py_ssize_t len; | 5101 Py_ssize_t len; |
| 5037 Py_ssize_t i; | 5102 Py_ssize_t i; |
| 5038 tmp = PyObject_GetAttrString(obj, "elts"); | 5103 tmp = _PyObject_GetAttrId(obj, &PyId_elts); |
| 5039 if (tmp == NULL) goto failed; | 5104 if (tmp == NULL) goto failed; |
| 5040 if (!PyList_Check(tmp)) { | 5105 if (!PyList_Check(tmp)) { |
| 5041 PyErr_Format(PyExc_TypeError, "Set field \"elts\" must be a list, not a %.200s", tmp->ob_type->tp_name); | 5106 PyErr_Format(PyExc_TypeError, "Set field \"elts\" must be a list, not a %.200s", tmp->ob_type->tp_name); |
| 5042 goto failed; | 5107 goto failed; |
| 5043 } | 5108 } |
| 5066 } | 5131 } |
| 5067 if (isinstance) { | 5132 if (isinstance) { |
| 5068 expr_ty elt; | 5133 expr_ty elt; |
| 5069 asdl_seq* generators; | 5134 asdl_seq* generators; |
| 5070 | 5135 |
| 5071 if (PyObject_HasAttrString(obj, "elt")) { | 5136 if (_PyObject_HasAttrId(obj, &PyId_elt)) { |
| 5072 int res; | 5137 int res; |
| 5073 tmp = PyObject_GetAttrString(obj, "elt"); | 5138 tmp = _PyObject_GetAttrId(obj, &PyId_elt); |
| 5074 if (tmp == NULL) goto failed; | 5139 if (tmp == NULL) goto failed; |
| 5075 res = obj2ast_expr(tmp, &elt, arena); | 5140 res = obj2ast_expr(tmp, &elt, arena); |
| 5076 if (res != 0) goto failed; | 5141 if (res != 0) goto failed; |
| 5077 Py_XDECREF(tmp); | 5142 Py_XDECREF(tmp); |
| 5078 tmp = NULL; | 5143 tmp = NULL; |
| 5079 } else { | 5144 } else { |
| 5080 PyErr_SetString(PyExc_TypeError, "required field \"elt\" missing from ListComp"); | 5145 PyErr_SetString(PyExc_TypeError, "required field \"elt\" missing from ListComp"); |
| 5081 return 1; | 5146 return 1; |
| 5082 } | 5147 } |
| 5083 if (PyObject_HasAttrString(obj, "generators")) { | 5148 if (_PyObject_HasAttrId(obj, &PyId_generators)) { |
| 5084 int res; | 5149 int res; |
| 5085 Py_ssize_t len; | 5150 Py_ssize_t len; |
| 5086 Py_ssize_t i; | 5151 Py_ssize_t i; |
| 5087 tmp = PyObject_GetAttrString(obj, "generators"); | 5152 tmp = _PyObject_GetAttrId(obj, &PyId_generators); |
| 5088 if (tmp == NULL) goto failed; | 5153 if (tmp == NULL) goto failed; |
| 5089 if (!PyList_Check(tmp)) { | 5154 if (!PyList_Check(tmp)) { |
| 5090 PyErr_Format(PyExc_TypeError, "ListComp field \"generators\" must be a list, not a %.200s", tmp->ob_type->tp_name); | 5155 PyErr_Format(PyExc_TypeError, "ListComp field \"generators\" must be a list, not a %.200s", tmp->ob_type->tp_name); |
| 5091 goto failed; | 5156 goto failed; |
| 5092 } | 5157 } |
| 5115 } | 5180 } |
| 5116 if (isinstance) { | 5181 if (isinstance) { |
| 5117 expr_ty elt; | 5182 expr_ty elt; |
| 5118 asdl_seq* generators; | 5183 asdl_seq* generators; |
| 5119 | 5184 |
| 5120 if (PyObject_HasAttrString(obj, "elt")) { | 5185 if (_PyObject_HasAttrId(obj, &PyId_elt)) { |
| 5121 int res; | 5186 int res; |
| 5122 tmp = PyObject_GetAttrString(obj, "elt"); | 5187 tmp = _PyObject_GetAttrId(obj, &PyId_elt); |
| 5123 if (tmp == NULL) goto failed; | 5188 if (tmp == NULL) goto failed; |
| 5124 res = obj2ast_expr(tmp, &elt, arena); | 5189 res = obj2ast_expr(tmp, &elt, arena); |
| 5125 if (res != 0) goto failed; | 5190 if (res != 0) goto failed; |
| 5126 Py_XDECREF(tmp); | 5191 Py_XDECREF(tmp); |
| 5127 tmp = NULL; | 5192 tmp = NULL; |
| 5128 } else { | 5193 } else { |
| 5129 PyErr_SetString(PyExc_TypeError, "required field \"elt\" missing from SetComp"); | 5194 PyErr_SetString(PyExc_TypeError, "required field \"elt\" missing from SetComp"); |
| 5130 return 1; | 5195 return 1; |
| 5131 } | 5196 } |
| 5132 if (PyObject_HasAttrString(obj, "generators")) { | 5197 if (_PyObject_HasAttrId(obj, &PyId_generators)) { |
| 5133 int res; | 5198 int res; |
| 5134 Py_ssize_t len; | 5199 Py_ssize_t len; |
| 5135 Py_ssize_t i; | 5200 Py_ssize_t i; |
| 5136 tmp = PyObject_GetAttrString(obj, "generators"); | 5201 tmp = _PyObject_GetAttrId(obj, &PyId_generators); |
| 5137 if (tmp == NULL) goto failed; | 5202 if (tmp == NULL) goto failed; |
| 5138 if (!PyList_Check(tmp)) { | 5203 if (!PyList_Check(tmp)) { |
| 5139 PyErr_Format(PyExc_TypeError, "SetComp field \"generators\" must be a list, not a %.200s", tmp->ob_type->tp_name); | 5204 PyErr_Format(PyExc_TypeError, "SetComp field \"generators\" must be a list, not a %.200s", tmp->ob_type->tp_name); |
| 5140 goto failed; | 5205 goto failed; |
| 5141 } | 5206 } |
| 5165 if (isinstance) { | 5230 if (isinstance) { |
| 5166 expr_ty key; | 5231 expr_ty key; |
| 5167 expr_ty value; | 5232 expr_ty value; |
| 5168 asdl_seq* generators; | 5233 asdl_seq* generators; |
| 5169 | 5234 |
| 5170 if (PyObject_HasAttrString(obj, "key")) { | 5235 if (_PyObject_HasAttrId(obj, &PyId_key)) { |
| 5171 int res; | 5236 int res; |
| 5172 tmp = PyObject_GetAttrString(obj, "key"); | 5237 tmp = _PyObject_GetAttrId(obj, &PyId_key); |
| 5173 if (tmp == NULL) goto failed; | 5238 if (tmp == NULL) goto failed; |
| 5174 res = obj2ast_expr(tmp, &key, arena); | 5239 res = obj2ast_expr(tmp, &key, arena); |
| 5175 if (res != 0) goto failed; | 5240 if (res != 0) goto failed; |
| 5176 Py_XDECREF(tmp); | 5241 Py_XDECREF(tmp); |
| 5177 tmp = NULL; | 5242 tmp = NULL; |
| 5178 } else { | 5243 } else { |
| 5179 PyErr_SetString(PyExc_TypeError, "required field \"key\" missing from DictComp"); | 5244 PyErr_SetString(PyExc_TypeError, "required field \"key\" missing from DictComp"); |
| 5180 return 1; | 5245 return 1; |
| 5181 } | 5246 } |
| 5182 if (PyObject_HasAttrString(obj, "value")) { | 5247 if (_PyObject_HasAttrId(obj, &PyId_value)) { |
| 5183 int res; | 5248 int res; |
| 5184 tmp = PyObject_GetAttrString(obj, "value"); | 5249 tmp = _PyObject_GetAttrId(obj, &PyId_value); |
| 5185 if (tmp == NULL) goto failed; | 5250 if (tmp == NULL) goto failed; |
| 5186 res = obj2ast_expr(tmp, &value, arena); | 5251 res = obj2ast_expr(tmp, &value, arena); |
| 5187 if (res != 0) goto failed; | 5252 if (res != 0) goto failed; |
| 5188 Py_XDECREF(tmp); | 5253 Py_XDECREF(tmp); |
| 5189 tmp = NULL; | 5254 tmp = NULL; |
| 5190 } else { | 5255 } else { |
| 5191 PyErr_SetString(PyExc_TypeError, "required field \"value\" missing from DictComp"); | 5256 PyErr_SetString(PyExc_TypeError, "required field \"value\" missing from DictComp"); |
| 5192 return 1; | 5257 return 1; |
| 5193 } | 5258 } |
| 5194 if (PyObject_HasAttrString(obj, "generators")) { | 5259 if (_PyObject_HasAttrId(obj, &PyId_generators)) { |
| 5195 int res; | 5260 int res; |
| 5196 Py_ssize_t len; | 5261 Py_ssize_t len; |
| 5197 Py_ssize_t i; | 5262 Py_ssize_t i; |
| 5198 tmp = PyObject_GetAttrString(obj, "generators"); | 5263 tmp = _PyObject_GetAttrId(obj, &PyId_generators); |
| 5199 if (tmp == NULL) goto failed; | 5264 if (tmp == NULL) goto failed; |
| 5200 if (!PyList_Check(tmp)) { | 5265 if (!PyList_Check(tmp)) { |
| 5201 PyErr_Format(PyExc_TypeError, "DictComp field \"generators\" must be a list, not a %.200s", tmp->ob_type->tp_name); | 5266 PyErr_Format(PyExc_TypeError, "DictComp field \"generators\" must be a list, not a %.200s", tmp->ob_type->tp_name); |
| 5202 goto failed; | 5267 goto failed; |
| 5203 } | 5268 } |
| 5227 } | 5292 } |
| 5228 if (isinstance) { | 5293 if (isinstance) { |
| 5229 expr_ty elt; | 5294 expr_ty elt; |
| 5230 asdl_seq* generators; | 5295 asdl_seq* generators; |
| 5231 | 5296 |
| 5232 if (PyObject_HasAttrString(obj, "elt")) { | 5297 if (_PyObject_HasAttrId(obj, &PyId_elt)) { |
| 5233 int res; | 5298 int res; |
| 5234 tmp = PyObject_GetAttrString(obj, "elt"); | 5299 tmp = _PyObject_GetAttrId(obj, &PyId_elt); |
| 5235 if (tmp == NULL) goto failed; | 5300 if (tmp == NULL) goto failed; |
| 5236 res = obj2ast_expr(tmp, &elt, arena); | 5301 res = obj2ast_expr(tmp, &elt, arena); |
| 5237 if (res != 0) goto failed; | 5302 if (res != 0) goto failed; |
| 5238 Py_XDECREF(tmp); | 5303 Py_XDECREF(tmp); |
| 5239 tmp = NULL; | 5304 tmp = NULL; |
| 5240 } else { | 5305 } else { |
| 5241 PyErr_SetString(PyExc_TypeError, "required field \"elt\" missing from GeneratorExp"); | 5306 PyErr_SetString(PyExc_TypeError, "required field \"elt\" missing from GeneratorExp"); |
| 5242 return 1; | 5307 return 1; |
| 5243 } | 5308 } |
| 5244 if (PyObject_HasAttrString(obj, "generators")) { | 5309 if (_PyObject_HasAttrId(obj, &PyId_generators)) { |
| 5245 int res; | 5310 int res; |
| 5246 Py_ssize_t len; | 5311 Py_ssize_t len; |
| 5247 Py_ssize_t i; | 5312 Py_ssize_t i; |
| 5248 tmp = PyObject_GetAttrString(obj, "generators"); | 5313 tmp = _PyObject_GetAttrId(obj, &PyId_generators); |
| 5249 if (tmp == NULL) goto failed; | 5314 if (tmp == NULL) goto failed; |
| 5250 if (!PyList_Check(tmp)) { | 5315 if (!PyList_Check(tmp)) { |
| 5251 PyErr_Format(PyExc_TypeError, "GeneratorExp field \"generators\" must be a list, not a %.200s", tmp->ob_type->tp_name); | 5316 PyErr_Format(PyExc_TypeError, "GeneratorExp field \"generators\" must be a list, not a %.200s", tmp->ob_type->tp_name); |
| 5252 goto failed; | 5317 goto failed; |
| 5253 } | 5318 } |
| 5275 return 1; | 5340 return 1; |
| 5276 } | 5341 } |
| 5277 if (isinstance) { | 5342 if (isinstance) { |
| 5278 expr_ty value; | 5343 expr_ty value; |
| 5279 | 5344 |
| 5280 if (PyObject_HasAttrString(obj, "value")) { | 5345 if (_PyObject_HasAttrId(obj, &PyId_value)) { |
| 5281 int res; | 5346 int res; |
| 5282 tmp = PyObject_GetAttrString(obj, "value"); | 5347 tmp = _PyObject_GetAttrId(obj, &PyId_value); |
| 5283 if (tmp == NULL) goto failed; | 5348 if (tmp == NULL) goto failed; |
| 5284 res = obj2ast_expr(tmp, &value, arena); | 5349 res = obj2ast_expr(tmp, &value, arena); |
| 5285 if (res != 0) goto failed; | 5350 if (res != 0) goto failed; |
| 5286 Py_XDECREF(tmp); | 5351 Py_XDECREF(tmp); |
| 5287 tmp = NULL; | 5352 tmp = NULL; |
| 5299 if (isinstance) { | 5364 if (isinstance) { |
| 5300 expr_ty left; | 5365 expr_ty left; |
| 5301 asdl_int_seq* ops; | 5366 asdl_int_seq* ops; |
| 5302 asdl_seq* comparators; | 5367 asdl_seq* comparators; |
| 5303 | 5368 |
| 5304 if (PyObject_HasAttrString(obj, "left")) { | 5369 if (_PyObject_HasAttrId(obj, &PyId_left)) { |
| 5305 int res; | 5370 int res; |
| 5306 tmp = PyObject_GetAttrString(obj, "left"); | 5371 tmp = _PyObject_GetAttrId(obj, &PyId_left); |
| 5307 if (tmp == NULL) goto failed; | 5372 if (tmp == NULL) goto failed; |
| 5308 res = obj2ast_expr(tmp, &left, arena); | 5373 res = obj2ast_expr(tmp, &left, arena); |
| 5309 if (res != 0) goto failed; | 5374 if (res != 0) goto failed; |
| 5310 Py_XDECREF(tmp); | 5375 Py_XDECREF(tmp); |
| 5311 tmp = NULL; | 5376 tmp = NULL; |
| 5312 } else { | 5377 } else { |
| 5313 PyErr_SetString(PyExc_TypeError, "required field \"left\" missing from Compare"); | 5378 PyErr_SetString(PyExc_TypeError, "required field \"left\" missing from Compare"); |
| 5314 return 1; | 5379 return 1; |
| 5315 } | 5380 } |
| 5316 if (PyObject_HasAttrString(obj, "ops")) { | 5381 if (_PyObject_HasAttrId(obj, &PyId_ops)) { |
| 5317 int res; | 5382 int res; |
| 5318 Py_ssize_t len; | 5383 Py_ssize_t len; |
| 5319 Py_ssize_t i; | 5384 Py_ssize_t i; |
| 5320 tmp = PyObject_GetAttrString(obj, "ops"); | 5385 tmp = _PyObject_GetAttrId(obj, &PyId_ops); |
| 5321 if (tmp == NULL) goto failed; | 5386 if (tmp == NULL) goto failed; |
| 5322 if (!PyList_Check(tmp)) { | 5387 if (!PyList_Check(tmp)) { |
| 5323 PyErr_Format(PyExc_TypeError, "Compare field \"ops\" must be a list, not a %.200s", tmp->ob_type->tp_name); | 5388 PyErr_Format(PyExc_TypeError, "Compare field \"ops\" must be a list, not a %.200s", tmp->ob_type->tp_name); |
| 5324 goto failed; | 5389 goto failed; |
| 5325 } | 5390 } |
| 5336 tmp = NULL; | 5401 tmp = NULL; |
| 5337 } else { | 5402 } else { |
| 5338 PyErr_SetString(PyExc_TypeError, "required field \"ops\" missing from Compare"); | 5403 PyErr_SetString(PyExc_TypeError, "required field \"ops\" missing from Compare"); |
| 5339 return 1; | 5404 return 1; |
| 5340 } | 5405 } |
| 5341 if (PyObject_HasAttrString(obj, "comparators")) { | 5406 if (_PyObject_HasAttrId(obj, &PyId_comparators)) { |
| 5342 int res; | 5407 int res; |
| 5343 Py_ssize_t len; | 5408 Py_ssize_t len; |
| 5344 Py_ssize_t i; | 5409 Py_ssize_t i; |
| 5345 tmp = PyObject_GetAttrString(obj, "comparators"); | 5410 tmp = _PyObject_GetAttrId(obj, &PyId_comparators); |
| 5346 if (tmp == NULL) goto failed; | 5411 if (tmp == NULL) goto failed; |
| 5347 if (!PyList_Check(tmp)) { | 5412 if (!PyList_Check(tmp)) { |
| 5348 PyErr_Format(PyExc_TypeError, "Compare field \"comparators\" must be a list, not a %.200s", tmp->ob_type->tp_name); | 5413 PyErr_Format(PyExc_TypeError, "Compare field \"comparators\" must be a list, not a %.200s", tmp->ob_type->tp_name); |
| 5349 goto failed; | 5414 goto failed; |
| 5350 } | 5415 } |
| 5377 asdl_seq* args; | 5442 asdl_seq* args; |
| 5378 asdl_seq* keywords; | 5443 asdl_seq* keywords; |
| 5379 expr_ty starargs; | 5444 expr_ty starargs; |
| 5380 expr_ty kwargs; | 5445 expr_ty kwargs; |
| 5381 | 5446 |
| 5382 if (PyObject_HasAttrString(obj, "func")) { | 5447 if (_PyObject_HasAttrId(obj, &PyId_func)) { |
| 5383 int res; | 5448 int res; |
| 5384 tmp = PyObject_GetAttrString(obj, "func"); | 5449 tmp = _PyObject_GetAttrId(obj, &PyId_func); |
| 5385 if (tmp == NULL) goto failed; | 5450 if (tmp == NULL) goto failed; |
| 5386 res = obj2ast_expr(tmp, &func, arena); | 5451 res = obj2ast_expr(tmp, &func, arena); |
| 5387 if (res != 0) goto failed; | 5452 if (res != 0) goto failed; |
| 5388 Py_XDECREF(tmp); | 5453 Py_XDECREF(tmp); |
| 5389 tmp = NULL; | 5454 tmp = NULL; |
| 5390 } else { | 5455 } else { |
| 5391 PyErr_SetString(PyExc_TypeError, "required field \"func\" missing from Call"); | 5456 PyErr_SetString(PyExc_TypeError, "required field \"func\" missing from Call"); |
| 5392 return 1; | 5457 return 1; |
| 5393 } | 5458 } |
| 5394 if (PyObject_HasAttrString(obj, "args")) { | 5459 if (_PyObject_HasAttrId(obj, &PyId_args)) { |
| 5395 int res; | 5460 int res; |
| 5396 Py_ssize_t len; | 5461 Py_ssize_t len; |
| 5397 Py_ssize_t i; | 5462 Py_ssize_t i; |
| 5398 tmp = PyObject_GetAttrString(obj, "args"); | 5463 tmp = _PyObject_GetAttrId(obj, &PyId_args); |
| 5399 if (tmp == NULL) goto failed; | 5464 if (tmp == NULL) goto failed; |
| 5400 if (!PyList_Check(tmp)) { | 5465 if (!PyList_Check(tmp)) { |
| 5401 PyErr_Format(PyExc_TypeError, "Call field \"args\" must be a list, not a %.200s", tmp->ob_type->tp_name); | 5466 PyErr_Format(PyExc_TypeError, "Call field \"args\" must be a list, not a %.200s", tmp->ob_type->tp_name); |
| 5402 goto failed; | 5467 goto failed; |
| 5403 } | 5468 } |
| 5414 tmp = NULL; | 5479 tmp = NULL; |
| 5415 } else { | 5480 } else { |
| 5416 PyErr_SetString(PyExc_TypeError, "required field \"args\" missing from Call"); | 5481 PyErr_SetString(PyExc_TypeError, "required field \"args\" missing from Call"); |
| 5417 return 1; | 5482 return 1; |
| 5418 } | 5483 } |
| 5419 if (PyObject_HasAttrString(obj, "keywords")) { | 5484 if (_PyObject_HasAttrId(obj, &PyId_keywords)) { |
| 5420 int res; | 5485 int res; |
| 5421 Py_ssize_t len; | 5486 Py_ssize_t len; |
| 5422 Py_ssize_t i; | 5487 Py_ssize_t i; |
| 5423 tmp = PyObject_GetAttrString(obj, "keywords"); | 5488 tmp = _PyObject_GetAttrId(obj, &PyId_keywords); |
| 5424 if (tmp == NULL) goto failed; | 5489 if (tmp == NULL) goto failed; |
| 5425 if (!PyList_Check(tmp)) { | 5490 if (!PyList_Check(tmp)) { |
| 5426 PyErr_Format(PyExc_TypeError, "Call field \"keywords\" must be a list, not a %.200s", tmp->ob_type->tp_name); | 5491 PyErr_Format(PyExc_TypeError, "Call field \"keywords\" must be a list, not a %.200s", tmp->ob_type->tp_name); |
| 5427 goto failed; | 5492 goto failed; |
| 5428 } | 5493 } |
| 5439 tmp = NULL; | 5504 tmp = NULL; |
| 5440 } else { | 5505 } else { |
| 5441 PyErr_SetString(PyExc_TypeError, "required field \"keywords\" missing from Call"); | 5506 PyErr_SetString(PyExc_TypeError, "required field \"keywords\" missing from Call"); |
| 5442 return 1; | 5507 return 1; |
| 5443 } | 5508 } |
| 5444 if (PyObject_HasAttrString(obj, "starargs")) { | 5509 if (_PyObject_HasAttrId(obj, &PyId_starargs)) { |
| 5445 int res; | 5510 int res; |
| 5446 tmp = PyObject_GetAttrString(obj, "starargs"); | 5511 tmp = _PyObject_GetAttrId(obj, &PyId_starargs); |
| 5447 if (tmp == NULL) goto failed; | 5512 if (tmp == NULL) goto failed; |
| 5448 res = obj2ast_expr(tmp, &starargs, arena); | 5513 res = obj2ast_expr(tmp, &starargs, arena); |
| 5449 if (res != 0) goto failed; | 5514 if (res != 0) goto failed; |
| 5450 Py_XDECREF(tmp); | 5515 Py_XDECREF(tmp); |
| 5451 tmp = NULL; | 5516 tmp = NULL; |
| 5452 } else { | 5517 } else { |
| 5453 starargs = NULL; | 5518 starargs = NULL; |
| 5454 } | 5519 } |
| 5455 if (PyObject_HasAttrString(obj, "kwargs")) { | 5520 if (_PyObject_HasAttrId(obj, &PyId_kwargs)) { |
| 5456 int res; | 5521 int res; |
| 5457 tmp = PyObject_GetAttrString(obj, "kwargs"); | 5522 tmp = _PyObject_GetAttrId(obj, &PyId_kwargs); |
| 5458 if (tmp == NULL) goto failed; | 5523 if (tmp == NULL) goto failed; |
| 5459 res = obj2ast_expr(tmp, &kwargs, arena); | 5524 res = obj2ast_expr(tmp, &kwargs, arena); |
| 5460 if (res != 0) goto failed; | 5525 if (res != 0) goto failed; |
| 5461 Py_XDECREF(tmp); | 5526 Py_XDECREF(tmp); |
| 5462 tmp = NULL; | 5527 tmp = NULL; |
| 5473 return 1; | 5538 return 1; |
| 5474 } | 5539 } |
| 5475 if (isinstance) { | 5540 if (isinstance) { |
| 5476 object n; | 5541 object n; |
| 5477 | 5542 |
| 5478 if (PyObject_HasAttrString(obj, "n")) { | 5543 if (_PyObject_HasAttrId(obj, &PyId_n)) { |
| 5479 int res; | 5544 int res; |
| 5480 tmp = PyObject_GetAttrString(obj, "n"); | 5545 tmp = _PyObject_GetAttrId(obj, &PyId_n); |
| 5481 if (tmp == NULL) goto failed; | 5546 if (tmp == NULL) goto failed; |
| 5482 res = obj2ast_object(tmp, &n, arena); | 5547 res = obj2ast_object(tmp, &n, arena); |
| 5483 if (res != 0) goto failed; | 5548 if (res != 0) goto failed; |
| 5484 Py_XDECREF(tmp); | 5549 Py_XDECREF(tmp); |
| 5485 tmp = NULL; | 5550 tmp = NULL; |
| 5496 return 1; | 5561 return 1; |
| 5497 } | 5562 } |
| 5498 if (isinstance) { | 5563 if (isinstance) { |
| 5499 string s; | 5564 string s; |
| 5500 | 5565 |
| 5501 if (PyObject_HasAttrString(obj, "s")) { | 5566 if (_PyObject_HasAttrId(obj, &PyId_s)) { |
| 5502 int res; | 5567 int res; |
| 5503 tmp = PyObject_GetAttrString(obj, "s"); | 5568 tmp = _PyObject_GetAttrId(obj, &PyId_s); |
| 5504 if (tmp == NULL) goto failed; | 5569 if (tmp == NULL) goto failed; |
| 5505 res = obj2ast_string(tmp, &s, arena); | 5570 res = obj2ast_string(tmp, &s, arena); |
| 5506 if (res != 0) goto failed; | 5571 if (res != 0) goto failed; |
| 5507 Py_XDECREF(tmp); | 5572 Py_XDECREF(tmp); |
| 5508 tmp = NULL; | 5573 tmp = NULL; |
| 5519 return 1; | 5584 return 1; |
| 5520 } | 5585 } |
| 5521 if (isinstance) { | 5586 if (isinstance) { |
| 5522 bytes s; | 5587 bytes s; |
| 5523 | 5588 |
| 5524 if (PyObject_HasAttrString(obj, "s")) { | 5589 if (_PyObject_HasAttrId(obj, &PyId_s)) { |
| 5525 int res; | 5590 int res; |
| 5526 tmp = PyObject_GetAttrString(obj, "s"); | 5591 tmp = _PyObject_GetAttrId(obj, &PyId_s); |
| 5527 if (tmp == NULL) goto failed; | 5592 if (tmp == NULL) goto failed; |
| 5528 res = obj2ast_bytes(tmp, &s, arena); | 5593 res = obj2ast_bytes(tmp, &s, arena); |
| 5529 if (res != 0) goto failed; | 5594 if (res != 0) goto failed; |
| 5530 Py_XDECREF(tmp); | 5595 Py_XDECREF(tmp); |
| 5531 tmp = NULL; | 5596 tmp = NULL; |
| 5554 if (isinstance) { | 5619 if (isinstance) { |
| 5555 expr_ty value; | 5620 expr_ty value; |
| 5556 identifier attr; | 5621 identifier attr; |
| 5557 expr_context_ty ctx; | 5622 expr_context_ty ctx; |
| 5558 | 5623 |
| 5559 if (PyObject_HasAttrString(obj, "value")) { | 5624 if (_PyObject_HasAttrId(obj, &PyId_value)) { |
| 5560 int res; | 5625 int res; |
| 5561 tmp = PyObject_GetAttrString(obj, "value"); | 5626 tmp = _PyObject_GetAttrId(obj, &PyId_value); |
| 5562 if (tmp == NULL) goto failed; | 5627 if (tmp == NULL) goto failed; |
| 5563 res = obj2ast_expr(tmp, &value, arena); | 5628 res = obj2ast_expr(tmp, &value, arena); |
| 5564 if (res != 0) goto failed; | 5629 if (res != 0) goto failed; |
| 5565 Py_XDECREF(tmp); | 5630 Py_XDECREF(tmp); |
| 5566 tmp = NULL; | 5631 tmp = NULL; |
| 5567 } else { | 5632 } else { |
| 5568 PyErr_SetString(PyExc_TypeError, "required field \"value\" missing from Attribute"); | 5633 PyErr_SetString(PyExc_TypeError, "required field \"value\" missing from Attribute"); |
| 5569 return 1; | 5634 return 1; |
| 5570 } | 5635 } |
| 5571 if (PyObject_HasAttrString(obj, "attr")) { | 5636 if (_PyObject_HasAttrId(obj, &PyId_attr)) { |
| 5572 int res; | 5637 int res; |
| 5573 tmp = PyObject_GetAttrString(obj, "attr"); | 5638 tmp = _PyObject_GetAttrId(obj, &PyId_attr); |
| 5574 if (tmp == NULL) goto failed; | 5639 if (tmp == NULL) goto failed; |
| 5575 res = obj2ast_identifier(tmp, &attr, arena); | 5640 res = obj2ast_identifier(tmp, &attr, arena); |
| 5576 if (res != 0) goto failed; | 5641 if (res != 0) goto failed; |
| 5577 Py_XDECREF(tmp); | 5642 Py_XDECREF(tmp); |
| 5578 tmp = NULL; | 5643 tmp = NULL; |
| 5579 } else { | 5644 } else { |
| 5580 PyErr_SetString(PyExc_TypeError, "required field \"attr\" missing from Attribute"); | 5645 PyErr_SetString(PyExc_TypeError, "required field \"attr\" missing from Attribute"); |
| 5581 return 1; | 5646 return 1; |
| 5582 } | 5647 } |
| 5583 if (PyObject_HasAttrString(obj, "ctx")) { | 5648 if (_PyObject_HasAttrId(obj, &PyId_ctx)) { |
| 5584 int res; | 5649 int res; |
| 5585 tmp = PyObject_GetAttrString(obj, "ctx"); | 5650 tmp = _PyObject_GetAttrId(obj, &PyId_ctx); |
| 5586 if (tmp == NULL) goto failed; | 5651 if (tmp == NULL) goto failed; |
| 5587 res = obj2ast_expr_context(tmp, &ctx, arena); | 5652 res = obj2ast_expr_context(tmp, &ctx, arena); |
| 5588 if (res != 0) goto failed; | 5653 if (res != 0) goto failed; |
| 5589 Py_XDECREF(tmp); | 5654 Py_XDECREF(tmp); |
| 5590 tmp = NULL; | 5655 tmp = NULL; |
| 5603 if (isinstance) { | 5668 if (isinstance) { |
| 5604 expr_ty value; | 5669 expr_ty value; |
| 5605 slice_ty slice; | 5670 slice_ty slice; |
| 5606 expr_context_ty ctx; | 5671 expr_context_ty ctx; |
| 5607 | 5672 |
| 5608 if (PyObject_HasAttrString(obj, "value")) { | 5673 if (_PyObject_HasAttrId(obj, &PyId_value)) { |
| 5609 int res; | 5674 int res; |
| 5610 tmp = PyObject_GetAttrString(obj, "value"); | 5675 tmp = _PyObject_GetAttrId(obj, &PyId_value); |
| 5611 if (tmp == NULL) goto failed; | 5676 if (tmp == NULL) goto failed; |
| 5612 res = obj2ast_expr(tmp, &value, arena); | 5677 res = obj2ast_expr(tmp, &value, arena); |
| 5613 if (res != 0) goto failed; | 5678 if (res != 0) goto failed; |
| 5614 Py_XDECREF(tmp); | 5679 Py_XDECREF(tmp); |
| 5615 tmp = NULL; | 5680 tmp = NULL; |
| 5616 } else { | 5681 } else { |
| 5617 PyErr_SetString(PyExc_TypeError, "required field \"value\" missing from Subscript"); | 5682 PyErr_SetString(PyExc_TypeError, "required field \"value\" missing from Subscript"); |
| 5618 return 1; | 5683 return 1; |
| 5619 } | 5684 } |
| 5620 if (PyObject_HasAttrString(obj, "slice")) { | 5685 if (_PyObject_HasAttrId(obj, &PyId_slice)) { |
| 5621 int res; | 5686 int res; |
| 5622 tmp = PyObject_GetAttrString(obj, "slice"); | 5687 tmp = _PyObject_GetAttrId(obj, &PyId_slice); |
| 5623 if (tmp == NULL) goto failed; | 5688 if (tmp == NULL) goto failed; |
| 5624 res = obj2ast_slice(tmp, &slice, arena); | 5689 res = obj2ast_slice(tmp, &slice, arena); |
| 5625 if (res != 0) goto failed; | 5690 if (res != 0) goto failed; |
| 5626 Py_XDECREF(tmp); | 5691 Py_XDECREF(tmp); |
| 5627 tmp = NULL; | 5692 tmp = NULL; |
| 5628 } else { | 5693 } else { |
| 5629 PyErr_SetString(PyExc_TypeError, "required field \"slice\" missing from Subscript"); | 5694 PyErr_SetString(PyExc_TypeError, "required field \"slice\" missing from Subscript"); |
| 5630 return 1; | 5695 return 1; |
| 5631 } | 5696 } |
| 5632 if (PyObject_HasAttrString(obj, "ctx")) { | 5697 if (_PyObject_HasAttrId(obj, &PyId_ctx)) { |
| 5633 int res; | 5698 int res; |
| 5634 tmp = PyObject_GetAttrString(obj, "ctx"); | 5699 tmp = _PyObject_GetAttrId(obj, &PyId_ctx); |
| 5635 if (tmp == NULL) goto failed; | 5700 if (tmp == NULL) goto failed; |
| 5636 res = obj2ast_expr_context(tmp, &ctx, arena); | 5701 res = obj2ast_expr_context(tmp, &ctx, arena); |
| 5637 if (res != 0) goto failed; | 5702 if (res != 0) goto failed; |
| 5638 Py_XDECREF(tmp); | 5703 Py_XDECREF(tmp); |
| 5639 tmp = NULL; | 5704 tmp = NULL; |
| 5651 } | 5716 } |
| 5652 if (isinstance) { | 5717 if (isinstance) { |
| 5653 expr_ty value; | 5718 expr_ty value; |
| 5654 expr_context_ty ctx; | 5719 expr_context_ty ctx; |
| 5655 | 5720 |
| 5656 if (PyObject_HasAttrString(obj, "value")) { | 5721 if (_PyObject_HasAttrId(obj, &PyId_value)) { |
| 5657 int res; | 5722 int res; |
| 5658 tmp = PyObject_GetAttrString(obj, "value"); | 5723 tmp = _PyObject_GetAttrId(obj, &PyId_value); |
| 5659 if (tmp == NULL) goto failed; | 5724 if (tmp == NULL) goto failed; |
| 5660 res = obj2ast_expr(tmp, &value, arena); | 5725 res = obj2ast_expr(tmp, &value, arena); |
| 5661 if (res != 0) goto failed; | 5726 if (res != 0) goto failed; |
| 5662 Py_XDECREF(tmp); | 5727 Py_XDECREF(tmp); |
| 5663 tmp = NULL; | 5728 tmp = NULL; |
| 5664 } else { | 5729 } else { |
| 5665 PyErr_SetString(PyExc_TypeError, "required field \"value\" missing from Starred"); | 5730 PyErr_SetString(PyExc_TypeError, "required field \"value\" missing from Starred"); |
| 5666 return 1; | 5731 return 1; |
| 5667 } | 5732 } |
| 5668 if (PyObject_HasAttrString(obj, "ctx")) { | 5733 if (_PyObject_HasAttrId(obj, &PyId_ctx)) { |
| 5669 int res; | 5734 int res; |
| 5670 tmp = PyObject_GetAttrString(obj, "ctx"); | 5735 tmp = _PyObject_GetAttrId(obj, &PyId_ctx); |
| 5671 if (tmp == NULL) goto failed; | 5736 if (tmp == NULL) goto failed; |
| 5672 res = obj2ast_expr_context(tmp, &ctx, arena); | 5737 res = obj2ast_expr_context(tmp, &ctx, arena); |
| 5673 if (res != 0) goto failed; | 5738 if (res != 0) goto failed; |
| 5674 Py_XDECREF(tmp); | 5739 Py_XDECREF(tmp); |
| 5675 tmp = NULL; | 5740 tmp = NULL; |
| 5687 } | 5752 } |
| 5688 if (isinstance) { | 5753 if (isinstance) { |
| 5689 identifier id; | 5754 identifier id; |
| 5690 expr_context_ty ctx; | 5755 expr_context_ty ctx; |
| 5691 | 5756 |
| 5692 if (PyObject_HasAttrString(obj, "id")) { | 5757 if (_PyObject_HasAttrId(obj, &PyId_id)) { |
| 5693 int res; | 5758 int res; |
| 5694 tmp = PyObject_GetAttrString(obj, "id"); | 5759 tmp = _PyObject_GetAttrId(obj, &PyId_id); |
| 5695 if (tmp == NULL) goto failed; | 5760 if (tmp == NULL) goto failed; |
| 5696 res = obj2ast_identifier(tmp, &id, arena); | 5761 res = obj2ast_identifier(tmp, &id, arena); |
| 5697 if (res != 0) goto failed; | 5762 if (res != 0) goto failed; |
| 5698 Py_XDECREF(tmp); | 5763 Py_XDECREF(tmp); |
| 5699 tmp = NULL; | 5764 tmp = NULL; |
| 5700 } else { | 5765 } else { |
| 5701 PyErr_SetString(PyExc_TypeError, "required field \"id\" missing from Name"); | 5766 PyErr_SetString(PyExc_TypeError, "required field \"id\" missing from Name"); |
| 5702 return 1; | 5767 return 1; |
| 5703 } | 5768 } |
| 5704 if (PyObject_HasAttrString(obj, "ctx")) { | 5769 if (_PyObject_HasAttrId(obj, &PyId_ctx)) { |
| 5705 int res; | 5770 int res; |
| 5706 tmp = PyObject_GetAttrString(obj, "ctx"); | 5771 tmp = _PyObject_GetAttrId(obj, &PyId_ctx); |
| 5707 if (tmp == NULL) goto failed; | 5772 if (tmp == NULL) goto failed; |
| 5708 res = obj2ast_expr_context(tmp, &ctx, arena); | 5773 res = obj2ast_expr_context(tmp, &ctx, arena); |
| 5709 if (res != 0) goto failed; | 5774 if (res != 0) goto failed; |
| 5710 Py_XDECREF(tmp); | 5775 Py_XDECREF(tmp); |
| 5711 tmp = NULL; | 5776 tmp = NULL; |
| 5723 } | 5788 } |
| 5724 if (isinstance) { | 5789 if (isinstance) { |
| 5725 asdl_seq* elts; | 5790 asdl_seq* elts; |
| 5726 expr_context_ty ctx; | 5791 expr_context_ty ctx; |
| 5727 | 5792 |
| 5728 if (PyObject_HasAttrString(obj, "elts")) { | 5793 if (_PyObject_HasAttrId(obj, &PyId_elts)) { |
| 5729 int res; | 5794 int res; |
| 5730 Py_ssize_t len; | 5795 Py_ssize_t len; |
| 5731 Py_ssize_t i; | 5796 Py_ssize_t i; |
| 5732 tmp = PyObject_GetAttrString(obj, "elts"); | 5797 tmp = _PyObject_GetAttrId(obj, &PyId_elts); |
| 5733 if (tmp == NULL) goto failed; | 5798 if (tmp == NULL) goto failed; |
| 5734 if (!PyList_Check(tmp)) { | 5799 if (!PyList_Check(tmp)) { |
| 5735 PyErr_Format(PyExc_TypeError, "List field \"elts\" must be a list, not a %.200s", tmp->ob_type->tp_name); | 5800 PyErr_Format(PyExc_TypeError, "List field \"elts\" must be a list, not a %.200s", tmp->ob_type->tp_name); |
| 5736 goto failed; | 5801 goto failed; |
| 5737 } | 5802 } |
| 5748 tmp = NULL; | 5813 tmp = NULL; |
| 5749 } else { | 5814 } else { |
| 5750 PyErr_SetString(PyExc_TypeError, "required field \"elts\" missing from List"); | 5815 PyErr_SetString(PyExc_TypeError, "required field \"elts\" missing from List"); |
| 5751 return 1; | 5816 return 1; |
| 5752 } | 5817 } |
| 5753 if (PyObject_HasAttrString(obj, "ctx")) { | 5818 if (_PyObject_HasAttrId(obj, &PyId_ctx)) { |
| 5754 int res; | 5819 int res; |
| 5755 tmp = PyObject_GetAttrString(obj, "ctx"); | 5820 tmp = _PyObject_GetAttrId(obj, &PyId_ctx); |
| 5756 if (tmp == NULL) goto failed; | 5821 if (tmp == NULL) goto failed; |
| 5757 res = obj2ast_expr_context(tmp, &ctx, arena); | 5822 res = obj2ast_expr_context(tmp, &ctx, arena); |
| 5758 if (res != 0) goto failed; | 5823 if (res != 0) goto failed; |
| 5759 Py_XDECREF(tmp); | 5824 Py_XDECREF(tmp); |
| 5760 tmp = NULL; | 5825 tmp = NULL; |
| 5772 } | 5837 } |
| 5773 if (isinstance) { | 5838 if (isinstance) { |
| 5774 asdl_seq* elts; | 5839 asdl_seq* elts; |
| 5775 expr_context_ty ctx; | 5840 expr_context_ty ctx; |
| 5776 | 5841 |
| 5777 if (PyObject_HasAttrString(obj, "elts")) { | 5842 if (_PyObject_HasAttrId(obj, &PyId_elts)) { |
| 5778 int res; | 5843 int res; |
| 5779 Py_ssize_t len; | 5844 Py_ssize_t len; |
| 5780 Py_ssize_t i; | 5845 Py_ssize_t i; |
| 5781 tmp = PyObject_GetAttrString(obj, "elts"); | 5846 tmp = _PyObject_GetAttrId(obj, &PyId_elts); |
| 5782 if (tmp == NULL) goto failed; | 5847 if (tmp == NULL) goto failed; |
| 5783 if (!PyList_Check(tmp)) { | 5848 if (!PyList_Check(tmp)) { |
| 5784 PyErr_Format(PyExc_TypeError, "Tuple field \"elts\" must be a list, not a %.200s", tmp->ob_type->tp_name); | 5849 PyErr_Format(PyExc_TypeError, "Tuple field \"elts\" must be a list, not a %.200s", tmp->ob_type->tp_name); |
| 5785 goto failed; | 5850 goto failed; |
| 5786 } | 5851 } |
| 5797 tmp = NULL; | 5862 tmp = NULL; |
| 5798 } else { | 5863 } else { |
| 5799 PyErr_SetString(PyExc_TypeError, "required field \"elts\" missing from Tuple"); | 5864 PyErr_SetString(PyExc_TypeError, "required field \"elts\" missing from Tuple"); |
| 5800 return 1; | 5865 return 1; |
| 5801 } | 5866 } |
| 5802 if (PyObject_HasAttrString(obj, "ctx")) { | 5867 if (_PyObject_HasAttrId(obj, &PyId_ctx)) { |
| 5803 int res; | 5868 int res; |
| 5804 tmp = PyObject_GetAttrString(obj, "ctx"); | 5869 tmp = _PyObject_GetAttrId(obj, &PyId_ctx); |
| 5805 if (tmp == NULL) goto failed; | 5870 if (tmp == NULL) goto failed; |
| 5806 res = obj2ast_expr_context(tmp, &ctx, arena); | 5871 res = obj2ast_expr_context(tmp, &ctx, arena); |
| 5807 if (res != 0) goto failed; | 5872 if (res != 0) goto failed; |
| 5808 Py_XDECREF(tmp); | 5873 Py_XDECREF(tmp); |
| 5809 tmp = NULL; | 5874 tmp = NULL; |
| 5898 if (isinstance) { | 5963 if (isinstance) { |
| 5899 expr_ty lower; | 5964 expr_ty lower; |
| 5900 expr_ty upper; | 5965 expr_ty upper; |
| 5901 expr_ty step; | 5966 expr_ty step; |
| 5902 | 5967 |
| 5903 if (PyObject_HasAttrString(obj, "lower")) { | 5968 if (_PyObject_HasAttrId(obj, &PyId_lower)) { |
| 5904 int res; | 5969 int res; |
| 5905 tmp = PyObject_GetAttrString(obj, "lower"); | 5970 tmp = _PyObject_GetAttrId(obj, &PyId_lower); |
| 5906 if (tmp == NULL) goto failed; | 5971 if (tmp == NULL) goto failed; |
| 5907 res = obj2ast_expr(tmp, &lower, arena); | 5972 res = obj2ast_expr(tmp, &lower, arena); |
| 5908 if (res != 0) goto failed; | 5973 if (res != 0) goto failed; |
| 5909 Py_XDECREF(tmp); | 5974 Py_XDECREF(tmp); |
| 5910 tmp = NULL; | 5975 tmp = NULL; |
| 5911 } else { | 5976 } else { |
| 5912 lower = NULL; | 5977 lower = NULL; |
| 5913 } | 5978 } |
| 5914 if (PyObject_HasAttrString(obj, "upper")) { | 5979 if (_PyObject_HasAttrId(obj, &PyId_upper)) { |
| 5915 int res; | 5980 int res; |
| 5916 tmp = PyObject_GetAttrString(obj, "upper"); | 5981 tmp = _PyObject_GetAttrId(obj, &PyId_upper); |
| 5917 if (tmp == NULL) goto failed; | 5982 if (tmp == NULL) goto failed; |
| 5918 res = obj2ast_expr(tmp, &upper, arena); | 5983 res = obj2ast_expr(tmp, &upper, arena); |
| 5919 if (res != 0) goto failed; | 5984 if (res != 0) goto failed; |
| 5920 Py_XDECREF(tmp); | 5985 Py_XDECREF(tmp); |
| 5921 tmp = NULL; | 5986 tmp = NULL; |
| 5922 } else { | 5987 } else { |
| 5923 upper = NULL; | 5988 upper = NULL; |
| 5924 } | 5989 } |
| 5925 if (PyObject_HasAttrString(obj, "step")) { | 5990 if (_PyObject_HasAttrId(obj, &PyId_step)) { |
| 5926 int res; | 5991 int res; |
| 5927 tmp = PyObject_GetAttrString(obj, "step"); | 5992 tmp = _PyObject_GetAttrId(obj, &PyId_step); |
| 5928 if (tmp == NULL) goto failed; | 5993 if (tmp == NULL) goto failed; |
| 5929 res = obj2ast_expr(tmp, &step, arena); | 5994 res = obj2ast_expr(tmp, &step, arena); |
| 5930 if (res != 0) goto failed; | 5995 if (res != 0) goto failed; |
| 5931 Py_XDECREF(tmp); | 5996 Py_XDECREF(tmp); |
| 5932 tmp = NULL; | 5997 tmp = NULL; |
| 5942 return 1; | 6007 return 1; |
| 5943 } | 6008 } |
| 5944 if (isinstance) { | 6009 if (isinstance) { |
| 5945 asdl_seq* dims; | 6010 asdl_seq* dims; |
| 5946 | 6011 |
| 5947 if (PyObject_HasAttrString(obj, "dims")) { | 6012 if (_PyObject_HasAttrId(obj, &PyId_dims)) { |
| 5948 int res; | 6013 int res; |
| 5949 Py_ssize_t len; | 6014 Py_ssize_t len; |
| 5950 Py_ssize_t i; | 6015 Py_ssize_t i; |
| 5951 tmp = PyObject_GetAttrString(obj, "dims"); | 6016 tmp = _PyObject_GetAttrId(obj, &PyId_dims); |
| 5952 if (tmp == NULL) goto failed; | 6017 if (tmp == NULL) goto failed; |
| 5953 if (!PyList_Check(tmp)) { | 6018 if (!PyList_Check(tmp)) { |
| 5954 PyErr_Format(PyExc_TypeError, "ExtSlice field \"dims\" must be a list, not a %.200s", tmp->ob_type->tp_name); | 6019 PyErr_Format(PyExc_TypeError, "ExtSlice field \"dims\" must be a list, not a %.200s", tmp->ob_type->tp_name); |
| 5955 goto failed; | 6020 goto failed; |
| 5956 } | 6021 } |
| 5978 return 1; | 6043 return 1; |
| 5979 } | 6044 } |
| 5980 if (isinstance) { | 6045 if (isinstance) { |
| 5981 expr_ty value; | 6046 expr_ty value; |
| 5982 | 6047 |
| 5983 if (PyObject_HasAttrString(obj, "value")) { | 6048 if (_PyObject_HasAttrId(obj, &PyId_value)) { |
| 5984 int res; | 6049 int res; |
| 5985 tmp = PyObject_GetAttrString(obj, "value"); | 6050 tmp = _PyObject_GetAttrId(obj, &PyId_value); |
| 5986 if (tmp == NULL) goto failed; | 6051 if (tmp == NULL) goto failed; |
| 5987 res = obj2ast_expr(tmp, &value, arena); | 6052 res = obj2ast_expr(tmp, &value, arena); |
| 5988 if (res != 0) goto failed; | 6053 if (res != 0) goto failed; |
| 5989 Py_XDECREF(tmp); | 6054 Py_XDECREF(tmp); |
| 5990 tmp = NULL; | 6055 tmp = NULL; |
| 6273 PyObject* tmp = NULL; | 6338 PyObject* tmp = NULL; |
| 6274 expr_ty target; | 6339 expr_ty target; |
| 6275 expr_ty iter; | 6340 expr_ty iter; |
| 6276 asdl_seq* ifs; | 6341 asdl_seq* ifs; |
| 6277 | 6342 |
| 6278 if (PyObject_HasAttrString(obj, "target")) { | 6343 if (_PyObject_HasAttrId(obj, &PyId_target)) { |
| 6279 int res; | 6344 int res; |
| 6280 tmp = PyObject_GetAttrString(obj, "target"); | 6345 tmp = _PyObject_GetAttrId(obj, &PyId_target); |
| 6281 if (tmp == NULL) goto failed; | 6346 if (tmp == NULL) goto failed; |
| 6282 res = obj2ast_expr(tmp, &target, arena); | 6347 res = obj2ast_expr(tmp, &target, arena); |
| 6283 if (res != 0) goto failed; | 6348 if (res != 0) goto failed; |
| 6284 Py_XDECREF(tmp); | 6349 Py_XDECREF(tmp); |
| 6285 tmp = NULL; | 6350 tmp = NULL; |
| 6286 } else { | 6351 } else { |
| 6287 PyErr_SetString(PyExc_TypeError, "required field \"target\" missing from comprehension"); | 6352 PyErr_SetString(PyExc_TypeError, "required field \"target\" missing from comprehension"); |
| 6288 return 1; | 6353 return 1; |
| 6289 } | 6354 } |
| 6290 if (PyObject_HasAttrString(obj, "iter")) { | 6355 if (_PyObject_HasAttrId(obj, &PyId_iter)) { |
| 6291 int res; | 6356 int res; |
| 6292 tmp = PyObject_GetAttrString(obj, "iter"); | 6357 tmp = _PyObject_GetAttrId(obj, &PyId_iter); |
| 6293 if (tmp == NULL) goto failed; | 6358 if (tmp == NULL) goto failed; |
| 6294 res = obj2ast_expr(tmp, &iter, arena); | 6359 res = obj2ast_expr(tmp, &iter, arena); |
| 6295 if (res != 0) goto failed; | 6360 if (res != 0) goto failed; |
| 6296 Py_XDECREF(tmp); | 6361 Py_XDECREF(tmp); |
| 6297 tmp = NULL; | 6362 tmp = NULL; |
| 6298 } else { | 6363 } else { |
| 6299 PyErr_SetString(PyExc_TypeError, "required field \"iter\" missing from comprehension"); | 6364 PyErr_SetString(PyExc_TypeError, "required field \"iter\" missing from comprehension"); |
| 6300 return 1; | 6365 return 1; |
| 6301 } | 6366 } |
| 6302 if (PyObject_HasAttrString(obj, "ifs")) { | 6367 if (_PyObject_HasAttrId(obj, &PyId_ifs)) { |
| 6303 int res; | 6368 int res; |
| 6304 Py_ssize_t len; | 6369 Py_ssize_t len; |
| 6305 Py_ssize_t i; | 6370 Py_ssize_t i; |
| 6306 tmp = PyObject_GetAttrString(obj, "ifs"); | 6371 tmp = _PyObject_GetAttrId(obj, &PyId_ifs); |
| 6307 if (tmp == NULL) goto failed; | 6372 if (tmp == NULL) goto failed; |
| 6308 if (!PyList_Check(tmp)) { | 6373 if (!PyList_Check(tmp)) { |
| 6309 PyErr_Format(PyExc_TypeError, "comprehension field \"ifs\" must be a list, not a %.200s", tmp->ob_type->tp_name); | 6374 PyErr_Format(PyExc_TypeError, "comprehension field \"ifs\" must be a list, not a %.200s", tmp->ob_type->tp_name); |
| 6310 goto failed; | 6375 goto failed; |
| 6311 } | 6376 } |
| 6342 | 6407 |
| 6343 if (obj == Py_None) { | 6408 if (obj == Py_None) { |
| 6344 *out = NULL; | 6409 *out = NULL; |
| 6345 return 0; | 6410 return 0; |
| 6346 } | 6411 } |
| 6347 if (PyObject_HasAttrString(obj, "lineno")) { | 6412 if (_PyObject_HasAttrId(obj, &PyId_lineno)) { |
| 6348 int res; | 6413 int res; |
| 6349 tmp = PyObject_GetAttrString(obj, "lineno"); | 6414 tmp = _PyObject_GetAttrId(obj, &PyId_lineno); |
| 6350 if (tmp == NULL) goto failed; | 6415 if (tmp == NULL) goto failed; |
| 6351 res = obj2ast_int(tmp, &lineno, arena); | 6416 res = obj2ast_int(tmp, &lineno, arena); |
| 6352 if (res != 0) goto failed; | 6417 if (res != 0) goto failed; |
| 6353 Py_XDECREF(tmp); | 6418 Py_XDECREF(tmp); |
| 6354 tmp = NULL; | 6419 tmp = NULL; |
| 6355 } else { | 6420 } else { |
| 6356 PyErr_SetString(PyExc_TypeError, "required field \"lineno\" missing from excepthandler"); | 6421 PyErr_SetString(PyExc_TypeError, "required field \"lineno\" missing from excepthandler"); |
| 6357 return 1; | 6422 return 1; |
| 6358 } | 6423 } |
| 6359 if (PyObject_HasAttrString(obj, "col_offset")) { | 6424 if (_PyObject_HasAttrId(obj, &PyId_col_offset)) { |
| 6360 int res; | 6425 int res; |
| 6361 tmp = PyObject_GetAttrString(obj, "col_offset"); | 6426 tmp = _PyObject_GetAttrId(obj, &PyId_col_offset); |
| 6362 if (tmp == NULL) goto failed; | 6427 if (tmp == NULL) goto failed; |
| 6363 res = obj2ast_int(tmp, &col_offset, arena); | 6428 res = obj2ast_int(tmp, &col_offset, arena); |
| 6364 if (res != 0) goto failed; | 6429 if (res != 0) goto failed; |
| 6365 Py_XDECREF(tmp); | 6430 Py_XDECREF(tmp); |
| 6366 tmp = NULL; | 6431 tmp = NULL; |
| 6375 if (isinstance) { | 6440 if (isinstance) { |
| 6376 expr_ty type; | 6441 expr_ty type; |
| 6377 identifier name; | 6442 identifier name; |
| 6378 asdl_seq* body; | 6443 asdl_seq* body; |
| 6379 | 6444 |
| 6380 if (PyObject_HasAttrString(obj, "type")) { | 6445 if (_PyObject_HasAttrId(obj, &PyId_type)) { |
| 6381 int res; | 6446 int res; |
| 6382 tmp = PyObject_GetAttrString(obj, "type"); | 6447 tmp = _PyObject_GetAttrId(obj, &PyId_type); |
| 6383 if (tmp == NULL) goto failed; | 6448 if (tmp == NULL) goto failed; |
| 6384 res = obj2ast_expr(tmp, &type, arena); | 6449 res = obj2ast_expr(tmp, &type, arena); |
| 6385 if (res != 0) goto failed; | 6450 if (res != 0) goto failed; |
| 6386 Py_XDECREF(tmp); | 6451 Py_XDECREF(tmp); |
| 6387 tmp = NULL; | 6452 tmp = NULL; |
| 6388 } else { | 6453 } else { |
| 6389 type = NULL; | 6454 type = NULL; |
| 6390 } | 6455 } |
| 6391 if (PyObject_HasAttrString(obj, "name")) { | 6456 if (_PyObject_HasAttrId(obj, &PyId_name)) { |
| 6392 int res; | 6457 int res; |
| 6393 tmp = PyObject_GetAttrString(obj, "name"); | 6458 tmp = _PyObject_GetAttrId(obj, &PyId_name); |
| 6394 if (tmp == NULL) goto failed; | 6459 if (tmp == NULL) goto failed; |
| 6395 res = obj2ast_identifier(tmp, &name, arena); | 6460 res = obj2ast_identifier(tmp, &name, arena); |
| 6396 if (res != 0) goto failed; | 6461 if (res != 0) goto failed; |
| 6397 Py_XDECREF(tmp); | 6462 Py_XDECREF(tmp); |
| 6398 tmp = NULL; | 6463 tmp = NULL; |
| 6399 } else { | 6464 } else { |
| 6400 name = NULL; | 6465 name = NULL; |
| 6401 } | 6466 } |
| 6402 if (PyObject_HasAttrString(obj, "body")) { | 6467 if (_PyObject_HasAttrId(obj, &PyId_body)) { |
| 6403 int res; | 6468 int res; |
| 6404 Py_ssize_t len; | 6469 Py_ssize_t len; |
| 6405 Py_ssize_t i; | 6470 Py_ssize_t i; |
| 6406 tmp = PyObject_GetAttrString(obj, "body"); | 6471 tmp = _PyObject_GetAttrId(obj, &PyId_body); |
| 6407 if (tmp == NULL) goto failed; | 6472 if (tmp == NULL) goto failed; |
| 6408 if (!PyList_Check(tmp)) { | 6473 if (!PyList_Check(tmp)) { |
| 6409 PyErr_Format(PyExc_TypeError, "ExceptHandler field \"body\" must be a list, not a %.200s", tmp->ob_type->tp_name); | 6474 PyErr_Format(PyExc_TypeError, "ExceptHandler field \"body\" must be a list, not a %.200s", tmp->ob_type->tp_name); |
| 6410 goto failed; | 6475 goto failed; |
| 6411 } | 6476 } |
| 6447 identifier kwarg; | 6512 identifier kwarg; |
| 6448 expr_ty kwargannotation; | 6513 expr_ty kwargannotation; |
| 6449 asdl_seq* defaults; | 6514 asdl_seq* defaults; |
| 6450 asdl_seq* kw_defaults; | 6515 asdl_seq* kw_defaults; |
| 6451 | 6516 |
| 6452 if (PyObject_HasAttrString(obj, "args")) { | 6517 if (_PyObject_HasAttrId(obj, &PyId_args)) { |
| 6453 int res; | 6518 int res; |
| 6454 Py_ssize_t len; | 6519 Py_ssize_t len; |
| 6455 Py_ssize_t i; | 6520 Py_ssize_t i; |
| 6456 tmp = PyObject_GetAttrString(obj, "args"); | 6521 tmp = _PyObject_GetAttrId(obj, &PyId_args); |
| 6457 if (tmp == NULL) goto failed; | 6522 if (tmp == NULL) goto failed; |
| 6458 if (!PyList_Check(tmp)) { | 6523 if (!PyList_Check(tmp)) { |
| 6459 PyErr_Format(PyExc_TypeError, "arguments field \"args\" must be a list, not a %.200s", tmp->ob_type->tp_name); | 6524 PyErr_Format(PyExc_TypeError, "arguments field \"args\" must be a list, not a %.200s", tmp->ob_type->tp_name); |
| 6460 goto failed; | 6525 goto failed; |
| 6461 } | 6526 } |
| 6472 tmp = NULL; | 6537 tmp = NULL; |
| 6473 } else { | 6538 } else { |
| 6474 PyErr_SetString(PyExc_TypeError, "required field \"args\" missing from arguments"); | 6539 PyErr_SetString(PyExc_TypeError, "required field \"args\" missing from arguments"); |
| 6475 return 1; | 6540 return 1; |
| 6476 } | 6541 } |
| 6477 if (PyObject_HasAttrString(obj, "vararg")) { | 6542 if (_PyObject_HasAttrId(obj, &PyId_vararg)) { |
| 6478 int res; | 6543 int res; |
| 6479 tmp = PyObject_GetAttrString(obj, "vararg"); | 6544 tmp = _PyObject_GetAttrId(obj, &PyId_vararg); |
| 6480 if (tmp == NULL) goto failed; | 6545 if (tmp == NULL) goto failed; |
| 6481 res = obj2ast_identifier(tmp, &vararg, arena); | 6546 res = obj2ast_identifier(tmp, &vararg, arena); |
| 6482 if (res != 0) goto failed; | 6547 if (res != 0) goto failed; |
| 6483 Py_XDECREF(tmp); | 6548 Py_XDECREF(tmp); |
| 6484 tmp = NULL; | 6549 tmp = NULL; |
| 6485 } else { | 6550 } else { |
| 6486 vararg = NULL; | 6551 vararg = NULL; |
| 6487 } | 6552 } |
| 6488 if (PyObject_HasAttrString(obj, "varargannotation")) { | 6553 if (_PyObject_HasAttrId(obj, &PyId_varargannotation)) { |
| 6489 int res; | 6554 int res; |
| 6490 tmp = PyObject_GetAttrString(obj, "varargannotation"); | 6555 tmp = _PyObject_GetAttrId(obj, &PyId_varargannotation); |
| 6491 if (tmp == NULL) goto failed; | 6556 if (tmp == NULL) goto failed; |
| 6492 res = obj2ast_expr(tmp, &varargannotation, arena); | 6557 res = obj2ast_expr(tmp, &varargannotation, arena); |
| 6493 if (res != 0) goto failed; | 6558 if (res != 0) goto failed; |
| 6494 Py_XDECREF(tmp); | 6559 Py_XDECREF(tmp); |
| 6495 tmp = NULL; | 6560 tmp = NULL; |
| 6496 } else { | 6561 } else { |
| 6497 varargannotation = NULL; | 6562 varargannotation = NULL; |
| 6498 } | 6563 } |
| 6499 if (PyObject_HasAttrString(obj, "kwonlyargs")) { | 6564 if (_PyObject_HasAttrId(obj, &PyId_kwonlyargs)) { |
| 6500 int res; | 6565 int res; |
| 6501 Py_ssize_t len; | 6566 Py_ssize_t len; |
| 6502 Py_ssize_t i; | 6567 Py_ssize_t i; |
| 6503 tmp = PyObject_GetAttrString(obj, "kwonlyargs"); | 6568 tmp = _PyObject_GetAttrId(obj, &PyId_kwonlyargs); |
| 6504 if (tmp == NULL) goto failed; | 6569 if (tmp == NULL) goto failed; |
| 6505 if (!PyList_Check(tmp)) { | 6570 if (!PyList_Check(tmp)) { |
| 6506 PyErr_Format(PyExc_TypeError, "arguments field \"kwonlyargs\" must be a list, not a %.200s", tmp->ob_type->tp_name); | 6571 PyErr_Format(PyExc_TypeError, "arguments field \"kwonlyargs\" must be a list, not a %.200s", tmp->ob_type->tp_name); |
| 6507 goto failed; | 6572 goto failed; |
| 6508 } | 6573 } |
| 6519 tmp = NULL; | 6584 tmp = NULL; |
| 6520 } else { | 6585 } else { |
| 6521 PyErr_SetString(PyExc_TypeError, "required field \"kwonlyargs\" missing from arguments"); | 6586 PyErr_SetString(PyExc_TypeError, "required field \"kwonlyargs\" missing from arguments"); |
| 6522 return 1; | 6587 return 1; |
| 6523 } | 6588 } |
| 6524 if (PyObject_HasAttrString(obj, "kwarg")) { | 6589 if (_PyObject_HasAttrId(obj, &PyId_kwarg)) { |
| 6525 int res; | 6590 int res; |
| 6526 tmp = PyObject_GetAttrString(obj, "kwarg"); | 6591 tmp = _PyObject_GetAttrId(obj, &PyId_kwarg); |
| 6527 if (tmp == NULL) goto failed; | 6592 if (tmp == NULL) goto failed; |
| 6528 res = obj2ast_identifier(tmp, &kwarg, arena); | 6593 res = obj2ast_identifier(tmp, &kwarg, arena); |
| 6529 if (res != 0) goto failed; | 6594 if (res != 0) goto failed; |
| 6530 Py_XDECREF(tmp); | 6595 Py_XDECREF(tmp); |
| 6531 tmp = NULL; | 6596 tmp = NULL; |
| 6532 } else { | 6597 } else { |
| 6533 kwarg = NULL; | 6598 kwarg = NULL; |
| 6534 } | 6599 } |
| 6535 if (PyObject_HasAttrString(obj, "kwargannotation")) { | 6600 if (_PyObject_HasAttrId(obj, &PyId_kwargannotation)) { |
| 6536 int res; | 6601 int res; |
| 6537 tmp = PyObject_GetAttrString(obj, "kwargannotation"); | 6602 tmp = _PyObject_GetAttrId(obj, &PyId_kwargannotation); |
| 6538 if (tmp == NULL) goto failed; | 6603 if (tmp == NULL) goto failed; |
| 6539 res = obj2ast_expr(tmp, &kwargannotation, arena); | 6604 res = obj2ast_expr(tmp, &kwargannotation, arena); |
| 6540 if (res != 0) goto failed; | 6605 if (res != 0) goto failed; |
| 6541 Py_XDECREF(tmp); | 6606 Py_XDECREF(tmp); |
| 6542 tmp = NULL; | 6607 tmp = NULL; |
| 6543 } else { | 6608 } else { |
| 6544 kwargannotation = NULL; | 6609 kwargannotation = NULL; |
| 6545 } | 6610 } |
| 6546 if (PyObject_HasAttrString(obj, "defaults")) { | 6611 if (_PyObject_HasAttrId(obj, &PyId_defaults)) { |
| 6547 int res; | 6612 int res; |
| 6548 Py_ssize_t len; | 6613 Py_ssize_t len; |
| 6549 Py_ssize_t i; | 6614 Py_ssize_t i; |
| 6550 tmp = PyObject_GetAttrString(obj, "defaults"); | 6615 tmp = _PyObject_GetAttrId(obj, &PyId_defaults); |
| 6551 if (tmp == NULL) goto failed; | 6616 if (tmp == NULL) goto failed; |
| 6552 if (!PyList_Check(tmp)) { | 6617 if (!PyList_Check(tmp)) { |
| 6553 PyErr_Format(PyExc_TypeError, "arguments field \"defaults\" must be a list, not a %.200s", tmp->ob_type->tp_name); | 6618 PyErr_Format(PyExc_TypeError, "arguments field \"defaults\" must be a list, not a %.200s", tmp->ob_type->tp_name); |
| 6554 goto failed; | 6619 goto failed; |
| 6555 } | 6620 } |
| 6566 tmp = NULL; | 6631 tmp = NULL; |
| 6567 } else { | 6632 } else { |
| 6568 PyErr_SetString(PyExc_TypeError, "required field \"defaults\" missing from arguments"); | 6633 PyErr_SetString(PyExc_TypeError, "required field \"defaults\" missing from arguments"); |
| 6569 return 1; | 6634 return 1; |
| 6570 } | 6635 } |
| 6571 if (PyObject_HasAttrString(obj, "kw_defaults")) { | 6636 if (_PyObject_HasAttrId(obj, &PyId_kw_defaults)) { |
| 6572 int res; | 6637 int res; |
| 6573 Py_ssize_t len; | 6638 Py_ssize_t len; |
| 6574 Py_ssize_t i; | 6639 Py_ssize_t i; |
| 6575 tmp = PyObject_GetAttrString(obj, "kw_defaults"); | 6640 tmp = _PyObject_GetAttrId(obj, &PyId_kw_defaults); |
| 6576 if (tmp == NULL) goto failed; | 6641 if (tmp == NULL) goto failed; |
| 6577 if (!PyList_Check(tmp)) { | 6642 if (!PyList_Check(tmp)) { |
| 6578 PyErr_Format(PyExc_TypeError, "arguments field \"kw_defaults\" must be a list, not a %.200s", tmp->ob_type->tp_name); | 6643 PyErr_Format(PyExc_TypeError, "arguments field \"kw_defaults\" must be a list, not a %.200s", tmp->ob_type->tp_name); |
| 6579 goto failed; | 6644 goto failed; |
| 6580 } | 6645 } |
| 6606 { | 6671 { |
| 6607 PyObject* tmp = NULL; | 6672 PyObject* tmp = NULL; |
| 6608 identifier arg; | 6673 identifier arg; |
| 6609 expr_ty annotation; | 6674 expr_ty annotation; |
| 6610 | 6675 |
| 6611 if (PyObject_HasAttrString(obj, "arg")) { | 6676 if (_PyObject_HasAttrId(obj, &PyId_arg)) { |
| 6612 int res; | 6677 int res; |
| 6613 tmp = PyObject_GetAttrString(obj, "arg"); | 6678 tmp = _PyObject_GetAttrId(obj, &PyId_arg); |
| 6614 if (tmp == NULL) goto failed; | 6679 if (tmp == NULL) goto failed; |
| 6615 res = obj2ast_identifier(tmp, &arg, arena); | 6680 res = obj2ast_identifier(tmp, &arg, arena); |
| 6616 if (res != 0) goto failed; | 6681 if (res != 0) goto failed; |
| 6617 Py_XDECREF(tmp); | 6682 Py_XDECREF(tmp); |
| 6618 tmp = NULL; | 6683 tmp = NULL; |
| 6619 } else { | 6684 } else { |
| 6620 PyErr_SetString(PyExc_TypeError, "required field \"arg\" missing from arg"); | 6685 PyErr_SetString(PyExc_TypeError, "required field \"arg\" missing from arg"); |
| 6621 return 1; | 6686 return 1; |
| 6622 } | 6687 } |
| 6623 if (PyObject_HasAttrString(obj, "annotation")) { | 6688 if (_PyObject_HasAttrId(obj, &PyId_annotation)) { |
| 6624 int res; | 6689 int res; |
| 6625 tmp = PyObject_GetAttrString(obj, "annotation"); | 6690 tmp = _PyObject_GetAttrId(obj, &PyId_annotation); |
| 6626 if (tmp == NULL) goto failed; | 6691 if (tmp == NULL) goto failed; |
| 6627 res = obj2ast_expr(tmp, &annotation, arena); | 6692 res = obj2ast_expr(tmp, &annotation, arena); |
| 6628 if (res != 0) goto failed; | 6693 if (res != 0) goto failed; |
| 6629 Py_XDECREF(tmp); | 6694 Py_XDECREF(tmp); |
| 6630 tmp = NULL; | 6695 tmp = NULL; |
| 6643 { | 6708 { |
| 6644 PyObject* tmp = NULL; | 6709 PyObject* tmp = NULL; |
| 6645 identifier arg; | 6710 identifier arg; |
| 6646 expr_ty value; | 6711 expr_ty value; |
| 6647 | 6712 |
| 6648 if (PyObject_HasAttrString(obj, "arg")) { | 6713 if (_PyObject_HasAttrId(obj, &PyId_arg)) { |
| 6649 int res; | 6714 int res; |
| 6650 tmp = PyObject_GetAttrString(obj, "arg"); | 6715 tmp = _PyObject_GetAttrId(obj, &PyId_arg); |
| 6651 if (tmp == NULL) goto failed; | 6716 if (tmp == NULL) goto failed; |
| 6652 res = obj2ast_identifier(tmp, &arg, arena); | 6717 res = obj2ast_identifier(tmp, &arg, arena); |
| 6653 if (res != 0) goto failed; | 6718 if (res != 0) goto failed; |
| 6654 Py_XDECREF(tmp); | 6719 Py_XDECREF(tmp); |
| 6655 tmp = NULL; | 6720 tmp = NULL; |
| 6656 } else { | 6721 } else { |
| 6657 PyErr_SetString(PyExc_TypeError, "required field \"arg\" missing from keyword"); | 6722 PyErr_SetString(PyExc_TypeError, "required field \"arg\" missing from keyword"); |
| 6658 return 1; | 6723 return 1; |
| 6659 } | 6724 } |
| 6660 if (PyObject_HasAttrString(obj, "value")) { | 6725 if (_PyObject_HasAttrId(obj, &PyId_value)) { |
| 6661 int res; | 6726 int res; |
| 6662 tmp = PyObject_GetAttrString(obj, "value"); | 6727 tmp = _PyObject_GetAttrId(obj, &PyId_value); |
| 6663 if (tmp == NULL) goto failed; | 6728 if (tmp == NULL) goto failed; |
| 6664 res = obj2ast_expr(tmp, &value, arena); | 6729 res = obj2ast_expr(tmp, &value, arena); |
| 6665 if (res != 0) goto failed; | 6730 if (res != 0) goto failed; |
| 6666 Py_XDECREF(tmp); | 6731 Py_XDECREF(tmp); |
| 6667 tmp = NULL; | 6732 tmp = NULL; |
| 6681 { | 6746 { |
| 6682 PyObject* tmp = NULL; | 6747 PyObject* tmp = NULL; |
| 6683 identifier name; | 6748 identifier name; |
| 6684 identifier asname; | 6749 identifier asname; |
| 6685 | 6750 |
| 6686 if (PyObject_HasAttrString(obj, "name")) { | 6751 if (_PyObject_HasAttrId(obj, &PyId_name)) { |
| 6687 int res; | 6752 int res; |
| 6688 tmp = PyObject_GetAttrString(obj, "name"); | 6753 tmp = _PyObject_GetAttrId(obj, &PyId_name); |
| 6689 if (tmp == NULL) goto failed; | 6754 if (tmp == NULL) goto failed; |
| 6690 res = obj2ast_identifier(tmp, &name, arena); | 6755 res = obj2ast_identifier(tmp, &name, arena); |
| 6691 if (res != 0) goto failed; | 6756 if (res != 0) goto failed; |
| 6692 Py_XDECREF(tmp); | 6757 Py_XDECREF(tmp); |
| 6693 tmp = NULL; | 6758 tmp = NULL; |
| 6694 } else { | 6759 } else { |
| 6695 PyErr_SetString(PyExc_TypeError, "required field \"name\" missing from alias"); | 6760 PyErr_SetString(PyExc_TypeError, "required field \"name\" missing from alias"); |
| 6696 return 1; | 6761 return 1; |
| 6697 } | 6762 } |
| 6698 if (PyObject_HasAttrString(obj, "asname")) { | 6763 if (_PyObject_HasAttrId(obj, &PyId_asname)) { |
| 6699 int res; | 6764 int res; |
| 6700 tmp = PyObject_GetAttrString(obj, "asname"); | 6765 tmp = _PyObject_GetAttrId(obj, &PyId_asname); |
| 6701 if (tmp == NULL) goto failed; | 6766 if (tmp == NULL) goto failed; |
| 6702 res = obj2ast_identifier(tmp, &asname, arena); | 6767 res = obj2ast_identifier(tmp, &asname, arena); |
| 6703 if (res != 0) goto failed; | 6768 if (res != 0) goto failed; |
| 6704 Py_XDECREF(tmp); | 6769 Py_XDECREF(tmp); |
| 6705 tmp = NULL; | 6770 tmp = NULL; |
| 6718 { | 6783 { |
| 6719 PyObject* tmp = NULL; | 6784 PyObject* tmp = NULL; |
| 6720 expr_ty context_expr; | 6785 expr_ty context_expr; |
| 6721 expr_ty optional_vars; | 6786 expr_ty optional_vars; |
| 6722 | 6787 |
| 6723 if (PyObject_HasAttrString(obj, "context_expr")) { | 6788 if (_PyObject_HasAttrId(obj, &PyId_context_expr)) { |
| 6724 int res; | 6789 int res; |
| 6725 tmp = PyObject_GetAttrString(obj, "context_expr"); | 6790 tmp = _PyObject_GetAttrId(obj, &PyId_context_expr); |
| 6726 if (tmp == NULL) goto failed; | 6791 if (tmp == NULL) goto failed; |
| 6727 res = obj2ast_expr(tmp, &context_expr, arena); | 6792 res = obj2ast_expr(tmp, &context_expr, arena); |
| 6728 if (res != 0) goto failed; | 6793 if (res != 0) goto failed; |
| 6729 Py_XDECREF(tmp); | 6794 Py_XDECREF(tmp); |
| 6730 tmp = NULL; | 6795 tmp = NULL; |
| 6731 } else { | 6796 } else { |
| 6732 PyErr_SetString(PyExc_TypeError, "required field \"context_expr\" missing from withitem"); | 6797 PyErr_SetString(PyExc_TypeError, "required field \"context_expr\" missing from withitem"); |
| 6733 return 1; | 6798 return 1; |
| 6734 } | 6799 } |
| 6735 if (PyObject_HasAttrString(obj, "optional_vars")) { | 6800 if (_PyObject_HasAttrId(obj, &PyId_optional_vars)) { |
| 6736 int res; | 6801 int res; |
| 6737 tmp = PyObject_GetAttrString(obj, "optional_vars"); | 6802 tmp = _PyObject_GetAttrId(obj, &PyId_optional_vars); |
| 6738 if (tmp == NULL) goto failed; | 6803 if (tmp == NULL) goto failed; |
| 6739 res = obj2ast_expr(tmp, &optional_vars, arena); | 6804 res = obj2ast_expr(tmp, &optional_vars, arena); |
| 6740 if (res != 0) goto failed; | 6805 if (res != 0) goto failed; |
| 6741 Py_XDECREF(tmp); | 6806 Py_XDECREF(tmp); |
| 6742 tmp = NULL; | 6807 tmp = NULL; |
