From 9a58f03dc21d15c076d051d902ce1d0324db9741 Mon Sep 17 00:00:00 2001 From: stratakis Date: Wed, 17 Jun 2020 21:43:27 +0200 Subject: =?UTF-8?q?[3.9]=20bpo-40637:=20Do=20not=20emit=20warnings=20for?= =?UTF-8?q?=20disabled=20builtin=20hashes=20(GH=E2=80=A6=20(GH-20951)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit …-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 --- Lib/test/test_hashlib.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Lib/test/test_hashlib.py b/Lib/test/test_hashlib.py index 6088307..86f20a7 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 -- cgit v0.12