10000 Support PEP 612 in typing_extensions (Python 3) by Fidget-Spinner · Pull Request #774 · python/typing · GitHub
[go: up one dir, main page]

Skip to content

Support PEP 612 in typing_extensions (Python 3) #774

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 14 commits into from
Apr 10, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add __hash__ to paramspec
  • Loading branch information
Fidget-Spinner committed Apr 8, 2021
commit 149d3c77d52ec73f04b3cd59cb2c0584c679ce28
2 changes: 2 additions & 0 deletions typing_extensions/src_py3/test_typing_extensions.py
Original file line number Diff line number Diff line change
Expand Up @@ -1881,6 +1881,8 @@ def test_basic_plain(self):
P = ParamSpec('P')
self.assertEqual(P, P)
self.assertIsInstance(P, ParamSpec)
# Should be hashable
hash(P)

def test_repr(self):
P = ParamSpec('P')
Expand Down
6 changes: 6 additions & 0 deletions typing_extensions/src_py3/typing_extensions.py
Original file line number Diff line number Diff line change
Expand Up @@ -2252,6 +2252,12 @@ def __repr__(self):
prefix = '~'
return prefix + self.__name__

def __hash__(self):
return hash((self.__name__,
self.__covariant__,
self.__contravariant__,
self.__bound__))

def __reduce__(self):
return self.__name__

Expand Down
0