X-Git-Url: https://arthur.barton.de/gitweb/?p=bup.git;a=blobdiff_plain;f=lib%2Fbup%2Fbloom.py;h=b686127f294026911f442a8ff4ac7cbcd62a011b;hp=97024b90f7da67def21e0296124ea653769392ed;hb=0e574aa5760f8511abba6ccaf805f34c2caeb996;hpb=1eb38bb8e0c63d02a4672d4beeccafe06dba3d04 diff --git a/lib/bup/bloom.py b/lib/bup/bloom.py index 97024b9..b686127 100644 --- a/lib/bup/bloom.py +++ b/lib/bup/bloom.py @@ -107,6 +107,7 @@ bloom_add = _helpers.bloom_add class ShaBloom: """Wrapper which contains data from multiple index files. """ def __init__(self, filename, f=None, readwrite=False, expected=-1): + self.closed = False self.name = filename self.readwrite = readwrite self.file = None @@ -183,6 +184,7 @@ class ShaBloom: return self.map and self.bits def close(self): + self.closed = True try: if self.map and self.readwrite: debug2("bloom: closing with %d entries\n" % self.entries) @@ -198,6 +200,9 @@ class ShaBloom: finally: # This won't handle pending exceptions correctly in py2 self._init_failed() + def __del__(self): + assert self.closed + def __enter__(self): return self