-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Assignment to next in class body of Iterator elicits error (in PY2 mode) #2503
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
Comments
The type of |
This is a general problem (not just for next). It prevents us from using
mypy with this PR for our own "C" repo (for totally valid code). Should we
roll back the PR or ask its author to come up with a fix? I'm not sure how
involved the fix would be.
|
Just to check if I understand the problem correctly, the following should also pass mypy not? (but it doesn't before the revert; same error as above)
|
That looks right to me, but I'll defer to @JukkaL.
|
Found an even more elegant example:
Pushed a fix, but I would love some feedback if this is an okay way to go. Additionally, would you be able to check if with this version your repo does validate successfully? |
Yes, that example is better because it shows the problem is not due to generics. Where's your fix? You're going to have to create a new PR. |
Both examples look good. |
However here's a more complex example: class I:
def foo(self) -> None: pass
class A(I):
def foo(self) -> None: pass
class B(A):
def bar(self) -> None: pass
foo = bar
class C(B):
def bar(self) -> None: pass
foo = bar |
Note that this becomes relevant after #2510 is merged. |
Since #2380 was merged, the following example elicits an error when type-checked in Python 2 mode:
The error comes from the code added by #2380:
The text was updated successfully, but these errors were encountered: