Ticket #6611: sorteddict-copy-7121.diff

File sorteddict-copy-7121.diff, 980 bytes (added by Jeremy Dunck, 17 years ago)
  • django/utils/datastructures.py

     
    145145        """Returns a copy of this object."""
    146146        # This way of initializing the copy means it works for subclasses, too.
    147147        obj = self.__class__(self)
    148         obj.keyOrder = self.keyOrder
     148        obj.keyOrder = self.keyOrder[:]
    149149        return obj
    150150
    151151    def __repr__(self):
  • tests/regressiontests/datastructures/tests.py

     
    7777'not one'
    7878>>> d.keys() == d.copy().keys()
    7979True
     80>>> d2 = d.copy()
     81>>> d2['four'] = 'four'
    8082>>> print repr(d)
    8183{'one': 'not one', 'two': 'two', 'three': 'three'}
    8284>>> d.pop('one', 'missing')
Back to Top