Opened 8 years ago

Closed 8 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@…> 8 years ago.
6050.diff (3.2 KB) - added by SmileyChris 8 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 8 years ago by Collin Grady <cgrady@…>

Changed 8 years ago by SmileyChris

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

comment:1 Changed 8 years ago by SmileyChris

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Triage Stage changed from Unreviewed to Ready for checkin

comment:2 Changed 8 years ago by SmileyChris

  • Has patch set

comment:3 Changed 8 years ago by mtredinnick

  • Resolution set to fixed
  • Status changed from new to closed

(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