Skip to content

Type created with NewType shouldn't be valid for isinstance call #6828

@erictraut

Description

@erictraut

A type created with NewType cannot be used in an isinstance call. Mypy flags this as an error, but pyright does not.

from typing import NewType

MyInt = NewType("MyInt", int)

v = 1
isinstance(v, MyInt)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions