Repository navigation
AI junk - #3753
Closed
harsh-404-404 wants to merge 2 commits into
Closed
AI junk#3753harsh-404-404 wants to merge 2 commits into
harsh-404-404 wants to merge 2 commits into
Conversation
added 2 commits
August 8, 2026 18:14
with '#' will be ignored, and an empty message aborts the commit. On branch fix-windows-pager-typeerror Your branch is up to date with 'origin/fix-windows-pager-typeerror'. Changes to be committed: modified: CHANGES.md modified: src/click/_termui_impl.py
with '#' will be ignored, and an empty message aborts the commit. On branch fix-windows-pager-typeerror Your branch is up to date with 'origin/fix-windows-pager-typeerror'. Changes to be committed: modified: CHANGES.md
This was
linked to
issues
Aug 13, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
On branch fix-windows-pager-typeerror
Changes to be committed:
modified: src/click/_termui_impl.py
Fixes a
TypeErrorand subsequent[WinError 32]when usingclick.echo_via_pager()on Windows.The Bug:
The
_tempfilepageryields a binary file (mode="wb"), butecho_via_pagerexpects aTextIOstream and writes strings to it.The Domino Effect:
"wb"file throws aTypeError.f.close(), the temporary file is left open by Python.finallyblock attemptsos.unlink()on an open file, which Windows rejects, throwing[WinError 32].The Fix:
Changed the
NamedTemporaryFilemode to"w"with explicit encoding, and yielded it asTextIOto match the expected signature inecho_via_pager.(Note: I did not open an issue prior to this PR as the type mismatch was straightforward.
Regarding Tests:
I did not include an automated test because mocking the Windows Terminal and pager subprocesses in the test suite is a bit tricky, and I'm a first-time contributor. However, the problem is very apparent and easily reproducible.
If you run the following script on Windows 11 using Click 8.4.2, it crashes immediately with a
TypeError(and subsequently[WinError 32]). With my patch applied, it opens the pager and exits cleanly.