diff --git a/dltype/_lib/_core.py b/dltype/_lib/_core.py index 7de2c21..6326d3c 100644 --- a/dltype/_lib/_core.py +++ b/dltype/_lib/_core.py @@ -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( diff --git a/dltype/tests/dltype_test.py b/dltype/tests/dltype_test.py index 7f240e5..3200185 100644 --- a/dltype/tests/dltype_test.py +++ b/dltype/tests/dltype_test.py @@ -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)