Skip to content

Commit 1ac7092

Browse files
Fix missing type() in _is_typing_union
1 parent 704fcb7 commit 1ac7092

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

discord/app/commands.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -389,7 +389,7 @@ def parse_options(self, params) -> List[Option]:
389389
def _is_typing_union(self, annotation):
390390
return (
391391
getattr(annotation, '__origin__', None) is Union
392-
or annotation is getattr(types, "UnionType", Union)
392+
or type(annotation) is getattr(types, "UnionType", Union)
393393
) # type: ignore
394394

395395
def _is_typing_optional(self, annotation):

discord/ext/commands/core.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1022,7 +1022,7 @@ def short_doc(self) -> str:
10221022
def _is_typing_optional(self, annotation: Union[T, Optional[T]]) -> TypeGuard[Optional[T]]:
10231023
return (
10241024
(getattr(annotation, '__origin__', None) is Union
1025-
or annotation is getattr(types, "UnionType", Union))
1025+
or type(annotation) is getattr(types, "UnionType", Union))
10261026
and type(None) in annotation.__args__ # type: ignore
10271027
)
10281028
@property

0 commit comments

Comments
 (0)