Skip to content

gh-140146: Fix for stdin redirection to a pipe with interactive tkinter on Windows#148819

Open
mdehoon wants to merge 3 commits intopython:mainfrom
mdehoon:issue140146_fix_for_windows_pipe
Open

gh-140146: Fix for stdin redirection to a pipe with interactive tkinter on Windows#148819
mdehoon wants to merge 3 commits intopython:mainfrom
mdehoon:issue140146_fix_for_windows_pipe

Conversation

@mdehoon
Copy link
Copy Markdown
Contributor

@mdehoon mdehoon commented Apr 21, 2026

On Windows, EventHook in _tkinter.c will hang on Windows if Python is run with stdin redirected to a pipe. The reason is that on Windows, EventHook checks for data availability on stdin by calling _kbhit, which reports if a key was hit on the keyboard. With this patch, EventHook first checks whether stdin is a console or a pipe, and then calls either _kbhit or PeekNamedPipe, respectively, to establish if input is available on stdin.

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