Index: constructor.py
===================================================================
--- constructor.py	(revision 418)
+++ constructor.py	(working copy)
@@ -6,6 +6,7 @@
 from nodes import *
 
 import datetime
+import types
 
 try:
     set
@@ -37,10 +38,6 @@
         if self.check_node():
             return self.construct_document(self.get_node())
 
-    def g(): yield None
-    generator_type = type(g())
-    del g
-
     def construct_document(self, node):
         data = self.construct_object(node)
         while self.state_generators:
@@ -91,7 +88,7 @@
             data = constructor(self, node)
         else:
             data = constructor(self, tag_suffix, node)
-        if isinstance(data, self.generator_type):
+        if isinstance(data, types.GeneratorType):
             generator = data
             data = generator.next()
             if self.deep_construct:
Index: representer.py
===================================================================
--- representer.py	(revision 418)
+++ representer.py	(working copy)
@@ -6,6 +6,7 @@
 from nodes import *
 
 import datetime
+import types
 
 try:
     set
@@ -36,17 +37,12 @@
         self.object_keeper = []
         self.alias_key = None
 
-    class C: pass
-    c = C()
-    def f(): pass
-    def g(): yield None
-    classobj_type = type(C)
-    instance_type = type(c)
-    function_type = type(f)
-    generator_type = type(g())
-    builtin_function_type = type(abs)
-    module_type = type(sys)
-    del C, c, f, g
+    classobj_type = types.ClassType
+    instance_type = types.InstanceType
+    function_type = types.FunctionType
+    generator_type = types.GeneratorType
+    builtin_function_type = types.BuiltinFunctionType
+    module_type = types.ModuleType
 
     def get_classobj_bases(self, cls):
         bases = [cls]
