Support loading pickled data referencing SortedDict.
Review Request #10557 — Created May 20, 2019 and submitted
Django used to provide a class called
SortedDict
, which has long been
deprecated in favor of Python's ownOrderedDict
. However, due to the
way that pickling works, older signatures would still attempt to loading
aSortedDict
class.This change adds a compatibility mechanism for this. Upon finding an
attempt to load aSortedDict
, we instead give it a forwarding object
that's compatible with the unpickle code that constructs a new
OrderedDict
. It's a bit hacky, in that we need to have this class that
subclassesdict
, overrides__new__
, and then returns an entirely
different object, but it's a necessity for the compatibility.
Successfully loaded an older signature on Python 3.7/Django 1.11.
Summary | ID |
---|---|
e44024fe0b0cb2005a401d3ab2b256fd9491dfef |