]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Closing #17378: ctypes documentation fix.
authorEli Bendersky <eliben@gmail.com>
Fri, 8 Mar 2013 13:34:58 +0000 (05:34 -0800)
committerEli Bendersky <eliben@gmail.com>
Fri, 8 Mar 2013 13:34:58 +0000 (05:34 -0800)
Document that ctypes automatically applies byref() when argtypes declares
POINTER.

Doc/library/ctypes.rst

index b51ea51ca6759cc607c049e5ca4cf309be509ff6..7f62e30561ebf7d89e317a12550ccb2a81494511 100644 (file)
@@ -816,6 +816,11 @@ pointer types.  So, for ``POINTER(c_int)``, ctypes accepts an array of c_int::
    3
    >>>
 
+In addition, if a function argument is explicitly declared to be a pointer type
+(such as ``POINTER(c_int)``) in :attr:`argtypes`, an object of the pointed
+type (``c_int`` in this case) can be passed to the function.  ctypes will apply
+the required :func:`byref` conversion in this case automatically.
+
 To set a POINTER type field to ``NULL``, you can assign ``None``::
 
    >>> bar.values = None