Rev 4295: Because we now store 'key' references, and we use None there to indicate in lp:///~jameinel/bzr/1.15-lru-gc

John Arbash Meinel john at arbash-meinel.com
Thu Apr 16 21:57:07 BST 2009


At lp:///~jameinel/bzr/1.15-lru-gc

------------------------------------------------------------
revno: 4295
revision-id: john at arbash-meinel.com-20090416205631-3utrx0gutoxove2f
parent: john at arbash-meinel.com-20090416204541-gg2qtfggaxwzudvz
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: 1.15-lru-gc
timestamp: Thu 2009-04-16 15:56:31 -0500
message:
  Because we now store 'key' references, and we use None there to indicate
  the end-of-chain, we can no longer safely map the None object to real values.
-------------- next part --------------
=== modified file 'bzrlib/lru_cache.py'
--- a/bzrlib/lru_cache.py	2009-04-16 20:45:41 +0000
+++ b/bzrlib/lru_cache.py	2009-04-16 20:56:31 +0000
@@ -149,6 +149,9 @@
         :param cleanup: None or a function taking (key, value) to indicate
                         'value' should be cleaned up.
         """
+        if key is None:
+            # We use None to indicate non-entries in our key following code.
+            raise ValueError('LRUCache cannot map None as a key')
         if key in self._cache:
             node = self._cache[key]
             node.run_cleanup()



More information about the bazaar-commits mailing list