1. Pypy
  2. Untitled project
  3. pypy

Commits

Amaury Forgeot d'Arc  committed 2c5703f

Translation fix for the buffer interface in cpyext

  • Participants
  • Parent commits 3e5417b
  • Branches py3k

Comments (0)

Files changed (2)

File pypy/module/cpyext/object.py

View file
  • Ignore whitespace
         raise OperationError(space.w_TypeError, space.wrap(
             "expected an object with the buffer interface"))
     with lltype.scoped_alloc(Py_buffer) as view:
-        if generic_cpy_call(space, pb.c_bf_getbuffer,
-                            obj, view, rffi.cast(rffi.INT_real, PyBUF_SIMPLE)):
+        ret = generic_cpy_call(
+            space, pb.c_bf_getbuffer,
+            obj, view, rffi.cast(rffi.INT_real, PyBUF_SIMPLE))
+        if rffi.cast(lltype.Signed, ret) == -1:
             return -1
 
         bufferp[0] = rffi.cast(rffi.CCHARP, view.c_buf)

File pypy/module/cpyext/slotdefs.py

View file
  • Ignore whitespace
     func_target = rffi.cast(getbufferproc, func)
     with lltype.scoped_alloc(Py_buffer) as view:
         flags = rffi.cast(rffi.INT_real, 0)
-        print "AFA CALL GETBUFFER"
         ret = generic_cpy_call(space, func_target, w_self, view, flags)
-        if ret < 0:
+        if rffi.cast(lltype.Signed, ret) == -1:
             space.fromcache(State).check_and_raise_exception(always=True)
         return space.wrap(CPyBuffer(view.c_buf, view.c_len, w_self))