[Python-checkins] [3.11] gh-107442: Document all valid types for ctypes `_as_parameter_` (GH-107443) (#107718)
erlend-aasland
webhook-mailer at python.org
Mon Aug 7 10:42:23 EDT 2023
https://github.com/python/cpython/commit/880670a34f664b1c93b7da79520a58040b68cabf
commit: 880670a34f664b1c93b7da79520a58040b68cabf
branch: 3.11
author: Tomas R <tomas.roun8 at gmail.com>
committer: erlend-aasland <erlend.aasland at protonmail.com>
date: 2023-08-07T16:42:19+02:00
summary:
[3.11] gh-107442: Document all valid types for ctypes `_as_parameter_` (GH-107443) (#107718)
(cherry picked from commit 6925c578a0e3cbb00858e64da813a7ffe79623c4)
Co-authored-by: Tomas R <tomas.roun8 at gmail.com>
files:
M Doc/library/ctypes.rst
diff --git a/Doc/library/ctypes.rst b/Doc/library/ctypes.rst
index b55ec32ef5af5..debc1c0adde84 100644
--- a/Doc/library/ctypes.rst
+++ b/Doc/library/ctypes.rst
@@ -399,9 +399,10 @@ Calling functions with your own custom data types
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
You can also customize :mod:`ctypes` argument conversion to allow instances of
-your own classes be used as function arguments. :mod:`ctypes` looks for an
-:attr:`_as_parameter_` attribute and uses this as the function argument. Of
-course, it must be one of integer, string, or bytes::
+your own classes be used as function arguments. :mod:`ctypes` looks for an
+:attr:`!_as_parameter_` attribute and uses this as the function argument. The
+attribute must be an integer, string, bytes, a :mod:`ctypes` instance, or an
+object with an :attr:`!_as_parameter_` attribute::
>>> class Bottles:
... def __init__(self, number):
More information about the Python-checkins
mailing list