Rev 4518: Add comments in the finally sections as to why we want them. in http://bazaar.launchpad.net/~jameinel/bzr/1.17-lru-cleanup
John Arbash Meinel
john at arbash-meinel.com
Wed Jul 8 16:43:56 BST 2009
At http://bazaar.launchpad.net/~jameinel/bzr/1.17-lru-cleanup
------------------------------------------------------------
revno: 4518
revision-id: john at arbash-meinel.com-20090708154351-u0t41fwjqm28pbnu
parent: john at arbash-meinel.com-20090708142804-i9rkpi9dmnu7v3x1
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: 1.17-lru-cleanup
timestamp: Wed 2009-07-08 10:43:51 -0500
message:
Add comments in the finally sections as to why we want them.
-------------- next part --------------
=== modified file 'bzrlib/lru_cache.py'
--- a/bzrlib/lru_cache.py 2009-07-08 14:28:04 +0000
+++ b/bzrlib/lru_cache.py 2009-07-08 15:43:51 +0000
@@ -52,8 +52,9 @@
if self.cleanup is not None:
self.cleanup(self.key, self.value)
finally:
+ # cleanup might raise an exception, but we want to make sure
+ # to break refcycles, etc
self.cleanup = None
- # Just make sure to break any refcycles, etc
self.value = None
@@ -161,6 +162,8 @@
try:
node.run_cleanup()
finally:
+ # Maintain the LRU properties, even if cleanup raises an
+ # exception
node.value = value
node.cleanup = cleanup
self._record_access(node)
@@ -249,7 +252,8 @@
try:
node.run_cleanup()
finally:
- # Now remove this node from the linked list
+ # cleanup might raise an exception, but we want to make sure to
+ # maintain the linked list
if node.prev is not None:
node.prev.next_key = node.next_key
if node.next_key is not _null_key:
More information about the bazaar-commits
mailing list