From: Stefan Behnel Date: Thu, 11 Nov 2010 13:32:32 +0000 (+0100) Subject: skip None checks on a node if we know its constant value as being not None X-Git-Tag: 0.14.alpha0~191 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=38d27e9219cc2e9f7e8b0a1f5339ee1846aa4537;p=cython.git skip None checks on a node if we know its constant value as being not None --- diff --git a/Cython/Compiler/ExprNodes.py b/Cython/Compiler/ExprNodes.py index 4ff284ca..988048bd 100755 --- a/Cython/Compiler/ExprNodes.py +++ b/Cython/Compiler/ExprNodes.py @@ -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