bpo-27635: Fix pickle documentation about `__new__` not being called. (GH-19269)
Automerge-Triggered-By: @pitrou
(cherry picked from commit 482259d0dc
)
Co-authored-by: Furkan Önder <furkantahaonder@gmail.com>
This commit is contained in:
parent
bfda4db0d2
commit
020f2aaaea
|
@ -639,9 +639,9 @@ the methods :meth:`__getstate__` and :meth:`__setstate__`.
|
||||||
At unpickling time, some methods like :meth:`__getattr__`,
|
At unpickling time, some methods like :meth:`__getattr__`,
|
||||||
:meth:`__getattribute__`, or :meth:`__setattr__` may be called upon the
|
:meth:`__getattribute__`, or :meth:`__setattr__` may be called upon the
|
||||||
instance. In case those methods rely on some internal invariant being
|
instance. In case those methods rely on some internal invariant being
|
||||||
true, the type should implement :meth:`__getnewargs__` or
|
true, the type should implement :meth:`__new__` to establish such an
|
||||||
:meth:`__getnewargs_ex__` to establish such an invariant; otherwise,
|
invariant, as :meth:`__init__` is not called when unpickling an
|
||||||
neither :meth:`__new__` nor :meth:`__init__` will be called.
|
instance.
|
||||||
|
|
||||||
.. index:: pair: copy; protocol
|
.. index:: pair: copy; protocol
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,2 @@
|
||||||
|
The pickle documentation incorrectly claimed that ``__new__`` isn't called by
|
||||||
|
default when unpickling.
|
Loading…
Reference in New Issue