Make close(), and hence __del__(), robust in the light of the world
being destroyed already.
This commit is contained in:
parent
19b55f2d17
commit
6599fb0917
|
@ -74,9 +74,12 @@ class Shelf:
|
||||||
del self.dict[key]
|
del self.dict[key]
|
||||||
|
|
||||||
def close(self):
|
def close(self):
|
||||||
if hasattr(self.dict, 'close'):
|
try:
|
||||||
self.dict.close()
|
if self.dict:
|
||||||
self.dict = None
|
self.dict.close()
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
self.dict = 0
|
||||||
|
|
||||||
def __del__(self):
|
def __del__(self):
|
||||||
self.close()
|
self.close()
|
||||||
|
|
Loading…
Reference in New Issue