From c0b2bc176c4348d5b26cb2ba2609177f0b19227f Mon Sep 17 00:00:00 2001 From: Adam Turner <9087854+aa-turner@users.noreply.github.com> Date: Mon, 24 Feb 2025 01:23:08 +0000 Subject: [PATCH] Doc: Strip trailing whitespace in ``pydoc_topics`` --- Doc/tools/extensions/pydoc_topics.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Doc/tools/extensions/pydoc_topics.py b/Doc/tools/extensions/pydoc_topics.py index 6e43df2e4bf9de..0f3dfacd4f2f87 100644 --- a/Doc/tools/extensions/pydoc_topics.py +++ b/Doc/tools/extensions/pydoc_topics.py @@ -143,7 +143,8 @@ def write_documents(self, _docnames: Set[str]) -> None: document.append(doc_ids[label_id]) visitor = TextTranslator(document, builder=self) document.walkabout(visitor) - self.topics[topic_label] = visitor.body + body = "\n".join(map(str.rstrip, visitor.body.splitlines())) + self.topics[topic_label] = body def finish(self) -> None: topics_repr = "\n".join(