Skip to content

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

Closed

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)

Activity

  1. added
    addressed in next version
    on Dec 28, 2023
  2. erictraut commented on Dec 30, 2023

    @erictraut
    CollaboratorAuthor

    This is addressed in pyright 1.1.344, which I just published. It will also be included in a future release of pylance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    addressed in next versionenhancement request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions