Author: Armin Rigo <[email protected]>
Branch:
Changeset: r2402:edfaf9c56322
Date: 2015-11-15 11:10 +0100
http://bitbucket.org/cffi/cffi/changeset/edfaf9c56322/
Log: Document ffi.new_allocator()
diff --git a/c/ffi_obj.c b/c/ffi_obj.c
--- a/c/ffi_obj.c
+++ b/c/ffi_obj.c
@@ -361,7 +361,19 @@
&PyTuple_GET_ITEM(allocator, 1));
}
-PyDoc_STRVAR(ffi_new_allocator_doc, "XXX");
+PyDoc_STRVAR(ffi_new_allocator_doc,
+"Return a new allocator, i.e. a function that behaves like ffi.new()\n"
+"but uses the provided low-level 'alloc' and 'free' functions.\n"
+"\n"
+"'alloc' is called with the size as argument. If it returns NULL, a\n"
+"MemoryError is raised. 'free' is called with the result of 'alloc'\n"
+"as argument. Both can be either Python functions or directly C\n"
+"functions. If 'free' is None, then no free function is called.\n"
+"If both 'alloc' and 'free' are None, the default is used.\n"
+"\n"
+"If 'should_clear_after_alloc' is set to False, then the memory\n"
+"returned by 'alloc' is assumed to be already cleared (or you are\n"
+"fine with garbage); otherwise CFFI will clear it.");
static PyObject *ffi_new_allocator(FFIObject *self, PyObject *args,
PyObject *kwds)
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit