skip None checks on a node if we know its constant value as being not None
authorStefan Behnel <scoder@users.berlios.de>
Thu, 11 Nov 2010 13:32:32 +0000 (14:32 +0100)
committerStefan Behnel <scoder@users.berlios.de>
Thu, 11 Nov 2010 13:32:32 +0000 (14:32 +0100)
Cython/Compiler/ExprNodes.py

index 4ff284cad489e6870484d7d44d9309fbfd93cabc..988048bd1c00a81af1bd15eae6ae4ffb93a1d498 100755 (executable)
@@ -651,7 +651,11 @@ class ExprNode(Node):
         return self.result_in_temp()
 
     def may_be_none(self):
-        return self.type.is_pyobject
+        if not self.type.is_pyobject:
+            return False
+        if self.constant_result not in (not_a_constant, constant_value_not_set):
+            return self.constant_result is not None
+        return True
 
     def as_cython_attribute(self):
         return None