Hello, I met a problem when i call cloudpickle.loads.
This is my code:
import cloudpickle
from scrapy.item import Item, Field
MyItem = type('MyItem', (Item,), dict({'id': Field()}))
item = MyItem()
print(cloudpickle.loads(cloudpickle.dumps(item))) # {}
print(isinstance(dict().values(), MyItem)) # False
print(cloudpickle.loads(cloudpickle.dumps(item))) # raise
I guess the cache of MetaClass cause to this problem.
isinstance call __instancecheck__ of ABCMeta and finally call __subclasscheck__ of ABCMeta.
code: https://github.com/python/cpython/blob/3.5/Lib/abc.py#L210
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.
Hello, I met a problem when i call cloudpickle.loads.
This is my code:
I guess the cache of MetaClass cause to this problem.
isinstancecall__instancecheck__of ABCMeta and finally call__subclasscheck__of ABCMeta.code: https://github.com/python/cpython/blob/3.5/Lib/abc.py#L210
And cloudpickle.dumps will dumps the
_abc_cacheand_abc_negative_cachewhich has some invalid object, so when I call cloudpickle.loads in second , it raise exception.