Commits

Antonio Cuni committed 0f99876

kill code to support tuple unpacking inside function arguments, which is no longer supported in python3

Comments (0)

Files changed (3)

pypy/interpreter/astcompiler/codegen.py

 
 class AbstractFunctionCodeGenerator(PythonCodeGenerator):
 
-    def _handle_nested_args(self, args):
-        for i in range(len(args)):
-            arg = args[i]
-            if isinstance(arg, ast.Tuple):
-                self.update_position(arg.lineno)
-                self.name_op(".%d" % (i,), ast.Load)
-                arg.walkabout(self)
-
     def _get_code_flags(self):
         scope = self.scope
         assert isinstance(scope, symtable.FunctionScope)
         args = func.args
         assert isinstance(args, ast.arguments)
         if args.args:
-            self._handle_nested_args(args.args)
             self.argcount = len(args.args)
         if args.kwonlyargs:
-            self._handle_nested_args(args.kwonlyargs)
             self.kwonlyargcount = len(args.kwonlyargs)
         if func.body:
             for i in range(start, len(func.body)):
         args = lam.args
         assert isinstance(args, ast.arguments)
         if args.args:
-            self._handle_nested_args(args.args)
             self.argcount = len(args.args)
         # Prevent a string from being the first constant and thus a docstring.
         self.add_const(self.space.w_None)

pypy/interpreter/astcompiler/symtable.py

         if arguments.kwarg:
             self.note_symbol(arguments.kwarg, SYM_PARAM)
             scope.note_keywords_arg(arguments.kwarg)
-        if arguments.args:
-            self._handle_nested_params(arguments.args)
 
     def _handle_params(self, params, is_toplevel):
         for i in range(len(params)):
             arg = params[i]
             if isinstance(arg, ast.Name):
                 self.note_symbol(arg.id, SYM_PARAM)
-            elif isinstance(arg, ast.Tuple):
-                # Tuple unpacking in the argument list.  Add a secret variable
-                # name to recieve the tuple with.
-                if is_toplevel:
-                    self.implicit_arg(i)
             else:
                 raise AssertionError("unknown parameter type")
-        if not is_toplevel:
-            self._handle_nested_params(params)
-
-    def _handle_nested_params(self, params):
-        for param in params:
-            if isinstance(param, ast.Tuple):
-                self._handle_params(param.elts, False)
 
     def visit_Name(self, name):
         if name.ctx == ast.Load:

pypy/interpreter/astcompiler/test/test_symtable.py

         assert scp.has_keywords_arg
         assert not scp.has_variable_arg
         assert scp.lookup("x") == symtable.SCOPE_LOCAL
-        scp = self.func_scope("def f((x, y), a): pass")
-        for name in ("x", "y", "a"):
-            assert scp.lookup(name) == symtable.SCOPE_LOCAL
-        scp = self.func_scope("def f(((a, b), c)): pass")
-        for name in ("a", "b", "c"):
-            assert scp.lookup(name) == symtable.SCOPE_LOCAL
 
     def test_arguments_kwonly(self):
         scp = self.func_scope("def f(a, *, b): pass")