Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fixed #6611 -- When copying a SortedDict, make a new copy of the keys…

… list.

Thanks, Jeremy Dunck.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@7129 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit e7b2ad8020aef2941eb477632c4a453e7150202a 1 parent d69f3cc
@malcolmt malcolmt authored
View
2  django/utils/datastructures.py
@@ -145,7 +145,7 @@ def copy(self):
"""Returns a copy of this object."""
# This way of initializing the copy means it works for subclasses, too.
obj = self.__class__(self)
- obj.keyOrder = self.keyOrder
+ obj.keyOrder = self.keyOrder[:]
return obj
def __repr__(self):
View
2  tests/regressiontests/datastructures/tests.py
@@ -77,6 +77,8 @@
'not one'
>>> d.keys() == d.copy().keys()
True
+>>> d2 = d.copy()
+>>> d2['four'] = 'four'
>>> print repr(d)
{'one': 'not one', 'two': 'two', 'three': 'three'}
>>> d.pop('one', 'missing')
Please sign in to comment.
Something went wrong with that request. Please try again.