Skip to content
Prev Previous commit
Next Next commit
Fix timeout in RecvChannel.recv().
  • Loading branch information
ericsnowcurrently committed Oct 17, 2023
commit b1c2b909318814815ea75815f9d93671abedc388
4 changes: 2 additions & 2 deletions Lib/test/support/interpreters.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,11 +183,11 @@ def recv(self, timeout=None, *,
timeout = int(timeout)
if timeout < 0:
raise ValueError(f'timeout value must be non-negative')
end = time.now() + timeout
end = time.time() + timeout
obj = _channels.recv(self._id, _sentinel)
while obj is _sentinel:
time.sleep(_delay)
if timeout is not None and time.now() >= end:
if timeout is not None and time.time() >= end:
raise TimeoutError
obj = _channels.recv(self._id, _sentinel)
return obj
Expand Down