]> granicus.if.org Git - python/commitdiff
bpo-940286: Fix pydoc to show cross refs correctly (GH-8390)
authorBerker Peksag <berker.peksag@gmail.com>
Mon, 23 Jul 2018 05:37:47 +0000 (08:37 +0300)
committerGitHub <noreply@github.com>
Mon, 23 Jul 2018 05:37:47 +0000 (08:37 +0300)
Lib/pydoc.py
Misc/NEWS.d/next/Library/2018-07-22-07-59-32.bpo-940286.NZTzyc.rst [new file with mode: 0644]

index 199745ca6fa8b0b694e84396e12463daa8a29a94..8a6b27b16e5278f8f5cd3d71a3bd3aa429f7a122 100644 (file)
@@ -2028,14 +2028,15 @@ module "pydoc_data.topics" could not be found.
         except KeyError:
             self.output.write('no documentation found for %s\n' % repr(topic))
             return
-        pager(doc.strip() + '\n')
+        doc = doc.strip() + '\n'
         if more_xrefs:
             xrefs = (xrefs or '') + ' ' + more_xrefs
         if xrefs:
             import textwrap
             text = 'Related help topics: ' + ', '.join(xrefs.split()) + '\n'
             wrapped_text = textwrap.wrap(text, 72)
-            self.output.write('\n%s\n' % ''.join(wrapped_text))
+            doc += '\n%s\n' % '\n'.join(wrapped_text)
+        pager(doc)
 
     def _gettopic(self, topic, more_xrefs=''):
         """Return unbuffered tuple of (topic, xrefs).
diff --git a/Misc/NEWS.d/next/Library/2018-07-22-07-59-32.bpo-940286.NZTzyc.rst b/Misc/NEWS.d/next/Library/2018-07-22-07-59-32.bpo-940286.NZTzyc.rst
new file mode 100644 (file)
index 0000000..678ac7a
--- /dev/null
@@ -0,0 +1,2 @@
+pydoc's ``Helper.showtopic()`` method now prints the cross references of a
+topic correctly.