Opened 9 years ago

Closed 9 years ago

#6050 closed (fixed)

SortedDict can have multiple copies of same key/value pair when iterated over

Reported by: stephen.judkins@… Owned by: nobody
Component: Tools Version: master
Severity: Keywords: SortedDict
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

Behavior is like this:

>>> from django.utils.datastructures import SortedDict
>>> SortedDict([('foo', 'bar'), ('foo', 'baz')])
{'foo': 'baz', 'foo': 'baz'}

It should be like this:

>>> SortedDict([('foo', 'bar'), ('foo', 'baz')])
{'foo': 'baz'}

Attachments (2)

6050.patch (610 bytes) - added by Collin Grady <cgrady@…> 9 years ago.
6050.diff (3.2 KB) - added by Chris Beaven 9 years ago.
With a new test module for SortedDict - hardly complete but shows basic usage and expected behaviour of this bug

Download all attachments as: .zip

Change History (5)

Changed 9 years ago by Collin Grady <cgrady@…>

Attachment: 6050.patch added

Changed 9 years ago by Chris Beaven

Attachment: 6050.diff added

With a new test module for SortedDict - hardly complete but shows basic usage and expected behaviour of this bug

comment:1 Changed 9 years ago by Chris Beaven

Needs documentation: unset
Needs tests: unset
Patch needs improvement: unset
Triage Stage: UnreviewedReady for checkin

comment:2 Changed 9 years ago by Chris Beaven

Has patch: set

comment:3 Changed 9 years ago by Malcolm Tredinnick

Resolution: fixed
Status: newclosed

(In [6751]) Fixed #6050 -- Handled edge-case of duplicate keys being passed when
initialising SortedDict. Patch from Collin Grady and SmileyChris.

Note: See TracTickets for help on using tickets.
Back to Top