I believe the problem might be something around the keywordis. Here are my test cases:
The first one is the case you provided:
And the second test case is:
I changed the keyword is to the operator == and it shows that mypy detects the error. Therefore, I believe the problem can be located with the keyword is.
I will continue working on this by further inspecting the source code and updating my process! However, I am new to mypy and not familiar with that. It would be best if you can provide me with some information that which files I should pay more attention to.
Activity
Akuli commented on Jan 4, 2022
Workaround: user: int | None = None or user: Optional[int] = None
zhangck981 commented on Apr 2, 2022
I believe the problem might be something around the keywordis. Here are my test cases:


The first one is the case you provided:
And the second test case is:
I changed the keyword is to the operator == and it shows that mypy detects the error. Therefore, I believe the problem can be located with the keyword is.
I will continue working on this by further inspecting the source code and updating my process! However, I am new to mypy and not familiar with that. It would be best if you can provide me with some information that which files I should pay more attention to.
A5rocks commented on Jan 22, 2025
Fixed by #18433.