Author: Ronan Lamy <[email protected]>
Branch: kill-flowobjspace
Changeset: r60552:eda004a832ff
Date: 2013-01-27 20:51 +0000
http://bitbucket.org/pypy/pypy/changeset/eda004a832ff/
Log: make CallSpec.unpack() non-destructive
diff --git a/rpython/flowspace/argument.py b/rpython/flowspace/argument.py
--- a/rpython/flowspace/argument.py
+++ b/rpython/flowspace/argument.py
@@ -386,21 +386,26 @@
self.space = space
assert isinstance(args_w, list)
self.arguments_w = args_w
- self.keywords = keywords
- self.keywords_w = keywords_w
+ self.keywords = keywords or []
+ self.keywords_w = keywords_w or []
self.keyword_names_w = None
def copy(self):
return CallSpec(self.space, self.arguments_w,
self.keywords, self.keywords_w, self.w_stararg)
+ 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
+ kwds_w = dict(zip(self.keywords, self.keywords_w))
+ return args_w, kwds_w
+
def combine_if_necessary(self):
- if self.combine_has_happened:
- return
- if self.w_stararg is not None:
- args_w = self.space.unpackiterable(self.w_stararg)
- self.arguments_w = self.arguments_w + args_w
- self.combine_has_happened = True
+ raise NotImplementedError
def _rawshape(self, nextra=0):
assert not self.combine_has_happened
diff --git a/rpython/flowspace/objspace.py b/rpython/flowspace/objspace.py
--- a/rpython/flowspace/objspace.py
+++ b/rpython/flowspace/objspace.py
@@ -417,7 +417,7 @@
return sc(self, fn, args)
try:
- args_w, kwds_w = args.copy().unpack()
+ args_w, kwds_w = args.unpack()
except UnwrapException:
args_w, kwds_w = '?', '?'
# NOTE: annrpython needs to know about the following two operations!
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit