-
-
Notifications
You must be signed in to change notification settings - Fork 189
Description
Hey, I've been working on a prototype of a "portable pickle" feature and started wondering whether it could eventually work with cPickle (or _pickle), the accelerator module written in C. I've also seen some comments in the code referencing the possibility that dill in general could use it.
However, after doing some investigation I noted that, even if the save_<type> functions are updated to use state setters (Py 3.8+) and don't rely on internal Pickler methods like save and save_reduce, there remains a big problem: cPickle will always save types and functions as globals (there isn't an internal dispatch table that we can modify as with the Python implementation).
I thought of creating a C extension module to play with cPickle internals, but all the C functions are private. The only remaining alternative I see is to have a complete clone of Pickler code with some minor tweaks to allow overriding these types' saving.
Have you also wondered about these issues? Do you think it is feasible to have a C extension compatible with multiple Python 3 versions? (I have no ideia how building and distributing these works.)