Author: Wim Lavrijsen <wlavrij...@lbl.gov> Branch: Changeset: r70969:4b806e538c61 Date: 2014-04-25 01:14 -0700 http://bitbucket.org/pypy/pypy/changeset/4b806e538c61/
Log: merge reflex-support into default: fixes for new buffer interfaces diff --git a/pypy/module/cppyy/converter.py b/pypy/module/cppyy/converter.py --- a/pypy/module/cppyy/converter.py +++ b/pypy/module/cppyy/converter.py @@ -63,7 +63,7 @@ def get_rawbuffer(space, w_obj): # raw buffer try: - buf = space.buffer_w(w_obj, space.BUF_SIMPLE) + buf = space.readbuf_w(w_obj) return rffi.cast(rffi.VOIDP, buf.get_raw_address()) except Exception: pass @@ -163,7 +163,7 @@ 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.buffer_w(w_value, space.BUF_SIMPLE) + buf = space.readbuf_w(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) @@ -204,7 +204,7 @@ # copy only the pointer value rawobject = get_rawobject_nonnull(space, w_obj) byteptr = rffi.cast(rffi.CCHARPP, capi.direct_ptradd(rawobject, offset)) - buf = space.buffer_w(w_value, space.BUF_SIMPLE) + buf = space.readbuf_w(w_value) try: byteptr[0] = buf.get_raw_address() except ValueError: diff --git a/pypy/module/cppyy/test/test_zjit.py b/pypy/module/cppyy/test/test_zjit.py --- a/pypy/module/cppyy/test/test_zjit.py +++ b/pypy/module/cppyy/test/test_zjit.py @@ -104,6 +104,7 @@ class dummy: pass self.config = dummy() self.config.translating = False + self.BUF_SIMPLE = 1 def issequence_w(self, w_obj): return True @@ -132,7 +133,10 @@ return w_obj interp_w._annspecialcase_ = 'specialize:arg(1)' - def buffer_w(self, w_obj): + def buffer_w(self, w_obj, flags): + return FakeBuffer(w_obj) + + def readbuf_w(self, w_obj): return FakeBuffer(w_obj) def exception_match(self, typ, sub): _______________________________________________ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit