-
Notifications
You must be signed in to change notification settings - Fork 184
Open
Description
When you have parent and child classes both have the same attribute, then the __dict__ of each class should contains this attribute.
But when the attribute have the same value, cloudpickle will remove the attribute from the dict of the sub class.
For Example:
import cloudpickle
import gc
class A:
__version__ = 1
class B(A):
__version__ = 1
obj = B()
print('Obj: ', '__version__' in obj.__class__.__dict__)
s = cloudpickle.dumps(obj)
loaded_obj = cloudpickle.loads(s)
print('Loaded obj: ', '__version__' in loaded_obj.__class__.__dict__)
del A
del B
del obj
del loaded_obj
gc.collect()
loaded_obj = cloudpickle.loads(s)
print('Loaded obj after gc: ', '__version__' in loaded_obj.__class__.__dict__)The output will be:
Obj: True
Loaded obj: True
Loaded obj after gc: False
Metadata
Metadata
Assignees
Labels
No labels