Skip to content

Dill breaks cloudpickle > 1.3.0 on inner functions with closure #393

Description

@davidsmf

Cloudpickle 1.5.0, dill 0.3.2 or 0.3.1.1:

importdillimportcloudpickleclassFoo:
defbar(self, param: int):
hello="Hello"defbaz() ->None:
print(hello, param)
cloudpickle.loads(cloudpickle.dumps(baz))()
if__name__=='__main__':
Foo().bar(param=2)

This fails with ValueError: Cell is empty.

Without the dill import, or with the dill import after the cloudpickle import, and it's all fine.

If the inner function is just

defbaz() ->None:
print("Hello world")

then it's also fine.

The problem seems to be if the inner function captures anything in its closure.

This was fine with cloudpickle 1.3.0

Should I bring this up with dill?

Activity

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

Metadata

Metadata

Assignees

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