Fix crash on undeclared builtin
authorRobert Bradshaw <robertwb@math.washington.edu>
Fri, 26 Oct 2007 23:16:07 +0000 (16:16 -0700)
committerRobert Bradshaw <robertwb@math.washington.edu>
Fri, 26 Oct 2007 23:16:07 +0000 (16:16 -0700)
Cython/Compiler/ExprNodes.py

index cd9b71ffb9ef56dc71d01c5cc8c37fc164525c48..4c3b50040991e468ca842d310fac9753512e2d8d 100644 (file)
@@ -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):