diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2025-01-06 12:28:50 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-01-06 12:28:50 (GMT) |
commit | 657d7b77e5c69967e9c0000b986fa4872d13958c (patch) | |
tree | f121e2754f42f8a3a872814ed8bb4ff99fad5f7e /Doc/c-api/arg.rst | |
parent | 1ef6bf4e29db43bbf06639923516838db2d5a5ba (diff) | |
download | cpython-657d7b77e5c69967e9c0000b986fa4872d13958c.zip cpython-657d7b77e5c69967e9c0000b986fa4872d13958c.tar.gz cpython-657d7b77e5c69967e9c0000b986fa4872d13958c.tar.bz2 |
gh-90241: Clarify documentation for PyUnicode_FSConverter and PyUnicode_FSDecoder (GH-128451)
Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
Diffstat (limited to 'Doc/c-api/arg.rst')
-rw-r--r-- | Doc/c-api/arg.rst | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/Doc/c-api/arg.rst b/Doc/c-api/arg.rst index 41c0366..209056e 100644 --- a/Doc/c-api/arg.rst +++ b/Doc/c-api/arg.rst @@ -319,7 +319,7 @@ Other objects .. _o_ampersand: -``O&`` (object) [*converter*, *anything*] +``O&`` (object) [*converter*, *address*] Convert a Python object to a C variable through a *converter* function. This takes two arguments: the first is a function, the second is the address of a C variable (of arbitrary type), converted to :c:expr:`void *`. The *converter* @@ -333,14 +333,20 @@ Other objects the conversion has failed. When the conversion fails, the *converter* function should raise an exception and leave the content of *address* unmodified. - If the *converter* returns ``Py_CLEANUP_SUPPORTED``, it may get called a + .. c:macro:: Py_CLEANUP_SUPPORTED + :no-typesetting: + + If the *converter* returns :c:macro:`!Py_CLEANUP_SUPPORTED`, it may get called a second time if the argument parsing eventually fails, giving the converter a chance to release any memory that it had already allocated. In this second call, the *object* parameter will be ``NULL``; *address* will have the same value as in the original call. + Examples of converters: :c:func:`PyUnicode_FSConverter` and + :c:func:`PyUnicode_FSDecoder`. + .. versionchanged:: 3.1 - ``Py_CLEANUP_SUPPORTED`` was added. + :c:macro:`!Py_CLEANUP_SUPPORTED` was added. ``p`` (:class:`bool`) [int] Tests the value passed in for truth (a boolean **p**\ redicate) and converts |