Skip to content

Commit 35ef4aa

Browse files
committed
improve implementation of EasyConfig.__hash__
1 parent 1c66429 commit 35ef4aa

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

easybuild/framework/easyconfig/easyconfig.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -742,11 +742,12 @@ def make_hashable(val):
742742
val = tuple([(key, make_hashable(val)) for (key, val) in sorted(val.items())])
743743
return val
744744

745-
tup = ()
745+
lst = []
746746
for (key, val) in sorted(self.asdict().items()):
747-
tup += (key, make_hashable(val))
747+
lst.append((key, make_hashable(val)))
748748

749-
return hash(tup)
749+
# a list is not hashable, but a tuple is
750+
return hash(tuple(lst))
750751

751752
def asdict(self):
752753
"""

0 commit comments

Comments
 (0)