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

Incorrect argument substitution on Unpack[tuple[...]] #118168

Closed
Assignees
JelleZijlstra
Labels
3.12only security fixes3.13bugs and security fixestopic-typingtype-bugAn unexpected behavior, bug, or error
@JelleZijlstra

Description

@JelleZijlstra

Bug report

Bug description:

In the code below, all of the prints should be equivalent:

fromtypingimportGeneric,Tuple,TypeVarTuple,UnpackTs=TypeVarTuple("Ts")classOld(Generic[*Ts]): ...classNew[*Ts]: ...PartOld=Old[int,*Ts]print(PartOld[str])print(PartOld[*tuple[str]])print(PartOld[*Tuple[str]])print(PartOld[Unpack[tuple[str]]])# Old[int, typing.Unpack[tuple[str]]]print(PartOld[Unpack[Tuple[str]]])PartNew=New[int,*Ts]print(PartNew[str])print(PartNew[*tuple[str]])print(PartNew[*Tuple[str]])print(PartNew[Unpack[tuple[str]]])# New[int, typing.Unpack[tuple[str]]]print(PartNew[Unpack[Tuple[str]]])

However, theUnpack[tuple[]] variants print something different. This is because the implementation ofUnpack doesn't deal correctly with builtin aliases. I'll send a PR.

CPython versions tested on:

3.12, CPython main branch

Operating systems tested on:

macOS

Linked PRs

Metadata

Metadata

Assignees

Labels

3.12only security fixes3.13bugs and 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