This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author frenzy
Recipients Mark.Shannon, frenzy, pablogsal, vstinner
Date 2021-02-16.07:39:33
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1613461173.3.0.51696322951.issue43228@roundup.psfhosted.org>
In-reply-to
Content
I'm not an expert nor an author but this might help:

Cloudpickle offers extended possibilities for pickling but uses the standard pickle module for unpickling:

>>> import pickle, cloudpickle
>>> cloudpickle.load is pickle.load
True
>>> cloudpickle.loads is pickle.loads
True

So, the question here is why the new Python version cannot handle cloudpickle output anymore.

>>> def f():
...     return len("aaaa")
... 


>>> pickle.dumps(f)
b'\x80\x04\x95\x12\x00\x00\x00\x00\x00\x00\x00\x8c\x08__main__\x94\x8c\x01f\x94\x93\x94.'

>>> cloudpickle.dumps(f)
b'\x80\x05\x95\xa9\x01\x00\x00\x00\x00\x00\x00\x8c\x17cloudpickle.cloudpickle\x94\x8c\r_builtin_type\x94\x93\x94\x8c\nLambdaType\x94\x85\x94R\x94(h\x02\x8c\x08CodeType\x94\x85\x94R\x94(K\x00K\x00K\x00K\x00K\x02KCC\x08t\x00d\x01\x83\x01S\x00\x94N\x8c\x04aaaa\x94\x86\x94\x8c\x03len\x94\x85\x94)\x8c\x07<stdin>\x94\x8c\x01f\x94K\x01C\x02\x00\x01\x94))t\x94R\x94}\x94(\x8c\x0b__package__\x94N\x8c\x08__name__\x94\x8c\x08__main__\x94uNNNt\x94R\x94\x8c\x1ccloudpickle.cloudpickle_fast\x94\x8c\x12_function_setstate\x94\x93\x94h\x18}\x94}\x94(h\x15h\x0f\x8c\x0c__qualname__\x94h\x0f\x8c\x0f__annotations__\x94}\x94\x8c\x0e__kwdefaults__\x94N\x8c\x0c__defaults__\x94N\x8c\n__module__\x94h\x16\x8c\x07__doc__\x94N\x8c\x0b__closure__\x94N\x8c\x17_cloudpickle_submodules\x94]\x94\x8c\x0b__globals__\x94}\x94u\x86\x94\x86R0.'

It seems to me that cloudpickle adds also __globals__ to the final output and pickle is no longer able to restore it.
History
Date User Action Args
2021-02-16 07:39:33frenzysetrecipients: + frenzy, vstinner, Mark.Shannon, pablogsal
2021-02-16 07:39:33frenzysetmessageid: <1613461173.3.0.51696322951.issue43228@roundup.psfhosted.org>
2021-02-16 07:39:33frenzylinkissue43228 messages
2021-02-16 07:39:33frenzycreate