[Python-checkins] (no subject)
Furkan Önder
webhook-mailer at python.org
Sat Apr 18 14:09:14 EDT 2020
To: python-checkins at python.org
Subject: bpo-27635: Fix pickle documentation about `__new__` not being called.
(GH-19269)
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: quoted-printable
MIME-Version: 1.0
https://github.com/python/cpython/commit/482259d0dcf27714a84cf56b93977320bea7=
e093
commit: 482259d0dcf27714a84cf56b93977320bea7e093
branch: master
author: Furkan =C3=96nder <furkantahaonder at gmail.com>
committer: GitHub <noreply at github.com>
date: 2020-04-18T11:09:09-07:00
summary:
bpo-27635: Fix pickle documentation about `__new__` not being called. (GH-192=
69)
Automerge-Triggered-By: @pitrou
files:
A Misc/NEWS.d/next/Documentation/2020-04-01-00-27-03.bpo-27635.VwxUty.rst
M Doc/library/pickle.rst
diff --git a/Doc/library/pickle.rst b/Doc/library/pickle.rst
index 779b60ed4da00..a7b92bb9538d9 100644
--- a/Doc/library/pickle.rst
+++ b/Doc/library/pickle.rst
@@ -639,9 +639,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.
=20
.. index:: pair: copy; protocol
=20
diff --git a/Misc/NEWS.d/next/Documentation/2020-04-01-00-27-03.bpo-27635.Vwx=
Uty.rst b/Misc/NEWS.d/next/Documentation/2020-04-01-00-27-03.bpo-27635.VwxUty=
.rst
new file mode 100644
index 0000000000000..24f640bd4ef5f
--- /dev/null
+++ b/Misc/NEWS.d/next/Documentation/2020-04-01-00-27-03.bpo-27635.VwxUty.rst
@@ -0,0 +1,2 @@
+The pickle documentation incorrectly claimed that ``__new__`` isn't called by
+default when unpickling.
More information about the Python-checkins
mailing list