Commit bbc4c9e2 authored by Stefan Behnel's avatar Stefan Behnel

fix in-place operations again: type inference may not work in advance

parent 47a94155
...@@ -704,7 +704,7 @@ class ExprNode(Node): ...@@ -704,7 +704,7 @@ class ExprNode(Node):
return self.result_in_temp() return self.result_in_temp()
def may_be_none(self): def may_be_none(self):
if not self.type.is_pyobject: if self.type and not self.type.is_pyobject:
return False return False
if self.constant_result not in (not_a_constant, constant_value_not_set): if self.constant_result not in (not_a_constant, constant_value_not_set):
return self.constant_result is not None return self.constant_result is not None
...@@ -1530,7 +1530,7 @@ class NameNode(AtomicExprNode): ...@@ -1530,7 +1530,7 @@ class NameNode(AtomicExprNode):
return 1 return 1
def may_be_none(self): 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 # gard against infinite recursion on self-dependencies
if getattr(self, '_none_checking', False): if getattr(self, '_none_checking', False):
# self-dependency - either this node receives a None # self-dependency - either this node receives a None
......
...@@ -711,9 +711,7 @@ class CreateControlFlowGraph(CythonTransform): ...@@ -711,9 +711,7 @@ class CreateControlFlowGraph(CythonTransform):
self.in_inplace_assignment = True self.in_inplace_assignment = True
self.visitchildren(node) self.visitchildren(node)
self.in_inplace_assignment = False self.in_inplace_assignment = False
expr_node = node.create_binop_node() self.mark_assignment(node.lhs, node.create_binop_node())
expr_node.type = expr_node.infer_type(self.env)
self.mark_assignment(node.lhs, expr_node)
return node return node
def visit_DelStatNode(self, node): def visit_DelStatNode(self, node):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment