pyright
pyright copied to clipboard
is_dataclass always evaluates to false with TypeVars
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()
Could someone from the pylance team please transfer this to the pyright project, since it's a core type checker issue? Thanks!
It looks like this has been fixed in #8738
This still needs to be fixed.
This is addressed in pyright 1.1.380.