8000 ipc: Remove some typeshed-related TODOs (#13982) · python/mypy@fed90ca · GitHub
[go: up one dir, main page]

Skip to content

Commit fed90ca

Browse files
authored
ipc: Remove some typeshed-related TODOs (#13982)
As per the TODO comments, this PR removes some unnecessary `assert`s in `mypy/ipc.py`. When these `assert`s were added in #6148, typeshed wasn't able to use `Literal` types yet. However, nowadays, typeshed has precise `Literal` overloads for `_winapi.WriteFile` and `_winapi.ConnectNamedType`, meaning mypy is able to precisely infer the return type of these function calls without the need for the `assert`s in `mypy/ipc.py`: https://github.com/python/typeshed/blob/main/stdlib/_winapi.pyi.
1 parent 32c26f2 commit fed90ca

File tree

1 file changed

+0
-5
lines changed

1 file changed

+0
-5
lines changed

mypy/ipc.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -89,9 +89,6 @@ def write(self, data: bytes) -> None:
8989
if sys.platform == "win32":
9090
try:
9191
ov, err = _winapi.WriteFile(self.connection, data, overlapped=True)
92-
# TODO: remove once typeshed supports Literal types
93-
assert isinstance(ov, _winapi.Overlapped)
94-
assert isinstance(err, int)
9592
try:
9693
if err == _winapi.ERROR_IO_PENDING:
9794
timeout = int(self.timeout * 1000) if self.timeout else _winapi.INFINITE
@@ -217,8 +214,6 @@ def __enter__(self) -> IPCServer:
217214
# client never connects, though this can be "solved" by killing the server
218215
try:
219216
ov = _winapi.ConnectNamedPipe(self.connection, overlapped=True)
220-
# TODO: remove once typeshed supports Literal types
221-
assert isinstance(ov, _winapi.Overlapped)
222217
except OSError as e:
223218
# Don't raise if the client already exists, or the client already connected
224219
if e.winerror not in (_winapi.ERROR_PIPE_CONNECTED, _winapi.ERROR_NO_DATA):

0 commit comments

Comments
 (0)
0