[pypy-commit] pypy memoryview-attributes: translation fixes

mattip pypy.commits at gmail.com
Sun Aug 21 05:48:47 EDT 2016


Author: Matti Picus <matti.picus at gmail.com>
Branch: memoryview-attributes
Changeset: r86371:e97ba225e392
Date: 2016-08-21 06:39 +1200
http://bitbucket.org/pypy/pypy/changeset/e97ba225e392/

Log:	translation fixes

diff --git a/pypy/interpreter/baseobjspace.py b/pypy/interpreter/baseobjspace.py
--- a/pypy/interpreter/baseobjspace.py
+++ b/pypy/interpreter/baseobjspace.py
@@ -208,7 +208,8 @@
     def buffer_w(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, flags)
+            w_result = space.get_and_call_function(w_impl, self, 
+                                        space.newint(flags))
             if space.isinstance_w(w_result, space.w_buffer):
                 return w_result.buffer_w(space, flags)
         raise BufferInterfaceNotFound
@@ -217,7 +218,7 @@
         w_impl = space.lookup(self, '__buffer__')
         if w_impl is not None:
             w_result = space.get_and_call_function(w_impl, self,
-                                                space.BUF_FULL_RO)
+                                        space.newint(space.BUF_FULL_RO))
             if space.isinstance_w(w_result, space.w_buffer):
                 return w_result.readbuf_w(space)
         raise BufferInterfaceNotFound
@@ -226,7 +227,7 @@
         w_impl = space.lookup(self, '__buffer__')
         if w_impl is not None:
             w_result = space.get_and_call_function(w_impl, self,
-                                                space.BUF_FULL)
+                                        space.newint(space.BUF_FULL))
             if space.isinstance_w(w_result, space.w_buffer):
                 return w_result.writebuf_w(space)
         raise BufferInterfaceNotFound
@@ -235,7 +236,7 @@
         w_impl = space.lookup(self, '__buffer__')
         if w_impl is not None:
             w_result = space.get_and_call_function(w_impl, self,
-                                                space.BUF_FULL_RO)
+                                        space.newint(space.BUF_FULL_RO))
             if space.isinstance_w(w_result, space.w_buffer):
                 return w_result.charbuf_w(space)
         raise BufferInterfaceNotFound
diff --git a/pypy/module/cpyext/slotdefs.py b/pypy/module/cpyext/slotdefs.py
--- a/pypy/module/cpyext/slotdefs.py
+++ b/pypy/module/cpyext/slotdefs.py
@@ -348,10 +348,7 @@
     with lltype.scoped_alloc(Py_buffer) as pybuf:
         _flags = 0
         if space.len_w(w_args) > 0:
-            _flags = space.listview(w_args)[0]
-        if not isinstance(_flags, int):
-            raise oefmt(space.w_TypeError, 
-                        "non-int flags passed to getbufferproc")
+            _flags = space.int_w(space.listview(w_args)[0])
         flags = rffi.cast(rffi.INT_real,_flags)
         size = generic_cpy_call(space, func_target, w_self, pybuf, flags)
         if widen(size) < 0:


More information about the pypy-commit mailing list