[pypy-commit] cffi default: Rewrite the code more clearly, and fix the wrong comment

arigo pypy.commits at gmail.com
Mon Jun 6 15:01:33 EDT 2016


Author: Armin Rigo <arigo at tunes.org>
Branch: 
Changeset: r2716:2acec12a75bb
Date: 2016-06-06 21:02 +0200
http://bitbucket.org/cffi/cffi/changeset/2acec12a75bb/

Log:	Rewrite the code more clearly, and fix the wrong comment

diff --git a/doc/source/ref.rst b/doc/source/ref.rst
--- a/doc/source/ref.rst
+++ b/doc/source/ref.rst
@@ -406,11 +406,13 @@
         ...
 
         def process(self):
-            lib.process_document(lib.my_callback,       # the callback
-                                 ffi.new_handle(self),  # 'void *data'
+            h = ffi.new_handle(self)
+            lib.process_document(lib.my_callback,   # the callback
+                                 h,                 # 'void *data'
                                  args...)
-            # 'self' stay alive at least until here, which means that
-            # the ffi.from_handle() done in my_callback() are safe
+            # 'h' stay alive until here, which means that the
+            # ffi.from_handle() done in my_callback() during
+            # the call to process_document() are safe
 
         def callback(self, arg1, arg2):
             ...


More information about the pypy-commit mailing list