Skip to content

Commit

Permalink
immutufy does not handle sets properly
Browse files Browse the repository at this point in the history
By using `append` rather than `extend` this is solved. Reported by @typoman
  • Loading branch information
LettError committed May 30, 2024
1 parent 66172cc commit 788e7d9
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Lib/ufoProcessor/ufoOperator.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def immutify(obj):
# make an immutable version of this object.
# assert immutify(10) == (10,)
# assert immutify([10, 20, "a"]) == (10, 20, 'a')
# assert immutify(dict(foo="bar", world=["a", "b"])) == ('foo', ('bar',), 'world', ('a', 'b'))
# assert immutify(dict(aSet={1,2,3}, foo="bar", world=["a", "b"])) == ('foo', ('bar',), 'world', ('a', 'b'))
hashValues = []
if isinstance(obj, dict):
hashValues.append(
Expand All @@ -48,7 +48,7 @@ def immutify(obj):
)
elif isinstance(obj, set):
for value in sorted(obj):
hashValues.extend(immutify(value))
hashValues.append(immutify(value))
elif isinstance(obj, (list, tuple)):
for value in obj:
hashValues.append(immutify(value))
Expand Down

0 comments on commit 788e7d9

Please sign in to comment.