Closed
Description
Bug Report
This code defines self._body
as Optional[bytes]
and does not produce any type errors: https://github.com/aio-libs/aiohttp/blob/f1eb09b3756f4ed378a25f8a634f734952d2da35/aiohttp/web_response.py#L589
If I instead define the type on the class, like:
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)
- Mypy configuration options from
mypy.ini
: https://github.com/aio-libs/aiohttp/blob/master/.mypy.ini