You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Preserve natural order of args in the union type #88818
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
assignee=Noneclosed_at=<Date2021-07-16.13:43:52.697>created_at=<Date2021-07-16.11:07:49.662>labels= ['interpreter-core', 'type-bug', 'library', '3.10', '3.11']
title='Preserve natural order of args in the union type'updated_at=<Date2021-07-16.13:43:52.697>user='https://github.com/serhiy-storchaka'
It is not particularly important, because the order of __args__ mostly affects only representation. But it is better to be consistent, and it is easy to fix these tiny issues.
Note that it does not make the order of __args__ deterministic in all cases. Due to using caching for typing.Union it can be not always preserved if we merger typing.Union objects which differs only by order of arguments.
New changeset 80844d1 by Serhiy Storchaka in branch '3.10':
[3.10] bpo-44652: Preserve natural order of args in the union type. (GH-27185) (GH-27190) 80844d1
Activity
serhiy-storchaka commentedon Jul 16, 2021
There are two issues related to the order of __args__ in typing.Union and the union type.
The cause is errors in __ror__ implementations.
It is not particularly important, because the order of __args__ mostly affects only representation. But it is better to be consistent, and it is easy to fix these tiny issues.
Note that it does not make the order of __args__ deterministic in all cases. Due to using caching for typing.Union it can be not always preserved if we merger typing.Union objects which differs only by order of arguments.
serhiy-storchaka commentedon Jul 16, 2021
New changeset 0cd2d51 by Serhiy Storchaka in branch 'main':
bpo-44652: Preserve natural order of args in the union type. (GH-27185)
0cd2d51
miss-islington commentedon Jul 16, 2021
New changeset 80844d1 by Serhiy Storchaka in branch '3.10':
[3.10] bpo-44652: Preserve natural order of args in the union type. (GH-27185) (GH-27190)
80844d1