[pypy-commit] pypy py3k: fix memoryview(<ctypes.Structure>)

rlamy pypy.commits at gmail.com
Wed Aug 31 15:10:44 EDT 2016


Author: Ronan Lamy <ronan.lamy at gmail.com>
Branch: py3k
Changeset: r86792:76de024304d4
Date: 2016-08-31 20:10 +0100
http://bitbucket.org/pypy/pypy/changeset/76de024304d4/

Log:	fix memoryview(<ctypes.Structure>)

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
@@ -167,7 +167,7 @@
             return self.value
 
     def __buffer__(self, flags):
-        return buffer(self._buffer)
+        return memoryview(self._buffer)
 
     def _get_b_base(self):
         try:
diff --git a/pypy/interpreter/baseobjspace.py b/pypy/interpreter/baseobjspace.py
--- a/pypy/interpreter/baseobjspace.py
+++ b/pypy/interpreter/baseobjspace.py
@@ -237,7 +237,8 @@
     def _buffer(self, space, flags):
         w_impl = space.lookup(self, '__buffer__')
         if w_impl is not None:
-            w_result = space.get_and_call_function(w_impl, self)
+            w_result = space.get_and_call_function(w_impl, self,
+                                                   space.newint(flags))
             if space.isinstance_w(w_result, space.w_memoryview):
                 return w_result
         raise BufferInterfaceNotFound


More information about the pypy-commit mailing list