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

Old-style genericParamSpec(default=...) fails if not provided as a type argument and not in the last position of a type list when passing type arguments #138859

Closed
Assignees
sobolevn
Labels
stdlibStandard Library Python modules in the Lib/ directorytopic-typingtype-bugAn unexpected behavior, bug, or error
@bzoracler

Description

@bzoracler

Bug report

Bug description:

In accordance to the typing specifications,default= ofParamSpec can take an ellipsis.... However, this is not handled properly with old-style generics in the following example and causes a runtime error:

fromtypingimportGeneric,ParamSpec,TypeVarP_default=ParamSpec("P_default",default=...)T=TypeVar("T")T_default=TypeVar("T_default",default=object)classA(Generic[T,P_default,T_default]):pass
>>> A[int]Traceback (most recent call last):  ...TypeError: can only concatenate list (not "tuple") to list

CPython versions tested on:

3.13

Operating systems tested on:

Linux

Linked PRs

Metadata

Metadata

Assignees

Labels

stdlibStandard Library Python modules in the Lib/ directorytopic-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