Commit 45dea6aa authored by Vitja Makarov's avatar Vitja Makarov

Visit lhs if not name and not sequence, fix #739

parent 4236478d
...@@ -638,10 +638,6 @@ class CreateControlFlowGraph(CythonTransform): ...@@ -638,10 +638,6 @@ class CreateControlFlowGraph(CythonTransform):
self.flow.block.add_child(exc_descr.entry_point) self.flow.block.add_child(exc_descr.entry_point)
self.flow.nextblock() self.flow.nextblock()
if isinstance(lhs, (ExprNodes.AttributeNode, ExprNodes.IndexNode)):
self.visit(lhs)
return
if not rhs: if not rhs:
rhs = object_expr rhs = object_expr
if lhs.is_name: if lhs.is_name:
...@@ -656,8 +652,7 @@ class CreateControlFlowGraph(CythonTransform): ...@@ -656,8 +652,7 @@ class CreateControlFlowGraph(CythonTransform):
for arg in lhs.args: for arg in lhs.args:
self.mark_assignment(arg) self.mark_assignment(arg)
else: else:
# Could use this info to infer cdef class attributes... self.visit(lhs)
pass
if self.flow.exceptions: if self.flow.exceptions:
exc_descr = self.flow.exceptions[-1] exc_descr = self.flow.exceptions[-1]
......
# cython: warn.maybe_uninitialized=True
# mode: error
# tag: werror
# ticket: 739
def index_lhs(a):
cdef object idx
a[idx] = 1
def slice_lhs(a):
cdef object idx
a[:idx] = 1
_ERRORS = """
7:9: local variable 'idx' referenced before assignment
11:10: local variable 'idx' referenced before assignment
"""
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