Author: Armin Rigo <[email protected]>
Branch: 
Changeset: r3006:3d609382a4b8
Date: 2017-08-31 17:44 +0200
http://bitbucket.org/cffi/cffi/changeset/3d609382a4b8/

Log:    Write down an explicit example of what not to do

diff --git a/doc/source/ref.rst b/doc/source/ref.rst
--- a/doc/source/ref.rst
+++ b/doc/source/ref.rst
@@ -51,6 +51,9 @@
 data can be used as long as this object is kept alive, but must not be
 used for a longer time.  Be careful about that when copying the
 pointer to the memory somewhere else, e.g. into another structure.
+Also, this means that a line like ``x = ffi.new(...)[0]`` is *always
+wrong:* the newly allocated object goes out of scope instantly, and so
+is freed immediately, and ``x`` is garbage.
 
 The returned memory is initially cleared (filled with zeroes), before
 the optional initializer is applied.  For performance, see
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to