[pypy-svn] pypy improve-unwrap_spec: Use args_w instead of w_args for dict.pop()

amauryfa commits-noreply at bitbucket.org
Thu Feb 17 10:19:23 CET 2011


Author: Amaury Forgeot d'Arc <amauryfa at gmail.com>
Branch: improve-unwrap_spec
Changeset: r42099:d3970feb8301
Date: 2011-02-16 19:40 +0100
http://bitbucket.org/pypy/pypy/changeset/d3970feb8301/

Log:	Use args_w instead of w_args for dict.pop()

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
@@ -794,9 +794,8 @@
         w_dict.setitem(w_key, w_default)
         return w_default
 
-def dict_pop__DictMulti_ANY(space, w_dict, w_key, w_defaults):
-    defaults = space.listview(w_defaults)
-    len_defaults = len(defaults)
+def dict_pop__DictMulti_ANY(space, w_dict, w_key, defaults_w):
+    len_defaults = len(defaults_w)
     if len_defaults > 1:
         raise operationerrfmt(space.w_TypeError,
                               "pop expected at most 2 arguments, got %d",
@@ -804,7 +803,7 @@
     w_item = w_dict.getitem(w_key)
     if w_item is None:
         if len_defaults > 0:
-            return defaults[0]
+            return defaults_w[0]
         else:
             space.raise_key_error(w_key)
     else:

diff --git a/pypy/objspace/std/dicttype.py b/pypy/objspace/std/dicttype.py
--- a/pypy/objspace/std/dicttype.py
+++ b/pypy/objspace/std/dicttype.py
@@ -20,7 +20,7 @@
 dict_get        = SMM('get',           3, defaults=(None,),
                       doc='D.get(k[,d]) -> D[k] if k in D, else d.  d defaults'
                           ' to None.')
-dict_pop        = SMM('pop',           2, w_varargs=True,
+dict_pop        = SMM('pop',           2, varargs_w=True,
                       doc='D.pop(k[,d]) -> v, remove specified key and return'
                           ' the corresponding value\nIf key is not found, d is'
                           ' returned if given, otherwise KeyError is raised')

diff --git a/pypy/objspace/std/proxy_helpers.py b/pypy/objspace/std/proxy_helpers.py
--- a/pypy/objspace/std/proxy_helpers.py
+++ b/pypy/objspace/std/proxy_helpers.py
@@ -44,6 +44,8 @@
         return install_general_args_trampoline(type_, mm, is_local, op_name)
     if ['w_args'] == mm.argnames_after:
         return install_w_args_trampoline(type_, mm, is_local, op_name)
+    if ['args_w'] == mm.argnames_after:
+        return install_w_args_trampoline(type_, mm, is_local, op_name)
     assert not mm.argnames_after
     # we search here for special-cased stuff
     def function(space, w_transparent_list, *args_w):


More information about the Pypy-commit mailing list