-
Notifications
You must be signed in to change notification settings - Fork 184
Closed
Labels
Description
The following test started to fail in the latest 0.5.6 release:
import numpy as np
import cloudpickle
def test_pickle_globals():
def f(x):
return np.sin(x) + np.cos(x) # requires access to global numpy
def g(): # some other object not necessary for f
pass
d = cloudpickle.loads(cloudpickle.dumps(f)).__globals__
assert 'g' not in d
assert set(d) == {'np', '__builtins__'}It now seems that cloudpickle brings in many more globals into the serialization.
In [6]: set(d)
Out[6]:
{'In',
'Out',
'_',
'_5',
'__',
'___',
'__builtin__',
'__builtins__',
'__doc__',
'__loader__',
'__name__',
'__package__',
'__spec__',
'_dh',
'_i',
'_i1',
'_i2',
'_i3',
'_i4',
'_i5',
'_i6',
'_ih',
'_ii',
'_iii',
'_oh',
'cloudpickle',
'd',
'exit',
'f',
'g',
'get_ipython',
'np',
'quit'}This is causing dask tests to fail