From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Fedora Python maintainers Date: Wed, 22 Jul 2020 16:15:41 +0200 Subject: [PATCH] 00188-fix-lib2to3-tests-when-hashlib-doesnt-compile-properly.patch Downstream only patch that should be removed when we compile all guaranteed hashlib algorithms properly. The problem is this: - during tests, test_hashlib is imported and executed before test_lib2to3 - if at least one hash function has failed, trying to import it triggers an exception that is being caught and exception is logged: http://hg.python.org/cpython/file/2de806c8b070/Lib/hashlib.py#l217 - logging the exception makes logging module run basicConfig - when lib2to3 tests are run again, lib2to3 runs basicConfig again, which doesn't do anything, because it was run previously (logging.root.handlers != []), which means that the default setup (most importantly logging level) is not overriden. That means that a test relying on this will fail (test_filename_changing_on_output_single_dir) --- Lib/lib2to3/main.py | 1 + 1 file changed, 1 insertion(+) diff --git a/Lib/lib2to3/main.py b/Lib/lib2to3/main.py index 1a1df013ade..4bd7212680d 100644 --- a/Lib/lib2to3/main.py +++ b/Lib/lib2to3/main.py @@ -213,6 +213,7 @@ def main(fixer_pkg, args=None): # Set up logging handler level = logging.DEBUG if options.verbose else logging.INFO + logging.root.handlers = [] logging.basicConfig(format='%(name)s: %(message)s', level=level) logger = logging.getLogger('lib2to3.main')