Django

Code

Ticket #6611: sorteddict-copy-7121.diff

File sorteddict-copy-7121.diff, 1.0 kB (added by jdunck, 8 months ago)
  • django/utils/datastructures.py

    old new  
    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

    old new  
    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')