[pypy-svn] r78293 - pypy/branch/set-object-cleanup/pypy/objspace/std

arigo at codespeak.net arigo at codespeak.net
Tue Oct 26 14:27:58 CEST 2010


Author: arigo
Date: Tue Oct 26 14:27:57 2010
New Revision: 78293

Modified:
   pypy/branch/set-object-cleanup/pypy/objspace/std/dictmultiobject.py
   pypy/branch/set-object-cleanup/pypy/objspace/std/dicttype.py
Log:
Kill dict.update() at app-level, and implement it as just
a call to dict.__init__().


Modified: pypy/branch/set-object-cleanup/pypy/objspace/std/dictmultiobject.py
==============================================================================
--- pypy/branch/set-object-cleanup/pypy/objspace/std/dictmultiobject.py	(original)
+++ pypy/branch/set-object-cleanup/pypy/objspace/std/dictmultiobject.py	Tue Oct 26 14:27:57 2010
@@ -645,7 +645,7 @@
     w_src, w_kwds = __args__.parse_obj(
             None, 'dict',
             init_signature, # signature
-            init_defaults)                           # default argument
+            init_defaults)  # default argument
     if w_src is None:
         pass
     elif space.findattr(w_src, space.wrap("keys")) is None:
@@ -665,6 +665,9 @@
         from pypy.objspace.std.dicttype import update1
         update1(space, w_dict, w_kwds)
 
+def dict_update__DictMulti(space, w_dict, __args__):
+    init__DictMulti(space, w_dict, __args__)
+
 def getitem__DictMulti_ANY(space, w_dict, w_key):
     w_value = w_dict.getitem(w_key)
     if w_value is not None:

Modified: pypy/branch/set-object-cleanup/pypy/objspace/std/dicttype.py
==============================================================================
--- pypy/branch/set-object-cleanup/pypy/objspace/std/dicttype.py	(original)
+++ pypy/branch/set-object-cleanup/pypy/objspace/std/dicttype.py	Tue Oct 26 14:27:57 2010
@@ -72,15 +72,6 @@
             for k,v in o:
                 dict.__setitem__(d, k, v)
 
-    def update(d, *args, **kwargs):
-        len_args = len(args)
-        if len_args == 1:
-            update1(d, args[0])
-        elif len_args > 1:
-            raise TypeError("update takes at most 1 (non-keyword) argument")
-        if kwargs:
-            update1(d, kwargs)
-
     def popitem(d):
         for k in dict.iterkeys(d):
             break
@@ -98,7 +89,6 @@
             return v
 ''', filename=__file__)
 
-dict_update__ANY             = app.interphook("update")
 dict_popitem__ANY            = app.interphook("popitem")
 dict_setdefault__ANY_ANY_ANY = app.interphook("setdefault")
 update1                      = app.interphook("update1")



More information about the Pypy-commit mailing list