Sitelet https://github.com/python/cpython/commit/bf1d2bc7cbebf59c9128805e8261406420053311
Skip to content

Commit bf1d2bc

Browse files
committed
Make the type consistent for hashlib algorithm constants. (Reviewed by Benjamin).
1 parent acff595 commit bf1d2bc

3 files changed

Lines changed: 6 additions & 3 deletions

File tree

‎Lib/hashlib.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,8 @@
5656
# always available algorithm is added.
5757
__always_supported = ('md5', 'sha1', 'sha224', 'sha256', 'sha384', 'sha512')
5858

59-
algorithms_guaranteed = __always_supported
60-
algorithms_available = frozenset(__always_supported)
59+
algorithms_guaranteed = set(__always_supported)
60+
algorithms_available = set(__always_supported)
6161

6262
__all__ = __always_supported + ('new', 'algorithms_guaranteed',
6363
'algorithms_available')

‎Lib/test/test_hashlib.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ def test_hash_array(self):
103103

104104
def test_algorithms_guaranteed(self):
105105
self.assertEqual(hashlib.algorithms_guaranteed,
106-
tuple(_algo for _algo in self.supported_hash_names
106+
set(_algo for _algo in self.supported_hash_names
107107
if _algo.islower()))
108108

109109
def test_algorithms_available(self):

‎Misc/NEWS‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ Core and Builtins
1616
Library
1717
-------
1818

19+
- Have hashlib.algorithms_available and hashlib.algorithms_guaranteed both
20+
return sets instead of one returning a tuple and the other a frozenset.
21+
1922
- Issue #10987: Fix the recursion limit handling in the _pickle module.
2023

2124
- Issue #10983: Fix several bugs making tunnel requests in http.client.

0 commit comments

Comments
 (0)