diff --git a/mypy/ipc.py b/mypy/ipc.py index 2d0139aca6cd..881b5c3f5592 100644 --- a/mypy/ipc.py +++ b/mypy/ipc.py @@ -94,10 +94,10 @@ def close(self) -> None: class IPCClient(IPCBase): """The client side of an IPC connection.""" - def __init__(self, name: str, timeout: Optional[int]) -> None: + def __init__(self, name: str, timeout: Optional[float]) -> None: super().__init__(name) if sys.platform == 'win32': - timeout = timeout or 0xFFFFFFFF # NMPWAIT_WAIT_FOREVER + timeout = int(timeout * 1000) if timeout else 0xFFFFFFFF # NMPWAIT_WAIT_FOREVER try: _winapi.WaitNamedPipe(self.name, timeout) except FileNotFoundError: diff --git a/mypy/test/testipc.py b/mypy/test/testipc.py index fed0d7fb41b1..f2ee77d5ff0f 100644 --- a/mypy/test/testipc.py +++ b/mypy/test/testipc.py @@ -28,7 +28,7 @@ def test_transaction_large(self) -> None: p = Process(target=server, args=(msg, queue), daemon=True) p.start() connection_name = queue.get() - with IPCClient(connection_name, timeout=1000) as client: + with IPCClient(connection_name, timeout=1) as client: assert client.read() == msg.encode() client.write(b'test') queue.close() @@ -41,11 +41,11 @@ def test_connect_twice(self) -> None: p = Process(target=server, args=(msg, queue), daemon=True) p.start() connection_name = queue.get() - with IPCClient(connection_name, timeout=1000) as client: + with IPCClient(connection_name, timeout=1) as client: assert client.read() == msg.encode() client.write(b'') # don't let the server hang up yet, we want to connect again. - with IPCClient(connection_name, timeout=1000) as client: + with IPCClient(connection_name, timeout=1) as client: assert client.read() == msg.encode() client.write(b'test') queue.close()