Skip to content

is_dataclass always evaluates to false with TypeVars #8686

@peku33

Description

@peku33

dataclasses.is_dataclass seems to always evaluate to false for generic types.

Environment data

  • Language Server version: 2024.8.1
  • OS and version: darwin arm64
  • Python version (and distribution if applicable, e.g. Anaconda): 3.11.9
  • python.analysis.indexing: true
  • python.analysis.typeCheckingMode: strict

Code Snippet

from dataclasses import is_dataclass
from typing import TypeVar

T = TypeVar("T")


def test_fn(type_: type[T]) -> T:
    assert is_dataclass(type_)

    print("this is marked as unreachable")

    raise NotImplementedError()

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
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions