From 38d27e9219cc2e9f7e8b0a1f5339ee1846aa4537 Mon Sep 17 00:00:00 2001 From: Stefan Behnel Date: Thu, 11 Nov 2010 14:32:32 +0100 Subject: [PATCH] skip None checks on a node if we know its constant value as being not None --- Cython/Compiler/ExprNodes.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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 -- 2.26.2