Fixed #12632 -- Improved performance of `SortedDict`. Thanks, Alex Gaynor.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@13742 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Justin Bronn 2010-09-11 02:28:16 +00:00
parent a56a226241
commit 1efa807703
1 changed files with 3 additions and 1 deletions

View File

@ -120,9 +120,11 @@ class SortedDict(dict):
self.keyOrder = data.keys()
else:
self.keyOrder = []
seen = set()
for key, value in data:
if key not in self.keyOrder:
if key not in seen:
self.keyOrder.append(key)
seen.add(key)
def __deepcopy__(self, memo):
return self.__class__([(key, deepcopy(value, memo))