Add Alexandre's suggestions
This commit is contained in:
parent
339563b31d
commit
f484655b83
25
pep-3154.txt
25
pep-3154.txt
|
@ -60,6 +60,26 @@ would be an obvious improvement. Also, dedicated set support could help
|
|||
remove the current impossibility of pickling self-referential sets
|
||||
[2]_.
|
||||
|
||||
Calling __new__ with keyword arguments
|
||||
--------------------------------------
|
||||
|
||||
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 "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
|
||||
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.
|
||||
For globals, this would generally be ``"{}.{}".format(obj.__module__, obj.__name__)``.
|
||||
Then a new opcode can resolve that path and push the object on the stack,
|
||||
similarly to the GLOBAL opcode.
|
||||
|
||||
Binary encoding for all opcodes
|
||||
-------------------------------
|
||||
|
||||
|
@ -96,6 +116,11 @@ References
|
|||
.. [2] "Cannot pickle self-referencing sets":
|
||||
http://bugs.python.org/issue9269
|
||||
|
||||
.. [3] "pickle/copyreg doesn't support keyword only arguments in __new__":
|
||||
http://bugs.python.org/issue4727
|
||||
|
||||
.. [4] "pickle should support methods":
|
||||
http://bugs.python.org/issue9276
|
||||
|
||||
Copyright
|
||||
=========
|
||||
|
|
Loading…
Reference in New Issue