Fix memory cache string generation and storage on Python 3.
Review Request #9730 — Created March 4, 2018 and submitted
djblets.cache
was usingcStringIO
to build up data for cache, and
then using the defaultpickle
protocol version to serialize it. This
wasn't compatible on Python 3.
cStringIO
is no more, and the equivalent expects Unicode strings and
not bytes, so we now must useio.BytesIO
for this purpose. The API is
pretty similar, so it's an easy transition.
pickle
's default protocol version on Python 3.x is not the same as it
was in Python 2.x, causing differences in how the data is serialized and
deserialized. We now force the usage of the protocol version defaulted
to on Python 2.x.A unit test was added for ensuring that Unicode storage still works and
that the serialized data is in the format we expect.
Relevant unit tests pass on Python 2.7, 3.4, 3.5, and 3.6.