diff options
author | Tomas R <tomas.roun8@gmail.com> | 2023-08-07 10:41:39 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-08-07 10:41:39 (GMT) |
commit | 6925c578a0e3cbb00858e64da813a7ffe79623c4 (patch) | |
tree | be822bba0357ab0d50d02d537bbc674e4886b046 /Doc/library | |
parent | a6675b1a597c67be972598ac8562883fabe48099 (diff) | |
download | cpython-6925c578a0e3cbb00858e64da813a7ffe79623c4.zip cpython-6925c578a0e3cbb00858e64da813a7ffe79623c4.tar.gz cpython-6925c578a0e3cbb00858e64da813a7ffe79623c4.tar.bz2 |
gh-107442: Document all valid types for ctypes _as_parameter_ (#107443)
Diffstat (limited to 'Doc/library')
-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 ec4b090..fcf711e 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): |