summaryrefslogtreecommitdiff
path: root/django/utils/functional.py
diff options
context:
space:
mode:
authorBouke Haarsma <bouke@webatoom.nl>2013-11-01 21:15:41 +0100
committerBaptiste Mispelon <bmispelon@gmail.com>2013-11-11 08:53:09 +0100
commit9b7455e918a437c3db91e88dcbf6d9c93fef96f8 (patch)
tree4cda7466ec20e5255633e7447eaa03ad5450bf24 /django/utils/functional.py
parent6c5f5b9a414b8bdfafc45db5710acf200cca9885 (diff)
Fixed #21351 -- Replaced memoize with Python's lru_cache.
Replaced the custom, untested memoize with a similar decorator from Python's 3.2 stdlib. Although some minor performance degradation (see ticket), it is expected that in the long run lru_cache will outperform memoize once it is implemented in C. Thanks to EvilDMP for the report and Baptiste Mispelon for the idea of replacing memoize with lru_cache.
Diffstat (limited to 'django/utils/functional.py')
-rw-r--r--django/utils/functional.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/django/utils/functional.py b/django/utils/functional.py
index 65ec4b53c4..d52323b220 100644
--- a/django/utils/functional.py
+++ b/django/utils/functional.py
@@ -2,6 +2,7 @@ import copy
import operator
from functools import wraps
import sys
+import warnings
from django.utils import six
from django.utils.six.moves import copyreg
@@ -24,6 +25,10 @@ def memoize(func, cache, num_args):
Only the first num_args are considered when creating the key.
"""
+ warnings.warn(u"memoize wrapper is deprecated and will be removed in "
+ u"Django 1.9. Use django.utils.lru_cache instead.",
+ PendingDeprecationWarning, 2)
+
@wraps(func)
def wrapper(*args):
mem_args = args[:num_args]