Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gh-124628: Pyrepl inputs on Windows shouldn't always be blocking reads #124629

Merged
merged 2 commits into from
Sep 26, 2024

Conversation

DinoV
Copy link
Contributor

@DinoV DinoV commented Sep 26, 2024

ReadConsoleInput is documented to always return at least 1 input. This causes a couple of hangs in the Windows version of pyrepl:

  1. When flushing the input after Ctrl-C in search we'll do a read, and this won't return until another Ctrl-C which crashes the interpreter. Windows provides an API for flushing the input buffer which we should use.
  2. When passing block=False we also still block. We can use the API to check if there are any inputs available, and if not, then just not block.

@DinoV DinoV added skip news needs backport to 3.13 bugs and security fixes labels Sep 26, 2024
@DinoV DinoV marked this pull request as ready for review September 26, 2024 20:12
@ambv ambv added the topic-repl Related to the interactive shell label Sep 26, 2024
@ambv ambv merged commit 83e5dc0 into python:main Sep 26, 2024
44 checks passed
@miss-islington-app
Copy link

Thanks @DinoV for the PR, and @ambv for merging it 🌮🎉.. I'm working now to backport this PR to: 3.13.
🐍🍒⛏🤖

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Sep 26, 2024
…g reads (pythonGH-124629)

(cherry picked from commit 83e5dc0)

Co-authored-by: Dino Viehland <[email protected]>
@bedevere-app
Copy link

bedevere-app bot commented Sep 26, 2024

GH-124638 is a backport of this pull request to the 3.13 branch.

@bedevere-app bedevere-app bot removed the needs backport to 3.13 bugs and security fixes label Sep 26, 2024
Yhg1s pushed a commit that referenced this pull request Sep 27, 2024
…ng reads (GH-124629) (#124638)

gh-124628: Pyrepl inputs on Windows shouldn't always be blocking reads (GH-124629)
(cherry picked from commit 83e5dc0)

Co-authored-by: Dino Viehland <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
skip news topic-repl Related to the interactive shell
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants