From: Robert Bradshaw Date: Tue, 4 Nov 2008 02:10:15 +0000 (-0800) Subject: Fix compiler crash on error. X-Git-Tag: 0.10~3 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=310140c7515718a665f13d7921a71b1257c95059;p=cython.git Fix compiler crash on error. --- diff --git a/Cython/Compiler/Optimize.py b/Cython/Compiler/Optimize.py index 84f7d4e3..e02f5b78 100644 --- a/Cython/Compiler/Optimize.py +++ b/Cython/Compiler/Optimize.py @@ -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)