[pypy-commit] pypy py3k: test and fix by disabling the unicodeliststragegy when converting from bytes
antocuni
noreply at buildbot.pypy.org
Mon Apr 16 17:24:07 CEST 2012
Author: Antonio Cuni <anto.cuni at gmail.com>
Branch: py3k
Changeset: r54427:4deee06acd87
Date: 2012-04-16 17:23 +0200
http://bitbucket.org/pypy/pypy/changeset/4deee06acd87/
Log: test and fix by disabling the unicodeliststragegy when converting
from 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
@@ -1084,12 +1084,15 @@
w_list.lstorage = strategy.erase(intlist[:])
return
- strlist = space.listview_str(w_iterable)
- if strlist is not None:
- w_list.strategy = strategy = space.fromcache(UnicodeListStrategy)
- # need to copy because intlist can share with w_iterable
- w_list.lstorage = strategy.erase(strlist[:])
- return
+ # XXX: listview_str works for bytes but not for strings, and the
+ # strategy works for strings but not for bytes. Disable it for now,
+ # but we'll need to fix it
+ ## strlist = space.listview_str(w_iterable)
+ ## if strlist is not None:
+ ## w_list.strategy = strategy = space.fromcache(UnicodeListStrategy)
+ ## # need to copy because intlist can share with w_iterable
+ ## w_list.lstorage = strategy.erase(strlist[:])
+ ## return
# xxx special hack for speed
from pypy.interpreter.generator import GeneratorIterator
diff --git a/pypy/objspace/std/test/test_listobject.py b/pypy/objspace/std/test/test_listobject.py
--- a/pypy/objspace/std/test/test_listobject.py
+++ b/pypy/objspace/std/test/test_listobject.py
@@ -1134,6 +1134,10 @@
assert l == []
assert list(g) == []
+ def test_list_from_bytes(self):
+ b = list(b'abc')
+ assert b == [97, 98, 99]
+
def test_uses_custom_iterator(self):
# obscure corner case: space.listview*() must not shortcut subclasses
# of dicts, because the OrderedDict in the stdlib relies on this.
@@ -1158,7 +1162,6 @@
assert s == set(base(arg))
-
class AppTestWithoutStrategies(object):
def setup_class(cls):
More information about the pypy-commit
mailing list