[pypy-commit] cffi static-callback: merge default

arigo noreply at buildbot.pypy.org
Sun Nov 15 05:16:20 EST 2015


Author: Armin Rigo <arigo at tunes.org>
Branch: static-callback
Changeset: r2403:1b32f226fb09
Date: 2015-11-15 11:10 +0100
http://bitbucket.org/cffi/cffi/changeset/1b32f226fb09/

Log:	merge default

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)


More information about the pypy-commit mailing list