Skip to content

Commit

Permalink
Fixes SetLattice serialization: elements are expected to be bytes (#3)
Browse files Browse the repository at this point in the history
  • Loading branch information
xcharleslin authored and vsreekanti committed Sep 18, 2019
1 parent dc46a93 commit 8949ba9
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions client/python/anna/lattices.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ def serialize(self):


class SetLattice(Lattice):
def __init__(self, value={}):
def __init__(self, value=set()):
if type(value) != set:
raise ValueError('SetLattice can only be formed from a set.')

Expand All @@ -123,7 +123,7 @@ def merge(self, other):
raise ValueError('Cannot merge SetLattice with invalid type ' +
str(type(other)) + '.')

new_set = {}
new_set = set()

for v in other.val:
new_set.insert(v)
Expand All @@ -137,9 +137,7 @@ def serialize(self):
res = SetValue()

for v in self.val:
if type(v) == str:
v = bytes(v, 'utf-8')
else:
if type(v) != bytes:
raise ValueError('Unsupported type %s in SetLattice!' %
(str(type(v))))

Expand Down

0 comments on commit 8949ba9

Please sign in to comment.