Skip to content
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

bpo-17258: Add requires_hashdigest to multiprocessing tests #20412

Merged
merged 2 commits into from
Jun 4, 2020

Conversation

tiran
Copy link
Member

@tiran tiran commented May 26, 2020

Skip some :mod:multiprocessing tests when MD5 hash digest is blocked.

Signed-off-by: Christian Heimes christian@python.org

https://bugs.python.org/issue17258

Automerge-Triggered-By: @tiran

Skip some :mod:`multiprocessing` tests when MD5 hash digest is blocked.

Signed-off-by: Christian Heimes <christian@python.org>
Signed-off-by: Christian Heimes <christian@python.org>
Copy link
Member

@vstinner vstinner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tested the fix manually: it works! I removed md5 support, test_multiprocessing_spawn and test_concurrent_futures pass as expected.

Remove MD5 support, remove the builtin md5 module:

find -name "*md5*.so" -delete

Apply patch:

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

@miss-islington
Copy link
Contributor

Thanks @tiran for the PR 🌮🎉.. I'm working now to backport this PR to: 3.9.
🐍🍒⛏🤖

@vstinner vstinner added needs backport to 3.9 only security fixes and removed needs backport to 3.9 only security fixes labels Jun 4, 2020
@miss-islington
Copy link
Contributor

Thanks @tiran for the PR 🌮🎉.. I'm working now to backport this PR to: 3.9.
🐍🍒⛏🤖

@tiran tiran added needs backport to 3.9 only security fixes and removed needs backport to 3.9 only security fixes labels Jun 4, 2020
@miss-islington
Copy link
Contributor

Thanks @tiran for the PR 🌮🎉.. I'm working now to backport this PR to: 3.9.
🐍🍒⛏🤖 I'm not a witch! I'm not a witch!

@vstinner
Copy link
Member

vstinner commented Jun 4, 2020

I reported the miss-islington issue to python/miss-islington#342

@Mariatta Mariatta added needs backport to 3.9 only security fixes and removed needs backport to 3.9 only security fixes labels Jun 4, 2020
@miss-islington
Copy link
Contributor

Thanks @tiran for the PR 🌮🎉.. I'm working now to backport this PR to: 3.9.
🐍🍒⛏🤖

@bedevere-bot bedevere-bot removed the needs backport to 3.9 only security fixes label Jun 4, 2020
@bedevere-bot
Copy link

GH-20626 is a backport of this pull request to the 3.9 branch.

miss-islington added a commit that referenced this pull request Jun 4, 2020
Skip some :mod:`multiprocessing` tests when MD5 hash digest is blocked.

Signed-off-by: Christian Heimes <christian@python.org>
(cherry picked from commit b022e5c)

Co-authored-by: Christian Heimes <christian@python.org>
arun-mani-j pushed a commit to arun-mani-j/cpython that referenced this pull request Jul 21, 2020
…-20412)

Skip some :mod:`multiprocessing` tests when MD5 hash digest is blocked.

Signed-off-by: Christian Heimes <christian@python.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
tests Tests in the Lib/test dir
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants