[Python-checkins] cpython (merge 3.2 -> 3.3): Issue #17378: ctypes documentation fix.

eli.bendersky python-checkins at python.org
Fri Mar 8 14:34:00 CET 2013


http://hg.python.org/cpython/rev/2cd2d8f8f72f
changeset:   82545:2cd2d8f8f72f
branch:      3.3
parent:      82540:1fd165883a65
parent:      82544:76be5efa0d86
user:        Eli Bendersky <eliben at gmail.com>
date:        Fri Mar 08 05:32:45 2013 -0800
summary:
  Issue #17378: ctypes documentation fix.

Document that ctypes automatically applies byref() when argtypes declares
POINTER.

files:
  Doc/library/ctypes.rst |  5 +++++
  1 files changed, 5 insertions(+), 0 deletions(-)


diff --git a/Doc/library/ctypes.rst b/Doc/library/ctypes.rst
--- a/Doc/library/ctypes.rst
+++ b/Doc/library/ctypes.rst
@@ -822,6 +822,11 @@
    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

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list