comparison Python/Python-ast.c @ 72926:db4aa878cea2

Port SetAttrString/HasAttrString to SetAttrId/GetAttrId.
author Martin v. Löwis <martin@v.loewis.de>
date Fri, 14 Oct 2011 15:16:45 +0200
parents 7109f31300fb
children 53cc2668d54f
comparison
equal deleted inserted replaced
72925:7109f31300fb 72926:db4aa878cea2
591 } 591 }
592 592
593 static int add_attributes(PyTypeObject* type, char**attrs, int num_fields) 593 static int add_attributes(PyTypeObject* type, char**attrs, int num_fields)
594 { 594 {
595 int i, result; 595 int i, result;
596 _Py_IDENTIFIER(_attributes);
596 PyObject *s, *l = PyTuple_New(num_fields); 597 PyObject *s, *l = PyTuple_New(num_fields);
597 if (!l) 598 if (!l)
598 return 0; 599 return 0;
599 for (i = 0; i < num_fields; i++) { 600 for (i = 0; i < num_fields; i++) {
600 s = PyUnicode_FromString(attrs[i]); 601 s = PyUnicode_FromString(attrs[i]);
602 Py_DECREF(l); 603 Py_DECREF(l);
603 return 0; 604 return 0;
604 } 605 }
605 PyTuple_SET_ITEM(l, i, s); 606 PyTuple_SET_ITEM(l, i, s);
606 } 607 }
607 result = PyObject_SetAttrString((PyObject*)type, "_attributes", l) >= 0; 608 result = _PyObject_SetAttrId((PyObject*)type, &PyId__attributes, l) >= 0;
608 Py_DECREF(l); 609 Py_DECREF(l);
609 return result; 610 return result;
610 } 611 }
611 612
612 /* Conversion AST -> Python */ 613 /* Conversion AST -> Python */
2228 case Module_kind: 2229 case Module_kind:
2229 result = PyType_GenericNew(Module_type, NULL, NULL); 2230 result = PyType_GenericNew(Module_type, NULL, NULL);
2230 if (!result) goto failed; 2231 if (!result) goto failed;
2231 value = ast2obj_list(o->v.Module.body, ast2obj_stmt); 2232 value = ast2obj_list(o->v.Module.body, ast2obj_stmt);
2232 if (!value) goto failed; 2233 if (!value) goto failed;
2233 if (PyObject_SetAttrString(result, "body", value) == -1) 2234 if (_PyObject_SetAttrId(result, &PyId_body, value) == -1)
2234 goto failed; 2235 goto failed;
2235 Py_DECREF(value); 2236 Py_DECREF(value);
2236 break; 2237 break;
2237 case Interactive_kind: 2238 case Interactive_kind:
2238 result = PyType_GenericNew(Interactive_type, NULL, NULL); 2239 result = PyType_GenericNew(Interactive_type, NULL, NULL);
2239 if (!result) goto failed; 2240 if (!result) goto failed;
2240 value = ast2obj_list(o->v.Interactive.body, ast2obj_stmt); 2241 value = ast2obj_list(o->v.Interactive.body, ast2obj_stmt);
2241 if (!value) goto failed; 2242 if (!value) goto failed;
2242 if (PyObject_SetAttrString(result, "body", value) == -1) 2243 if (_PyObject_SetAttrId(result, &PyId_body, value) == -1)
2243 goto failed; 2244 goto failed;
2244 Py_DECREF(value); 2245 Py_DECREF(value);
2245 break; 2246 break;
2246 case Expression_kind: 2247 case Expression_kind:
2247 result = PyType_GenericNew(Expression_type, NULL, NULL); 2248 result = PyType_GenericNew(Expression_type, NULL, NULL);
2248 if (!result) goto failed; 2249 if (!result) goto failed;
2249 value = ast2obj_expr(o->v.Expression.body); 2250 value = ast2obj_expr(o->v.Expression.body);
2250 if (!value) goto failed; 2251 if (!value) goto failed;
2251 if (PyObject_SetAttrString(result, "body", value) == -1) 2252 if (_PyObject_SetAttrId(result, &PyId_body, value) == -1)
2252 goto failed; 2253 goto failed;
2253 Py_DECREF(value); 2254 Py_DECREF(value);
2254 break; 2255 break;
2255 case Suite_kind: 2256 case Suite_kind:
2256 result = PyType_GenericNew(Suite_type, NULL, NULL); 2257 result = PyType_GenericNew(Suite_type, NULL, NULL);
2257 if (!result) goto failed; 2258 if (!result) goto failed;
2258 value = ast2obj_list(o->v.Suite.body, ast2obj_stmt); 2259 value = ast2obj_list(o->v.Suite.body, ast2obj_stmt);
2259 if (!value) goto failed; 2260 if (!value) goto failed;
2260 if (PyObject_SetAttrString(result, "body", value) == -1) 2261 if (_PyObject_SetAttrId(result, &PyId_body, value) == -1)
2261 goto failed; 2262 goto failed;
2262 Py_DECREF(value); 2263 Py_DECREF(value);
2263 break; 2264 break;
2264 } 2265 }
2265 return result; 2266 return result;
2283 case FunctionDef_kind: 2284 case FunctionDef_kind:
2284 result = PyType_GenericNew(FunctionDef_type, NULL, NULL); 2285 result = PyType_GenericNew(FunctionDef_type, NULL, NULL);
2285 if (!result) goto failed; 2286 if (!result) goto failed;
2286 value = ast2obj_identifier(o->v.FunctionDef.name); 2287 value = ast2obj_identifier(o->v.FunctionDef.name);
2287 if (!value) goto failed; 2288 if (!value) goto failed;
2288 if (PyObject_SetAttrString(result, "name", value) == -1) 2289 if (_PyObject_SetAttrId(result, &PyId_name, value) == -1)
2289 goto failed; 2290 goto failed;
2290 Py_DECREF(value); 2291 Py_DECREF(value);
2291 value = ast2obj_arguments(o->v.FunctionDef.args); 2292 value = ast2obj_arguments(o->v.FunctionDef.args);
2292 if (!value) goto failed; 2293 if (!value) goto failed;
2293 if (PyObject_SetAttrString(result, "args", value) == -1) 2294 if (_PyObject_SetAttrId(result, &PyId_args, value) == -1)
2294 goto failed; 2295 goto failed;
2295 Py_DECREF(value); 2296 Py_DECREF(value);
2296 value = ast2obj_list(o->v.FunctionDef.body, ast2obj_stmt); 2297 value = ast2obj_list(o->v.FunctionDef.body, ast2obj_stmt);
2297 if (!value) goto failed; 2298 if (!value) goto failed;
2298 if (PyObject_SetAttrString(result, "body", value) == -1) 2299 if (_PyObject_SetAttrId(result, &PyId_body, value) == -1)
2299 goto failed; 2300 goto failed;
2300 Py_DECREF(value); 2301 Py_DECREF(value);
2301 value = ast2obj_list(o->v.FunctionDef.decorator_list, 2302 value = ast2obj_list(o->v.FunctionDef.decorator_list,
2302 ast2obj_expr); 2303 ast2obj_expr);
2303 if (!value) goto failed; 2304 if (!value) goto failed;
2304 if (PyObject_SetAttrString(result, "decorator_list", value) == 2305 if (_PyObject_SetAttrId(result, &PyId_decorator_list, value) ==
2305 -1) 2306 -1)
2306 goto failed; 2307 goto failed;
2307 Py_DECREF(value); 2308 Py_DECREF(value);
2308 value = ast2obj_expr(o->v.FunctionDef.returns); 2309 value = ast2obj_expr(o->v.FunctionDef.returns);
2309 if (!value) goto failed; 2310 if (!value) goto failed;
2310 if (PyObject_SetAttrString(result, "returns", value) == -1) 2311 if (_PyObject_SetAttrId(result, &PyId_returns, value) == -1)
2311 goto failed; 2312 goto failed;
2312 Py_DECREF(value); 2313 Py_DECREF(value);
2313 break; 2314 break;
2314 case ClassDef_kind: 2315 case ClassDef_kind:
2315 result = PyType_GenericNew(ClassDef_type, NULL, NULL); 2316 result = PyType_GenericNew(ClassDef_type, NULL, NULL);
2316 if (!result) goto failed; 2317 if (!result) goto failed;
2317 value = ast2obj_identifier(o->v.ClassDef.name); 2318 value = ast2obj_identifier(o->v.ClassDef.name);
2318 if (!value) goto failed; 2319 if (!value) goto failed;
2319 if (PyObject_SetAttrString(result, "name", value) == -1) 2320 if (_PyObject_SetAttrId(result, &PyId_name, value) == -1)
2320 goto failed; 2321 goto failed;
2321 Py_DECREF(value); 2322 Py_DECREF(value);
2322 value = ast2obj_list(o->v.ClassDef.bases, ast2obj_expr); 2323 value = ast2obj_list(o->v.ClassDef.bases, ast2obj_expr);
2323 if (!value) goto failed; 2324 if (!value) goto failed;
2324 if (PyObject_SetAttrString(result, "bases", value) == -1) 2325 if (_PyObject_SetAttrId(result, &PyId_bases, value) == -1)
2325 goto failed; 2326 goto failed;
2326 Py_DECREF(value); 2327 Py_DECREF(value);
2327 value = ast2obj_list(o->v.ClassDef.keywords, ast2obj_keyword); 2328 value = ast2obj_list(o->v.ClassDef.keywords, ast2obj_keyword);
2328 if (!value) goto failed; 2329 if (!value) goto failed;
2329 if (PyObject_SetAttrString(result, "keywords", value) == -1) 2330 if (_PyObject_SetAttrId(result, &PyId_keywords, value) == -1)
2330 goto failed; 2331 goto failed;
2331 Py_DECREF(value); 2332 Py_DECREF(value);
2332 value = ast2obj_expr(o->v.ClassDef.starargs); 2333 value = ast2obj_expr(o->v.ClassDef.starargs);
2333 if (!value) goto failed; 2334 if (!value) goto failed;
2334 if (PyObject_SetAttrString(result, "starargs", value) == -1) 2335 if (_PyObject_SetAttrId(result, &PyId_starargs, value) == -1)
2335 goto failed; 2336 goto failed;
2336 Py_DECREF(value); 2337 Py_DECREF(value);
2337 value = ast2obj_expr(o->v.ClassDef.kwargs); 2338 value = ast2obj_expr(o->v.ClassDef.kwargs);
2338 if (!value) goto failed; 2339 if (!value) goto failed;
2339 if (PyObject_SetAttrString(result, "kwargs", value) == -1) 2340 if (_PyObject_SetAttrId(result, &PyId_kwargs, value) == -1)
2340 goto failed; 2341 goto failed;
2341 Py_DECREF(value); 2342 Py_DECREF(value);
2342 value = ast2obj_list(o->v.ClassDef.body, ast2obj_stmt); 2343 value = ast2obj_list(o->v.ClassDef.body, ast2obj_stmt);
2343 if (!value) goto failed; 2344 if (!value) goto failed;
2344 if (PyObject_SetAttrString(result, "body", value) == -1) 2345 if (_PyObject_SetAttrId(result, &PyId_body, value) == -1)
2345 goto failed; 2346 goto failed;
2346 Py_DECREF(value); 2347 Py_DECREF(value);
2347 value = ast2obj_list(o->v.ClassDef.decorator_list, 2348 value = ast2obj_list(o->v.ClassDef.decorator_list,
2348 ast2obj_expr); 2349 ast2obj_expr);
2349 if (!value) goto failed; 2350 if (!value) goto failed;
2350 if (PyObject_SetAttrString(result, "decorator_list", value) == 2351 if (_PyObject_SetAttrId(result, &PyId_decorator_list, value) ==
2351 -1) 2352 -1)
2352 goto failed; 2353 goto failed;
2353 Py_DECREF(value); 2354 Py_DECREF(value);
2354 break; 2355 break;
2355 case Return_kind: 2356 case Return_kind:
2356 result = PyType_GenericNew(Return_type, NULL, NULL); 2357 result = PyType_GenericNew(Return_type, NULL, NULL);
2357 if (!result) goto failed; 2358 if (!result) goto failed;
2358 value = ast2obj_expr(o->v.Return.value); 2359 value = ast2obj_expr(o->v.Return.value);
2359 if (!value) goto failed; 2360 if (!value) goto failed;
2360 if (PyObject_SetAttrString(result, "value", value) == -1) 2361 if (_PyObject_SetAttrId(result, &PyId_value, value) == -1)
2361 goto failed; 2362 goto failed;
2362 Py_DECREF(value); 2363 Py_DECREF(value);
2363 break; 2364 break;
2364 case Delete_kind: 2365 case Delete_kind:
2365 result = PyType_GenericNew(Delete_type, NULL, NULL); 2366 result = PyType_GenericNew(Delete_type, NULL, NULL);
2366 if (!result) goto failed; 2367 if (!result) goto failed;
2367 value = ast2obj_list(o->v.Delete.targets, ast2obj_expr); 2368 value = ast2obj_list(o->v.Delete.targets, ast2obj_expr);
2368 if (!value) goto failed; 2369 if (!value) goto failed;
2369 if (PyObject_SetAttrString(result, "targets", value) == -1) 2370 if (_PyObject_SetAttrId(result, &PyId_targets, value) == -1)
2370 goto failed; 2371 goto failed;
2371 Py_DECREF(value); 2372 Py_DECREF(value);
2372 break; 2373 break;
2373 case Assign_kind: 2374 case Assign_kind:
2374 result = PyType_GenericNew(Assign_type, NULL, NULL); 2375 result = PyType_GenericNew(Assign_type, NULL, NULL);
2375 if (!result) goto failed; 2376 if (!result) goto failed;
2376 value = ast2obj_list(o->v.Assign.targets, ast2obj_expr); 2377 value = ast2obj_list(o->v.Assign.targets, ast2obj_expr);
2377 if (!value) goto failed; 2378 if (!value) goto failed;
2378 if (PyObject_SetAttrString(result, "targets", value) == -1) 2379 if (_PyObject_SetAttrId(result, &PyId_targets, value) == -1)
2379 goto failed; 2380 goto failed;
2380 Py_DECREF(value); 2381 Py_DECREF(value);
2381 value = ast2obj_expr(o->v.Assign.value); 2382 value = ast2obj_expr(o->v.Assign.value);
2382 if (!value) goto failed; 2383 if (!value) goto failed;
2383 if (PyObject_SetAttrString(result, "value", value) == -1) 2384 if (_PyObject_SetAttrId(result, &PyId_value, value) == -1)
2384 goto failed; 2385 goto failed;
2385 Py_DECREF(value); 2386 Py_DECREF(value);
2386 break; 2387 break;
2387 case AugAssign_kind: 2388 case AugAssign_kind:
2388 result = PyType_GenericNew(AugAssign_type, NULL, NULL); 2389 result = PyType_GenericNew(AugAssign_type, NULL, NULL);
2389 if (!result) goto failed; 2390 if (!result) goto failed;
2390 value = ast2obj_expr(o->v.AugAssign.target); 2391 value = ast2obj_expr(o->v.AugAssign.target);
2391 if (!value) goto failed; 2392 if (!value) goto failed;
2392 if (PyObject_SetAttrString(result, "target", value) == -1) 2393 if (_PyObject_SetAttrId(result, &PyId_target, value) == -1)
2393 goto failed; 2394 goto failed;
2394 Py_DECREF(value); 2395 Py_DECREF(value);
2395 value = ast2obj_operator(o->v.AugAssign.op); 2396 value = ast2obj_operator(o->v.AugAssign.op);
2396 if (!value) goto failed; 2397 if (!value) goto failed;
2397 if (PyObject_SetAttrString(result, "op", value) == -1) 2398 if (_PyObject_SetAttrId(result, &PyId_op, value) == -1)
2398 goto failed; 2399 goto failed;
2399 Py_DECREF(value); 2400 Py_DECREF(value);
2400 value = ast2obj_expr(o->v.AugAssign.value); 2401 value = ast2obj_expr(o->v.AugAssign.value);
2401 if (!value) goto failed; 2402 if (!value) goto failed;
2402 if (PyObject_SetAttrString(result, "value", value) == -1) 2403 if (_PyObject_SetAttrId(result, &PyId_value, value) == -1)
2403 goto failed; 2404 goto failed;
2404 Py_DECREF(value); 2405 Py_DECREF(value);
2405 break; 2406 break;
2406 case For_kind: 2407 case For_kind:
2407 result = PyType_GenericNew(For_type, NULL, NULL); 2408 result = PyType_GenericNew(For_type, NULL, NULL);
2408 if (!result) goto failed; 2409 if (!result) goto failed;
2409 value = ast2obj_expr(o->v.For.target); 2410 value = ast2obj_expr(o->v.For.target);
2410 if (!value) goto failed; 2411 if (!value) goto failed;
2411 if (PyObject_SetAttrString(result, "target", value) == -1) 2412 if (_PyObject_SetAttrId(result, &PyId_target, value) == -1)
2412 goto failed; 2413 goto failed;
2413 Py_DECREF(value); 2414 Py_DECREF(value);
2414 value = ast2obj_expr(o->v.For.iter); 2415 value = ast2obj_expr(o->v.For.iter);
2415 if (!value) goto failed; 2416 if (!value) goto failed;
2416 if (PyObject_SetAttrString(result, "iter", value) == -1) 2417 if (_PyObject_SetAttrId(result, &PyId_iter, value) == -1)
2417 goto failed; 2418 goto failed;
2418 Py_DECREF(value); 2419 Py_DECREF(value);
2419 value = ast2obj_list(o->v.For.body, ast2obj_stmt); 2420 value = ast2obj_list(o->v.For.body, ast2obj_stmt);
2420 if (!value) goto failed; 2421 if (!value) goto failed;
2421 if (PyObject_SetAttrString(result, "body", value) == -1) 2422 if (_PyObject_SetAttrId(result, &PyId_body, value) == -1)
2422 goto failed; 2423 goto failed;
2423 Py_DECREF(value); 2424 Py_DECREF(value);
2424 value = ast2obj_list(o->v.For.orelse, ast2obj_stmt); 2425 value = ast2obj_list(o->v.For.orelse, ast2obj_stmt);
2425 if (!value) goto failed; 2426 if (!value) goto failed;
2426 if (PyObject_SetAttrString(result, "orelse", value) == -1) 2427 if (_PyObject_SetAttrId(result, &PyId_orelse, value) == -1)
2427 goto failed; 2428 goto failed;
2428 Py_DECREF(value); 2429 Py_DECREF(value);
2429 break; 2430 break;
2430 case While_kind: 2431 case While_kind:
2431 result = PyType_GenericNew(While_type, NULL, NULL); 2432 result = PyType_GenericNew(While_type, NULL, NULL);
2432 if (!result) goto failed; 2433 if (!result) goto failed;
2433 value = ast2obj_expr(o->v.While.test); 2434 value = ast2obj_expr(o->v.While.test);
2434 if (!value) goto failed; 2435 if (!value) goto failed;
2435 if (PyObject_SetAttrString(result, "test", value) == -1) 2436 if (_PyObject_SetAttrId(result, &PyId_test, value) == -1)
2436 goto failed; 2437 goto failed;
2437 Py_DECREF(value); 2438 Py_DECREF(value);
2438 value = ast2obj_list(o->v.While.body, ast2obj_stmt); 2439 value = ast2obj_list(o->v.While.body, ast2obj_stmt);
2439 if (!value) goto failed; 2440 if (!value) goto failed;
2440 if (PyObject_SetAttrString(result, "body", value) == -1) 2441 if (_PyObject_SetAttrId(result, &PyId_body, value) == -1)
2441 goto failed; 2442 goto failed;
2442 Py_DECREF(value); 2443 Py_DECREF(value);
2443 value = ast2obj_list(o->v.While.orelse, ast2obj_stmt); 2444 value = ast2obj_list(o->v.While.orelse, ast2obj_stmt);
2444 if (!value) goto failed; 2445 if (!value) goto failed;
2445 if (PyObject_SetAttrString(result, "orelse", value) == -1) 2446 if (_PyObject_SetAttrId(result, &PyId_orelse, value) == -1)
2446 goto failed; 2447 goto failed;
2447 Py_DECREF(value); 2448 Py_DECREF(value);
2448 break; 2449 break;
2449 case If_kind: 2450 case If_kind:
2450 result = PyType_GenericNew(If_type, NULL, NULL); 2451 result = PyType_GenericNew(If_type, NULL, NULL);
2451 if (!result) goto failed; 2452 if (!result) goto failed;
2452 value = ast2obj_expr(o->v.If.test); 2453 value = ast2obj_expr(o->v.If.test);
2453 if (!value) goto failed; 2454 if (!value) goto failed;
2454 if (PyObject_SetAttrString(result, "test", value) == -1) 2455 if (_PyObject_SetAttrId(result, &PyId_test, value) == -1)
2455 goto failed; 2456 goto failed;
2456 Py_DECREF(value); 2457 Py_DECREF(value);
2457 value = ast2obj_list(o->v.If.body, ast2obj_stmt); 2458 value = ast2obj_list(o->v.If.body, ast2obj_stmt);
2458 if (!value) goto failed; 2459 if (!value) goto failed;
2459 if (PyObject_SetAttrString(result, "body", value) == -1) 2460 if (_PyObject_SetAttrId(result, &PyId_body, value) == -1)
2460 goto failed; 2461 goto failed;
2461 Py_DECREF(value); 2462 Py_DECREF(value);
2462 value = ast2obj_list(o->v.If.orelse, ast2obj_stmt); 2463 value = ast2obj_list(o->v.If.orelse, ast2obj_stmt);
2463 if (!value) goto failed; 2464 if (!value) goto failed;
2464 if (PyObject_SetAttrString(result, "orelse", value) == -1) 2465 if (_PyObject_SetAttrId(result, &PyId_orelse, value) == -1)
2465 goto failed; 2466 goto failed;
2466 Py_DECREF(value); 2467 Py_DECREF(value);
2467 break; 2468 break;
2468 case With_kind: 2469 case With_kind:
2469 result = PyType_GenericNew(With_type, NULL, NULL); 2470 result = PyType_GenericNew(With_type, NULL, NULL);
2470 if (!result) goto failed; 2471 if (!result) goto failed;
2471 value = ast2obj_list(o->v.With.items, ast2obj_withitem); 2472 value = ast2obj_list(o->v.With.items, ast2obj_withitem);
2472 if (!value) goto failed; 2473 if (!value) goto failed;
2473 if (PyObject_SetAttrString(result, "items", value) == -1) 2474 if (_PyObject_SetAttrId(result, &PyId_items, value) == -1)
2474 goto failed; 2475 goto failed;
2475 Py_DECREF(value); 2476 Py_DECREF(value);
2476 value = ast2obj_list(o->v.With.body, ast2obj_stmt); 2477 value = ast2obj_list(o->v.With.body, ast2obj_stmt);
2477 if (!value) goto failed; 2478 if (!value) goto failed;
2478 if (PyObject_SetAttrString(result, "body", value) == -1) 2479 if (_PyObject_SetAttrId(result, &PyId_body, value) == -1)
2479 goto failed; 2480 goto failed;
2480 Py_DECREF(value); 2481 Py_DECREF(value);
2481 break; 2482 break;
2482 case Raise_kind: 2483 case Raise_kind:
2483 result = PyType_GenericNew(Raise_type, NULL, NULL); 2484 result = PyType_GenericNew(Raise_type, NULL, NULL);
2484 if (!result) goto failed; 2485 if (!result) goto failed;
2485 value = ast2obj_expr(o->v.Raise.exc); 2486 value = ast2obj_expr(o->v.Raise.exc);
2486 if (!value) goto failed; 2487 if (!value) goto failed;
2487 if (PyObject_SetAttrString(result, "exc", value) == -1) 2488 if (_PyObject_SetAttrId(result, &PyId_exc, value) == -1)
2488 goto failed; 2489 goto failed;
2489 Py_DECREF(value); 2490 Py_DECREF(value);
2490 value = ast2obj_expr(o->v.Raise.cause); 2491 value = ast2obj_expr(o->v.Raise.cause);
2491 if (!value) goto failed; 2492 if (!value) goto failed;
2492 if (PyObject_SetAttrString(result, "cause", value) == -1) 2493 if (_PyObject_SetAttrId(result, &PyId_cause, value) == -1)
2493 goto failed; 2494 goto failed;
2494 Py_DECREF(value); 2495 Py_DECREF(value);
2495 break; 2496 break;
2496 case Try_kind: 2497 case Try_kind:
2497 result = PyType_GenericNew(Try_type, NULL, NULL); 2498 result = PyType_GenericNew(Try_type, NULL, NULL);
2498 if (!result) goto failed; 2499 if (!result) goto failed;
2499 value = ast2obj_list(o->v.Try.body, ast2obj_stmt); 2500 value = ast2obj_list(o->v.Try.body, ast2obj_stmt);
2500 if (!value) goto failed; 2501 if (!value) goto failed;
2501 if (PyObject_SetAttrString(result, "body", value) == -1) 2502 if (_PyObject_SetAttrId(result, &PyId_body, value) == -1)
2502 goto failed; 2503 goto failed;
2503 Py_DECREF(value); 2504 Py_DECREF(value);
2504 value = ast2obj_list(o->v.Try.handlers, ast2obj_excepthandler); 2505 value = ast2obj_list(o->v.Try.handlers, ast2obj_excepthandler);
2505 if (!value) goto failed; 2506 if (!value) goto failed;
2506 if (PyObject_SetAttrString(result, "handlers", value) == -1) 2507 if (_PyObject_SetAttrId(result, &PyId_handlers, value) == -1)
2507 goto failed; 2508 goto failed;
2508 Py_DECREF(value); 2509 Py_DECREF(value);
2509 value = ast2obj_list(o->v.Try.orelse, ast2obj_stmt); 2510 value = ast2obj_list(o->v.Try.orelse, ast2obj_stmt);
2510 if (!value) goto failed; 2511 if (!value) goto failed;
2511 if (PyObject_SetAttrString(result, "orelse", value) == -1) 2512 if (_PyObject_SetAttrId(result, &PyId_orelse, value) == -1)
2512 goto failed; 2513 goto failed;
2513 Py_DECREF(value); 2514 Py_DECREF(value);
2514 value = ast2obj_list(o->v.Try.finalbody, ast2obj_stmt); 2515 value = ast2obj_list(o->v.Try.finalbody, ast2obj_stmt);
2515 if (!value) goto failed; 2516 if (!value) goto failed;
2516 if (PyObject_SetAttrString(result, "finalbody", value) == -1) 2517 if (_PyObject_SetAttrId(result, &PyId_finalbody, value) == -1)
2517 goto failed; 2518 goto failed;
2518 Py_DECREF(value); 2519 Py_DECREF(value);
2519 break; 2520 break;
2520 case Assert_kind: 2521 case Assert_kind:
2521 result = PyType_GenericNew(Assert_type, NULL, NULL); 2522 result = PyType_GenericNew(Assert_type, NULL, NULL);
2522 if (!result) goto failed; 2523 if (!result) goto failed;
2523 value = ast2obj_expr(o->v.Assert.test); 2524 value = ast2obj_expr(o->v.Assert.test);
2524 if (!value) goto failed; 2525 if (!value) goto failed;
2525 if (PyObject_SetAttrString(result, "test", value) == -1) 2526 if (_PyObject_SetAttrId(result, &PyId_test, value) == -1)
2526 goto failed; 2527 goto failed;
2527 Py_DECREF(value); 2528 Py_DECREF(value);
2528 value = ast2obj_expr(o->v.Assert.msg); 2529 value = ast2obj_expr(o->v.Assert.msg);
2529 if (!value) goto failed; 2530 if (!value) goto failed;
2530 if (PyObject_SetAttrString(result, "msg", value) == -1) 2531 if (_PyObject_SetAttrId(result, &PyId_msg, value) == -1)
2531 goto failed; 2532 goto failed;
2532 Py_DECREF(value); 2533 Py_DECREF(value);
2533 break; 2534 break;
2534 case Import_kind: 2535 case Import_kind:
2535 result = PyType_GenericNew(Import_type, NULL, NULL); 2536 result = PyType_GenericNew(Import_type, NULL, NULL);
2536 if (!result) goto failed; 2537 if (!result) goto failed;
2537 value = ast2obj_list(o->v.Import.names, ast2obj_alias); 2538 value = ast2obj_list(o->v.Import.names, ast2obj_alias);
2538 if (!value) goto failed; 2539 if (!value) goto failed;
2539 if (PyObject_SetAttrString(result, "names", value) == -1) 2540 if (_PyObject_SetAttrId(result, &PyId_names, value) == -1)
2540 goto failed; 2541 goto failed;
2541 Py_DECREF(value); 2542 Py_DECREF(value);
2542 break; 2543 break;
2543 case ImportFrom_kind: 2544 case ImportFrom_kind:
2544 result = PyType_GenericNew(ImportFrom_type, NULL, NULL); 2545 result = PyType_GenericNew(ImportFrom_type, NULL, NULL);
2545 if (!result) goto failed; 2546 if (!result) goto failed;
2546 value = ast2obj_identifier(o->v.ImportFrom.module); 2547 value = ast2obj_identifier(o->v.ImportFrom.module);
2547 if (!value) goto failed; 2548 if (!value) goto failed;
2548 if (PyObject_SetAttrString(result, "module", value) == -1) 2549 if (_PyObject_SetAttrId(result, &PyId_module, value) == -1)
2549 goto failed; 2550 goto failed;
2550 Py_DECREF(value); 2551 Py_DECREF(value);
2551 value = ast2obj_list(o->v.ImportFrom.names, ast2obj_alias); 2552 value = ast2obj_list(o->v.ImportFrom.names, ast2obj_alias);
2552 if (!value) goto failed; 2553 if (!value) goto failed;
2553 if (PyObject_SetAttrString(result, "names", value) == -1) 2554 if (_PyObject_SetAttrId(result, &PyId_names, value) == -1)
2554 goto failed; 2555 goto failed;
2555 Py_DECREF(value); 2556 Py_DECREF(value);
2556 value = ast2obj_int(o->v.ImportFrom.level); 2557 value = ast2obj_int(o->v.ImportFrom.level);
2557 if (!value) goto failed; 2558 if (!value) goto failed;
2558 if (PyObject_SetAttrString(result, "level", value) == -1) 2559 if (_PyObject_SetAttrId(result, &PyId_level, value) == -1)
2559 goto failed; 2560 goto failed;
2560 Py_DECREF(value); 2561 Py_DECREF(value);
2561 break; 2562 break;
2562 case Global_kind: 2563 case Global_kind:
2563 result = PyType_GenericNew(Global_type, NULL, NULL); 2564 result = PyType_GenericNew(Global_type, NULL, NULL);
2564 if (!result) goto failed; 2565 if (!result) goto failed;
2565 value = ast2obj_list(o->v.Global.names, ast2obj_identifier); 2566 value = ast2obj_list(o->v.Global.names, ast2obj_identifier);
2566 if (!value) goto failed; 2567 if (!value) goto failed;
2567 if (PyObject_SetAttrString(result, "names", value) == -1) 2568 if (_PyObject_SetAttrId(result, &PyId_names, value) == -1)
2568 goto failed; 2569 goto failed;
2569 Py_DECREF(value); 2570 Py_DECREF(value);
2570 break; 2571 break;
2571 case Nonlocal_kind: 2572 case Nonlocal_kind:
2572 result = PyType_GenericNew(Nonlocal_type, NULL, NULL); 2573 result = PyType_GenericNew(Nonlocal_type, NULL, NULL);
2573 if (!result) goto failed; 2574 if (!result) goto failed;
2574 value = ast2obj_list(o->v.Nonlocal.names, ast2obj_identifier); 2575 value = ast2obj_list(o->v.Nonlocal.names, ast2obj_identifier);
2575 if (!value) goto failed; 2576 if (!value) goto failed;
2576 if (PyObject_SetAttrString(result, "names", value) == -1) 2577 if (_PyObject_SetAttrId(result, &PyId_names, value) == -1)
2577 goto failed; 2578 goto failed;
2578 Py_DECREF(value); 2579 Py_DECREF(value);
2579 break; 2580 break;
2580 case Expr_kind: 2581 case Expr_kind:
2581 result = PyType_GenericNew(Expr_type, NULL, NULL); 2582 result = PyType_GenericNew(Expr_type, NULL, NULL);
2582 if (!result) goto failed; 2583 if (!result) goto failed;
2583 value = ast2obj_expr(o->v.Expr.value); 2584 value = ast2obj_expr(o->v.Expr.value);
2584 if (!value) goto failed; 2585 if (!value) goto failed;
2585 if (PyObject_SetAttrString(result, "value", value) == -1) 2586 if (_PyObject_SetAttrId(result, &PyId_value, value) == -1)
2586 goto failed; 2587 goto failed;
2587 Py_DECREF(value); 2588 Py_DECREF(value);
2588 break; 2589 break;
2589 case Pass_kind: 2590 case Pass_kind:
2590 result = PyType_GenericNew(Pass_type, NULL, NULL); 2591 result = PyType_GenericNew(Pass_type, NULL, NULL);
2599 if (!result) goto failed; 2600 if (!result) goto failed;
2600 break; 2601 break;
2601 } 2602 }
2602 value = ast2obj_int(o->lineno); 2603 value = ast2obj_int(o->lineno);
2603 if (!value) goto failed; 2604 if (!value) goto failed;
2604 if (PyObject_SetAttrString(result, "lineno", value) < 0) 2605 if (_PyObject_SetAttrId(result, &PyId_lineno, value) < 0)
2605 goto failed; 2606 goto failed;
2606 Py_DECREF(value); 2607 Py_DECREF(value);
2607 value = ast2obj_int(o->col_offset); 2608 value = ast2obj_int(o->col_offset);
2608 if (!value) goto failed; 2609 if (!value) goto failed;
2609 if (PyObject_SetAttrString(result, "col_offset", value) < 0) 2610 if (_PyObject_SetAttrId(result, &PyId_col_offset, value) < 0)
2610 goto failed; 2611 goto failed;
2611 Py_DECREF(value); 2612 Py_DECREF(value);
2612 return result; 2613 return result;
2613 failed: 2614 failed:
2614 Py_XDECREF(value); 2615 Py_XDECREF(value);
2630 case BoolOp_kind: 2631 case BoolOp_kind:
2631 result = PyType_GenericNew(BoolOp_type, NULL, NULL); 2632 result = PyType_GenericNew(BoolOp_type, NULL, NULL);
2632 if (!result) goto failed; 2633 if (!result) goto failed;
2633 value = ast2obj_boolop(o->v.BoolOp.op); 2634 value = ast2obj_boolop(o->v.BoolOp.op);
2634 if (!value) goto failed; 2635 if (!value) goto failed;
2635 if (PyObject_SetAttrString(result, "op", value) == -1) 2636 if (_PyObject_SetAttrId(result, &PyId_op, value) == -1)
2636 goto failed; 2637 goto failed;
2637 Py_DECREF(value); 2638 Py_DECREF(value);
2638 value = ast2obj_list(o->v.BoolOp.values, ast2obj_expr); 2639 value = ast2obj_list(o->v.BoolOp.values, ast2obj_expr);
2639 if (!value) goto failed; 2640 if (!value) goto failed;
2640 if (PyObject_SetAttrString(result, "values", value) == -1) 2641 if (_PyObject_SetAttrId(result, &PyId_values, value) == -1)
2641 goto failed; 2642 goto failed;
2642 Py_DECREF(value); 2643 Py_DECREF(value);
2643 break; 2644 break;
2644 case BinOp_kind: 2645 case BinOp_kind:
2645 result = PyType_GenericNew(BinOp_type, NULL, NULL); 2646 result = PyType_GenericNew(BinOp_type, NULL, NULL);
2646 if (!result) goto failed; 2647 if (!result) goto failed;
2647 value = ast2obj_expr(o->v.BinOp.left); 2648 value = ast2obj_expr(o->v.BinOp.left);
2648 if (!value) goto failed; 2649 if (!value) goto failed;
2649 if (PyObject_SetAttrString(result, "left", value) == -1) 2650 if (_PyObject_SetAttrId(result, &PyId_left, value) == -1)
2650 goto failed; 2651 goto failed;
2651 Py_DECREF(value); 2652 Py_DECREF(value);
2652 value = ast2obj_operator(o->v.BinOp.op); 2653 value = ast2obj_operator(o->v.BinOp.op);
2653 if (!value) goto failed; 2654 if (!value) goto failed;
2654 if (PyObject_SetAttrString(result, "op", value) == -1) 2655 if (_PyObject_SetAttrId(result, &PyId_op, value) == -1)
2655 goto failed; 2656 goto failed;
2656 Py_DECREF(value); 2657 Py_DECREF(value);
2657 value = ast2obj_expr(o->v.BinOp.right); 2658 value = ast2obj_expr(o->v.BinOp.right);
2658 if (!value) goto failed; 2659 if (!value) goto failed;
2659 if (PyObject_SetAttrString(result, "right", value) == -1) 2660 if (_PyObject_SetAttrId(result, &PyId_right, value) == -1)
2660 goto failed; 2661 goto failed;
2661 Py_DECREF(value); 2662 Py_DECREF(value);
2662 break; 2663 break;
2663 case UnaryOp_kind: 2664 case UnaryOp_kind:
2664 result = PyType_GenericNew(UnaryOp_type, NULL, NULL); 2665 result = PyType_GenericNew(UnaryOp_type, NULL, NULL);
2665 if (!result) goto failed; 2666 if (!result) goto failed;
2666 value = ast2obj_unaryop(o->v.UnaryOp.op); 2667 value = ast2obj_unaryop(o->v.UnaryOp.op);
2667 if (!value) goto failed; 2668 if (!value) goto failed;
2668 if (PyObject_SetAttrString(result, "op", value) == -1) 2669 if (_PyObject_SetAttrId(result, &PyId_op, value) == -1)
2669 goto failed; 2670 goto failed;
2670 Py_DECREF(value); 2671 Py_DECREF(value);
2671 value = ast2obj_expr(o->v.UnaryOp.operand); 2672 value = ast2obj_expr(o->v.UnaryOp.operand);
2672 if (!value) goto failed; 2673 if (!value) goto failed;
2673 if (PyObject_SetAttrString(result, "operand", value) == -1) 2674 if (_PyObject_SetAttrId(result, &PyId_operand, value) == -1)
2674 goto failed; 2675 goto failed;
2675 Py_DECREF(value); 2676 Py_DECREF(value);
2676 break; 2677 break;
2677 case Lambda_kind: 2678 case Lambda_kind:
2678 result = PyType_GenericNew(Lambda_type, NULL, NULL); 2679 result = PyType_GenericNew(Lambda_type, NULL, NULL);
2679 if (!result) goto failed; 2680 if (!result) goto failed;
2680 value = ast2obj_arguments(o->v.Lambda.args); 2681 value = ast2obj_arguments(o->v.Lambda.args);
2681 if (!value) goto failed; 2682 if (!value) goto failed;
2682 if (PyObject_SetAttrString(result, "args", value) == -1) 2683 if (_PyObject_SetAttrId(result, &PyId_args, value) == -1)
2683 goto failed; 2684 goto failed;
2684 Py_DECREF(value); 2685 Py_DECREF(value);
2685 value = ast2obj_expr(o->v.Lambda.body); 2686 value = ast2obj_expr(o->v.Lambda.body);
2686 if (!value) goto failed; 2687 if (!value) goto failed;
2687 if (PyObject_SetAttrString(result, "body", value) == -1) 2688 if (_PyObject_SetAttrId(result, &PyId_body, value) == -1)
2688 goto failed; 2689 goto failed;
2689 Py_DECREF(value); 2690 Py_DECREF(value);
2690 break; 2691 break;
2691 case IfExp_kind: 2692 case IfExp_kind:
2692 result = PyType_GenericNew(IfExp_type, NULL, NULL); 2693 result = PyType_GenericNew(IfExp_type, NULL, NULL);
2693 if (!result) goto failed; 2694 if (!result) goto failed;
2694 value = ast2obj_expr(o->v.IfExp.test); 2695 value = ast2obj_expr(o->v.IfExp.test);
2695 if (!value) goto failed; 2696 if (!value) goto failed;
2696 if (PyObject_SetAttrString(result, "test", value) == -1) 2697 if (_PyObject_SetAttrId(result, &PyId_test, value) == -1)
2697 goto failed; 2698 goto failed;
2698 Py_DECREF(value); 2699 Py_DECREF(value);
2699 value = ast2obj_expr(o->v.IfExp.body); 2700 value = ast2obj_expr(o->v.IfExp.body);
2700 if (!value) goto failed; 2701 if (!value) goto failed;
2701 if (PyObject_SetAttrString(result, "body", value) == -1) 2702 if (_PyObject_SetAttrId(result, &PyId_body, value) == -1)
2702 goto failed; 2703 goto failed;
2703 Py_DECREF(value); 2704 Py_DECREF(value);
2704 value = ast2obj_expr(o->v.IfExp.orelse); 2705 value = ast2obj_expr(o->v.IfExp.orelse);
2705 if (!value) goto failed; 2706 if (!value) goto failed;
2706 if (PyObject_SetAttrString(result, "orelse", value) == -1) 2707 if (_PyObject_SetAttrId(result, &PyId_orelse, value) == -1)
2707 goto failed; 2708 goto failed;
2708 Py_DECREF(value); 2709 Py_DECREF(value);
2709 break; 2710 break;
2710 case Dict_kind: 2711 case Dict_kind:
2711 result = PyType_GenericNew(Dict_type, NULL, NULL); 2712 result = PyType_GenericNew(Dict_type, NULL, NULL);
2712 if (!result) goto failed; 2713 if (!result) goto failed;
2713 value = ast2obj_list(o->v.Dict.keys, ast2obj_expr); 2714 value = ast2obj_list(o->v.Dict.keys, ast2obj_expr);
2714 if (!value) goto failed; 2715 if (!value) goto failed;
2715 if (PyObject_SetAttrString(result, "keys", value) == -1) 2716 if (_PyObject_SetAttrId(result, &PyId_keys, value) == -1)
2716 goto failed; 2717 goto failed;
2717 Py_DECREF(value); 2718 Py_DECREF(value);
2718 value = ast2obj_list(o->v.Dict.values, ast2obj_expr); 2719 value = ast2obj_list(o->v.Dict.values, ast2obj_expr);
2719 if (!value) goto failed; 2720 if (!value) goto failed;
2720 if (PyObject_SetAttrString(result, "values", value) == -1) 2721 if (_PyObject_SetAttrId(result, &PyId_values, value) == -1)
2721 goto failed; 2722 goto failed;
2722 Py_DECREF(value); 2723 Py_DECREF(value);
2723 break; 2724 break;
2724 case Set_kind: 2725 case Set_kind:
2725 result = PyType_GenericNew(Set_type, NULL, NULL); 2726 result = PyType_GenericNew(Set_type, NULL, NULL);
2726 if (!result) goto failed; 2727 if (!result) goto failed;
2727 value = ast2obj_list(o->v.Set.elts, ast2obj_expr); 2728 value = ast2obj_list(o->v.Set.elts, ast2obj_expr);
2728 if (!value) goto failed; 2729 if (!value) goto failed;
2729 if (PyObject_SetAttrString(result, "elts", value) == -1) 2730 if (_PyObject_SetAttrId(result, &PyId_elts, value) == -1)
2730 goto failed; 2731 goto failed;
2731 Py_DECREF(value); 2732 Py_DECREF(value);
2732 break; 2733 break;
2733 case ListComp_kind: 2734 case ListComp_kind:
2734 result = PyType_GenericNew(ListComp_type, NULL, NULL); 2735 result = PyType_GenericNew(ListComp_type, NULL, NULL);
2735 if (!result) goto failed; 2736 if (!result) goto failed;
2736 value = ast2obj_expr(o->v.ListComp.elt); 2737 value = ast2obj_expr(o->v.ListComp.elt);
2737 if (!value) goto failed; 2738 if (!value) goto failed;
2738 if (PyObject_SetAttrString(result, "elt", value) == -1) 2739 if (_PyObject_SetAttrId(result, &PyId_elt, value) == -1)
2739 goto failed; 2740 goto failed;
2740 Py_DECREF(value); 2741 Py_DECREF(value);
2741 value = ast2obj_list(o->v.ListComp.generators, 2742 value = ast2obj_list(o->v.ListComp.generators,
2742 ast2obj_comprehension); 2743 ast2obj_comprehension);
2743 if (!value) goto failed; 2744 if (!value) goto failed;
2744 if (PyObject_SetAttrString(result, "generators", value) == -1) 2745 if (_PyObject_SetAttrId(result, &PyId_generators, value) == -1)
2745 goto failed; 2746 goto failed;
2746 Py_DECREF(value); 2747 Py_DECREF(value);
2747 break; 2748 break;
2748 case SetComp_kind: 2749 case SetComp_kind:
2749 result = PyType_GenericNew(SetComp_type, NULL, NULL); 2750 result = PyType_GenericNew(SetComp_type, NULL, NULL);
2750 if (!result) goto failed; 2751 if (!result) goto failed;
2751 value = ast2obj_expr(o->v.SetComp.elt); 2752 value = ast2obj_expr(o->v.SetComp.elt);
2752 if (!value) goto failed; 2753 if (!value) goto failed;
2753 if (PyObject_SetAttrString(result, "elt", value) == -1) 2754 if (_PyObject_SetAttrId(result, &PyId_elt, value) == -1)
2754 goto failed; 2755 goto failed;
2755 Py_DECREF(value); 2756 Py_DECREF(value);
2756 value = ast2obj_list(o->v.SetComp.generators, 2757 value = ast2obj_list(o->v.SetComp.generators,
2757 ast2obj_comprehension); 2758 ast2obj_comprehension);
2758 if (!value) goto failed; 2759 if (!value) goto failed;
2759 if (PyObject_SetAttrString(result, "generators", value) == -1) 2760 if (_PyObject_SetAttrId(result, &PyId_generators, value) == -1)
2760 goto failed; 2761 goto failed;
2761 Py_DECREF(value); 2762 Py_DECREF(value);
2762 break; 2763 break;
2763 case DictComp_kind: 2764 case DictComp_kind:
2764 result = PyType_GenericNew(DictComp_type, NULL, NULL); 2765 result = PyType_GenericNew(DictComp_type, NULL, NULL);
2765 if (!result) goto failed; 2766 if (!result) goto failed;
2766 value = ast2obj_expr(o->v.DictComp.key); 2767 value = ast2obj_expr(o->v.DictComp.key);
2767 if (!value) goto failed; 2768 if (!value) goto failed;
2768 if (PyObject_SetAttrString(result, "key", value) == -1) 2769 if (_PyObject_SetAttrId(result, &PyId_key, value) == -1)
2769 goto failed; 2770 goto failed;
2770 Py_DECREF(value); 2771 Py_DECREF(value);
2771 value = ast2obj_expr(o->v.DictComp.value); 2772 value = ast2obj_expr(o->v.DictComp.value);
2772 if (!value) goto failed; 2773 if (!value) goto failed;
2773 if (PyObject_SetAttrString(result, "value", value) == -1) 2774 if (_PyObject_SetAttrId(result, &PyId_value, value) == -1)
2774 goto failed; 2775 goto failed;
2775 Py_DECREF(value); 2776 Py_DECREF(value);
2776 value = ast2obj_list(o->v.DictComp.generators, 2777 value = ast2obj_list(o->v.DictComp.generators,
2777 ast2obj_comprehension); 2778 ast2obj_comprehension);
2778 if (!value) goto failed; 2779 if (!value) goto failed;
2779 if (PyObject_SetAttrString(result, "generators", value) == -1) 2780 if (_PyObject_SetAttrId(result, &PyId_generators, value) == -1)
2780 goto failed; 2781 goto failed;
2781 Py_DECREF(value); 2782 Py_DECREF(value);
2782 break; 2783 break;
2783 case GeneratorExp_kind: 2784 case GeneratorExp_kind:
2784 result = PyType_GenericNew(GeneratorExp_type, NULL, NULL); 2785 result = PyType_GenericNew(GeneratorExp_type, NULL, NULL);
2785 if (!result) goto failed; 2786 if (!result) goto failed;
2786 value = ast2obj_expr(o->v.GeneratorExp.elt); 2787 value = ast2obj_expr(o->v.GeneratorExp.elt);
2787 if (!value) goto failed; 2788 if (!value) goto failed;
2788 if (PyObject_SetAttrString(result, "elt", value) == -1) 2789 if (_PyObject_SetAttrId(result, &PyId_elt, value) == -1)
2789 goto failed; 2790 goto failed;
2790 Py_DECREF(value); 2791 Py_DECREF(value);
2791 value = ast2obj_list(o->v.GeneratorExp.generators, 2792 value = ast2obj_list(o->v.GeneratorExp.generators,
2792 ast2obj_comprehension); 2793 ast2obj_comprehension);
2793 if (!value) goto failed; 2794 if (!value) goto failed;
2794 if (PyObject_SetAttrString(result, "generators", value) == -1) 2795 if (_PyObject_SetAttrId(result, &PyId_generators, value) == -1)
2795 goto failed; 2796 goto failed;
2796 Py_DECREF(value); 2797 Py_DECREF(value);
2797 break; 2798 break;
2798 case Yield_kind: 2799 case Yield_kind:
2799 result = PyType_GenericNew(Yield_type, NULL, NULL); 2800 result = PyType_GenericNew(Yield_type, NULL, NULL);
2800 if (!result) goto failed; 2801 if (!result) goto failed;
2801 value = ast2obj_expr(o->v.Yield.value); 2802 value = ast2obj_expr(o->v.Yield.value);
2802 if (!value) goto failed; 2803 if (!value) goto failed;
2803 if (PyObject_SetAttrString(result, "value", value) == -1) 2804 if (_PyObject_SetAttrId(result, &PyId_value, value) == -1)
2804 goto failed; 2805 goto failed;
2805 Py_DECREF(value); 2806 Py_DECREF(value);
2806 break; 2807 break;
2807 case Compare_kind: 2808 case Compare_kind:
2808 result = PyType_GenericNew(Compare_type, NULL, NULL); 2809 result = PyType_GenericNew(Compare_type, NULL, NULL);
2809 if (!result) goto failed; 2810 if (!result) goto failed;
2810 value = ast2obj_expr(o->v.Compare.left); 2811 value = ast2obj_expr(o->v.Compare.left);
2811 if (!value) goto failed; 2812 if (!value) goto failed;
2812 if (PyObject_SetAttrString(result, "left", value) == -1) 2813 if (_PyObject_SetAttrId(result, &PyId_left, value) == -1)
2813 goto failed; 2814 goto failed;
2814 Py_DECREF(value); 2815 Py_DECREF(value);
2815 { 2816 {
2816 int i, n = asdl_seq_LEN(o->v.Compare.ops); 2817 int i, n = asdl_seq_LEN(o->v.Compare.ops);
2817 value = PyList_New(n); 2818 value = PyList_New(n);
2818 if (!value) goto failed; 2819 if (!value) goto failed;
2819 for(i = 0; i < n; i++) 2820 for(i = 0; i < n; i++)
2820 PyList_SET_ITEM(value, i, ast2obj_cmpop((cmpop_ty)asdl_seq_GET(o->v.Compare.ops, i))); 2821 PyList_SET_ITEM(value, i, ast2obj_cmpop((cmpop_ty)asdl_seq_GET(o->v.Compare.ops, i)));
2821 } 2822 }
2822 if (!value) goto failed; 2823 if (!value) goto failed;
2823 if (PyObject_SetAttrString(result, "ops", value) == -1) 2824 if (_PyObject_SetAttrId(result, &PyId_ops, value) == -1)
2824 goto failed; 2825 goto failed;
2825 Py_DECREF(value); 2826 Py_DECREF(value);
2826 value = ast2obj_list(o->v.Compare.comparators, ast2obj_expr); 2827 value = ast2obj_list(o->v.Compare.comparators, ast2obj_expr);
2827 if (!value) goto failed; 2828 if (!value) goto failed;
2828 if (PyObject_SetAttrString(result, "comparators", value) == -1) 2829 if (_PyObject_SetAttrId(result, &PyId_comparators, value) == -1)
2829 goto failed; 2830 goto failed;
2830 Py_DECREF(value); 2831 Py_DECREF(value);
2831 break; 2832 break;
2832 case Call_kind: 2833 case Call_kind:
2833 result = PyType_GenericNew(Call_type, NULL, NULL); 2834 result = PyType_GenericNew(Call_type, NULL, NULL);
2834 if (!result) goto failed; 2835 if (!result) goto failed;
2835 value = ast2obj_expr(o->v.Call.func); 2836 value = ast2obj_expr(o->v.Call.func);
2836 if (!value) goto failed; 2837 if (!value) goto failed;
2837 if (PyObject_SetAttrString(result, "func", value) == -1) 2838 if (_PyObject_SetAttrId(result, &PyId_func, value) == -1)
2838 goto failed; 2839 goto failed;
2839 Py_DECREF(value); 2840 Py_DECREF(value);
2840 value = ast2obj_list(o->v.Call.args, ast2obj_expr); 2841 value = ast2obj_list(o->v.Call.args, ast2obj_expr);
2841 if (!value) goto failed; 2842 if (!value) goto failed;
2842 if (PyObject_SetAttrString(result, "args", value) == -1) 2843 if (_PyObject_SetAttrId(result, &PyId_args, value) == -1)
2843 goto failed; 2844 goto failed;
2844 Py_DECREF(value); 2845 Py_DECREF(value);
2845 value = ast2obj_list(o->v.Call.keywords, ast2obj_keyword); 2846 value = ast2obj_list(o->v.Call.keywords, ast2obj_keyword);
2846 if (!value) goto failed; 2847 if (!value) goto failed;
2847 if (PyObject_SetAttrString(result, "keywords", value) == -1) 2848 if (_PyObject_SetAttrId(result, &PyId_keywords, value) == -1)
2848 goto failed; 2849 goto failed;
2849 Py_DECREF(value); 2850 Py_DECREF(value);
2850 value = ast2obj_expr(o->v.Call.starargs); 2851 value = ast2obj_expr(o->v.Call.starargs);
2851 if (!value) goto failed; 2852 if (!value) goto failed;
2852 if (PyObject_SetAttrString(result, "starargs", value) == -1) 2853 if (_PyObject_SetAttrId(result, &PyId_starargs, value) == -1)
2853 goto failed; 2854 goto failed;
2854 Py_DECREF(value); 2855 Py_DECREF(value);
2855 value = ast2obj_expr(o->v.Call.kwargs); 2856 value = ast2obj_expr(o->v.Call.kwargs);
2856 if (!value) goto failed; 2857 if (!value) goto failed;
2857 if (PyObject_SetAttrString(result, "kwargs", value) == -1) 2858 if (_PyObject_SetAttrId(result, &PyId_kwargs, value) == -1)
2858 goto failed; 2859 goto failed;
2859 Py_DECREF(value); 2860 Py_DECREF(value);
2860 break; 2861 break;
2861 case Num_kind: 2862 case Num_kind:
2862 result = PyType_GenericNew(Num_type, NULL, NULL); 2863 result = PyType_GenericNew(Num_type, NULL, NULL);
2863 if (!result) goto failed; 2864 if (!result) goto failed;
2864 value = ast2obj_object(o->v.Num.n); 2865 value = ast2obj_object(o->v.Num.n);
2865 if (!value) goto failed; 2866 if (!value) goto failed;
2866 if (PyObject_SetAttrString(result, "n", value) == -1) 2867 if (_PyObject_SetAttrId(result, &PyId_n, value) == -1)
2867 goto failed; 2868 goto failed;
2868 Py_DECREF(value); 2869 Py_DECREF(value);
2869 break; 2870 break;
2870 case Str_kind: 2871 case Str_kind:
2871 result = PyType_GenericNew(Str_type, NULL, NULL); 2872 result = PyType_GenericNew(Str_type, NULL, NULL);
2872 if (!result) goto failed; 2873 if (!result) goto failed;
2873 value = ast2obj_string(o->v.Str.s); 2874 value = ast2obj_string(o->v.Str.s);
2874 if (!value) goto failed; 2875 if (!value) goto failed;
2875 if (PyObject_SetAttrString(result, "s", value) == -1) 2876 if (_PyObject_SetAttrId(result, &PyId_s, value) == -1)
2876 goto failed; 2877 goto failed;
2877 Py_DECREF(value); 2878 Py_DECREF(value);
2878 break; 2879 break;
2879 case Bytes_kind: 2880 case Bytes_kind:
2880 result = PyType_GenericNew(Bytes_type, NULL, NULL); 2881 result = PyType_GenericNew(Bytes_type, NULL, NULL);
2881 if (!result) goto failed; 2882 if (!result) goto failed;
2882 value = ast2obj_bytes(o->v.Bytes.s); 2883 value = ast2obj_bytes(o->v.Bytes.s);
2883 if (!value) goto failed; 2884 if (!value) goto failed;
2884 if (PyObject_SetAttrString(result, "s", value) == -1) 2885 if (_PyObject_SetAttrId(result, &PyId_s, value) == -1)
2885 goto failed; 2886 goto failed;
2886 Py_DECREF(value); 2887 Py_DECREF(value);
2887 break; 2888 break;
2888 case Ellipsis_kind: 2889 case Ellipsis_kind:
2889 result = PyType_GenericNew(Ellipsis_type, NULL, NULL); 2890 result = PyType_GenericNew(Ellipsis_type, NULL, NULL);
2892 case Attribute_kind: 2893 case Attribute_kind:
2893 result = PyType_GenericNew(Attribute_type, NULL, NULL); 2894 result = PyType_GenericNew(Attribute_type, NULL, NULL);
2894 if (!result) goto failed; 2895 if (!result) goto failed;
2895 value = ast2obj_expr(o->v.Attribute.value); 2896 value = ast2obj_expr(o->v.Attribute.value);
2896 if (!value) goto failed; 2897 if (!value) goto failed;
2897 if (PyObject_SetAttrString(result, "value", value) == -1) 2898 if (_PyObject_SetAttrId(result, &PyId_value, value) == -1)
2898 goto failed; 2899 goto failed;
2899 Py_DECREF(value); 2900 Py_DECREF(value);
2900 value = ast2obj_identifier(o->v.Attribute.attr); 2901 value = ast2obj_identifier(o->v.Attribute.attr);
2901 if (!value) goto failed; 2902 if (!value) goto failed;
2902 if (PyObject_SetAttrString(result, "attr", value) == -1) 2903 if (_PyObject_SetAttrId(result, &PyId_attr, value) == -1)
2903 goto failed; 2904 goto failed;
2904 Py_DECREF(value); 2905 Py_DECREF(value);
2905 value = ast2obj_expr_context(o->v.Attribute.ctx); 2906 value = ast2obj_expr_context(o->v.Attribute.ctx);
2906 if (!value) goto failed; 2907 if (!value) goto failed;
2907 if (PyObject_SetAttrString(result, "ctx", value) == -1) 2908 if (_PyObject_SetAttrId(result, &PyId_ctx, value) == -1)
2908 goto failed; 2909 goto failed;
2909 Py_DECREF(value); 2910 Py_DECREF(value);
2910 break; 2911 break;
2911 case Subscript_kind: 2912 case Subscript_kind:
2912 result = PyType_GenericNew(Subscript_type, NULL, NULL); 2913 result = PyType_GenericNew(Subscript_type, NULL, NULL);
2913 if (!result) goto failed; 2914 if (!result) goto failed;
2914 value = ast2obj_expr(o->v.Subscript.value); 2915 value = ast2obj_expr(o->v.Subscript.value);
2915 if (!value) goto failed; 2916 if (!value) goto failed;
2916 if (PyObject_SetAttrString(result, "value", value) == -1) 2917 if (_PyObject_SetAttrId(result, &PyId_value, value) == -1)
2917 goto failed; 2918 goto failed;
2918 Py_DECREF(value); 2919 Py_DECREF(value);
2919 value = ast2obj_slice(o->v.Subscript.slice); 2920 value = ast2obj_slice(o->v.Subscript.slice);
2920 if (!value) goto failed; 2921 if (!value) goto failed;
2921 if (PyObject_SetAttrString(result, "slice", value) == -1) 2922 if (_PyObject_SetAttrId(result, &PyId_slice, value) == -1)
2922 goto failed; 2923 goto failed;
2923 Py_DECREF(value); 2924 Py_DECREF(value);
2924 value = ast2obj_expr_context(o->v.Subscript.ctx); 2925 value = ast2obj_expr_context(o->v.Subscript.ctx);
2925 if (!value) goto failed; 2926 if (!value) goto failed;
2926 if (PyObject_SetAttrString(result, "ctx", value) == -1) 2927 if (_PyObject_SetAttrId(result, &PyId_ctx, value) == -1)
2927 goto failed; 2928 goto failed;
2928 Py_DECREF(value); 2929 Py_DECREF(value);
2929 break; 2930 break;
2930 case Starred_kind: 2931 case Starred_kind:
2931 result = PyType_GenericNew(Starred_type, NULL, NULL); 2932 result = PyType_GenericNew(Starred_type, NULL, NULL);
2932 if (!result) goto failed; 2933 if (!result) goto failed;
2933 value = ast2obj_expr(o->v.Starred.value); 2934 value = ast2obj_expr(o->v.Starred.value);
2934 if (!value) goto failed; 2935 if (!value) goto failed;
2935 if (PyObject_SetAttrString(result, "value", value) == -1) 2936 if (_PyObject_SetAttrId(result, &PyId_value, value) == -1)
2936 goto failed; 2937 goto failed;
2937 Py_DECREF(value); 2938 Py_DECREF(value);
2938 value = ast2obj_expr_context(o->v.Starred.ctx); 2939 value = ast2obj_expr_context(o->v.Starred.ctx);
2939 if (!value) goto failed; 2940 if (!value) goto failed;
2940 if (PyObject_SetAttrString(result, "ctx", value) == -1) 2941 if (_PyObject_SetAttrId(result, &PyId_ctx, value) == -1)
2941 goto failed; 2942 goto failed;
2942 Py_DECREF(value); 2943 Py_DECREF(value);
2943 break; 2944 break;
2944 case Name_kind: 2945 case Name_kind:
2945 result = PyType_GenericNew(Name_type, NULL, NULL); 2946 result = PyType_GenericNew(Name_type, NULL, NULL);
2946 if (!result) goto failed; 2947 if (!result) goto failed;
2947 value = ast2obj_identifier(o->v.Name.id); 2948 value = ast2obj_identifier(o->v.Name.id);
2948 if (!value) goto failed; 2949 if (!value) goto failed;
2949 if (PyObject_SetAttrString(result, "id", value) == -1) 2950 if (_PyObject_SetAttrId(result, &PyId_id, value) == -1)
2950 goto failed; 2951 goto failed;
2951 Py_DECREF(value); 2952 Py_DECREF(value);
2952 value = ast2obj_expr_context(o->v.Name.ctx); 2953 value = ast2obj_expr_context(o->v.Name.ctx);
2953 if (!value) goto failed; 2954 if (!value) goto failed;
2954 if (PyObject_SetAttrString(result, "ctx", value) == -1) 2955 if (_PyObject_SetAttrId(result, &PyId_ctx, value) == -1)
2955 goto failed; 2956 goto failed;
2956 Py_DECREF(value); 2957 Py_DECREF(value);
2957 break; 2958 break;
2958 case List_kind: 2959 case List_kind:
2959 result = PyType_GenericNew(List_type, NULL, NULL); 2960 result = PyType_GenericNew(List_type, NULL, NULL);
2960 if (!result) goto failed; 2961 if (!result) goto failed;
2961 value = ast2obj_list(o->v.List.elts, ast2obj_expr); 2962 value = ast2obj_list(o->v.List.elts, ast2obj_expr);
2962 if (!value) goto failed; 2963 if (!value) goto failed;
2963 if (PyObject_SetAttrString(result, "elts", value) == -1) 2964 if (_PyObject_SetAttrId(result, &PyId_elts, value) == -1)
2964 goto failed; 2965 goto failed;
2965 Py_DECREF(value); 2966 Py_DECREF(value);
2966 value = ast2obj_expr_context(o->v.List.ctx); 2967 value = ast2obj_expr_context(o->v.List.ctx);
2967 if (!value) goto failed; 2968 if (!value) goto failed;
2968 if (PyObject_SetAttrString(result, "ctx", value) == -1) 2969 if (_PyObject_SetAttrId(result, &PyId_ctx, value) == -1)
2969 goto failed; 2970 goto failed;
2970 Py_DECREF(value); 2971 Py_DECREF(value);
2971 break; 2972 break;
2972 case Tuple_kind: 2973 case Tuple_kind:
2973 result = PyType_GenericNew(Tuple_type, NULL, NULL); 2974 result = PyType_GenericNew(Tuple_type, NULL, NULL);
2974 if (!result) goto failed; 2975 if (!result) goto failed;
2975 value = ast2obj_list(o->v.Tuple.elts, ast2obj_expr); 2976 value = ast2obj_list(o->v.Tuple.elts, ast2obj_expr);
2976 if (!value) goto failed; 2977 if (!value) goto failed;
2977 if (PyObject_SetAttrString(result, "elts", value) == -1) 2978 if (_PyObject_SetAttrId(result, &PyId_elts, value) == -1)
2978 goto failed; 2979 goto failed;
2979 Py_DECREF(value); 2980 Py_DECREF(value);
2980 value = ast2obj_expr_context(o->v.Tuple.ctx); 2981 value = ast2obj_expr_context(o->v.Tuple.ctx);
2981 if (!value) goto failed; 2982 if (!value) goto failed;
2982 if (PyObject_SetAttrString(result, "ctx", value) == -1) 2983 if (_PyObject_SetAttrId(result, &PyId_ctx, value) == -1)
2983 goto failed; 2984 goto failed;
2984 Py_DECREF(value); 2985 Py_DECREF(value);
2985 break; 2986 break;
2986 } 2987 }
2987 value = ast2obj_int(o->lineno); 2988 value = ast2obj_int(o->lineno);
2988 if (!value) goto failed; 2989 if (!value) goto failed;
2989 if (PyObject_SetAttrString(result, "lineno", value) < 0) 2990 if (_PyObject_SetAttrId(result, &PyId_lineno, value) < 0)
2990 goto failed; 2991 goto failed;
2991 Py_DECREF(value); 2992 Py_DECREF(value);
2992 value = ast2obj_int(o->col_offset); 2993 value = ast2obj_int(o->col_offset);
2993 if (!value) goto failed; 2994 if (!value) goto failed;
2994 if (PyObject_SetAttrString(result, "col_offset", value) < 0) 2995 if (_PyObject_SetAttrId(result, &PyId_col_offset, value) < 0)
2995 goto failed; 2996 goto failed;
2996 Py_DECREF(value); 2997 Py_DECREF(value);
2997 return result; 2998 return result;
2998 failed: 2999 failed:
2999 Py_XDECREF(value); 3000 Py_XDECREF(value);
3042 case Slice_kind: 3043 case Slice_kind:
3043 result = PyType_GenericNew(Slice_type, NULL, NULL); 3044 result = PyType_GenericNew(Slice_type, NULL, NULL);
3044 if (!result) goto failed; 3045 if (!result) goto failed;
3045 value = ast2obj_expr(o->v.Slice.lower); 3046 value = ast2obj_expr(o->v.Slice.lower);
3046 if (!value) goto failed; 3047 if (!value) goto failed;
3047 if (PyObject_SetAttrString(result, "lower", value) == -1) 3048 if (_PyObject_SetAttrId(result, &PyId_lower, value) == -1)
3048 goto failed; 3049 goto failed;
3049 Py_DECREF(value); 3050 Py_DECREF(value);
3050 value = ast2obj_expr(o->v.Slice.upper); 3051 value = ast2obj_expr(o->v.Slice.upper);
3051 if (!value) goto failed; 3052 if (!value) goto failed;
3052 if (PyObject_SetAttrString(result, "upper", value) == -1) 3053 if (_PyObject_SetAttrId(result, &PyId_upper, value) == -1)
3053 goto failed; 3054 goto failed;
3054 Py_DECREF(value); 3055 Py_DECREF(value);
3055 value = ast2obj_expr(o->v.Slice.step); 3056 value = ast2obj_expr(o->v.Slice.step);
3056 if (!value) goto failed; 3057 if (!value) goto failed;
3057 if (PyObject_SetAttrString(result, "step", value) == -1) 3058 if (_PyObject_SetAttrId(result, &PyId_step, value) == -1)
3058 goto failed; 3059 goto failed;
3059 Py_DECREF(value); 3060 Py_DECREF(value);
3060 break; 3061 break;
3061 case ExtSlice_kind: 3062 case ExtSlice_kind:
3062 result = PyType_GenericNew(ExtSlice_type, NULL, NULL); 3063 result = PyType_GenericNew(ExtSlice_type, NULL, NULL);
3063 if (!result) goto failed; 3064 if (!result) goto failed;
3064 value = ast2obj_list(o->v.ExtSlice.dims, ast2obj_slice); 3065 value = ast2obj_list(o->v.ExtSlice.dims, ast2obj_slice);
3065 if (!value) goto failed; 3066 if (!value) goto failed;
3066 if (PyObject_SetAttrString(result, "dims", value) == -1) 3067 if (_PyObject_SetAttrId(result, &PyId_dims, value) == -1)
3067 goto failed; 3068 goto failed;
3068 Py_DECREF(value); 3069 Py_DECREF(value);
3069 break; 3070 break;
3070 case Index_kind: 3071 case Index_kind:
3071 result = PyType_GenericNew(Index_type, NULL, NULL); 3072 result = PyType_GenericNew(Index_type, NULL, NULL);
3072 if (!result) goto failed; 3073 if (!result) goto failed;
3073 value = ast2obj_expr(o->v.Index.value); 3074 value = ast2obj_expr(o->v.Index.value);
3074 if (!value) goto failed; 3075 if (!value) goto failed;
3075 if (PyObject_SetAttrString(result, "value", value) == -1) 3076 if (_PyObject_SetAttrId(result, &PyId_value, value) == -1)
3076 goto failed; 3077 goto failed;
3077 Py_DECREF(value); 3078 Py_DECREF(value);
3078 break; 3079 break;
3079 } 3080 }
3080 return result; 3081 return result;
3216 3217
3217 result = PyType_GenericNew(comprehension_type, NULL, NULL); 3218 result = PyType_GenericNew(comprehension_type, NULL, NULL);
3218 if (!result) return NULL; 3219 if (!result) return NULL;
3219 value = ast2obj_expr(o->target); 3220 value = ast2obj_expr(o->target);
3220 if (!value) goto failed; 3221 if (!value) goto failed;
3221 if (PyObject_SetAttrString(result, "target", value) == -1) 3222 if (_PyObject_SetAttrId(result, &PyId_target, value) == -1)
3222 goto failed; 3223 goto failed;
3223 Py_DECREF(value); 3224 Py_DECREF(value);
3224 value = ast2obj_expr(o->iter); 3225 value = ast2obj_expr(o->iter);
3225 if (!value) goto failed; 3226 if (!value) goto failed;
3226 if (PyObject_SetAttrString(result, "iter", value) == -1) 3227 if (_PyObject_SetAttrId(result, &PyId_iter, value) == -1)
3227 goto failed; 3228 goto failed;
3228 Py_DECREF(value); 3229 Py_DECREF(value);
3229 value = ast2obj_list(o->ifs, ast2obj_expr); 3230 value = ast2obj_list(o->ifs, ast2obj_expr);
3230 if (!value) goto failed; 3231 if (!value) goto failed;
3231 if (PyObject_SetAttrString(result, "ifs", value) == -1) 3232 if (_PyObject_SetAttrId(result, &PyId_ifs, value) == -1)
3232 goto failed; 3233 goto failed;
3233 Py_DECREF(value); 3234 Py_DECREF(value);
3234 return result; 3235 return result;
3235 failed: 3236 failed:
3236 Py_XDECREF(value); 3237 Py_XDECREF(value);
3252 case ExceptHandler_kind: 3253 case ExceptHandler_kind:
3253 result = PyType_GenericNew(ExceptHandler_type, NULL, NULL); 3254 result = PyType_GenericNew(ExceptHandler_type, NULL, NULL);
3254 if (!result) goto failed; 3255 if (!result) goto failed;
3255 value = ast2obj_expr(o->v.ExceptHandler.type); 3256 value = ast2obj_expr(o->v.ExceptHandler.type);
3256 if (!value) goto failed; 3257 if (!value) goto failed;
3257 if (PyObject_SetAttrString(result, "type", value) == -1) 3258 if (_PyObject_SetAttrId(result, &PyId_type, value) == -1)
3258 goto failed; 3259 goto failed;
3259 Py_DECREF(value); 3260 Py_DECREF(value);
3260 value = ast2obj_identifier(o->v.ExceptHandler.name); 3261 value = ast2obj_identifier(o->v.ExceptHandler.name);
3261 if (!value) goto failed; 3262 if (!value) goto failed;
3262 if (PyObject_SetAttrString(result, "name", value) == -1) 3263 if (_PyObject_SetAttrId(result, &PyId_name, value) == -1)
3263 goto failed; 3264 goto failed;
3264 Py_DECREF(value); 3265 Py_DECREF(value);
3265 value = ast2obj_list(o->v.ExceptHandler.body, ast2obj_stmt); 3266 value = ast2obj_list(o->v.ExceptHandler.body, ast2obj_stmt);
3266 if (!value) goto failed; 3267 if (!value) goto failed;
3267 if (PyObject_SetAttrString(result, "body", value) == -1) 3268 if (_PyObject_SetAttrId(result, &PyId_body, value) == -1)
3268 goto failed; 3269 goto failed;
3269 Py_DECREF(value); 3270 Py_DECREF(value);
3270 break; 3271 break;
3271 } 3272 }
3272 value = ast2obj_int(o->lineno); 3273 value = ast2obj_int(o->lineno);
3273 if (!value) goto failed; 3274 if (!value) goto failed;
3274 if (PyObject_SetAttrString(result, "lineno", value) < 0) 3275 if (_PyObject_SetAttrId(result, &PyId_lineno, value) < 0)
3275 goto failed; 3276 goto failed;
3276 Py_DECREF(value); 3277 Py_DECREF(value);
3277 value = ast2obj_int(o->col_offset); 3278 value = ast2obj_int(o->col_offset);
3278 if (!value) goto failed; 3279 if (!value) goto failed;
3279 if (PyObject_SetAttrString(result, "col_offset", value) < 0) 3280 if (_PyObject_SetAttrId(result, &PyId_col_offset, value) < 0)
3280 goto failed; 3281 goto failed;
3281 Py_DECREF(value); 3282 Py_DECREF(value);
3282 return result; 3283 return result;
3283 failed: 3284 failed:
3284 Py_XDECREF(value); 3285 Py_XDECREF(value);
3298 3299
3299 result = PyType_GenericNew(arguments_type, NULL, NULL); 3300 result = PyType_GenericNew(arguments_type, NULL, NULL);
3300 if (!result) return NULL; 3301 if (!result) return NULL;
3301 value = ast2obj_list(o->args, ast2obj_arg); 3302 value = ast2obj_list(o->args, ast2obj_arg);
3302 if (!value) goto failed; 3303 if (!value) goto failed;
3303 if (PyObject_SetAttrString(result, "args", value) == -1) 3304 if (_PyObject_SetAttrId(result, &PyId_args, value) == -1)
3304 goto failed; 3305 goto failed;
3305 Py_DECREF(value); 3306 Py_DECREF(value);
3306 value = ast2obj_identifier(o->vararg); 3307 value = ast2obj_identifier(o->vararg);
3307 if (!value) goto failed; 3308 if (!value) goto failed;
3308 if (PyObject_SetAttrString(result, "vararg", value) == -1) 3309 if (_PyObject_SetAttrId(result, &PyId_vararg, value) == -1)
3309 goto failed; 3310 goto failed;
3310 Py_DECREF(value); 3311 Py_DECREF(value);
3311 value = ast2obj_expr(o->varargannotation); 3312 value = ast2obj_expr(o->varargannotation);
3312 if (!value) goto failed; 3313 if (!value) goto failed;
3313 if (PyObject_SetAttrString(result, "varargannotation", value) == -1) 3314 if (_PyObject_SetAttrId(result, &PyId_varargannotation, value) == -1)
3314 goto failed; 3315 goto failed;
3315 Py_DECREF(value); 3316 Py_DECREF(value);
3316 value = ast2obj_list(o->kwonlyargs, ast2obj_arg); 3317 value = ast2obj_list(o->kwonlyargs, ast2obj_arg);
3317 if (!value) goto failed; 3318 if (!value) goto failed;
3318 if (PyObject_SetAttrString(result, "kwonlyargs", value) == -1) 3319 if (_PyObject_SetAttrId(result, &PyId_kwonlyargs, value) == -1)
3319 goto failed; 3320 goto failed;
3320 Py_DECREF(value); 3321 Py_DECREF(value);
3321 value = ast2obj_identifier(o->kwarg); 3322 value = ast2obj_identifier(o->kwarg);
3322 if (!value) goto failed; 3323 if (!value) goto failed;
3323 if (PyObject_SetAttrString(result, "kwarg", value) == -1) 3324 if (_PyObject_SetAttrId(result, &PyId_kwarg, value) == -1)
3324 goto failed; 3325 goto failed;
3325 Py_DECREF(value); 3326 Py_DECREF(value);
3326 value = ast2obj_expr(o->kwargannotation); 3327 value = ast2obj_expr(o->kwargannotation);
3327 if (!value) goto failed; 3328 if (!value) goto failed;
3328 if (PyObject_SetAttrString(result, "kwargannotation", value) == -1) 3329 if (_PyObject_SetAttrId(result, &PyId_kwargannotation, value) == -1)
3329 goto failed; 3330 goto failed;
3330 Py_DECREF(value); 3331 Py_DECREF(value);
3331 value = ast2obj_list(o->defaults, ast2obj_expr); 3332 value = ast2obj_list(o->defaults, ast2obj_expr);
3332 if (!value) goto failed; 3333 if (!value) goto failed;
3333 if (PyObject_SetAttrString(result, "defaults", value) == -1) 3334 if (_PyObject_SetAttrId(result, &PyId_defaults, value) == -1)
3334 goto failed; 3335 goto failed;
3335 Py_DECREF(value); 3336 Py_DECREF(value);
3336 value = ast2obj_list(o->kw_defaults, ast2obj_expr); 3337 value = ast2obj_list(o->kw_defaults, ast2obj_expr);
3337 if (!value) goto failed; 3338 if (!value) goto failed;
3338 if (PyObject_SetAttrString(result, "kw_defaults", value) == -1) 3339 if (_PyObject_SetAttrId(result, &PyId_kw_defaults, value) == -1)
3339 goto failed; 3340 goto failed;
3340 Py_DECREF(value); 3341 Py_DECREF(value);
3341 return result; 3342 return result;
3342 failed: 3343 failed:
3343 Py_XDECREF(value); 3344 Py_XDECREF(value);
3357 3358
3358 result = PyType_GenericNew(arg_type, NULL, NULL); 3359 result = PyType_GenericNew(arg_type, NULL, NULL);
3359 if (!result) return NULL; 3360 if (!result) return NULL;
3360 value = ast2obj_identifier(o->arg); 3361 value = ast2obj_identifier(o->arg);
3361 if (!value) goto failed; 3362 if (!value) goto failed;
3362 if (PyObject_SetAttrString(result, "arg", value) == -1) 3363 if (_PyObject_SetAttrId(result, &PyId_arg, value) == -1)
3363 goto failed; 3364 goto failed;
3364 Py_DECREF(value); 3365 Py_DECREF(value);
3365 value = ast2obj_expr(o->annotation); 3366 value = ast2obj_expr(o->annotation);
3366 if (!value) goto failed; 3367 if (!value) goto failed;
3367 if (PyObject_SetAttrString(result, "annotation", value) == -1) 3368 if (_PyObject_SetAttrId(result, &PyId_annotation, value) == -1)
3368 goto failed; 3369 goto failed;
3369 Py_DECREF(value); 3370 Py_DECREF(value);
3370 return result; 3371 return result;
3371 failed: 3372 failed:
3372 Py_XDECREF(value); 3373 Py_XDECREF(value);
3386 3387
3387 result = PyType_GenericNew(keyword_type, NULL, NULL); 3388 result = PyType_GenericNew(keyword_type, NULL, NULL);
3388 if (!result) return NULL; 3389 if (!result) return NULL;
3389 value = ast2obj_identifier(o->arg); 3390 value = ast2obj_identifier(o->arg);
3390 if (!value) goto failed; 3391 if (!value) goto failed;
3391 if (PyObject_SetAttrString(result, "arg", value) == -1) 3392 if (_PyObject_SetAttrId(result, &PyId_arg, value) == -1)
3392 goto failed; 3393 goto failed;
3393 Py_DECREF(value); 3394 Py_DECREF(value);
3394 value = ast2obj_expr(o->value); 3395 value = ast2obj_expr(o->value);
3395 if (!value) goto failed; 3396 if (!value) goto failed;
3396 if (PyObject_SetAttrString(result, "value", value) == -1) 3397 if (_PyObject_SetAttrId(result, &PyId_value, value) == -1)
3397 goto failed; 3398 goto failed;
3398 Py_DECREF(value); 3399 Py_DECREF(value);
3399 return result; 3400 return result;
3400 failed: 3401 failed:
3401 Py_XDECREF(value); 3402 Py_XDECREF(value);
3415 3416
3416 result = PyType_GenericNew(alias_type, NULL, NULL); 3417 result = PyType_GenericNew(alias_type, NULL, NULL);
3417 if (!result) return NULL; 3418 if (!result) return NULL;
3418 value = ast2obj_identifier(o->name); 3419 value = ast2obj_identifier(o->name);
3419 if (!value) goto failed; 3420 if (!value) goto failed;
3420 if (PyObject_SetAttrString(result, "name", value) == -1) 3421 if (_PyObject_SetAttrId(result, &PyId_name, value) == -1)
3421 goto failed; 3422 goto failed;
3422 Py_DECREF(value); 3423 Py_DECREF(value);
3423 value = ast2obj_identifier(o->asname); 3424 value = ast2obj_identifier(o->asname);
3424 if (!value) goto failed; 3425 if (!value) goto failed;
3425 if (PyObject_SetAttrString(result, "asname", value) == -1) 3426 if (_PyObject_SetAttrId(result, &PyId_asname, value) == -1)
3426 goto failed; 3427 goto failed;
3427 Py_DECREF(value); 3428 Py_DECREF(value);
3428 return result; 3429 return result;
3429 failed: 3430 failed:
3430 Py_XDECREF(value); 3431 Py_XDECREF(value);
3444 3445
3445 result = PyType_GenericNew(withitem_type, NULL, NULL); 3446 result = PyType_GenericNew(withitem_type, NULL, NULL);
3446 if (!result) return NULL; 3447 if (!result) return NULL;
3447 value = ast2obj_expr(o->context_expr); 3448 value = ast2obj_expr(o->context_expr);
3448 if (!value) goto failed; 3449 if (!value) goto failed;
3449 if (PyObject_SetAttrString(result, "context_expr", value) == -1) 3450 if (_PyObject_SetAttrId(result, &PyId_context_expr, value) == -1)
3450 goto failed; 3451 goto failed;
3451 Py_DECREF(value); 3452 Py_DECREF(value);
3452 value = ast2obj_expr(o->optional_vars); 3453 value = ast2obj_expr(o->optional_vars);
3453 if (!value) goto failed; 3454 if (!value) goto failed;
3454 if (PyObject_SetAttrString(result, "optional_vars", value) == -1) 3455 if (_PyObject_SetAttrId(result, &PyId_optional_vars, value) == -1)
3455 goto failed; 3456 goto failed;
3456 Py_DECREF(value); 3457 Py_DECREF(value);
3457 return result; 3458 return result;
3458 failed: 3459 failed:
3459 Py_XDECREF(value); 3460 Py_XDECREF(value);