On 2026-07-30T11:59:04, Alexey Charkov <[email protected]> wrote:
> binman: Do not dedent docstrings twice on Python 3.13+
>
> WriteDocs() and write_bintool_docs() strip four characters from the start
> of every docstring line but the first, to undo the indentation the source
> file gives them. Since Python 3.13 the compiler already removes the common
> indentation from docstrings [1], so this removes four characters of actual
> text from every line of every entry and bintool description:
>
>   $ binman entry-docs | head
>   ...
>    that an image node whose only content is an optional entry which was
>    is an example showing ATF, TEE and a device tree all combined::
>
> Use inspect.cleandoc() instead, which produces the same result on both
> older and newer interpreters.
>
> The existing tests only checked that some output was produced, so they
> missed this entirely; make them also confirm that a known line of a known
> description survives intact.
>
> Link: https://github.com/python/cpython/issues/81283 [1]
> Signed-off-by: Alexey Charkov <[email protected]>
>
> tools/binman/bintool.py |  6 ++++--
>  tools/binman/entry.py   |  9 +++++++--
>  tools/binman/ftest.py   | 19 +++++++++++++++++--
>  3 files changed, 28 insertions(+), 6 deletions(-)

Reviewed-by: Simon Glass <[email protected]>

Reply via email to