[pypy-commit] pypy kill-flowobjspace: kill CallSpec.unpack()
rlamy
noreply at buildbot.pypy.org
Sun Feb 3 03:21:41 CET 2013
Author: Ronan Lamy <ronan.lamy at gmail.com>
Branch: kill-flowobjspace
Changeset: r60834:f84990947cae
Date: 2013-02-03 01:48 +0000
http://bitbucket.org/pypy/pypy/changeset/f84990947cae/
Log: kill CallSpec.unpack()
diff --git a/rpython/flowspace/argument.py b/rpython/flowspace/argument.py
--- a/rpython/flowspace/argument.py
+++ b/rpython/flowspace/argument.py
@@ -86,15 +86,6 @@
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
diff --git a/rpython/flowspace/objspace.py b/rpython/flowspace/objspace.py
--- a/rpython/flowspace/objspace.py
+++ b/rpython/flowspace/objspace.py
@@ -412,23 +412,23 @@
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
More information about the pypy-commit
mailing list