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
This commit is contained in:
parent
d69f3ccfdb
commit
e7b2ad8020
|
@ -145,7 +145,7 @@ class SortedDict(dict):
|
|||
"""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):
|
||||
|
|
|
@ -77,6 +77,8 @@ MultiValueDictKeyError: "Key 'lastname' not found in <MultiValueDict: {'position
|
|||
'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')
|
||||
|
|
Loading…
Reference in New Issue