Author: Armin Rigo <[email protected]>
Branch: py3k
Changeset: r86359:79b3a413aab8
Date: 2016-08-20 19:44 +0200
http://bitbucket.org/pypy/pypy/changeset/79b3a413aab8/

Log:    Add an assert that we get consistently the rpython 'str' type here,
        and fix two tests that passed 'unicode' explicitly

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
@@ -68,6 +68,7 @@
     @jit.elidable
     def find_map_attr(self, name, index):
         # attr cache
+        assert type(name) is str    # utf8-encoded
         space = self.space
         cache = space.fromcache(MapAttrCache)
         SHIFT2 = r_uint.BITS - space.config.objspace.std.methodcachesizeexp
diff --git a/pypy/objspace/std/test/test_dictmultiobject.py 
b/pypy/objspace/std/test/test_dictmultiobject.py
--- a/pypy/objspace/std/test/test_dictmultiobject.py
+++ b/pypy/objspace/std/test/test_dictmultiobject.py
@@ -1282,7 +1282,7 @@
             assert a == self.string2
             assert b == 2000
             if not self._str_devolves:
-                result = self.impl.getitem_str(self.string)
+                result = self.impl.getitem_str(self.string.encode('utf-8'))
             else:
                 result = self.impl.getitem(self.string)
             assert result == 1000
@@ -1293,7 +1293,7 @@
         assert self.impl.length() == 1
         assert self.impl.getitem(self.string) == 1000
         if not self._str_devolves:
-            result = self.impl.getitem_str(self.string)
+            result = self.impl.getitem_str(self.string.encode('utf-8'))
         else:
             result = self.impl.getitem(self.string)
         assert result == 1000
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to