Spurious type error in except
branch after an assignment from an await
that throws
#18074
Labels
bug
mypy got something wrong
Bug Report
If a loop is guarded with an
x is not None
condition, and the body of the loop contains atry
...except
that assigns tox
,mypy
erroneously concludes thatx
might beNone
in theexcept
branch.To Reproduce
(https://mypy-play.net/?mypy=latest&python=3.12&gist=000b86de168d7bca72f3ff58de4121cb)
Expected Behavior
The program is well-typed.
Actual Behavior
Your Environment
See Playground details.
The text was updated successfully, but these errors were encountered: