don't try and access __name__ on typing classes

This commit is contained in:
sneakers-the-rat 2024-05-17 16:27:05 -07:00
parent 49a51563d6
commit 7fee64ada6
Signed by untrusted user who does not match committer: jonny
GPG key ID: 6DCB96EF1E4D232D

View file

@ -140,7 +140,10 @@ class NDArray(NPTypingType, metaclass=NDArrayMeta):
json_schema = handler.resolve_ref_schema(json_schema)
dtype = cls.__args__[1]
if not isinstance(dtype, tuple) and dtype.__module__ != "builtins":
if not isinstance(dtype, tuple) and dtype.__module__ not in (
"builtins",
"typing",
):
json_schema["dtype"] = ".".join([dtype.__module__, dtype.__name__])
return json_schema