-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Mypy forgets type information after a nested if-statement. #5378
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
Yeah, this does look like a bug. I somehow thought that the "binder" (the part of mypy that handles this) uses a stack, but here it appears it has popped too much off the stack. Does this also occur with older mypy versions? |
When I encountered this, I had 0.610. |
I wonder how easy this would be to fix? I would be happy if I could fix it, but I haven't had the time to study the mypy code yet. |
The binder is a piece of work, so this may not be an easy project for a beginner. Sorry. |
This bug still happens in 1.7.1. |
This passes after #18138 from @sterliakov :-) |
Mypy forgets type information after a nested if-statement. Small example:
Mypy 0.620 correctly infers that x has a member args for the first print statement, but after the nested if statement, it has forgotten about that and throws an error.
The text was updated successfully, but these errors were encountered: