bpo-17258: Add requires_hashdigest to multiprocessing tests by tiran · Pull Request #20412 · python/cpython (original) (raw)
I tested the fix manually: it works! I removed md5 support, test_multiprocessing_spawn and test_concurrent_futures pass as expected.
find -name "*md5*.so" -delete
diff --git a/Lib/hashlib.py b/Lib/hashlib.py
index 1b6e50247c..0ec64e1a5f 100644
--- a/Lib/hashlib.py
+++ b/Lib/hashlib.py
@@ -55,7 +55,7 @@ More condensed:
# This tuple and __get_builtin_constructor() must be modified if a new
# always available algorithm is added.
-__always_supported = ('md5', 'sha1', 'sha224', 'sha256', 'sha384', 'sha512',
+__always_supported = ('sha1', 'sha224', 'sha256', 'sha384', 'sha512',
'blake2b', 'blake2s',
'sha3_224', 'sha3_256', 'sha3_384', 'sha3_512',
'shake_128', 'shake_256')
diff --git a/Lib/test/support/hashlib_helper.py b/Lib/test/support/hashlib_helper.py
index a28132a565..a2bb7ee187 100644
--- a/Lib/test/support/hashlib_helper.py
+++ b/Lib/test/support/hashlib_helper.py
@@ -29,7 +29,7 @@ def requires_hashdigest(digestname, openssl=None, usedforsecurity=True):
_hashlib.new(digestname, usedforsecurity=usedforsecurity)
else:
hashlib.new(digestname, usedforsecurity=usedforsecurity)
- except ValueError:
+ except (ValueError, AttributeError):
raise unittest.SkipTest(
f"hash digest '{digestname}' is not available."
)
diff --git a/Modules/_hashopenssl.c b/Modules/_hashopenssl.c
index 0b2ef95a6f..7fa876d565 100644
--- a/Modules/_hashopenssl.c
+++ b/Modules/_hashopenssl.c
@@ -1842,7 +1842,6 @@ static struct PyMethodDef EVP_functions[] = {
_HASHLIB_GET_FIPS_MODE_METHODDEF
_HASHLIB_HMAC_SINGLESHOT_METHODDEF
_HASHLIB_HMAC_NEW_METHODDEF
- _HASHLIB_OPENSSL_MD5_METHODDEF
_HASHLIB_OPENSSL_SHA1_METHODDEF
_HASHLIB_OPENSSL_SHA224_METHODDEF
_HASHLIB_OPENSSL_SHA256_METHODDEF