[pypy-commit] cffi cffi-1.0: ffi.buffer()
arigo
noreply at buildbot.pypy.org
Sun Apr 26 11:23:28 CEST 2015
Author: Armin Rigo <arigo at tunes.org>
Branch: cffi-1.0
Changeset: r1838:c1a8a13f781d
Date: 2015-04-26 11:09 +0200
http://bitbucket.org/cffi/cffi/changeset/c1a8a13f781d/
Log: ffi.buffer()
diff --git a/_cffi1/ffi_obj.c b/_cffi1/ffi_obj.c
--- a/_cffi1/ffi_obj.c
+++ b/_cffi1/ffi_obj.c
@@ -302,6 +302,20 @@
#define ffi_string b_string /* ffi_string() => b_string()
from _cffi_backend.c */
+PyDoc_STRVAR(ffi_buffer_doc,
+"Return a read-write buffer object that references the raw C data\n"
+"pointed to by the given 'cdata'. The 'cdata' must be a pointer or an\n"
+"array. Can be passed to functions expecting a buffer, or directly\n"
+"manipulated with:\n"
+"\n"
+" buf[:] get a copy of it in a regular string, or\n"
+" buf[idx] as a single character\n"
+" buf[:] = ...\n"
+" buf[idx] = ... change the content");
+
+#define ffi_buffer b_buffer /* ffi_buffer() => b_buffer()
+ from _cffi_backend.c */
+
PyDoc_STRVAR(ffi_offsetof_doc,
"Return the offset of the named field inside the given structure or\n"
"array, which must be given as a C type name. You can give several\n"
@@ -698,9 +712,7 @@
{"__set_types",(PyCFunction)ffi__set_types, METH_VARARGS},
{"addressof", (PyCFunction)ffi_addressof, METH_VARARGS, ffi_addressof_doc},
{"alignof", (PyCFunction)ffi_alignof, METH_O, ffi_alignof_doc},
-#if 0
{"buffer", (PyCFunction)ffi_buffer, METH_VARARGS, ffi_buffer_doc},
-#endif
{"callback", (PyCFunction)ffi_callback, METH_VARARGS |
METH_KEYWORDS,ffi_callback_doc},
{"cast", (PyCFunction)ffi_cast, METH_VARARGS, ffi_cast_doc},
More information about the pypy-commit
mailing list