Commits

Stephen Tu committed c8d8c57

properly handle assignments like:
x, y = rhs

  • Participants
  • Parent commits b088693

Comments (0)

Files changed (1)

File pypy/interpreter/astcompiler/codegen.py

         ast.GenericASTVisitor.visit_Return(self, node)
 
     def visit_Assign(self, node):
-        #self._break_if_file_matches('fooscope.py')
+        #self._break_if_file_matches('fooassign.py')
         ntargets = len(node.targets)
         if ntargets == 1:
-            self._assignment_like(node.targets[0], node.value, False)
-            self._note_assignment(node.targets[0], node.value)
-        else:
-            assert ntargets > 1
-            # XXX: come up w/ a better feature name (this is unclear)
-            self._record_binary_feature(node.value, 'used_as_rhs_multiassign')
+            target = node.targets[0]
+            self._assignment_like(target, node.value, False)
+            self._note_assignment(target, node.value)
+            if isinstance(target, ast.Tuple):
+                # this is the case of:
+                # x, y = rhs
+                self._record_binary_feature(node.value, 'used_as_rhs_multiassign')
+        # XXX: handle ntarget > 1 later. this happens when we have
+        # x = y = rhs, in which case targets = [Name(x), Name(y)]
+
         ast.GenericASTVisitor.visit_Assign(self, node)
 
     def visit_AugAssign(self, node):