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
Mypy only recognizes certain checks as runtime type checks -- this includes isinstance(x, C) and x is [not] None, but it does not include tuple length checks. So mypy doesn't narrow the union type to a specific union member based on the condition.
I suspect there's probably already another issue open that may have more discussion about this.
Uh oh!
There was an error while loading. Please reload this page.
Bug Report
For a Union type of two possible Tuple lengths, mypy reports index out of range for Tuples of the longer type even with a proper explicit check.
To Reproduce
Expected Behavior
The code listing above should be perfectly typed.
Actual Behavior
mypy reports,
Your Environment
--ignore-missing-imports
mypy.ini
(and other config files):The text was updated successfully, but these errors were encountered: