Made the lru cache more robust.
--HG--
branch : trunk
diff --git a/jinja2/utils.py b/jinja2/utils.py
index dc52e0b..7e56279 100644
--- a/jinja2/utils.py
+++ b/jinja2/utils.py
@@ -613,7 +613,7 @@
if self._queue[-1] != key:
try:
self._remove(key)
- except:
+ except ValueError:
# if something removed the key from the container
# when we read, ignore the ValueError that we would
# get otherwise.
@@ -643,7 +643,11 @@
self._wlock.acquire()
try:
del self._mapping[key]
- self._remove(key)
+ try:
+ self._remove(key)
+ except ValueError:
+ # __getitem__ is not locked, it might happen
+ pass
finally:
self._wlock.release()