Skip to content

Commit 14e1664

Browse files
committed
Use unresolved values for comparison and hash
1 parent 51f5f15 commit 14e1664

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
@@ -1712,11 +1712,14 @@ def get(self, key, default=None, resolve=True):
17121712
# see also https://docs.python.org/2/reference/datamodel.html#object.__eq__
17131713
def __eq__(self, ec):
17141714
"""Is this EasyConfig instance equivalent to the provided one?"""
1715-
return self.asdict() == ec.asdict()
1715+
# Compare raw values to check that templates used are the same
1716+
with disable_templating(self):
1717+
with disable_templating(ec):
1718+
return self.asdict() == ec.asdict()
17161719

17171720
def __ne__(self, ec):
17181721
"""Is this EasyConfig instance equivalent to the provided one?"""
1719-
return self.asdict() != ec.asdict()
1722+
return not self == ec
17201723

17211724
def __hash__(self):
17221725
"""Return hash value for a hashable representation of this EasyConfig instance."""
@@ -1729,8 +1732,9 @@ def make_hashable(val):
17291732
return val
17301733

17311734
lst = []
1732-
for (key, val) in sorted(self.asdict().items()):
1733-
lst.append((key, make_hashable(val)))
1735+
with disable_templating(self):
1736+
for (key, val) in sorted(self.asdict().items()):
1737+
lst.append((key, make_hashable(val)))
17341738

17351739
# a list is not hashable, but a tuple is
17361740
return hash(tuple(lst))

0 commit comments

Comments
 (0)