[pypy-commit] pypy unicode-strategies: enable listview_unicode also for subclasses which do not ovverride __iter__
antocuni
noreply at buildbot.pypy.org
Fri Oct 26 21:45:32 CEST 2012
Author: Antonio Cuni <anto.cuni at gmail.com>
Branch: unicode-strategies
Changeset: r58474:c83bd1c0bc81
Date: 2012-10-26 19:33 +0200
http://bitbucket.org/pypy/pypy/changeset/c83bd1c0bc81/
Log: enable listview_unicode also for subclasses which do not ovverride
__iter__
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
@@ -475,8 +475,8 @@
## return w_obj.listview_unicode()
## if isinstance(w_obj, W_UnicodeObject):
## return w_obj.listview_unicode()
- ## if isinstance(w_obj, W_ListObject) and self._uses_list_iter(w_obj):
- ## return w_obj.getitems_unicode()
+ if isinstance(w_obj, W_ListObject) and self._uses_list_iter(w_obj):
+ return w_obj.getitems_unicode()
return None
def listview_int(self, w_obj):
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
@@ -1188,9 +1188,10 @@
# strategies, to avoid surprizes depending on the strategy.
class X: pass
for base, arg in [
- (list, []), (list, [5]), (list, ['x']), (list, [X]),
- (set, []), (set, [5]), (set, ['x']), (set, [X]),
+ (list, []), (list, [5]), (list, ['x']), (list, [X]), (list, [u'x']),
+ (set, []), (set, [5]), (set, ['x']), (set, [X]), (set, [u'x']),
(dict, []), (dict, [(5,6)]), (dict, [('x',7)]), (dict, [(X,8)]),
+ (dict, [(u'x', 7)]),
]:
print base, arg
class SubClass(base):
More information about the pypy-commit
mailing list