# Negative numbers choose the highest available protocol.
import pickle
-PICKLE_PROTOCOL = pickle.HIGHEST_PROTOCOL
+# Was pickle.HIGHEST_PROTOCOL
+# Changed to 2 so py3.5+'s pickle will be compatible with py2.7.
+PICKLE_PROTOCOL = 2
# TODO: FIXME
# In 3.x, 'profile' automatically loads the fast version if available.
p = f.read()
if len(p) > 0:
try:
- self._dict = pickle.loads(p)
+ if bytes is not str:
+ self._dict = pickle.loads(p, encoding='bytes')
+ else:
+ self._dict = pickle.loads(p)
except (pickle.UnpicklingError, EOFError, KeyError):
# Note how we catch KeyErrors too here, which might happen
# when we don't have cPickle available (default pickle