Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
srean opened this issue May 3, 2018 · 0 comments

Comments

@srean
Copy link

srean commented May 3, 2018

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants