From c7ac503f4b766eb2aa49731f0160b4aabac06d84 Mon Sep 17 00:00:00 2001 From: "Miss Islington (bot)" <31488909+miss-islington@users.noreply.github.com> Date: Thu, 27 Feb 2025 15:26:42 +0100 Subject: [PATCH] [3.12] Doc: Strip trailing whitespace in ``pydoc_topics`` (GH-130492) (#130636) (cherry picked from commit 3f3e1c4095ae229b0c6d0364f289a20732281a96) Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com> --- 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 27de43027107..86d929fdd902 100644 --- a/Doc/tools/extensions/pydoc_topics.py +++ b/Doc/tools/extensions/pydoc_topics.py @@ -142,7 +142,8 @@ class PydocTopicsBuilder(TextBuilder): 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( -- 2.47.3