Support loading pickled data referencing SortedDict.

Review Request #10557 — Created May 20, 2019 and submitted

chipx86
Django Evolution
master
django-evolution

Django used to provide a class called SortedDict, which has long been
deprecated in favor of Python's own OrderedDict. However, due to the
way that pickling works, older signatures would still attempt to loading
a SortedDict class.

This change adds a compatibility mechanism for this. Upon finding an
attempt to load a SortedDict, 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
subclasses dict, 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
Support loading pickled data referencing SortedDict.
david
  1. Ship It!
  2. 
      
chipx86
Review request changed

Status: Closed (submitted)

Change Summary:

Pushed to master (a610faf)
Loading...