Skip to content

Commit e03c919

Browse files
Document the returned value.
1 parent d17ebec commit e03c919

File tree

2 files changed

+15
-8
lines changed

2 files changed

+15
-8
lines changed

Doc/c-api/arg.rst

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,10 @@ Other objects
321321
the conversion has failed. When the conversion fails, the *converter* function
322322
should raise an exception and leave the content of *address* unmodified.
323323

324-
If the *converter* returns ``Py_CLEANUP_SUPPORTED``, it may get called a
324+
.. c:macro:: Py_CLEANUP_SUPPORTED
325+
:no-typesetting:
326+
327+
If the *converter* returns :c:macro:`!Py_CLEANUP_SUPPORTED`, it may get called a
325328
second time if the argument parsing eventually fails, giving the converter a
326329
chance to release any memory that it had already allocated. In this second
327330
call, the *object* parameter will be ``NULL``; *address* will have the same value
@@ -331,7 +334,7 @@ Other objects
331334
:c:func:`PyUnicode_FSDecoder`.
332335

333336
.. versionchanged:: 3.1
334-
``Py_CLEANUP_SUPPORTED`` was added.
337+
:c:macro:`!Py_CLEANUP_SUPPORTED` was added.
335338

336339
``p`` (:class:`bool`) [int]
337340
Tests the value passed in for truth (a boolean **p**\ redicate) and converts

Doc/c-api/unicode.rst

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -796,13 +796,15 @@ conversion function:
796796
:c:func:`PyUnicode_EncodeFSDefault`; :class:`bytes` objects are output as-is.
797797
*result* must be an address of a C variable of type :c:expr:`PyObject*`
798798
(or :c:expr:`PyBytesObject*`).
799-
The variable is set to a new :term:`strong reference` to
799+
On success, set the variable to a new :term:`strong reference` to
800800
a :ref:`bytes object <bytesobjects>` which must be released
801-
when it is no longer used.
801+
when it is no longer used and return non-zero value
802+
(:c:macro:`Py_CLEANUP_SUPPORTED`).
802803
Embedded null bytes are not allowed in the result.
804+
On failure, return ``0`` with an exception set.
803805
804806
If *obj* is ``NULL``, the function releases a strong reference
805-
stored in the variable referred by *result*.
807+
stored in the variable referred by *result* and returns ``1``.
806808
807809
.. versionadded:: 3.1
808810
@@ -821,13 +823,15 @@ conversion function:
821823
objects are output as-is.
822824
*result* must be an address of a C variable of type :c:expr:`PyObject*`
823825
(or :c:expr:`PyUnicodeObject*`).
824-
The variable is set to a new :term:`strong reference` to
826+
On success, set the variable to a new :term:`strong reference` to
825827
a :ref:`Unicode object <unicodeobjects>` which must be released
826-
when it is no longer used.
828+
when it is no longer used and return non-zero value
829+
(:c:macro:`Py_CLEANUP_SUPPORTED`).
827830
Embedded null characters are not allowed in the result.
831+
On failure, return ``0`` with an exception set.
828832
829833
If *obj* is ``NULL``, the function releases a strong reference
830-
stored in the variable referred by *result*.
834+
stored in the variable referred by *result* and returns ``1``.
831835
832836
.. versionadded:: 3.2
833837

0 commit comments

Comments
 (0)