-
Notifications
You must be signed in to change notification settings - Fork 167
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
Recent release brings in all globals #202
Comments
This test does not really check that those extra objects where included in the pickle though. The |
So maybe it's not a bug :) But we need to improve the tests in cloudpickle to make sure that we did no introduce a regression. |
Ah, interesting. Another way to test: In [1]: import numpy as np
...: import cloudpickle
...:
In [2]: def f(x):
...: return np.sin(x) + np.cos(x)
...:
In [3]: b = cloudpickle.dumps(f)
In [4]: def g():
...: pass
...:
In [5]: b2 = cloudpickle.dumps(f)
In [6]: b == b2
Out[6]: True |
The current behavior is to try to retrieve the So I think the test should be changed to test that importing a function from a |
Here is another one that passes: import cloudpickle
import numpy as np
from io import StringIO
from pickletools import dis
def unrelated_function(a):
return np.array([a])
def my_small_function(a, b):
return a + b
pickled = cloudpickle.dumps(my_small_function)
buffer_ = StringIO()
dis(pickled, out=buffer_)
pickled_asm = buffer_.getvalue()
assert 'my_small_function' in pickled_asm
assert 'unrelated_function' not in pickled_asm
assert 'numpy' not in pickled_asm |
Implementation taken from cloudpipe/cloudpickle#202 (comment)
Implementation taken from cloudpipe/cloudpickle#202 (comment)
OK. Closing as not-a-bug. Thanks everyone for the help. |
Great, I opened #203 to improve the cloudpickle tests. |
* Change test_pickle_globals to not check __globals__ directly Implementation taken from cloudpipe/cloudpickle#202 (comment) * [skip ci] Fix docstring
The following test started to fail in the latest 0.5.6 release:
It now seems that cloudpickle brings in many more globals into the serialization.
This is causing dask tests to fail
The text was updated successfully, but these errors were encountered: