[Python-checkins] bpo-15542: Documentation incorrectly suggests __init__ called after direct __new__ call (GH-15478) (GH-15506)

Raymond Hettinger webhook-mailer at python.org
Mon Aug 26 03:19:24 EDT 2019


https://github.com/python/cpython/commit/c841fb9e065c393bba5d5505238f7e286f1dcfc6
commit: c841fb9e065c393bba5d5505238f7e286f1dcfc6
branch: 3.8
author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com>
committer: Raymond Hettinger <rhettinger at users.noreply.github.com>
date: 2019-08-26T00:19:17-07:00
summary:

bpo-15542: Documentation incorrectly suggests __init__ called after direct  __new__ call (GH-15478) (GH-15506)

(cherry picked from commit 6b16d938d6d1ccb443815e20e8812deed274dc09)

Co-authored-by: Joannah Nanjekye <33177550+nanjekyejoannah at users.noreply.github.com>

files:
M Doc/reference/datamodel.rst

diff --git a/Doc/reference/datamodel.rst b/Doc/reference/datamodel.rst
index 1dd8e42ef87e..d1702ccb6417 100644
--- a/Doc/reference/datamodel.rst
+++ b/Doc/reference/datamodel.rst
@@ -1166,10 +1166,10 @@ Basic customization
    with appropriate arguments and then modifying the newly-created instance
    as necessary before returning it.
 
-   If :meth:`__new__` returns an instance of *cls*, then the new instance's
-   :meth:`__init__` method will be invoked like ``__init__(self[, ...])``, where
-   *self* is the new instance and the remaining arguments are the same as were
-   passed to :meth:`__new__`.
+   If :meth:`__new__` is invoked during object construction and it returns an
+   instance or subclass of *cls*, then the new instance’s :meth:`__init__` method
+   will be invoked like ``__init__(self[, ...])``, where *self* is the new instance
+   and the remaining arguments are the same as were passed to the object constructor.
 
    If :meth:`__new__` does not return an instance of *cls*, then the new instance's
    :meth:`__init__` method will not be invoked.



More information about the Python-checkins mailing list