[pypy-commit] pypy kwargsdict-strategy: make empty dicts use this path as well
cfbolz
noreply at buildbot.pypy.org
Sat Apr 7 15:04:22 CEST 2012
Author: Carl Friedrich Bolz <cfbolz at gmx.de>
Branch: kwargsdict-strategy
Changeset: r54230:5bad845d3944
Date: 2012-04-06 11:08 +0200
http://bitbucket.org/pypy/pypy/changeset/5bad845d3944/
Log: make empty dicts use this path as well
diff --git a/pypy/interpreter/argument.py b/pypy/interpreter/argument.py
--- a/pypy/interpreter/argument.py
+++ b/pypy/interpreter/argument.py
@@ -170,12 +170,10 @@
# unpack the ** arguments
space = self.space
keywords, values_w = space.view_as_kwargs(w_starstararg)
- if keywords is not None:
+ 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))
if space.isinstance_w(w_starstararg, space.w_dict):
- if not space.is_true(w_starstararg):
- return False # don't call unpackiterable - it's jit-opaque
keys_w = space.unpackiterable(w_starstararg)
else:
try:
@@ -190,11 +188,8 @@
"a mapping, not %s" % (typename,)))
raise
keys_w = space.unpackiterable(w_keys)
- if keys_w:
- self._do_combine_starstarargs_wrapped(keys_w, w_starstararg)
- return True
- else:
- return False # empty dict; don't disable the JIT
+ self._do_combine_starstarargs_wrapped(keys_w, w_starstararg)
+ return True
def _do_combine_starstarargs_wrapped(self, keys_w, w_starstararg):
space = self.space
diff --git a/pypy/objspace/std/dictmultiobject.py b/pypy/objspace/std/dictmultiobject.py
--- a/pypy/objspace/std/dictmultiobject.py
+++ b/pypy/objspace/std/dictmultiobject.py
@@ -262,6 +262,9 @@
def popitem(self, w_dict):
raise KeyError
+ def view_as_kwargs(self, w_dict):
+ return ([], [])
+
registerimplementation(W_DictMultiObject)
# DictImplementation lattice
More information about the pypy-commit
mailing list