Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Regression when pickling closures #86

Closed
pitrou opened this issue May 23, 2017 · 2 comments
Closed

Regression when pickling closures #86

pitrou opened this issue May 23, 2017 · 2 comments
Labels

Comments

@pitrou
Copy link
Member

pitrou commented May 23, 2017

This is on git master:

>>> import cloudpickle
>>> def f():
...:    s = {1,2}
...:    def g():
...:        return len(s)
...:    return g
...:
>>> g = f()
>>> g
<function __main__.f.<locals>.g>
>>> cloudpickle.dumps(g)
Traceback (most recent call last):
  File "<ipython-input-5-3faa44bc74aa>", line 1, in <module>
    cloudpickle.dumps(g)
  File "/home/antoine/cloudpickle/cloudpickle/cloudpickle.py", line 734, in dumps
    cp.dump(obj)
  File "/home/antoine/cloudpickle/cloudpickle/cloudpickle.py", line 146, in dump
    return Pickler.dump(self, obj)
  File "/home/antoine/miniconda3/envs/dask36/lib/python3.6/pickle.py", line 409, in dump
    self.save(obj)
  File "/home/antoine/miniconda3/envs/dask36/lib/python3.6/pickle.py", line 476, in save
    f(self, obj) # Call unbound method with explicit self
  File "/home/antoine/cloudpickle/cloudpickle/cloudpickle.py", line 267, in save_function
    self.save_function_tuple(obj)
  File "/home/antoine/cloudpickle/cloudpickle/cloudpickle.py", line 336, in save_function_tuple
    self._save_subimports(code, set(f_globals.values()) | set(closure))
TypeError: unhashable type: 'set'
@pitrou
Copy link
Member Author

pitrou commented May 23, 2017

@ogrisel

pitrou added a commit to pitrou/cloudpickle that referenced this issue May 23, 2017
@pitrou
Copy link
Member Author

pitrou commented May 30, 2017

Fixed by PR #90.

@pitrou pitrou closed this as completed May 30, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant