Make MappingProxyType picklable
Currently, mappingproxies are not picklable, which (among other things) lead to signature objects being non picklable. Could this be easily fixed, or is there a stronger reason for not allowing that pickling? If mappingproxies cannot be made picklable, perhaps signatures can implement __getnewargs__ to allow pickling? Antony
Antony, On 2/21/2014, 9:13 PM, Antony Lee wrote:
Currently, mappingproxies are not picklable, which (among other things) lead to signature objects being non picklable. Could this be easily fixed, or is there a stronger reason for not allowing that pickling? If mappingproxies cannot be made picklable, perhaps signatures can implement __getnewargs__ to allow pickling? Antony
Good catch. I think we'll make Signatures picklable in 3.5 (http://bugs.python.org/issue20726) It can be implemented using __reduce__ and __setstate__ methods. We can't use __getnewargs__ as we have keyword-only arguments in Parameter and Signature classes (but maybe we'll be able to use __getnewargs_ex__ in 3.5) Do you have any other reasons to make mappingproxies picklable? Yury
Not really, although if there is no technical limitation (and if there is
one, what is it?), it seems preferable to make mappingproxies picklable
rather than use ad-hoc fixes for Signature.
Thanks for the quick reply.
2014-02-21 19:26 GMT-08:00 Yury Selivanov
Antony,
On 2/21/2014, 9:13 PM, Antony Lee wrote:
Currently, mappingproxies are not picklable, which (among other things) lead to signature objects being non picklable. Could this be easily fixed, or is there a stronger reason for not allowing that pickling? If mappingproxies cannot be made picklable, perhaps signatures can implement __getnewargs__ to allow pickling? Antony
Good catch. I think we'll make Signatures picklable in 3.5 (http://bugs.python.org/issue20726) It can be implemented using __reduce__ and __setstate__ methods. We can't use __getnewargs__ as we have keyword-only arguments in Parameter and Signature classes (but maybe we'll be able to use __getnewargs_ex__ in 3.5)
Do you have any other reasons to make mappingproxies picklable?
Yury _______________________________________________ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/
participants (2)
-
Antony Lee
-
Yury Selivanov