]> granicus.if.org Git - python/commitdiff
put notes in a ..note section
authorBenjamin Peterson <benjamin@python.org>
Mon, 20 Jan 2014 05:10:23 +0000 (00:10 -0500)
committerBenjamin Peterson <benjamin@python.org>
Mon, 20 Jan 2014 05:10:23 +0000 (00:10 -0500)
Doc/library/ctypes.rst

index f001165320ee1b6428922faa2fb39b47a26d945f..f46da85a577e9173c832539a9d9709b62bb20393 100644 (file)
@@ -1022,18 +1022,18 @@ As we can easily check, our array is sorted now::
    1 5 7 33 99
    >>>
 
-**Important notes for callback functions:**
-
-Make sure you keep references to :func:`CFUNCTYPE` objects as long as they are
-used from C code. :mod:`ctypes` doesn't, and if you don't, they may be garbage
-collected, crashing your program when a callback is made.
-
-Also, note that if the callback function is called in a thread created outside
-of Python's control (e.g. by the foreign code that calls the callback), ctypes
-creates a new dummy Python thread on every invocation. This behavior is correct
-for most purposes, but it means that values stored with `threading.local` will
-*not* survive across different callbacks, even when those calls are made from
-the same C thread.
+.. note::
+
+   Make sure you keep references to :func:`CFUNCTYPE` objects as long as they
+   are used from C code. :mod:`ctypes` doesn't, and if you don't, they may be
+   garbage collected, crashing your program when a callback is made.
+
+   Also, note that if the callback function is called in a thread created
+   outside of Python's control (e.g. by the foreign code that calls the
+   callback), ctypes creates a new dummy Python thread on every invocation. This
+   behavior is correct for most purposes, but it means that values stored with
+   `threading.local` will *not* survive across different callbacks, even when
+   those calls are made from the same C thread.
 
 .. _ctypes-accessing-values-exported-from-dlls: