Skip to content

Bug: Inconsistency in how fromfile and intersection and union deals with self.bitarray #20

@srean

Description

@srean

Once you deserialize a serialized BloomFilter object the self.bitarray length might differ because of added padding.

This is handled in this line https://github.com/joseph-fox/python-bloomfilter/blob/master/pybloom_live/pybloom.py#L216

Here difference in length due to the trailing bits is ignored.

No such accounting of differing bitarray lengths are being done here https://github.com/joseph-fox/python-bloomfilter/blob/master/pybloom_live/pybloom.py#L183 or https://github.com/joseph-fox/python-bloomfilter/blob/master/pybloom_live/pybloom.py#L169 . Here the bitarray union and intersection will fail if the bitarray.length( ) are different. The lengths may differ because of a roundtrip through serialization deserialization, even when the capacity and error-rates are the same.

I think the correct thing to do here is to strip off the padding in fromfile to ensure that the bitarray representation is exactly the same

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions