Fix compiler crash on error.
authorRobert Bradshaw <robertwb@math.washington.edu>
Tue, 4 Nov 2008 02:10:15 +0000 (18:10 -0800)
committerRobert Bradshaw <robertwb@math.washington.edu>
Tue, 4 Nov 2008 02:10:15 +0000 (18:10 -0800)
Cython/Compiler/Optimize.py

index 84f7d4e3ad1bc8deacc3fefe5753c1c47f86fa64..e02f5b78753546d203636fc45821d3da3491e0be 100644 (file)
@@ -167,6 +167,8 @@ class FinalOptimizePhase(Visitor.CythonTransform):
                 if type_arg.type.is_builtin_type and type_arg.type.name == 'type':
                     object_module = self.context.find_module('python_object')
                     node.function.entry = object_module.lookup('PyObject_TypeCheck')
+                    if node.function.entry is None:
+                        return node # only happens when there was an error earlier
                     node.function.type = node.function.entry.type
                     PyTypeObjectPtr = PyrexTypes.CPtrType(object_module.lookup('PyTypeObject').type)
                     node.args[1] = ExprNodes.CastNode(node.args[1], PyTypeObjectPtr)