Re: [PATCH] binman: Do not dedent docstrings twice on Python 3.13+

Simon Glass <[email protected]>
Newsgroups gmane.comp.boot-loaders.u-boot
Message-ID <CAFLszTgGzA5AHN5kMvLF0dD-xPhKDOR+bxrDiDc9KG5E8dBE2A__20767.3370301322$1786209807$gmane$org@mail.gmail.com>
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]>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.