Fix typing.Union check on Python 3.5.2
Apparently 3.5.4 has __origin__ for typing.Union, but 3.5.2 has not. Let's hope this now works everywhere...
This commit is contained in:
parent
52d7ff79fc
commit
a472351423
@ -394,7 +394,9 @@ class Command:
|
|||||||
if isinstance(typ, tuple):
|
if isinstance(typ, tuple):
|
||||||
raise TypeError("{}: Legacy tuple type annotation!".format(
|
raise TypeError("{}: Legacy tuple type annotation!".format(
|
||||||
self.name))
|
self.name))
|
||||||
elif getattr(typ, '__origin__', None) is typing.Union:
|
elif getattr(typ, '__origin__', None) is typing.Union or (
|
||||||
|
hasattr(typing, 'UnionMeta') and
|
||||||
|
isinstance(typ, typing.UnionMeta)):
|
||||||
# this is... slightly evil, I know
|
# this is... slightly evil, I know
|
||||||
# pylint: disable=no-member,useless-suppression
|
# pylint: disable=no-member,useless-suppression
|
||||||
try:
|
try:
|
||||||
|
Loading…
Reference in New Issue
Block a user