diff options
author | William Deegan <bill@baddogconsulting.com> | 2017-09-11 03:54:12 (GMT) |
---|---|---|
committer | William Deegan <bill@baddogconsulting.com> | 2017-09-11 03:54:12 (GMT) |
commit | 25bf7aea336336109f46fd94f640f2ba48621417 (patch) | |
tree | c67c23f2dc5398d4e643bb95de1b61b4007b72ad /src/engine | |
parent | a8e9b1ef62fa2bd12cd21b9c9b7f622dfe11d257 (diff) | |
download | SCons-25bf7aea336336109f46fd94f640f2ba48621417.zip SCons-25bf7aea336336109f46fd94f640f2ba48621417.tar.gz SCons-25bf7aea336336109f46fd94f640f2ba48621417.tar.bz2 |
PY2/3 changes to pickle so py2.7 and py3.5+ pickles used in sconsign will be readable by either. There are still rebuilds when switching
Diffstat (limited to 'src/engine')
-rw-r--r-- | src/engine/SCons/compat/__init__.py | 4 | ||||
-rw-r--r-- | src/engine/SCons/dblite.py | 5 |
2 files changed, 7 insertions, 2 deletions
diff --git a/src/engine/SCons/compat/__init__.py b/src/engine/SCons/compat/__init__.py index 59a1a94..0b6c016 100644 --- a/src/engine/SCons/compat/__init__.py +++ b/src/engine/SCons/compat/__init__.py @@ -96,7 +96,9 @@ rename_module('pickle', 'cPickle') # 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. diff --git a/src/engine/SCons/dblite.py b/src/engine/SCons/dblite.py index a9b9589..87a1763 100644 --- a/src/engine/SCons/dblite.py +++ b/src/engine/SCons/dblite.py @@ -119,7 +119,10 @@ class dblite(object): 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 |