Fix memory cache string generation and storage on Python 3.
Review Request #9730 — Created March 4, 2018 and submitted
djblets.cachewas usingcStringIOto build up data for cache, and
then using the defaultpickleprotocol version to serialize it. This
wasn't compatible on Python 3.
cStringIOis no more, and the equivalent expects Unicode strings and
not bytes, so we now must useio.BytesIOfor 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.