Commits

Armin Rigo  committed 24ff93f

Change the interface of deldictvalue() to take an unwrapped
attribute name, like getdictvalue() and setdictvalue(). Just for
unification purposes.

  • Participants
  • Parent commits 97ce6ad

Comments (0)

Files changed (8)

File pypy/interpreter/baseobjspace.py

             return True
         return False
 
-    def deldictvalue(self, space, w_name):
+    def deldictvalue(self, space, attr):
         w_dict = self.getdict(space)
         if w_dict is not None:
             try:
-                space.delitem(w_dict, w_name)
+                space.delitem(w_dict, space.wrap(attr))
                 return True
             except OperationError, ex:
                 if not ex.match(space, space.w_KeyError):

File pypy/module/__builtin__/interp_classobj.py

         if w_meth is not None:
             space.call_function(w_meth, w_name)
         else:
-            if not self.deldictvalue(space, w_name):
+            if not self.deldictvalue(space, name):
                 raise operationerrfmt(
                     space.w_AttributeError,
                     "%s instance has no attribute '%s'",

File pypy/objspace/descroperation.py

             if space.is_data_descr(w_descr):
                 space.delete(w_descr, w_obj)
                 return
-        if w_obj.deldictvalue(space, w_name):
+        if w_obj.deldictvalue(space, name):
             return
         raiseattrerror(space, w_obj, name, w_descr)
 

File pypy/objspace/std/dictproxyobject.py

         space = self.space
         w_key_type = space.type(w_key)
         if space.is_w(w_key_type, space.w_str):
-            if not self.unerase(w_dict.dstorage).deldictvalue(space, w_key):
+            key = self.space.str_w(w_key)
+            if not self.unerase(w_dict.dstorage).deldictvalue(space, key):
                 raise KeyError
         else:
             raise KeyError

File pypy/objspace/std/mapdict.py

     def setdictvalue(self, space, attrname, w_value):
         return self._get_mapdict_map().write(self, (attrname, DICT), w_value)
 
-    def deldictvalue(self, space, w_name):
-        attrname = space.str_w(w_name)
+    def deldictvalue(self, space, attrname):
         new_obj = self._get_mapdict_map().delete(self, (attrname, DICT))
         if new_obj is None:
             return False
         w_key_type = space.type(w_key)
         w_obj = self.unerase(w_dict.dstorage)
         if space.is_w(w_key_type, space.w_str):
-            flag = w_obj.deldictvalue(space, w_key)
+            key = self.space.str_w(w_key)
+            flag = w_obj.deldictvalue(space, key)
             if not flag:
                 raise KeyError
         elif _never_equal_to_string(space, w_key_type):

File pypy/objspace/std/proxyobject.py

                     raise
                 return False
         
-        def deldictvalue(self, space, w_attr):
+        def deldictvalue(self, space, attr):
             try:
                 space.call_function(self.w_controller, space.wrap('__delattr__'),
-                   w_attr)
+                   space.wrap(attr))
                 return True
             except OperationError, e:
                 if not e.match(space, space.w_AttributeError):

File pypy/objspace/std/typeobject.py

         w_self.dict_w[name] = w_value
         return True
 
-    def deldictvalue(w_self, space, w_key):
+    def deldictvalue(w_self, space, key):
         if w_self.lazyloaders:
             w_self._freeze_()    # force un-lazification
-        key = space.str_w(w_key)
         if (not space.config.objspace.std.mutable_builtintypes
                 and not w_self.is_heaptype()):
             msg = "can't delete attributes on type object '%s'"

File pypy/objspace/std/typetype.py

 
 def descr_del___abstractmethods__(space, w_type):
     w_type = _check(space, w_type)
-    if not w_type.deldictvalue(space, space.wrap("__abstractmethods__")):
+    if not w_type.deldictvalue(space, "__abstractmethods__"):
         raise OperationError(space.w_AttributeError,
                              space.wrap("__abstractmethods__"))
     w_type.set_abstract(False)