~parthm/bzr/164450-push-pull-tags

« back to all changes in this revision

Viewing changes to bzrlib/lru_cache.py

  • Committer: John Arbash Meinel
  • Date: 2009-07-08 15:43:51 UTC
  • mto: This revision was merged to the branch mainline in revision 4521.
  • Revision ID: john@arbash-meinel.com-20090708154351-u0t41fwjqm28pbnu
Add comments in the finally sections as to why we want them.

Show diffs side-by-side

added added

removed removed

Lines of Context:
52
52
            if self.cleanup is not None:
53
53
                self.cleanup(self.key, self.value)
54
54
        finally:
 
55
            # cleanup might raise an exception, but we want to make sure
 
56
            # to break refcycles, etc
55
57
            self.cleanup = None
56
 
            # Just make sure to break any refcycles, etc
57
58
            self.value = None
58
59
 
59
60
 
161
162
            try:
162
163
                node.run_cleanup()
163
164
            finally:
 
165
                # Maintain the LRU properties, even if cleanup raises an
 
166
                # exception
164
167
                node.value = value
165
168
                node.cleanup = cleanup
166
169
                self._record_access(node)
249
252
        try:
250
253
            node.run_cleanup()
251
254
        finally:
252
 
            # Now remove this node from the linked list
 
255
            # cleanup might raise an exception, but we want to make sure to
 
256
            # maintain the linked list
253
257
            if node.prev is not None:
254
258
                node.prev.next_key = node.next_key
255
259
            if node.next_key is not _null_key: