Skip to content

Mypy degrades inferred generic return type from tuple[type[T], ...] to object #20891

@Vanerio

Description

@Vanerio

Bug Report
Mypy incorrectly treats generic return type inferred from tuple[type[T], ...] as object

To Reproduce

Gist URL
Playground URL

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugmypy got something wrongtopic-inferenceWhen to infer types or require explicit annotationstopic-join-v-unionUsing join vs. using unions

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions