Reputation: 867
When I preserve the object to file with pickle, is the file will be expired when I update the python interpreter(for example from 3.6.4 to 3.7.0r1) or change the implementation of python(for example from cpython to pypy)?
If it does, is there a range of compatibility to allow upgrade of platform? Or is there a tools to convert these dumped file to adapt new platform?
Upvotes: 2
Views: 711
Reputation: 2576
No, it doesn't matter. The only issue would be going from 3.x to 2.x, as noted in pickle.py. The latest pickle can read all file formats that were written in one of the listed versions (note that 1.0 was the original pickle implementation):
Changing between python implementations such as IronPython or Jython shouldn't matter as long as they properly implement standard library modules which almost all do.
Upvotes: 2
Reputation: 2248
If you're just pickling across versions of python 3, then you won't run into any problems with the default protocol. However, if you require the pickle file to be read by python 2, then you can change the pickle version to 0
during the dump, which can be read by python 2 and python 3.
I recommend reading the docs as it has much more on the topic: https://docs.python.org/3/library/pickle.html
Upvotes: 2