"Jerome Alet" <al**@librelogiciel.com> wrote in message
news:pa****************************@librelogiciel. com...
I'd want to pickle a complex Python data structure and save it as
a blob in a relationnal database.
Now I do that, and I can retrieve it with no problem and then
unpickle it.
But if I upgrade Python some day, will I still be able to unpickle
datas which were pickled with old versions and stored in my database ?
In short, yes.
Lib Ref 3.14.2 Data stream format
There are currently 3 different protocols which can be used for
pickling.
Protocol version 0 is the original ASCII protocol and is backwards
compatible with earlier versions of Python.
Protocol version 1 is the old binary format which is also compatible
with earlier versions of Python.
Protocol version 2 was introduced in Python 2.3. It provides much more
efficient pickling of new-style classes.
Refer to PEP 307 for more information.
-----
From the PEP:
To date, each release of Python has been able to
read pickles written by all previous releases.
Protocol 1 is kept precisely for this reason. I am sure that Guido
intends for this to remain true at least thru the 2.x series. I
believe this would only change if the Python object system were
changed enough (in Python 3 or beyond) that unpickling old objects in
the new system were to make no sense. If that were to happen, you
would want to upgrade by addition rather than replacement.
Terry J. Reedy