[pypy-commit] pypy py3.5-multiprocessing: use memoryview in python3, not buffer

plan_rich pypy.commits at gmail.com
Mon Nov 28 05:23:59 EST 2016


Author: Richard Plangger <planrichi at gmail.com>
Branch: py3.5-multiprocessing
Changeset: r88694:489f39369c1d
Date: 2016-11-21 15:42 +0100
http://bitbucket.org/pypy/pypy/changeset/489f39369c1d/

Log:	use memoryview in python3, not buffer

diff --git a/lib_pypy/_ctypes/basics.py b/lib_pypy/_ctypes/basics.py
--- a/lib_pypy/_ctypes/basics.py
+++ b/lib_pypy/_ctypes/basics.py
@@ -85,7 +85,7 @@
 
     def from_buffer(self, obj, offset=0):
         size = self._sizeofinstances()
-        buf = buffer(obj, offset, size)
+        buf = memoryview(obj[offset:offset+size])
         if len(buf) < size:
             raise ValueError(
                 "Buffer size too small (%d instead of at least %d bytes)"
@@ -97,7 +97,8 @@
 
     def from_buffer_copy(self, obj, offset=0):
         size = self._sizeofinstances()
-        buf = buffer(obj, offset, size)
+        buf = memoryview(obj, offset, size)
+        buf = memoryview(obj[offset:offset+size])
         if len(buf) < size:
             raise ValueError(
                 "Buffer size too small (%d instead of at least %d bytes)"


More information about the pypy-commit mailing list