If you create an in-memory BloomFilter (i.e. no filename argument passed to BloomFilter.__init__) some actions can segfault.
Given, bloom_filter = BloomFilter(1000, 0.01), the following actions segfault:
bloom_filter.name
bloom_filter.copy('another_path')
bloom_filter.to_base64()
The root cause is that attempting to access self._bf.array.filename actually triggers the segfault.
There's no reasonable value for bloom_filter.name on an in-memory BloomFilter if that attribute is always supposed to be an actual file on disk. But raising something like NotImplementedError would be preferable to a segfault.
For copy() and to_base64(), they could both get their job done if they accessed the raw data through mmap instead of having to go through a file on disk. But that's a pretty good-sized code change, so raising NotImplementedError there would be fine. If you want those functions, back your filter with a file.
If you create an in-memory BloomFilter (i.e. no filename argument passed to
BloomFilter.__init__
) some actions can segfault.Given,
bloom_filter = BloomFilter(1000, 0.01)
, the following actions segfault:bloom_filter.name
bloom_filter.copy('another_path')
bloom_filter.to_base64()
The root cause is that attempting to access
self._bf.array.filename
actually triggers the segfault.There's no reasonable value for
bloom_filter.name
on an in-memory BloomFilter if that attribute is always supposed to be an actual file on disk. But raising something likeNotImplementedError
would be preferable to a segfault.For
copy()
andto_base64()
, they could both get their job done if they accessed the raw data through mmap instead of having to go through a file on disk. But that's a pretty good-sized code change, so raisingNotImplementedError
there would be fine. If you want those functions, back your filter with a file.