Author: Amaury Forgeot d'Arc <[email protected]>
Branch: py3k
Changeset: r59046:2c5703fd490a
Date: 2012-11-22 22:46 +0100
http://bitbucket.org/pypy/pypy/changeset/2c5703fd490a/
Log: Translation fix for the buffer interface in cpyext
diff --git a/pypy/module/cpyext/object.py b/pypy/module/cpyext/object.py
--- a/pypy/module/cpyext/object.py
+++ b/pypy/module/cpyext/object.py
@@ -411,8 +411,10 @@
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)
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
@@ -246,9 +246,8 @@
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))
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit