Skip to content

Commit 9a58f03

Browse files
authored
[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 <[email protected]>
1 parent b39d41b commit 9a58f03

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Lib/test/test_hashlib.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ def _conditional_import_module(self, module_name):
102102
try:
103103
return importlib.import_module(module_name)
104104
except ModuleNotFoundError as error:
105-
if self._warn_on_extension_import:
105+
if self._warn_on_extension_import and module_name in builtin_hashes:
106106
warnings.warn('Did a C extension fail to compile? %s' % error)
107107
return None
108108

0 commit comments

Comments
 (0)