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
Unioned types should be hashable: not documented? #112281
This is more complex than I initially thought, because _UnionGenericAlias also uses set to compare results. So, we need a slow way of doing it as well. See
Activity
sobolevn commentedon Nov 20, 2023
PEPs https://peps.python.org/pep-0593/#specification and https://peps.python.org/pep-0604/ do not say anything about requirement of items to be hashable. I think that this is a bug: unhashable items must be allowed.
I think that we need to rework our
_deduplicatefunction. I have an idea on how to do it :)Thanks for the report! 👍
sobolevn commentedon Nov 20, 2023
This is more complex than I initially thought, because
_UnionGenericAliasalso usessetto compare results. So, we need a slow way of doing it as well. Seecpython/Lib/typing.py
Line 1536 in ce1096f
pythongh-112281: Allow `Union` with unhashable `Annotated` metadata
gh-112281: Allow `Union` with unhashable `Annotated` metadata (#112283)
pythongh-112281: Allow `Union` with unhashable `Annotated` metadata (p…
[3.12] gh-112281: Allow `Union` with unhashable `Annotated` metadata (G…
[3.11] pythongh-112281: Allow `Union` with unhashable `Annotated` met…
[3.11] gh-112281: Allow `Union` with unhashable `Annotated` metadata (G…
pythongh-112281: Allow `Union` with unhashable `Annotated` metadata (p…
pythongh-112281: Allow `Union` with unhashable `Annotated` metadata (p…
pythongh-112281: Allow `Union` with unhashable `Annotated` metadata (p…