python-trio / trio-typing

Type hints for Trio and related projects
Other
27 stars 13 forks source link

`@takes_callable_and_args` plugin is broken on Mypy v1.0.0 #71

Closed gschaffner closed 1 year ago

gschaffner commented 1 year ago

a change occurred in Mypy v1.0.0 that is causing a previously untriggered bug in trio_typing.plugin's @takes_callable_and_args support to occur. for example:

async def foo(a: int) -> None:
    ...

async with trio.open_nursery() as nursery:
    nursery.start_soon(foo, 0)
    # error: Argument 1 to "start_soon" of "Nursery" has incompatible type "Callable[[int], Coroutine[Any, Any, None]]"; expected "Callable[[__T1], Awaitable[Any]]"

(credit due to @belm0 for reporting this at https://gitter.im/python-trio/general?at=63e2f572511fff631f6decbc :) )