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
{{ message }}
Repository navigation
Union is incorrectly constructed when callable() is used, resulting in a false positive #9778
mypy reports foo.py:9: error: Incompatible return value type (got "Union[T, object]", expected "T")
Your Environment
Mypy version used: 0.790 and confirmed on master
Python version used: 3.6, 3.9
The oddest thing is that this will pass if I replace callable with a wrapper, e.g.
defcheck(x: object) ->bool:
returncallable(x)
reveal_type(check) is almost identical to reveal_type(callable):
foo.py:9: note: Revealed type is 'def (x: builtins.object) -> builtins.bool'
foo.py:10: note: Revealed type is 'def (builtins.object) -> builtins.bool'
This might be related to other false positives around Union + TypeVar (e.g. #6898) but I am unsure.
Activity
Narrow type variable bounds in binder (python#19183)