[pypy-commit] pypy py3k-listview_str: attempt to re-enable space.listview_str. It was disabled because some strategies implemented it for unicode and some for bytes, so translation failed. We decide that listview_str is only for bytes, and that we will need to grow the equivalent unicode ones

antocuni noreply at buildbot.pypy.org
Fri Oct 26 16:31:03 CEST 2012


Author: Antonio Cuni <anto.cuni at gmail.com>
Branch: py3k-listview_str
Changeset: r58455:d0c1cb8e18fc
Date: 2012-10-26 14:09 +0200
http://bitbucket.org/pypy/pypy/changeset/d0c1cb8e18fc/

Log:	attempt to re-enable space.listview_str. It was disabled because
	some strategies implemented it for unicode and some for bytes, so
	translation failed. We decide that listview_str is only for bytes,
	and that we will need to grow the equivalent unicode ones

diff --git a/TODO b/TODO
--- a/TODO
+++ b/TODO
@@ -7,7 +7,7 @@
 
 re-enable IntDictStrategy
 
-re-enable StdObjSpace.listview_str
+write strategies for unicode list/dict/set, and add StdObjSpace.listview_unicode & co.
 
 re-enable the kwargs dict strategy in dictmultiobject.py
 re-enable view_as_kwargs
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
@@ -1034,7 +1034,8 @@
             l.reverse()
 
     def getitems_str(self, w_list):
-        return self.unerase(w_list.lstorage)
+        return None # note that getitems_str is for bytes, not unicode
+        #return self.unerase(w_list.lstorage)
 
 # _______________________________________________________
 
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
@@ -470,7 +470,10 @@
             raise self._wrap_expected_length(expected_length, len(t))
         return t
 
-    def __disabled_listview_str(self, w_obj):
+    def listview_str(self, w_obj):
+        """
+        return a list of RPython bytes strings
+        """
         # note: uses exact type checking for objects with strategies,
         # and isinstance() for others.  See test_listobject.test_uses_custom...
         if type(w_obj) is W_ListObject:
diff --git a/pypy/objspace/std/setobject.py b/pypy/objspace/std/setobject.py
--- a/pypy/objspace/std/setobject.py
+++ b/pypy/objspace/std/setobject.py
@@ -682,7 +682,8 @@
         return {}
 
     def listview_str(self, w_set):
-        return self.unerase(w_set.sstorage).keys()
+        return None # this is for bytes, not unicode
+        #return self.unerase(w_set.sstorage).keys()
 
     def is_correct_type(self, w_key):
         return type(w_key) is W_UnicodeObject


More information about the pypy-commit mailing list