[Python-checkins] peps: Add a suggestion to make more callables picklable (as multiprocessing
antoine.pitrou
python-checkins at python.org
Tue Aug 16 12:14:08 CEST 2011
http://hg.python.org/peps/rev/83606a50ac6a
changeset: 3928:83606a50ac6a
user: Antoine Pitrou <solipsis at pitrou.net>
date: Tue Aug 16 12:12:02 2011 +0200
summary:
Add a suggestion to make more callables picklable (as multiprocessing
already does)
files:
pep-3154.txt | 17 ++++++++++++++---
1 files changed, 14 insertions(+), 3 deletions(-)
diff --git a/pep-3154.txt b/pep-3154.txt
--- a/pep-3154.txt
+++ b/pep-3154.txt
@@ -67,12 +67,20 @@
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 @@
.. [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
--
Repository URL: http://hg.python.org/peps
More information about the Python-checkins
mailing list