diff options
author | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2023-08-07 12:33:25 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-08-07 12:33:25 (GMT) |
commit | e5582bdbcf56033a445c7a96eca8503968771b33 (patch) | |
tree | e6056d87d80a8f45c1988425388ed9c487eba1e3 | |
parent | 19863c36d2c9172b5c6c930e3c54ab8d63271993 (diff) | |
download | cpython-e5582bdbcf56033a445c7a96eca8503968771b33.zip cpython-e5582bdbcf56033a445c7a96eca8503968771b33.tar.gz cpython-e5582bdbcf56033a445c7a96eca8503968771b33.tar.bz2 |
[3.12] gh-107442: Document all valid types for ctypes _as_parameter_ (GH-107443) (#107707)
gh-107442: Document all valid types for ctypes _as_parameter_ (GH-107443)
(cherry picked from commit 6925c578a0e3cbb00858e64da813a7ffe79623c4)
Co-authored-by: Tomas R <tomas.roun8@gmail.com>
-rw-r--r-- | Doc/library/ctypes.rst | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/Doc/library/ctypes.rst b/Doc/library/ctypes.rst index ff579d98..3c794be 100644 --- a/Doc/library/ctypes.rst +++ b/Doc/library/ctypes.rst @@ -401,9 +401,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): |