3180
3180
obj2ast_mod(PyObject* obj, mod_ty* out, PyArena* arena)
3182
3182
PyObject* tmp = NULL;
3185
3186
if (obj == Py_None) {
3189
if (PyObject_IsInstance(obj, (PyObject*)Module_type)) {
3190
isinstance = PyObject_IsInstance(obj, (PyObject*)Module_type);
3191
if (isinstance == -1) {
3190
3195
asdl_seq* body;
3192
3197
if (PyObject_HasAttrString(obj, "body")) {
3218
3223
if (*out == NULL) goto failed;
3221
if (PyObject_IsInstance(obj, (PyObject*)Interactive_type)) {
3226
isinstance = PyObject_IsInstance(obj, (PyObject*)Interactive_type);
3227
if (isinstance == -1) {
3222
3231
asdl_seq* body;
3224
3233
if (PyObject_HasAttrString(obj, "body")) {
3250
3259
if (*out == NULL) goto failed;
3253
if (PyObject_IsInstance(obj, (PyObject*)Expression_type)) {
3262
isinstance = PyObject_IsInstance(obj, (PyObject*)Expression_type);
3263
if (isinstance == -1) {
3256
3269
if (PyObject_HasAttrString(obj, "body")) {
3269
3282
if (*out == NULL) goto failed;
3272
if (PyObject_IsInstance(obj, (PyObject*)Suite_type)) {
3285
isinstance = PyObject_IsInstance(obj, (PyObject*)Suite_type);
3286
if (isinstance == -1) {
3273
3290
asdl_seq* body;
3275
3292
if (PyObject_HasAttrString(obj, "body")) {
3346
3364
PyErr_SetString(PyExc_TypeError, "required field \"col_offset\" missing from stmt");
3349
if (PyObject_IsInstance(obj, (PyObject*)FunctionDef_type)) {
3367
isinstance = PyObject_IsInstance(obj, (PyObject*)FunctionDef_type);
3368
if (isinstance == -1) {
3350
3372
identifier name;
3351
3373
arguments_ty args;
3352
3374
asdl_seq* body;
3529
3555
if (*out == NULL) goto failed;
3532
if (PyObject_IsInstance(obj, (PyObject*)Return_type)) {
3558
isinstance = PyObject_IsInstance(obj, (PyObject*)Return_type);
3559
if (isinstance == -1) {
3535
3565
if (PyObject_HasAttrString(obj, "value")) {
3547
3577
if (*out == NULL) goto failed;
3550
if (PyObject_IsInstance(obj, (PyObject*)Delete_type)) {
3580
isinstance = PyObject_IsInstance(obj, (PyObject*)Delete_type);
3581
if (isinstance == -1) {
3551
3585
asdl_seq* targets;
3553
3587
if (PyObject_HasAttrString(obj, "targets")) {
4227
4305
if (*out == NULL) goto failed;
4230
if (PyObject_IsInstance(obj, (PyObject*)Import_type)) {
4308
isinstance = PyObject_IsInstance(obj, (PyObject*)Import_type);
4309
if (isinstance == -1) {
4231
4313
asdl_seq* names;
4233
4315
if (PyObject_HasAttrString(obj, "names")) {
4360
4450
if (*out == NULL) goto failed;
4363
if (PyObject_IsInstance(obj, (PyObject*)Global_type)) {
4453
isinstance = PyObject_IsInstance(obj, (PyObject*)Global_type);
4454
if (isinstance == -1) {
4364
4458
asdl_seq* names;
4366
4460
if (PyObject_HasAttrString(obj, "names")) {
4392
4486
if (*out == NULL) goto failed;
4395
if (PyObject_IsInstance(obj, (PyObject*)Expr_type)) {
4489
isinstance = PyObject_IsInstance(obj, (PyObject*)Expr_type);
4490
if (isinstance == -1) {
4398
4496
if (PyObject_HasAttrString(obj, "value")) {
4411
4509
if (*out == NULL) goto failed;
4414
if (PyObject_IsInstance(obj, (PyObject*)Pass_type)) {
4512
isinstance = PyObject_IsInstance(obj, (PyObject*)Pass_type);
4513
if (isinstance == -1) {
4416
4518
*out = Pass(lineno, col_offset, arena);
4417
4519
if (*out == NULL) goto failed;
4420
if (PyObject_IsInstance(obj, (PyObject*)Break_type)) {
4522
isinstance = PyObject_IsInstance(obj, (PyObject*)Break_type);
4523
if (isinstance == -1) {
4422
4528
*out = Break(lineno, col_offset, arena);
4423
4529
if (*out == NULL) goto failed;
4426
if (PyObject_IsInstance(obj, (PyObject*)Continue_type)) {
4532
isinstance = PyObject_IsInstance(obj, (PyObject*)Continue_type);
4533
if (isinstance == -1) {
4428
4538
*out = Continue(lineno, col_offset, arena);
4429
4539
if (*out == NULL) goto failed;
4474
4585
PyErr_SetString(PyExc_TypeError, "required field \"col_offset\" missing from expr");
4477
if (PyObject_IsInstance(obj, (PyObject*)BoolOp_type)) {
4588
isinstance = PyObject_IsInstance(obj, (PyObject*)BoolOp_type);
4589
if (isinstance == -1) {
4479
4594
asdl_seq* values;
4821
4964
if (*out == NULL) goto failed;
4824
if (PyObject_IsInstance(obj, (PyObject*)Yield_type)) {
4967
isinstance = PyObject_IsInstance(obj, (PyObject*)Yield_type);
4968
if (isinstance == -1) {
4827
4974
if (PyObject_HasAttrString(obj, "value")) {
5007
5162
if (*out == NULL) goto failed;
5010
if (PyObject_IsInstance(obj, (PyObject*)Repr_type)) {
5165
isinstance = PyObject_IsInstance(obj, (PyObject*)Repr_type);
5166
if (isinstance == -1) {
5013
5172
if (PyObject_HasAttrString(obj, "value")) {
5026
5185
if (*out == NULL) goto failed;
5029
if (PyObject_IsInstance(obj, (PyObject*)Num_type)) {
5188
isinstance = PyObject_IsInstance(obj, (PyObject*)Num_type);
5189
if (isinstance == -1) {
5032
5195
if (PyObject_HasAttrString(obj, "n")) {
5045
5208
if (*out == NULL) goto failed;
5048
if (PyObject_IsInstance(obj, (PyObject*)Str_type)) {
5211
isinstance = PyObject_IsInstance(obj, (PyObject*)Str_type);
5212
if (isinstance == -1) {
5051
5218
if (PyObject_HasAttrString(obj, "s")) {
5289
5476
obj2ast_expr_context(PyObject* obj, expr_context_ty* out, PyArena* arena)
5291
5478
PyObject* tmp = NULL;
5293
if (PyObject_IsInstance(obj, (PyObject*)Load_type)) {
5481
isinstance = PyObject_IsInstance(obj, (PyObject *)Load_type);
5482
if (isinstance == -1) {
5297
if (PyObject_IsInstance(obj, (PyObject*)Store_type)) {
5489
isinstance = PyObject_IsInstance(obj, (PyObject *)Store_type);
5490
if (isinstance == -1) {
5301
if (PyObject_IsInstance(obj, (PyObject*)Del_type)) {
5497
isinstance = PyObject_IsInstance(obj, (PyObject *)Del_type);
5498
if (isinstance == -1) {
5305
if (PyObject_IsInstance(obj, (PyObject*)AugLoad_type)) {
5505
isinstance = PyObject_IsInstance(obj, (PyObject *)AugLoad_type);
5506
if (isinstance == -1) {
5306
5510
*out = AugLoad;
5309
if (PyObject_IsInstance(obj, (PyObject*)AugStore_type)) {
5513
isinstance = PyObject_IsInstance(obj, (PyObject *)AugStore_type);
5514
if (isinstance == -1) {
5310
5518
*out = AugStore;
5313
if (PyObject_IsInstance(obj, (PyObject*)Param_type)) {
5521
isinstance = PyObject_IsInstance(obj, (PyObject *)Param_type);
5522
if (isinstance == -1) {
5327
5539
obj2ast_slice(PyObject* obj, slice_ty* out, PyArena* arena)
5329
5541
PyObject* tmp = NULL;
5332
5545
if (obj == Py_None) {
5336
if (PyObject_IsInstance(obj, (PyObject*)Ellipsis_type)) {
5549
isinstance = PyObject_IsInstance(obj, (PyObject*)Ellipsis_type);
5550
if (isinstance == -1) {
5338
5555
*out = Ellipsis(arena);
5339
5556
if (*out == NULL) goto failed;
5342
if (PyObject_IsInstance(obj, (PyObject*)Slice_type)) {
5559
isinstance = PyObject_IsInstance(obj, (PyObject*)Slice_type);
5560
if (isinstance == -1) {
5381
5602
if (*out == NULL) goto failed;
5384
if (PyObject_IsInstance(obj, (PyObject*)ExtSlice_type)) {
5605
isinstance = PyObject_IsInstance(obj, (PyObject*)ExtSlice_type);
5606
if (isinstance == -1) {
5385
5610
asdl_seq* dims;
5387
5612
if (PyObject_HasAttrString(obj, "dims")) {
5413
5638
if (*out == NULL) goto failed;
5416
if (PyObject_IsInstance(obj, (PyObject*)Index_type)) {
5641
isinstance = PyObject_IsInstance(obj, (PyObject*)Index_type);
5642
if (isinstance == -1) {
5419
5648
if (PyObject_HasAttrString(obj, "value")) {
5445
5674
obj2ast_boolop(PyObject* obj, boolop_ty* out, PyArena* arena)
5447
5676
PyObject* tmp = NULL;
5449
if (PyObject_IsInstance(obj, (PyObject*)And_type)) {
5679
isinstance = PyObject_IsInstance(obj, (PyObject *)And_type);
5680
if (isinstance == -1) {
5453
if (PyObject_IsInstance(obj, (PyObject*)Or_type)) {
5687
isinstance = PyObject_IsInstance(obj, (PyObject *)Or_type);
5688
if (isinstance == -1) {
5467
5705
obj2ast_operator(PyObject* obj, operator_ty* out, PyArena* arena)
5469
5707
PyObject* tmp = NULL;
5471
if (PyObject_IsInstance(obj, (PyObject*)Add_type)) {
5710
isinstance = PyObject_IsInstance(obj, (PyObject *)Add_type);
5711
if (isinstance == -1) {
5475
if (PyObject_IsInstance(obj, (PyObject*)Sub_type)) {
5718
isinstance = PyObject_IsInstance(obj, (PyObject *)Sub_type);
5719
if (isinstance == -1) {
5479
if (PyObject_IsInstance(obj, (PyObject*)Mult_type)) {
5726
isinstance = PyObject_IsInstance(obj, (PyObject *)Mult_type);
5727
if (isinstance == -1) {
5483
if (PyObject_IsInstance(obj, (PyObject*)Div_type)) {
5734
isinstance = PyObject_IsInstance(obj, (PyObject *)Div_type);
5735
if (isinstance == -1) {
5487
if (PyObject_IsInstance(obj, (PyObject*)Mod_type)) {
5742
isinstance = PyObject_IsInstance(obj, (PyObject *)Mod_type);
5743
if (isinstance == -1) {
5491
if (PyObject_IsInstance(obj, (PyObject*)Pow_type)) {
5750
isinstance = PyObject_IsInstance(obj, (PyObject *)Pow_type);
5751
if (isinstance == -1) {
5495
if (PyObject_IsInstance(obj, (PyObject*)LShift_type)) {
5758
isinstance = PyObject_IsInstance(obj, (PyObject *)LShift_type);
5759
if (isinstance == -1) {
5499
if (PyObject_IsInstance(obj, (PyObject*)RShift_type)) {
5766
isinstance = PyObject_IsInstance(obj, (PyObject *)RShift_type);
5767
if (isinstance == -1) {
5503
if (PyObject_IsInstance(obj, (PyObject*)BitOr_type)) {
5774
isinstance = PyObject_IsInstance(obj, (PyObject *)BitOr_type);
5775
if (isinstance == -1) {
5507
if (PyObject_IsInstance(obj, (PyObject*)BitXor_type)) {
5782
isinstance = PyObject_IsInstance(obj, (PyObject *)BitXor_type);
5783
if (isinstance == -1) {
5511
if (PyObject_IsInstance(obj, (PyObject*)BitAnd_type)) {
5790
isinstance = PyObject_IsInstance(obj, (PyObject *)BitAnd_type);
5791
if (isinstance == -1) {
5515
if (PyObject_IsInstance(obj, (PyObject*)FloorDiv_type)) {
5798
isinstance = PyObject_IsInstance(obj, (PyObject *)FloorDiv_type);
5799
if (isinstance == -1) {
5516
5803
*out = FloorDiv;
5529
5816
obj2ast_unaryop(PyObject* obj, unaryop_ty* out, PyArena* arena)
5531
5818
PyObject* tmp = NULL;
5533
if (PyObject_IsInstance(obj, (PyObject*)Invert_type)) {
5821
isinstance = PyObject_IsInstance(obj, (PyObject *)Invert_type);
5822
if (isinstance == -1) {
5537
if (PyObject_IsInstance(obj, (PyObject*)Not_type)) {
5829
isinstance = PyObject_IsInstance(obj, (PyObject *)Not_type);
5830
if (isinstance == -1) {
5541
if (PyObject_IsInstance(obj, (PyObject*)UAdd_type)) {
5837
isinstance = PyObject_IsInstance(obj, (PyObject *)UAdd_type);
5838
if (isinstance == -1) {
5545
if (PyObject_IsInstance(obj, (PyObject*)USub_type)) {
5845
isinstance = PyObject_IsInstance(obj, (PyObject *)USub_type);
5846
if (isinstance == -1) {
5559
5863
obj2ast_cmpop(PyObject* obj, cmpop_ty* out, PyArena* arena)
5561
5865
PyObject* tmp = NULL;
5563
if (PyObject_IsInstance(obj, (PyObject*)Eq_type)) {
5868
isinstance = PyObject_IsInstance(obj, (PyObject *)Eq_type);
5869
if (isinstance == -1) {
5567
if (PyObject_IsInstance(obj, (PyObject*)NotEq_type)) {
5876
isinstance = PyObject_IsInstance(obj, (PyObject *)NotEq_type);
5877
if (isinstance == -1) {
5571
if (PyObject_IsInstance(obj, (PyObject*)Lt_type)) {
5884
isinstance = PyObject_IsInstance(obj, (PyObject *)Lt_type);
5885
if (isinstance == -1) {
5575
if (PyObject_IsInstance(obj, (PyObject*)LtE_type)) {
5892
isinstance = PyObject_IsInstance(obj, (PyObject *)LtE_type);
5893
if (isinstance == -1) {
5579
if (PyObject_IsInstance(obj, (PyObject*)Gt_type)) {
5900
isinstance = PyObject_IsInstance(obj, (PyObject *)Gt_type);
5901
if (isinstance == -1) {
5583
if (PyObject_IsInstance(obj, (PyObject*)GtE_type)) {
5908
isinstance = PyObject_IsInstance(obj, (PyObject *)GtE_type);
5909
if (isinstance == -1) {
5587
if (PyObject_IsInstance(obj, (PyObject*)Is_type)) {
5916
isinstance = PyObject_IsInstance(obj, (PyObject *)Is_type);
5917
if (isinstance == -1) {
5591
if (PyObject_IsInstance(obj, (PyObject*)IsNot_type)) {
5924
isinstance = PyObject_IsInstance(obj, (PyObject *)IsNot_type);
5925
if (isinstance == -1) {
5595
if (PyObject_IsInstance(obj, (PyObject*)In_type)) {
5932
isinstance = PyObject_IsInstance(obj, (PyObject *)In_type);
5933
if (isinstance == -1) {
5599
if (PyObject_IsInstance(obj, (PyObject*)NotIn_type)) {
5940
isinstance = PyObject_IsInstance(obj, (PyObject *)NotIn_type);
5941
if (isinstance == -1) {
5709
6055
PyErr_SetString(PyExc_TypeError, "required field \"col_offset\" missing from excepthandler");
5712
if (PyObject_IsInstance(obj, (PyObject*)ExceptHandler_type)) {
6058
isinstance = PyObject_IsInstance(obj, (PyObject*)ExceptHandler_type);
6059
if (isinstance == -1) {
5715
6065
asdl_seq* body;
6110
6460
PyObject *req_type[] = {(PyObject*)Module_type, (PyObject*)Expression_type,
6111
6461
(PyObject*)Interactive_type};
6112
6462
char *req_name[] = {"Module", "Expression", "Interactive"};
6113
6464
assert(0 <= mode && mode <= 2);
6117
if (!PyObject_IsInstance(ast, req_type[mode])) {
6468
isinstance = PyObject_IsInstance(ast, req_type[mode]);
6469
if (isinstance == -1)
6118
6472
PyErr_Format(PyExc_TypeError, "expected %s node, got %.400s",
6119
6473
req_name[mode], Py_TYPE(ast)->tp_name);