[pypy-commit] pypy list-strategies: Fixed getstorage_copy again

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


Author: Lukas Diekmann <lukas.diekmann at uni-duesseldorf.de>
Branch: list-strategies
Changeset: r47502:9b07ebaab89c
Date: 2011-04-21 12:42 +0200
http://bitbucket.org/pypy/pypy/changeset/9b07ebaab89c/

Log:	Fixed getstorage_copy again

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
@@ -254,7 +254,7 @@
         return []
 
     def getstorage_copy(self, w_list):
-        return self.cast_to_void_star(self.getitems_copy(w_list))
+        return self.cast_to_void_star([])
 
     def append(self, w_list, w_item):
         w_list.__init__(self.space, [w_item])
@@ -344,7 +344,8 @@
         return self._getitems_range(w_list, True)
 
     def getstorage_copy(self, w_list):
-        return self.cast_to_void_star(self.getitems_copy(w_list))
+        # tuple is unmutable
+        return w_list.lstorage
 
     getitems_copy = getitems
 
@@ -511,7 +512,8 @@
         return [self.wrap(item) for item in self.cast_from_void_star(w_list.lstorage)]
 
     def getstorage_copy(self, w_list):
-        return self.cast_to_void_star(self.getitems_copy(w_list))
+        items = self.cast_from_void_star(w_list.lstorage)[:]
+        return self.cast_to_void_star(items)
 
     getitems = getitems_copy
 


More information about the pypy-commit mailing list