Skip to content

Commit 1b74197

Browse files
committed
Use unresolved values for comparison and hash
1 parent 66df965 commit 1b74197

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

easybuild/framework/easyconfig/easyconfig.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1685,11 +1685,14 @@ def get(self, key, default=None, resolve=True):
16851685
# see also https://docs.python.org/2/reference/datamodel.html#object.__eq__
16861686
def __eq__(self, ec):
16871687
"""Is this EasyConfig instance equivalent to the provided one?"""
1688-
return self.asdict() == ec.asdict()
1688+
# Compare raw values to check that templates used are the same
1689+
with disable_templating(self):
1690+
with disable_templating(ec):
1691+
return self.asdict() == ec.asdict()
16891692

16901693
def __ne__(self, ec):
16911694
"""Is this EasyConfig instance equivalent to the provided one?"""
1692-
return self.asdict() != ec.asdict()
1695+
return not self == ec
16931696

16941697
def __hash__(self):
16951698
"""Return hash value for a hashable representation of this EasyConfig instance."""
@@ -1702,8 +1705,9 @@ def make_hashable(val):
17021705
return val
17031706

17041707
lst = []
1705-
for (key, val) in sorted(self.asdict().items()):
1706-
lst.append((key, make_hashable(val)))
1708+
with disable_templating(self):
1709+
for (key, val) in sorted(self.asdict().items()):
1710+
lst.append((key, make_hashable(val)))
17071711

17081712
# a list is not hashable, but a tuple is
17091713
return hash(tuple(lst))

0 commit comments

Comments
 (0)