mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
bpo-44652: Preserve natural order of args in the union type. (GH-27185)
This commit is contained in:
parent
6aab5f9bf3
commit
0cd2d51aad
3 changed files with 39 additions and 11 deletions
|
@ -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):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue