At http://bazaar.launchpad.net/~jameinel/bzr/1.17-lru-cleanup
------------------------------------------------------------
revno: 4518
revision-id: [email protected]
parent: [email protected]
committer: John Arbash Meinel <[email protected]>
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.
=== 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:
--
bazaar-commits mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/bazaar-commits