Skip to content

Commit 1fdc8c7

Browse files
committed
Address reviewer comments
- Moved retrieval of PY_BUILTIN_HASHLIB_HASHES out of the loop - Removed guard from test_gil
1 parent dc7c6c6 commit 1fdc8c7

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

Lib/test/test_hashlib.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,7 @@ def test_algorithms_available(self):
234234
issubset(hashlib.algorithms_available))
235235
# all available algorithms must be loadable, bpo-47101
236236
self.assertNotIn("undefined", hashlib.algorithms_available)
237+
algorithms_builtin = sysconfig.get_config_var("PY_BUILTIN_HASHLIB_HASHES").split(",")
237238
for name in hashlib.algorithms_available:
238239
with self.subTest(name):
239240
try:
@@ -243,7 +244,7 @@ def test_algorithms_available(self):
243244
# builtins may be absent if python built with
244245
# a subset of --with-builtin-hashlib-hashes or none.
245246
if ("blake2" in name and
246-
"blake2" not in sysconfig.get_config_var("PY_BUILTIN_HASHLIB_HASHES").split(",")):
247+
"blake2" not in algorithms_builtin):
247248
self.skipTest(verr)
248249
else:
249250
raise
@@ -1067,9 +1068,7 @@ def test_gil(self):
10671068
# for multithreaded operation. Currently, all cryptographic modules
10681069
# have the same constant value (2048) but in the future it might not
10691070
# be the case.
1070-
mods = ['_md5', '_sha1', '_sha2', '_sha3', '_hashlib']
1071-
if _blake2:
1072-
mods.append('_blake2')
1071+
mods = ['_md5', '_sha1', '_sha2', '_sha3', '_blake2', '_hashlib']
10731072
gil_minsize = hashlib_helper.find_gil_minsize(mods)
10741073
for cons in self.hash_constructors:
10751074
# constructors belong to one of the above modules

0 commit comments

Comments
 (0)