summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorstratakis <cstratak@redhat.com>2020-06-17 21:43:27 +0200
committerGitHub <noreply@github.com>2020-06-17 12:43:27 -0700
commit9a58f03dc21d15c076d051d902ce1d0324db9741 (patch)
tree5e00849b4ff44b800c42e5d140c88fa6e8570849
parentb39d41ba1b77f7bc51c4d6f6d0e336693192cb3a (diff)
downloadcpython-git-9a58f03dc21d15c076d051d902ce1d0324db9741.tar.gz
[3.9] bpo-40637: Do not emit warnings for disabled builtin hashes (GH… (GH-20951)
…-20937) test_hashlib emits some warnings when it cannot find some hashes as it assumes they failed to compile. Since we can disable hashes through configure, we emit the warnings only in the case that we did not intentionaly disable them. Automerge-Triggered-By: @tiran (cherry picked from commit 236a0f5) Co-authored-by: stratakis <cstratak@redhat.com>
-rw-r--r--Lib/test/test_hashlib.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/Lib/test/test_hashlib.py b/Lib/test/test_hashlib.py
index 6088307f84..86f20a7aff 100644
--- a/Lib/test/test_hashlib.py
+++ b/Lib/test/test_hashlib.py
@@ -102,7 +102,7 @@ class HashLibTestCase(unittest.TestCase):
try:
return importlib.import_module(module_name)
except ModuleNotFoundError as error:
- if self._warn_on_extension_import:
+ if self._warn_on_extension_import and module_name in builtin_hashes:
warnings.warn('Did a C extension fail to compile? %s' % error)
return None