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
blueyed
changed the title
IOBase: Return type "str" of "readline" incompatible with return type "bytes" in supertype "IOBase" [override]
Return type "str" of "readline" incompatible with return type "bytes" in supertype "IOBase" [override]
Oct 26, 2020
blueyed
added a commit
to blueyed/pytest
that referenced
this issue
Oct 26, 2020
Currently, mypy only stops checking for LSP violations in the class hierarchy once it encounters a super class with a violation. Instead, it should stop after first encountering the method while walking up the inheritance tree, no matter whether that is a violation or not.
Here is an example not using typeshed:
classBase:
deffoo(self, x: int) ->None:
passclassSub1(Base):
deffoo(self, x: str) ->None: # type: ignore[override]passclassSub2(Sub1):
deffoo(self, x: str) ->None: # Argument 1 of "foo" is incompatible with supertype "Base"; supertype defines the argument type as "int" [override]pass
Sub2.foo should only be checked against Sub1.foo, not Base.foo as well.
Since python/typeshed#4145 (released with mypy 0.790) mypy fails with:
According to python/typeshed#4145 (comment) this is likely a bug in mypy.
(mypy 0.800+dev.f220ce50725ed7f117832b9f03aed4d1a9508e00 (current master))
The text was updated successfully, but these errors were encountered: