diff options
author | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2018-07-23 06:51:54 (GMT) |
---|---|---|
committer | Berker Peksag <berker.peksag@gmail.com> | 2018-07-23 06:51:54 (GMT) |
commit | 14f58f0ff823ba71e3f21803c509d348626b6089 (patch) | |
tree | d29a97099014e9687dac9b695fcbf69701754c95 | |
parent | c7b91d95d8890a4bafefa797f194a1ae3f0f0abb (diff) | |
download | cpython-14f58f0ff823ba71e3f21803c509d348626b6089.zip cpython-14f58f0ff823ba71e3f21803c509d348626b6089.tar.gz cpython-14f58f0ff823ba71e3f21803c509d348626b6089.tar.bz2 |
bpo-940286: Fix pydoc to show cross refs correctly (GH-8390)
(cherry picked from commit d04f46c59f1d07d9bcc0ba910741296ac88d370d)
Co-authored-by: Berker Peksag <berker.peksag@gmail.com>
-rw-r--r-- | Lib/pydoc.py | 5 | ||||
-rw-r--r-- | Misc/NEWS.d/next/Library/2018-07-22-07-59-32.bpo-940286.NZTzyc.rst | 2 |
2 files changed, 5 insertions, 2 deletions
diff --git a/Lib/pydoc.py b/Lib/pydoc.py index 199745c..8a6b27b 100644 --- a/Lib/pydoc.py +++ b/Lib/pydoc.py @@ -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 index 0000000..678ac7a --- /dev/null +++ b/Misc/NEWS.d/next/Library/2018-07-22-07-59-32.bpo-940286.NZTzyc.rst @@ -0,0 +1,2 @@ +pydoc's ``Helper.showtopic()`` method now prints the cross references of a +topic correctly. |