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 timeout=None
  • Loading branch information
chris-eibl committed Apr 24, 2025
commit cad6bfb50a84af0b617d99f9ed86cca5d10ea8fc
9 changes: 8 additions & 1 deletion Lib/_pyrepl/windows_console.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,9 @@ def __init__(self, err: int | None, descr: str | None = None) -> None:
WAIT_TIMEOUT = 0x102
WAIT_FAILED = 0xFFFFFFFF

# from winbase.h
INFINITE = 0xFFFFFFFF


class _error(Exception):
pass
Expand Down Expand Up @@ -523,7 +526,11 @@ def getpending(self) -> Event:

def wait(self, timeout: float | None) -> bool:
"""Wait for an event."""
ret = WaitForSingleObject(InHandle, int(timeout))
if timeout is None:
timeout = INFINITE
else:
timeout = int(timeout)
ret = WaitForSingleObject(InHandle, timeout)
if ret == WAIT_FAILED:
raise WinError(ctypes.get_last_error())

Expand Down
Loading