diff --git a/pep-3154.txt b/pep-3154.txt index 9ed7b7f5c..a7a2249c0 100644 --- a/pep-3154.txt +++ b/pep-3154.txt @@ -67,12 +67,20 @@ Currently, classes whose __new__ mandates the use of keyword-only arguments can not be pickled (or, rather, unpickled) [3]_. Both a new special method (``__getnewargs_ex__`` ?) and a new opcode (NEWOBJEX ?) are needed. +Serializing more callable objects +--------------------------------- + +Currently, only module-global functions are serializable. Multiprocessing +has custom support for pickling other callables such as bound methods [4]_. +This support could be folded in the protocol, and made more efficient +through a new GETATTR opcode. + Serializing "pseudo-global" objects ----------------------------------- Objects which are not module-global, but should be treated in a similar -fashion -- such as methods [4]_ or nested classes -- cannot currently be -pickled (or, rather, unpickled) because the pickle protocol does not +fashion -- such as unbound methods [5]_ or nested classes -- cannot currently +be pickled (or, rather, unpickled) because the pickle protocol does not correctly specify how to retrieve them. One solution would be through the adjunction of a ``__namespace__`` (or ``__qualname__``) to all class and function objects, specifying the full "path" by which they can be retrieved. @@ -119,7 +127,10 @@ References .. [3] "pickle/copyreg doesn't support keyword only arguments in __new__": http://bugs.python.org/issue4727 -.. [4] "pickle should support methods": +.. [4] Lib/multiprocessing/forking.py: + http://hg.python.org/cpython/file/baea9f5f973c/Lib/multiprocessing/forking.py#l54 + +.. [5] "pickle should support methods": http://bugs.python.org/issue9276 Copyright