diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2021-07-16 13:11:30 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-07-16 13:11:30 (GMT) |
commit | 0cd2d51aadcd2a0c0739a5df0a6235d64f35619e (patch) | |
tree | 34ce39c44816e5e02ccaec8c4bcb214d548f0b0e /Lib/typing.py | |
parent | 6aab5f9bf303a8e4cd8377fabcdcb499e0541f9a (diff) | |
download | cpython-0cd2d51aadcd2a0c0739a5df0a6235d64f35619e.zip cpython-0cd2d51aadcd2a0c0739a5df0a6235d64f35619e.tar.gz cpython-0cd2d51aadcd2a0c0739a5df0a6235d64f35619e.tar.bz2 |
bpo-44652: Preserve natural order of args in the union type. (GH-27185)
Diffstat (limited to 'Lib/typing.py')
-rw-r--r-- | Lib/typing.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/Lib/typing.py b/Lib/typing.py index ca05fb5..2f22868 100644 --- a/Lib/typing.py +++ b/Lib/typing.py @@ -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): |