]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.13] gh-125225: Fix column misalignment in help('topics') output (gh-125226) (...
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Mon, 19 May 2025 15:34:31 +0000 (17:34 +0200)
committerGitHub <noreply@github.com>
Mon, 19 May 2025 15:34:31 +0000 (17:34 +0200)
The 'help("topics")' output was misaligned due to "ASSIGNMENTEXPRESSIONS"
exceeding the implicit maximum default column width of 19 characters.

Reduced the number of columns from 4 to 3 in the listtopics()
function to allow more space for longer topic names.
(cherry picked from commit b22460c44d1bc597c96d4a3d27ad8373d7952820)

Co-authored-by: Étienne Pelletier <EtiennePelletier@users.noreply.github.com>
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
Lib/pydoc.py

index 591d7bc8f865cf306feb75ee649f9bc15eb83ca2..00a65b2ded716ec6173431d0235d326a4903171d 100755 (executable)
@@ -2082,7 +2082,7 @@ enter "q", "quit" or "exit".
 '''.format('%d.%d' % sys.version_info[:2]))
 
     def list(self, items, columns=4, width=80):
-        items = list(sorted(items))
+        items = sorted(items)
         colw = width // columns
         rows = (len(items) + columns - 1) // columns
         for row in range(rows):
@@ -2114,7 +2114,7 @@ to. Enter any symbol to get more help.
 Here is a list of available topics.  Enter any topic name to get more help.
 
 ''')
-        self.list(self.topics.keys())
+        self.list(self.topics.keys(), columns=3)
 
     def showtopic(self, topic, more_xrefs=''):
         try: