diff --git a/django/utils/datastructures.py b/django/utils/datastructures.py index f46b57c151..a2b78a31c5 100644 --- a/django/utils/datastructures.py +++ b/django/utils/datastructures.py @@ -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): diff --git a/tests/regressiontests/datastructures/tests.py b/tests/regressiontests/datastructures/tests.py index b5dc5d171b..172057f080 100644 --- a/tests/regressiontests/datastructures/tests.py +++ b/tests/regressiontests/datastructures/tests.py @@ -77,6 +77,8 @@ MultiValueDictKeyError: "Key 'lastname' not found in >> 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')