Commits

Antonio Cuni  committed dcf6cdb

make sure that StringListStrategy actually wraps bytes

  • Participants
  • Parent commits 96f5f07
  • Branches py3k

Comments (0)

Files changed (2)

File pypy/objspace/std/listobject.py

     _applevel_repr = "str"
 
     def wrap(self, stringval):
-        return self.space.wrap(stringval)
+        return self.space.wrapbytes(stringval)
 
     def unwrap(self, w_string):
         return self.space.str_w(w_string)

File pypy/objspace/std/test/test_liststrategies.py

         w_l = W_ListObject(space, [space.wrap(1), space.wrap(2), space.wrap(3)])
         assert self.space.listview_int(w_l) == [1, 2, 3]
 
+    def test_stringstrategy_wraps_bytes(self):
+        space = self.space
+        wb = space.wrapbytes
+        l = W_ListObject(space, [wb('a'), wb('b')])
+        w_item = l.getitem(0)
+        assert isinstance(w_item, space.StringObjectCls)
+
 
 class TestW_ListStrategiesDisabled:
     def setup_class(cls):