mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
bpo-42345: Fix hash implementation of typing.Literal (GH-23383)
Fix hash implementation of `typing.Literal`.
Update docs regarding `typing.Litaral` caching.
Base implementation was done in PR GH-23294.
(cherry picked from commit 1b54077ff6
)
Co-authored-by: Yurii Karabas <1998uriyyo@gmail.com>
This commit is contained in:
parent
87c87b5bd6
commit
2acd9d0c6c
3 changed files with 9 additions and 4 deletions
|
@ -932,7 +932,7 @@ class _LiteralGenericAlias(_GenericAlias, _root=True):
|
|||
return set(_value_and_type_iter(self.__args__)) == set(_value_and_type_iter(other.__args__))
|
||||
|
||||
def __hash__(self):
|
||||
return hash(tuple(_value_and_type_iter(self.__args__)))
|
||||
return hash(frozenset(_value_and_type_iter(self.__args__)))
|
||||
|
||||
|
||||
class Generic:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue