Skip to content

Commit

Permalink
[3.9] bpo-40637: Do not emit warnings for disabled builtin hashes (py…
Browse files Browse the repository at this point in the history
…thonGH-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]>
  • Loading branch information
stratakis committed Jun 17, 2020
1 parent b39d41b commit 6127ea1
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion Lib/test/test_hashlib.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ def _conditional_import_module(self, module_name):
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

Expand Down

0 comments on commit 6127ea1

Please sign in to comment.