Commit 605d5668 authored by Maiken's avatar Maiken
Browse files

Merge branch 'python-3.9-compatibility' into 'master'

Compatibility with Python 3.9.

See merge request nordugrid/arc!927
parents ffb55404 2ba3973e
...@@ -26,7 +26,10 @@ class BitVector(object): ...@@ -26,7 +26,10 @@ class BitVector(object):
else: else:
assert n_bits == len(bits) * TYPE_SIZE, "Size and given bits does not match" assert n_bits == len(bits) * TYPE_SIZE, "Size and given bits does not match"
self.bits = array.array(ARRAY_TYPE) self.bits = array.array(ARRAY_TYPE)
self.bits.fromstring(bits) try:
self.bits.frombytes(bits)
except AttributeError:
self.bits.fromstring(bits)
def __setitem__(self, index, value): def __setitem__(self, index, value):
...@@ -41,4 +44,7 @@ class BitVector(object): ...@@ -41,4 +44,7 @@ class BitVector(object):
def tostring(self): def tostring(self):
return self.bits.tostring() try:
return self.bits.tobytes()
except AttributeError:
return self.bits.tostring()
...@@ -104,7 +104,10 @@ class BloomFilter(object): ...@@ -104,7 +104,10 @@ class BloomFilter(object):
def serialize(self): def serialize(self):
return self.bits.tostring() try:
return self.bits.tobytes()
except AttributeError:
return self.bits.tostring()
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment