This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author JelleZijlstra
Recipients JelleZijlstra, gvanrossum, kj, levkivskyi
Date 2021-06-22.15:00:20
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1624374020.28.0.104947228336.issue44490@roundup.psfhosted.org>
In-reply-to
Content
I agree that this is a bug. `types.Union` is also missing a __getitem__ implementation.

And `typing.Union` supports pickling while `types.Union` doesn't:

>>> pickle.loads(pickle.dumps(int | str))
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: cannot pickle 'types.Union' object
>>> pickle.loads(pickle.dumps(Union[int, str]))
typing.Union[int, str]

I don't have a use case for pickling types but someone might.
History
Date User Action Args
2021-06-22 15:00:20JelleZijlstrasetrecipients: + JelleZijlstra, gvanrossum, levkivskyi, kj
2021-06-22 15:00:20JelleZijlstrasetmessageid: <1624374020.28.0.104947228336.issue44490@roundup.psfhosted.org>
2021-06-22 15:00:20JelleZijlstralinkissue44490 messages
2021-06-22 15:00:20JelleZijlstracreate