From e4d09f3d6335c9947c0e02b6f5097fc1d424e7d5 Mon Sep 17 00:00:00 2001 From: Robert Bradshaw Date: Fri, 26 Oct 2007 16:16:07 -0700 Subject: [PATCH] Fix crash on undeclared builtin --- Cython/Compiler/ExprNodes.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Cython/Compiler/ExprNodes.py b/Cython/Compiler/ExprNodes.py index cd9b71ff..4c3b5004 100644 --- a/Cython/Compiler/ExprNodes.py +++ b/Cython/Compiler/ExprNodes.py @@ -742,7 +742,7 @@ class NameNode(AtomicExprNode): #print "NameNode.coerce_to:", self.name, dst_type ### if dst_type is py_object_type: entry = self.entry - if entry.is_cfunction: + if entry and entry.is_cfunction: var_entry = entry.as_variable if var_entry: node = NameNode(self.pos, name = self.name) @@ -779,6 +779,9 @@ class NameNode(AtomicExprNode): self.entry = env.lookup(self.name) if not self.entry: self.entry = env.declare_builtin(self.name, self.pos) + if not self.entry: + self.type = PyrexTypes.error_type + return self.analyse_rvalue_entry(env) def analyse_target_types(self, env): -- 2.26.2