https://github.com/python/cpython/commit/ab79a3d04ac145900b62fcadbfcb79ef2766cca3
commit: ab79a3d04ac145900b62fcadbfcb79ef2766cca3
branch: 3.14
author: Miss Islington (bot) <[email protected]>
committer: StanFromIreland <[email protected]>
date: 2026-11-02T16:54:16Z
summary:

[3.14] gh-161039: Fix detection of `less` 706 and later by the `pydoc` pager 
(GH-161040) (#161149)

(cherry picked from commit 2f2051287f0c24c7bb99a7f570e5a6178ba1f8de)

Co-authored-by: Todd Zullinger <[email protected]>
Co-authored-by: Stan Ulbrych <[email protected]>

files:
A Misc/NEWS.d/next/Library/2026-10-31-21-34-00.gh-issue-161039.k7_pTD.rst
M Lib/_pyrepl/pager.py

diff --git a/Lib/_pyrepl/pager.py b/Lib/_pyrepl/pager.py
index 1fddc63e3ee3ad0..2914755f435d86b 100644
--- a/Lib/_pyrepl/pager.py
+++ b/Lib/_pyrepl/pager.py
@@ -38,7 +38,7 @@ def get_pager() -> Pager:
         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:
+    if hasattr(os, 'system') and os.system('(less -V) >/dev/null 2>&1') == 0:
         return lambda text, title='': pipe_pager(text, 'less', title)
 
     import tempfile
diff --git 
a/Misc/NEWS.d/next/Library/2026-10-31-21-34-00.gh-issue-161039.k7_pTD.rst 
b/Misc/NEWS.d/next/Library/2026-10-31-21-34-00.gh-issue-161039.k7_pTD.rst
new file mode 100644
index 000000000000000..3b697fb155b7aca
--- /dev/null
+++ b/Misc/NEWS.d/next/Library/2026-10-31-21-34-00.gh-issue-161039.k7_pTD.rst
@@ -0,0 +1 @@
+Fix the :mod:`pydoc` pager not detecting ``less`` 706 and newer.

_______________________________________________
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