Skip to content

Commit e807ba9

Browse files
committed
Timeout: use math.ceil to avoid truncation
1 parent 4ec17c1 commit e807ba9

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

Lib/subprocess.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@
5252
import warnings
5353
import contextlib
5454
import functools
55+
import math
5556
from time import monotonic as _time
5657
import types
5758

@@ -2080,7 +2081,7 @@ def _wait_pidfd(self, timeout):
20802081
try:
20812082
poller = select.poll()
20822083
poller.register(pidfd, select.POLLIN)
2083-
events = poller.poll(math.ceil(timeout * 1000))
2084+
events = poller.poll(int(timeout * 1000))
20842085
if not events:
20852086
raise TimeoutExpired(self.args, timeout)
20862087
return True
@@ -2106,7 +2107,7 @@ def _wait_kqueue(self, timeout):
21062107
)
21072108
try:
21082109
events = kq.control([kev], 1, timeout) # wait
2109-
except OSError:
2110+
except OSError as err:
21102111
return False
21112112
if not events:
21122113
raise TimeoutExpired(self.args, timeout)

0 commit comments

Comments
 (0)