Derek, On Tue, 2020-02-04 at 12:56 -0500, Derek Atkins wrote: > Hi Frank, > > Frank Crawford < > fr...@crawford.emu.id.au > > writes: >
... > According to the docs I just found on class pickle.Pickler[0], there > is > a fix_imports and Protocol version number in there that lets you set > the > compatibility level: > > The optional protocol argument, an integer, tells the pickler to > use > the given protocol; supported protocols are 0 to > HIGHEST_PROTOCOL. If not specified, the default is > DEFAULT_PROTOCOL. If a negative number is specified, > HIGHEST_PROTOCOL is selected. > > If fix_imports is true and protocol is less than 3, pickle will > try > to map the new Python 3 names to the old module names used in > Python > 2, so that the pickle data stream is readable with Python 2. > > SO.. It SHOULD be possible to create a pickle in Py3 that is > readable > by Py2. Have we tried this? Unfortunately, no, it doesn't work the way it reads. It maps some pickle built-in name to new versions of those names, but doesn't address the translation of ascii to unicode and visa-versa (except for those specific instances). I did try this. Certainly, if you could get the translation to work, you would need to use protocol version and that is a general thing that should be looked at in the future, but as a performance issue, not a conversion option. > -derek > > [0] > https://docs.python.org/3/library/pickle.html#pickle.Pickler > >