diff --git a/Lib/pydoc.py b/Lib/pydoc.py index 96aa1dfc1aacf6..3376a7e19d7f10 100755 --- a/Lib/pydoc.py +++ b/Lib/pydoc.py @@ -1583,7 +1583,8 @@ def getpager(): if sys.platform == 'win32': return lambda text: tempfilepager(plain(text), 'more <') if hasattr(os, 'system') and os.system('(less) 2>/dev/null') == 0: - return lambda text: pipepager(text, 'less') + cmd = 'less "-P?e(END) .(q to quit)" --quit-at-eof' + return lambda text: pipepager(text, cmd) import tempfile (fd, filename) = tempfile.mkstemp() diff --git a/Misc/NEWS.d/next/Library/2020-07-17-10-15-59.bpo-21625.cKVDj2.rst b/Misc/NEWS.d/next/Library/2020-07-17-10-15-59.bpo-21625.cKVDj2.rst new file mode 100644 index 00000000000000..aa3f88a6c2af10 --- /dev/null +++ b/Misc/NEWS.d/next/Library/2020-07-17-10-15-59.bpo-21625.cKVDj2.rst @@ -0,0 +1,2 @@ +When the ``MANPAGER`` and ``PAGER`` environment variables are not set, +interactive :func:`help` now quits if enter is pressed on the last line.