comparison Python/Python-ast.c @ 37879:f731859e9b3b

Merge p3yk branch with the trunk up to revision 45595. This breaks a fair number of tests, all because of the codecs/_multibytecodecs issue described here (it's not a Py3K issue, just something Py3K discovers): http://mail.python.org/pipermail/python-dev/2006-April/064051.html Hye-Shik Chang promised to look for a fix, so no need to fix it here. The tests that are expected to break are: test_codecencodings_cn test_codecencodings_hk test_codecencodings_jp test_codecencodings_kr test_codecencodings_tw test_codecs test_multibytecodec This merge fixes an actual test failure (test_weakref) in this branch, though, so I believe merging is the right thing to do anyway.
author Thomas Wouters <thomas@python.org>
date Fri, 21 Apr 2006 10:40:58 +0000
parents df843b07f5fe
children a31202c9485d
comparison
equal deleted inserted replaced
37877:6a45f26ea619 37879:f731859e9b3b
329 static PyObject* ast2obj_excepthandler(void*); 329 static PyObject* ast2obj_excepthandler(void*);
330 static char *excepthandler_fields[]={ 330 static char *excepthandler_fields[]={
331 "type", 331 "type",
332 "name", 332 "name",
333 "body", 333 "body",
334 "lineno",
335 "col_offset",
334 }; 336 };
335 static PyTypeObject *arguments_type; 337 static PyTypeObject *arguments_type;
336 static PyObject* ast2obj_arguments(void*); 338 static PyObject* ast2obj_arguments(void*);
337 static char *arguments_fields[]={ 339 static char *arguments_fields[]={
338 "args", 340 "args",
379 return (PyTypeObject*)result; 381 return (PyTypeObject*)result;
380 } 382 }
381 383
382 static int add_attributes(PyTypeObject* type, char**attrs, int num_fields) 384 static int add_attributes(PyTypeObject* type, char**attrs, int num_fields)
383 { 385 {
384 int i; 386 int i, result;
385 PyObject *s, *l = PyList_New(num_fields); 387 PyObject *s, *l = PyList_New(num_fields);
386 if (!l) return 0; 388 if (!l) return 0;
387 for(i=0; i < num_fields; i++) { 389 for(i = 0; i < num_fields; i++) {
388 s = PyString_FromString(attrs[i]); 390 s = PyString_FromString(attrs[i]);
389 if (!s) { 391 if (!s) {
390 Py_DECREF(l); 392 Py_DECREF(l);
391 return 0; 393 return 0;
392 } 394 }
393 PyList_SET_ITEM(l, i, s); 395 PyList_SET_ITEM(l, i, s);
394 } 396 }
395 return PyObject_SetAttrString((PyObject*)type, "_attributes", l) >=0; 397 result = PyObject_SetAttrString((PyObject*)type, "_attributes", l) >= 0;
398 Py_DECREF(l);
399 return result;
396 } 400 }
397 401
398 static PyObject* ast2obj_list(asdl_seq *seq, PyObject* (*func)(void*)) 402 static PyObject* ast2obj_list(asdl_seq *seq, PyObject* (*func)(void*))
399 { 403 {
400 int i, n = asdl_seq_LEN(seq); 404 int i, n = asdl_seq_LEN(seq);
430 static PyObject* ast2obj_int(bool b) 434 static PyObject* ast2obj_int(bool b)
431 { 435 {
432 return PyInt_FromLong(b); 436 return PyInt_FromLong(b);
433 } 437 }
434 438
435 static int initialized;
436 static int init_types(void) 439 static int init_types(void)
437 { 440 {
441 static int initialized;
438 if (initialized) return 1; 442 if (initialized) return 1;
439 AST_type = make_type("AST", &PyBaseObject_Type, NULL, 0); 443 AST_type = make_type("AST", &PyBaseObject_Type, NULL, 0);
440 mod_type = make_type("mod", AST_type, NULL, 0); 444 mod_type = make_type("mod", AST_type, NULL, 0);
441 if (!mod_type) return 0; 445 if (!mod_type) return 0;
442 if (!add_attributes(mod_type, NULL, 0)) return 0; 446 if (!add_attributes(mod_type, NULL, 0)) return 0;
708 if (!NotIn_singleton) return 0; 712 if (!NotIn_singleton) return 0;
709 comprehension_type = make_type("comprehension", AST_type, 713 comprehension_type = make_type("comprehension", AST_type,
710 comprehension_fields, 3); 714 comprehension_fields, 3);
711 if (!comprehension_type) return 0; 715 if (!comprehension_type) return 0;
712 excepthandler_type = make_type("excepthandler", AST_type, 716 excepthandler_type = make_type("excepthandler", AST_type,
713 excepthandler_fields, 3); 717 excepthandler_fields, 5);
714 if (!excepthandler_type) return 0; 718 if (!excepthandler_type) return 0;
715 arguments_type = make_type("arguments", AST_type, arguments_fields, 4); 719 arguments_type = make_type("arguments", AST_type, arguments_fields, 4);
716 if (!arguments_type) return 0; 720 if (!arguments_type) return 0;
717 keyword_type = make_type("keyword", AST_type, keyword_fields, 2); 721 keyword_type = make_type("keyword", AST_type, keyword_fields, 2);
718 if (!keyword_type) return 0; 722 if (!keyword_type) return 0;
1497 p->col_offset = col_offset; 1501 p->col_offset = col_offset;
1498 return p; 1502 return p;
1499 } 1503 }
1500 1504
1501 expr_ty 1505 expr_ty
1502 Compare(expr_ty left, asdl_seq * ops, asdl_seq * comparators, int lineno, int 1506 Compare(expr_ty left, asdl_int_seq * ops, asdl_seq * comparators, int lineno,
1503 col_offset, PyArena *arena) 1507 int col_offset, PyArena *arena)
1504 { 1508 {
1505 expr_ty p; 1509 expr_ty p;
1506 if (!left) { 1510 if (!left) {
1507 PyErr_SetString(PyExc_ValueError, 1511 PyErr_SetString(PyExc_ValueError,
1508 "field left is required for Compare"); 1512 "field left is required for Compare");
1839 p->ifs = ifs; 1843 p->ifs = ifs;
1840 return p; 1844 return p;
1841 } 1845 }
1842 1846
1843 excepthandler_ty 1847 excepthandler_ty
1844 excepthandler(expr_ty type, expr_ty name, asdl_seq * body, PyArena *arena) 1848 excepthandler(expr_ty type, expr_ty name, asdl_seq * body, int lineno, int
1849 col_offset, PyArena *arena)
1845 { 1850 {
1846 excepthandler_ty p; 1851 excepthandler_ty p;
1847 p = (excepthandler_ty)PyArena_Malloc(arena, sizeof(*p)); 1852 p = (excepthandler_ty)PyArena_Malloc(arena, sizeof(*p));
1848 if (!p) { 1853 if (!p) {
1849 PyErr_NoMemory(); 1854 PyErr_NoMemory();
1850 return NULL; 1855 return NULL;
1851 } 1856 }
1852 p->type = type; 1857 p->type = type;
1853 p->name = name; 1858 p->name = name;
1854 p->body = body; 1859 p->body = body;
1860 p->lineno = lineno;
1861 p->col_offset = col_offset;
1855 return p; 1862 return p;
1856 } 1863 }
1857 1864
1858 arguments_ty 1865 arguments_ty
1859 arguments(asdl_seq * args, identifier vararg, identifier kwarg, asdl_seq * 1866 arguments(asdl_seq * args, identifier vararg, identifier kwarg, asdl_seq *
2913 value = ast2obj_list(o->body, ast2obj_stmt); 2920 value = ast2obj_list(o->body, ast2obj_stmt);
2914 if (!value) goto failed; 2921 if (!value) goto failed;
2915 if (PyObject_SetAttrString(result, "body", value) == -1) 2922 if (PyObject_SetAttrString(result, "body", value) == -1)
2916 goto failed; 2923 goto failed;
2917 Py_DECREF(value); 2924 Py_DECREF(value);
2925 value = ast2obj_int(o->lineno);
2926 if (!value) goto failed;
2927 if (PyObject_SetAttrString(result, "lineno", value) == -1)
2928 goto failed;
2929 Py_DECREF(value);
2930 value = ast2obj_int(o->col_offset);
2931 if (!value) goto failed;
2932 if (PyObject_SetAttrString(result, "col_offset", value) == -1)
2933 goto failed;
2934 Py_DECREF(value);
2918 return result; 2935 return result;
2919 failed: 2936 failed:
2920 Py_XDECREF(value); 2937 Py_XDECREF(value);
2921 Py_XDECREF(result); 2938 Py_XDECREF(result);
2922 return NULL; 2939 return NULL;
3031 if (PyDict_SetItemString(d, "AST", (PyObject*)AST_type) < 0) return; 3048 if (PyDict_SetItemString(d, "AST", (PyObject*)AST_type) < 0) return;
3032 if (PyModule_AddIntConstant(m, "PyCF_ONLY_AST", PyCF_ONLY_AST) < 0) 3049 if (PyModule_AddIntConstant(m, "PyCF_ONLY_AST", PyCF_ONLY_AST) < 0)
3033 return; 3050 return;
3034 if (PyModule_AddStringConstant(m, "__version__", "42753") < 0) 3051 if (PyModule_AddStringConstant(m, "__version__", "42753") < 0)
3035 return; 3052 return;
3036 if(PyDict_SetItemString(d, "mod", (PyObject*)mod_type) < 0) return; 3053 if (PyDict_SetItemString(d, "mod", (PyObject*)mod_type) < 0) return;
3037 if(PyDict_SetItemString(d, "Module", (PyObject*)Module_type) < 0) 3054 if (PyDict_SetItemString(d, "Module", (PyObject*)Module_type) < 0)
3038 return; 3055 return;
3039 if(PyDict_SetItemString(d, "Interactive", (PyObject*)Interactive_type) 3056 if (PyDict_SetItemString(d, "Interactive", (PyObject*)Interactive_type)
3040 < 0) return; 3057 < 0) return;
3041 if(PyDict_SetItemString(d, "Expression", (PyObject*)Expression_type) < 3058 if (PyDict_SetItemString(d, "Expression", (PyObject*)Expression_type) <
3042 0) return; 3059 0) return;
3043 if(PyDict_SetItemString(d, "Suite", (PyObject*)Suite_type) < 0) return; 3060 if (PyDict_SetItemString(d, "Suite", (PyObject*)Suite_type) < 0) return;
3044 if(PyDict_SetItemString(d, "stmt", (PyObject*)stmt_type) < 0) return; 3061 if (PyDict_SetItemString(d, "stmt", (PyObject*)stmt_type) < 0) return;
3045 if(PyDict_SetItemString(d, "FunctionDef", (PyObject*)FunctionDef_type) 3062 if (PyDict_SetItemString(d, "FunctionDef", (PyObject*)FunctionDef_type)
3046 < 0) return; 3063 < 0) return;
3047 if(PyDict_SetItemString(d, "ClassDef", (PyObject*)ClassDef_type) < 0) 3064 if (PyDict_SetItemString(d, "ClassDef", (PyObject*)ClassDef_type) < 0)
3048 return; 3065 return;
3049 if(PyDict_SetItemString(d, "Return", (PyObject*)Return_type) < 0) 3066 if (PyDict_SetItemString(d, "Return", (PyObject*)Return_type) < 0)
3050 return; 3067 return;
3051 if(PyDict_SetItemString(d, "Delete", (PyObject*)Delete_type) < 0) 3068 if (PyDict_SetItemString(d, "Delete", (PyObject*)Delete_type) < 0)
3052 return; 3069 return;
3053 if(PyDict_SetItemString(d, "Assign", (PyObject*)Assign_type) < 0) 3070 if (PyDict_SetItemString(d, "Assign", (PyObject*)Assign_type) < 0)
3054 return; 3071 return;
3055 if(PyDict_SetItemString(d, "AugAssign", (PyObject*)AugAssign_type) < 0) 3072 if (PyDict_SetItemString(d, "AugAssign", (PyObject*)AugAssign_type) <
3056 return; 3073 0) return;
3057 if(PyDict_SetItemString(d, "Print", (PyObject*)Print_type) < 0) return; 3074 if (PyDict_SetItemString(d, "Print", (PyObject*)Print_type) < 0) return;
3058 if(PyDict_SetItemString(d, "For", (PyObject*)For_type) < 0) return; 3075 if (PyDict_SetItemString(d, "For", (PyObject*)For_type) < 0) return;
3059 if(PyDict_SetItemString(d, "While", (PyObject*)While_type) < 0) return; 3076 if (PyDict_SetItemString(d, "While", (PyObject*)While_type) < 0) return;
3060 if(PyDict_SetItemString(d, "If", (PyObject*)If_type) < 0) return; 3077 if (PyDict_SetItemString(d, "If", (PyObject*)If_type) < 0) return;
3061 if(PyDict_SetItemString(d, "With", (PyObject*)With_type) < 0) return; 3078 if (PyDict_SetItemString(d, "With", (PyObject*)With_type) < 0) return;
3062 if(PyDict_SetItemString(d, "Raise", (PyObject*)Raise_type) < 0) return; 3079 if (PyDict_SetItemString(d, "Raise", (PyObject*)Raise_type) < 0) return;
3063 if(PyDict_SetItemString(d, "TryExcept", (PyObject*)TryExcept_type) < 0) 3080 if (PyDict_SetItemString(d, "TryExcept", (PyObject*)TryExcept_type) <
3064 return; 3081 0) return;
3065 if(PyDict_SetItemString(d, "TryFinally", (PyObject*)TryFinally_type) < 3082 if (PyDict_SetItemString(d, "TryFinally", (PyObject*)TryFinally_type) <
3066 0) return; 3083 0) return;
3067 if(PyDict_SetItemString(d, "Assert", (PyObject*)Assert_type) < 0) 3084 if (PyDict_SetItemString(d, "Assert", (PyObject*)Assert_type) < 0)
3068 return; 3085 return;
3069 if(PyDict_SetItemString(d, "Import", (PyObject*)Import_type) < 0) 3086 if (PyDict_SetItemString(d, "Import", (PyObject*)Import_type) < 0)
3070 return; 3087 return;
3071 if(PyDict_SetItemString(d, "ImportFrom", (PyObject*)ImportFrom_type) < 3088 if (PyDict_SetItemString(d, "ImportFrom", (PyObject*)ImportFrom_type) <
3072 0) return; 3089 0) return;
3073 if(PyDict_SetItemString(d, "Exec", (PyObject*)Exec_type) < 0) return; 3090 if (PyDict_SetItemString(d, "Exec", (PyObject*)Exec_type) < 0) return;
3074 if(PyDict_SetItemString(d, "Global", (PyObject*)Global_type) < 0) 3091 if (PyDict_SetItemString(d, "Global", (PyObject*)Global_type) < 0)
3075 return; 3092 return;
3076 if(PyDict_SetItemString(d, "Expr", (PyObject*)Expr_type) < 0) return; 3093 if (PyDict_SetItemString(d, "Expr", (PyObject*)Expr_type) < 0) return;
3077 if(PyDict_SetItemString(d, "Pass", (PyObject*)Pass_type) < 0) return; 3094 if (PyDict_SetItemString(d, "Pass", (PyObject*)Pass_type) < 0) return;
3078 if(PyDict_SetItemString(d, "Break", (PyObject*)Break_type) < 0) return; 3095 if (PyDict_SetItemString(d, "Break", (PyObject*)Break_type) < 0) return;
3079 if(PyDict_SetItemString(d, "Continue", (PyObject*)Continue_type) < 0) 3096 if (PyDict_SetItemString(d, "Continue", (PyObject*)Continue_type) < 0)
3080 return; 3097 return;
3081 if(PyDict_SetItemString(d, "expr", (PyObject*)expr_type) < 0) return; 3098 if (PyDict_SetItemString(d, "expr", (PyObject*)expr_type) < 0) return;
3082 if(PyDict_SetItemString(d, "BoolOp", (PyObject*)BoolOp_type) < 0) 3099 if (PyDict_SetItemString(d, "BoolOp", (PyObject*)BoolOp_type) < 0)
3083 return; 3100 return;
3084 if(PyDict_SetItemString(d, "BinOp", (PyObject*)BinOp_type) < 0) return; 3101 if (PyDict_SetItemString(d, "BinOp", (PyObject*)BinOp_type) < 0) return;
3085 if(PyDict_SetItemString(d, "UnaryOp", (PyObject*)UnaryOp_type) < 0) 3102 if (PyDict_SetItemString(d, "UnaryOp", (PyObject*)UnaryOp_type) < 0)
3086 return; 3103 return;
3087 if(PyDict_SetItemString(d, "Lambda", (PyObject*)Lambda_type) < 0) 3104 if (PyDict_SetItemString(d, "Lambda", (PyObject*)Lambda_type) < 0)
3088 return; 3105 return;
3089 if(PyDict_SetItemString(d, "IfExp", (PyObject*)IfExp_type) < 0) return; 3106 if (PyDict_SetItemString(d, "IfExp", (PyObject*)IfExp_type) < 0) return;
3090 if(PyDict_SetItemString(d, "Dict", (PyObject*)Dict_type) < 0) return; 3107 if (PyDict_SetItemString(d, "Dict", (PyObject*)Dict_type) < 0) return;
3091 if(PyDict_SetItemString(d, "ListComp", (PyObject*)ListComp_type) < 0) 3108 if (PyDict_SetItemString(d, "ListComp", (PyObject*)ListComp_type) < 0)
3092 return; 3109 return;
3093 if(PyDict_SetItemString(d, "GeneratorExp", 3110 if (PyDict_SetItemString(d, "GeneratorExp",
3094 (PyObject*)GeneratorExp_type) < 0) return; 3111 (PyObject*)GeneratorExp_type) < 0) return;
3095 if(PyDict_SetItemString(d, "Yield", (PyObject*)Yield_type) < 0) return; 3112 if (PyDict_SetItemString(d, "Yield", (PyObject*)Yield_type) < 0) return;
3096 if(PyDict_SetItemString(d, "Compare", (PyObject*)Compare_type) < 0) 3113 if (PyDict_SetItemString(d, "Compare", (PyObject*)Compare_type) < 0)
3097 return; 3114 return;
3098 if(PyDict_SetItemString(d, "Call", (PyObject*)Call_type) < 0) return; 3115 if (PyDict_SetItemString(d, "Call", (PyObject*)Call_type) < 0) return;
3099 if(PyDict_SetItemString(d, "Repr", (PyObject*)Repr_type) < 0) return; 3116 if (PyDict_SetItemString(d, "Repr", (PyObject*)Repr_type) < 0) return;
3100 if(PyDict_SetItemString(d, "Num", (PyObject*)Num_type) < 0) return; 3117 if (PyDict_SetItemString(d, "Num", (PyObject*)Num_type) < 0) return;
3101 if(PyDict_SetItemString(d, "Str", (PyObject*)Str_type) < 0) return; 3118 if (PyDict_SetItemString(d, "Str", (PyObject*)Str_type) < 0) return;
3102 if(PyDict_SetItemString(d, "Attribute", (PyObject*)Attribute_type) < 0) 3119 if (PyDict_SetItemString(d, "Attribute", (PyObject*)Attribute_type) <
3103 return; 3120 0) return;
3104 if(PyDict_SetItemString(d, "Subscript", (PyObject*)Subscript_type) < 0) 3121 if (PyDict_SetItemString(d, "Subscript", (PyObject*)Subscript_type) <
3105 return; 3122 0) return;
3106 if(PyDict_SetItemString(d, "Name", (PyObject*)Name_type) < 0) return; 3123 if (PyDict_SetItemString(d, "Name", (PyObject*)Name_type) < 0) return;
3107 if(PyDict_SetItemString(d, "List", (PyObject*)List_type) < 0) return; 3124 if (PyDict_SetItemString(d, "List", (PyObject*)List_type) < 0) return;
3108 if(PyDict_SetItemString(d, "Tuple", (PyObject*)Tuple_type) < 0) return; 3125 if (PyDict_SetItemString(d, "Tuple", (PyObject*)Tuple_type) < 0) return;
3109 if(PyDict_SetItemString(d, "expr_context", 3126 if (PyDict_SetItemString(d, "expr_context",
3110 (PyObject*)expr_context_type) < 0) return; 3127 (PyObject*)expr_context_type) < 0) return;
3111 if(PyDict_SetItemString(d, "Load", (PyObject*)Load_type) < 0) return; 3128 if (PyDict_SetItemString(d, "Load", (PyObject*)Load_type) < 0) return;
3112 if(PyDict_SetItemString(d, "Store", (PyObject*)Store_type) < 0) return; 3129 if (PyDict_SetItemString(d, "Store", (PyObject*)Store_type) < 0) return;
3113 if(PyDict_SetItemString(d, "Del", (PyObject*)Del_type) < 0) return; 3130 if (PyDict_SetItemString(d, "Del", (PyObject*)Del_type) < 0) return;
3114 if(PyDict_SetItemString(d, "AugLoad", (PyObject*)AugLoad_type) < 0) 3131 if (PyDict_SetItemString(d, "AugLoad", (PyObject*)AugLoad_type) < 0)
3115 return; 3132 return;
3116 if(PyDict_SetItemString(d, "AugStore", (PyObject*)AugStore_type) < 0) 3133 if (PyDict_SetItemString(d, "AugStore", (PyObject*)AugStore_type) < 0)
3117 return; 3134 return;
3118 if(PyDict_SetItemString(d, "Param", (PyObject*)Param_type) < 0) return; 3135 if (PyDict_SetItemString(d, "Param", (PyObject*)Param_type) < 0) return;
3119 if(PyDict_SetItemString(d, "slice", (PyObject*)slice_type) < 0) return; 3136 if (PyDict_SetItemString(d, "slice", (PyObject*)slice_type) < 0) return;
3120 if(PyDict_SetItemString(d, "Ellipsis", (PyObject*)Ellipsis_type) < 0) 3137 if (PyDict_SetItemString(d, "Ellipsis", (PyObject*)Ellipsis_type) < 0)
3121 return; 3138 return;
3122 if(PyDict_SetItemString(d, "Slice", (PyObject*)Slice_type) < 0) return; 3139 if (PyDict_SetItemString(d, "Slice", (PyObject*)Slice_type) < 0) return;
3123 if(PyDict_SetItemString(d, "ExtSlice", (PyObject*)ExtSlice_type) < 0) 3140 if (PyDict_SetItemString(d, "ExtSlice", (PyObject*)ExtSlice_type) < 0)
3124 return; 3141 return;
3125 if(PyDict_SetItemString(d, "Index", (PyObject*)Index_type) < 0) return; 3142 if (PyDict_SetItemString(d, "Index", (PyObject*)Index_type) < 0) return;
3126 if(PyDict_SetItemString(d, "boolop", (PyObject*)boolop_type) < 0) 3143 if (PyDict_SetItemString(d, "boolop", (PyObject*)boolop_type) < 0)
3127 return; 3144 return;
3128 if(PyDict_SetItemString(d, "And", (PyObject*)And_type) < 0) return; 3145 if (PyDict_SetItemString(d, "And", (PyObject*)And_type) < 0) return;
3129 if(PyDict_SetItemString(d, "Or", (PyObject*)Or_type) < 0) return; 3146 if (PyDict_SetItemString(d, "Or", (PyObject*)Or_type) < 0) return;
3130 if(PyDict_SetItemString(d, "operator", (PyObject*)operator_type) < 0) 3147 if (PyDict_SetItemString(d, "operator", (PyObject*)operator_type) < 0)
3131 return; 3148 return;
3132 if(PyDict_SetItemString(d, "Add", (PyObject*)Add_type) < 0) return; 3149 if (PyDict_SetItemString(d, "Add", (PyObject*)Add_type) < 0) return;
3133 if(PyDict_SetItemString(d, "Sub", (PyObject*)Sub_type) < 0) return; 3150 if (PyDict_SetItemString(d, "Sub", (PyObject*)Sub_type) < 0) return;
3134 if(PyDict_SetItemString(d, "Mult", (PyObject*)Mult_type) < 0) return; 3151 if (PyDict_SetItemString(d, "Mult", (PyObject*)Mult_type) < 0) return;
3135 if(PyDict_SetItemString(d, "Div", (PyObject*)Div_type) < 0) return; 3152 if (PyDict_SetItemString(d, "Div", (PyObject*)Div_type) < 0) return;
3136 if(PyDict_SetItemString(d, "Mod", (PyObject*)Mod_type) < 0) return; 3153 if (PyDict_SetItemString(d, "Mod", (PyObject*)Mod_type) < 0) return;
3137 if(PyDict_SetItemString(d, "Pow", (PyObject*)Pow_type) < 0) return; 3154 if (PyDict_SetItemString(d, "Pow", (PyObject*)Pow_type) < 0) return;
3138 if(PyDict_SetItemString(d, "LShift", (PyObject*)LShift_type) < 0) 3155 if (PyDict_SetItemString(d, "LShift", (PyObject*)LShift_type) < 0)
3139 return; 3156 return;
3140 if(PyDict_SetItemString(d, "RShift", (PyObject*)RShift_type) < 0) 3157 if (PyDict_SetItemString(d, "RShift", (PyObject*)RShift_type) < 0)
3141 return; 3158 return;
3142 if(PyDict_SetItemString(d, "BitOr", (PyObject*)BitOr_type) < 0) return; 3159 if (PyDict_SetItemString(d, "BitOr", (PyObject*)BitOr_type) < 0) return;
3143 if(PyDict_SetItemString(d, "BitXor", (PyObject*)BitXor_type) < 0) 3160 if (PyDict_SetItemString(d, "BitXor", (PyObject*)BitXor_type) < 0)
3144 return; 3161 return;
3145 if(PyDict_SetItemString(d, "BitAnd", (PyObject*)BitAnd_type) < 0) 3162 if (PyDict_SetItemString(d, "BitAnd", (PyObject*)BitAnd_type) < 0)
3146 return; 3163 return;
3147 if(PyDict_SetItemString(d, "FloorDiv", (PyObject*)FloorDiv_type) < 0) 3164 if (PyDict_SetItemString(d, "FloorDiv", (PyObject*)FloorDiv_type) < 0)
3148 return; 3165 return;
3149 if(PyDict_SetItemString(d, "unaryop", (PyObject*)unaryop_type) < 0) 3166 if (PyDict_SetItemString(d, "unaryop", (PyObject*)unaryop_type) < 0)
3150 return; 3167 return;
3151 if(PyDict_SetItemString(d, "Invert", (PyObject*)Invert_type) < 0) 3168 if (PyDict_SetItemString(d, "Invert", (PyObject*)Invert_type) < 0)
3152 return; 3169 return;
3153 if(PyDict_SetItemString(d, "Not", (PyObject*)Not_type) < 0) return; 3170 if (PyDict_SetItemString(d, "Not", (PyObject*)Not_type) < 0) return;
3154 if(PyDict_SetItemString(d, "UAdd", (PyObject*)UAdd_type) < 0) return; 3171 if (PyDict_SetItemString(d, "UAdd", (PyObject*)UAdd_type) < 0) return;
3155 if(PyDict_SetItemString(d, "USub", (PyObject*)USub_type) < 0) return; 3172 if (PyDict_SetItemString(d, "USub", (PyObject*)USub_type) < 0) return;
3156 if(PyDict_SetItemString(d, "cmpop", (PyObject*)cmpop_type) < 0) return; 3173 if (PyDict_SetItemString(d, "cmpop", (PyObject*)cmpop_type) < 0) return;
3157 if(PyDict_SetItemString(d, "Eq", (PyObject*)Eq_type) < 0) return; 3174 if (PyDict_SetItemString(d, "Eq", (PyObject*)Eq_type) < 0) return;
3158 if(PyDict_SetItemString(d, "NotEq", (PyObject*)NotEq_type) < 0) return; 3175 if (PyDict_SetItemString(d, "NotEq", (PyObject*)NotEq_type) < 0) return;
3159 if(PyDict_SetItemString(d, "Lt", (PyObject*)Lt_type) < 0) return; 3176 if (PyDict_SetItemString(d, "Lt", (PyObject*)Lt_type) < 0) return;
3160 if(PyDict_SetItemString(d, "LtE", (PyObject*)LtE_type) < 0) return; 3177 if (PyDict_SetItemString(d, "LtE", (PyObject*)LtE_type) < 0) return;
3161 if(PyDict_SetItemString(d, "Gt", (PyObject*)Gt_type) < 0) return; 3178 if (PyDict_SetItemString(d, "Gt", (PyObject*)Gt_type) < 0) return;
3162 if(PyDict_SetItemString(d, "GtE", (PyObject*)GtE_type) < 0) return; 3179 if (PyDict_SetItemString(d, "GtE", (PyObject*)GtE_type) < 0) return;
3163 if(PyDict_SetItemString(d, "Is", (PyObject*)Is_type) < 0) return; 3180 if (PyDict_SetItemString(d, "Is", (PyObject*)Is_type) < 0) return;
3164 if(PyDict_SetItemString(d, "IsNot", (PyObject*)IsNot_type) < 0) return; 3181 if (PyDict_SetItemString(d, "IsNot", (PyObject*)IsNot_type) < 0) return;
3165 if(PyDict_SetItemString(d, "In", (PyObject*)In_type) < 0) return; 3182 if (PyDict_SetItemString(d, "In", (PyObject*)In_type) < 0) return;
3166 if(PyDict_SetItemString(d, "NotIn", (PyObject*)NotIn_type) < 0) return; 3183 if (PyDict_SetItemString(d, "NotIn", (PyObject*)NotIn_type) < 0) return;
3167 if(PyDict_SetItemString(d, "comprehension", 3184 if (PyDict_SetItemString(d, "comprehension",
3168 (PyObject*)comprehension_type) < 0) return; 3185 (PyObject*)comprehension_type) < 0) return;
3169 if(PyDict_SetItemString(d, "excepthandler", 3186 if (PyDict_SetItemString(d, "excepthandler",
3170 (PyObject*)excepthandler_type) < 0) return; 3187 (PyObject*)excepthandler_type) < 0) return;
3171 if(PyDict_SetItemString(d, "arguments", (PyObject*)arguments_type) < 0) 3188 if (PyDict_SetItemString(d, "arguments", (PyObject*)arguments_type) <
3172 return; 3189 0) return;
3173 if(PyDict_SetItemString(d, "keyword", (PyObject*)keyword_type) < 0) 3190 if (PyDict_SetItemString(d, "keyword", (PyObject*)keyword_type) < 0)
3174 return; 3191 return;
3175 if(PyDict_SetItemString(d, "alias", (PyObject*)alias_type) < 0) return; 3192 if (PyDict_SetItemString(d, "alias", (PyObject*)alias_type) < 0) return;
3176 } 3193 }
3177 3194
3178 3195
3179 PyObject* PyAST_mod2obj(mod_ty t) 3196 PyObject* PyAST_mod2obj(mod_ty t)
3180 { 3197 {