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 Arusekk
Recipients Arusekk
Date 2021-02-01.19:44:18
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1612208658.97.0.645260626964.issue43093@roundup.psfhosted.org>
In-reply-to
Content
Sorry, I forgot to state what is my actual goal: for the module objects to be pickleable in native CPython (possibly from C layer) without the need to add this to every code that wants to pickle module objects.

The point is that they can already be unpickled from the representation generated by the code, so it should only be necessary to implement __reduce__ in moduleobject.c, and probably to change the object's qualname / module attributes. Or to introduce a helper function, like PyPy did, for the fake module case; I just found supporting existing unpickling paths more elegant (and working across all Python versions since 2.0.0), as much as unelegant is the monkey-patching done in my example. It is possible that (for the actual module case) _compat_pickle.REVERSE_IMPORT_MAPPING should be considered as well for the old protocols (which would probably imply using __reduce_ex__ instead), but I did not explore that.
History
Date User Action Args
2021-02-01 19:44:18Arusekksetrecipients: + Arusekk
2021-02-01 19:44:18Arusekksetmessageid: <1612208658.97.0.645260626964.issue43093@roundup.psfhosted.org>
2021-02-01 19:44:18Arusekklinkissue43093 messages
2021-02-01 19:44:18Arusekkcreate