Skip to content

gh-161039: fix detection of less >= 706 in _pyrepl/pager.py - #161040

Open
tmzullinger wants to merge 1 commit into
python:mainfrom
tmzullinger:pyrepl-pager-fix-less-detection
Open

tmzullinger wants to merge 1 commit into
python:mainfrom
tmzullinger:pyrepl-pager-fix-less-detection

Conversation

@tmzullinger

@tmzullinger tmzullinger commented Oct 31, 2026 •

Copy link
Copy Markdown

Since less tag v706¹, less exits with a failure status when no filename is provided. Pass the -? option and redirect both stdout and stderr to /dev/null.

Failure to detect less results in using more for users who don't have MANPAGER or PAGER set, which is unexpected.

¹ gwsw/less@7c85230 (Exit with a failure
status in more cases, 2026-06-14)

@python-cla-bot

python-cla-bot Bot commented Oct 31, 2026 •

Copy link
Copy Markdown

All commit authors signed the Contributor License Agreement.

CLA signed

@bedevere-app

bedevere-app Bot commented Oct 31, 2026

Copy link
Copy Markdown

Most changes to Python require a NEWS entry. Add one using the blurb_it web app or the blurb command-line tool.

If this change has little impact on Python users, wait for a maintainer to apply the skip news label instead.

@tmzullinger

Copy link
Copy Markdown
Author

This could be handled in various ways. Using less -? seemed like a clear and easy way to go. It is supported by less for many, many years. (I didn't check the code history, but a system with less-436 shows the -? option there.)

…_pager`

Since less tag v706¹, less exits with a failure status when no filename
is provided.  Pass the `-?` option and redirect both stdout and stderr
to /dev/null.

Failure to detect `less` results in using `more` for users who don't
have MANPAGER or PAGER set, which is unexpected.

¹ gwsw/less@7c85230 (Exit with a failure
  status in more cases, 2026-06-14)
@tmzullinger
tmzullinger force-pushed the pyrepl-pager-fix-less-detection branch from 72a8316 to 67fb193 Compare November 1, 2026 01:41
@tmzullinger

Copy link
Copy Markdown
Author

Apparently, I should not have bothered adding a NEWS snippet after the initial feedback from the bot. Or at the least, I don't know enough about the syntax to write one that passes the doc checks.

If someone can offer advice on fixing whatever is wrong with the snippet or whether it's even needed for the simple code fix, I'll happily change it either way.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant