Fix typing.Union checks with Python 3.7
This commit is contained in:
parent
80ee43beca
commit
63766c1711
@ -76,6 +76,7 @@ Fixed
|
|||||||
- QtWebEngine: Qt download objects are now cleaned up properly when a download
|
- QtWebEngine: Qt download objects are now cleaned up properly when a download
|
||||||
is removed.
|
is removed.
|
||||||
- Suspended pages now should always load the correct page when being un-suspended.
|
- Suspended pages now should always load the correct page when being un-suspended.
|
||||||
|
- Compatibility with Python 3.7
|
||||||
|
|
||||||
Removed
|
Removed
|
||||||
~~~~~~~
|
~~~~~~~
|
||||||
|
@ -394,10 +394,8 @@ 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 type(typ) is type(typing.Union): # noqa: E721
|
elif getattr(typ, '__origin__', None) is typing.Union:
|
||||||
# this is... slightly evil, I know
|
# 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
|
# pylint: disable=no-member,useless-suppression
|
||||||
try:
|
try:
|
||||||
types = list(typ.__args__)
|
types = list(typ.__args__)
|
||||||
|
Loading…
Reference in New Issue
Block a user