bpo-27635: Fix pickle documentation about __new__
not being called.… · python/cpython@0abb548 (original) (raw)
File tree
2 files changed
lines changed
- Misc/NEWS.d/next/Documentation
2 files changed
lines changed
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -562,9 +562,9 @@ the methods :meth:`__getstate__` and :meth:`__setstate__`. | ||
562 | 562 | At unpickling time, some methods like :meth:`__getattr__`, |
563 | 563 | :meth:`__getattribute__`, or :meth:`__setattr__` may be called upon the |
564 | 564 | instance. In case those methods rely on some internal invariant being |
565 | - true, the type should implement :meth:`__getnewargs__` or | |
566 | -:meth:`__getnewargs_ex__` to establish such an invariant; otherwise, | |
567 | -neither :meth:`__new__` nor :meth:`__init__` will be called. | |
565 | + true, the type should implement :meth:`__new__` to establish such an | |
566 | +invariant, as :meth:`__init__` is not called when unpickling an | |
567 | +instance. | |
568 | 568 | |
569 | 569 | .. index:: pair: copy; protocol |
570 | 570 |
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. |