From a2d5c43368573f0fe0a620c87ef4dd9391d40eda Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sat, 8 Oct 2022 20:57:44 -0400 Subject: Restore protection of distutils.log patching. --- setuptools/logging.py | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'setuptools') diff --git a/setuptools/logging.py b/setuptools/logging.py index 70708adb..e99c1b9d 100644 --- a/setuptools/logging.py +++ b/setuptools/logging.py @@ -24,6 +24,11 @@ def configure(): format="{message}", style='{', handlers=handlers, level=logging.DEBUG) if hasattr(distutils.log, 'Log'): monkey.patch_func(set_threshold, distutils.log, 'set_threshold') + # For some reason `distutils.log` module is getting cached in `distutils.dist` + # and then loaded again when patched, + # implying: id(distutils.log) != id(distutils.dist.log). + # Make sure the same module object is used everywhere: + distutils.dist.log = distutils.log def set_threshold(level): -- cgit v1.2.1