Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

User generic with TypeVarTuple does not check for minimal type of arguments #99382

Closed
Labels
3.11only security fixes3.12only security fixestopic-typingtype-bugAn unexpected behavior, bug, or error
@serhiy-storchaka

Description

@serhiy-storchaka

The following code:

fromtypingimport*T=TypeVar('T')T2=TypeVar('T2')Ts=TypeVarTuple('Ts')classA(Generic[T,T2,*Ts]):x:List[T]y:List[T2]z:Tuple[*Ts]A[int]

is executed without errors. It is expected to get an error becauseA requires at least two arguments.

WithoutTypeVarTuple you get helpful errors.

classB(Generic[T,T2]):passB[int]B[int,str,bytes]
TypeError: Too few arguments for <class '__main__.B'>; actual 1, expected 2
TypeError: Too many arguments for <class '__main__.B'>; actual 3, expected 2

Metadata

Metadata

Assignees

No one assigned

    Labels

    3.11only security fixes3.12only security fixestopic-typingtype-bugAn unexpected behavior, bug, or error

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp