python / python/mypy

mypy should give error at the timing when the type alias set multiple `TypeVarTuple`-based type parameters is defined but not used

Offen
#20,544 2 Kommentare 0 Reaktionen 1 zugewiesene Person Auf GitHub ansehen

@aviralgarg05 arbeitet bereits daran.

Seit 09.1.2026.

bug topic-pep-646
Vorherrschende Sprache
Python
Sterne
20.6k
Forks
3.3k
PR-Merge-Kennzahlen
PR-Kennzahlen ausstehend

Beschreibung

*Memo:

  • mypy test.py
  • mypy 1.19.1
  • Python 3.14.0

Defining the type alias set multiple TypeVarTuple-based type parameters, mypy doesn't give error while mypy gives the error, when using the type alias as shown below so mypy should give error at the timing when the type alias set multiple TypeVarTuple-based type parameters is defined but not used:

*Memo:

  • pyright and pyrefly give error at the timing when the type alias set multiple TypeVarTuple-based type parameters is defined.
''' New syntax '''
type TA[*Ts1, *Ts2] = tuple[*Ts1] | tuple[*Ts2] # No error
''' New syntax '''

''' Old syntax '''
# from typing import TypeAlias, TypeVarTuple

# Ts1 = TypeVarTuple('Ts1')
# Ts2 = TypeVarTuple('Ts2')

# TA: TypeAlias = tuple[*Ts1] | tuple[*Ts2] # No error
''' Old syntax '''

v: TA[*tuple[int, ...], *tuple[str, ...]] # Error

error: More than one variadic Unpack in a type is not allowed

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.