[pypy-commit] pypy cffi-new-allocator: Tweak to the docstring
arigo
noreply at buildbot.pypy.org
Mon Jul 6 17:15:42 CEST 2015
Author: Armin Rigo <arigo at tunes.org>
Branch: cffi-new-allocator
Changeset: r78461:0dfa553a36e2
Date: 2015-07-06 16:14 +0200
http://bitbucket.org/pypy/pypy/changeset/0dfa553a36e2/
Log: Tweak to the docstring
diff --git a/pypy/module/_cffi_backend/ffi_obj.py b/pypy/module/_cffi_backend/ffi_obj.py
--- a/pypy/module/_cffi_backend/ffi_obj.py
+++ b/pypy/module/_cffi_backend/ffi_obj.py
@@ -427,15 +427,15 @@
def descr_new_allocator(self, w_alloc, w_free,
should_clear_after_alloc=1):
"""\
-Return a new allocator.
+Return a new allocator, i.e. a function that behaves like ffi.new()
+but uses the provided low-level 'alloc' and 'free' functions.
'alloc' is called with the size as argument. If it returns NULL, a
MemoryError is raised. 'free' is called with the result of 'alloc'
as argument. Both can be either Python function or directly C
-functions. If 'free' is explicitly set to None, then no free function
-is called.
+functions. If 'free' is None, then no free function is called.
+If both 'alloc' and 'free' are None, the default is used.
-If both 'alloc' and 'free' are None, the default is used.
If 'should_clear_after_alloc' is set to False, then the memory
returned by 'alloc' is assumed to be already cleared (or you are
fine with garbage); otherwise CFFI will clear it.
More information about the pypy-commit
mailing list