Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion dltype/_lib/_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ def from_hint( # noqa: PLR0911
if origin is not Annotated:
if (
any(T in hint.mro() for T in _dtypes.SUPPORTED_TENSOR_TYPES)
if hint and hasattr(hint, "mro")
if hint and hasattr(hint, "mro") and hint is not type
else False
):
warnings.warn(
Expand Down
8 changes: 8 additions & 0 deletions dltype/tests/dltype_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -1732,3 +1732,11 @@ def func(non_optional_tensor: SomeTensorT, optional_tensor: SomeTensorT | None =

with pytest.raises(dltype.DLTypeUnsupportedTensorTypeError):
func(None, torch.zeros((1, 2, 3))) # pyright: ignore[reportArgumentType]


def test_weird_type() -> None:
@dltype.dltyped()
def func(arg: type) -> None:
pass

func(int)
Loading