[pypy-commit] pypy pyarg-parsetuple-s-star-buffer: Add trivial buffer implementation module

exarkun noreply at buildbot.pypy.org
Mon Dec 12 16:45:27 CET 2011


Author: Jean-Paul Calderone <exarkun at twistedmatrix.com>
Branch: pyarg-parsetuple-s-star-buffer
Changeset: r50430:421fe5b137ea
Date: 2011-12-12 10:45 -0500
http://bitbucket.org/pypy/pypy/changeset/421fe5b137ea/

Log:	Add trivial buffer implementation module

diff --git a/pypy/module/cpyext/buffer.py b/pypy/module/cpyext/buffer.py
new file mode 100644
--- /dev/null
+++ b/pypy/module/cpyext/buffer.py
@@ -0,0 +1,11 @@
+from pypy.rpython.lltypesystem import rffi, lltype
+from pypy.module.cpyext.api import (
+    cpython_api, CANNOT_FAIL, Py_buffer)
+
+ at cpython_api([lltype.Ptr(Py_buffer), lltype.Char], rffi.INT_real, error=CANNOT_FAIL)
+def PyBuffer_IsContiguous(space, view, fortran):
+    """Return 1 if the memory defined by the view is C-style (fortran is
+    'C') or Fortran-style (fortran is 'F') contiguous or either one
+    (fortran is 'A').  Return 0 otherwise."""
+    # PyPy only supports contiguous Py_buffers for now.
+    return space.wrap(1)


More information about the pypy-commit mailing list