diff --git a/lib/spack/llnl/util/lang.py b/lib/spack/llnl/util/lang.py index 314566e97a1..8ec71137823 100644 --- a/lib/spack/llnl/util/lang.py +++ b/lib/spack/llnl/util/lang.py @@ -486,6 +486,8 @@ class HashableMap(MutableMapping): """This is a hashable, comparable dictionary. Hash is performed on a tuple of the values in the dictionary.""" + __slots__ = 'dict', + def __init__(self): self.dict = {} diff --git a/lib/spack/spack/spec.py b/lib/spack/spack/spec.py index a3256702894..fc8a884511a 100644 --- a/lib/spack/spack/spec.py +++ b/lib/spack/spack/spec.py @@ -243,6 +243,8 @@ def frontend_arch(): """Return the frontend architecture""" return ArchSpec._return_arch("frontend", "frontend") + __slots__ = '_platform', '_os', '_target' + def __init__(self, spec_or_platform_tuple=(None, None, None)): """Architecture specification a package should be built with. @@ -553,6 +555,8 @@ class CompilerSpec(object): versions that a package should be built with. CompilerSpecs have a name and a version list.""" + __slots__ = 'name', 'versions' + def __init__(self, *args): nargs = len(args) if nargs == 1: @@ -677,6 +681,8 @@ class DependencySpec(object): - deptypes: list of strings, representing dependency relationships. """ + __slots__ = 'parent', 'spec', 'deptypes' + def __init__(self, parent, spec, deptypes): self.parent = parent self.spec = spec @@ -717,6 +723,9 @@ def canonical(self): class FlagMap(lang.HashableMap): + + __slots__ = 'spec', + def __init__(self, spec): super(FlagMap, self).__init__() self.spec = spec @@ -801,6 +810,7 @@ class _EdgeMap(Mapping): Edges are stored in a dictionary and keyed by package name. """ + __slots__ = 'edges', 'store_by_child' def __init__(self, store_by=EdgeDirection.child): # Sanitize input arguments