-
-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Open
Labels
bugmypy got something wrongmypy got something wrong
Description
Bug Report
isinstance throws Parameterized generics cannot be used with class or instance checks [misc] for TypeAlias for a class inherited from NamedTuple. This is related to #18488
To Reproduce
from typing import Any, TypeAlias, NamedTuple
class Foo(NamedTuple):
pass
Alias: TypeAlias = Foo
def is_foo(x: Any) -> bool:
return isinstance(x, Alias)https://mypy-play.net//?mypy=latest&python=3.13&gist=91206dbc88693a2e88ec03e79a8d8235
Expected Behavior
Should not throw.
Actual Behavior
Throws Parameterized generics cannot be used with class or instance checks [misc]
- Mypy version used: 1.19.1
- Mypy command-line flags:
mypy . --strict - Mypy configuration options from
pyproject.toml:
[tool.mypy]
strict = true
allow_redefinition = true
allow_redefinition_new = true
local_partial_types = true
follow_untyped_imports = true- Python version used: 3.13.11
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugmypy got something wrongmypy got something wrong