Skip to content

Commit 97ea3fd

Browse files
committed
Remove potential Attribute error from __origin__
1 parent 123223c commit 97ea3fd

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

discord_slash/model.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -484,10 +484,10 @@ def from_type(cls, t: type):
484484
return cls.ROLE
485485
if hasattr(typing, "_GenericAlias"): # 3.7 onwards
486486
# Easier than imports
487-
if (
488-
t.__origin__ is not None and t.__origin__ is typing.Union
489-
): # proven in 3.7.8+, 3.8.6+, 3.9+ definitively
490-
return cls.MENTIONABLE
487+
if hasattr(t, "__origin__"):
488+
if t.__origin__ is typing.Union:
489+
# proven in 3.7.8+, 3.8.6+, 3.9+ definitively
490+
return cls.MENTIONABLE
491491
if not hasattr(typing, "_GenericAlias"): # py 3.6
492492
if isinstance(t, typing._Union): # noqa
493493
return cls.MENTIONABLE

0 commit comments

Comments
 (0)