-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Closed
Labels
bugmypy got something wrongmypy got something wrongtopic-descriptorsProperties, class vs. instance attributesProperties, class vs. instance attributes
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
Metadata
Metadata
Assignees
Labels
bugmypy got something wrongmypy got something wrongtopic-descriptorsProperties, class vs. instance attributesProperties, class vs. instance attributes