Skip to content

Commit cce07ea

Browse files
committed
bpo-46716: Handle negative timeouts for wait on Windows
1 parent 32e7715 commit cce07ea

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

Lib/subprocess.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1483,8 +1483,12 @@ def _wait(self, timeout):
14831483
"""Internal implementation of wait() on Windows."""
14841484
if timeout is None:
14851485
timeout_millis = _winapi.INFINITE
1486+
elif timeout <= 0:
1487+
timeout_millis = 0
14861488
else:
14871489
timeout_millis = int(timeout * 1000)
1490+
if timeout_millis >= _winapi.INFINITE:
1491+
raise OverflowError('timeout too large to convert to C DWORD')
14881492
if self.returncode is None:
14891493
# API note: Returns immediately if timeout_millis == 0.
14901494
result = _winapi.WaitForSingleObject(self._handle,

0 commit comments

Comments
 (0)