You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
OK, this is an actual type error, you should either update the AnyFunction to Callable[..., Coroutine[None, None, Any]] or use a type variable with current type as a bound. I would recommend the second one, I always use it myself and it gives tighter types, with AnyFunction = TypeVar('AnyFunction', bound=Callable[..., Awaitable[Any]]) the code passes.
This is a bit verbose, but I think @gvanrossum proposed that we should actually infer the most precise types for async defs. Possible solution is to define an alias like NativeCoro = Coroutine[None, None, T].
Thanks for clarifying! So the issue is that in the base class run is now inferred as (roughly) Callable[..., Coroutine], and in the child class it is the more general type Callable[..., Awaitable].
I feel like this should perhaps be allowed (just like we allow overriding a function with a different Callable), but it doesn't seem like a big deal.
with master produces
This is a regression since 0.600.
The text was updated successfully, but these errors were encountered: