Somewhat safer unpickler
This class inherits all the implementation from the builtin pickle.Unpickler
but modifies the self.dispatch
dictionary used to unpack the serialized structures.
This is not checked to be safe, but in case you are using pickled files in production and you are searching for some safer way to load them to convert the data to a different format, this class can be handy.
The same idea works for Python 3, subclassing pickle._Unpickler
.