-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Closed
Labels
bugmypy got something wrongmypy got something wrong
Description
With:
from functools import wraps
from typing import Any, AsyncIterator, Awaitable, Callable, Coroutine, Optional, TypeVar, Union, overload
from aiohttp import web
_T = TypeVar("_T")
_RequestView = TypeVar("_RequestView", web.Request, web.View)
def atomic(coro: Callable[[_RequestView], Awaitable[_T]]):
@wraps(coro)
async def wrapper(request_or_view: _RequestView) -> _T:
reveal_type(request_or_view)
if isinstance(request_or_view, web.View):
request = request_or_view.request
else:
request = request_or_view
I get an unreachable error on the last line. I suspect it is type checking twice with the TypeVar set to web.Request and then to web.View, which is resulting in an unreachable error. Rather odd that it doesn't produce a second unreachable error though...
Metadata
Metadata
Assignees
Labels
bugmypy got something wrongmypy got something wrong