summaryrefslogtreecommitdiffstats
path: root/Doc/library/ctypes.rst
diff options
context:
space:
mode:
authorAmaury Forgeot d'Arc <amauryfa@gmail.com>2008-06-17 20:36:03 (GMT)
committerAmaury Forgeot d'Arc <amauryfa@gmail.com>2008-06-17 20:36:03 (GMT)
commitfdfe62d887d5b695a82dae68006ac3b12c02eb57 (patch)
tree262cc9a3a1e7b1c7189b35c6b5c49465ef9f49a4 /Doc/library/ctypes.rst
parent36817a984cd5e460020b29cd9cf9b52b142573df (diff)
downloadcpython-fdfe62d887d5b695a82dae68006ac3b12c02eb57.zip
cpython-fdfe62d887d5b695a82dae68006ac3b12c02eb57.tar.gz
cpython-fdfe62d887d5b695a82dae68006ac3b12c02eb57.tar.bz2
Merged revisions 64089,64098,64100-64102,64113,64115-64116,64118,64120,64132,64342 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk ........ r64089 | armin.ronacher | 2008-06-10 22:37:02 +0200 (mar., 10 juin 2008) | 3 lines Fix a formatting error in the ast documentation. ........ r64098 | raymond.hettinger | 2008-06-11 02:25:29 +0200 (mer., 11 juin 2008) | 6 lines Mini-PEP: Simplifying numbers.py * Convert binary methods in Integral to mixin methods * Remove three-arg __pow__ as a required method * Make __int__ the root method instead of __long__. ........ r64100 | raymond.hettinger | 2008-06-11 02:28:51 +0200 (mer., 11 juin 2008) | 1 line Update numbers doc for the Integral simplification. ........ r64101 | raymond.hettinger | 2008-06-11 02:44:47 +0200 (mer., 11 juin 2008) | 3 lines Handle the case with zero arguments. ........ r64102 | benjamin.peterson | 2008-06-11 03:31:28 +0200 (mer., 11 juin 2008) | 4 lines convert test_struct to a unittest thanks to Giampaolo Rodola I had to disable one test because it was functioning incorrectly, see #1530559 I also removed the debugging prints ........ r64113 | thomas.heller | 2008-06-11 09:10:43 +0200 (mer., 11 juin 2008) | 2 lines Fix markup. Document the new 'offset' parameter for the 'ctypes.byref' function. ........ r64115 | raymond.hettinger | 2008-06-11 12:30:54 +0200 (mer., 11 juin 2008) | 1 line Multi-arg form for set.difference() and set.difference_update(). ........ r64116 | raymond.hettinger | 2008-06-11 14:06:49 +0200 (mer., 11 juin 2008) | 1 line Issue 3051: Let heapq work with either __lt__ or __le__. ........ r64118 | raymond.hettinger | 2008-06-11 14:39:09 +0200 (mer., 11 juin 2008) | 1 line Optimize previous checkin for heapq. ........ r64120 | raymond.hettinger | 2008-06-11 15:14:50 +0200 (mer., 11 juin 2008) | 1 line Add test for heapq using both __lt__ and __le__. ........ r64132 | gregory.p.smith | 2008-06-11 20:00:52 +0200 (mer., 11 juin 2008) | 3 lines Correct an incorrect comment about our #include of stddef.h. (see Doug Evans' comment on python-dev 2008-06-10) ........ r64342 | guido.van.rossum | 2008-06-17 19:38:02 +0200 (mar., 17 juin 2008) | 3 lines Roll back Raymond's -r64098 while we think of something better. (See issue 3056 -- we're close to a resolution but need unittests.) ........
Diffstat (limited to 'Doc/library/ctypes.rst')
-rw-r--r--Doc/library/ctypes.rst50
1 files changed, 25 insertions, 25 deletions
diff --git a/Doc/library/ctypes.rst b/Doc/library/ctypes.rst
index 61c1e61..51d340c 100644
--- a/Doc/library/ctypes.rst
+++ b/Doc/library/ctypes.rst
@@ -1395,11 +1395,6 @@ GetLastError() and SetLastError() Windows api functions;
to request and change the ctypes private copy of the windows error
code.
-.. versionchanged:: 2.6
-
-The `use_errno` and `use_last_error` parameters were added in Python
-2.6.
-
.. data:: RTLD_GLOBAL
:noindex:
@@ -1561,22 +1556,23 @@ They are instances of a private class:
Assign a Python function or another callable to this attribute. The
callable will be called with three or more arguments:
+ .. function:: callable(result, func, arguments)
+ :noindex:
-.. function:: callable(result, func, arguments)
- :noindex:
+ ``result`` is what the foreign function returns, as specified
+ by the :attr:`restype` attribute.
- ``result`` is what the foreign function returns, as specified by the
- :attr:`restype` attribute.
+ ``func`` is the foreign function object itself, this allows
+ to reuse the same callable object to check or post process
+ the results of several functions.
- ``func`` is the foreign function object itself, this allows to reuse the same
- callable object to check or post process the results of several functions.
+ ``arguments`` is a tuple containing the parameters originally
+ passed to the function call, this allows to specialize the
+ behavior on the arguments used.
- ``arguments`` is a tuple containing the parameters originally passed to the
- function call, this allows to specialize the behavior on the arguments used.
-
- The object that this function returns will be returned from the foreign
- function call, but it can also check the result value and raise an exception
- if the foreign function call failed.
+ The object that this function returns will be returned from the
+ foreign function call, but it can also check the result value
+ and raise an exception if the foreign function call failed.
.. exception:: ArgumentError()
@@ -1605,10 +1601,6 @@ type and the argument types of the function.
variable is exchanged with the real `errno` value bafore and after the call;
`use_last_error` does the same for the Windows error code.
- .. versionchanged:: 2.6
- The optional `use_errno` and `use_last_error` parameters were
- added.
-
.. function:: WINFUNCTYPE(restype, *argtypes, use_errno=False, use_last_error=False)
@@ -1786,11 +1778,19 @@ Utility functions
ctypes type or instance.
-.. function:: byref(obj)
+.. function:: byref(obj[, offset])
+
+ Returns a light-weight pointer to ``obj``, which must be an
+ instance of a ctypes type. ``offset`` defaults to zero, it must be
+ an integer which is added to the internal pointer value.
+
+ ``byref(obj, offset)`` corresponds to this C code::
+
+ (((char *)&obj) + offset)
- Returns a light-weight pointer to ``obj``, which must be an instance of a ctypes
- type. The returned object can only be used as a foreign function call parameter.
- It behaves similar to ``pointer(obj)``, but the construction is a lot faster.
+ The returned object can only be used as a foreign function call
+ parameter. It behaves similar to ``pointer(obj)``, but the
+ construction is a lot faster.
.. function:: cast(obj, type)