bpo-44652: Preserve natural order of args in the union type. (GH-27185)

This commit is contained in:
Serhiy Storchaka 2021-07-16 16:11:30 +03:00 committed by GitHub
parent 6aab5f9bf3
commit 0cd2d51aad
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 39 additions and 11 deletions

View file

@ -988,8 +988,8 @@ class _GenericAlias(_BaseGenericAlias, _root=True):
def __or__(self, right):
return Union[self, right]
def __ror__(self, right):
return Union[self, right]
def __ror__(self, left):
return Union[left, self]
@_tp_cache
def __getitem__(self, params):
@ -1099,8 +1099,8 @@ class _SpecialGenericAlias(_BaseGenericAlias, _root=True):
def __or__(self, right):
return Union[self, right]
def __ror__(self, right):
return Union[self, right]
def __ror__(self, left):
return Union[left, self]
class _CallableGenericAlias(_GenericAlias, _root=True):
def __repr__(self):