Commits

Ronan Lamy  committed f849909

kill CallSpec.unpack()

  • Participants
  • Parent commits 97725c1
  • Branches kill-flowobjspace

Comments (0)

Files changed (2)

File rpython/flowspace/argument.py

         self.arguments_w = args_w
         self.keywords = keywords or {}
 
-    def unpack(self):
-        "Return a ([w1,w2...], {'kw':w3...}) pair."
-        if self.w_stararg is not None:
-            stargs_w = self.space.unpackiterable(self.w_stararg)
-            args_w = self.arguments_w + stargs_w
-        else:
-            args_w = self.arguments_w
-        return args_w, self.keywords
-
     def flatten(self):
         """ Argument <-> list of w_objects together with "shape" information """
         shape_cnt  = len(self.arguments_w)    # Number of positional args

File rpython/flowspace/objspace.py

             except (KeyError, TypeError):
                 pass
             else:
-                args_w, kwds_w = args.unpack()
-                assert kwds_w == {}, "should not call %r with keyword arguments" % (fn,)
+                assert args.keywords == {}, "should not call %r with keyword arguments" % (fn,)
+                if args.w_stararg is not None:
+                    args_w = args.arguments_w + self.unpackiterable(args.w_stararg)
+                else:
+                    args_w = args.arguments_w
                 return sc(self, fn, args_w)
 
-        try:
-            args_w, kwds_w = args.unpack()
-        except UnwrapException:
-            args_w, kwds_w = '?', '?'
-        # NOTE: annrpython needs to know about the following two operations!
-        if not kwds_w:
-            # simple case
+        if args.keywords or isinstance(args.w_stararg, Variable):
+            shape, args_w = args.flatten()
+            w_res = self.frame.do_operation('call_args', w_callable,
+                    Constant(shape), *args_w)
+        else:
+            if args.w_stararg is not None:
+                args_w = args.arguments_w + self.unpackiterable(args.w_stararg)
+            else:
+                args_w = args.arguments_w
             w_res = self.frame.do_operation('simple_call', w_callable, *args_w)
-        else:
-            # general case
-            shape, args_w = args.flatten()
-            w_res = self.frame.do_operation('call_args', w_callable, Constant(shape),
-                                      *args_w)
 
         # maybe the call has generated an exception (any one)
         # but, let's say, not if we are calling a built-in class or function