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]
|
||||
|
||||
def close(self):
|
||||
if hasattr(self.dict, 'close'):
|
||||
try:
|
||||
if self.dict:
|
||||
self.dict.close()
|
||||
self.dict = None
|
||||
except:
|
||||
pass
|
||||
self.dict = 0
|
||||
|
||||
def __del__(self):
|
||||
self.close()
|
||||
|
|
Loading…
Reference in New Issue