diff options
author | Florian Bruhin <git@the-compiler.org> | 2018-02-10 17:22:21 +0100 |
---|---|---|
committer | Florian Bruhin <git@the-compiler.org> | 2018-02-28 16:07:20 +0100 |
commit | d134e0b1d051a5532b8633ebff6b6eb202ee7fd9 (patch) | |
tree | 9230b425ddea93498466b1ca3db98c1756ad1f2a | |
parent | 4e8abaa2d16103f42cb26919e50d59937a88ae8f (diff) | |
download | qutebrowser-d134e0b1d051a5532b8633ebff6b6eb202ee7fd9.tar.gz qutebrowser-d134e0b1d051a5532b8633ebff6b6eb202ee7fd9.zip |
Fix typing.Union checks with Python 3.7
(cherry picked from commit 63766c1711548ed119d197be22740b4cd4e3f61a)
-rw-r--r-- | qutebrowser/commands/command.py | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/qutebrowser/commands/command.py b/qutebrowser/commands/command.py index b4ff1cde8..58035ab9e 100644 --- a/qutebrowser/commands/command.py +++ b/qutebrowser/commands/command.py @@ -394,10 +394,8 @@ class Command: if isinstance(typ, tuple): raise TypeError("{}: Legacy tuple type annotation!".format( self.name)) - elif type(typ) is type(typing.Union): # noqa: E721 + elif getattr(typ, '__origin__', None) is typing.Union: # this is... slightly evil, I know - # We also can't use isinstance here because typing.Union doesn't - # support that. # pylint: disable=no-member,useless-suppression try: types = list(typ.__args__) |