Author: Antonio Cuni <[email protected]>
Branch: py3k
Changeset: r58882:dcf6cdb8aa0c
Date: 2012-11-05 17:13 +0100
http://bitbucket.org/pypy/pypy/changeset/dcf6cdb8aa0c/
Log: make sure that StringListStrategy actually wraps bytes
diff --git a/pypy/objspace/std/listobject.py b/pypy/objspace/std/listobject.py
--- a/pypy/objspace/std/listobject.py
+++ b/pypy/objspace/std/listobject.py
@@ -1033,7 +1033,7 @@
_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)
diff --git a/pypy/objspace/std/test/test_liststrategies.py
b/pypy/objspace/std/test/test_liststrategies.py
--- a/pypy/objspace/std/test/test_liststrategies.py
+++ b/pypy/objspace/std/test/test_liststrategies.py
@@ -621,6 +621,13 @@
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):
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit