Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix return value of wait() and use it in _read_input()
  • Loading branch information
chris-eibl committed Apr 24, 2025
commit 4098e3d5de951fbac4b7db95fbf2f333366d1d8c
11 changes: 5 additions & 6 deletions Lib/_pyrepl/windows_console.py
Original file line number Diff line number Diff line change
Expand Up @@ -416,12 +416,8 @@ def _getscrollbacksize(self) -> int:
return info.srWindow.Bottom # type: ignore[no-any-return]

def _read_input(self, block: bool = True) -> INPUT_RECORD | None:
if not block:
ret = WaitForSingleObject(InHandle, 0)
if ret == WAIT_FAILED:
raise WinError(get_last_error())
elif ret == WAIT_TIMEOUT:
return None
if not block and not self.wait(timeout=0):
return None

rec = INPUT_RECORD()
read = DWORD()
Expand Down Expand Up @@ -536,6 +532,9 @@ def wait(self, timeout: float | None) -> bool:
ret = WaitForSingleObject(InHandle, timeout)
if ret == WAIT_FAILED:
raise WinError(get_last_error())
elif ret == WAIT_TIMEOUT:
return False
return True

def repaint(self) -> None:
raise NotImplementedError("No repaint support")
Expand Down