[pypy-commit] pypy PyBuffer: Fix BufferSlice.as_str()

rlamy pypy.commits at gmail.com
Tue Mar 28 13:12:48 EDT 2017


Author: Ronan Lamy <ronan.lamy at gmail.com>
Branch: PyBuffer
Changeset: r90850:6395c8c41478
Date: 2017-03-28 18:04 +0100
http://bitbucket.org/pypy/pypy/changeset/6395c8c41478/

Log:	Fix BufferSlice.as_str()

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
@@ -738,7 +738,8 @@
         return self.shape[0] * self.getitemsize()
 
     def as_str(self):
-        return self.getslice(0, self.getlength(), 1, self.getlength())
+        slicelen = self.shape[0]
+        return self.getslice(0, slicelen * self.step, self.step, slicelen)
 
     def as_str_and_offset_maybe(self):
         string, offset = self.buf.as_str_and_offset_maybe()


More information about the pypy-commit mailing list