-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Spurious "incompatible with supertype" error with double inheritance from a generic #5027
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Labels
bug
mypy got something wrong
false-positive
mypy gave an error on correct code
priority-1-normal
topic-type-variables
Comments
JelleZijlstra
added a commit
to JelleZijlstra/typeshed
that referenced
this issue
Jun 12, 2018
Fixes python#2189 The errors from mypy are a false positive (see python/mypy#5027).
gvanrossum
pushed a commit
to python/typeshed
that referenced
this issue
Jun 12, 2018
Fixes #2189. The errors from mypy are a false positive (see python/mypy#5027).
JelleZijlstra
added a commit
to JelleZijlstra/typeshed
that referenced
this issue
Jun 17, 2018
Matches the implementation in https://github.com/python/cpython/blob/3.4/Lib/http/client.py#L308 The ignore works around python/mypy#5027 (commented further up in the 3.5 branch). Part of python#1476.
ilevkivskyi
pushed a commit
to python/typeshed
that referenced
this issue
Jun 17, 2018
Matches the implementation in https://github.com/python/cpython/blob/3.4/Lib/http/client.py#L308 The ignore works around python/mypy#5027 (commented further up in the 3.5 branch). Part of #1476.
yedpodtrzitko
pushed a commit
to yedpodtrzitko/typeshed
that referenced
this issue
Jan 23, 2019
Fixes python#2189. The errors from mypy are a false positive (see python/mypy#5027).
yedpodtrzitko
pushed a commit
to yedpodtrzitko/typeshed
that referenced
this issue
Jan 23, 2019
Matches the implementation in https://github.com/python/cpython/blob/3.4/Lib/http/client.py#L308 The ignore works around python/mypy#5027 (commented further up in the 3.5 branch). Part of python#1476.
This got fixed somewhere; the sample in my post above now passes mypy. I'm going to close this and remove the related type ignores in typeshed. |
JelleZijlstra
added a commit
to JelleZijlstra/typeshed
that referenced
this issue
May 28, 2020
The mypy issue got fixed by the good people of mypy. I did have to add an override for __enter__ similar to what we're doing in python#4082.
JelleZijlstra
added a commit
to python/typeshed
that referenced
this issue
May 28, 2020
The mypy issue got fixed by the good people of mypy. I did have to add an override for __enter__ similar to what we're doing in #4082.
vishalkuo
pushed a commit
to vishalkuo/typeshed
that referenced
this issue
Jun 26, 2020
The mypy issue got fixed by the good people of mypy. I did have to add an override for __enter__ similar to what we're doing in python#4082.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
bug
mypy got something wrong
false-positive
mypy gave an error on correct code
priority-1-normal
topic-type-variables
The following file:
produces
with mypy 0.600 and python 3.7.0b4.
This should be accepted because the class inherits from
A[bytes]
, which means that itsx
method should indeed returnbytes
. This is only a problem with double inheritance: if I makeB
inherit fromA[bytes]
, mypy shows no error forB
.My use case was that I wanted to make a typeshed class inherit from both
io.BufferedIOBase
(to reflect the implementation) andIO[bytes]
(to make it compatible with type hints that acceptIO[bytes]
).The text was updated successfully, but these errors were encountered: