From a3d8e95e76e50cd5e9720295902617d56ab28553 Mon Sep 17 00:00:00 2001 From: Massimiliano Culpo Date: Thu, 26 Aug 2021 18:46:01 +0200 Subject: Avoid double loop in subprocess_context.store_patches (#25621) fixes #21643 As far as I can see the double loop is not needed, since "patch" is never used and the items in the list are tuples of three values. --- lib/spack/spack/subprocess_context.py | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/lib/spack/spack/subprocess_context.py b/lib/spack/spack/subprocess_context.py index 803411cb95..bfba6b0acc 100644 --- a/lib/spack/spack/subprocess_context.py +++ b/lib/spack/spack/subprocess_context.py @@ -139,16 +139,15 @@ def store_patches(): class_patches = list() if not patches: return TestPatches(list(), list()) - for patch in patches: - for target, name, _ in patches: - if isinstance(target, ModuleType): - new_val = getattr(target, name) - module_name = target.__name__ - module_patches.append((module_name, name, new_val)) - elif isinstance(target, type): - new_val = getattr(target, name) - class_fqn = '.'.join([target.__module__, target.__name__]) - class_patches.append((class_fqn, name, new_val)) + for target, name, _ in patches: + if isinstance(target, ModuleType): + new_val = getattr(target, name) + module_name = target.__name__ + module_patches.append((module_name, name, new_val)) + elif isinstance(target, type): + new_val = getattr(target, name) + class_fqn = '.'.join([target.__module__, target.__name__]) + class_patches.append((class_fqn, name, new_val)) return TestPatches(module_patches, class_patches) -- cgit v1.2.3-60-g2f50