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
Convert None to NoneType in the union type constructor #88801
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-15.07:15:55.473>created_at=<Date2021-07-14.10:51:57.968>labels= ['interpreter-core', 'type-feature', '3.10', '3.11']
title='Convert None to NoneType in the union type constructor'updated_at=<Date2021-07-15.07:15:55.473>user='https://github.com/serhiy-storchaka'
The former converts None to NoneType, the latter leaves it as is, and only performs conversion in __instancecheck__ and __subclasscheck__. In the discussion for bpo-44606 it was proposed to convert None to NoneType in the union type constructor to make more uniform with typing.Union and simplify __instancecheck__ and __subclasscheck__.
New changeset 6dec525 by Serhiy Storchaka in branch '3.10':
[3.10] bpo-44635: Convert None to NoneType in the union type constructor (GH-27136). (GH-27142) 6dec525
Activity
serhiy-storchaka commentedon Jul 14, 2021
There is a difference between typing.Union and the builtin union type in representing None in __args__:
The former converts None to NoneType, the latter leaves it as is, and only performs conversion in __instancecheck__ and __subclasscheck__. In the discussion for bpo-44606 it was proposed to convert None to NoneType in the union type constructor to make more uniform with typing.Union and simplify __instancecheck__ and __subclasscheck__.
serhiy-storchaka commentedon Jul 14, 2021
New changeset b81cac0 by Serhiy Storchaka in branch 'main':
bpo-44635: Convert None to NoneType in the union type constructor (GH-27136)
b81cac0
serhiy-storchaka commentedon Jul 15, 2021
New changeset 6dec525 by Serhiy Storchaka in branch '3.10':
[3.10] bpo-44635: Convert None to NoneType in the union type constructor (GH-27136). (GH-27142)
6dec525