Mypy degrades inferred generic return type from tuple[type[T], ...] to object
Open
Nobody has claimed this yet.
bug
topic-inference
topic-join-v-union
- Dominant language
- Python
- Stars
- 20.6k
- Forks
- 3.3k
- PR merge metrics
- PR metrics pending
Description
Bug Report
Mypy incorrectly treats generic return type inferred from tuple[type[T], ...] as object
To Reproduce
Expected Behavior
Variable is recognized as int | str
Actual Behavior
Mypy error:
Argument 1 to "func_b" has incompatible type "object"; expected "int | str" Mypy(arg-type)
Your Environment
- Mypy version used: 1.19.1
- Python version used: 3.14.0
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the linked Mypy playground or gist and reproduce the error using Mypy 1.19.1 and Python 3.14. Trace the generic return-type inference for tuple[type[T], ...] and verify that the value is recognized as int | str rather than object, with no incompatible-argument error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- compilers, devtools
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100