Skip to content

Pickled functions incompatible between 0.4.0 and 0.4.1 #126

Description

@nikhaldi

When trying to unpickle a function with the 0.4.1 release from last week that was pickled with 0.4.0 I get this exception:

$ pip install cloudpickle==0.4.0
Collecting cloudpickle==0.4.0
Using cached cloudpickle-0.4.0-py2.py3-none-any.whl
Installing collected packages: cloudpickle
Found existing installation: cloudpickle 0.4.1
Uninstalling cloudpickle-0.4.1:
Successfully uninstalled cloudpickle-0.4.1
Successfully installed cloudpickle-0.4.0
$ python
Python 2.7.12 (default, Nov 19 2016, 06:48:10) [GCC 5.4.0 20160609] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import cloudpickle
>>> with open('pickled', 'wb') as p:
... cloudpickle.dump(lambda x: x, p)
... >>> $ pip install cloudpickle==0.4.1
Collecting cloudpickle==0.4.1
Using cached cloudpickle-0.4.1-py2.py3-none-any.whl
Installing collected packages: cloudpickle
Found existing installation: cloudpickle 0.4.0
Uninstalling cloudpickle-0.4.0:
Successfully uninstalled cloudpickle-0.4.0
Successfully installed cloudpickle-0.4.1
$ python
Python 2.7.12 (default, Nov 19 2016, 06:48:10) [GCC 5.4.0 20160609] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import cloudpickle
>>> with open('pickled', 'rb') as p:
... cloudpickle.load(p)
... Traceback (most recent call last):
File "<stdin>", line 2, in <module>
File "/usr/lib/python2.7/pickle.py", line 1384, in load
return Unpickler(file).load()
File "/usr/lib/python2.7/pickle.py", line 864, in load
dispatch[key](self)
File "/usr/lib/python2.7/pickle.py", line 1139, in load_reduce
value = func(*args)
TypeError: _fill_function() takes exactly 6 arguments (5 given)

Same incompatibility in the other direction.

I realize this is fixable by synchronizing the cloudpickle version across environments, but this is not necessarily trivial in a distributed setting and the pickle may have been persisted somewhere a while ago before the version bump.

So my question is more if this break in compatibility was intentional. I'm somewhat surprised that this would break in a minor release. Does cloudpickle have an official policy about which versions should be compatible? Would be good to know so we know how to hedge against it.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions