Skip to content

Commit 236a0f5

Browse files
authored
bpo-40637: Do not emit warnings for disabled builtin hashes (pythonGH-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
1 parent 98ce7b1 commit 236a0f5

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Lib/test/test_hashlib.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ def _conditional_import_module(self, module_name):
103103
try:
104104
return importlib.import_module(module_name)
105105
except ModuleNotFoundError as error:
106-
if self._warn_on_extension_import:
106+
if self._warn_on_extension_import and module_name in builtin_hashes:
107107
warnings.warn('Did a C extension fail to compile? %s' % error)
108108
return None
109109

0 commit comments

Comments
 (0)