From 4ab240d53af95938c6a7e61f9d62aede34dcfc3d 2011-11-23 21:07:40 From: Thomas Kluyver Date: 2011-11-23 21:07:40 Subject: [PATCH] Specify protocol 2 for pickleshare, so objects stored by Python 3 can be used in Python 2. --- diff --git a/IPython/utils/pickleshare.py b/IPython/utils/pickleshare.py index fe14a44..e68d1fe 100755 --- a/IPython/utils/pickleshare.py +++ b/IPython/utils/pickleshare.py @@ -80,7 +80,9 @@ class PickleShareDB(collections.MutableMapping): parent = fil.parent if parent and not parent.isdir(): parent.makedirs() - pickled = pickle.dump(value,fil.open('wb')) + # We specify protocol 2, so that we can mostly go between Python 2 + # and Python 3. We can upgrade to protocol 3 when Python 2 is obsolete. + pickled = pickle.dump(value,fil.open('wb'), protocol=2) try: self.cache[fil] = (value,fil.mtime) except OSError,e: