[3.10] bpo-44654: Refactor and clean up the union type implementation (GH-27196) (GH-27219)

(cherry picked from commit 0fd27375ca)
This commit is contained in:
Miss Islington (bot) 2021-07-17 14:10:21 -07:00 committed by GitHub
parent 2d055ce132
commit 03aad3049d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 85 additions and 120 deletions

View file

@ -1181,7 +1181,7 @@ class _UnionGenericAlias(_GenericAlias, _root=True):
return Union[params]
def __eq__(self, other):
if not isinstance(other, _UnionGenericAlias):
if not isinstance(other, (_UnionGenericAlias, types.Union)):
return NotImplemented
return set(self.__args__) == set(other.__args__)