]> git.ipfire.org Git - thirdparty/jinja.git/commitdiff
don't create a third queue 1090/head
authorDavid Lord <davidism@gmail.com>
Thu, 24 Oct 2019 14:54:38 +0000 (07:54 -0700)
committerDavid Lord <davidism@gmail.com>
Thu, 24 Oct 2019 14:54:38 +0000 (07:54 -0700)
CHANGES.rst
jinja2/utils.py
tests/test_utils.py

index 6a35fd857b9934a0385ecaaf70e990fb183999e2..f64047bd6cf65a96ece1dece3b5e8c88e5cc7083 100644 (file)
@@ -55,8 +55,8 @@ Unreleased
 -   :class:`~nativetypes.NativeTemplate` correctly handles quotes
     between expressions. ``"'{{ a }}', '{{ b }}'"`` renders as the tuple
     ``('1', '2')`` rather than the string ``'1, 2'``. :issue:`1020`
--   ``LRUCache.copy()`` correctly re-initializes the queue methods
-    after copying. :issue:`843`
+-   After calling ``LRUCache.copy()``, the copy's queue methods point to
+    the correct queue. :issue:`843`
 
 
 Version 2.10.3
index 220edcf1d5d2ac4770d1d148efe10ed4ef8277ad..d2759e21dd52113e3c5829e729beae35dccb33c1 100644 (file)
@@ -340,8 +340,7 @@ class LRUCache(object):
         """Return a shallow copy of the instance."""
         rv = self.__class__(self.capacity)
         rv._mapping.update(self._mapping)
-        rv._queue = deque(self._queue)
-        rv._postinit()
+        rv._queue.extend(self._queue)
         return rv
 
     def get(self, key, default=None):
index 56ca5dcdc3b460bd4a4a19ae426248b3514315cc..7ff39f01f256f80e02fa8603197fd9b9e582916e 100644 (file)
@@ -17,10 +17,11 @@ import random
 import pytest
 
 from jinja2._compat import string_types, range_type
-from jinja2.utils import LRUCache, escape, object_type_repr, urlize, \
+from jinja2.utils import LRUCache, object_type_repr, urlize, \
      select_autoescape, generate_lorem_ipsum, missing, consume
 from markupsafe import Markup
 
+
 @pytest.mark.utils
 @pytest.mark.lrucache
 class TestLRUCache(object):