cpython: de982d8b7b15 (original) (raw)
Mercurial > cpython
changeset 98728:de982d8b7b15
Issue #24164: Document changes to __getnewargs__ and __getnewargs_ex__. [#24164]
Serhiy Storchaka storchaka@gmail.com | |
---|---|
date | Tue, 13 Oct 2015 21:26:35 +0300 |
parents | d88526aa1b29 |
children | 388483b53cde |
files | Doc/library/pickle.rst |
diffstat | 1 files changed, 13 insertions(+), 6 deletions(-)[+] [-] Doc/library/pickle.rst 19 |
line wrap: on
line diff
--- a/Doc/library/pickle.rst +++ b/Doc/library/pickle.rst @@ -488,7 +488,7 @@ methods: .. method:: object.getnewargs_ex()
- In protocols 2 and newer, classes that implements the
:meth:
__getnewargs_ex__
method can dictate the values passed to the :meth:__new__
method upon unpickling. The method must return a pair(args, kwargs)
where args is a tuple of positional arguments @@ -500,15 +500,22 @@ methods: class requires keyword-only arguments. Otherwise, it is recommended for compatibility to implement :meth:__getnewargs__
. - .. versionchanged:: 3.6
:meth:`__getnewargs_ex__` is now used in protocols 2 and 3.[](#l1.17)
+ .. method:: object.getnewargs()
- This method serve a similar purpose as :meth:
__getnewargs_ex__
but - for protocols 2 and newer. It must return a tuple of arguments
args
- which will be passed to the :meth:
__new__
method upon unpickling.
- This method serve a similar purpose as :meth:
__getnewargs_ex__
, but - supports only positional arguments. It must return a tuple of arguments
args
which will be passed to the :meth:__new__
method upon unpickling.
- In protocols 4 and newer, :meth:
__getnewargs__
will not be called if - :meth:
__getnewargs_ex__
is defined.