[pypy-commit] pypy py3.5: Fix visit_list

raffael_t pypy.commits at gmail.com
Thu Jun 16 16:39:30 EDT 2016


Author: Raffael Tfirst <raffael.tfirst at gmail.com>
Branch: py3.5
Changeset: r85200:8d7c7f8d2ee3
Date: 2016-06-16 22:38 +0200
http://bitbucket.org/pypy/pypy/changeset/8d7c7f8d2ee3/

Log:	Fix visit_list

diff --git a/pypy/interpreter/astcompiler/codegen.py b/pypy/interpreter/astcompiler/codegen.py
--- a/pypy/interpreter/astcompiler/codegen.py
+++ b/pypy/interpreter/astcompiler/codegen.py
@@ -1018,6 +1018,7 @@
         self.use_next_block(end)
 
     def _visit_list_or_tuple(self, node, elts, ctx, op):
+        #TODO
         elt_count = len(elts) if elts else 0
         if ctx == ast.Store:
             seen_star = False
@@ -1040,7 +1041,6 @@
         if ctx == ast.Load:
             self.emit_op_arg(op, elt_count)
     
-    #TODO
     def _visit_starunpack(self, node, elts, ctx, single_op, innter_op, outer_op):
         elt_count = len(elts) if elts else 0
         if ctx == ast.Store:
@@ -1076,7 +1076,12 @@
 
     def visit_List(self, l):
         self.update_position(l.lineno)
-        self._visit_list_or_tuple(l, l.elts, l.ctx, ops.BUILD_LIST)
+        if l.ctx == ast.Store:
+            self._visit_list_or_tuple_assignment(l, l.elts)
+        elif l.ctx == ast.Load:
+            self._visit_list_or_tuple_starunpack(l, l.elts, l.ctx, ops.BUILD_LIST)
+        else
+            self.visit_sequence(l.elts)
 
     def visit_Dict(self, d):
         self.update_position(d.lineno)


More information about the pypy-commit mailing list