summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/spack/spack/environment.py4
-rw-r--r--lib/spack/spack/spec_list.py6
2 files changed, 8 insertions, 2 deletions
diff --git a/lib/spack/spack/environment.py b/lib/spack/spack/environment.py
index 824f60d338..16f745f9e8 100644
--- a/lib/spack/spack/environment.py
+++ b/lib/spack/spack/environment.py
@@ -600,8 +600,8 @@ class Environment(object):
"""Copy user_specs from a read-in lockfile."""
self.spec_lists = {
user_speclist_name: SpecList(
- user_speclist_name, [Spec(s)
- for s in self.concretized_user_specs]
+ user_speclist_name,
+ [str(s) for s in self.concretized_user_specs]
)
}
diff --git a/lib/spack/spack/spec_list.py b/lib/spack/spack/spec_list.py
index 460e7846ed..88b4dd7e96 100644
--- a/lib/spack/spack/spec_list.py
+++ b/lib/spack/spack/spec_list.py
@@ -28,6 +28,12 @@ class SpecList(object):
self.name = name
self._reference = reference # TODO: Do we need defensive copy here?
+ # Validate yaml_list before assigning
+ if not all(isinstance(s, string_types) or isinstance(s, (list, dict))
+ for s in yaml_list):
+ raise ValueError(
+ "yaml_list can contain only valid YAML types! Found:\n %s"
+ % [type(s) for s in yaml_list])
self.yaml_list = yaml_list[:]
# Expansions can be expensive to compute and difficult to keep updated