Commit 83a6f2c5 authored by Guido van Rossum's avatar Guido van Rossum

Make close(), and hence __del__(), robust in the light of the world

being destroyed already.
parent 45c68f0d
......@@ -74,9 +74,12 @@ class Shelf:
del self.dict[key]
def close(self):
if hasattr(self.dict, 'close'):
self.dict.close()
self.dict = None
try:
if self.dict:
self.dict.close()
except:
pass
self.dict = 0
def __del__(self):
self.close()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment