-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
unreachable code after suppress() #9199
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
IIRC there is a way to tell mypy that a context manager can swallow an exception by annotating its |
It appears that's already been done (by return I think the problem is that Mypy fails to recognise that if an exception is thrown then the |
Actually, it looks like the exact same issue that introduced this: #7214 |
Perhaps you have some configuration flag that affects this? And (just to be sure) what mypy version are you using? I can't repro your issue, but it looks like you didn't show all the code of a self-contained example. |
Hmm, running it again, the error has now disappeared... |
Mypy reports this as unreachable code on the last line:
If the indexing causes a KeyError, this code will be reached.
_get_session()
isAny
, but I also tried casting it to aDict
. So, it looks like Mypy assumes this will always succeed, despite us explicitly catching the error.The text was updated successfully, but these errors were encountered: