[pypy-commit] pypy PyBuffer: Fix tolist() on 1-D buffers

rlamy pypy.commits at gmail.com
Tue Apr 11 13:41:22 EDT 2017


Author: Ronan Lamy <ronan.lamy at gmail.com>
Branch: PyBuffer
Changeset: r91041:4d42369e2fb3
Date: 2017-04-11 18:40 +0100
http://bitbucket.org/pypy/pypy/changeset/4d42369e2fb3/

Log:	Fix tolist() on 1-D buffers

diff --git a/pypy/objspace/std/memoryobject.py b/pypy/objspace/std/memoryobject.py
--- a/pypy/objspace/std/memoryobject.py
+++ b/pypy/objspace/std/memoryobject.py
@@ -104,8 +104,9 @@
             raise NotImplementedError
         elif dim == 1:
             itemsize = self.getitemsize()
-            return self._tolist(space, buf.as_binary(), self.getlength(), itemsize, fmt,
-                                self.getstrides())
+            n = self.getshape()[0]
+            values_w = [buf.w_getitem(space, i) for i in range(n)]
+            return space.newlist(values_w)
         else:
             return self._tolist_rec(space, buf.as_binary(), 0, 0, fmt)
 


More information about the pypy-commit mailing list