Commits

wlav committed 154db83

use getarg_w instead of readbuf_w (thanks Brian!)

Comments (0)

Files changed (2)

pypy/module/cppyy/converter.py

 def get_rawbuffer(space, w_obj):
     # raw buffer
     try:
-        buf = space.readbuf_w(w_obj)
+        buf = space.getarg_w('s*', w_obj)
         return rffi.cast(rffi.VOIDP, buf.get_raw_address())
     except Exception:
         pass
     def to_memory(self, space, w_obj, w_value, offset):
         # copy the full array (uses byte copy for now)
         address = rffi.cast(rffi.CCHARP, self._get_raw_address(space, w_obj, offset))
-        buf = space.readbuf_w(w_value)
+        buf = space.getarg_w('s*', w_value)
         # TODO: report if too many items given?
         for i in range(min(self.size*self.typesize, buf.getlength())):
             address[i] = buf.getitem(i)
         # copy only the pointer value
         rawobject = get_rawobject_nonnull(space, w_obj)
         byteptr = rffi.cast(rffi.CCHARPP, capi.direct_ptradd(rawobject, offset))
-        buf = space.readbuf_w(w_value)
+        buf = space.getarg_w('s*', w_value)
         try:
             byteptr[0] = buf.get_raw_address()
         except ValueError:

pypy/module/cppyy/test/test_zjit.py

         return w_obj
     interp_w._annspecialcase_ = 'specialize:arg(1)'
 
-    def buffer_w(self, w_obj, flags):
-        return FakeBuffer(w_obj)
-
-    def readbuf_w(self, w_obj):
+    def getarg_w(self, code, w_obj):    # for retrieving buffers
         return FakeBuffer(w_obj)
 
     def exception_match(self, typ, sub):