Skip to content

mypy doesn't know about empty unpacked tuples #18390

Open
@A5rocks

Description

@A5rocks

Bug Report

Blah[()] works sometimes when Blah[Unpack[tuple[()]]] doesn't and that doesn't make sense.

To Reproduce

from typing import Generic, TypeVarTuple, Unpack

Ts = TypeVarTuple("Ts")

class Blah(Generic[Unpack[Ts]]):
    pass

x: Blah[()]  # works
y: Blah[Unpack[tuple[()]]]  # E: Missing type parameters for generic type "Blah[()]"

Expected Behavior

Both should work.

Actual Behavior

Only first works.

Your Environment

Checked on mypy playground.

  • Mypy version used: v1.14
  • Mypy command-line flags: strict
  • Mypy configuration options from mypy.ini (and other config files): N/A
  • Python version used: 3.12

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugmypy got something wrongtopic-pep-646PEP 646 (TypeVarTuple, Unpack)

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions