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
class Response(StreamResponse):
_body: Optional[bytes]
Then I get a type error: Incompatible types in assignment (expression has type "Optional[bytes]", base class "StreamResponse" defined the type as "None") [assignment]
To Reproduce
See next comment.
Your Environment
Mypy version used: 0.930 (but, those type errors must have been there for months already)
Bug Report
This code defines
self._bodyasOptional[bytes]and does not produce any type errors: https://github.com/aio-libs/aiohttp/blob/f1eb09b3756f4ed378a25f8a634f734952d2da35/aiohttp/web_response.py#L589If I instead define the type on the class, like:
Then I get a type error:
Incompatible types in assignment (expression has type "Optional[bytes]", base class "StreamResponse" defined the type as "None") [assignment]To Reproduce
See next comment.
Your Environment
mypy.ini: https://github.com/aio-libs/aiohttp/blob/master/.mypy.ini