From 8949ba93246db0774ac37ca480666a68f53dab05 Mon Sep 17 00:00:00 2001 From: Charles Date: Wed, 18 Sep 2019 08:36:35 -0700 Subject: [PATCH] Fixes SetLattice serialization: elements are expected to be bytes (#3) --- client/python/anna/lattices.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/client/python/anna/lattices.py b/client/python/anna/lattices.py index f376793..53b5a66 100644 --- a/client/python/anna/lattices.py +++ b/client/python/anna/lattices.py @@ -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.') @@ -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) @@ -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))))