Author: Amaury Forgeot d'Arc <[email protected]>
Branch: py3k
Changeset: r58828:6967729886c8
Date: 2012-11-11 14:25 +0100
http://bitbucket.org/pypy/pypy/changeset/6967729886c8/
Log: A bytes string is not a sequence of bytes characters, but a sequence
of numbers.
diff --git a/pypy/objspace/std/objspace.py b/pypy/objspace/std/objspace.py
--- a/pypy/objspace/std/objspace.py
+++ b/pypy/objspace/std/objspace.py
@@ -483,7 +483,8 @@
if type(w_obj) is W_SetObject or type(w_obj) is W_FrozensetObject:
return w_obj.listview_str()
if isinstance(w_obj, W_StringObject):
- return w_obj.listview_str()
+ # Python3 considers bytes strings as a list of numbers.
+ return None
if isinstance(w_obj, W_ListObject) and self._uses_list_iter(w_obj):
return w_obj.getitems_str()
return None
diff --git a/pypy/objspace/std/test/test_stringobject.py
b/pypy/objspace/std/test/test_stringobject.py
--- a/pypy/objspace/std/test/test_stringobject.py
+++ b/pypy/objspace/std/test/test_stringobject.py
@@ -85,9 +85,9 @@
assert self.space.eq_w(space.getitem(w_str, w_slice), wb('el'))
def test_listview_str(self):
- py.test.py3k_skip("listview_str not supported yet")
- w_str = self.space.wrap('abcd')
- assert self.space.listview_str(w_str) == list("abcd")
+ w_str = self.space.wrapbytes('abcd')
+ # list(b'abcd') is a list of numbers
+ assert self.space.listview_str(w_str) == None
class AppTestStringObject:
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit