[issue44490] PEP 604 Union (int | str) doesn't have __parameters__
Jelle Zijlstra
report at bugs.python.org
Tue Jun 22 11:00:20 EDT 2021
Jelle Zijlstra <jelle.zijlstra at gmail.com> added the comment:
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.
----------
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue44490>
_______________________________________
More information about the Python-bugs-list
mailing list