Skip to content

Commit c57d3ab

Browse files
Ammend annotation for __slots__
This fixes an assignablity issue in subclasses that was caused by using too strict an annotation for the purpose of `__slots__` as a special case for mypy. We can keep an annotation here for mypy if really needed, but it needs to work with subclass assignability. ideally, long term all data model names are understood as part of the specification, but this needs to be permissive enough to allow subclasses to add members. See error in pyright as a result of adding a special case for mypy: microsoft/pyright#11058
1 parent 546dd28 commit c57d3ab

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

stdlib/asyncio/protocols.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ class BaseProtocol:
1414

1515
class Protocol(BaseProtocol):
1616
# Need annotation or mypy will complain about 'Cannot determine type of "__slots__" in base class'
17-
__slots__: tuple[()] = ()
17+
__slots__: tuple[str, ...] = ()
1818
def data_received(self, data: bytes) -> None: ...
1919
def eof_received(self) -> bool | None: ...
2020

0 commit comments

Comments
 (0)