Skip to content

Final should not be compatible with type[T] #7094

@erictraut

Description

@erictraut

The following should generate an error but doesn't.

T = TypeVar("T")

def takes_type(t: type[T]) -> T:
    return t()

takes_type(Final[int])

Final is a special form.

Metadata

Metadata

Assignees

No one assigned

    Labels

    addressed in next versionIssue is fixed and will appear in next published versionbugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions