From 2e9675adf81bd44ddc29a46f17b8c754d527b12a Mon Sep 17 00:00:00 2001 From: Thomas Heller Date: Wed, 11 Jun 2008 18:10:43 +0000 Subject: [PATCH] More doc fixes. --- Doc/library/ctypes.rst | 21 ++++++--------------- 1 file changed, 6 insertions(+), 15 deletions(-) diff --git a/Doc/library/ctypes.rst b/Doc/library/ctypes.rst index df0c96a73b3..e17fd24885c 100644 --- a/Doc/library/ctypes.rst +++ b/Doc/library/ctypes.rst @@ -721,6 +721,8 @@ would cause the pointer to point to the memory location where this is stored:: c_long(99) >>> +.. XXX Document dereferencing pointers, and that it is preferred over the .contents attribute. + Pointer instances can also be indexed with integers:: >>> pi[0] @@ -767,7 +769,7 @@ Calling the pointer type without an argument creates a ``NULL`` pointer. >>> ``ctypes`` checks for ``NULL`` when dereferencing pointers (but dereferencing -non-\ ``NULL`` pointers would crash Python):: +invalid non-\ ``NULL`` pointers would crash Python):: >>> null_ptr[0] Traceback (most recent call last): @@ -813,9 +815,9 @@ To set a POINTER type field to ``NULL``, you can assign ``None``:: >>> bar.values = None >>> -XXX list other conversions... +.. XXX list other conversions... -Sometimes you have instances of incompatible types. In ``C``, you can cast one +Sometimes you have instances of incompatible types. In C, you can cast one type into another type. ``ctypes`` provides a ``cast`` function which can be used in the same way. The ``Bar`` structure defined above accepts ``POINTER(c_int)`` pointers or :class:`c_int` arrays for its ``values`` field, @@ -1072,7 +1074,7 @@ crashing your program when a callback is made. Accessing values exported from dlls ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -Sometimes, a dll not only exports functions, it also exports variables. An +Some shared libraries not only export functions, they also export variables. An example in the Python library itself is the ``Py_OptimizeFlag``, an integer set to 0, 1, or 2, depending on the :option:`-O` or :option:`-OO` flag given on startup. @@ -1248,17 +1250,6 @@ dynamic nature of Python, and (re-)define the data type after the required size is already known, on a case by case basis. -.. _ctypes-bugs-todo-non-implemented-things: - -Bugs, ToDo and non-implemented things -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -Enumeration types are not implemented. You can do it easily yourself, using -:class:`c_int` as the base class. - -``long double`` is not implemented. - - .. _ctypes-ctypes-reference: ctypes reference