In cloudpickle v.0.8.0 and above, it seems that references to global objects are lost in the serialization -> deserialization process.
For example, the following asserts pass in cloudpickle 0.7.0:
importcloudpickleFOO= {}
deffoo_add(x):
FOO["x"] =xfunc=cloudpickle.loads(cloudpickle.dumps(foo_add))
assertFOO== {}, FOOfunc(66)
assertFOO== {"x": 66}, FOOfoo_add(67)
assertFOO== {"x": 67}, FOOHowever, in 0.8.0 and above, the following assert fails:
func(66)
assertFOO== {"x": 66}, FOOwith:
i.e., the function runs without error but doesn't actually affect the global dictionary anymore.
In
cloudpicklev.0.8.0 and above, it seems that references to global objects are lost in the serialization -> deserialization process.For example, the following asserts pass in
cloudpickle0.7.0:However, in 0.8.0 and above, the following assert fails:
with:
AssertionError: {}i.e., the function runs without error but doesn't actually affect the global dictionary anymore.