[pypy-commit] pypy py3k-kwonly-builtin: Put the ".decode('utf-8')" here, whenever we wrap an RPython-level string

arigo pypy.commits at gmail.com
Sat Aug 20 14:04:59 EDT 2016


Author: Armin Rigo <arigo at tunes.org>
Branch: py3k-kwonly-builtin
Changeset: r86361:0582c616e50c
Date: 2016-08-20 20:04 +0200
http://bitbucket.org/pypy/pypy/changeset/0582c616e50c/

Log:	Put the ".decode('utf-8')" here, whenever we wrap an RPython-level
	string as an app-level unicode attribute name

diff --git a/pypy/objspace/std/mapdict.py b/pypy/objspace/std/mapdict.py
--- a/pypy/objspace/std/mapdict.py
+++ b/pypy/objspace/std/mapdict.py
@@ -337,7 +337,7 @@
             space = self.space
             w_dict = obj.getdict(space)
             try:
-                space.delitem(w_dict, space.wrap(name))
+                space.delitem(w_dict, space.wrap(name.decode('utf-8')))
             except OperationError as ex:
                 if not ex.match(space, space.w_KeyError):
                     raise
@@ -402,7 +402,7 @@
     def materialize_r_dict(self, space, obj, dict_w):
         new_obj = self.back.materialize_r_dict(space, obj, dict_w)
         if self.index == DICT:
-            w_attr = space.wrap(self.name)
+            w_attr = space.wrap(self.name.decode('utf-8'))
             dict_w[w_attr] = obj._mapdict_read_storage(self.storageindex)
         else:
             self._copy_attr(obj, new_obj)
@@ -810,7 +810,7 @@
             raise KeyError
         key = curr.name
         w_value = self.getitem_str(w_dict, key)
-        w_key = self.space.wrap(key)
+        w_key = self.space.wrap(key.decode('utf-8'))
         self.delitem(w_dict, w_key)
         return (w_key, w_value)
 
@@ -845,7 +845,7 @@
             if curr_map:
                 self.curr_map = curr_map.back
                 attr = curr_map.name
-                w_attr = self.space.wrap(attr)
+                w_attr = self.space.wrap(attr.decode('utf-8'))
                 return w_attr
         return None
 
@@ -886,7 +886,7 @@
             if curr_map:
                 self.curr_map = curr_map.back
                 attr = curr_map.name
-                w_attr = self.space.wrap(attr)
+                w_attr = self.space.wrap(attr.decode('utf-8'))
                 return w_attr, self.w_obj.getdictvalue(self.space, attr)
         return None, None
 


More information about the pypy-commit mailing list