]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
bpo-27635: Fix pickle documentation about `__new__` not being called. (GH-19269)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Sat, 18 Apr 2020 18:14:41 +0000 (11:14 -0700)
committerGitHub <noreply@github.com>
Sat, 18 Apr 2020 18:14:41 +0000 (11:14 -0700)
Automerge-Triggered-By: @pitrou
(cherry picked from commit 482259d0dcf27714a84cf56b93977320bea7e093)

Co-authored-by: Furkan Önder <furkantahaonder@gmail.com>
Doc/library/pickle.rst
Misc/NEWS.d/next/Documentation/2020-04-01-00-27-03.bpo-27635.VwxUty.rst [new file with mode: 0644]

index f741976c93064d21ebe3296d3c34d7c8fabc3598..d638944756e7a026632f61e5ab01381b4c855200 100644 (file)
@@ -562,9 +562,9 @@ the methods :meth:`__getstate__` and :meth:`__setstate__`.
    At unpickling time, some methods like :meth:`__getattr__`,
    :meth:`__getattribute__`, or :meth:`__setattr__` may be called upon the
    instance.  In case those methods rely on some internal invariant being
-   true, the type should implement :meth:`__getnewargs__` or
-   :meth:`__getnewargs_ex__` to establish such an invariant; otherwise,
-   neither :meth:`__new__` nor :meth:`__init__` will be called.
+   true, the type should implement :meth:`__new__` to establish such an
+   invariant, as :meth:`__init__` is not called when unpickling an
+   instance.
 
 .. index:: pair: copy; protocol
 
diff --git a/Misc/NEWS.d/next/Documentation/2020-04-01-00-27-03.bpo-27635.VwxUty.rst b/Misc/NEWS.d/next/Documentation/2020-04-01-00-27-03.bpo-27635.VwxUty.rst
new file mode 100644 (file)
index 0000000..24f640b
--- /dev/null
@@ -0,0 +1,2 @@
+The pickle documentation incorrectly claimed that ``__new__`` isn't called by
+default when unpickling.