You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I can't repro, the only error I get is main.py:5: error: "append" of "list" does not return a value [func-returns-value] which is correct (you need to do return arg).
Bug Report
When I use
or
to handleNone
, mypy doesn't recognize that the code handles theNone
case and issues errors about accessing attributes:I get a
union-attr
error forappend
. To fix this, I can do the following:However, I think this is wrong because the code is equivilent. Am I'm missing something here?
Expected Behavior
I would expect that when using
arg or []
, mypy would recognize thatarg
is neverNone
after that line (assuming I don't override).Actual Behavior
error: Item "None" of "Optional[list]" has no attribute "append" [union-attr]
Your Environment
pyproject.toml
:The text was updated successfully, but these errors were encountered: