[pypy-commit] pypy list-strategies: Each strategy must implement (not inherit) it's own length method (translation fix)

l.diekmann noreply at buildbot.pypy.org
Fri Sep 23 13:12:22 CEST 2011


Author: Lukas Diekmann <lukas.diekmann at uni-duesseldorf.de>
Branch: list-strategies
Changeset: r47464:40905329581f
Date: 2011-03-15 14:51 +0100
http://bitbucket.org/pypy/pypy/changeset/40905329581f/

Log:	Each strategy must implement (not inherit) it's own length method
	(translation fix)

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
@@ -375,7 +375,8 @@
         new = self.cast_to_void_star((self.unwrap(last), -skip, length))
         w_list.storage = new
 
-class AbstractUnwrappedStrategy(ListStrategy):
+class AbstractUnwrappedStrategy(object):
+    _mixin_ = True
 
     def wrap(self, unwrapped):
         raise NotImplementedError
@@ -577,7 +578,7 @@
     def reverse(self, w_list):
         self.cast_from_void_star(w_list.storage).reverse()
 
-class ObjectListStrategy(AbstractUnwrappedStrategy):
+class ObjectListStrategy(AbstractUnwrappedStrategy, ListStrategy):
     def unwrap(self, w_obj):
         return w_obj
 
@@ -597,7 +598,7 @@
     def init_from_list_w(self, w_list, list_w):
         w_list.storage = self.cast_to_void_star(list_w)
 
-class IntegerListStrategy(AbstractUnwrappedStrategy):
+class IntegerListStrategy(AbstractUnwrappedStrategy, ListStrategy):
 
     def wrap(self, intval):
         return self.space.wrap(intval)
@@ -615,7 +616,7 @@
     def list_is_correct_type(self, w_list):
         return w_list.strategy is self.space.fromcache(IntegerListStrategy)
 
-class StringListStrategy(AbstractUnwrappedStrategy):
+class StringListStrategy(AbstractUnwrappedStrategy, ListStrategy):
 
     def wrap(self, stringval):
         return self.space.wrap(stringval)


More information about the pypy-commit mailing list