False exception error in except clause with a ternary conditional operator #7356
Labels
bug
mypy got something wrong
false-positive
mypy gave an error on correct code
priority-1-normal
topic-ternary-expression
a if b else c
MyPy reports an error:
Actually
except
accepts either an exception type, or a tuple of exception types (including an empty tuple).(PermissionError,) if sys.platform == "win32" else ()
also causes an error. But(PermissionError,) if sys.platform == "win32" else (IsADirectoryError,)
is accepted by MyPy.The text was updated successfully, but these errors were encountered: