-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Open
Labels
bugmypy got something wrongmypy got something wrongtopic-join-v-unionUsing join vs. using unionsUsing join vs. using unions
Description
Bug Report
Combining iterables of Callable classes fails type checking. Initially observed in PyTorch, see https://github.com/pytorch/pytorch/pull/153558/files#diff-f6db1b80859c6471ce6e5eb1fc0e31ec094d550e328eeec49076fd346439de91R88
To Reproduce
https://mypy-play.net/?mypy=latest&python=3.13&gist=f51186b431defd72652a9dd1c7ca0b48
Expected Behavior
All assignments in the repro should validate.
Actual Behavior
main.py:15: error: Incompatible types in assignment (expression has type "list[object]", variable has type "list[Callable[..., Any]]") [assignment]
main.py:20: error: Incompatible types in assignment (expression has type "list[object]", variable has type "list[Callable[..., Any]]") [assignment]
Found 2 errors in 1 file (checked 1 source file)
Your Environment
- Mypy version used: 1.15.0, also observed on 1.14.0.
- Python version used: 3.13, observed as far back as 3.9 locally.
- See mypy-play.net repro for any other environment questions.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugmypy got something wrongmypy got something wrongtopic-join-v-unionUsing join vs. using unionsUsing join vs. using unions