bpo-27635: Fix pickle documentation about __new__ not being called.… · python/cpython@482259d (original) (raw)

File tree

2 files changed

lines changed

2 files changed

lines changed

Original file line number Diff line number Diff line change
@@ -639,9 +639,9 @@ the methods :meth:`__getstate__` and :meth:`__setstate__`.
639 639 At unpickling time, some methods like :meth:`__getattr__`,
640 640 :meth:`__getattribute__`, or :meth:`__setattr__` may be called upon the
641 641 instance. In case those methods rely on some internal invariant being
642 - true, the type should implement :meth:`__getnewargs__` or
643 -:meth:`__getnewargs_ex__` to establish such an invariant; otherwise,
644 -neither :meth:`__new__` nor :meth:`__init__` will be called.
642 + true, the type should implement :meth:`__new__` to establish such an
643 +invariant, as :meth:`__init__` is not called when unpickling an
644 +instance.
645 645
646 646 .. index:: pair: copy; protocol
647 647
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
1 +The pickle documentation incorrectly claimed that ``__new__`` isn't called by
2 +default when unpickling.