summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorMassimiliano Culpo <massimiliano.culpo@gmail.com>2021-08-26 18:46:01 +0200
committerGitHub <noreply@github.com>2021-08-26 09:46:01 -0700
commita3d8e95e76e50cd5e9720295902617d56ab28553 (patch)
tree121a12231f180c40c93e0773f0eb14a422495499 /lib
parent1ab6f30fdd1dd3b84e99bfbd14018a237b8095fb (diff)
downloadspack-a3d8e95e76e50cd5e9720295902617d56ab28553.tar.gz
spack-a3d8e95e76e50cd5e9720295902617d56ab28553.tar.bz2
spack-a3d8e95e76e50cd5e9720295902617d56ab28553.tar.xz
spack-a3d8e95e76e50cd5e9720295902617d56ab28553.zip
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.
Diffstat (limited to 'lib')
-rw-r--r--lib/spack/spack/subprocess_context.py19
1 files 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)