mirror of
https://github.com/python/cpython.git
synced 2025-08-02 08:02:56 +00:00
[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:
parent
2d055ce132
commit
03aad3049d
8 changed files with 85 additions and 120 deletions
|
@ -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__)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue