diff options
author | Armin Rigo <arigo@tunes.org> | 2015-11-15 11:10:03 +0100 |
---|---|---|
committer | Armin Rigo <arigo@tunes.org> | 2015-11-15 11:10:03 +0100 |
commit | 5ecf62ebb617a243044535cad96bc2e223e68259 (patch) | |
tree | dc992ead385fe52db85fd1471c34d3299453402f /c/ffi_obj.c | |
parent | 7a8bdf1f2c870207b99ae4970dd590c448d4d0f6 (diff) | |
download | cffi-5ecf62ebb617a243044535cad96bc2e223e68259.tar.gz |
Document ffi.new_allocator()
Diffstat (limited to 'c/ffi_obj.c')
-rw-r--r-- | c/ffi_obj.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/c/ffi_obj.c b/c/ffi_obj.c index 936e654..737a0d9 100644 --- a/c/ffi_obj.c +++ b/c/ffi_obj.c @@ -361,7 +361,19 @@ static PyObject *_ffi_new_with_allocator(PyObject *allocator, PyObject *args, &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) |