Restore functions pickling
Hello, I was recently porting my application from Py2 to Py3 and encountered error, when I accidentally became unable to define my own pickling mechanism for functions. Before that I was using it to pickle pure lambdas, registering my own handler for cPickle with copy_reg, but after [1] (and release 3.4) it seems that feature has been removed. As it mentioned in commit message, this was done for compatibility with pure-python pickle. So I have to ask, may be it would be better to revert the commit and add the corresponding feature to pure-python pickle implementation? [1] https://hg.python.org/cpython/rev/6bd1f0a27e8e -- Best wishes, Vsevolod Velichko
On Wed, 4 May 2016 at 11:39 Всеволод Величко <torkvemada@sorokdva.net> wrote:
Hello,
I was recently porting my application from Py2 to Py3 and encountered error, when I accidentally became unable to define my own pickling mechanism for functions. Before that I was using it to pickle pure lambdas, registering my own handler for cPickle with copy_reg, but after [1] (and release 3.4) it seems that feature has been removed.
As it mentioned in commit message, this was done for compatibility with pure-python pickle. So I have to ask, may be it would be better to revert the commit and add the corresponding feature to pure-python pickle implementation?
If you want to provide a patch to implement function pickling in pure Python code and make this work with both pickle.py and _pickle.c we might be up for accepting the patch. You can also open an issue requesting pickling support for functions at bugs.python.org to keep track of the request and see if anyone else is interested in the feature.
Super, since you are not against this feature, I created the issue with the pach[1]. Hopefully you or one of your colleagues will have some time to review it. (I signed the contributor form, changes just not reached the bugtracker yet) [1] http://bugs.python.org/issue26959 2016-05-04 21:55 GMT+03:00 Brett Cannon <brett@python.org>:
On Wed, 4 May 2016 at 11:39 Всеволод Величко <torkvemada@sorokdva.net> wrote:
Hello,
I was recently porting my application from Py2 to Py3 and encountered error, when I accidentally became unable to define my own pickling mechanism for functions. Before that I was using it to pickle pure lambdas, registering my own handler for cPickle with copy_reg, but after [1] (and release 3.4) it seems that feature has been removed.
As it mentioned in commit message, this was done for compatibility with pure-python pickle. So I have to ask, may be it would be better to revert the commit and add the corresponding feature to pure-python pickle implementation?
If you want to provide a patch to implement function pickling in pure Python code and make this work with both pickle.py and _pickle.c we might be up for accepting the patch. You can also open an issue requesting pickling support for functions at bugs.python.org to keep track of the request and see if anyone else is interested in the feature.
-- Best wishes, Vsevolod Velichko
participants (2)
-
Brett Cannon
-
Всеволод Величко