From bbc4c9e2014ce3952fe9d928d545e8ffd2a52957 Mon Sep 17 00:00:00 2001 From: Stefan Behnel <scoder@users.berlios.de> Date: Mon, 3 Oct 2011 09:58:01 +0200 Subject: [PATCH] fix in-place operations again: type inference may not work in advance --- Cython/Compiler/ExprNodes.py | 4 ++-- Cython/Compiler/FlowControl.py | 4 +--- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/Cython/Compiler/ExprNodes.py b/Cython/Compiler/ExprNodes.py index 26424d5ae..85b44b255 100755 --- a/Cython/Compiler/ExprNodes.py +++ b/Cython/Compiler/ExprNodes.py @@ -704,7 +704,7 @@ class ExprNode(Node): return self.result_in_temp() def may_be_none(self): - if not self.type.is_pyobject: + if self.type and 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 @@ -1530,7 +1530,7 @@ class NameNode(AtomicExprNode): return 1 def may_be_none(self): - if self.type.is_pyobject and self.cf_state: + if self.cf_state and self.type and self.type.is_pyobject: # gard against infinite recursion on self-dependencies if getattr(self, '_none_checking', False): # self-dependency - either this node receives a None diff --git a/Cython/Compiler/FlowControl.py b/Cython/Compiler/FlowControl.py index 6d93687e8..960a6714c 100644 --- a/Cython/Compiler/FlowControl.py +++ b/Cython/Compiler/FlowControl.py @@ -711,9 +711,7 @@ class CreateControlFlowGraph(CythonTransform): self.in_inplace_assignment = True self.visitchildren(node) self.in_inplace_assignment = False - expr_node = node.create_binop_node() - expr_node.type = expr_node.infer_type(self.env) - self.mark_assignment(node.lhs, expr_node) + self.mark_assignment(node.lhs, node.create_binop_node()) return node def visit_DelStatNode(self, node): -- 2.30.9