Opened 7 years ago

Closed 7 years ago

Last modified 11 days ago

#30159 closed Cleanup/optimization (fixed)

Remove obsolete use of OrderedDict with Python 3.6+

Reported by: Nick Pope Owned by: Nick Pope
Component: Core (Other) Version: dev
Severity: Normal Keywords: ordereddict
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

With Django 3.0 supporting Python 3.6+ we can strip out some of the use of OrderedDict that is no longer required now that dictionaries preserve insertion order. Although this property of dictionaries is only a language feature from Python 3.7, it is unlikely to be changed in a patch release of CPython 3.6 and PyPy3 already preserves insertion order.

Change History (5)

comment:1 by Nick Pope, 7 years ago

Has patch: set

comment:2 by Tim Graham, 7 years ago

Component: UncategorizedCore (Other)
Triage Stage: UnreviewedReady for checkin

comment:3 by Tim Graham <timograham@…>, 7 years ago

Resolution: fixed
Status: assignedclosed

In 24b82cd2:

Fixed #30159 -- Removed unneeded use of OrderedDict.

Dicts preserve order since Python 3.6.

comment:4 by Jacob Walls <jacobtylerwalls@…>, 11 days ago

In 71426673:

Replaced yaml serializer workaround to preserve dict order with PyYAML's sort_keys=False.

The sort_keys parameter was added in PyYAML 5.1 (released March 2019).
The workaround was added in 24b82cd201e21060fbc02117dc16d1702877a1f3
(refs #30159).

comment:5 by Mariusz Felisiak <felisiak.mariusz@…>, 11 days ago

In d33364c7:

Removed OrderedDict representer from PyYAML serializer.

Added in 5bc3123479bd97dc9d8a36fa9a3421a71063d1da (refs #24558),
it was obsoleted when OrderedDict usage was removed in
24b82cd201e21060fbc02117dc16d1702877a1f3 (refs #30159).

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