[Python-checkins] bpo-940286: Fix pydoc to show cross refs correctly (GH-8390)

Miss Islington (bot) webhook-mailer at python.org
Mon Jul 23 02:51:31 EDT 2018


https://github.com/python/cpython/commit/e9e6495eedd7fb588964ffa50e8bf2c5ce9c6051
commit: e9e6495eedd7fb588964ffa50e8bf2c5ce9c6051
branch: 3.6
author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com>
committer: GitHub <noreply at github.com>
date: 2018年07月22日T23:51:28-07:00
summary:
bpo-940286: Fix pydoc to show cross refs correctly (GH-8390)
(cherry picked from commit d04f46c59f1d07d9bcc0ba910741296ac88d370d)
Co-authored-by: Berker Peksag <berker.peksag at gmail.com>
files:
A Misc/NEWS.d/next/Library/2018-07-22-07-59-32.bpo-940286.NZTzyc.rst
M Lib/pydoc.py
diff --git a/Lib/pydoc.py b/Lib/pydoc.py
index 8c707540030b..fffa2d50a29c 100644
--- a/Lib/pydoc.py
+++ b/Lib/pydoc.py
@@ -1992,14 +1992,15 @@ def showtopic(self, topic, more_xrefs=''):
 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 000000000000..678ac7a12244
--- /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.


More information about the Python-checkins mailing list

AltStyle によって変換されたページ (->オリジナル) /