-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
(🐞) for
/else
with break
statement incorrect possibly-undefined error
#14209
Comments
Also when the else condition raises:
|
for
/else
with break
statement incorrect partially defined errorfor
/else
with break
statement incorrect possibly-undefined error
I'm not able to repro the problem with the latest version of mypy. But then again, I'm not able to repro with any versions going back to 0.990, so maybe I'm not using the right configuration. @KotlinIsland, are you able to repro this issue with the latest version? BTW, it would be useful in the future if you included the mypy version in your bug reports as requested in the bug template. |
Did you miss enabling the error code? Both still reproduce on 1.5. |
Ah, that was what I was missing. I though this error code was enabled by default in recent versions of mypy. |
@erictraut You should try using basedmypy, all errors are enabled by default. |
It also seems impossible to get something like this to type check:
I guess mypy doesn't know how to confirm that the loop is guaranteed to execute. |
This also fails:
Seems like mypy doesn't understand that the |
I never contributed code to mypy before, but would love to get this fixed. |
Yeah, it would be a relatively simple scenario. Likely only one spot that needs fixing |
I started my Draft PR (#17720) by adding three failing test cases reproducing the issue. If someone can help me with a builtins/fixture issue, that would be highly appreciated. It's not a blocker yet (I have two "good" failing tests to work with), but I'm curious to learn more about how this is done "properly" 🙂 |
update class list:
def __iter__(self): ... |
While investigating this issue, I determined five separate issues or possible improvements with
I hope I can get #17720 merged, but currently don't have the capacity to work on the other points. |
#14191 (comment)
The text was updated successfully, but these errors were encountered: