[pypy-commit] pypy kwargsdict-strategy: - gah, actually enable view_as_kwargs
cfbolz
noreply at buildbot.pypy.org
Sat Apr 7 15:04:26 CEST 2012
Author: Carl Friedrich Bolz <cfbolz at gmx.de>
Branch: kwargsdict-strategy
Changeset: r54233:1ce73e4161df
Date: 2012-04-07 10:56 +0200
http://bitbucket.org/pypy/pypy/changeset/1ce73e4161df/
Log: - gah, actually enable view_as_kwargs
- also, fix a resizing problem
- fix logic when to look into argument matching
diff --git a/pypy/interpreter/argument.py b/pypy/interpreter/argument.py
--- a/pypy/interpreter/argument.py
+++ b/pypy/interpreter/argument.py
@@ -172,7 +172,7 @@
keywords, values_w = space.view_as_kwargs(w_starstararg)
if keywords is not None: # this path also taken for empty dicts
self._add_keywordargs_no_unwrapping(keywords, values_w)
- return jit.isconstant(len(self.keywords))
+ return not jit.isconstant(len(self.keywords))
if space.isinstance_w(w_starstararg, space.w_dict):
keys_w = space.unpackiterable(w_starstararg)
else:
@@ -231,8 +231,8 @@
jit.isconstant(self.keywords)))
def _add_keywordargs_no_unwrapping(self, keywords, keywords_w):
if self.keywords is None:
- self.keywords = keywords
- self.keywords_w = keywords_w
+ self.keywords = keywords[:] # copy to make non-resizable
+ self.keywords_w = keywords_w[:]
else:
# looks quadratic, but the JIT should remove all of it nicely.
# Also, all the lists should be small
diff --git a/pypy/objspace/std/objspace.py b/pypy/objspace/std/objspace.py
--- a/pypy/objspace/std/objspace.py
+++ b/pypy/objspace/std/objspace.py
@@ -473,9 +473,8 @@
return None
def view_as_kwargs(self, w_dict):
- return (None, None)
- if type(w_obj) is W_DictMultiObject:
- return w_obj.view_as_kwargs()
+ if type(w_dict) is W_DictMultiObject:
+ return w_dict.view_as_kwargs()
return (None, None)
def _uses_list_iter(self, w_obj):
More information about the pypy-commit
mailing list