From 310140c7515718a665f13d7921a71b1257c95059 Mon Sep 17 00:00:00 2001 From: Robert Bradshaw Date: Mon, 3 Nov 2008 18:10:15 -0800 Subject: [PATCH] Fix compiler crash on error. --- Cython/Compiler/Optimize.py | 2 ++ 1 file changed, 2 insertions(+) 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) -- 2.26.2