Fix memory cache string generation and storage on Python 3.

Review Request #9730 — Created March 4, 2018 and submitted

Information

Djblets
release-2.0.x
21260cc...

Reviewers

djblets.cache was using cStringIO to build up data for cache, and
then using the default pickle 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 use io.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.

david
  1. Ship It!
  2. 
      
chipx86
Review request changed

Status: Closed (submitted)

Change Summary:

Pushed to release-2.0.x (3172bd9)
Loading...