Don't write "if self.dict: self.dict.close()"; just write
"self.dict.close()" and ignore the exception.  The "if self.dict:"
part would be calculated through len(self.dict.keys()), which is very
expensive for a large dictionary...
diff --git a/Lib/shelve.py b/Lib/shelve.py
index 9b65a09..6bdc030 100644
--- a/Lib/shelve.py
+++ b/Lib/shelve.py
@@ -75,8 +75,7 @@
 	
 	def close(self):
 		try:
-			if self.dict:
-				self.dict.close()
+                    self.dict.close()
 		except:
 			pass
 		self.dict = 0