-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Closed
Labels
bugmypy got something wrongmypy got something wrong
Description
Bug Report
After foo = None
, mypy thinks that foo
will always be None
, even if a loop can jump between the assignment and the use of foo
.
To Reproduce
def main() -> None:
gonna_select = None
while True:
if gonna_select is not None:
print(1 + "lol")
gonna_select = "lol"
Expected Behavior
error from 1 + "lol"
Actual Behavior
no error
Your Environment
- Mypy version used: 0.910
- Mypy command-line flags: none
- Mypy configuration options from
mypy.ini
(and other config files): none - Python version used: 3.7
Metadata
Metadata
Assignees
Labels
bugmypy got something wrongmypy got something wrong