From 49348553c2a86a8681734de214d753622f966597 Mon Sep 17 00:00:00 2001 From: David Langerman Date: Wed, 3 Jun 2026 20:29:47 -0400 Subject: [PATCH] fix type as an arg causing an error --- dltype/_lib/_core.py | 2 +- dltype/tests/dltype_test.py | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) 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)