[Python-checkins] commit of r41578 - in python/branches/ast-objects: Include/Python-ast.h Parser/asdl_c.py Python/Python-ast.c

martin.v.loewis python-checkins at python.org
Fri Dec 2 13:16:17 CET 2005


Author: martin.v.loewis
Date: Fri Dec  2 13:16:10 2005
New Revision: 41578

Modified:
   python/branches/ast-objects/Include/Python-ast.h
   python/branches/ast-objects/Parser/asdl_c.py
   python/branches/ast-objects/Python/Python-ast.c
Log:
Generate PyAST_validate.


Modified: python/branches/ast-objects/Include/Python-ast.h
==============================================================================
--- python/branches/ast-objects/Include/Python-ast.h	(original)
+++ python/branches/ast-objects/Include/Python-ast.h	Fri Dec  2 13:16:10 2005
@@ -523,6 +523,69 @@
 PyObject *Py_Tuple_New(PyObject*, PyObject*, int);
 #define Tuple Py_Tuple_New
 
+PyAPI_DATA(PyTypeObject) Py_expr_context_Type;
+#define expr_context_Check(op) PyObject_TypeCheck(op, &Py_expr_context_Type)
+
+struct _expr_context{
+        PyObject_HEAD
+        enum {Load_kind, Store_kind, Del_kind, AugLoad_kind, AugStore_kind,
+               Param_kind} _kind;
+};
+
+PyAPI_DATA(PyTypeObject) Py_Load_Type;
+#define Load_Check(op) PyObject_TypeCheck(op, &Py_Load_Type)
+
+struct _Load{
+        struct _expr_context _base;
+};
+PyObject *Py_Load_New(void);
+#define Load Py_Load_New
+
+PyAPI_DATA(PyTypeObject) Py_Store_Type;
+#define Store_Check(op) PyObject_TypeCheck(op, &Py_Store_Type)
+
+struct _Store{
+        struct _expr_context _base;
+};
+PyObject *Py_Store_New(void);
+#define Store Py_Store_New
+
+PyAPI_DATA(PyTypeObject) Py_Del_Type;
+#define Del_Check(op) PyObject_TypeCheck(op, &Py_Del_Type)
+
+struct _Del{
+        struct _expr_context _base;
+};
+PyObject *Py_Del_New(void);
+#define Del Py_Del_New
+
+PyAPI_DATA(PyTypeObject) Py_AugLoad_Type;
+#define AugLoad_Check(op) PyObject_TypeCheck(op, &Py_AugLoad_Type)
+
+struct _AugLoad{
+        struct _expr_context _base;
+};
+PyObject *Py_AugLoad_New(void);
+#define AugLoad Py_AugLoad_New
+
+PyAPI_DATA(PyTypeObject) Py_AugStore_Type;
+#define AugStore_Check(op) PyObject_TypeCheck(op, &Py_AugStore_Type)
+
+struct _AugStore{
+        struct _expr_context _base;
+};
+PyObject *Py_AugStore_New(void);
+#define AugStore Py_AugStore_New
+
+PyAPI_DATA(PyTypeObject) Py_Param_Type;
+#define Param_Check(op) PyObject_TypeCheck(op, &Py_Param_Type)
+
+struct _Param{
+        struct _expr_context _base;
+};
+PyObject *Py_Param_New(void);
+#define Param Py_Param_New
+
 PyAPI_DATA(PyTypeObject) Py_slice_Type;
 #define slice_Check(op) PyObject_TypeCheck(op, &Py_slice_Type)
 
@@ -572,6 +635,293 @@
 PyObject *Py_Index_New(PyObject*);
 #define Index Py_Index_New
 
+PyAPI_DATA(PyTypeObject) Py_boolop_Type;
+#define boolop_Check(op) PyObject_TypeCheck(op, &Py_boolop_Type)
+
+struct _boolop{
+        PyObject_HEAD
+        enum {And_kind, Or_kind} _kind;
+};
+
+PyAPI_DATA(PyTypeObject) Py_And_Type;
+#define And_Check(op) PyObject_TypeCheck(op, &Py_And_Type)
+
+struct _And{
+        struct _boolop _base;
+};
+PyObject *Py_And_New(void);
+#define And Py_And_New
+
+PyAPI_DATA(PyTypeObject) Py_Or_Type;
+#define Or_Check(op) PyObject_TypeCheck(op, &Py_Or_Type)
+
+struct _Or{
+        struct _boolop _base;
+};
+PyObject *Py_Or_New(void);
+#define Or Py_Or_New
+
+PyAPI_DATA(PyTypeObject) Py_operator_Type;
+#define operator_Check(op) PyObject_TypeCheck(op, &Py_operator_Type)
+
+struct _operator{
+        PyObject_HEAD
+        enum {Add_kind, Sub_kind, Mult_kind, Div_kind, Mod_kind, Pow_kind,
+               LShift_kind, RShift_kind, BitOr_kind, BitXor_kind, BitAnd_kind,
+               FloorDiv_kind} _kind;
+};
+
+PyAPI_DATA(PyTypeObject) Py_Add_Type;
+#define Add_Check(op) PyObject_TypeCheck(op, &Py_Add_Type)
+
+struct _Add{
+        struct _operator _base;
+};
+PyObject *Py_Add_New(void);
+#define Add Py_Add_New
+
+PyAPI_DATA(PyTypeObject) Py_Sub_Type;
+#define Sub_Check(op) PyObject_TypeCheck(op, &Py_Sub_Type)
+
+struct _Sub{
+        struct _operator _base;
+};
+PyObject *Py_Sub_New(void);
+#define Sub Py_Sub_New
+
+PyAPI_DATA(PyTypeObject) Py_Mult_Type;
+#define Mult_Check(op) PyObject_TypeCheck(op, &Py_Mult_Type)
+
+struct _Mult{
+        struct _operator _base;
+};
+PyObject *Py_Mult_New(void);
+#define Mult Py_Mult_New
+
+PyAPI_DATA(PyTypeObject) Py_Div_Type;
+#define Div_Check(op) PyObject_TypeCheck(op, &Py_Div_Type)
+
+struct _Div{
+        struct _operator _base;
+};
+PyObject *Py_Div_New(void);
+#define Div Py_Div_New
+
+PyAPI_DATA(PyTypeObject) Py_Mod_Type;
+#define Mod_Check(op) PyObject_TypeCheck(op, &Py_Mod_Type)
+
+struct _Mod{
+        struct _operator _base;
+};
+PyObject *Py_Mod_New(void);
+#define Mod Py_Mod_New
+
+PyAPI_DATA(PyTypeObject) Py_Pow_Type;
+#define Pow_Check(op) PyObject_TypeCheck(op, &Py_Pow_Type)
+
+struct _Pow{
+        struct _operator _base;
+};
+PyObject *Py_Pow_New(void);
+#define Pow Py_Pow_New
+
+PyAPI_DATA(PyTypeObject) Py_LShift_Type;
+#define LShift_Check(op) PyObject_TypeCheck(op, &Py_LShift_Type)
+
+struct _LShift{
+        struct _operator _base;
+};
+PyObject *Py_LShift_New(void);
+#define LShift Py_LShift_New
+
+PyAPI_DATA(PyTypeObject) Py_RShift_Type;
+#define RShift_Check(op) PyObject_TypeCheck(op, &Py_RShift_Type)
+
+struct _RShift{
+        struct _operator _base;
+};
+PyObject *Py_RShift_New(void);
+#define RShift Py_RShift_New
+
+PyAPI_DATA(PyTypeObject) Py_BitOr_Type;
+#define BitOr_Check(op) PyObject_TypeCheck(op, &Py_BitOr_Type)
+
+struct _BitOr{
+        struct _operator _base;
+};
+PyObject *Py_BitOr_New(void);
+#define BitOr Py_BitOr_New
+
+PyAPI_DATA(PyTypeObject) Py_BitXor_Type;
+#define BitXor_Check(op) PyObject_TypeCheck(op, &Py_BitXor_Type)
+
+struct _BitXor{
+        struct _operator _base;
+};
+PyObject *Py_BitXor_New(void);
+#define BitXor Py_BitXor_New
+
+PyAPI_DATA(PyTypeObject) Py_BitAnd_Type;
+#define BitAnd_Check(op) PyObject_TypeCheck(op, &Py_BitAnd_Type)
+
+struct _BitAnd{
+        struct _operator _base;
+};
+PyObject *Py_BitAnd_New(void);
+#define BitAnd Py_BitAnd_New
+
+PyAPI_DATA(PyTypeObject) Py_FloorDiv_Type;
+#define FloorDiv_Check(op) PyObject_TypeCheck(op, &Py_FloorDiv_Type)
+
+struct _FloorDiv{
+        struct _operator _base;
+};
+PyObject *Py_FloorDiv_New(void);
+#define FloorDiv Py_FloorDiv_New
+
+PyAPI_DATA(PyTypeObject) Py_unaryop_Type;
+#define unaryop_Check(op) PyObject_TypeCheck(op, &Py_unaryop_Type)
+
+struct _unaryop{
+        PyObject_HEAD
+        enum {Invert_kind, Not_kind, UAdd_kind, USub_kind} _kind;
+};
+
+PyAPI_DATA(PyTypeObject) Py_Invert_Type;
+#define Invert_Check(op) PyObject_TypeCheck(op, &Py_Invert_Type)
+
+struct _Invert{
+        struct _unaryop _base;
+};
+PyObject *Py_Invert_New(void);
+#define Invert Py_Invert_New
+
+PyAPI_DATA(PyTypeObject) Py_Not_Type;
+#define Not_Check(op) PyObject_TypeCheck(op, &Py_Not_Type)
+
+struct _Not{
+        struct _unaryop _base;
+};
+PyObject *Py_Not_New(void);
+#define Not Py_Not_New
+
+PyAPI_DATA(PyTypeObject) Py_UAdd_Type;
+#define UAdd_Check(op) PyObject_TypeCheck(op, &Py_UAdd_Type)
+
+struct _UAdd{
+        struct _unaryop _base;
+};
+PyObject *Py_UAdd_New(void);
+#define UAdd Py_UAdd_New
+
+PyAPI_DATA(PyTypeObject) Py_USub_Type;
+#define USub_Check(op) PyObject_TypeCheck(op, &Py_USub_Type)
+
+struct _USub{
+        struct _unaryop _base;
+};
+PyObject *Py_USub_New(void);
+#define USub Py_USub_New
+
+PyAPI_DATA(PyTypeObject) Py_cmpop_Type;
+#define cmpop_Check(op) PyObject_TypeCheck(op, &Py_cmpop_Type)
+
+struct _cmpop{
+        PyObject_HEAD
+        enum {Eq_kind, NotEq_kind, Lt_kind, LtE_kind, Gt_kind, GtE_kind,
+               Is_kind, IsNot_kind, In_kind, NotIn_kind} _kind;
+};
+
+PyAPI_DATA(PyTypeObject) Py_Eq_Type;
+#define Eq_Check(op) PyObject_TypeCheck(op, &Py_Eq_Type)
+
+struct _Eq{
+        struct _cmpop _base;
+};
+PyObject *Py_Eq_New(void);
+#define Eq Py_Eq_New
+
+PyAPI_DATA(PyTypeObject) Py_NotEq_Type;
+#define NotEq_Check(op) PyObject_TypeCheck(op, &Py_NotEq_Type)
+
+struct _NotEq{
+        struct _cmpop _base;
+};
+PyObject *Py_NotEq_New(void);
+#define NotEq Py_NotEq_New
+
+PyAPI_DATA(PyTypeObject) Py_Lt_Type;
+#define Lt_Check(op) PyObject_TypeCheck(op, &Py_Lt_Type)
+
+struct _Lt{
+        struct _cmpop _base;
+};
+PyObject *Py_Lt_New(void);
+#define Lt Py_Lt_New
+
+PyAPI_DATA(PyTypeObject) Py_LtE_Type;
+#define LtE_Check(op) PyObject_TypeCheck(op, &Py_LtE_Type)
+
+struct _LtE{
+        struct _cmpop _base;
+};
+PyObject *Py_LtE_New(void);
+#define LtE Py_LtE_New
+
+PyAPI_DATA(PyTypeObject) Py_Gt_Type;
+#define Gt_Check(op) PyObject_TypeCheck(op, &Py_Gt_Type)
+
+struct _Gt{
+        struct _cmpop _base;
+};
+PyObject *Py_Gt_New(void);
+#define Gt Py_Gt_New
+
+PyAPI_DATA(PyTypeObject) Py_GtE_Type;
+#define GtE_Check(op) PyObject_TypeCheck(op, &Py_GtE_Type)
+
+struct _GtE{
+        struct _cmpop _base;
+};
+PyObject *Py_GtE_New(void);
+#define GtE Py_GtE_New
+
+PyAPI_DATA(PyTypeObject) Py_Is_Type;
+#define Is_Check(op) PyObject_TypeCheck(op, &Py_Is_Type)
+
+struct _Is{
+        struct _cmpop _base;
+};
+PyObject *Py_Is_New(void);
+#define Is Py_Is_New
+
+PyAPI_DATA(PyTypeObject) Py_IsNot_Type;
+#define IsNot_Check(op) PyObject_TypeCheck(op, &Py_IsNot_Type)
+
+struct _IsNot{
+        struct _cmpop _base;
+};
+PyObject *Py_IsNot_New(void);
+#define IsNot Py_IsNot_New
+
+PyAPI_DATA(PyTypeObject) Py_In_Type;
+#define In_Check(op) PyObject_TypeCheck(op, &Py_In_Type)
+
+struct _In{
+        struct _cmpop _base;
+};
+PyObject *Py_In_New(void);
+#define In Py_In_New
+
+PyAPI_DATA(PyTypeObject) Py_NotIn_Type;
+#define NotIn_Check(op) PyObject_TypeCheck(op, &Py_NotIn_Type)
+
+struct _NotIn{
+        struct _cmpop _base;
+};
+PyObject *Py_NotIn_New(void);
+#define NotIn Py_NotIn_New
+
 PyAPI_DATA(PyTypeObject) Py_comprehension_Type;
 #define comprehension_Check(op) PyObject_TypeCheck(op, &Py_comprehension_Type)
 

Modified: python/branches/ast-objects/Parser/asdl_c.py
==============================================================================
--- python/branches/ast-objects/Parser/asdl_c.py	(original)
+++ python/branches/ast-objects/Parser/asdl_c.py	Fri Dec  2 13:16:10 2005
@@ -4,7 +4,7 @@
 # TO DO
 # handle fields that have a type but no name
 
-import os, sys, traceback
+import os, sys, traceback, operator
 
 import asdl
 
@@ -104,11 +104,8 @@
         self.visit(type.value, type.name)
 
     def visitSum(self, sum, name):
-        if is_simple(sum):
-            pass # XXX
-        else:
-            for t in sum.types:
-                self.visit(t, name, sum.attributes)
+        for t in sum.types:
+            self.visit(t, name, sum.attributes)
 
     def get_args(self, fields):
         """Return list of C argument into, one for each field.
@@ -144,8 +141,7 @@
         self.visit(type.value, type.name, depth)
 
     def visitSum(self, sum, name, depth):
-        if not is_simple(sum):
-            self.sum_with_constructors(sum, name, depth)
+        self.sum_with_constructors(sum, name, depth)
 
     def sum_with_constructors(self, sum, name, depth):
         def emit(s, depth=depth):
@@ -197,9 +193,34 @@
         self.emit("PyObject *Py_%s_New(%s);" % (name, ", ".join(field_types)), depth)
         self.emit("", depth)
 
+class ForwardVisitor(TraversalVisitor):
+    def emit_validate(self, name):
+        self.emit("static int %s_validate(PyObject*);" % name, 0)
+        
+    def visitSum(self, sum, name):
+        self.emit_validate(name)
+        for t in sum.types:
+            self.visit(t, name, sum.attributes)    
+        
+    def visitProduct(self, prod, name):
+        self.emit_validate(name)
+
+    def visitConstructor(self, cons, name, attrs):
+        self.emit_validate(cons.name)
+    
+
 class FunctionVisitor(TraversalVisitor):
     """Visitor to generate constructor functions for AST."""
 
+    def check(self, t):
+        t = t.value
+        if t in ("identifier", "string"):
+            return "PyString_Check"
+        elif t == "bool":
+            return "PyBool_Check"
+        else:
+            return t+"_Check"
+
     def emit_ctor(self, name, args, attrs):
         def emit(s, depth=0, reflow=1):
             self.emit(s, depth, reflow)
@@ -241,9 +262,116 @@
         emit("}")
         emit("")
 
+    def emit_seq_check(self, f):
+        depth = 1
+        def emit(s):
+            self.emit(s, depth)
+        emit("if (!PyList_Check(obj->%s)) {" % f.name)
+        emit('   failed_check("%s", "list", obj->%s);' % (f.name, f.name))
+        emit('   return -1;')
+        emit("}")
+        emit("for(i = 0; i < PyList_Size(obj->%s); i++) {" % f.name)
+        depth = 2
+        check = self.check(f.type)
+        emit("if (!%s(PyList_GET_ITEM(obj->%s, i))) {" % (check, f.name))
+        emit('    failed_check("%s", "%s", PyList_GET_ITEM(obj->%s, i));' % (f.name, f.type, f.name))
+        emit('    return -1;')
+        emit("}")
+        if f.type.value not in ('identifier',):
+            emit("if (%s_validate(PyList_GET_ITEM(obj->%s, i)) < 0)" % (f.type, f.name))
+            emit("    return -1;")
+        depth = 1
+        emit("}")
+
+    def emit_opt_check(self, f):
+        depth = 1
+        def emit(s):
+            self.emit(s, depth)
+        emit("if (obj->%s != Py_None) /* empty */;" % f.name)
+        check = self.check(f.type)
+        emit("else if (!%s(obj->%s)) {" % (check, f.name))
+        emit('    failed_check("%s", "%s", obj->%s);' % (f.name, f.type, f.name))
+        emit('    return -1;')
+        emit("}")
+        if f.type.value not in ('identifier',):
+            emit("else if (%s_validate(obj->%s) < 0)" % (f.type, f.name))
+            emit("    return -1;")
+
+    def emit_field_check(self, f, inbase):
+        depth = 1
+        def emit(s):
+            self.emit(s, depth)
+        base = ""
+        if inbase:
+            base = "_base."
+            type = f[0]
+            name = f[1]
+        else:
+            type = f.type
+            name = f.name
+        if type == "int":
+            return
+        check = self.check(type)
+        emit("if (!%s(obj->%s%s)) {" % (check, base, name))
+        emit('    failed_check("%s", "%s", obj->%s%s);' %
+             (name, type, base, name))
+        emit('    return -1;')
+        emit("}")
+
+    def emit_validate(self, name, fields, attrs):
+        depth = 0
+        def emit(s):
+            self.emit(s, depth)
+        has_seq = reduce(operator.or_, ([f.seq for f in fields]), False)
+        emit("static int")
+        emit("%s_validate(PyObject *_obj)" % name)
+        emit("{")
+        depth = 1
+        if fields:
+            emit("struct _%s *obj = (struct _%s*)_obj;" % (name,name))
+        if has_seq:
+            emit("int i;")
+        for  f in fields:
+            if f.seq:
+                self.emit_seq_check(f)
+            elif f.opt:
+                self.emit_opt_check(f)
+            else:
+                self.emit_field_check(f, False)
+        for f in attrs:
+            self.emit_field_check(f, True)
+        emit("return 0;")
+        depth = 0
+        emit("}")
+        emit("")
+
+    def emit_sumvalidate(self, sum, name):
+        depth = 0
+        def emit(s):
+            self.emit(s, depth)
+        emit("int")
+        emit("%s_validate(PyObject* _obj)" % name)
+        emit("{")
+        depth = 1
+        emit("struct _%s *obj = (struct _%s*)_obj;" % (name,name))
+        # caller should have verified that this is the correct type
+        emit("assert(%s_Check(_obj));" % (name))
+        emit("switch(obj->_kind) {")
+        depth = 2
+        for t in sum.types:
+            emit("case %s_kind:" % t.name)
+            emit("    return %s_validate(_obj);" % t.name)
+        depth = 1
+        emit("}")
+        emit('PyErr_SetString(PyExc_TypeError, "invalid _kind in %s");' % name)
+        emit('return -1;')
+        depth = 0
+        emit("}")
+        
+
     def emit_type(self, name):
         depth = 0
-        def emit(s=1):
+        def emit(s):
             self.emit(s, depth)
         def null(thing):
             emit("0,\t\t/* tp_%s */" % thing)
@@ -275,19 +403,18 @@
         emit("")
 
     def visitSum(self, sum, name):
-        if is_simple(sum):
-            pass # XXX
-        else:
-            self.emit("#define %s_dealloc 0" % name, 0)
-            self.emit_type(name)
-            for t in sum.types:
-                self.visit(t, name, sum.attributes)    
+        self.emit("#define %s_dealloc 0" % name, 0)
+        self.emit_type(name)
+        self.emit_sumvalidate(sum, name)
+        for t in sum.types:
+            self.visit(t, name, sum.attributes)    
         
     def visitProduct(self, prod, name):
         args = self.get_args(prod.fields)
         self.emit_ctor(str(name), args, [])
         self.emit_dealloc(str(name), args, [])
         self.emit_type(str(name))
+        self.emit_validate(str(name), prod.fields, [])
 
     def visitConstructor(self, cons, name, attrs):
         args = self.get_args(cons.fields)
@@ -295,6 +422,22 @@
         self.emit_ctor(cons.name, args, attrs)
         self.emit_dealloc(cons.name, args, attrs)
         self.emit_type(cons.name)
+        self.emit_validate(cons.name, cons.fields, attrs)
+
+class PyAST_Validate(TraversalVisitor):
+    def visitModule(self, mod):
+        self.emit("int PyAST_Validate(PyObject *obj)", 0)
+        self.emit("{", 0)
+        for dfn in mod.dfns:
+            self.visit(dfn)
+        self.emit('PyErr_Format(PyExc_TypeError, "Not an AST node: %s", obj->ob_type->tp_name);', 1)
+        self.emit("return -1;", 1)
+        self.emit("}", 0)
+        self.emit("", 0)
+
+    def visitType(self, t):
+        self.emit("if (%s_Check(obj))" % t.name, 1)
+        self.emit("return %s_validate(obj);" % t.name, 2)
 
 class InitVisitor(TraversalVisitor):
     def visitModule(self, mod):
@@ -305,12 +448,9 @@
         self.emit("}", 0)
 
     def visitSum(self, sum, name):
-        if is_simple(sum):
-            pass # XXX
-        else:
-            self.emit_init(name)
-            for t in sum.types:
-                self.visit(t, name, sum.attributes)    
+        self.emit_init(name)
+        for t in sum.types:
+            self.visit(t, name, sum.attributes)    
 
     def visitProduct(self, prod, name):
         self.emit_init(name)
@@ -333,6 +473,17 @@
             v.visit(object)
             v.emit("", 0)
 
+static_code = """
+static void failed_check(const char* field, const char* expected,
+                         PyObject *real)
+{
+    PyErr_Format(PyExc_TypeError, "invalid %s: excpected %s, found %s",
+                 field, expected, real->ob_type->tp_name);
+}
+/* Convenience macro to simplify asdl_c.py */
+#define object_Check(x) 1
+"""
+
 def main(srcfile):
     auto_gen_msg = '/* File automatically generated by %s */\n' % sys.argv[0]
     mod = asdl.parse(srcfile)
@@ -361,9 +512,13 @@
     print >> f, '#include "Python.h"'
     print >> f, '#include "%s-ast.h"' % mod.name
     print >> f
-    v = ChainOfVisitors(FunctionVisitor(f),
-                        InitVisitor(f),
-                        )
+    print >> f, static_code
+    v = ChainOfVisitors(
+        ForwardVisitor(f),
+        FunctionVisitor(f),
+        PyAST_Validate(f),
+        InitVisitor(f),
+        )
     v.visit(mod)
     f.close()
 

Modified: python/branches/ast-objects/Python/Python-ast.c
==============================================================================
--- python/branches/ast-objects/Python/Python-ast.c	(original)
+++ python/branches/ast-objects/Python/Python-ast.c	Fri Dec  2 13:16:10 2005
@@ -3,6 +3,113 @@
 #include "Python.h"
 #include "Python-ast.h"
 
+
+static void failed_check(const char* field, const char* expected,
+                         PyObject *real)
+{
+    PyErr_Format(PyExc_TypeError, "invalid %s: excpected %s, found %s",
+                 field, expected, real->ob_type->tp_name);
+}
+/* Convenience macro to simplify asdl_c.py */
+#define object_Check(x) 1
+
+static int mod_validate(PyObject*);
+static int Module_validate(PyObject*);
+static int Interactive_validate(PyObject*);
+static int Expression_validate(PyObject*);
+static int Suite_validate(PyObject*);
+static int stmt_validate(PyObject*);
+static int FunctionDef_validate(PyObject*);
+static int ClassDef_validate(PyObject*);
+static int Return_validate(PyObject*);
+static int Delete_validate(PyObject*);
+static int Assign_validate(PyObject*);
+static int AugAssign_validate(PyObject*);
+static int Print_validate(PyObject*);
+static int For_validate(PyObject*);
+static int While_validate(PyObject*);
+static int If_validate(PyObject*);
+static int Raise_validate(PyObject*);
+static int TryExcept_validate(PyObject*);
+static int TryFinally_validate(PyObject*);
+static int Assert_validate(PyObject*);
+static int Import_validate(PyObject*);
+static int ImportFrom_validate(PyObject*);
+static int Exec_validate(PyObject*);
+static int Global_validate(PyObject*);
+static int Expr_validate(PyObject*);
+static int Pass_validate(PyObject*);
+static int Break_validate(PyObject*);
+static int Continue_validate(PyObject*);
+static int expr_validate(PyObject*);
+static int BoolOp_validate(PyObject*);
+static int BinOp_validate(PyObject*);
+static int UnaryOp_validate(PyObject*);
+static int Lambda_validate(PyObject*);
+static int Dict_validate(PyObject*);
+static int ListComp_validate(PyObject*);
+static int GeneratorExp_validate(PyObject*);
+static int Yield_validate(PyObject*);
+static int Compare_validate(PyObject*);
+static int Call_validate(PyObject*);
+static int Repr_validate(PyObject*);
+static int Num_validate(PyObject*);
+static int Str_validate(PyObject*);
+static int Attribute_validate(PyObject*);
+static int Subscript_validate(PyObject*);
+static int Name_validate(PyObject*);
+static int List_validate(PyObject*);
+static int Tuple_validate(PyObject*);
+static int expr_context_validate(PyObject*);
+static int Load_validate(PyObject*);
+static int Store_validate(PyObject*);
+static int Del_validate(PyObject*);
+static int AugLoad_validate(PyObject*);
+static int AugStore_validate(PyObject*);
+static int Param_validate(PyObject*);
+static int slice_validate(PyObject*);
+static int Ellipsis_validate(PyObject*);
+static int Slice_validate(PyObject*);
+static int ExtSlice_validate(PyObject*);
+static int Index_validate(PyObject*);
+static int boolop_validate(PyObject*);
+static int And_validate(PyObject*);
+static int Or_validate(PyObject*);
+static int operator_validate(PyObject*);
+static int Add_validate(PyObject*);
+static int Sub_validate(PyObject*);
+static int Mult_validate(PyObject*);
+static int Div_validate(PyObject*);
+static int Mod_validate(PyObject*);
+static int Pow_validate(PyObject*);
+static int LShift_validate(PyObject*);
+static int RShift_validate(PyObject*);
+static int BitOr_validate(PyObject*);
+static int BitXor_validate(PyObject*);
+static int BitAnd_validate(PyObject*);
+static int FloorDiv_validate(PyObject*);
+static int unaryop_validate(PyObject*);
+static int Invert_validate(PyObject*);
+static int Not_validate(PyObject*);
+static int UAdd_validate(PyObject*);
+static int USub_validate(PyObject*);
+static int cmpop_validate(PyObject*);
+static int Eq_validate(PyObject*);
+static int NotEq_validate(PyObject*);
+static int Lt_validate(PyObject*);
+static int LtE_validate(PyObject*);
+static int Gt_validate(PyObject*);
+static int GtE_validate(PyObject*);
+static int Is_validate(PyObject*);
+static int IsNot_validate(PyObject*);
+static int In_validate(PyObject*);
+static int NotIn_validate(PyObject*);
+static int comprehension_validate(PyObject*);
+static int excepthandler_validate(PyObject*);
+static int arguments_validate(PyObject*);
+static int keyword_validate(PyObject*);
+static int alias_validate(PyObject*);
+
 #define mod_dealloc 0
 PyTypeObject Py_mod_Type = {
         PyObject_HEAD_INIT(NULL)
@@ -48,6 +155,24 @@
         0,		/* tp_is_gc */
 };
 
+int
+mod_validate(PyObject* _obj)
+{
+        struct _mod *obj = (struct _mod*)_obj;
+        assert(mod_Check(_obj));
+        switch(obj->_kind) {
+                case Module_kind:
+                    return Module_validate(_obj);
+                case Interactive_kind:
+                    return Interactive_validate(_obj);
+                case Expression_kind:
+                    return Expression_validate(_obj);
+                case Suite_kind:
+                    return Suite_validate(_obj);
+        }
+        PyErr_SetString(PyExc_TypeError, "invalid _kind in mod");
+        return -1;
+}
 PyObject*
 Py_Module_New(PyObject* body)
 {
@@ -111,6 +236,26 @@
         0,		/* tp_is_gc */
 };
 
+static int
+Module_validate(PyObject *_obj)
+{
+        struct _Module *obj = (struct _Module*)_obj;
+        int i;
+        if (!PyList_Check(obj->body)) {
+           failed_check("body", "list", obj->body);
+           return -1;
+        }
+        for(i = 0; i < PyList_Size(obj->body); i++) {
+                if (!stmt_Check(PyList_GET_ITEM(obj->body, i))) {
+                    failed_check("body", "stmt", PyList_GET_ITEM(obj->body, i));
+                    return -1;
+                }
+                if (stmt_validate(PyList_GET_ITEM(obj->body, i)) < 0)
+                    return -1;
+        }
+        return 0;
+}
+
 PyObject*
 Py_Interactive_New(PyObject* body)
 {
@@ -174,6 +319,26 @@
         0,		/* tp_is_gc */
 };
 
+static int
+Interactive_validate(PyObject *_obj)
+{
+        struct _Interactive *obj = (struct _Interactive*)_obj;
+        int i;
+        if (!PyList_Check(obj->body)) {
+           failed_check("body", "list", obj->body);
+           return -1;
+        }
+        for(i = 0; i < PyList_Size(obj->body); i++) {
+                if (!stmt_Check(PyList_GET_ITEM(obj->body, i))) {
+                    failed_check("body", "stmt", PyList_GET_ITEM(obj->body, i));
+                    return -1;
+                }
+                if (stmt_validate(PyList_GET_ITEM(obj->body, i)) < 0)
+                    return -1;
+        }
+        return 0;
+}
+
 PyObject*
 Py_Expression_New(PyObject* body)
 {
@@ -237,6 +402,17 @@
         0,		/* tp_is_gc */
 };
 
+static int
+Expression_validate(PyObject *_obj)
+{
+        struct _Expression *obj = (struct _Expression*)_obj;
+        if (!expr_Check(obj->body)) {
+            failed_check("body", "expr", obj->body);
+            return -1;
+        }
+        return 0;
+}
+
 PyObject*
 Py_Suite_New(PyObject* body)
 {
@@ -300,6 +476,26 @@
         0,		/* tp_is_gc */
 };
 
+static int
+Suite_validate(PyObject *_obj)
+{
+        struct _Suite *obj = (struct _Suite*)_obj;
+        int i;
+        if (!PyList_Check(obj->body)) {
+           failed_check("body", "list", obj->body);
+           return -1;
+        }
+        for(i = 0; i < PyList_Size(obj->body); i++) {
+                if (!stmt_Check(PyList_GET_ITEM(obj->body, i))) {
+                    failed_check("body", "stmt", PyList_GET_ITEM(obj->body, i));
+                    return -1;
+                }
+                if (stmt_validate(PyList_GET_ITEM(obj->body, i)) < 0)
+                    return -1;
+        }
+        return 0;
+}
+
 #define stmt_dealloc 0
 PyTypeObject Py_stmt_Type = {
         PyObject_HEAD_INIT(NULL)
@@ -345,6 +541,60 @@
         0,		/* tp_is_gc */
 };
 
+int
+stmt_validate(PyObject* _obj)
+{
+        struct _stmt *obj = (struct _stmt*)_obj;
+        assert(stmt_Check(_obj));
+        switch(obj->_kind) {
+                case FunctionDef_kind:
+                    return FunctionDef_validate(_obj);
+                case ClassDef_kind:
+                    return ClassDef_validate(_obj);
+                case Return_kind:
+                    return Return_validate(_obj);
+                case Delete_kind:
+                    return Delete_validate(_obj);
+                case Assign_kind:
+                    return Assign_validate(_obj);
+                case AugAssign_kind:
+                    return AugAssign_validate(_obj);
+                case Print_kind:
+                    return Print_validate(_obj);
+                case For_kind:
+                    return For_validate(_obj);
+                case While_kind:
+                    return While_validate(_obj);
+                case If_kind:
+                    return If_validate(_obj);
+                case Raise_kind:
+                    return Raise_validate(_obj);
+                case TryExcept_kind:
+                    return TryExcept_validate(_obj);
+                case TryFinally_kind:
+                    return TryFinally_validate(_obj);
+                case Assert_kind:
+                    return Assert_validate(_obj);
+                case Import_kind:
+                    return Import_validate(_obj);
+                case ImportFrom_kind:
+                    return ImportFrom_validate(_obj);
+                case Exec_kind:
+                    return Exec_validate(_obj);
+                case Global_kind:
+                    return Global_validate(_obj);
+                case Expr_kind:
+                    return Expr_validate(_obj);
+                case Pass_kind:
+                    return Pass_validate(_obj);
+                case Break_kind:
+                    return Break_validate(_obj);
+                case Continue_kind:
+                    return Continue_validate(_obj);
+        }
+        PyErr_SetString(PyExc_TypeError, "invalid _kind in stmt");
+        return -1;
+}
 PyObject*
 Py_FunctionDef_New(PyObject* name, PyObject* args, PyObject* body, PyObject*
                    decorators, int lineno)
@@ -419,6 +669,47 @@
         0,		/* tp_is_gc */
 };
 
+static int
+FunctionDef_validate(PyObject *_obj)
+{
+        struct _FunctionDef *obj = (struct _FunctionDef*)_obj;
+        int i;
+        if (!PyString_Check(obj->name)) {
+            failed_check("name", "identifier", obj->name);
+            return -1;
+        }
+        if (!arguments_Check(obj->args)) {
+            failed_check("args", "arguments", obj->args);
+            return -1;
+        }
+        if (!PyList_Check(obj->body)) {
+           failed_check("body", "list", obj->body);
+           return -1;
+        }
+        for(i = 0; i < PyList_Size(obj->body); i++) {
+                if (!stmt_Check(PyList_GET_ITEM(obj->body, i))) {
+                    failed_check("body", "stmt", PyList_GET_ITEM(obj->body, i));
+                    return -1;
+                }
+                if (stmt_validate(PyList_GET_ITEM(obj->body, i)) < 0)
+                    return -1;
+        }
+        if (!PyList_Check(obj->decorators)) {
+           failed_check("decorators", "list", obj->decorators);
+           return -1;
+        }
+        for(i = 0; i < PyList_Size(obj->decorators); i++) {
+                if (!expr_Check(PyList_GET_ITEM(obj->decorators, i))) {
+                    failed_check("decorators", "expr",
+                                 PyList_GET_ITEM(obj->decorators, i));
+                    return -1;
+                }
+                if (expr_validate(PyList_GET_ITEM(obj->decorators, i)) < 0)
+                    return -1;
+        }
+        return 0;
+}
+
 PyObject*
 Py_ClassDef_New(PyObject* name, PyObject* bases, PyObject* body, int lineno)
 {
@@ -489,6 +780,43 @@
         0,		/* tp_is_gc */
 };
 
+static int
+ClassDef_validate(PyObject *_obj)
+{
+        struct _ClassDef *obj = (struct _ClassDef*)_obj;
+        int i;
+        if (!PyString_Check(obj->name)) {
+            failed_check("name", "identifier", obj->name);
+            return -1;
+        }
+        if (!PyList_Check(obj->bases)) {
+           failed_check("bases", "list", obj->bases);
+           return -1;
+        }
+        for(i = 0; i < PyList_Size(obj->bases); i++) {
+                if (!expr_Check(PyList_GET_ITEM(obj->bases, i))) {
+                    failed_check("bases", "expr", PyList_GET_ITEM(obj->bases,
+                                 i));
+                    return -1;
+                }
+                if (expr_validate(PyList_GET_ITEM(obj->bases, i)) < 0)
+                    return -1;
+        }
+        if (!PyList_Check(obj->body)) {
+           failed_check("body", "list", obj->body);
+           return -1;
+        }
+        for(i = 0; i < PyList_Size(obj->body); i++) {
+                if (!stmt_Check(PyList_GET_ITEM(obj->body, i))) {
+                    failed_check("body", "stmt", PyList_GET_ITEM(obj->body, i));
+                    return -1;
+                }
+                if (stmt_validate(PyList_GET_ITEM(obj->body, i)) < 0)
+                    return -1;
+        }
+        return 0;
+}
+
 PyObject*
 Py_Return_New(PyObject* value, int lineno)
 {
@@ -553,6 +881,20 @@
         0,		/* tp_is_gc */
 };
 
+static int
+Return_validate(PyObject *_obj)
+{
+        struct _Return *obj = (struct _Return*)_obj;
+        if (obj->value != Py_None) /* empty */;
+        else if (!expr_Check(obj->value)) {
+            failed_check("value", "expr", obj->value);
+            return -1;
+        }
+        else if (expr_validate(obj->value) < 0)
+            return -1;
+        return 0;
+}
+
 PyObject*
 Py_Delete_New(PyObject* targets, int lineno)
 {
@@ -617,6 +959,27 @@
         0,		/* tp_is_gc */
 };
 
+static int
+Delete_validate(PyObject *_obj)
+{
+        struct _Delete *obj = (struct _Delete*)_obj;
+        int i;
+        if (!PyList_Check(obj->targets)) {
+           failed_check("targets", "list", obj->targets);
+           return -1;
+        }
+        for(i = 0; i < PyList_Size(obj->targets); i++) {
+                if (!expr_Check(PyList_GET_ITEM(obj->targets, i))) {
+                    failed_check("targets", "expr",
+                                 PyList_GET_ITEM(obj->targets, i));
+                    return -1;
+                }
+                if (expr_validate(PyList_GET_ITEM(obj->targets, i)) < 0)
+                    return -1;
+        }
+        return 0;
+}
+
 PyObject*
 Py_Assign_New(PyObject* targets, PyObject* value, int lineno)
 {
@@ -684,6 +1047,31 @@
         0,		/* tp_is_gc */
 };
 
+static int
+Assign_validate(PyObject *_obj)
+{
+        struct _Assign *obj = (struct _Assign*)_obj;
+        int i;
+        if (!PyList_Check(obj->targets)) {
+           failed_check("targets", "list", obj->targets);
+           return -1;
+        }
+        for(i = 0; i < PyList_Size(obj->targets); i++) {
+                if (!expr_Check(PyList_GET_ITEM(obj->targets, i))) {
+                    failed_check("targets", "expr",
+                                 PyList_GET_ITEM(obj->targets, i));
+                    return -1;
+                }
+                if (expr_validate(PyList_GET_ITEM(obj->targets, i)) < 0)
+                    return -1;
+        }
+        if (!expr_Check(obj->value)) {
+            failed_check("value", "expr", obj->value);
+            return -1;
+        }
+        return 0;
+}
+
 PyObject*
 Py_AugAssign_New(PyObject* target, PyObject* op, PyObject* value, int lineno)
 {
@@ -754,6 +1142,25 @@
         0,		/* tp_is_gc */
 };
 
+static int
+AugAssign_validate(PyObject *_obj)
+{
+        struct _AugAssign *obj = (struct _AugAssign*)_obj;
+        if (!expr_Check(obj->target)) {
+            failed_check("target", "expr", obj->target);
+            return -1;
+        }
+        if (!operator_Check(obj->op)) {
+            failed_check("op", "operator", obj->op);
+            return -1;
+        }
+        if (!expr_Check(obj->value)) {
+            failed_check("value", "expr", obj->value);
+            return -1;
+        }
+        return 0;
+}
+
 PyObject*
 Py_Print_New(PyObject* dest, PyObject* values, PyObject* nl, int lineno)
 {
@@ -824,6 +1231,38 @@
         0,		/* tp_is_gc */
 };
 
+static int
+Print_validate(PyObject *_obj)
+{
+        struct _Print *obj = (struct _Print*)_obj;
+        int i;
+        if (obj->dest != Py_None) /* empty */;
+        else if (!expr_Check(obj->dest)) {
+            failed_check("dest", "expr", obj->dest);
+            return -1;
+        }
+        else if (expr_validate(obj->dest) < 0)
+            return -1;
+        if (!PyList_Check(obj->values)) {
+           failed_check("values", "list", obj->values);
+           return -1;
+        }
+        for(i = 0; i < PyList_Size(obj->values); i++) {
+                if (!expr_Check(PyList_GET_ITEM(obj->values, i))) {
+                    failed_check("values", "expr", PyList_GET_ITEM(obj->values,
+                                 i));
+                    return -1;
+                }
+                if (expr_validate(PyList_GET_ITEM(obj->values, i)) < 0)
+                    return -1;
+        }
+        if (!PyBool_Check(obj->nl)) {
+            failed_check("nl", "bool", obj->nl);
+            return -1;
+        }
+        return 0;
+}
+
 PyObject*
 Py_For_New(PyObject* target, PyObject* iter, PyObject* body, PyObject* orelse,
            int lineno)
@@ -898,6 +1337,47 @@
         0,		/* tp_is_gc */
 };
 
+static int
+For_validate(PyObject *_obj)
+{
+        struct _For *obj = (struct _For*)_obj;
+        int i;
+        if (!expr_Check(obj->target)) {
+            failed_check("target", "expr", obj->target);
+            return -1;
+        }
+        if (!expr_Check(obj->iter)) {
+            failed_check("iter", "expr", obj->iter);
+            return -1;
+        }
+        if (!PyList_Check(obj->body)) {
+           failed_check("body", "list", obj->body);
+           return -1;
+        }
+        for(i = 0; i < PyList_Size(obj->body); i++) {
+                if (!stmt_Check(PyList_GET_ITEM(obj->body, i))) {
+                    failed_check("body", "stmt", PyList_GET_ITEM(obj->body, i));
+                    return -1;
+                }
+                if (stmt_validate(PyList_GET_ITEM(obj->body, i)) < 0)
+                    return -1;
+        }
+        if (!PyList_Check(obj->orelse)) {
+           failed_check("orelse", "list", obj->orelse);
+           return -1;
+        }
+        for(i = 0; i < PyList_Size(obj->orelse); i++) {
+                if (!stmt_Check(PyList_GET_ITEM(obj->orelse, i))) {
+                    failed_check("orelse", "stmt", PyList_GET_ITEM(obj->orelse,
+                                 i));
+                    return -1;
+                }
+                if (stmt_validate(PyList_GET_ITEM(obj->orelse, i)) < 0)
+                    return -1;
+        }
+        return 0;
+}
+
 PyObject*
 Py_While_New(PyObject* test, PyObject* body, PyObject* orelse, int lineno)
 {
@@ -968,6 +1448,43 @@
         0,		/* tp_is_gc */
 };
 
+static int
+While_validate(PyObject *_obj)
+{
+        struct _While *obj = (struct _While*)_obj;
+        int i;
+        if (!expr_Check(obj->test)) {
+            failed_check("test", "expr", obj->test);
+            return -1;
+        }
+        if (!PyList_Check(obj->body)) {
+           failed_check("body", "list", obj->body);
+           return -1;
+        }
+        for(i = 0; i < PyList_Size(obj->body); i++) {
+                if (!stmt_Check(PyList_GET_ITEM(obj->body, i))) {
+                    failed_check("body", "stmt", PyList_GET_ITEM(obj->body, i));
+                    return -1;
+                }
+                if (stmt_validate(PyList_GET_ITEM(obj->body, i)) < 0)
+                    return -1;
+        }
+        if (!PyList_Check(obj->orelse)) {
+           failed_check("orelse", "list", obj->orelse);
+           return -1;
+        }
+        for(i = 0; i < PyList_Size(obj->orelse); i++) {
+                if (!stmt_Check(PyList_GET_ITEM(obj->orelse, i))) {
+                    failed_check("orelse", "stmt", PyList_GET_ITEM(obj->orelse,
+                                 i));
+                    return -1;
+                }
+                if (stmt_validate(PyList_GET_ITEM(obj->orelse, i)) < 0)
+                    return -1;
+        }
+        return 0;
+}
+
 PyObject*
 Py_If_New(PyObject* test, PyObject* body, PyObject* orelse, int lineno)
 {
@@ -1038,6 +1555,43 @@
         0,		/* tp_is_gc */
 };
 
+static int
+If_validate(PyObject *_obj)
+{
+        struct _If *obj = (struct _If*)_obj;
+        int i;
+        if (!expr_Check(obj->test)) {
+            failed_check("test", "expr", obj->test);
+            return -1;
+        }
+        if (!PyList_Check(obj->body)) {
+           failed_check("body", "list", obj->body);
+           return -1;
+        }
+        for(i = 0; i < PyList_Size(obj->body); i++) {
+                if (!stmt_Check(PyList_GET_ITEM(obj->body, i))) {
+                    failed_check("body", "stmt", PyList_GET_ITEM(obj->body, i));
+                    return -1;
+                }
+                if (stmt_validate(PyList_GET_ITEM(obj->body, i)) < 0)
+                    return -1;
+        }
+        if (!PyList_Check(obj->orelse)) {
+           failed_check("orelse", "list", obj->orelse);
+           return -1;
+        }
+        for(i = 0; i < PyList_Size(obj->orelse); i++) {
+                if (!stmt_Check(PyList_GET_ITEM(obj->orelse, i))) {
+                    failed_check("orelse", "stmt", PyList_GET_ITEM(obj->orelse,
+                                 i));
+                    return -1;
+                }
+                if (stmt_validate(PyList_GET_ITEM(obj->orelse, i)) < 0)
+                    return -1;
+        }
+        return 0;
+}
+
 PyObject*
 Py_Raise_New(PyObject* type, PyObject* inst, PyObject* tback, int lineno)
 {
@@ -1108,6 +1662,34 @@
         0,		/* tp_is_gc */
 };
 
+static int
+Raise_validate(PyObject *_obj)
+{
+        struct _Raise *obj = (struct _Raise*)_obj;
+        if (obj->type != Py_None) /* empty */;
+        else if (!expr_Check(obj->type)) {
+            failed_check("type", "expr", obj->type);
+            return -1;
+        }
+        else if (expr_validate(obj->type) < 0)
+            return -1;
+        if (obj->inst != Py_None) /* empty */;
+        else if (!expr_Check(obj->inst)) {
+            failed_check("inst", "expr", obj->inst);
+            return -1;
+        }
+        else if (expr_validate(obj->inst) < 0)
+            return -1;
+        if (obj->tback != Py_None) /* empty */;
+        else if (!expr_Check(obj->tback)) {
+            failed_check("tback", "expr", obj->tback);
+            return -1;
+        }
+        else if (expr_validate(obj->tback) < 0)
+            return -1;
+        return 0;
+}
+
 PyObject*
 Py_TryExcept_New(PyObject* body, PyObject* handlers, PyObject* orelse, int
                  lineno)
@@ -1179,6 +1761,53 @@
         0,		/* tp_is_gc */
 };
 
+static int
+TryExcept_validate(PyObject *_obj)
+{
+        struct _TryExcept *obj = (struct _TryExcept*)_obj;
+        int i;
+        if (!PyList_Check(obj->body)) {
+           failed_check("body", "list", obj->body);
+           return -1;
+        }
+        for(i = 0; i < PyList_Size(obj->body); i++) {
+                if (!stmt_Check(PyList_GET_ITEM(obj->body, i))) {
+                    failed_check("body", "stmt", PyList_GET_ITEM(obj->body, i));
+                    return -1;
+                }
+                if (stmt_validate(PyList_GET_ITEM(obj->body, i)) < 0)
+                    return -1;
+        }
+        if (!PyList_Check(obj->handlers)) {
+           failed_check("handlers", "list", obj->handlers);
+           return -1;
+        }
+        for(i = 0; i < PyList_Size(obj->handlers); i++) {
+                if (!excepthandler_Check(PyList_GET_ITEM(obj->handlers, i))) {
+                    failed_check("handlers", "excepthandler",
+                                 PyList_GET_ITEM(obj->handlers, i));
+                    return -1;
+                }
+                if (excepthandler_validate(PyList_GET_ITEM(obj->handlers, i)) <
+                    0)
+                    return -1;
+        }
+        if (!PyList_Check(obj->orelse)) {
+           failed_check("orelse", "list", obj->orelse);
+           return -1;
+        }
+        for(i = 0; i < PyList_Size(obj->orelse); i++) {
+                if (!stmt_Check(PyList_GET_ITEM(obj->orelse, i))) {
+                    failed_check("orelse", "stmt", PyList_GET_ITEM(obj->orelse,
+                                 i));
+                    return -1;
+                }
+                if (stmt_validate(PyList_GET_ITEM(obj->orelse, i)) < 0)
+                    return -1;
+        }
+        return 0;
+}
+
 PyObject*
 Py_TryFinally_New(PyObject* body, PyObject* finalbody, int lineno)
 {
@@ -1246,6 +1875,39 @@
         0,		/* tp_is_gc */
 };
 
+static int
+TryFinally_validate(PyObject *_obj)
+{
+        struct _TryFinally *obj = (struct _TryFinally*)_obj;
+        int i;
+        if (!PyList_Check(obj->body)) {
+           failed_check("body", "list", obj->body);
+           return -1;
+        }
+        for(i = 0; i < PyList_Size(obj->body); i++) {
+                if (!stmt_Check(PyList_GET_ITEM(obj->body, i))) {
+                    failed_check("body", "stmt", PyList_GET_ITEM(obj->body, i));
+                    return -1;
+                }
+                if (stmt_validate(PyList_GET_ITEM(obj->body, i)) < 0)
+                    return -1;
+        }
+        if (!PyList_Check(obj->finalbody)) {
+           failed_check("finalbody", "list", obj->finalbody);
+           return -1;
+        }
+        for(i = 0; i < PyList_Size(obj->finalbody); i++) {
+                if (!stmt_Check(PyList_GET_ITEM(obj->finalbody, i))) {
+                    failed_check("finalbody", "stmt",
+                                 PyList_GET_ITEM(obj->finalbody, i));
+                    return -1;
+                }
+                if (stmt_validate(PyList_GET_ITEM(obj->finalbody, i)) < 0)
+                    return -1;
+        }
+        return 0;
+}
+
 PyObject*
 Py_Assert_New(PyObject* test, PyObject* msg, int lineno)
 {
@@ -1313,6 +1975,24 @@
         0,		/* tp_is_gc */
 };
 
+static int
+Assert_validate(PyObject *_obj)
+{
+        struct _Assert *obj = (struct _Assert*)_obj;
+        if (!expr_Check(obj->test)) {
+            failed_check("test", "expr", obj->test);
+            return -1;
+        }
+        if (obj->msg != Py_None) /* empty */;
+        else if (!expr_Check(obj->msg)) {
+            failed_check("msg", "expr", obj->msg);
+            return -1;
+        }
+        else if (expr_validate(obj->msg) < 0)
+            return -1;
+        return 0;
+}
+
 PyObject*
 Py_Import_New(PyObject* names, int lineno)
 {
@@ -1377,6 +2057,27 @@
         0,		/* tp_is_gc */
 };
 
+static int
+Import_validate(PyObject *_obj)
+{
+        struct _Import *obj = (struct _Import*)_obj;
+        int i;
+        if (!PyList_Check(obj->names)) {
+           failed_check("names", "list", obj->names);
+           return -1;
+        }
+        for(i = 0; i < PyList_Size(obj->names); i++) {
+                if (!alias_Check(PyList_GET_ITEM(obj->names, i))) {
+                    failed_check("names", "alias", PyList_GET_ITEM(obj->names,
+                                 i));
+                    return -1;
+                }
+                if (alias_validate(PyList_GET_ITEM(obj->names, i)) < 0)
+                    return -1;
+        }
+        return 0;
+}
+
 PyObject*
 Py_ImportFrom_New(PyObject* module, PyObject* names, int lineno)
 {
@@ -1444,6 +2145,31 @@
         0,		/* tp_is_gc */
 };
 
+static int
+ImportFrom_validate(PyObject *_obj)
+{
+        struct _ImportFrom *obj = (struct _ImportFrom*)_obj;
+        int i;
+        if (!PyString_Check(obj->module)) {
+            failed_check("module", "identifier", obj->module);
+            return -1;
+        }
+        if (!PyList_Check(obj->names)) {
+           failed_check("names", "list", obj->names);
+           return -1;
+        }
+        for(i = 0; i < PyList_Size(obj->names); i++) {
+                if (!alias_Check(PyList_GET_ITEM(obj->names, i))) {
+                    failed_check("names", "alias", PyList_GET_ITEM(obj->names,
+                                 i));
+                    return -1;
+                }
+                if (alias_validate(PyList_GET_ITEM(obj->names, i)) < 0)
+                    return -1;
+        }
+        return 0;
+}
+
 PyObject*
 Py_Exec_New(PyObject* body, PyObject* globals, PyObject* locals, int lineno)
 {
@@ -1514,6 +2240,31 @@
         0,		/* tp_is_gc */
 };
 
+static int
+Exec_validate(PyObject *_obj)
+{
+        struct _Exec *obj = (struct _Exec*)_obj;
+        if (!expr_Check(obj->body)) {
+            failed_check("body", "expr", obj->body);
+            return -1;
+        }
+        if (obj->globals != Py_None) /* empty */;
+        else if (!expr_Check(obj->globals)) {
+            failed_check("globals", "expr", obj->globals);
+            return -1;
+        }
+        else if (expr_validate(obj->globals) < 0)
+            return -1;
+        if (obj->locals != Py_None) /* empty */;
+        else if (!expr_Check(obj->locals)) {
+            failed_check("locals", "expr", obj->locals);
+            return -1;
+        }
+        else if (expr_validate(obj->locals) < 0)
+            return -1;
+        return 0;
+}
+
 PyObject*
 Py_Global_New(PyObject* names, int lineno)
 {
@@ -1578,6 +2329,25 @@
         0,		/* tp_is_gc */
 };
 
+static int
+Global_validate(PyObject *_obj)
+{
+        struct _Global *obj = (struct _Global*)_obj;
+        int i;
+        if (!PyList_Check(obj->names)) {
+           failed_check("names", "list", obj->names);
+           return -1;
+        }
+        for(i = 0; i < PyList_Size(obj->names); i++) {
+                if (!PyString_Check(PyList_GET_ITEM(obj->names, i))) {
+                    failed_check("names", "identifier",
+                                 PyList_GET_ITEM(obj->names, i));
+                    return -1;
+                }
+        }
+        return 0;
+}
+
 PyObject*
 Py_Expr_New(PyObject* value, int lineno)
 {
@@ -1642,6 +2412,17 @@
         0,		/* tp_is_gc */
 };
 
+static int
+Expr_validate(PyObject *_obj)
+{
+        struct _Expr *obj = (struct _Expr*)_obj;
+        if (!expr_Check(obj->value)) {
+            failed_check("value", "expr", obj->value);
+            return -1;
+        }
+        return 0;
+}
+
 PyObject*
 Py_Pass_New(int lineno)
 {
@@ -1703,6 +2484,12 @@
         0,		/* tp_is_gc */
 };
 
+static int
+Pass_validate(PyObject *_obj)
+{
+        return 0;
+}
+
 PyObject*
 Py_Break_New(int lineno)
 {
@@ -1764,6 +2551,12 @@
         0,		/* tp_is_gc */
 };
 
+static int
+Break_validate(PyObject *_obj)
+{
+        return 0;
+}
+
 PyObject*
 Py_Continue_New(int lineno)
 {
@@ -1825,6 +2618,12 @@
         0,		/* tp_is_gc */
 };
 
+static int
+Continue_validate(PyObject *_obj)
+{
+        return 0;
+}
+
 #define expr_dealloc 0
 PyTypeObject Py_expr_Type = {
         PyObject_HEAD_INIT(NULL)
@@ -1870,6 +2669,52 @@
         0,		/* tp_is_gc */
 };
 
+int
+expr_validate(PyObject* _obj)
+{
+        struct _expr *obj = (struct _expr*)_obj;
+        assert(expr_Check(_obj));
+        switch(obj->_kind) {
+                case BoolOp_kind:
+                    return BoolOp_validate(_obj);
+                case BinOp_kind:
+                    return BinOp_validate(_obj);
+                case UnaryOp_kind:
+                    return UnaryOp_validate(_obj);
+                case Lambda_kind:
+                    return Lambda_validate(_obj);
+                case Dict_kind:
+                    return Dict_validate(_obj);
+                case ListComp_kind:
+                    return ListComp_validate(_obj);
+                case GeneratorExp_kind:
+                    return GeneratorExp_validate(_obj);
+                case Yield_kind:
+                    return Yield_validate(_obj);
+                case Compare_kind:
+                    return Compare_validate(_obj);
+                case Call_kind:
+                    return Call_validate(_obj);
+                case Repr_kind:
+                    return Repr_validate(_obj);
+                case Num_kind:
+                    return Num_validate(_obj);
+                case Str_kind:
+                    return Str_validate(_obj);
+                case Attribute_kind:
+                    return Attribute_validate(_obj);
+                case Subscript_kind:
+                    return Subscript_validate(_obj);
+                case Name_kind:
+                    return Name_validate(_obj);
+                case List_kind:
+                    return List_validate(_obj);
+                case Tuple_kind:
+                    return Tuple_validate(_obj);
+        }
+        PyErr_SetString(PyExc_TypeError, "invalid _kind in expr");
+        return -1;
+}
 PyObject*
 Py_BoolOp_New(PyObject* op, PyObject* values, int lineno)
 {
@@ -1937,6 +2782,31 @@
         0,		/* tp_is_gc */
 };
 
+static int
+BoolOp_validate(PyObject *_obj)
+{
+        struct _BoolOp *obj = (struct _BoolOp*)_obj;
+        int i;
+        if (!boolop_Check(obj->op)) {
+            failed_check("op", "boolop", obj->op);
+            return -1;
+        }
+        if (!PyList_Check(obj->values)) {
+           failed_check("values", "list", obj->values);
+           return -1;
+        }
+        for(i = 0; i < PyList_Size(obj->values); i++) {
+                if (!expr_Check(PyList_GET_ITEM(obj->values, i))) {
+                    failed_check("values", "expr", PyList_GET_ITEM(obj->values,
+                                 i));
+                    return -1;
+                }
+                if (expr_validate(PyList_GET_ITEM(obj->values, i)) < 0)
+                    return -1;
+        }
+        return 0;
+}
+
 PyObject*
 Py_BinOp_New(PyObject* left, PyObject* op, PyObject* right, int lineno)
 {
@@ -2007,6 +2877,25 @@
         0,		/* tp_is_gc */
 };
 
+static int
+BinOp_validate(PyObject *_obj)
+{
+        struct _BinOp *obj = (struct _BinOp*)_obj;
+        if (!expr_Check(obj->left)) {
+            failed_check("left", "expr", obj->left);
+            return -1;
+        }
+        if (!operator_Check(obj->op)) {
+            failed_check("op", "operator", obj->op);
+            return -1;
+        }
+        if (!expr_Check(obj->right)) {
+            failed_check("right", "expr", obj->right);
+            return -1;
+        }
+        return 0;
+}
+
 PyObject*
 Py_UnaryOp_New(PyObject* op, PyObject* operand, int lineno)
 {
@@ -2074,6 +2963,21 @@
         0,		/* tp_is_gc */
 };
 
+static int
+UnaryOp_validate(PyObject *_obj)
+{
+        struct _UnaryOp *obj = (struct _UnaryOp*)_obj;
+        if (!unaryop_Check(obj->op)) {
+            failed_check("op", "unaryop", obj->op);
+            return -1;
+        }
+        if (!expr_Check(obj->operand)) {
+            failed_check("operand", "expr", obj->operand);
+            return -1;
+        }
+        return 0;
+}
+
 PyObject*
 Py_Lambda_New(PyObject* args, PyObject* body, int lineno)
 {
@@ -2141,6 +3045,21 @@
         0,		/* tp_is_gc */
 };
 
+static int
+Lambda_validate(PyObject *_obj)
+{
+        struct _Lambda *obj = (struct _Lambda*)_obj;
+        if (!arguments_Check(obj->args)) {
+            failed_check("args", "arguments", obj->args);
+            return -1;
+        }
+        if (!expr_Check(obj->body)) {
+            failed_check("body", "expr", obj->body);
+            return -1;
+        }
+        return 0;
+}
+
 PyObject*
 Py_Dict_New(PyObject* keys, PyObject* values, int lineno)
 {
@@ -2208,6 +3127,39 @@
         0,		/* tp_is_gc */
 };
 
+static int
+Dict_validate(PyObject *_obj)
+{
+        struct _Dict *obj = (struct _Dict*)_obj;
+        int i;
+        if (!PyList_Check(obj->keys)) {
+           failed_check("keys", "list", obj->keys);
+           return -1;
+        }
+        for(i = 0; i < PyList_Size(obj->keys); i++) {
+                if (!expr_Check(PyList_GET_ITEM(obj->keys, i))) {
+                    failed_check("keys", "expr", PyList_GET_ITEM(obj->keys, i));
+                    return -1;
+                }
+                if (expr_validate(PyList_GET_ITEM(obj->keys, i)) < 0)
+                    return -1;
+        }
+        if (!PyList_Check(obj->values)) {
+           failed_check("values", "list", obj->values);
+           return -1;
+        }
+        for(i = 0; i < PyList_Size(obj->values); i++) {
+                if (!expr_Check(PyList_GET_ITEM(obj->values, i))) {
+                    failed_check("values", "expr", PyList_GET_ITEM(obj->values,
+                                 i));
+                    return -1;
+                }
+                if (expr_validate(PyList_GET_ITEM(obj->values, i)) < 0)
+                    return -1;
+        }
+        return 0;
+}
+
 PyObject*
 Py_ListComp_New(PyObject* elt, PyObject* generators, int lineno)
 {
@@ -2275,6 +3227,32 @@
         0,		/* tp_is_gc */
 };
 
+static int
+ListComp_validate(PyObject *_obj)
+{
+        struct _ListComp *obj = (struct _ListComp*)_obj;
+        int i;
+        if (!expr_Check(obj->elt)) {
+            failed_check("elt", "expr", obj->elt);
+            return -1;
+        }
+        if (!PyList_Check(obj->generators)) {
+           failed_check("generators", "list", obj->generators);
+           return -1;
+        }
+        for(i = 0; i < PyList_Size(obj->generators); i++) {
+                if (!comprehension_Check(PyList_GET_ITEM(obj->generators, i))) {
+                    failed_check("generators", "comprehension",
+                                 PyList_GET_ITEM(obj->generators, i));
+                    return -1;
+                }
+                if (comprehension_validate(PyList_GET_ITEM(obj->generators, i))
+                    < 0)
+                    return -1;
+        }
+        return 0;
+}
+
 PyObject*
 Py_GeneratorExp_New(PyObject* elt, PyObject* generators, int lineno)
 {
@@ -2342,6 +3320,32 @@
         0,		/* tp_is_gc */
 };
 
+static int
+GeneratorExp_validate(PyObject *_obj)
+{
+        struct _GeneratorExp *obj = (struct _GeneratorExp*)_obj;
+        int i;
+        if (!expr_Check(obj->elt)) {
+            failed_check("elt", "expr", obj->elt);
+            return -1;
+        }
+        if (!PyList_Check(obj->generators)) {
+           failed_check("generators", "list", obj->generators);
+           return -1;
+        }
+        for(i = 0; i < PyList_Size(obj->generators); i++) {
+                if (!comprehension_Check(PyList_GET_ITEM(obj->generators, i))) {
+                    failed_check("generators", "comprehension",
+                                 PyList_GET_ITEM(obj->generators, i));
+                    return -1;
+                }
+                if (comprehension_validate(PyList_GET_ITEM(obj->generators, i))
+                    < 0)
+                    return -1;
+        }
+        return 0;
+}
+
 PyObject*
 Py_Yield_New(PyObject* value, int lineno)
 {
@@ -2406,6 +3410,20 @@
         0,		/* tp_is_gc */
 };
 
+static int
+Yield_validate(PyObject *_obj)
+{
+        struct _Yield *obj = (struct _Yield*)_obj;
+        if (obj->value != Py_None) /* empty */;
+        else if (!expr_Check(obj->value)) {
+            failed_check("value", "expr", obj->value);
+            return -1;
+        }
+        else if (expr_validate(obj->value) < 0)
+            return -1;
+        return 0;
+}
+
 PyObject*
 Py_Compare_New(PyObject* left, PyObject* ops, PyObject* comparators, int lineno)
 {
@@ -2476,6 +3494,43 @@
         0,		/* tp_is_gc */
 };
 
+static int
+Compare_validate(PyObject *_obj)
+{
+        struct _Compare *obj = (struct _Compare*)_obj;
+        int i;
+        if (!expr_Check(obj->left)) {
+            failed_check("left", "expr", obj->left);
+            return -1;
+        }
+        if (!PyList_Check(obj->ops)) {
+           failed_check("ops", "list", obj->ops);
+           return -1;
+        }
+        for(i = 0; i < PyList_Size(obj->ops); i++) {
+                if (!cmpop_Check(PyList_GET_ITEM(obj->ops, i))) {
+                    failed_check("ops", "cmpop", PyList_GET_ITEM(obj->ops, i));
+                    return -1;
+                }
+                if (cmpop_validate(PyList_GET_ITEM(obj->ops, i)) < 0)
+                    return -1;
+        }
+        if (!PyList_Check(obj->comparators)) {
+           failed_check("comparators", "list", obj->comparators);
+           return -1;
+        }
+        for(i = 0; i < PyList_Size(obj->comparators); i++) {
+                if (!expr_Check(PyList_GET_ITEM(obj->comparators, i))) {
+                    failed_check("comparators", "expr",
+                                 PyList_GET_ITEM(obj->comparators, i));
+                    return -1;
+                }
+                if (expr_validate(PyList_GET_ITEM(obj->comparators, i)) < 0)
+                    return -1;
+        }
+        return 0;
+}
+
 PyObject*
 Py_Call_New(PyObject* func, PyObject* args, PyObject* keywords, PyObject*
             starargs, PyObject* kwargs, int lineno)
@@ -2553,6 +3608,57 @@
         0,		/* tp_is_gc */
 };
 
+static int
+Call_validate(PyObject *_obj)
+{
+        struct _Call *obj = (struct _Call*)_obj;
+        int i;
+        if (!expr_Check(obj->func)) {
+            failed_check("func", "expr", obj->func);
+            return -1;
+        }
+        if (!PyList_Check(obj->args)) {
+           failed_check("args", "list", obj->args);
+           return -1;
+        }
+        for(i = 0; i < PyList_Size(obj->args); i++) {
+                if (!expr_Check(PyList_GET_ITEM(obj->args, i))) {
+                    failed_check("args", "expr", PyList_GET_ITEM(obj->args, i));
+                    return -1;
+                }
+                if (expr_validate(PyList_GET_ITEM(obj->args, i)) < 0)
+                    return -1;
+        }
+        if (!PyList_Check(obj->keywords)) {
+           failed_check("keywords", "list", obj->keywords);
+           return -1;
+        }
+        for(i = 0; i < PyList_Size(obj->keywords); i++) {
+                if (!keyword_Check(PyList_GET_ITEM(obj->keywords, i))) {
+                    failed_check("keywords", "keyword",
+                                 PyList_GET_ITEM(obj->keywords, i));
+                    return -1;
+                }
+                if (keyword_validate(PyList_GET_ITEM(obj->keywords, i)) < 0)
+                    return -1;
+        }
+        if (obj->starargs != Py_None) /* empty */;
+        else if (!expr_Check(obj->starargs)) {
+            failed_check("starargs", "expr", obj->starargs);
+            return -1;
+        }
+        else if (expr_validate(obj->starargs) < 0)
+            return -1;
+        if (obj->kwargs != Py_None) /* empty */;
+        else if (!expr_Check(obj->kwargs)) {
+            failed_check("kwargs", "expr", obj->kwargs);
+            return -1;
+        }
+        else if (expr_validate(obj->kwargs) < 0)
+            return -1;
+        return 0;
+}
+
 PyObject*
 Py_Repr_New(PyObject* value, int lineno)
 {
@@ -2617,6 +3723,17 @@
         0,		/* tp_is_gc */
 };
 
+static int
+Repr_validate(PyObject *_obj)
+{
+        struct _Repr *obj = (struct _Repr*)_obj;
+        if (!expr_Check(obj->value)) {
+            failed_check("value", "expr", obj->value);
+            return -1;
+        }
+        return 0;
+}
+
 PyObject*
 Py_Num_New(PyObject* n, int lineno)
 {
@@ -2681,6 +3798,17 @@
         0,		/* tp_is_gc */
 };
 
+static int
+Num_validate(PyObject *_obj)
+{
+        struct _Num *obj = (struct _Num*)_obj;
+        if (!object_Check(obj->n)) {
+            failed_check("n", "object", obj->n);
+            return -1;
+        }
+        return 0;
+}
+
 PyObject*
 Py_Str_New(PyObject* s, int lineno)
 {
@@ -2745,6 +3873,17 @@
         0,		/* tp_is_gc */
 };
 
+static int
+Str_validate(PyObject *_obj)
+{
+        struct _Str *obj = (struct _Str*)_obj;
+        if (!PyString_Check(obj->s)) {
+            failed_check("s", "string", obj->s);
+            return -1;
+        }
+        return 0;
+}
+
 PyObject*
 Py_Attribute_New(PyObject* value, PyObject* attr, PyObject* ctx, int lineno)
 {
@@ -2815,6 +3954,25 @@
         0,		/* tp_is_gc */
 };
 
+static int
+Attribute_validate(PyObject *_obj)
+{
+        struct _Attribute *obj = (struct _Attribute*)_obj;
+        if (!expr_Check(obj->value)) {
+            failed_check("value", "expr", obj->value);
+            return -1;
+        }
+        if (!PyString_Check(obj->attr)) {
+            failed_check("attr", "identifier", obj->attr);
+            return -1;
+        }
+        if (!expr_context_Check(obj->ctx)) {
+            failed_check("ctx", "expr_context", obj->ctx);
+            return -1;
+        }
+        return 0;
+}
+
 PyObject*
 Py_Subscript_New(PyObject* value, PyObject* slice, PyObject* ctx, int lineno)
 {
@@ -2885,6 +4043,25 @@
         0,		/* tp_is_gc */
 };
 
+static int
+Subscript_validate(PyObject *_obj)
+{
+        struct _Subscript *obj = (struct _Subscript*)_obj;
+        if (!expr_Check(obj->value)) {
+            failed_check("value", "expr", obj->value);
+            return -1;
+        }
+        if (!slice_Check(obj->slice)) {
+            failed_check("slice", "slice", obj->slice);
+            return -1;
+        }
+        if (!expr_context_Check(obj->ctx)) {
+            failed_check("ctx", "expr_context", obj->ctx);
+            return -1;
+        }
+        return 0;
+}
+
 PyObject*
 Py_Name_New(PyObject* id, PyObject* ctx, int lineno)
 {
@@ -2952,6 +4129,21 @@
         0,		/* tp_is_gc */
 };
 
+static int
+Name_validate(PyObject *_obj)
+{
+        struct _Name *obj = (struct _Name*)_obj;
+        if (!PyString_Check(obj->id)) {
+            failed_check("id", "identifier", obj->id);
+            return -1;
+        }
+        if (!expr_context_Check(obj->ctx)) {
+            failed_check("ctx", "expr_context", obj->ctx);
+            return -1;
+        }
+        return 0;
+}
+
 PyObject*
 Py_List_New(PyObject* elts, PyObject* ctx, int lineno)
 {
@@ -3019,6 +4211,30 @@
         0,		/* tp_is_gc */
 };
 
+static int
+List_validate(PyObject *_obj)
+{
+        struct _List *obj = (struct _List*)_obj;
+        int i;
+        if (!PyList_Check(obj->elts)) {
+           failed_check("elts", "list", obj->elts);
+           return -1;
+        }
+        for(i = 0; i < PyList_Size(obj->elts); i++) {
+                if (!expr_Check(PyList_GET_ITEM(obj->elts, i))) {
+                    failed_check("elts", "expr", PyList_GET_ITEM(obj->elts, i));
+                    return -1;
+                }
+                if (expr_validate(PyList_GET_ITEM(obj->elts, i)) < 0)
+                    return -1;
+        }
+        if (!expr_context_Check(obj->ctx)) {
+            failed_check("ctx", "expr_context", obj->ctx);
+            return -1;
+        }
+        return 0;
+}
+
 PyObject*
 Py_Tuple_New(PyObject* elts, PyObject* ctx, int lineno)
 {
@@ -3086,14 +4302,38 @@
         0,		/* tp_is_gc */
 };
 
-#define slice_dealloc 0
-PyTypeObject Py_slice_Type = {
+static int
+Tuple_validate(PyObject *_obj)
+{
+        struct _Tuple *obj = (struct _Tuple*)_obj;
+        int i;
+        if (!PyList_Check(obj->elts)) {
+           failed_check("elts", "list", obj->elts);
+           return -1;
+        }
+        for(i = 0; i < PyList_Size(obj->elts); i++) {
+                if (!expr_Check(PyList_GET_ITEM(obj->elts, i))) {
+                    failed_check("elts", "expr", PyList_GET_ITEM(obj->elts, i));
+                    return -1;
+                }
+                if (expr_validate(PyList_GET_ITEM(obj->elts, i)) < 0)
+                    return -1;
+        }
+        if (!expr_context_Check(obj->ctx)) {
+            failed_check("ctx", "expr_context", obj->ctx);
+            return -1;
+        }
+        return 0;
+}
+
+#define expr_context_dealloc 0
+PyTypeObject Py_expr_context_Type = {
         PyObject_HEAD_INIT(NULL)
         0,		/*ob_size*/
-        "slice",		/*tp_name*/
-        sizeof(struct _slice),	/*tp_basicsize*/
+        "expr_context",		/*tp_name*/
+        sizeof(struct _expr_context),	/*tp_basicsize*/
         0,		/* tp_itemsize */
-        slice_dealloc,		/*tp_dealloc*/
+        expr_context_dealloc,		/*tp_dealloc*/
         0,		/* tp_print */
         0,		/* tp_getattr */
         0,		/* tp_setattr */
@@ -3131,29 +4371,51 @@
         0,		/* tp_is_gc */
 };
 
+int
+expr_context_validate(PyObject* _obj)
+{
+        struct _expr_context *obj = (struct _expr_context*)_obj;
+        assert(expr_context_Check(_obj));
+        switch(obj->_kind) {
+                case Load_kind:
+                    return Load_validate(_obj);
+                case Store_kind:
+                    return Store_validate(_obj);
+                case Del_kind:
+                    return Del_validate(_obj);
+                case AugLoad_kind:
+                    return AugLoad_validate(_obj);
+                case AugStore_kind:
+                    return AugStore_validate(_obj);
+                case Param_kind:
+                    return Param_validate(_obj);
+        }
+        PyErr_SetString(PyExc_TypeError, "invalid _kind in expr_context");
+        return -1;
+}
 PyObject*
-Py_Ellipsis_New()
+Py_Load_New()
 {
-        struct _Ellipsis *result = PyObject_New(struct _Ellipsis, &Py_Ellipsis_Type);
+        struct _Load *result = PyObject_New(struct _Load, &Py_Load_Type);
         if (result == NULL)
                 return NULL;
         return (PyObject*)result;
 }
 
 static void
-Ellipsis_dealloc(PyObject* _self)
+Load_dealloc(PyObject* _self)
 {
-        struct _Ellipsis *self = (struct _Ellipsis*)_self;
+        struct _Load *self = (struct _Load*)_self;
         PyObject_Del(self);
 }
 
-PyTypeObject Py_Ellipsis_Type = {
+PyTypeObject Py_Load_Type = {
         PyObject_HEAD_INIT(NULL)
         0,		/*ob_size*/
-        "Ellipsis",		/*tp_name*/
-        sizeof(struct _Ellipsis),	/*tp_basicsize*/
+        "Load",		/*tp_name*/
+        sizeof(struct _Load),	/*tp_basicsize*/
         0,		/* tp_itemsize */
-        Ellipsis_dealloc,		/*tp_dealloc*/
+        Load_dealloc,		/*tp_dealloc*/
         0,		/* tp_print */
         0,		/* tp_getattr */
         0,		/* tp_setattr */
@@ -3191,38 +4453,35 @@
         0,		/* tp_is_gc */
 };
 
+static int
+Load_validate(PyObject *_obj)
+{
+        return 0;
+}
+
 PyObject*
-Py_Slice_New(PyObject* lower, PyObject* upper, PyObject* step)
+Py_Store_New()
 {
-        struct _Slice *result = PyObject_New(struct _Slice, &Py_Slice_Type);
+        struct _Store *result = PyObject_New(struct _Store, &Py_Store_Type);
         if (result == NULL)
                 return NULL;
-        Py_INCREF(lower);
-        result->lower = lower;
-        Py_INCREF(upper);
-        result->upper = upper;
-        Py_INCREF(step);
-        result->step = step;
         return (PyObject*)result;
 }
 
 static void
-Slice_dealloc(PyObject* _self)
+Store_dealloc(PyObject* _self)
 {
-        struct _Slice *self = (struct _Slice*)_self;
-        Py_DECREF(self->lower);
-        Py_DECREF(self->upper);
-        Py_DECREF(self->step);
+        struct _Store *self = (struct _Store*)_self;
         PyObject_Del(self);
 }
 
-PyTypeObject Py_Slice_Type = {
+PyTypeObject Py_Store_Type = {
         PyObject_HEAD_INIT(NULL)
         0,		/*ob_size*/
-        "Slice",		/*tp_name*/
-        sizeof(struct _Slice),	/*tp_basicsize*/
+        "Store",		/*tp_name*/
+        sizeof(struct _Store),	/*tp_basicsize*/
         0,		/* tp_itemsize */
-        Slice_dealloc,		/*tp_dealloc*/
+        Store_dealloc,		/*tp_dealloc*/
         0,		/* tp_print */
         0,		/* tp_getattr */
         0,		/* tp_setattr */
@@ -3260,32 +4519,35 @@
         0,		/* tp_is_gc */
 };
 
+static int
+Store_validate(PyObject *_obj)
+{
+        return 0;
+}
+
 PyObject*
-Py_ExtSlice_New(PyObject* dims)
+Py_Del_New()
 {
-        struct _ExtSlice *result = PyObject_New(struct _ExtSlice, &Py_ExtSlice_Type);
+        struct _Del *result = PyObject_New(struct _Del, &Py_Del_Type);
         if (result == NULL)
                 return NULL;
-        Py_INCREF(dims);
-        result->dims = dims;
         return (PyObject*)result;
 }
 
 static void
-ExtSlice_dealloc(PyObject* _self)
+Del_dealloc(PyObject* _self)
 {
-        struct _ExtSlice *self = (struct _ExtSlice*)_self;
-        Py_DECREF(self->dims);
+        struct _Del *self = (struct _Del*)_self;
         PyObject_Del(self);
 }
 
-PyTypeObject Py_ExtSlice_Type = {
+PyTypeObject Py_Del_Type = {
         PyObject_HEAD_INIT(NULL)
         0,		/*ob_size*/
-        "ExtSlice",		/*tp_name*/
-        sizeof(struct _ExtSlice),	/*tp_basicsize*/
+        "Del",		/*tp_name*/
+        sizeof(struct _Del),	/*tp_basicsize*/
         0,		/* tp_itemsize */
-        ExtSlice_dealloc,		/*tp_dealloc*/
+        Del_dealloc,		/*tp_dealloc*/
         0,		/* tp_print */
         0,		/* tp_getattr */
         0,		/* tp_setattr */
@@ -3323,32 +4585,35 @@
         0,		/* tp_is_gc */
 };
 
+static int
+Del_validate(PyObject *_obj)
+{
+        return 0;
+}
+
 PyObject*
-Py_Index_New(PyObject* value)
+Py_AugLoad_New()
 {
-        struct _Index *result = PyObject_New(struct _Index, &Py_Index_Type);
+        struct _AugLoad *result = PyObject_New(struct _AugLoad, &Py_AugLoad_Type);
         if (result == NULL)
                 return NULL;
-        Py_INCREF(value);
-        result->value = value;
         return (PyObject*)result;
 }
 
 static void
-Index_dealloc(PyObject* _self)
+AugLoad_dealloc(PyObject* _self)
 {
-        struct _Index *self = (struct _Index*)_self;
-        Py_DECREF(self->value);
+        struct _AugLoad *self = (struct _AugLoad*)_self;
         PyObject_Del(self);
 }
 
-PyTypeObject Py_Index_Type = {
+PyTypeObject Py_AugLoad_Type = {
         PyObject_HEAD_INIT(NULL)
         0,		/*ob_size*/
-        "Index",		/*tp_name*/
-        sizeof(struct _Index),	/*tp_basicsize*/
+        "AugLoad",		/*tp_name*/
+        sizeof(struct _AugLoad),	/*tp_basicsize*/
         0,		/* tp_itemsize */
-        Index_dealloc,		/*tp_dealloc*/
+        AugLoad_dealloc,		/*tp_dealloc*/
         0,		/* tp_print */
         0,		/* tp_getattr */
         0,		/* tp_setattr */
@@ -3386,38 +4651,35 @@
         0,		/* tp_is_gc */
 };
 
+static int
+AugLoad_validate(PyObject *_obj)
+{
+        return 0;
+}
+
 PyObject*
-Py_comprehension_New(PyObject* target, PyObject* iter, PyObject* ifs)
+Py_AugStore_New()
 {
-        struct _comprehension *result = PyObject_New(struct _comprehension, &Py_comprehension_Type);
+        struct _AugStore *result = PyObject_New(struct _AugStore, &Py_AugStore_Type);
         if (result == NULL)
                 return NULL;
-        Py_INCREF(target);
-        result->target = target;
-        Py_INCREF(iter);
-        result->iter = iter;
-        Py_INCREF(ifs);
-        result->ifs = ifs;
         return (PyObject*)result;
 }
 
 static void
-comprehension_dealloc(PyObject* _self)
+AugStore_dealloc(PyObject* _self)
 {
-        struct _comprehension *self = (struct _comprehension*)_self;
-        Py_DECREF(self->target);
-        Py_DECREF(self->iter);
-        Py_DECREF(self->ifs);
+        struct _AugStore *self = (struct _AugStore*)_self;
         PyObject_Del(self);
 }
 
-PyTypeObject Py_comprehension_Type = {
+PyTypeObject Py_AugStore_Type = {
         PyObject_HEAD_INIT(NULL)
         0,		/*ob_size*/
-        "comprehension",		/*tp_name*/
-        sizeof(struct _comprehension),	/*tp_basicsize*/
+        "AugStore",		/*tp_name*/
+        sizeof(struct _AugStore),	/*tp_basicsize*/
         0,		/* tp_itemsize */
-        comprehension_dealloc,		/*tp_dealloc*/
+        AugStore_dealloc,		/*tp_dealloc*/
         0,		/* tp_print */
         0,		/* tp_getattr */
         0,		/* tp_setattr */
@@ -3455,38 +4717,35 @@
         0,		/* tp_is_gc */
 };
 
+static int
+AugStore_validate(PyObject *_obj)
+{
+        return 0;
+}
+
 PyObject*
-Py_excepthandler_New(PyObject* type, PyObject* name, PyObject* body)
+Py_Param_New()
 {
-        struct _excepthandler *result = PyObject_New(struct _excepthandler, &Py_excepthandler_Type);
+        struct _Param *result = PyObject_New(struct _Param, &Py_Param_Type);
         if (result == NULL)
                 return NULL;
-        Py_INCREF(type);
-        result->type = type;
-        Py_INCREF(name);
-        result->name = name;
-        Py_INCREF(body);
-        result->body = body;
         return (PyObject*)result;
 }
 
 static void
-excepthandler_dealloc(PyObject* _self)
+Param_dealloc(PyObject* _self)
 {
-        struct _excepthandler *self = (struct _excepthandler*)_self;
-        Py_DECREF(self->type);
-        Py_DECREF(self->name);
-        Py_DECREF(self->body);
+        struct _Param *self = (struct _Param*)_self;
         PyObject_Del(self);
 }
 
-PyTypeObject Py_excepthandler_Type = {
+PyTypeObject Py_Param_Type = {
         PyObject_HEAD_INIT(NULL)
         0,		/*ob_size*/
-        "excepthandler",		/*tp_name*/
-        sizeof(struct _excepthandler),	/*tp_basicsize*/
+        "Param",		/*tp_name*/
+        sizeof(struct _Param),	/*tp_basicsize*/
         0,		/* tp_itemsize */
-        excepthandler_dealloc,		/*tp_dealloc*/
+        Param_dealloc,		/*tp_dealloc*/
         0,		/* tp_print */
         0,		/* tp_getattr */
         0,		/* tp_setattr */
@@ -3524,17 +4783,2731 @@
         0,		/* tp_is_gc */
 };
 
-PyObject*
-Py_arguments_New(PyObject* args, PyObject* vararg, PyObject* kwarg, PyObject*
-                 defaults)
+static int
+Param_validate(PyObject *_obj)
 {
-        struct _arguments *result = PyObject_New(struct _arguments, &Py_arguments_Type);
-        if (result == NULL)
-                return NULL;
-        Py_INCREF(args);
-        result->args = args;
-        Py_INCREF(vararg);
-        result->vararg = vararg;
+        return 0;
+}
+
+#define slice_dealloc 0
+PyTypeObject Py_slice_Type = {
+        PyObject_HEAD_INIT(NULL)
+        0,		/*ob_size*/
+        "slice",		/*tp_name*/
+        sizeof(struct _slice),	/*tp_basicsize*/
+        0,		/* tp_itemsize */
+        slice_dealloc,		/*tp_dealloc*/
+        0,		/* tp_print */
+        0,		/* tp_getattr */
+        0,		/* tp_setattr */
+        0,		/* tp_compare */
+        0,		/* tp_repr */
+        0,		/* tp_as_number */
+        0,		/* tp_as_sequence */
+        0,		/* tp_as_mapping */
+        0,		/* tp_hash */
+        0,		/* tp_call */
+        0,		/* tp_str */
+        0,		/* tp_getattro */
+        0,		/* tp_setattro */
+        0,		/* tp_as_buffer */
+        Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE,		/*tp_flags*/
+        0,		/* tp_doc */
+        0,		/* tp_traverse */
+        0,		/* tp_clear */
+        0,		/* tp_richcompare */
+        0,		/* tp_weaklistoffset */
+        0,		/* tp_iter */
+        0,		/* tp_iternext */
+        0,		/* tp_methods */
+        0,		/* tp_members */
+        0,		/* tp_getset */
+        0,		/* tp_base */
+        0,		/* tp_dict */
+        0,		/* tp_descr_get */
+        0,		/* tp_descr_set */
+        0,		/* tp_dictoffset */
+        0,		/* tp_init */
+        0,		/* tp_alloc */
+        0,		/* tp_new */
+        0,		/* tp_free */
+        0,		/* tp_is_gc */
+};
+
+int
+slice_validate(PyObject* _obj)
+{
+        struct _slice *obj = (struct _slice*)_obj;
+        assert(slice_Check(_obj));
+        switch(obj->_kind) {
+                case Ellipsis_kind:
+                    return Ellipsis_validate(_obj);
+                case Slice_kind:
+                    return Slice_validate(_obj);
+                case ExtSlice_kind:
+                    return ExtSlice_validate(_obj);
+                case Index_kind:
+                    return Index_validate(_obj);
+        }
+        PyErr_SetString(PyExc_TypeError, "invalid _kind in slice");
+        return -1;
+}
+PyObject*
+Py_Ellipsis_New()
+{
+        struct _Ellipsis *result = PyObject_New(struct _Ellipsis, &Py_Ellipsis_Type);
+        if (result == NULL)
+                return NULL;
+        return (PyObject*)result;
+}
+
+static void
+Ellipsis_dealloc(PyObject* _self)
+{
+        struct _Ellipsis *self = (struct _Ellipsis*)_self;
+        PyObject_Del(self);
+}
+
+PyTypeObject Py_Ellipsis_Type = {
+        PyObject_HEAD_INIT(NULL)
+        0,		/*ob_size*/
+        "Ellipsis",		/*tp_name*/
+        sizeof(struct _Ellipsis),	/*tp_basicsize*/
+        0,		/* tp_itemsize */
+        Ellipsis_dealloc,		/*tp_dealloc*/
+        0,		/* tp_print */
+        0,		/* tp_getattr */
+        0,		/* tp_setattr */
+        0,		/* tp_compare */
+        0,		/* tp_repr */
+        0,		/* tp_as_number */
+        0,		/* tp_as_sequence */
+        0,		/* tp_as_mapping */
+        0,		/* tp_hash */
+        0,		/* tp_call */
+        0,		/* tp_str */
+        0,		/* tp_getattro */
+        0,		/* tp_setattro */
+        0,		/* tp_as_buffer */
+        Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE,		/*tp_flags*/
+        0,		/* tp_doc */
+        0,		/* tp_traverse */
+        0,		/* tp_clear */
+        0,		/* tp_richcompare */
+        0,		/* tp_weaklistoffset */
+        0,		/* tp_iter */
+        0,		/* tp_iternext */
+        0,		/* tp_methods */
+        0,		/* tp_members */
+        0,		/* tp_getset */
+        0,		/* tp_base */
+        0,		/* tp_dict */
+        0,		/* tp_descr_get */
+        0,		/* tp_descr_set */
+        0,		/* tp_dictoffset */
+        0,		/* tp_init */
+        0,		/* tp_alloc */
+        0,		/* tp_new */
+        0,		/* tp_free */
+        0,		/* tp_is_gc */
+};
+
+static int
+Ellipsis_validate(PyObject *_obj)
+{
+        return 0;
+}
+
+PyObject*
+Py_Slice_New(PyObject* lower, PyObject* upper, PyObject* step)
+{
+        struct _Slice *result = PyObject_New(struct _Slice, &Py_Slice_Type);
+        if (result == NULL)
+                return NULL;
+        Py_INCREF(lower);
+        result->lower = lower;
+        Py_INCREF(upper);
+        result->upper = upper;
+        Py_INCREF(step);
+        result->step = step;
+        return (PyObject*)result;
+}
+
+static void
+Slice_dealloc(PyObject* _self)
+{
+        struct _Slice *self = (struct _Slice*)_self;
+        Py_DECREF(self->lower);
+        Py_DECREF(self->upper);
+        Py_DECREF(self->step);
+        PyObject_Del(self);
+}
+
+PyTypeObject Py_Slice_Type = {
+        PyObject_HEAD_INIT(NULL)
+        0,		/*ob_size*/
+        "Slice",		/*tp_name*/
+        sizeof(struct _Slice),	/*tp_basicsize*/
+        0,		/* tp_itemsize */
+        Slice_dealloc,		/*tp_dealloc*/
+        0,		/* tp_print */
+        0,		/* tp_getattr */
+        0,		/* tp_setattr */
+        0,		/* tp_compare */
+        0,		/* tp_repr */
+        0,		/* tp_as_number */
+        0,		/* tp_as_sequence */
+        0,		/* tp_as_mapping */
+        0,		/* tp_hash */
+        0,		/* tp_call */
+        0,		/* tp_str */
+        0,		/* tp_getattro */
+        0,		/* tp_setattro */
+        0,		/* tp_as_buffer */
+        Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE,		/*tp_flags*/
+        0,		/* tp_doc */
+        0,		/* tp_traverse */
+        0,		/* tp_clear */
+        0,		/* tp_richcompare */
+        0,		/* tp_weaklistoffset */
+        0,		/* tp_iter */
+        0,		/* tp_iternext */
+        0,		/* tp_methods */
+        0,		/* tp_members */
+        0,		/* tp_getset */
+        0,		/* tp_base */
+        0,		/* tp_dict */
+        0,		/* tp_descr_get */
+        0,		/* tp_descr_set */
+        0,		/* tp_dictoffset */
+        0,		/* tp_init */
+        0,		/* tp_alloc */
+        0,		/* tp_new */
+        0,		/* tp_free */
+        0,		/* tp_is_gc */
+};
+
+static int
+Slice_validate(PyObject *_obj)
+{
+        struct _Slice *obj = (struct _Slice*)_obj;
+        if (obj->lower != Py_None) /* empty */;
+        else if (!expr_Check(obj->lower)) {
+            failed_check("lower", "expr", obj->lower);
+            return -1;
+        }
+        else if (expr_validate(obj->lower) < 0)
+            return -1;
+        if (obj->upper != Py_None) /* empty */;
+        else if (!expr_Check(obj->upper)) {
+            failed_check("upper", "expr", obj->upper);
+            return -1;
+        }
+        else if (expr_validate(obj->upper) < 0)
+            return -1;
+        if (obj->step != Py_None) /* empty */;
+        else if (!expr_Check(obj->step)) {
+            failed_check("step", "expr", obj->step);
+            return -1;
+        }
+        else if (expr_validate(obj->step) < 0)
+            return -1;
+        return 0;
+}
+
+PyObject*
+Py_ExtSlice_New(PyObject* dims)
+{
+        struct _ExtSlice *result = PyObject_New(struct _ExtSlice, &Py_ExtSlice_Type);
+        if (result == NULL)
+                return NULL;
+        Py_INCREF(dims);
+        result->dims = dims;
+        return (PyObject*)result;
+}
+
+static void
+ExtSlice_dealloc(PyObject* _self)
+{
+        struct _ExtSlice *self = (struct _ExtSlice*)_self;
+        Py_DECREF(self->dims);
+        PyObject_Del(self);
+}
+
+PyTypeObject Py_ExtSlice_Type = {
+        PyObject_HEAD_INIT(NULL)
+        0,		/*ob_size*/
+        "ExtSlice",		/*tp_name*/
+        sizeof(struct _ExtSlice),	/*tp_basicsize*/
+        0,		/* tp_itemsize */
+        ExtSlice_dealloc,		/*tp_dealloc*/
+        0,		/* tp_print */
+        0,		/* tp_getattr */
+        0,		/* tp_setattr */
+        0,		/* tp_compare */
+        0,		/* tp_repr */
+        0,		/* tp_as_number */
+        0,		/* tp_as_sequence */
+        0,		/* tp_as_mapping */
+        0,		/* tp_hash */
+        0,		/* tp_call */
+        0,		/* tp_str */
+        0,		/* tp_getattro */
+        0,		/* tp_setattro */
+        0,		/* tp_as_buffer */
+        Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE,		/*tp_flags*/
+        0,		/* tp_doc */
+        0,		/* tp_traverse */
+        0,		/* tp_clear */
+        0,		/* tp_richcompare */
+        0,		/* tp_weaklistoffset */
+        0,		/* tp_iter */
+        0,		/* tp_iternext */
+        0,		/* tp_methods */
+        0,		/* tp_members */
+        0,		/* tp_getset */
+        0,		/* tp_base */
+        0,		/* tp_dict */
+        0,		/* tp_descr_get */
+        0,		/* tp_descr_set */
+        0,		/* tp_dictoffset */
+        0,		/* tp_init */
+        0,		/* tp_alloc */
+        0,		/* tp_new */
+        0,		/* tp_free */
+        0,		/* tp_is_gc */
+};
+
+static int
+ExtSlice_validate(PyObject *_obj)
+{
+        struct _ExtSlice *obj = (struct _ExtSlice*)_obj;
+        int i;
+        if (!PyList_Check(obj->dims)) {
+           failed_check("dims", "list", obj->dims);
+           return -1;
+        }
+        for(i = 0; i < PyList_Size(obj->dims); i++) {
+                if (!slice_Check(PyList_GET_ITEM(obj->dims, i))) {
+                    failed_check("dims", "slice", PyList_GET_ITEM(obj->dims,
+                                 i));
+                    return -1;
+                }
+                if (slice_validate(PyList_GET_ITEM(obj->dims, i)) < 0)
+                    return -1;
+        }
+        return 0;
+}
+
+PyObject*
+Py_Index_New(PyObject* value)
+{
+        struct _Index *result = PyObject_New(struct _Index, &Py_Index_Type);
+        if (result == NULL)
+                return NULL;
+        Py_INCREF(value);
+        result->value = value;
+        return (PyObject*)result;
+}
+
+static void
+Index_dealloc(PyObject* _self)
+{
+        struct _Index *self = (struct _Index*)_self;
+        Py_DECREF(self->value);
+        PyObject_Del(self);
+}
+
+PyTypeObject Py_Index_Type = {
+        PyObject_HEAD_INIT(NULL)
+        0,		/*ob_size*/
+        "Index",		/*tp_name*/
+        sizeof(struct _Index),	/*tp_basicsize*/
+        0,		/* tp_itemsize */
+        Index_dealloc,		/*tp_dealloc*/
+        0,		/* tp_print */
+        0,		/* tp_getattr */
+        0,		/* tp_setattr */
+        0,		/* tp_compare */
+        0,		/* tp_repr */
+        0,		/* tp_as_number */
+        0,		/* tp_as_sequence */
+        0,		/* tp_as_mapping */
+        0,		/* tp_hash */
+        0,		/* tp_call */
+        0,		/* tp_str */
+        0,		/* tp_getattro */
+        0,		/* tp_setattro */
+        0,		/* tp_as_buffer */
+        Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE,		/*tp_flags*/
+        0,		/* tp_doc */
+        0,		/* tp_traverse */
+        0,		/* tp_clear */
+        0,		/* tp_richcompare */
+        0,		/* tp_weaklistoffset */
+        0,		/* tp_iter */
+        0,		/* tp_iternext */
+        0,		/* tp_methods */
+        0,		/* tp_members */
+        0,		/* tp_getset */
+        0,		/* tp_base */
+        0,		/* tp_dict */
+        0,		/* tp_descr_get */
+        0,		/* tp_descr_set */
+        0,		/* tp_dictoffset */
+        0,		/* tp_init */
+        0,		/* tp_alloc */
+        0,		/* tp_new */
+        0,		/* tp_free */
+        0,		/* tp_is_gc */
+};
+
+static int
+Index_validate(PyObject *_obj)
+{
+        struct _Index *obj = (struct _Index*)_obj;
+        if (!expr_Check(obj->value)) {
+            failed_check("value", "expr", obj->value);
+            return -1;
+        }
+        return 0;
+}
+
+#define boolop_dealloc 0
+PyTypeObject Py_boolop_Type = {
+        PyObject_HEAD_INIT(NULL)
+        0,		/*ob_size*/
+        "boolop",		/*tp_name*/
+        sizeof(struct _boolop),	/*tp_basicsize*/
+        0,		/* tp_itemsize */
+        boolop_dealloc,		/*tp_dealloc*/
+        0,		/* tp_print */
+        0,		/* tp_getattr */
+        0,		/* tp_setattr */
+        0,		/* tp_compare */
+        0,		/* tp_repr */
+        0,		/* tp_as_number */
+        0,		/* tp_as_sequence */
+        0,		/* tp_as_mapping */
+        0,		/* tp_hash */
+        0,		/* tp_call */
+        0,		/* tp_str */
+        0,		/* tp_getattro */
+        0,		/* tp_setattro */
+        0,		/* tp_as_buffer */
+        Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE,		/*tp_flags*/
+        0,		/* tp_doc */
+        0,		/* tp_traverse */
+        0,		/* tp_clear */
+        0,		/* tp_richcompare */
+        0,		/* tp_weaklistoffset */
+        0,		/* tp_iter */
+        0,		/* tp_iternext */
+        0,		/* tp_methods */
+        0,		/* tp_members */
+        0,		/* tp_getset */
+        0,		/* tp_base */
+        0,		/* tp_dict */
+        0,		/* tp_descr_get */
+        0,		/* tp_descr_set */
+        0,		/* tp_dictoffset */
+        0,		/* tp_init */
+        0,		/* tp_alloc */
+        0,		/* tp_new */
+        0,		/* tp_free */
+        0,		/* tp_is_gc */
+};
+
+int
+boolop_validate(PyObject* _obj)
+{
+        struct _boolop *obj = (struct _boolop*)_obj;
+        assert(boolop_Check(_obj));
+        switch(obj->_kind) {
+                case And_kind:
+                    return And_validate(_obj);
+                case Or_kind:
+                    return Or_validate(_obj);
+        }
+        PyErr_SetString(PyExc_TypeError, "invalid _kind in boolop");
+        return -1;
+}
+PyObject*
+Py_And_New()
+{
+        struct _And *result = PyObject_New(struct _And, &Py_And_Type);
+        if (result == NULL)
+                return NULL;
+        return (PyObject*)result;
+}
+
+static void
+And_dealloc(PyObject* _self)
+{
+        struct _And *self = (struct _And*)_self;
+        PyObject_Del(self);
+}
+
+PyTypeObject Py_And_Type = {
+        PyObject_HEAD_INIT(NULL)
+        0,		/*ob_size*/
+        "And",		/*tp_name*/
+        sizeof(struct _And),	/*tp_basicsize*/
+        0,		/* tp_itemsize */
+        And_dealloc,		/*tp_dealloc*/
+        0,		/* tp_print */
+        0,		/* tp_getattr */
+        0,		/* tp_setattr */
+        0,		/* tp_compare */
+        0,		/* tp_repr */
+        0,		/* tp_as_number */
+        0,		/* tp_as_sequence */
+        0,		/* tp_as_mapping */
+        0,		/* tp_hash */
+        0,		/* tp_call */
+        0,		/* tp_str */
+        0,		/* tp_getattro */
+        0,		/* tp_setattro */
+        0,		/* tp_as_buffer */
+        Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE,		/*tp_flags*/
+        0,		/* tp_doc */
+        0,		/* tp_traverse */
+        0,		/* tp_clear */
+        0,		/* tp_richcompare */
+        0,		/* tp_weaklistoffset */
+        0,		/* tp_iter */
+        0,		/* tp_iternext */
+        0,		/* tp_methods */
+        0,		/* tp_members */
+        0,		/* tp_getset */
+        0,		/* tp_base */
+        0,		/* tp_dict */
+        0,		/* tp_descr_get */
+        0,		/* tp_descr_set */
+        0,		/* tp_dictoffset */
+        0,		/* tp_init */
+        0,		/* tp_alloc */
+        0,		/* tp_new */
+        0,		/* tp_free */
+        0,		/* tp_is_gc */
+};
+
+static int
+And_validate(PyObject *_obj)
+{
+        return 0;
+}
+
+PyObject*
+Py_Or_New()
+{
+        struct _Or *result = PyObject_New(struct _Or, &Py_Or_Type);
+        if (result == NULL)
+                return NULL;
+        return (PyObject*)result;
+}
+
+static void
+Or_dealloc(PyObject* _self)
+{
+        struct _Or *self = (struct _Or*)_self;
+        PyObject_Del(self);
+}
+
+PyTypeObject Py_Or_Type = {
+        PyObject_HEAD_INIT(NULL)
+        0,		/*ob_size*/
+        "Or",		/*tp_name*/
+        sizeof(struct _Or),	/*tp_basicsize*/
+        0,		/* tp_itemsize */
+        Or_dealloc,		/*tp_dealloc*/
+        0,		/* tp_print */
+        0,		/* tp_getattr */
+        0,		/* tp_setattr */
+        0,		/* tp_compare */
+        0,		/* tp_repr */
+        0,		/* tp_as_number */
+        0,		/* tp_as_sequence */
+        0,		/* tp_as_mapping */
+        0,		/* tp_hash */
+        0,		/* tp_call */
+        0,		/* tp_str */
+        0,		/* tp_getattro */
+        0,		/* tp_setattro */
+        0,		/* tp_as_buffer */
+        Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE,		/*tp_flags*/
+        0,		/* tp_doc */
+        0,		/* tp_traverse */
+        0,		/* tp_clear */
+        0,		/* tp_richcompare */
+        0,		/* tp_weaklistoffset */
+        0,		/* tp_iter */
+        0,		/* tp_iternext */
+        0,		/* tp_methods */
+        0,		/* tp_members */
+        0,		/* tp_getset */
+        0,		/* tp_base */
+        0,		/* tp_dict */
+        0,		/* tp_descr_get */
+        0,		/* tp_descr_set */
+        0,		/* tp_dictoffset */
+        0,		/* tp_init */
+        0,		/* tp_alloc */
+        0,		/* tp_new */
+        0,		/* tp_free */
+        0,		/* tp_is_gc */
+};
+
+static int
+Or_validate(PyObject *_obj)
+{
+        return 0;
+}
+
+#define operator_dealloc 0
+PyTypeObject Py_operator_Type = {
+        PyObject_HEAD_INIT(NULL)
+        0,		/*ob_size*/
+        "operator",		/*tp_name*/
+        sizeof(struct _operator),	/*tp_basicsize*/
+        0,		/* tp_itemsize */
+        operator_dealloc,		/*tp_dealloc*/
+        0,		/* tp_print */
+        0,		/* tp_getattr */
+        0,		/* tp_setattr */
+        0,		/* tp_compare */
+        0,		/* tp_repr */
+        0,		/* tp_as_number */
+        0,		/* tp_as_sequence */
+        0,		/* tp_as_mapping */
+        0,		/* tp_hash */
+        0,		/* tp_call */
+        0,		/* tp_str */
+        0,		/* tp_getattro */
+        0,		/* tp_setattro */
+        0,		/* tp_as_buffer */
+        Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE,		/*tp_flags*/
+        0,		/* tp_doc */
+        0,		/* tp_traverse */
+        0,		/* tp_clear */
+        0,		/* tp_richcompare */
+        0,		/* tp_weaklistoffset */
+        0,		/* tp_iter */
+        0,		/* tp_iternext */
+        0,		/* tp_methods */
+        0,		/* tp_members */
+        0,		/* tp_getset */
+        0,		/* tp_base */
+        0,		/* tp_dict */
+        0,		/* tp_descr_get */
+        0,		/* tp_descr_set */
+        0,		/* tp_dictoffset */
+        0,		/* tp_init */
+        0,		/* tp_alloc */
+        0,		/* tp_new */
+        0,		/* tp_free */
+        0,		/* tp_is_gc */
+};
+
+int
+operator_validate(PyObject* _obj)
+{
+        struct _operator *obj = (struct _operator*)_obj;
+        assert(operator_Check(_obj));
+        switch(obj->_kind) {
+                case Add_kind:
+                    return Add_validate(_obj);
+                case Sub_kind:
+                    return Sub_validate(_obj);
+                case Mult_kind:
+                    return Mult_validate(_obj);
+                case Div_kind:
+                    return Div_validate(_obj);
+                case Mod_kind:
+                    return Mod_validate(_obj);
+                case Pow_kind:
+                    return Pow_validate(_obj);
+                case LShift_kind:
+                    return LShift_validate(_obj);
+                case RShift_kind:
+                    return RShift_validate(_obj);
+                case BitOr_kind:
+                    return BitOr_validate(_obj);
+                case BitXor_kind:
+                    return BitXor_validate(_obj);
+                case BitAnd_kind:
+                    return BitAnd_validate(_obj);
+                case FloorDiv_kind:
+                    return FloorDiv_validate(_obj);
+        }
+        PyErr_SetString(PyExc_TypeError, "invalid _kind in operator");
+        return -1;
+}
+PyObject*
+Py_Add_New()
+{
+        struct _Add *result = PyObject_New(struct _Add, &Py_Add_Type);
+        if (result == NULL)
+                return NULL;
+        return (PyObject*)result;
+}
+
+static void
+Add_dealloc(PyObject* _self)
+{
+        struct _Add *self = (struct _Add*)_self;
+        PyObject_Del(self);
+}
+
+PyTypeObject Py_Add_Type = {
+        PyObject_HEAD_INIT(NULL)
+        0,		/*ob_size*/
+        "Add",		/*tp_name*/
+        sizeof(struct _Add),	/*tp_basicsize*/
+        0,		/* tp_itemsize */
+        Add_dealloc,		/*tp_dealloc*/
+        0,		/* tp_print */
+        0,		/* tp_getattr */
+        0,		/* tp_setattr */
+        0,		/* tp_compare */
+        0,		/* tp_repr */
+        0,		/* tp_as_number */
+        0,		/* tp_as_sequence */
+        0,		/* tp_as_mapping */
+        0,		/* tp_hash */
+        0,		/* tp_call */
+        0,		/* tp_str */
+        0,		/* tp_getattro */
+        0,		/* tp_setattro */
+        0,		/* tp_as_buffer */
+        Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE,		/*tp_flags*/
+        0,		/* tp_doc */
+        0,		/* tp_traverse */
+        0,		/* tp_clear */
+        0,		/* tp_richcompare */
+        0,		/* tp_weaklistoffset */
+        0,		/* tp_iter */
+        0,		/* tp_iternext */
+        0,		/* tp_methods */
+        0,		/* tp_members */
+        0,		/* tp_getset */
+        0,		/* tp_base */
+        0,		/* tp_dict */
+        0,		/* tp_descr_get */
+        0,		/* tp_descr_set */
+        0,		/* tp_dictoffset */
+        0,		/* tp_init */
+        0,		/* tp_alloc */
+        0,		/* tp_new */
+        0,		/* tp_free */
+        0,		/* tp_is_gc */
+};
+
+static int
+Add_validate(PyObject *_obj)
+{
+        return 0;
+}
+
+PyObject*
+Py_Sub_New()
+{
+        struct _Sub *result = PyObject_New(struct _Sub, &Py_Sub_Type);
+        if (result == NULL)
+                return NULL;
+        return (PyObject*)result;
+}
+
+static void
+Sub_dealloc(PyObject* _self)
+{
+        struct _Sub *self = (struct _Sub*)_self;
+        PyObject_Del(self);
+}
+
+PyTypeObject Py_Sub_Type = {
+        PyObject_HEAD_INIT(NULL)
+        0,		/*ob_size*/
+        "Sub",		/*tp_name*/
+        sizeof(struct _Sub),	/*tp_basicsize*/
+        0,		/* tp_itemsize */
+        Sub_dealloc,		/*tp_dealloc*/
+        0,		/* tp_print */
+        0,		/* tp_getattr */
+        0,		/* tp_setattr */
+        0,		/* tp_compare */
+        0,		/* tp_repr */
+        0,		/* tp_as_number */
+        0,		/* tp_as_sequence */
+        0,		/* tp_as_mapping */
+        0,		/* tp_hash */
+        0,		/* tp_call */
+        0,		/* tp_str */
+        0,		/* tp_getattro */
+        0,		/* tp_setattro */
+        0,		/* tp_as_buffer */
+        Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE,		/*tp_flags*/
+        0,		/* tp_doc */
+        0,		/* tp_traverse */
+        0,		/* tp_clear */
+        0,		/* tp_richcompare */
+        0,		/* tp_weaklistoffset */
+        0,		/* tp_iter */
+        0,		/* tp_iternext */
+        0,		/* tp_methods */
+        0,		/* tp_members */
+        0,		/* tp_getset */
+        0,		/* tp_base */
+        0,		/* tp_dict */
+        0,		/* tp_descr_get */
+        0,		/* tp_descr_set */
+        0,		/* tp_dictoffset */
+        0,		/* tp_init */
+        0,		/* tp_alloc */
+        0,		/* tp_new */
+        0,		/* tp_free */
+        0,		/* tp_is_gc */
+};
+
+static int
+Sub_validate(PyObject *_obj)
+{
+        return 0;
+}
+
+PyObject*
+Py_Mult_New()
+{
+        struct _Mult *result = PyObject_New(struct _Mult, &Py_Mult_Type);
+        if (result == NULL)
+                return NULL;
+        return (PyObject*)result;
+}
+
+static void
+Mult_dealloc(PyObject* _self)
+{
+        struct _Mult *self = (struct _Mult*)_self;
+        PyObject_Del(self);
+}
+
+PyTypeObject Py_Mult_Type = {
+        PyObject_HEAD_INIT(NULL)
+        0,		/*ob_size*/
+        "Mult",		/*tp_name*/
+        sizeof(struct _Mult),	/*tp_basicsize*/
+        0,		/* tp_itemsize */
+        Mult_dealloc,		/*tp_dealloc*/
+        0,		/* tp_print */
+        0,		/* tp_getattr */
+        0,		/* tp_setattr */
+        0,		/* tp_compare */
+        0,		/* tp_repr */
+        0,		/* tp_as_number */
+        0,		/* tp_as_sequence */
+        0,		/* tp_as_mapping */
+        0,		/* tp_hash */
+        0,		/* tp_call */
+        0,		/* tp_str */
+        0,		/* tp_getattro */
+        0,		/* tp_setattro */
+        0,		/* tp_as_buffer */
+        Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE,		/*tp_flags*/
+        0,		/* tp_doc */
+        0,		/* tp_traverse */
+        0,		/* tp_clear */
+        0,		/* tp_richcompare */
+        0,		/* tp_weaklistoffset */
+        0,		/* tp_iter */
+        0,		/* tp_iternext */
+        0,		/* tp_methods */
+        0,		/* tp_members */
+        0,		/* tp_getset */
+        0,		/* tp_base */
+        0,		/* tp_dict */
+        0,		/* tp_descr_get */
+        0,		/* tp_descr_set */
+        0,		/* tp_dictoffset */
+        0,		/* tp_init */
+        0,		/* tp_alloc */
+        0,		/* tp_new */
+        0,		/* tp_free */
+        0,		/* tp_is_gc */
+};
+
+static int
+Mult_validate(PyObject *_obj)
+{
+        return 0;
+}
+
+PyObject*
+Py_Div_New()
+{
+        struct _Div *result = PyObject_New(struct _Div, &Py_Div_Type);
+        if (result == NULL)
+                return NULL;
+        return (PyObject*)result;
+}
+
+static void
+Div_dealloc(PyObject* _self)
+{
+        struct _Div *self = (struct _Div*)_self;
+        PyObject_Del(self);
+}
+
+PyTypeObject Py_Div_Type = {
+        PyObject_HEAD_INIT(NULL)
+        0,		/*ob_size*/
+        "Div",		/*tp_name*/
+        sizeof(struct _Div),	/*tp_basicsize*/
+        0,		/* tp_itemsize */
+        Div_dealloc,		/*tp_dealloc*/
+        0,		/* tp_print */
+        0,		/* tp_getattr */
+        0,		/* tp_setattr */
+        0,		/* tp_compare */
+        0,		/* tp_repr */
+        0,		/* tp_as_number */
+        0,		/* tp_as_sequence */
+        0,		/* tp_as_mapping */
+        0,		/* tp_hash */
+        0,		/* tp_call */
+        0,		/* tp_str */
+        0,		/* tp_getattro */
+        0,		/* tp_setattro */
+        0,		/* tp_as_buffer */
+        Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE,		/*tp_flags*/
+        0,		/* tp_doc */
+        0,		/* tp_traverse */
+        0,		/* tp_clear */
+        0,		/* tp_richcompare */
+        0,		/* tp_weaklistoffset */
+        0,		/* tp_iter */
+        0,		/* tp_iternext */
+        0,		/* tp_methods */
+        0,		/* tp_members */
+        0,		/* tp_getset */
+        0,		/* tp_base */
+        0,		/* tp_dict */
+        0,		/* tp_descr_get */
+        0,		/* tp_descr_set */
+        0,		/* tp_dictoffset */
+        0,		/* tp_init */
+        0,		/* tp_alloc */
+        0,		/* tp_new */
+        0,		/* tp_free */
+        0,		/* tp_is_gc */
+};
+
+static int
+Div_validate(PyObject *_obj)
+{
+        return 0;
+}
+
+PyObject*
+Py_Mod_New()
+{
+        struct _Mod *result = PyObject_New(struct _Mod, &Py_Mod_Type);
+        if (result == NULL)
+                return NULL;
+        return (PyObject*)result;
+}
+
+static void
+Mod_dealloc(PyObject* _self)
+{
+        struct _Mod *self = (struct _Mod*)_self;
+        PyObject_Del(self);
+}
+
+PyTypeObject Py_Mod_Type = {
+        PyObject_HEAD_INIT(NULL)
+        0,		/*ob_size*/
+        "Mod",		/*tp_name*/
+        sizeof(struct _Mod),	/*tp_basicsize*/
+        0,		/* tp_itemsize */
+        Mod_dealloc,		/*tp_dealloc*/
+        0,		/* tp_print */
+        0,		/* tp_getattr */
+        0,		/* tp_setattr */
+        0,		/* tp_compare */
+        0,		/* tp_repr */
+        0,		/* tp_as_number */
+        0,		/* tp_as_sequence */
+        0,		/* tp_as_mapping */
+        0,		/* tp_hash */
+        0,		/* tp_call */
+        0,		/* tp_str */
+        0,		/* tp_getattro */
+        0,		/* tp_setattro */
+        0,		/* tp_as_buffer */
+        Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE,		/*tp_flags*/
+        0,		/* tp_doc */
+        0,		/* tp_traverse */
+        0,		/* tp_clear */
+        0,		/* tp_richcompare */
+        0,		/* tp_weaklistoffset */
+        0,		/* tp_iter */
+        0,		/* tp_iternext */
+        0,		/* tp_methods */
+        0,		/* tp_members */
+        0,		/* tp_getset */
+        0,		/* tp_base */
+        0,		/* tp_dict */
+        0,		/* tp_descr_get */
+        0,		/* tp_descr_set */
+        0,		/* tp_dictoffset */
+        0,		/* tp_init */
+        0,		/* tp_alloc */
+        0,		/* tp_new */
+        0,		/* tp_free */
+        0,		/* tp_is_gc */
+};
+
+static int
+Mod_validate(PyObject *_obj)
+{
+        return 0;
+}
+
+PyObject*
+Py_Pow_New()
+{
+        struct _Pow *result = PyObject_New(struct _Pow, &Py_Pow_Type);
+        if (result == NULL)
+                return NULL;
+        return (PyObject*)result;
+}
+
+static void
+Pow_dealloc(PyObject* _self)
+{
+        struct _Pow *self = (struct _Pow*)_self;
+        PyObject_Del(self);
+}
+
+PyTypeObject Py_Pow_Type = {
+        PyObject_HEAD_INIT(NULL)
+        0,		/*ob_size*/
+        "Pow",		/*tp_name*/
+        sizeof(struct _Pow),	/*tp_basicsize*/
+        0,		/* tp_itemsize */
+        Pow_dealloc,		/*tp_dealloc*/
+        0,		/* tp_print */
+        0,		/* tp_getattr */
+        0,		/* tp_setattr */
+        0,		/* tp_compare */
+        0,		/* tp_repr */
+        0,		/* tp_as_number */
+        0,		/* tp_as_sequence */
+        0,		/* tp_as_mapping */
+        0,		/* tp_hash */
+        0,		/* tp_call */
+        0,		/* tp_str */
+        0,		/* tp_getattro */
+        0,		/* tp_setattro */
+        0,		/* tp_as_buffer */
+        Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE,		/*tp_flags*/
+        0,		/* tp_doc */
+        0,		/* tp_traverse */
+        0,		/* tp_clear */
+        0,		/* tp_richcompare */
+        0,		/* tp_weaklistoffset */
+        0,		/* tp_iter */
+        0,		/* tp_iternext */
+        0,		/* tp_methods */
+        0,		/* tp_members */
+        0,		/* tp_getset */
+        0,		/* tp_base */
+        0,		/* tp_dict */
+        0,		/* tp_descr_get */
+        0,		/* tp_descr_set */
+        0,		/* tp_dictoffset */
+        0,		/* tp_init */
+        0,		/* tp_alloc */
+        0,		/* tp_new */
+        0,		/* tp_free */
+        0,		/* tp_is_gc */
+};
+
+static int
+Pow_validate(PyObject *_obj)
+{
+        return 0;
+}
+
+PyObject*
+Py_LShift_New()
+{
+        struct _LShift *result = PyObject_New(struct _LShift, &Py_LShift_Type);
+        if (result == NULL)
+                return NULL;
+        return (PyObject*)result;
+}
+
+static void
+LShift_dealloc(PyObject* _self)
+{
+        struct _LShift *self = (struct _LShift*)_self;
+        PyObject_Del(self);
+}
+
+PyTypeObject Py_LShift_Type = {
+        PyObject_HEAD_INIT(NULL)
+        0,		/*ob_size*/
+        "LShift",		/*tp_name*/
+        sizeof(struct _LShift),	/*tp_basicsize*/
+        0,		/* tp_itemsize */
+        LShift_dealloc,		/*tp_dealloc*/
+        0,		/* tp_print */
+        0,		/* tp_getattr */
+        0,		/* tp_setattr */
+        0,		/* tp_compare */
+        0,		/* tp_repr */
+        0,		/* tp_as_number */
+        0,		/* tp_as_sequence */
+        0,		/* tp_as_mapping */
+        0,		/* tp_hash */
+        0,		/* tp_call */
+        0,		/* tp_str */
+        0,		/* tp_getattro */
+        0,		/* tp_setattro */
+        0,		/* tp_as_buffer */
+        Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE,		/*tp_flags*/
+        0,		/* tp_doc */
+        0,		/* tp_traverse */
+        0,		/* tp_clear */
+        0,		/* tp_richcompare */
+        0,		/* tp_weaklistoffset */
+        0,		/* tp_iter */
+        0,		/* tp_iternext */
+        0,		/* tp_methods */
+        0,		/* tp_members */
+        0,		/* tp_getset */
+        0,		/* tp_base */
+        0,		/* tp_dict */
+        0,		/* tp_descr_get */
+        0,		/* tp_descr_set */
+        0,		/* tp_dictoffset */
+        0,		/* tp_init */
+        0,		/* tp_alloc */
+        0,		/* tp_new */
+        0,		/* tp_free */
+        0,		/* tp_is_gc */
+};
+
+static int
+LShift_validate(PyObject *_obj)
+{
+        return 0;
+}
+
+PyObject*
+Py_RShift_New()
+{
+        struct _RShift *result = PyObject_New(struct _RShift, &Py_RShift_Type);
+        if (result == NULL)
+                return NULL;
+        return (PyObject*)result;
+}
+
+static void
+RShift_dealloc(PyObject* _self)
+{
+        struct _RShift *self = (struct _RShift*)_self;
+        PyObject_Del(self);
+}
+
+PyTypeObject Py_RShift_Type = {
+        PyObject_HEAD_INIT(NULL)
+        0,		/*ob_size*/
+        "RShift",		/*tp_name*/
+        sizeof(struct _RShift),	/*tp_basicsize*/
+        0,		/* tp_itemsize */
+        RShift_dealloc,		/*tp_dealloc*/
+        0,		/* tp_print */
+        0,		/* tp_getattr */
+        0,		/* tp_setattr */
+        0,		/* tp_compare */
+        0,		/* tp_repr */
+        0,		/* tp_as_number */
+        0,		/* tp_as_sequence */
+        0,		/* tp_as_mapping */
+        0,		/* tp_hash */
+        0,		/* tp_call */
+        0,		/* tp_str */
+        0,		/* tp_getattro */
+        0,		/* tp_setattro */
+        0,		/* tp_as_buffer */
+        Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE,		/*tp_flags*/
+        0,		/* tp_doc */
+        0,		/* tp_traverse */
+        0,		/* tp_clear */
+        0,		/* tp_richcompare */
+        0,		/* tp_weaklistoffset */
+        0,		/* tp_iter */
+        0,		/* tp_iternext */
+        0,		/* tp_methods */
+        0,		/* tp_members */
+        0,		/* tp_getset */
+        0,		/* tp_base */
+        0,		/* tp_dict */
+        0,		/* tp_descr_get */
+        0,		/* tp_descr_set */
+        0,		/* tp_dictoffset */
+        0,		/* tp_init */
+        0,		/* tp_alloc */
+        0,		/* tp_new */
+        0,		/* tp_free */
+        0,		/* tp_is_gc */
+};
+
+static int
+RShift_validate(PyObject *_obj)
+{
+        return 0;
+}
+
+PyObject*
+Py_BitOr_New()
+{
+        struct _BitOr *result = PyObject_New(struct _BitOr, &Py_BitOr_Type);
+        if (result == NULL)
+                return NULL;
+        return (PyObject*)result;
+}
+
+static void
+BitOr_dealloc(PyObject* _self)
+{
+        struct _BitOr *self = (struct _BitOr*)_self;
+        PyObject_Del(self);
+}
+
+PyTypeObject Py_BitOr_Type = {
+        PyObject_HEAD_INIT(NULL)
+        0,		/*ob_size*/
+        "BitOr",		/*tp_name*/
+        sizeof(struct _BitOr),	/*tp_basicsize*/
+        0,		/* tp_itemsize */
+        BitOr_dealloc,		/*tp_dealloc*/
+        0,		/* tp_print */
+        0,		/* tp_getattr */
+        0,		/* tp_setattr */
+        0,		/* tp_compare */
+        0,		/* tp_repr */
+        0,		/* tp_as_number */
+        0,		/* tp_as_sequence */
+        0,		/* tp_as_mapping */
+        0,		/* tp_hash */
+        0,		/* tp_call */
+        0,		/* tp_str */
+        0,		/* tp_getattro */
+        0,		/* tp_setattro */
+        0,		/* tp_as_buffer */
+        Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE,		/*tp_flags*/
+        0,		/* tp_doc */
+        0,		/* tp_traverse */
+        0,		/* tp_clear */
+        0,		/* tp_richcompare */
+        0,		/* tp_weaklistoffset */
+        0,		/* tp_iter */
+        0,		/* tp_iternext */
+        0,		/* tp_methods */
+        0,		/* tp_members */
+        0,		/* tp_getset */
+        0,		/* tp_base */
+        0,		/* tp_dict */
+        0,		/* tp_descr_get */
+        0,		/* tp_descr_set */
+        0,		/* tp_dictoffset */
+        0,		/* tp_init */
+        0,		/* tp_alloc */
+        0,		/* tp_new */
+        0,		/* tp_free */
+        0,		/* tp_is_gc */
+};
+
+static int
+BitOr_validate(PyObject *_obj)
+{
+        return 0;
+}
+
+PyObject*
+Py_BitXor_New()
+{
+        struct _BitXor *result = PyObject_New(struct _BitXor, &Py_BitXor_Type);
+        if (result == NULL)
+                return NULL;
+        return (PyObject*)result;
+}
+
+static void
+BitXor_dealloc(PyObject* _self)
+{
+        struct _BitXor *self = (struct _BitXor*)_self;
+        PyObject_Del(self);
+}
+
+PyTypeObject Py_BitXor_Type = {
+        PyObject_HEAD_INIT(NULL)
+        0,		/*ob_size*/
+        "BitXor",		/*tp_name*/
+        sizeof(struct _BitXor),	/*tp_basicsize*/
+        0,		/* tp_itemsize */
+        BitXor_dealloc,		/*tp_dealloc*/
+        0,		/* tp_print */
+        0,		/* tp_getattr */
+        0,		/* tp_setattr */
+        0,		/* tp_compare */
+        0,		/* tp_repr */
+        0,		/* tp_as_number */
+        0,		/* tp_as_sequence */
+        0,		/* tp_as_mapping */
+        0,		/* tp_hash */
+        0,		/* tp_call */
+        0,		/* tp_str */
+        0,		/* tp_getattro */
+        0,		/* tp_setattro */
+        0,		/* tp_as_buffer */
+        Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE,		/*tp_flags*/
+        0,		/* tp_doc */
+        0,		/* tp_traverse */
+        0,		/* tp_clear */
+        0,		/* tp_richcompare */
+        0,		/* tp_weaklistoffset */
+        0,		/* tp_iter */
+        0,		/* tp_iternext */
+        0,		/* tp_methods */
+        0,		/* tp_members */
+        0,		/* tp_getset */
+        0,		/* tp_base */
+        0,		/* tp_dict */
+        0,		/* tp_descr_get */
+        0,		/* tp_descr_set */
+        0,		/* tp_dictoffset */
+        0,		/* tp_init */
+        0,		/* tp_alloc */
+        0,		/* tp_new */
+        0,		/* tp_free */
+        0,		/* tp_is_gc */
+};
+
+static int
+BitXor_validate(PyObject *_obj)
+{
+        return 0;
+}
+
+PyObject*
+Py_BitAnd_New()
+{
+        struct _BitAnd *result = PyObject_New(struct _BitAnd, &Py_BitAnd_Type);
+        if (result == NULL)
+                return NULL;
+        return (PyObject*)result;
+}
+
+static void
+BitAnd_dealloc(PyObject* _self)
+{
+        struct _BitAnd *self = (struct _BitAnd*)_self;
+        PyObject_Del(self);
+}
+
+PyTypeObject Py_BitAnd_Type = {
+        PyObject_HEAD_INIT(NULL)
+        0,		/*ob_size*/
+        "BitAnd",		/*tp_name*/
+        sizeof(struct _BitAnd),	/*tp_basicsize*/
+        0,		/* tp_itemsize */
+        BitAnd_dealloc,		/*tp_dealloc*/
+        0,		/* tp_print */
+        0,		/* tp_getattr */
+        0,		/* tp_setattr */
+        0,		/* tp_compare */
+        0,		/* tp_repr */
+        0,		/* tp_as_number */
+        0,		/* tp_as_sequence */
+        0,		/* tp_as_mapping */
+        0,		/* tp_hash */
+        0,		/* tp_call */
+        0,		/* tp_str */
+        0,		/* tp_getattro */
+        0,		/* tp_setattro */
+        0,		/* tp_as_buffer */
+        Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE,		/*tp_flags*/
+        0,		/* tp_doc */
+        0,		/* tp_traverse */
+        0,		/* tp_clear */
+        0,		/* tp_richcompare */
+        0,		/* tp_weaklistoffset */
+        0,		/* tp_iter */
+        0,		/* tp_iternext */
+        0,		/* tp_methods */
+        0,		/* tp_members */
+        0,		/* tp_getset */
+        0,		/* tp_base */
+        0,		/* tp_dict */
+        0,		/* tp_descr_get */
+        0,		/* tp_descr_set */
+        0,		/* tp_dictoffset */
+        0,		/* tp_init */
+        0,		/* tp_alloc */
+        0,		/* tp_new */
+        0,		/* tp_free */
+        0,		/* tp_is_gc */
+};
+
+static int
+BitAnd_validate(PyObject *_obj)
+{
+        return 0;
+}
+
+PyObject*
+Py_FloorDiv_New()
+{
+        struct _FloorDiv *result = PyObject_New(struct _FloorDiv, &Py_FloorDiv_Type);
+        if (result == NULL)
+                return NULL;
+        return (PyObject*)result;
+}
+
+static void
+FloorDiv_dealloc(PyObject* _self)
+{
+        struct _FloorDiv *self = (struct _FloorDiv*)_self;
+        PyObject_Del(self);
+}
+
+PyTypeObject Py_FloorDiv_Type = {
+        PyObject_HEAD_INIT(NULL)
+        0,		/*ob_size*/
+        "FloorDiv",		/*tp_name*/
+        sizeof(struct _FloorDiv),	/*tp_basicsize*/
+        0,		/* tp_itemsize */
+        FloorDiv_dealloc,		/*tp_dealloc*/
+        0,		/* tp_print */
+        0,		/* tp_getattr */
+        0,		/* tp_setattr */
+        0,		/* tp_compare */
+        0,		/* tp_repr */
+        0,		/* tp_as_number */
+        0,		/* tp_as_sequence */
+        0,		/* tp_as_mapping */
+        0,		/* tp_hash */
+        0,		/* tp_call */
+        0,		/* tp_str */
+        0,		/* tp_getattro */
+        0,		/* tp_setattro */
+        0,		/* tp_as_buffer */
+        Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE,		/*tp_flags*/
+        0,		/* tp_doc */
+        0,		/* tp_traverse */
+        0,		/* tp_clear */
+        0,		/* tp_richcompare */
+        0,		/* tp_weaklistoffset */
+        0,		/* tp_iter */
+        0,		/* tp_iternext */
+        0,		/* tp_methods */
+        0,		/* tp_members */
+        0,		/* tp_getset */
+        0,		/* tp_base */
+        0,		/* tp_dict */
+        0,		/* tp_descr_get */
+        0,		/* tp_descr_set */
+        0,		/* tp_dictoffset */
+        0,		/* tp_init */
+        0,		/* tp_alloc */
+        0,		/* tp_new */
+        0,		/* tp_free */
+        0,		/* tp_is_gc */
+};
+
+static int
+FloorDiv_validate(PyObject *_obj)
+{
+        return 0;
+}
+
+#define unaryop_dealloc 0
+PyTypeObject Py_unaryop_Type = {
+        PyObject_HEAD_INIT(NULL)
+        0,		/*ob_size*/
+        "unaryop",		/*tp_name*/
+        sizeof(struct _unaryop),	/*tp_basicsize*/
+        0,		/* tp_itemsize */
+        unaryop_dealloc,		/*tp_dealloc*/
+        0,		/* tp_print */
+        0,		/* tp_getattr */
+        0,		/* tp_setattr */
+        0,		/* tp_compare */
+        0,		/* tp_repr */
+        0,		/* tp_as_number */
+        0,		/* tp_as_sequence */
+        0,		/* tp_as_mapping */
+        0,		/* tp_hash */
+        0,		/* tp_call */
+        0,		/* tp_str */
+        0,		/* tp_getattro */
+        0,		/* tp_setattro */
+        0,		/* tp_as_buffer */
+        Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE,		/*tp_flags*/
+        0,		/* tp_doc */
+        0,		/* tp_traverse */
+        0,		/* tp_clear */
+        0,		/* tp_richcompare */
+        0,		/* tp_weaklistoffset */
+        0,		/* tp_iter */
+        0,		/* tp_iternext */
+        0,		/* tp_methods */
+        0,		/* tp_members */
+        0,		/* tp_getset */
+        0,		/* tp_base */
+        0,		/* tp_dict */
+        0,		/* tp_descr_get */
+        0,		/* tp_descr_set */
+        0,		/* tp_dictoffset */
+        0,		/* tp_init */
+        0,		/* tp_alloc */
+        0,		/* tp_new */
+        0,		/* tp_free */
+        0,		/* tp_is_gc */
+};
+
+int
+unaryop_validate(PyObject* _obj)
+{
+        struct _unaryop *obj = (struct _unaryop*)_obj;
+        assert(unaryop_Check(_obj));
+        switch(obj->_kind) {
+                case Invert_kind:
+                    return Invert_validate(_obj);
+                case Not_kind:
+                    return Not_validate(_obj);
+                case UAdd_kind:
+                    return UAdd_validate(_obj);
+                case USub_kind:
+                    return USub_validate(_obj);
+        }
+        PyErr_SetString(PyExc_TypeError, "invalid _kind in unaryop");
+        return -1;
+}
+PyObject*
+Py_Invert_New()
+{
+        struct _Invert *result = PyObject_New(struct _Invert, &Py_Invert_Type);
+        if (result == NULL)
+                return NULL;
+        return (PyObject*)result;
+}
+
+static void
+Invert_dealloc(PyObject* _self)
+{
+        struct _Invert *self = (struct _Invert*)_self;
+        PyObject_Del(self);
+}
+
+PyTypeObject Py_Invert_Type = {
+        PyObject_HEAD_INIT(NULL)
+        0,		/*ob_size*/
+        "Invert",		/*tp_name*/
+        sizeof(struct _Invert),	/*tp_basicsize*/
+        0,		/* tp_itemsize */
+        Invert_dealloc,		/*tp_dealloc*/
+        0,		/* tp_print */
+        0,		/* tp_getattr */
+        0,		/* tp_setattr */
+        0,		/* tp_compare */
+        0,		/* tp_repr */
+        0,		/* tp_as_number */
+        0,		/* tp_as_sequence */
+        0,		/* tp_as_mapping */
+        0,		/* tp_hash */
+        0,		/* tp_call */
+        0,		/* tp_str */
+        0,		/* tp_getattro */
+        0,		/* tp_setattro */
+        0,		/* tp_as_buffer */
+        Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE,		/*tp_flags*/
+        0,		/* tp_doc */
+        0,		/* tp_traverse */
+        0,		/* tp_clear */
+        0,		/* tp_richcompare */
+        0,		/* tp_weaklistoffset */
+        0,		/* tp_iter */
+        0,		/* tp_iternext */
+        0,		/* tp_methods */
+        0,		/* tp_members */
+        0,		/* tp_getset */
+        0,		/* tp_base */
+        0,		/* tp_dict */
+        0,		/* tp_descr_get */
+        0,		/* tp_descr_set */
+        0,		/* tp_dictoffset */
+        0,		/* tp_init */
+        0,		/* tp_alloc */
+        0,		/* tp_new */
+        0,		/* tp_free */
+        0,		/* tp_is_gc */
+};
+
+static int
+Invert_validate(PyObject *_obj)
+{
+        return 0;
+}
+
+PyObject*
+Py_Not_New()
+{
+        struct _Not *result = PyObject_New(struct _Not, &Py_Not_Type);
+        if (result == NULL)
+                return NULL;
+        return (PyObject*)result;
+}
+
+static void
+Not_dealloc(PyObject* _self)
+{
+        struct _Not *self = (struct _Not*)_self;
+        PyObject_Del(self);
+}
+
+PyTypeObject Py_Not_Type = {
+        PyObject_HEAD_INIT(NULL)
+        0,		/*ob_size*/
+        "Not",		/*tp_name*/
+        sizeof(struct _Not),	/*tp_basicsize*/
+        0,		/* tp_itemsize */
+        Not_dealloc,		/*tp_dealloc*/
+        0,		/* tp_print */
+        0,		/* tp_getattr */
+        0,		/* tp_setattr */
+        0,		/* tp_compare */
+        0,		/* tp_repr */
+        0,		/* tp_as_number */
+        0,		/* tp_as_sequence */
+        0,		/* tp_as_mapping */
+        0,		/* tp_hash */
+        0,		/* tp_call */
+        0,		/* tp_str */
+        0,		/* tp_getattro */
+        0,		/* tp_setattro */
+        0,		/* tp_as_buffer */
+        Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE,		/*tp_flags*/
+        0,		/* tp_doc */
+        0,		/* tp_traverse */
+        0,		/* tp_clear */
+        0,		/* tp_richcompare */
+        0,		/* tp_weaklistoffset */
+        0,		/* tp_iter */
+        0,		/* tp_iternext */
+        0,		/* tp_methods */
+        0,		/* tp_members */
+        0,		/* tp_getset */
+        0,		/* tp_base */
+        0,		/* tp_dict */
+        0,		/* tp_descr_get */
+        0,		/* tp_descr_set */
+        0,		/* tp_dictoffset */
+        0,		/* tp_init */
+        0,		/* tp_alloc */
+        0,		/* tp_new */
+        0,		/* tp_free */
+        0,		/* tp_is_gc */
+};
+
+static int
+Not_validate(PyObject *_obj)
+{
+        return 0;
+}
+
+PyObject*
+Py_UAdd_New()
+{
+        struct _UAdd *result = PyObject_New(struct _UAdd, &Py_UAdd_Type);
+        if (result == NULL)
+                return NULL;
+        return (PyObject*)result;
+}
+
+static void
+UAdd_dealloc(PyObject* _self)
+{
+        struct _UAdd *self = (struct _UAdd*)_self;
+        PyObject_Del(self);
+}
+
+PyTypeObject Py_UAdd_Type = {
+        PyObject_HEAD_INIT(NULL)
+        0,		/*ob_size*/
+        "UAdd",		/*tp_name*/
+        sizeof(struct _UAdd),	/*tp_basicsize*/
+        0,		/* tp_itemsize */
+        UAdd_dealloc,		/*tp_dealloc*/
+        0,		/* tp_print */
+        0,		/* tp_getattr */
+        0,		/* tp_setattr */
+        0,		/* tp_compare */
+        0,		/* tp_repr */
+        0,		/* tp_as_number */
+        0,		/* tp_as_sequence */
+        0,		/* tp_as_mapping */
+        0,		/* tp_hash */
+        0,		/* tp_call */
+        0,		/* tp_str */
+        0,		/* tp_getattro */
+        0,		/* tp_setattro */
+        0,		/* tp_as_buffer */
+        Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE,		/*tp_flags*/
+        0,		/* tp_doc */
+        0,		/* tp_traverse */
+        0,		/* tp_clear */
+        0,		/* tp_richcompare */
+        0,		/* tp_weaklistoffset */
+        0,		/* tp_iter */
+        0,		/* tp_iternext */
+        0,		/* tp_methods */
+        0,		/* tp_members */
+        0,		/* tp_getset */
+        0,		/* tp_base */
+        0,		/* tp_dict */
+        0,		/* tp_descr_get */
+        0,		/* tp_descr_set */
+        0,		/* tp_dictoffset */
+        0,		/* tp_init */
+        0,		/* tp_alloc */
+        0,		/* tp_new */
+        0,		/* tp_free */
+        0,		/* tp_is_gc */
+};
+
+static int
+UAdd_validate(PyObject *_obj)
+{
+        return 0;
+}
+
+PyObject*
+Py_USub_New()
+{
+        struct _USub *result = PyObject_New(struct _USub, &Py_USub_Type);
+        if (result == NULL)
+                return NULL;
+        return (PyObject*)result;
+}
+
+static void
+USub_dealloc(PyObject* _self)
+{
+        struct _USub *self = (struct _USub*)_self;
+        PyObject_Del(self);
+}
+
+PyTypeObject Py_USub_Type = {
+        PyObject_HEAD_INIT(NULL)
+        0,		/*ob_size*/
+        "USub",		/*tp_name*/
+        sizeof(struct _USub),	/*tp_basicsize*/
+        0,		/* tp_itemsize */
+        USub_dealloc,		/*tp_dealloc*/
+        0,		/* tp_print */
+        0,		/* tp_getattr */
+        0,		/* tp_setattr */
+        0,		/* tp_compare */
+        0,		/* tp_repr */
+        0,		/* tp_as_number */
+        0,		/* tp_as_sequence */
+        0,		/* tp_as_mapping */
+        0,		/* tp_hash */
+        0,		/* tp_call */
+        0,		/* tp_str */
+        0,		/* tp_getattro */
+        0,		/* tp_setattro */
+        0,		/* tp_as_buffer */
+        Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE,		/*tp_flags*/
+        0,		/* tp_doc */
+        0,		/* tp_traverse */
+        0,		/* tp_clear */
+        0,		/* tp_richcompare */
+        0,		/* tp_weaklistoffset */
+        0,		/* tp_iter */
+        0,		/* tp_iternext */
+        0,		/* tp_methods */
+        0,		/* tp_members */
+        0,		/* tp_getset */
+        0,		/* tp_base */
+        0,		/* tp_dict */
+        0,		/* tp_descr_get */
+        0,		/* tp_descr_set */
+        0,		/* tp_dictoffset */
+        0,		/* tp_init */
+        0,		/* tp_alloc */
+        0,		/* tp_new */
+        0,		/* tp_free */
+        0,		/* tp_is_gc */
+};
+
+static int
+USub_validate(PyObject *_obj)
+{
+        return 0;
+}
+
+#define cmpop_dealloc 0
+PyTypeObject Py_cmpop_Type = {
+        PyObject_HEAD_INIT(NULL)
+        0,		/*ob_size*/
+        "cmpop",		/*tp_name*/
+        sizeof(struct _cmpop),	/*tp_basicsize*/
+        0,		/* tp_itemsize */
+        cmpop_dealloc,		/*tp_dealloc*/
+        0,		/* tp_print */
+        0,		/* tp_getattr */
+        0,		/* tp_setattr */
+        0,		/* tp_compare */
+        0,		/* tp_repr */
+        0,		/* tp_as_number */
+        0,		/* tp_as_sequence */
+        0,		/* tp_as_mapping */
+        0,		/* tp_hash */
+        0,		/* tp_call */
+        0,		/* tp_str */
+        0,		/* tp_getattro */
+        0,		/* tp_setattro */
+        0,		/* tp_as_buffer */
+        Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE,		/*tp_flags*/
+        0,		/* tp_doc */
+        0,		/* tp_traverse */
+        0,		/* tp_clear */
+        0,		/* tp_richcompare */
+        0,		/* tp_weaklistoffset */
+        0,		/* tp_iter */
+        0,		/* tp_iternext */
+        0,		/* tp_methods */
+        0,		/* tp_members */
+        0,		/* tp_getset */
+        0,		/* tp_base */
+        0,		/* tp_dict */
+        0,		/* tp_descr_get */
+        0,		/* tp_descr_set */
+        0,		/* tp_dictoffset */
+        0,		/* tp_init */
+        0,		/* tp_alloc */
+        0,		/* tp_new */
+        0,		/* tp_free */
+        0,		/* tp_is_gc */
+};
+
+int
+cmpop_validate(PyObject* _obj)
+{
+        struct _cmpop *obj = (struct _cmpop*)_obj;
+        assert(cmpop_Check(_obj));
+        switch(obj->_kind) {
+                case Eq_kind:
+                    return Eq_validate(_obj);
+                case NotEq_kind:
+                    return NotEq_validate(_obj);
+                case Lt_kind:
+                    return Lt_validate(_obj);
+                case LtE_kind:
+                    return LtE_validate(_obj);
+                case Gt_kind:
+                    return Gt_validate(_obj);
+                case GtE_kind:
+                    return GtE_validate(_obj);
+                case Is_kind:
+                    return Is_validate(_obj);
+                case IsNot_kind:
+                    return IsNot_validate(_obj);
+                case In_kind:
+                    return In_validate(_obj);
+                case NotIn_kind:
+                    return NotIn_validate(_obj);
+        }
+        PyErr_SetString(PyExc_TypeError, "invalid _kind in cmpop");
+        return -1;
+}
+PyObject*
+Py_Eq_New()
+{
+        struct _Eq *result = PyObject_New(struct _Eq, &Py_Eq_Type);
+        if (result == NULL)
+                return NULL;
+        return (PyObject*)result;
+}
+
+static void
+Eq_dealloc(PyObject* _self)
+{
+        struct _Eq *self = (struct _Eq*)_self;
+        PyObject_Del(self);
+}
+
+PyTypeObject Py_Eq_Type = {
+        PyObject_HEAD_INIT(NULL)
+        0,		/*ob_size*/
+        "Eq",		/*tp_name*/
+        sizeof(struct _Eq),	/*tp_basicsize*/
+        0,		/* tp_itemsize */
+        Eq_dealloc,		/*tp_dealloc*/
+        0,		/* tp_print */
+        0,		/* tp_getattr */
+        0,		/* tp_setattr */
+        0,		/* tp_compare */
+        0,		/* tp_repr */
+        0,		/* tp_as_number */
+        0,		/* tp_as_sequence */
+        0,		/* tp_as_mapping */
+        0,		/* tp_hash */
+        0,		/* tp_call */
+        0,		/* tp_str */
+        0,		/* tp_getattro */
+        0,		/* tp_setattro */
+        0,		/* tp_as_buffer */
+        Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE,		/*tp_flags*/
+        0,		/* tp_doc */
+        0,		/* tp_traverse */
+        0,		/* tp_clear */
+        0,		/* tp_richcompare */
+        0,		/* tp_weaklistoffset */
+        0,		/* tp_iter */
+        0,		/* tp_iternext */
+        0,		/* tp_methods */
+        0,		/* tp_members */
+        0,		/* tp_getset */
+        0,		/* tp_base */
+        0,		/* tp_dict */
+        0,		/* tp_descr_get */
+        0,		/* tp_descr_set */
+        0,		/* tp_dictoffset */
+        0,		/* tp_init */
+        0,		/* tp_alloc */
+        0,		/* tp_new */
+        0,		/* tp_free */
+        0,		/* tp_is_gc */
+};
+
+static int
+Eq_validate(PyObject *_obj)
+{
+        return 0;
+}
+
+PyObject*
+Py_NotEq_New()
+{
+        struct _NotEq *result = PyObject_New(struct _NotEq, &Py_NotEq_Type);
+        if (result == NULL)
+                return NULL;
+        return (PyObject*)result;
+}
+
+static void
+NotEq_dealloc(PyObject* _self)
+{
+        struct _NotEq *self = (struct _NotEq*)_self;
+        PyObject_Del(self);
+}
+
+PyTypeObject Py_NotEq_Type = {
+        PyObject_HEAD_INIT(NULL)
+        0,		/*ob_size*/
+        "NotEq",		/*tp_name*/
+        sizeof(struct _NotEq),	/*tp_basicsize*/
+        0,		/* tp_itemsize */
+        NotEq_dealloc,		/*tp_dealloc*/
+        0,		/* tp_print */
+        0,		/* tp_getattr */
+        0,		/* tp_setattr */
+        0,		/* tp_compare */
+        0,		/* tp_repr */
+        0,		/* tp_as_number */
+        0,		/* tp_as_sequence */
+        0,		/* tp_as_mapping */
+        0,		/* tp_hash */
+        0,		/* tp_call */
+        0,		/* tp_str */
+        0,		/* tp_getattro */
+        0,		/* tp_setattro */
+        0,		/* tp_as_buffer */
+        Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE,		/*tp_flags*/
+        0,		/* tp_doc */
+        0,		/* tp_traverse */
+        0,		/* tp_clear */
+        0,		/* tp_richcompare */
+        0,		/* tp_weaklistoffset */
+        0,		/* tp_iter */
+        0,		/* tp_iternext */
+        0,		/* tp_methods */
+        0,		/* tp_members */
+        0,		/* tp_getset */
+        0,		/* tp_base */
+        0,		/* tp_dict */
+        0,		/* tp_descr_get */
+        0,		/* tp_descr_set */
+        0,		/* tp_dictoffset */
+        0,		/* tp_init */
+        0,		/* tp_alloc */
+        0,		/* tp_new */
+        0,		/* tp_free */
+        0,		/* tp_is_gc */
+};
+
+static int
+NotEq_validate(PyObject *_obj)
+{
+        return 0;
+}
+
+PyObject*
+Py_Lt_New()
+{
+        struct _Lt *result = PyObject_New(struct _Lt, &Py_Lt_Type);
+        if (result == NULL)
+                return NULL;
+        return (PyObject*)result;
+}
+
+static void
+Lt_dealloc(PyObject* _self)
+{
+        struct _Lt *self = (struct _Lt*)_self;
+        PyObject_Del(self);
+}
+
+PyTypeObject Py_Lt_Type = {
+        PyObject_HEAD_INIT(NULL)
+        0,		/*ob_size*/
+        "Lt",		/*tp_name*/
+        sizeof(struct _Lt),	/*tp_basicsize*/
+        0,		/* tp_itemsize */
+        Lt_dealloc,		/*tp_dealloc*/
+        0,		/* tp_print */
+        0,		/* tp_getattr */
+        0,		/* tp_setattr */
+        0,		/* tp_compare */
+        0,		/* tp_repr */
+        0,		/* tp_as_number */
+        0,		/* tp_as_sequence */
+        0,		/* tp_as_mapping */
+        0,		/* tp_hash */
+        0,		/* tp_call */
+        0,		/* tp_str */
+        0,		/* tp_getattro */
+        0,		/* tp_setattro */
+        0,		/* tp_as_buffer */
+        Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE,		/*tp_flags*/
+        0,		/* tp_doc */
+        0,		/* tp_traverse */
+        0,		/* tp_clear */
+        0,		/* tp_richcompare */
+        0,		/* tp_weaklistoffset */
+        0,		/* tp_iter */
+        0,		/* tp_iternext */
+        0,		/* tp_methods */
+        0,		/* tp_members */
+        0,		/* tp_getset */
+        0,		/* tp_base */
+        0,		/* tp_dict */
+        0,		/* tp_descr_get */
+        0,		/* tp_descr_set */
+        0,		/* tp_dictoffset */
+        0,		/* tp_init */
+        0,		/* tp_alloc */
+        0,		/* tp_new */
+        0,		/* tp_free */
+        0,		/* tp_is_gc */
+};
+
+static int
+Lt_validate(PyObject *_obj)
+{
+        return 0;
+}
+
+PyObject*
+Py_LtE_New()
+{
+        struct _LtE *result = PyObject_New(struct _LtE, &Py_LtE_Type);
+        if (result == NULL)
+                return NULL;
+        return (PyObject*)result;
+}
+
+static void
+LtE_dealloc(PyObject* _self)
+{
+        struct _LtE *self = (struct _LtE*)_self;
+        PyObject_Del(self);
+}
+
+PyTypeObject Py_LtE_Type = {
+        PyObject_HEAD_INIT(NULL)
+        0,		/*ob_size*/
+        "LtE",		/*tp_name*/
+        sizeof(struct _LtE),	/*tp_basicsize*/
+        0,		/* tp_itemsize */
+        LtE_dealloc,		/*tp_dealloc*/
+        0,		/* tp_print */
+        0,		/* tp_getattr */
+        0,		/* tp_setattr */
+        0,		/* tp_compare */
+        0,		/* tp_repr */
+        0,		/* tp_as_number */
+        0,		/* tp_as_sequence */
+        0,		/* tp_as_mapping */
+        0,		/* tp_hash */
+        0,		/* tp_call */
+        0,		/* tp_str */
+        0,		/* tp_getattro */
+        0,		/* tp_setattro */
+        0,		/* tp_as_buffer */
+        Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE,		/*tp_flags*/
+        0,		/* tp_doc */
+        0,		/* tp_traverse */
+        0,		/* tp_clear */
+        0,		/* tp_richcompare */
+        0,		/* tp_weaklistoffset */
+        0,		/* tp_iter */
+        0,		/* tp_iternext */
+        0,		/* tp_methods */
+        0,		/* tp_members */
+        0,		/* tp_getset */
+        0,		/* tp_base */
+        0,		/* tp_dict */
+        0,		/* tp_descr_get */
+        0,		/* tp_descr_set */
+        0,		/* tp_dictoffset */
+        0,		/* tp_init */
+        0,		/* tp_alloc */
+        0,		/* tp_new */
+        0,		/* tp_free */
+        0,		/* tp_is_gc */
+};
+
+static int
+LtE_validate(PyObject *_obj)
+{
+        return 0;
+}
+
+PyObject*
+Py_Gt_New()
+{
+        struct _Gt *result = PyObject_New(struct _Gt, &Py_Gt_Type);
+        if (result == NULL)
+                return NULL;
+        return (PyObject*)result;
+}
+
+static void
+Gt_dealloc(PyObject* _self)
+{
+        struct _Gt *self = (struct _Gt*)_self;
+        PyObject_Del(self);
+}
+
+PyTypeObject Py_Gt_Type = {
+        PyObject_HEAD_INIT(NULL)
+        0,		/*ob_size*/
+        "Gt",		/*tp_name*/
+        sizeof(struct _Gt),	/*tp_basicsize*/
+        0,		/* tp_itemsize */
+        Gt_dealloc,		/*tp_dealloc*/
+        0,		/* tp_print */
+        0,		/* tp_getattr */
+        0,		/* tp_setattr */
+        0,		/* tp_compare */
+        0,		/* tp_repr */
+        0,		/* tp_as_number */
+        0,		/* tp_as_sequence */
+        0,		/* tp_as_mapping */
+        0,		/* tp_hash */
+        0,		/* tp_call */
+        0,		/* tp_str */
+        0,		/* tp_getattro */
+        0,		/* tp_setattro */
+        0,		/* tp_as_buffer */
+        Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE,		/*tp_flags*/
+        0,		/* tp_doc */
+        0,		/* tp_traverse */
+        0,		/* tp_clear */
+        0,		/* tp_richcompare */
+        0,		/* tp_weaklistoffset */
+        0,		/* tp_iter */
+        0,		/* tp_iternext */
+        0,		/* tp_methods */
+        0,		/* tp_members */
+        0,		/* tp_getset */
+        0,		/* tp_base */
+        0,		/* tp_dict */
+        0,		/* tp_descr_get */
+        0,		/* tp_descr_set */
+        0,		/* tp_dictoffset */
+        0,		/* tp_init */
+        0,		/* tp_alloc */
+        0,		/* tp_new */
+        0,		/* tp_free */
+        0,		/* tp_is_gc */
+};
+
+static int
+Gt_validate(PyObject *_obj)
+{
+        return 0;
+}
+
+PyObject*
+Py_GtE_New()
+{
+        struct _GtE *result = PyObject_New(struct _GtE, &Py_GtE_Type);
+        if (result == NULL)
+                return NULL;
+        return (PyObject*)result;
+}
+
+static void
+GtE_dealloc(PyObject* _self)
+{
+        struct _GtE *self = (struct _GtE*)_self;
+        PyObject_Del(self);
+}
+
+PyTypeObject Py_GtE_Type = {
+        PyObject_HEAD_INIT(NULL)
+        0,		/*ob_size*/
+        "GtE",		/*tp_name*/
+        sizeof(struct _GtE),	/*tp_basicsize*/
+        0,		/* tp_itemsize */
+        GtE_dealloc,		/*tp_dealloc*/
+        0,		/* tp_print */
+        0,		/* tp_getattr */
+        0,		/* tp_setattr */
+        0,		/* tp_compare */
+        0,		/* tp_repr */
+        0,		/* tp_as_number */
+        0,		/* tp_as_sequence */
+        0,		/* tp_as_mapping */
+        0,		/* tp_hash */
+        0,		/* tp_call */
+        0,		/* tp_str */
+        0,		/* tp_getattro */
+        0,		/* tp_setattro */
+        0,		/* tp_as_buffer */
+        Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE,		/*tp_flags*/
+        0,		/* tp_doc */
+        0,		/* tp_traverse */
+        0,		/* tp_clear */
+        0,		/* tp_richcompare */
+        0,		/* tp_weaklistoffset */
+        0,		/* tp_iter */
+        0,		/* tp_iternext */
+        0,		/* tp_methods */
+        0,		/* tp_members */
+        0,		/* tp_getset */
+        0,		/* tp_base */
+        0,		/* tp_dict */
+        0,		/* tp_descr_get */
+        0,		/* tp_descr_set */
+        0,		/* tp_dictoffset */
+        0,		/* tp_init */
+        0,		/* tp_alloc */
+        0,		/* tp_new */
+        0,		/* tp_free */
+        0,		/* tp_is_gc */
+};
+
+static int
+GtE_validate(PyObject *_obj)
+{
+        return 0;
+}
+
+PyObject*
+Py_Is_New()
+{
+        struct _Is *result = PyObject_New(struct _Is, &Py_Is_Type);
+        if (result == NULL)
+                return NULL;
+        return (PyObject*)result;
+}
+
+static void
+Is_dealloc(PyObject* _self)
+{
+        struct _Is *self = (struct _Is*)_self;
+        PyObject_Del(self);
+}
+
+PyTypeObject Py_Is_Type = {
+        PyObject_HEAD_INIT(NULL)
+        0,		/*ob_size*/
+        "Is",		/*tp_name*/
+        sizeof(struct _Is),	/*tp_basicsize*/
+        0,		/* tp_itemsize */
+        Is_dealloc,		/*tp_dealloc*/
+        0,		/* tp_print */
+        0,		/* tp_getattr */
+        0,		/* tp_setattr */
+        0,		/* tp_compare */
+        0,		/* tp_repr */
+        0,		/* tp_as_number */
+        0,		/* tp_as_sequence */
+        0,		/* tp_as_mapping */
+        0,		/* tp_hash */
+        0,		/* tp_call */
+        0,		/* tp_str */
+        0,		/* tp_getattro */
+        0,		/* tp_setattro */
+        0,		/* tp_as_buffer */
+        Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE,		/*tp_flags*/
+        0,		/* tp_doc */
+        0,		/* tp_traverse */
+        0,		/* tp_clear */
+        0,		/* tp_richcompare */
+        0,		/* tp_weaklistoffset */
+        0,		/* tp_iter */
+        0,		/* tp_iternext */
+        0,		/* tp_methods */
+        0,		/* tp_members */
+        0,		/* tp_getset */
+        0,		/* tp_base */
+        0,		/* tp_dict */
+        0,		/* tp_descr_get */
+        0,		/* tp_descr_set */
+        0,		/* tp_dictoffset */
+        0,		/* tp_init */
+        0,		/* tp_alloc */
+        0,		/* tp_new */
+        0,		/* tp_free */
+        0,		/* tp_is_gc */
+};
+
+static int
+Is_validate(PyObject *_obj)
+{
+        return 0;
+}
+
+PyObject*
+Py_IsNot_New()
+{
+        struct _IsNot *result = PyObject_New(struct _IsNot, &Py_IsNot_Type);
+        if (result == NULL)
+                return NULL;
+        return (PyObject*)result;
+}
+
+static void
+IsNot_dealloc(PyObject* _self)
+{
+        struct _IsNot *self = (struct _IsNot*)_self;
+        PyObject_Del(self);
+}
+
+PyTypeObject Py_IsNot_Type = {
+        PyObject_HEAD_INIT(NULL)
+        0,		/*ob_size*/
+        "IsNot",		/*tp_name*/
+        sizeof(struct _IsNot),	/*tp_basicsize*/
+        0,		/* tp_itemsize */
+        IsNot_dealloc,		/*tp_dealloc*/
+        0,		/* tp_print */
+        0,		/* tp_getattr */
+        0,		/* tp_setattr */
+        0,		/* tp_compare */
+        0,		/* tp_repr */
+        0,		/* tp_as_number */
+        0,		/* tp_as_sequence */
+        0,		/* tp_as_mapping */
+        0,		/* tp_hash */
+        0,		/* tp_call */
+        0,		/* tp_str */
+        0,		/* tp_getattro */
+        0,		/* tp_setattro */
+        0,		/* tp_as_buffer */
+        Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE,		/*tp_flags*/
+        0,		/* tp_doc */
+        0,		/* tp_traverse */
+        0,		/* tp_clear */
+        0,		/* tp_richcompare */
+        0,		/* tp_weaklistoffset */
+        0,		/* tp_iter */
+        0,		/* tp_iternext */
+        0,		/* tp_methods */
+        0,		/* tp_members */
+        0,		/* tp_getset */
+        0,		/* tp_base */
+        0,		/* tp_dict */
+        0,		/* tp_descr_get */
+        0,		/* tp_descr_set */
+        0,		/* tp_dictoffset */
+        0,		/* tp_init */
+        0,		/* tp_alloc */
+        0,		/* tp_new */
+        0,		/* tp_free */
+        0,		/* tp_is_gc */
+};
+
+static int
+IsNot_validate(PyObject *_obj)
+{
+        return 0;
+}
+
+PyObject*
+Py_In_New()
+{
+        struct _In *result = PyObject_New(struct _In, &Py_In_Type);
+        if (result == NULL)
+                return NULL;
+        return (PyObject*)result;
+}
+
+static void
+In_dealloc(PyObject* _self)
+{
+        struct _In *self = (struct _In*)_self;
+        PyObject_Del(self);
+}
+
+PyTypeObject Py_In_Type = {
+        PyObject_HEAD_INIT(NULL)
+        0,		/*ob_size*/
+        "In",		/*tp_name*/
+        sizeof(struct _In),	/*tp_basicsize*/
+        0,		/* tp_itemsize */
+        In_dealloc,		/*tp_dealloc*/
+        0,		/* tp_print */
+        0,		/* tp_getattr */
+        0,		/* tp_setattr */
+        0,		/* tp_compare */
+        0,		/* tp_repr */
+        0,		/* tp_as_number */
+        0,		/* tp_as_sequence */
+        0,		/* tp_as_mapping */
+        0,		/* tp_hash */
+        0,		/* tp_call */
+        0,		/* tp_str */
+        0,		/* tp_getattro */
+        0,		/* tp_setattro */
+        0,		/* tp_as_buffer */
+        Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE,		/*tp_flags*/
+        0,		/* tp_doc */
+        0,		/* tp_traverse */
+        0,		/* tp_clear */
+        0,		/* tp_richcompare */
+        0,		/* tp_weaklistoffset */
+        0,		/* tp_iter */
+        0,		/* tp_iternext */
+        0,		/* tp_methods */
+        0,		/* tp_members */
+        0,		/* tp_getset */
+        0,		/* tp_base */
+        0,		/* tp_dict */
+        0,		/* tp_descr_get */
+        0,		/* tp_descr_set */
+        0,		/* tp_dictoffset */
+        0,		/* tp_init */
+        0,		/* tp_alloc */
+        0,		/* tp_new */
+        0,		/* tp_free */
+        0,		/* tp_is_gc */
+};
+
+static int
+In_validate(PyObject *_obj)
+{
+        return 0;
+}
+
+PyObject*
+Py_NotIn_New()
+{
+        struct _NotIn *result = PyObject_New(struct _NotIn, &Py_NotIn_Type);
+        if (result == NULL)
+                return NULL;
+        return (PyObject*)result;
+}
+
+static void
+NotIn_dealloc(PyObject* _self)
+{
+        struct _NotIn *self = (struct _NotIn*)_self;
+        PyObject_Del(self);
+}
+
+PyTypeObject Py_NotIn_Type = {
+        PyObject_HEAD_INIT(NULL)
+        0,		/*ob_size*/
+        "NotIn",		/*tp_name*/
+        sizeof(struct _NotIn),	/*tp_basicsize*/
+        0,		/* tp_itemsize */
+        NotIn_dealloc,		/*tp_dealloc*/
+        0,		/* tp_print */
+        0,		/* tp_getattr */
+        0,		/* tp_setattr */
+        0,		/* tp_compare */
+        0,		/* tp_repr */
+        0,		/* tp_as_number */
+        0,		/* tp_as_sequence */
+        0,		/* tp_as_mapping */
+        0,		/* tp_hash */
+        0,		/* tp_call */
+        0,		/* tp_str */
+        0,		/* tp_getattro */
+        0,		/* tp_setattro */
+        0,		/* tp_as_buffer */
+        Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE,		/*tp_flags*/
+        0,		/* tp_doc */
+        0,		/* tp_traverse */
+        0,		/* tp_clear */
+        0,		/* tp_richcompare */
+        0,		/* tp_weaklistoffset */
+        0,		/* tp_iter */
+        0,		/* tp_iternext */
+        0,		/* tp_methods */
+        0,		/* tp_members */
+        0,		/* tp_getset */
+        0,		/* tp_base */
+        0,		/* tp_dict */
+        0,		/* tp_descr_get */
+        0,		/* tp_descr_set */
+        0,		/* tp_dictoffset */
+        0,		/* tp_init */
+        0,		/* tp_alloc */
+        0,		/* tp_new */
+        0,		/* tp_free */
+        0,		/* tp_is_gc */
+};
+
+static int
+NotIn_validate(PyObject *_obj)
+{
+        return 0;
+}
+
+PyObject*
+Py_comprehension_New(PyObject* target, PyObject* iter, PyObject* ifs)
+{
+        struct _comprehension *result = PyObject_New(struct _comprehension, &Py_comprehension_Type);
+        if (result == NULL)
+                return NULL;
+        Py_INCREF(target);
+        result->target = target;
+        Py_INCREF(iter);
+        result->iter = iter;
+        Py_INCREF(ifs);
+        result->ifs = ifs;
+        return (PyObject*)result;
+}
+
+static void
+comprehension_dealloc(PyObject* _self)
+{
+        struct _comprehension *self = (struct _comprehension*)_self;
+        Py_DECREF(self->target);
+        Py_DECREF(self->iter);
+        Py_DECREF(self->ifs);
+        PyObject_Del(self);
+}
+
+PyTypeObject Py_comprehension_Type = {
+        PyObject_HEAD_INIT(NULL)
+        0,		/*ob_size*/
+        "comprehension",		/*tp_name*/
+        sizeof(struct _comprehension),	/*tp_basicsize*/
+        0,		/* tp_itemsize */
+        comprehension_dealloc,		/*tp_dealloc*/
+        0,		/* tp_print */
+        0,		/* tp_getattr */
+        0,		/* tp_setattr */
+        0,		/* tp_compare */
+        0,		/* tp_repr */
+        0,		/* tp_as_number */
+        0,		/* tp_as_sequence */
+        0,		/* tp_as_mapping */
+        0,		/* tp_hash */
+        0,		/* tp_call */
+        0,		/* tp_str */
+        0,		/* tp_getattro */
+        0,		/* tp_setattro */
+        0,		/* tp_as_buffer */
+        Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE,		/*tp_flags*/
+        0,		/* tp_doc */
+        0,		/* tp_traverse */
+        0,		/* tp_clear */
+        0,		/* tp_richcompare */
+        0,		/* tp_weaklistoffset */
+        0,		/* tp_iter */
+        0,		/* tp_iternext */
+        0,		/* tp_methods */
+        0,		/* tp_members */
+        0,		/* tp_getset */
+        0,		/* tp_base */
+        0,		/* tp_dict */
+        0,		/* tp_descr_get */
+        0,		/* tp_descr_set */
+        0,		/* tp_dictoffset */
+        0,		/* tp_init */
+        0,		/* tp_alloc */
+        0,		/* tp_new */
+        0,		/* tp_free */
+        0,		/* tp_is_gc */
+};
+
+static int
+comprehension_validate(PyObject *_obj)
+{
+        struct _comprehension *obj = (struct _comprehension*)_obj;
+        int i;
+        if (!expr_Check(obj->target)) {
+            failed_check("target", "expr", obj->target);
+            return -1;
+        }
+        if (!expr_Check(obj->iter)) {
+            failed_check("iter", "expr", obj->iter);
+            return -1;
+        }
+        if (!PyList_Check(obj->ifs)) {
+           failed_check("ifs", "list", obj->ifs);
+           return -1;
+        }
+        for(i = 0; i < PyList_Size(obj->ifs); i++) {
+                if (!expr_Check(PyList_GET_ITEM(obj->ifs, i))) {
+                    failed_check("ifs", "expr", PyList_GET_ITEM(obj->ifs, i));
+                    return -1;
+                }
+                if (expr_validate(PyList_GET_ITEM(obj->ifs, i)) < 0)
+                    return -1;
+        }
+        return 0;
+}
+
+PyObject*
+Py_excepthandler_New(PyObject* type, PyObject* name, PyObject* body)
+{
+        struct _excepthandler *result = PyObject_New(struct _excepthandler, &Py_excepthandler_Type);
+        if (result == NULL)
+                return NULL;
+        Py_INCREF(type);
+        result->type = type;
+        Py_INCREF(name);
+        result->name = name;
+        Py_INCREF(body);
+        result->body = body;
+        return (PyObject*)result;
+}
+
+static void
+excepthandler_dealloc(PyObject* _self)
+{
+        struct _excepthandler *self = (struct _excepthandler*)_self;
+        Py_DECREF(self->type);
+        Py_DECREF(self->name);
+        Py_DECREF(self->body);
+        PyObject_Del(self);
+}
+
+PyTypeObject Py_excepthandler_Type = {
+        PyObject_HEAD_INIT(NULL)
+        0,		/*ob_size*/
+        "excepthandler",		/*tp_name*/
+        sizeof(struct _excepthandler),	/*tp_basicsize*/
+        0,		/* tp_itemsize */
+        excepthandler_dealloc,		/*tp_dealloc*/
+        0,		/* tp_print */
+        0,		/* tp_getattr */
+        0,		/* tp_setattr */
+        0,		/* tp_compare */
+        0,		/* tp_repr */
+        0,		/* tp_as_number */
+        0,		/* tp_as_sequence */
+        0,		/* tp_as_mapping */
+        0,		/* tp_hash */
+        0,		/* tp_call */
+        0,		/* tp_str */
+        0,		/* tp_getattro */
+        0,		/* tp_setattro */
+        0,		/* tp_as_buffer */
+        Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE,		/*tp_flags*/
+        0,		/* tp_doc */
+        0,		/* tp_traverse */
+        0,		/* tp_clear */
+        0,		/* tp_richcompare */
+        0,		/* tp_weaklistoffset */
+        0,		/* tp_iter */
+        0,		/* tp_iternext */
+        0,		/* tp_methods */
+        0,		/* tp_members */
+        0,		/* tp_getset */
+        0,		/* tp_base */
+        0,		/* tp_dict */
+        0,		/* tp_descr_get */
+        0,		/* tp_descr_set */
+        0,		/* tp_dictoffset */
+        0,		/* tp_init */
+        0,		/* tp_alloc */
+        0,		/* tp_new */
+        0,		/* tp_free */
+        0,		/* tp_is_gc */
+};
+
+static int
+excepthandler_validate(PyObject *_obj)
+{
+        struct _excepthandler *obj = (struct _excepthandler*)_obj;
+        int i;
+        if (obj->type != Py_None) /* empty */;
+        else if (!expr_Check(obj->type)) {
+            failed_check("type", "expr", obj->type);
+            return -1;
+        }
+        else if (expr_validate(obj->type) < 0)
+            return -1;
+        if (obj->name != Py_None) /* empty */;
+        else if (!expr_Check(obj->name)) {
+            failed_check("name", "expr", obj->name);
+            return -1;
+        }
+        else if (expr_validate(obj->name) < 0)
+            return -1;
+        if (!PyList_Check(obj->body)) {
+           failed_check("body", "list", obj->body);
+           return -1;
+        }
+        for(i = 0; i < PyList_Size(obj->body); i++) {
+                if (!stmt_Check(PyList_GET_ITEM(obj->body, i))) {
+                    failed_check("body", "stmt", PyList_GET_ITEM(obj->body, i));
+                    return -1;
+                }
+                if (stmt_validate(PyList_GET_ITEM(obj->body, i)) < 0)
+                    return -1;
+        }
+        return 0;
+}
+
+PyObject*
+Py_arguments_New(PyObject* args, PyObject* vararg, PyObject* kwarg, PyObject*
+                 defaults)
+{
+        struct _arguments *result = PyObject_New(struct _arguments, &Py_arguments_Type);
+        if (result == NULL)
+                return NULL;
+        Py_INCREF(args);
+        result->args = args;
+        Py_INCREF(vararg);
+        result->vararg = vararg;
         Py_INCREF(kwarg);
         result->kwarg = kwarg;
         Py_INCREF(defaults);
@@ -3597,6 +7570,49 @@
         0,		/* tp_is_gc */
 };
 
+static int
+arguments_validate(PyObject *_obj)
+{
+        struct _arguments *obj = (struct _arguments*)_obj;
+        int i;
+        if (!PyList_Check(obj->args)) {
+           failed_check("args", "list", obj->args);
+           return -1;
+        }
+        for(i = 0; i < PyList_Size(obj->args); i++) {
+                if (!expr_Check(PyList_GET_ITEM(obj->args, i))) {
+                    failed_check("args", "expr", PyList_GET_ITEM(obj->args, i));
+                    return -1;
+                }
+                if (expr_validate(PyList_GET_ITEM(obj->args, i)) < 0)
+                    return -1;
+        }
+        if (obj->vararg != Py_None) /* empty */;
+        else if (!PyString_Check(obj->vararg)) {
+            failed_check("vararg", "identifier", obj->vararg);
+            return -1;
+        }
+        if (obj->kwarg != Py_None) /* empty */;
+        else if (!PyString_Check(obj->kwarg)) {
+            failed_check("kwarg", "identifier", obj->kwarg);
+            return -1;
+        }
+        if (!PyList_Check(obj->defaults)) {
+           failed_check("defaults", "list", obj->defaults);
+           return -1;
+        }
+        for(i = 0; i < PyList_Size(obj->defaults); i++) {
+                if (!expr_Check(PyList_GET_ITEM(obj->defaults, i))) {
+                    failed_check("defaults", "expr",
+                                 PyList_GET_ITEM(obj->defaults, i));
+                    return -1;
+                }
+                if (expr_validate(PyList_GET_ITEM(obj->defaults, i)) < 0)
+                    return -1;
+        }
+        return 0;
+}
+
 PyObject*
 Py_keyword_New(PyObject* arg, PyObject* value)
 {
@@ -3663,6 +7679,21 @@
         0,		/* tp_is_gc */
 };
 
+static int
+keyword_validate(PyObject *_obj)
+{
+        struct _keyword *obj = (struct _keyword*)_obj;
+        if (!PyString_Check(obj->arg)) {
+            failed_check("arg", "identifier", obj->arg);
+            return -1;
+        }
+        if (!expr_Check(obj->value)) {
+            failed_check("value", "expr", obj->value);
+            return -1;
+        }
+        return 0;
+}
+
 PyObject*
 Py_alias_New(PyObject* name, PyObject* asname)
 {
@@ -3729,6 +7760,58 @@
         0,		/* tp_is_gc */
 };
 
+static int
+alias_validate(PyObject *_obj)
+{
+        struct _alias *obj = (struct _alias*)_obj;
+        if (!PyString_Check(obj->name)) {
+            failed_check("name", "identifier", obj->name);
+            return -1;
+        }
+        if (obj->asname != Py_None) /* empty */;
+        else if (!PyString_Check(obj->asname)) {
+            failed_check("asname", "identifier", obj->asname);
+            return -1;
+        }
+        return 0;
+}
+
+
+int PyAST_Validate(PyObject *obj)
+{
+        if (mod_Check(obj))
+                return mod_validate(obj);
+        if (stmt_Check(obj))
+                return stmt_validate(obj);
+        if (expr_Check(obj))
+                return expr_validate(obj);
+        if (expr_context_Check(obj))
+                return expr_context_validate(obj);
+        if (slice_Check(obj))
+                return slice_validate(obj);
+        if (boolop_Check(obj))
+                return boolop_validate(obj);
+        if (operator_Check(obj))
+                return operator_validate(obj);
+        if (unaryop_Check(obj))
+                return unaryop_validate(obj);
+        if (cmpop_Check(obj))
+                return cmpop_validate(obj);
+        if (comprehension_Check(obj))
+                return comprehension_validate(obj);
+        if (excepthandler_Check(obj))
+                return excepthandler_validate(obj);
+        if (arguments_Check(obj))
+                return arguments_validate(obj);
+        if (keyword_Check(obj))
+                return keyword_validate(obj);
+        if (alias_Check(obj))
+                return alias_validate(obj);
+        PyErr_Format(PyExc_TypeError, "Not an AST node: %s",
+                     obj->ob_type->tp_name);
+        return -1;
+}
+
 
 void init_ast(void)
 {
@@ -3870,6 +7953,26 @@
         Py_Tuple_Type.tp_base = &Py_expr_Type;
         if (PyType_Ready(&Py_Tuple_Type) < 0)
                 return;
+        if (PyType_Ready(&Py_expr_context_Type) < 0)
+                return;
+        Py_Load_Type.tp_base = &Py_expr_context_Type;
+        if (PyType_Ready(&Py_Load_Type) < 0)
+                return;
+        Py_Store_Type.tp_base = &Py_expr_context_Type;
+        if (PyType_Ready(&Py_Store_Type) < 0)
+                return;
+        Py_Del_Type.tp_base = &Py_expr_context_Type;
+        if (PyType_Ready(&Py_Del_Type) < 0)
+                return;
+        Py_AugLoad_Type.tp_base = &Py_expr_context_Type;
+        if (PyType_Ready(&Py_AugLoad_Type) < 0)
+                return;
+        Py_AugStore_Type.tp_base = &Py_expr_context_Type;
+        if (PyType_Ready(&Py_AugStore_Type) < 0)
+                return;
+        Py_Param_Type.tp_base = &Py_expr_context_Type;
+        if (PyType_Ready(&Py_Param_Type) < 0)
+                return;
         if (PyType_Ready(&Py_slice_Type) < 0)
                 return;
         Py_Ellipsis_Type.tp_base = &Py_slice_Type;
@@ -3884,6 +7987,98 @@
         Py_Index_Type.tp_base = &Py_slice_Type;
         if (PyType_Ready(&Py_Index_Type) < 0)
                 return;
+        if (PyType_Ready(&Py_boolop_Type) < 0)
+                return;
+        Py_And_Type.tp_base = &Py_boolop_Type;
+        if (PyType_Ready(&Py_And_Type) < 0)
+                return;
+        Py_Or_Type.tp_base = &Py_boolop_Type;
+        if (PyType_Ready(&Py_Or_Type) < 0)
+                return;
+        if (PyType_Ready(&Py_operator_Type) < 0)
+                return;
+        Py_Add_Type.tp_base = &Py_operator_Type;
+        if (PyType_Ready(&Py_Add_Type) < 0)
+                return;
+        Py_Sub_Type.tp_base = &Py_operator_Type;
+        if (PyType_Ready(&Py_Sub_Type) < 0)
+                return;
+        Py_Mult_Type.tp_base = &Py_operator_Type;
+        if (PyType_Ready(&Py_Mult_Type) < 0)
+                return;
+        Py_Div_Type.tp_base = &Py_operator_Type;
+        if (PyType_Ready(&Py_Div_Type) < 0)
+                return;
+        Py_Mod_Type.tp_base = &Py_operator_Type;
+        if (PyType_Ready(&Py_Mod_Type) < 0)
+                return;
+        Py_Pow_Type.tp_base = &Py_operator_Type;
+        if (PyType_Ready(&Py_Pow_Type) < 0)
+                return;
+        Py_LShift_Type.tp_base = &Py_operator_Type;
+        if (PyType_Ready(&Py_LShift_Type) < 0)
+                return;
+        Py_RShift_Type.tp_base = &Py_operator_Type;
+        if (PyType_Ready(&Py_RShift_Type) < 0)
+                return;
+        Py_BitOr_Type.tp_base = &Py_operator_Type;
+        if (PyType_Ready(&Py_BitOr_Type) < 0)
+                return;
+        Py_BitXor_Type.tp_base = &Py_operator_Type;
+        if (PyType_Ready(&Py_BitXor_Type) < 0)
+                return;
+        Py_BitAnd_Type.tp_base = &Py_operator_Type;
+        if (PyType_Ready(&Py_BitAnd_Type) < 0)
+                return;
+        Py_FloorDiv_Type.tp_base = &Py_operator_Type;
+        if (PyType_Ready(&Py_FloorDiv_Type) < 0)
+                return;
+        if (PyType_Ready(&Py_unaryop_Type) < 0)
+                return;
+        Py_Invert_Type.tp_base = &Py_unaryop_Type;
+        if (PyType_Ready(&Py_Invert_Type) < 0)
+                return;
+        Py_Not_Type.tp_base = &Py_unaryop_Type;
+        if (PyType_Ready(&Py_Not_Type) < 0)
+                return;
+        Py_UAdd_Type.tp_base = &Py_unaryop_Type;
+        if (PyType_Ready(&Py_UAdd_Type) < 0)
+                return;
+        Py_USub_Type.tp_base = &Py_unaryop_Type;
+        if (PyType_Ready(&Py_USub_Type) < 0)
+                return;
+        if (PyType_Ready(&Py_cmpop_Type) < 0)
+                return;
+        Py_Eq_Type.tp_base = &Py_cmpop_Type;
+        if (PyType_Ready(&Py_Eq_Type) < 0)
+                return;
+        Py_NotEq_Type.tp_base = &Py_cmpop_Type;
+        if (PyType_Ready(&Py_NotEq_Type) < 0)
+                return;
+        Py_Lt_Type.tp_base = &Py_cmpop_Type;
+        if (PyType_Ready(&Py_Lt_Type) < 0)
+                return;
+        Py_LtE_Type.tp_base = &Py_cmpop_Type;
+        if (PyType_Ready(&Py_LtE_Type) < 0)
+                return;
+        Py_Gt_Type.tp_base = &Py_cmpop_Type;
+        if (PyType_Ready(&Py_Gt_Type) < 0)
+                return;
+        Py_GtE_Type.tp_base = &Py_cmpop_Type;
+        if (PyType_Ready(&Py_GtE_Type) < 0)
+                return;
+        Py_Is_Type.tp_base = &Py_cmpop_Type;
+        if (PyType_Ready(&Py_Is_Type) < 0)
+                return;
+        Py_IsNot_Type.tp_base = &Py_cmpop_Type;
+        if (PyType_Ready(&Py_IsNot_Type) < 0)
+                return;
+        Py_In_Type.tp_base = &Py_cmpop_Type;
+        if (PyType_Ready(&Py_In_Type) < 0)
+                return;
+        Py_NotIn_Type.tp_base = &Py_cmpop_Type;
+        if (PyType_Ready(&Py_NotIn_Type) < 0)
+                return;
         if (PyType_Ready(&Py_comprehension_Type) < 0)
                 return;
         if (PyType_Ready(&Py_excepthandler_Type) < 0)


More information about the Python-checkins mailing list