Skip to content

Commit 421241a

Browse files
dlangermdlangerm-stackav
authored andcommitted
fix type as an arg causing an error
1 parent a9c59e3 commit 421241a

2 files changed

Lines changed: 9 additions & 1 deletion

File tree

dltype/_lib/_core.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ def from_hint( # noqa: PLR0911
101101
if origin is not Annotated:
102102
if (
103103
any(T in hint.mro() for T in _dtypes.SUPPORTED_TENSOR_TYPES)
104-
if hint and hasattr(hint, "mro")
104+
if hint and hasattr(hint, "mro") and hint is not type
105105
else False
106106
):
107107
warnings.warn(

dltype/tests/dltype_test.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1732,3 +1732,11 @@ def func(non_optional_tensor: SomeTensorT, optional_tensor: SomeTensorT | None =
17321732

17331733
with pytest.raises(dltype.DLTypeUnsupportedTensorTypeError):
17341734
func(None, torch.zeros((1, 2, 3))) # pyright: ignore[reportArgumentType]
1735+
1736+
1737+
def test_weird_type() -> None:
1738+
@dltype.dltyped()
1739+
def func(arg: type) -> None:
1740+
pass
1741+
1742+
func(int)

0 commit comments

Comments
 (0)