Issue 26959: pickle: respect dispatch for functions again (original) (raw)

Issue26959

Created on 2016-05-05 00:13 by torkve, last changed 2022-04-11 14:58 by admin.

Files
File name Uploaded Description Edit
function_pickle.patch torkve,2016-05-05 00:13 Patch for custom function picklers support review
function_pickle.patch torkve,2016-05-06 10:21 Patch for custom function picklers support. v2 review
Messages (5)
msg264866 - (view) Author: Vsevolod Velichko (torkve) * Date: 2016-05-05 00:13
The commit [2] removed support for handling unpicklable functions with copyreg override from cpickle due to lack of the same feature in pickle. This patch restores that feature and adds the support of it to pickle. [1] Original discussion: https://mail.python.org/pipermail/python-dev/2016-May/144426.html [2] https://hg.python.org/cpython/rev/6bd1f0a27e8e
msg264950 - (view) Author: Hrvoje Nikšić (hniksic) * Date: 2016-05-06 09:22
You can simplify pickle_lambda in the test by using marshal.dumps(code_obj) and marshal.loads(code_obj) to dump and load the code object without going through its entire guts. It would be a shame to have to change a pickle test just because some detail of the code object implementation changes.
msg264958 - (view) Author: Vsevolod Velichko (torkve) * Date: 2016-05-06 10:21
I was trying to avoid additional imports in the test. But your point of view seems more reasonable, so I reupload the fixed patch.
msg279809 - (view) Author: Vsevolod Velichko (torkve) * Date: 2016-10-31 17:15
Hi, any progress here?
msg288153 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2017-02-19 18:58
Is saving global an atomic operation? Falling back to using reduce can be not safe if some data was written during saving global. That also might make error messages less helpful. Is not founding a function the only cause of PicklingError? Raising and catching an exception is not very efficient. Shouldn't the fallback be used for classes and C functions? If add this feature the patch should be significantly reworked.
History
Date User Action Args
2022-04-11 14:58:30 admin set github: 71146
2018-01-08 12:52:28 serhiy.storchaka set assignee: serhiy.storchaka
2017-02-19 18:58:51 serhiy.storchaka set versions: + Python 3.7, - Python 3.6nosy: + serhiy.storchakamessages: + type: behavior -> enhancementstage: patch review -> needs patch
2016-10-31 17:15:16 torkve set messages: +
2016-05-06 10:21:04 torkve set files: + function_pickle.patchmessages: +
2016-05-06 09:22:40 hniksic set nosy: + hniksicmessages: +
2016-05-06 07:14:41 SilentGhost set nosy: + pitrou, alexandre.vassalottistage: patch review
2016-05-05 00:13:46 torkve create