You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
And cloudpickle.dumps will dumps the _abc_cache and _abc_negative_cache which has some invalid object, so when I call cloudpickle.loads in second , it raise exception.
Hi, thanks for reporting. I can reproduce on python3.6, your example raises:
Traceback (most recent call last):
File "test_scrapy.py", line 8, in <module> print(cloudpickle.loads(cloudpickle.dumps(item))) # raise
File "/home/pierreglaser/repos/cloudpickle/cloudpickle/cloudpickle.py", line 1308, in _rehydrate_skelet
on_class
setattr(skeleton_class, attrname, attr)
TypeError: can't set attributes of built-in/extension type 'dict_values'
Indeed, the error comes from the fact that the negative cache of MyItem got populated with an unpickleable class (dict_values) during
isinstance(dict().values(), MyItem)
In general, I would lean towards not pickling the abc caches of a specifc class: we don't need the objects in the cache to pickle the said class, and this actually may make the final pickle unnecessarily large.
Activity
pierreglaser commentedon Aug 1, 2019
Hi, thanks for reporting. I can reproduce on python3.6, your example raises:
I'll look into it.
pierreglaser commentedon Aug 1, 2019
Indeed, the error comes from the fact that the negative cache of
MyItemgot populated with an unpickleable class (dict_values) duringIn general, I would lean towards not pickling the
abccaches of a specifc class: we don't need the objects in the cache to pickle the said class, and this actually may make the final pickle unnecessarily large.yitso commentedon Aug 1, 2019
Thanks for your reply.
not pickling the abc caches is great idea~
py-cloudpickle: updated to 2.0.0