python/typeshed#11250 changed the signatures of SocketType.recv and friends, so it should now be possible to change
|
# Not possible to typecheck with a Callable (due to DefaultArg), nor with a |
|
# callback Protocol (https://github.com/python/typing/discussions/1040) |
|
# but this seems to work. If not explicitly defined then pyright --verifytypes will |
|
# complain about AmbiguousType |
|
if TYPE_CHECKING: |
|
|
|
def recv(__self, __buflen: int, __flags: int = 0) -> Awaitable[bytes]: ... |
|
|
|
# _make_simple_sock_method_wrapper is typed, so this checks that the above is correct |
|
# this requires that we refrain from using `/` to specify pos-only |
|
# args, or mypy thinks the signature differs from typeshed. |
|
recv = _make_simple_sock_method_wrapper( |
|
_stdlib_socket.socket.recv, |
|
_core.wait_readable, |
|
) |
although I'm surprised that mypy haven't started complaining from bumping typeshed. Maybe they did some backwards compatibility thing? Or haven't bumped typeshed?
python/typeshed#11250 changed the signatures of
SocketType.recvand friends, so it should now be possible to changetrio/src/trio/_socket.py
Lines 1115 to 1129 in 4e979bf
although I'm surprised that mypy haven't started complaining from bumping typeshed. Maybe they did some backwards compatibility thing? Or haven't bumped typeshed?