https://github.com/python/cpython/commit/9e218afc8591e3687855a591ffd5bcb7d9bf1bc7
commit: 9e218afc8591e3687855a591ffd5bcb7d9bf1bc7
branch: 3.13
author: Miss Islington (bot) <[email protected]>
committer: vstinner <[email protected]>
date: 2024-10-07T23:45:43+02:00
summary:

[3.13] Support the "pager" binary in _pyrepl (GH-122878) (#124242)

Support the "pager" binary in _pyrepl (GH-122878)

Debian (and derivatives) provide a /usr/bin/pager binary, managed by the
alternatives system, that always points to an available pager utility.
Allow _pyrepl to use it, to follow system policy.

This is a very trivial change, from a patch that Debian has been
carrying since 2.7 era. Seems appropriate to upstream.
https://bugs.debian.org/799555
(cherry picked from commit 426569eb8ca1edaa68026aa2bab6b8d1c9105f93)

Co-authored-by: Stefano Rivera <[email protected]>
Co-authored-by: T. Wouters <[email protected]>

files:
A 
Misc/NEWS.d/next/Core_and_Builtins/2024-09-19-13-17-31.gh-issue-122878.4iFpsB.rst
M Lib/_pyrepl/pager.py

diff --git a/Lib/_pyrepl/pager.py b/Lib/_pyrepl/pager.py
index 66dcd99111adfc..1fddc63e3ee3ad 100644
--- a/Lib/_pyrepl/pager.py
+++ b/Lib/_pyrepl/pager.py
@@ -36,6 +36,8 @@ def get_pager() -> Pager:
         return plain_pager
     if sys.platform == 'win32':
         return lambda text, title='': tempfile_pager(plain(text), 'more <')
+    if hasattr(os, 'system') and os.system('(pager) 2>/dev/null') == 0:
+        return lambda text, title='': pipe_pager(text, 'pager', title)
     if hasattr(os, 'system') and os.system('(less) 2>/dev/null') == 0:
         return lambda text, title='': pipe_pager(text, 'less', title)
 
diff --git 
a/Misc/NEWS.d/next/Core_and_Builtins/2024-09-19-13-17-31.gh-issue-122878.4iFpsB.rst
 
b/Misc/NEWS.d/next/Core_and_Builtins/2024-09-19-13-17-31.gh-issue-122878.4iFpsB.rst
new file mode 100644
index 00000000000000..85dd0fd769be68
--- /dev/null
+++ 
b/Misc/NEWS.d/next/Core_and_Builtins/2024-09-19-13-17-31.gh-issue-122878.4iFpsB.rst
@@ -0,0 +1 @@
+Use the ``pager`` binary, if available (e.g. on Debian and derivatives), to 
display REPL ``help()``.

_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-checkins.python.org/
Member address: [email protected]

Reply via email to