We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Bug Report
Mypy seems to assume that for loop body executes at least once when inferring index variable types.
To Reproduce
x: int | str x = "abc" for x in list[int](): pass reveal_type(x) # int
Expected Behavior
Revealed type is int | str.
int | str
Actual Behavior
Revealed type is int.
int
Your Environment
Latest master.
The text was updated successfully, but these errors were encountered:
Nice! thanks for the fix — this will also close #16321
Sorry, something went wrong.
Don't assume that for loop body index variable is always set (#18631)
f946af4
Fixes #18629. Fixes #16321. Fixes #8637.
Don't assume that for loop body index variable is always set (python#…
7d0f4d6
…18631) Fixes python#18629. Fixes python#16321. Fixes python#8637.
JukkaL
Successfully merging a pull request may close this issue.
Bug Report
Mypy seems to assume that for loop body executes at least once when inferring index variable types.
To Reproduce
Expected Behavior
Revealed type is
int | str
.Actual Behavior
Revealed type is
int
.Your Environment
Latest master.
The text was updated successfully, but these errors were encountered: