summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2022-03-23 20:58:02 (GMT)
committerGitHub <noreply@github.com>2022-03-23 20:58:02 (GMT)
commitec3589f59d2c8456591f33656639bcc303eb7bd5 (patch)
tree99d57ab2a002318541ef5ec6e7587dbac7299723 /Lib
parente513b8188af4d2f43ab2b96b51bc45bd4f6fd5b6 (diff)
downloadcpython-ec3589f59d2c8456591f33656639bcc303eb7bd5.zip
cpython-ec3589f59d2c8456591f33656639bcc303eb7bd5.tar.gz
cpython-ec3589f59d2c8456591f33656639bcc303eb7bd5.tar.bz2
bpo-47101: list only activated algorithms in hashlib.algorithms_available (GH-32076)
(cherry picked from commit 48e2010d92076b472922fa632fffc98ee150004f) Co-authored-by: Christian Heimes <christian@python.org>
Diffstat (limited to 'Lib')
-rw-r--r--Lib/test/test_hashlib.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/Lib/test/test_hashlib.py b/Lib/test/test_hashlib.py
index 214bc3c..f845c7a 100644
--- a/Lib/test/test_hashlib.py
+++ b/Lib/test/test_hashlib.py
@@ -223,6 +223,10 @@ class HashLibTestCase(unittest.TestCase):
def test_algorithms_available(self):
self.assertTrue(set(hashlib.algorithms_guaranteed).
issubset(hashlib.algorithms_available))
+ # all available algorithms must be loadable, bpo-47101
+ self.assertNotIn("undefined", hashlib.algorithms_available)
+ for name in hashlib.algorithms_available:
+ digest = hashlib.new(name, usedforsecurity=False)
def test_usedforsecurity_true(self):
hashlib.new("sha256", usedforsecurity=True)